Re: Simulating Control-Alt-Delete?
From: Alex Ionescu [397670] (alex_at_relsoft.net)
Date: 11/11/04
- Next message: Andrea: "User application video capture via kernel streaming?"
- Previous message: Jonathan Wood: "Not Getting WM_MOUSEHOVER, WM_MOUSELEAVE"
- In reply to: Richard Lewis Haggard: "Re: Simulating Control-Alt-Delete?"
- Next in thread: Doron Holan [MS]: "Re: Simulating Control-Alt-Delete?"
- Reply: Doron Holan [MS]: "Re: Simulating Control-Alt-Delete?"
- Reply: Richard Lewis Haggard: "Re: Simulating Control-Alt-Delete?"
- Reply: Richard Lewis Haggard: "Re: Simulating Control-Alt-Delete?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 10 Nov 2004 22:22:27 -0500
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
- Next message: Andrea: "User application video capture via kernel streaming?"
- Previous message: Jonathan Wood: "Not Getting WM_MOUSEHOVER, WM_MOUSELEAVE"
- In reply to: Richard Lewis Haggard: "Re: Simulating Control-Alt-Delete?"
- Next in thread: Doron Holan [MS]: "Re: Simulating Control-Alt-Delete?"
- Reply: Doron Holan [MS]: "Re: Simulating Control-Alt-Delete?"
- Reply: Richard Lewis Haggard: "Re: Simulating Control-Alt-Delete?"
- Reply: Richard Lewis Haggard: "Re: Simulating Control-Alt-Delete?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|