@mukea/uiohook-napi 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +77 -0
- package/binding.gyp +85 -0
- package/dist/index.d.ts +194 -0
- package/dist/index.js +206 -0
- package/dist/index.js.map +1 -0
- package/dist/prebuild-test-noop.d.ts +0 -0
- package/dist/prebuild-test-noop.js +3 -0
- package/dist/prebuild-test-noop.js.map +1 -0
- package/libuiohook/include/uiohook.h +457 -0
- package/libuiohook/src/darwin/input_helper.c +535 -0
- package/libuiohook/src/darwin/input_helper.h +203 -0
- package/libuiohook/src/darwin/input_hook.c +1436 -0
- package/libuiohook/src/darwin/post_event.c +303 -0
- package/libuiohook/src/darwin/system_properties.c +479 -0
- package/libuiohook/src/logger.c +40 -0
- package/libuiohook/src/logger.h +32 -0
- package/libuiohook/src/windows/input_helper.c +913 -0
- package/libuiohook/src/windows/input_helper.h +146 -0
- package/libuiohook/src/windows/input_hook.c +722 -0
- package/libuiohook/src/windows/post_event.c +248 -0
- package/libuiohook/src/windows/system_properties.c +231 -0
- package/libuiohook/src/x11/input_helper.c +1846 -0
- package/libuiohook/src/x11/input_helper.h +108 -0
- package/libuiohook/src/x11/input_hook.c +1116 -0
- package/libuiohook/src/x11/post_event.c +427 -0
- package/libuiohook/src/x11/system_properties.c +494 -0
- package/package.json +60 -0
- package/prebuilds/darwin/darwin-arm64/@mukea+uiohook-napi.node +0 -0
- package/prebuilds/darwin/darwin-x64/@mukea+uiohook-napi.node +0 -0
- package/prebuilds/linux/linux-arm64/@mukea+uiohook-napi.node +0 -0
- package/prebuilds/linux/linux-x64/@mukea+uiohook-napi.node +0 -0
- package/prebuilds/windows/win32-x64/@mukea+uiohook-napi.node +0 -0
- package/src/lib/addon.c +337 -0
- package/src/lib/napi_helpers.c +51 -0
- package/src/lib/napi_helpers.h +53 -0
- package/src/lib/uiohook_worker.c +200 -0
- package/src/lib/uiohook_worker.h +12 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/* libUIOHook: Cross-platform keyboard and mouse hooking from userland.
|
|
2
|
+
* Copyright (C) 2006-2023 Alexander Barker. All Rights Reserved.
|
|
3
|
+
* https://github.com/kwhat/libuiohook/
|
|
4
|
+
*
|
|
5
|
+
* libUIOHook is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU Lesser General Public License as published
|
|
7
|
+
* by the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
*
|
|
10
|
+
* libUIOHook is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/***********************************************************************
|
|
20
|
+
* The following code is based on code provided by Marc-André Moreau
|
|
21
|
+
* to work around a failure to support dead keys in the ToUnicode() API.
|
|
22
|
+
* According to the author some parts were taken directly from
|
|
23
|
+
* Microsoft's kbd.h header file that is shipped with the Windows Driver
|
|
24
|
+
* Development Kit.
|
|
25
|
+
*
|
|
26
|
+
* The original code was substantially modified to provide the following:
|
|
27
|
+
* 1) More dynamic code structure.
|
|
28
|
+
* 2) Support for compilers that do not implement _ptr64 (GCC / LLVM).
|
|
29
|
+
* 3) Support for Wow64 at runtime via 32-bit binary.
|
|
30
|
+
* 4) Support for contextual language switching.
|
|
31
|
+
*
|
|
32
|
+
* I have contacted Marc-André Moreau who has granted permission for
|
|
33
|
+
* his original source code to be used under the Public Domain. Although
|
|
34
|
+
* the libUIOHook library as a whole is currently covered under the LGPLv3,
|
|
35
|
+
* please feel free to use and learn from the source code contained in the
|
|
36
|
+
* following functions under the terms of the Public Domain.
|
|
37
|
+
*
|
|
38
|
+
* For further reading and the original code, please visit:
|
|
39
|
+
* http://legacy.docdroppers.org/wiki/index.php?title=Writing_Keyloggers
|
|
40
|
+
* http://www.techmantras.com/content/writing-keyloggers-full-length-tutorial
|
|
41
|
+
*
|
|
42
|
+
***********************************************************************/
|
|
43
|
+
|
|
44
|
+
#ifndef _included_input_helper
|
|
45
|
+
#define _included_input_helper
|
|
46
|
+
|
|
47
|
+
#include <limits.h>
|
|
48
|
+
#include <windows.h>
|
|
49
|
+
|
|
50
|
+
#ifndef LPFN_ISWOW64PROCESS
|
|
51
|
+
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
|
|
52
|
+
#endif
|
|
53
|
+
|
|
54
|
+
typedef void* (CALLBACK *KbdLayerDescriptor) (VOID);
|
|
55
|
+
|
|
56
|
+
#define CAPLOK 0x01
|
|
57
|
+
#define WCH_NONE 0xF000
|
|
58
|
+
#define WCH_DEAD 0xF001
|
|
59
|
+
|
|
60
|
+
#ifndef WM_MOUSEHWHEEL
|
|
61
|
+
#define WM_MOUSEHWHEEL 0x020E
|
|
62
|
+
#endif
|
|
63
|
+
|
|
64
|
+
typedef struct _VK_TO_WCHARS {
|
|
65
|
+
BYTE VirtualKey;
|
|
66
|
+
BYTE Attributes;
|
|
67
|
+
WCHAR wch[];
|
|
68
|
+
} VK_TO_WCHARS, *PVK_TO_WCHARS;
|
|
69
|
+
|
|
70
|
+
typedef struct _LIGATURE {
|
|
71
|
+
BYTE VirtualKey;
|
|
72
|
+
WORD ModificationNumber;
|
|
73
|
+
WCHAR wch[];
|
|
74
|
+
} LIGATURE, *PLIGATURE;
|
|
75
|
+
|
|
76
|
+
typedef struct _VK_TO_BIT {
|
|
77
|
+
BYTE Vk;
|
|
78
|
+
BYTE ModBits;
|
|
79
|
+
} VK_TO_BIT, *PVK_TO_BIT;
|
|
80
|
+
|
|
81
|
+
typedef struct _MODIFIERS {
|
|
82
|
+
PVK_TO_BIT pVkToBit; // __ptr64
|
|
83
|
+
WORD wMaxModBits;
|
|
84
|
+
BYTE ModNumber[];
|
|
85
|
+
} MODIFIERS, *PMODIFIERS;
|
|
86
|
+
|
|
87
|
+
typedef struct _VSC_VK {
|
|
88
|
+
BYTE Vsc;
|
|
89
|
+
USHORT Vk;
|
|
90
|
+
} VSC_VK, *PVSC_VK;
|
|
91
|
+
|
|
92
|
+
typedef struct _VK_TO_WCHAR_TABLE {
|
|
93
|
+
PVK_TO_WCHARS pVkToWchars; // __ptr64
|
|
94
|
+
BYTE nModifications;
|
|
95
|
+
BYTE cbSize;
|
|
96
|
+
} VK_TO_WCHAR_TABLE, *PVK_TO_WCHAR_TABLE;
|
|
97
|
+
|
|
98
|
+
typedef struct _DEADKEY {
|
|
99
|
+
DWORD dwBoth;
|
|
100
|
+
WCHAR wchComposed;
|
|
101
|
+
USHORT uFlags;
|
|
102
|
+
} DEADKEY, *PDEADKEY;
|
|
103
|
+
|
|
104
|
+
typedef struct _VSC_LPWSTR {
|
|
105
|
+
BYTE vsc;
|
|
106
|
+
WCHAR *pwsz; // __ptr64
|
|
107
|
+
} VSC_LPWSTR, *PVSC_LPWSTR;
|
|
108
|
+
|
|
109
|
+
typedef struct tagKbdLayer {
|
|
110
|
+
PMODIFIERS pCharModifiers; // __ptr64
|
|
111
|
+
PVK_TO_WCHAR_TABLE pVkToWcharTable; // __ptr64
|
|
112
|
+
PDEADKEY pDeadKey; // __ptr64
|
|
113
|
+
PVSC_LPWSTR pKeyNames; // __ptr64
|
|
114
|
+
PVSC_LPWSTR pKeyNamesExt; // __ptr64
|
|
115
|
+
WCHAR **pKeyNamesDead; // __ptr64
|
|
116
|
+
USHORT *pusVSCtoVK; // __ptr64
|
|
117
|
+
BYTE bMaxVSCtoVK;
|
|
118
|
+
PVSC_VK pVSCtoVK_E0; // __ptr64
|
|
119
|
+
PVSC_VK pVSCtoVK_E1; // __ptr64
|
|
120
|
+
DWORD fLocaleFlags;
|
|
121
|
+
BYTE nLgMax;
|
|
122
|
+
BYTE cbLgEntry;
|
|
123
|
+
PLIGATURE pLigature; // __ptr64
|
|
124
|
+
DWORD dwType;
|
|
125
|
+
DWORD dwSubType;
|
|
126
|
+
} KBDTABLES, *PKBDTABLES; // __ptr64
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
extern SIZE_T keycode_to_unicode(DWORD keycode, PWCHAR buffer, SIZE_T size);
|
|
130
|
+
|
|
131
|
+
//extern DWORD unicode_to_keycode(wchar_t unicode);
|
|
132
|
+
|
|
133
|
+
extern unsigned short keycode_to_scancode(DWORD vk_code, DWORD flags);
|
|
134
|
+
|
|
135
|
+
extern DWORD scancode_to_keycode(unsigned short scancode);
|
|
136
|
+
|
|
137
|
+
/* Help track how much rotation should be applied to a scroll wheel event. */
|
|
138
|
+
extern int16_t get_scroll_wheel_rotation(DWORD data, uint8_t direction);
|
|
139
|
+
|
|
140
|
+
// Initialize the locale list and wow64 pointer size.
|
|
141
|
+
extern int load_input_helper();
|
|
142
|
+
|
|
143
|
+
// Cleanup the initialized locales.
|
|
144
|
+
extern int unload_input_helper();
|
|
145
|
+
|
|
146
|
+
#endif
|