C
C
Creat1ve2019-01-23 01:43:39
C++ / C#
Creat1ve, 2019-01-23 01:43:39

How to catch pressing CTRL+ALT+DEL (SetWindowsHookEx)?

Good day.
How to catch pressing CTRL+ALT+DEL?
I do it like this:

SetWindowsHookEx(WH_KEYBOARD_LL, ... ... ... )
...
int callHookProc(int nCode, DWORD wParam, DWORD lParam)
{
    switch (wParam) {
        case WM_KEYDOWN: 
        ...
    }
}

Any combination works except for the above. There are no syntactic and logical errors, Google suggested that it was blocked by small software. Are there any options?
(And no, I don't write viruses. I want to teach WinPE to open the task manager using the CTRL+ALT+DEL key combination)
UPD: Solved. How? And hell knows. While fiddling with the code and getting confused in the DLLs from the bulldozer, I rewrote all the same lines "just in case" and it worked. What's in the main, what's in PE. I mean, it's not a bug. Apparently, after all, somewhere I made a mistake at that time.
switch (wParam) {
        case WM_KEYDOWN: {
            KBDLLHOOKSTRUCT kbdStruct = *((KBDLLHOOKSTRUCT*)lParam);
            if (kbdStruct.vkCode == VK_DELETE)
            {
                boolean b = bool( uchar(GetKeyState(VK_MENU)) >> 7 );
                b = b && ( bool( uchar(GetKeyState(VK_LCONTROL)) >> 7 )
                           || bool( uchar(GetKeyState(VK_RCONTROL)) >> 7 ) );
                if (b) { QWinHook::m_This->call_taskmgr(); }
            }
            break;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2019-01-23
@jcmvbkbc

How to catch pressing CTRL+ALT+DEL?

In Windows by usual means - in any way. Because it is secure attention sequence. It is handled by winlogon or the GINA loaded into it. Read from here .
Write and install your own GINA.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question