Skip to content

Commit 4fe8891

Browse files
committed
cleaned up the sources a bit
1 parent 2208a52 commit 4fe8891

1 file changed

Lines changed: 3 additions & 35 deletions

File tree

src/main.cpp

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,44 +13,12 @@
1313
#include "systemtray.h"
1414

1515
/*
16-
* *NOT IT* The idea here is to use keybd_event() instead of SendInput() to avoid the problem of
17-
* some (games in particular) applications not responding well to SendInput() while
18-
* also playing nice with the previous code written for SendInput
19-
* https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-keybd_event
20-
*
21-
* HAS THE SAME ISSUE
22-
* The games might be monitoring the status of LLKHF_INJECTED and ignoring it.
23-
* Modify this flag in the llkeyboardproc if it is our custom release keys?
24-
*
25-
* As written in "Practical Video Game Bots: Automating Game Processes..." by Ilya Shpigor p.g. 90:
26-
* "All keyboard events, which are produced by the SendInput and keybd_event WinAPI functions, have
27-
* the LLKHF_INJECTED flag in the KBDLLHOOKSTRUCT structure. One the other hand, keyboard events,
28-
* which are produced by a keyboard driver, do not have this flag. This flag is set on the Windows
29-
* kernel level, and it is impossible to disable the flag on the WinAPI level."
30-
*
31-
* We have some possibilities in that we could create a virtual keyboard driver for our application
32-
* or patch the windows kernel. However, these are pretty extreme for our purposes and would likely
33-
* not play well with some anticheats. If we really wanted to remove this flag we could attempt to
34-
* do so in llkeyboardproc as noted earlier. However, this may not fix the issue either as:
35-
*
36-
* *NOT IT* SendInput and keybd_event are susceptible to User Interface Privilege Isolation (UIPI). An
16+
* SendInput and keybd_event are susceptible to User Interface Privilege Isolation (UIPI). An
3717
* application running at a higher integrity level than an application calling SendInput will
3818
* not receive this input.
39-
*
40-
* Also I have seen reports that using scancode instead of the virtual keycode could fix the
41-
* keyup not registering problem. See the keybd_event microsoft docs for more.
42-
* https://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html
43-
* for a list of scancodes (1.4 ordinary scancodes) section
44-
* *THIS WAS IT*
19+
* Maybe run AutoRun with administrator permissions if it doesn't work with some apps?
4520
*/
4621

47-
/*
48-
* TODO Known Issues:
49-
* - games like Minecraft that rely more on the actual key up and key down messages rather than key repeats
50-
* still hold the keys even when repeating is done (must manually press the held key and release to stop holding)
51-
* - note: I now think that the game is just not listening to our key events and the only reason
52-
* it is holding the keys is because we consumed the key up event
53-
*/
5422
#ifdef AUTORUN_DEBUG
5523
// can use these as well: __FILE__, __LINE__ and __func__
5624
#define log(x, ...) printf(x, __VA_ARGS__)
@@ -144,7 +112,7 @@ void disable_hold_task() {
144112
delete[] inputsBuffer;
145113
holdTask = NULL;
146114

147-
// must zero memory here because we do not track key events whilst this task is enabled TODO may not be necessary
115+
// zero memory here because we do not track key events whilst this task is enabled (not entirely necessary as we run this synchronously with llkeyboardproc)
148116
memset(KEY_STATES, 0, KEY_STATE_BUFFER_SIZE);
149117
log("toggled off\n");
150118
}

0 commit comments

Comments
 (0)