Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Sending CTRL+ALT+DEL inside a Windows NT Service (C++)

Posted on 2004-08-16
7
Medium Priority
?
842 Views
Last Modified: 2009-07-29
I am writing a Windows NT service that needs to emulate (send) at some point a secure attention sequence (SAS), i.e. CTRL+ALT+DEL. The service will run on Windows NT, Windows 2000 and Windows XP. I need a code in C++ (I am using Visual C++).

Regards,

0
Comment
Question by:POLITEC
  • 4
  • 3
7 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 11811548
You won't be able to do that., since the logon desktop is secured and therefore inaccessible for (theoretically) all SW. This might work only from within a GINA. VC++ comes with a sample that illustrates how to write a custom GINA, see also http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthn/security/winlogon_and_gina.asp ("Winlogon and GINA"). What is your final goal? Maybe there's an easier way.
0
 

Author Comment

by:POLITEC
ID: 11811683
Dear jkr,

The final goal is to automatically popup a "logon dialog" to the user. At this point I can’t replace a GINA.

Regards,
0
 
LVL 86

Expert Comment

by:jkr
ID: 11811860
Well, the 'logon' dialog will be brought on by the GINA anyway, there should be no need to do that manually. Under what circumstances do you need to do that and for what purpose?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:POLITEC
ID: 11813033
Dear jkr,

We know that the workstation will be looked, and we need to popup a 'logon' dialog to the user automatically, in order to the user fill the login credentials.

Regards,
0
 
LVL 86

Expert Comment

by:jkr
ID: 11813260
When the WS is locked, the system will prompt for a username and password anyway... and even that is done by the GINA.
0
 

Author Comment

by:POLITEC
ID: 11813488
Dear Jkr,

I am looking a way to simulate an CTRL+ALT+DEL, as using sendkeys , or keyboard API. I can’t replace the GINA, as I am using a custom GINA at this moment. I can not disclose more information about the application, but the bottom line is: I need to send the secure attention sequence using a code inside a service.

Regards,
0
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 11964404
OK, you should never give up - I accidentially stubled over how VNC fakes a CTRL+ALT+DEL message:

// 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

916 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