Simulate a Control-Alt-Delete Key Sequence in Vista and XP

Can I simulate C # / C ++ Control + Alt + Delete code in Vista? When is UAC on / off? How is this done in XP?

Can you provide sample code that works in Vista?

+4
source share
5 answers

Existing code for simulating the Secure Attention (SAS) sequence, which most people call the control alt delete or ctrl-alt-del, no longer works in Windows Vista. It looks like Microsoft is offering a library that exports a function called SimulateSAS (). It is not publicly accessible, and one must request it by sending an email to saslib@microsoft.com.

There is a similar library with the following functions:

  • Works with and without User Account Control (UAC)
  • Support for current, console and any terminal server session
  • No driver needed
  • The calling application does not need to sign or manifest
  • Support for multiple languages

Please note that this library is not free. Meanwhile, you can contact info@simulatesas.com if you are interested in it.

+5
source

Please use the information below, " saslib@microsoft.com " is outdated and less likely to receive replies. The following is the information.

Starting with the publicly available Windows 7 operating system and associated software development kit (SDK), SAS functionality for Vista applications will only be available through the Windows SDK. SASLIB and saslib email support will be discontinued.

Information on how to download the platform SDK can be found on the Microsoft Download Center for "Windows SDK for Windows 7 and .Net Framework 3.5 SP1" at the following link: http://www.microsoft.com/downloads/details.aspx? FamilyID = c17ba869-9671-4330-a63e-1fd44e0e2505 & displaylang = en .

After installing this SDK, you will find the redistributable sas.dll in the redist directory:

\ Program Files \ Microsoft SDK \ Windows \ v7.0 \ redist \ x86 \ sas.dll

\ Program Files \ Microsoft SDK \ Windows \ v7.0 \ redist \ amd64 \ sas.dll

\ Program Files \ Microsoft SDK \ Windows \ v7.0 \ redist \ ia64 \ sas.dll

+2
source

PostMessage (HWND_BROADCAST, WM_HOTKEY, 0, MAKELONG (MOD_ALT | MOD_CONTROL, VK_DELETE));

You get PostMessage from user32 dll

edit: a CodeProject article that has code for it

edit: There is some discussion from VNC about why this will not work in Vista and how to configure UAC to allow this.

0
source

You should call the following code only from the maintenance process.

HDESK desktop = OpenDesktopW(L"Winlogon", 0, TRUE, DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL | DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS | DESKTOP_SWITCHDESKTOP | GENERIC_WRITE); int result = SetThreadDesktop(desktop); if (result) { HMODULE sasdll = LoadLibraryA("sas.dll"); if (sasdll) { typedef void(__stdcall * SendSAS_t)(BOOL); SendSAS_t sendSAS = (SendSAS_t)GetProcAddress(sasdll, "SendSAS"); if (sendSAS) sendSAS(FALSE); } } CloseDesktop(desktop); 
0
source

Source: https://habr.com/ru/post/1277083/


All Articles