Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Hardware keypresses does not detectable by other programs #1

Open
kfirfer opened this issue Apr 10, 2022 · 7 comments
Open

Hardware keypresses does not detectable by other programs #1

kfirfer opened this issue Apr 10, 2022 · 7 comments

Comments

@kfirfer
Copy link

kfirfer commented Apr 10, 2022

Disclaimer: I have zero C# knowledge

While I running the program, he somehow remove the capability to recognize key pressed, even physical , with other programs

For example, after running the program, This python standard code doesn't works:

        if keyboard.is_pressed("del"):
            os._exit(1)

'is_pressed' function doesn't care if it came from the physical keyboard nor injected

@TetteDev
Copy link
Owner

Yeah, there is a very big issue with the code (mine)

The code currently prevents any other program, which registered a Low level keyboard/mouse hook with SetWindowsHook prior to our program, to recieve any low level mouse/keyboard kernel events

To remedy this, the program not receiving any mouse/keyboard events, must remove their hooks, and then reinstate them (placing their hook procedure before our program in the hook chain)

tldr; the code in this repo should not be used as it is a bit misleading

@TetteDev
Copy link
Owner

The reason this happens is this line;
https://github.com/Sadulisten/LowLevelMouseHook-Example/blob/master/LLMHREmover/Program.cs#L175

Dont know what I thought when I wrote this, but dereferencing the parameter lParam and passing it back as a pointer to callnexthook makes no sense

@TetteDev
Copy link
Owner

If it were to be done properly, it would simply pass the lParam, without doing any stupid stuff, right back into Callnexthook

@TetteDev
Copy link
Owner

I have "updated" the code in the repo.
Now there shouldn't be any of the previous stupidities mentioned before, code is untested though, so it might not work but in theory it should (hopefully)

Have a good day/night

@kfirfer
Copy link
Author

kfirfer commented Apr 10, 2022

Thanks for the fast respond !

I succeeded to run your updated code, and the python code works now without a problem

But now its seems other programs can detect if it came from physical/other process

Tested with this repo detector example:
https://github.com/errorc0de404/DetectMouseEvents

Wish I could contribute, I just monkey copy pasted =/

@TetteDev
Copy link
Owner

Can you try doing these two things;

  1. Start the detector first, and then this program; and report if it works
  2. Start this program first, and then the detector; and report if it works

If neither of these works, then I am afraid this no longer is a viable method for removing llmhf/llkhf flags unfortunately

@kfirfer
Copy link
Author

kfirfer commented Apr 10, 2022

Tried both situations, also as Administrator but he still detected

Thanks anyway !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants