Solved

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

Posted on 2004-08-16
7
807 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

863 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

27 Experts available now in Live!

Get 1:1 Help Now