tags:

views:

497

answers:

5

Hi all, first things first this problem has stumped me for about a week and i would love a working answer!

I would like to know how to invoke the Windows Security Dialog (press ctrl+alt+del on a windows workstation NOTE: i dont want the task manager!) programatically.

ON AN XP WORKSTATION, don't worry about Win7 or Vista

Ideally with a quick example in C# (or VB.NET if you must)

Ive searched many of the DLL's such as msgina.dll and i can't find it anywhere!

Alternatively Just invoking the change password screen would be nice!

Many thanks internets in advance

A: 

You might want to take a look at the SendInput hook in User32: http://msdn.microsoft.com/en-us/library/ms646310(VS.85).aspx and http://pinvoke.net/default.aspx/user32/SendInput.html

statichippo
ctrl+alt+del can't be emulated from software. It causes hardware interrupt which is catched by OS kernel
werewindle
i guess you can only send the message not get.
drorhan
@drorhan, no. It called *secure attention sequence* and must be produced by user behind physical keyboard for security reasons
werewindle
i bet a driver could insert those key strokes to the hardware input stream.
Segfault
A: 

I would imagine something like this, get the handle of the desktop, using 'GetDesktopWindow', make sure the focus is set to the handle, and Send a keystroke 'Ctrl+Alt+Del' using 'SendInput' or use the 'SendMessage' to send the keystrokes to that handle returned by GetDesktopWindow. It is not guaranteed to work as that is top-off-my-head.

Hope this helps, Best regards, Tom.

tommieb75
A: 

Here is a doc for Custom Login Experience

http://msdn.microsoft.com/tr-tr/magazine/cc163489%28en-us%29.aspx

may it can give an idea.

drorhan
+2  A: 

You can try call WlxLoggedOnSAS function from GINA or WlxSasNotify from WinLogon. But, I afraid it won't work. But, maybe it will lead you to working method. And it definitely will not work in Vista/W7.

In other side, it might be that Windows Security Dialog can be called only by secure attention sequence ( ctrl+alt+del) by securytt reasons.

werewindle
+1  A: 

Security features might be standing in your way to programmatically manage security-related features like Security Dialog through CtrlAltDel. I've been running into the same kinds of problems.

About your request to invoke password change dialog.

IADsUser

"designed to represent and manage an end-user account on a network [and locally]."

If you find yourself short on solutions, you might whip up your own quick Windows form with password fields and communicate with the Windows IADsUser Interface using the WinNT provider to bind to a local (instead of network) user account on the XP machine.

GetObject("WinNT://MYCOMPUTER/jeffsmith,user") //WinNT provider

... and use the ChangePassword(..) method (links to code sample).

usr.ChangePassword szOldPass, szNewPass

If you're trying to invoke the Windows features directly to cause the user to trust the process then admittedly a custom form for changing a password might look a bit goofy.

RunDLL32

Another avenue you might try is programmatically invoking RunDLL32.exe at the command line and targeting the correct Win DLL to bring up the password change dialog box. One forum said the following works in XP if SP2 isn't installed. I can't test it because I'm on Vista.

rundll32.exe shell32.dll,Control_RunDLL password.cpl

You can Google for many of these, however it does seem to come up short as far as changing the password or invoking Windows security dialog.

Microsoft's info about Run32Dll

John K