Solved

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

Posted on 2004-08-16
7
810 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

785 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