Solved

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

Posted on 2004-08-16
7
804 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now