Block user input (keyboard & mouse)

c++ / delphi package - dll injection and api hooking
Post Reply
dudul
Posts: 27
Joined: Wed Sep 09, 2015 3:00 pm

Block user input (keyboard & mouse)

Post by dudul »

Hi,
Is it possible to block the user input, like keyboard and mouse?

(sorry for the double post)

Thank you in advance
iconic
Site Admin
Posts: 1065
Joined: Wed Jun 08, 2005 5:08 am

Re: Block user input (keyboard & mouse)

Post by iconic »

You're probably looking for an API such as BlockInput()
Blocks keyboard and mouse input events from reaching applications.
https://msdn.microsoft.com/en-us/librar ... 85%29.aspx

--Iconic
dudul
Posts: 27
Joined: Wed Sep 09, 2015 3:00 pm

Re: Block user input (keyboard & mouse)

Post by dudul »

I meant for a global hook, not just for my application.

My purpose is to block the CTRL+ALT+DELETE (for example) in some situations.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Block user input (keyboard & mouse)

Post by madshi »

I doubt that a user mode API hook can block Ctrl+Alt+Delete. I wouldn't know which API to hook for that to work. I'm not sure that there is a simple API for that, either, but I don't know for sure. You may have to write a driver to block Ctrl+Alt+Delete, but I don't really know.

I hope this is for a legit purpose? Blocking Ctrl+Alt+Delete sounds rather agressive/suspicious.
iconic
Site Admin
Posts: 1065
Joined: Wed Jun 08, 2005 5:08 am

Re: Block user input (keyboard & mouse)

Post by iconic »

CTRL+ALT+DEL is a security combination and it's not easily intercepted. If just anyone could intercept it there would be a massive security hole in the OS. You've a few choices...

[1] Subclass Winlogon's SAS window and intercept the key press combination there (on newer OSs such as Windows 8.1 Winlogon is now a protected process)
[2] Hook the existing GINA or replace it with your own GINA DLL that can capture it
[3] Write a keyboard filter driver

P.S: SetWindowsHookEx(WH_KEYBOARD_LL) will not work either

--Iconic
Post Reply