[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to emulate a CTRL+ALT+DEL Sequence (secure attention sequence)

Posted on 2004-08-17
6
Medium Priority
?
1,158 Views
Last Modified: 2013-12-03
I am writing a Windows NT service that needs to popup the standard “user logon” dialog box.

I know in advance that the workstation is locked. The basic idea is to emulate a “secure attention sequence”, i.e. CTRL+ALT+DEL. The user will be responsible for fill the login credentials. I would like to know, for example, if I can call a function on Winlogon.exe , or the standard Gina (msgina.dll) , for example.

The premises are:

1.      I can’t replace the GINA
2.      I need a code that works inside a service (I am using Microsoft Visual C++).

Regards,
0
Comment
Question by:POLITEC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 8

Expert Comment

by:adg080898
ID: 11827012
The whole idea of Ctrl+Alt+Del to bring up the login is to *prevent* programmatically opening the login dialog. Of course, anything is possible.
0
 
LVL 8

Expert Comment

by:adg080898
ID: 11827030
Have you tried keybd_event?

// Press the three keys down
keybd_event(VK_CONTROL, MapVirtualKey(VK_CONTROL, 0), 0, 0);
keybd_event(VK_MENU, MapVirtualKey(VK_MENU, 0), 0, 0);
keybd_event(VK_DELETE, MapVirtualKey(VK_DELETE, 0), 0, 0);

// Release the keys
keybd_event(VK_CONTROL, MapVirtualKey(VK_CONTROL, 0), KEYEVENTF_KEYUP, 0);
keybd_event(VK_MENU, MapVirtualKey(VK_MENU, 0), KEYEVENTF_KEYUP, 0);
keybd_event(VK_DELETE, MapVirtualKey(VK_DELETE, 0), KEYEVENTF_KEYUP, 0);

I don't have any service source code handy to test it, but it should work. The docs for keybd_event say that the keyboard *driver* calls this to inject input, so it may work.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/KeyboardInputFunctions/keybd_event.asp
0
 
LVL 86

Expert Comment

by:jkr
ID: 11827051
I feel bad to state the same again as in your very Q in the C++ area, but: The logon desktop is secured quite "heavily". You cannot use any of the above functions successfully without gaining access to that very desktop. and, that is not possible.
0
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 12046663
Actually, there is a solution that I posted at http:Q_21095286.html

// Static routine used to fool Winlogon into thinking CtrlAltDel was pressed

void *
SimulateCtrlAltDelThreadFn(void *context)
{
     HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());

     // Switch into the Winlogon desktop
     if (!vncService::SelectDesktop("Winlogon"))
     {
          vnclog.Print(LL_INTERR, VNCLOG("failed to select logon desktop\n"));
          return FALSE;
     }

     vnclog.Print(LL_ALL, VNCLOG("generating ctrl-alt-del\n"));

     // Fake a hotkey event to any windows we find there.... :(
     // Winlogon uses hotkeys to trap Ctrl-Alt-Del...
     PostMessage(HWND_BROADCAST, WM_HOTKEY, 0, MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE));

     // Switch back to our original desktop
     if (old_desktop != NULL)
          vncService::SelectHDESK(old_desktop);

     return NULL;
}

ant the related USENET posting at http://groups.google.com/groups?lr=&ie=UTF-8&selm=3F9D5000.303%40davebsoft.com
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question