Re: Simulating Control-Alt-Delete?

From: Richard Lewis Haggard (HaggardAtWorldDotStdDotCom)
Date: 11/11/04


Date: Thu, 11 Nov 2004 15:28:18 -0500

I was wondering if it might be possible to send the CAD straight to the
Winlogon.exe window or not.

As part of my experimentation, I wrote up a little thing that iterated
through all workstations, all desktops and all top level windows.
Unexpectedly, this routine returned only two desktops, default and
disconnect. I was expecting four desktops, one for the gina, one for the
screen saver, one for the user and one for the services. Also unexpectedly,
the WinLogon window didn't show. Could it be that this routine was not being
permitted to iterate all desktops and windows?
===
Richard Lewis Haggard

"Alex Ionescu [397670]" <alex@relsoft.net> wrote in message
news:eyFMt25xEHA.3212@TK2MSFTNGP09.phx.gbl...
> Richard Lewis Haggard wrote:
> > I'm making an automated test program that will exercise a suite of
programs,
> > one of which is a replacement for MSGINA. That complicates things
> > considerably since it will have to inject keyboard SAS events
> > (Control-Alt-Delete) and survive across desktops.
>
> So you basically want a way to show your GINA replacement as if the user
> had pressed CAD?
>
> >
> > I think I can make the actual program itself a service and so it should
be
> > able to operate on both the default desktop (the one that the logon box
> > appears on) and the user's own desktop. Being a service, there will be
> > issues with sending keystrokes/mouse messages that are to emulate human
> > interaction but it shouldn't be insurmountable.
>
> If you make it interactive and do a lot of hacking (and violate service
> rules) you would get it to work.
>
> >
> > The only unknown that I'm concerned about is the actual
Control-Alt-Delete
> > sequence itself. I've solved this problem years ago back in the stone
age
> > when women were women, men were men and sheep were afraid by writing a
> > keyboard driver that could be commanded to send key down/up sequences to
the
> > system as though the physical keyboard itself had received human
keystroke
> > action. I don't want to go that far this time because the program is
going
> > to have to run generically, not just on a particular hardware
configuration.
>
> A keyboard filter hook is pretty generic, although injecting keystrokes
> is a bit harder since you'll probably need a full virtual driver. In any
> case, I don't see why they woudl be stuck to a particular hardware
> configuration. You actually run more risk of not having it run on
> general configurations by playing around with services that inject
> keystrokes.
>
> Anyways, since it looks like you need this for legimiate reasons, I'll
> give you my answer. It's not pretty, but it works up to Longhorn (I
> haven't tested on that OS). IMO it is the nicest.
>
> Write this part of your test suite as a DLL, and add it to AppInit_DLLs.
> Give it a shared section or some other way in which you plan to
> communicate with it. After system startup, your DLL will live inside
> Winlogon. Your process has to load the DLL (it automatically will), and
> then somehow communicate with the other DLL (This is easiest by using
> shared sections, much like creating a hook dlls). You need to tell the
> DLL inside Winlogon to:
>
> hSasWnd = FindWindow("SAS Window class", "SAS window");
> SendMessage(hSasWnd, WM_HOTKEY, 0, MAKELONG(MOD_CONTROL | MOD_ALT,
> VK_DELETE));
>
> If you really want to get ugly and lean, skip the whole DLL part and
> open a handle to winlogon, use
> CreateRemotethread+WriteProcessMemory+VirtualAllocEx to allocate memory,
> write the above code (in ASM os really neat C, making sure not to make
> any assumptions about the environment, remember, you're running in
> outsider memory), and then call CreateRemoteThread to execute those
> lines. Done properly, this is something like 10 lines of code and
> provides an instant way of faking Ctrl-Alt-Del. The nicer, more
> recommended way is to use AppInit_DLLs.
>
> I would pick this method over a driver, because if a User-Mode app
> messes up, the damage is much worse then if a driver messes up.
>
> There's another method which will probably work for any version of NT
> that will ever be made, but I don't want to get into it.
>
> --
> Best regards,
> Alex Ionescu,
> President, Relsoft Technologies
> Kernel Developer, ReactOS
> http://www.reactos.com



Relevant Pages

  • Re: Threading problem with Garbage Collector
    ... It itself controls calls to a DLL ... "A"), it loads the DLL, which in turn then creates a window (it needs to, ... Disposemethod it uses the label window to synchronize the FreeLibrary ... delegate void DelegateKillDLL(); ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: VB6 runtime is supported on Windows 7
    ... The settings window was fairly extensive ... DLL and the settings are organized into a UDT rather ...
    (microsoft.public.vb.general.discussion)
  • Re: window from win32 dll
    ... handle of the DLL, according to the documentation. ... instance of the window to share the one-and-only DC that is a class DC? ... For example, you are presuming RegisterClassEx ... .HINSTANCE storing in dllmain HMODULE ...
    (microsoft.public.vc.mfc)
  • Re: Difference between WM_APP and WM_USER
    ... broadcasting or even 'broadcasting' such a message is outrageously ... DLL that uses WM_APP+7 as a message to a designated window. ... dll to use this message range. ...
    (microsoft.public.vc.mfc)
  • Re: X arch
    ... maximized window spreads over two monitors. ... > and use one for one X server, and the other for the other. ... > keyboard and mouse asociated with some VT. ... > if the two desktops are served from completely different machines). ...
    (comp.os.linux.x)