Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-08-16
7
Medium Priority
?
835 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
[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
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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.

670 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