-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathkernel32-AHKV2.ahk
85 lines (77 loc) · 2.23 KB
/
kernel32-AHKV2.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
ReadDirectoryChangesW(
hDirectory,
lpBuffer,
nBufferLength,
bWatchSubtree,
dwNotifyFilter,
byref lpBytesReturned,
lpOverlapped,
lpCompletionRoutine) {
if !dllcall( 'kernel32.dll\ReadDirectoryChangesW',
'ptr', hDirectory, ; HANDLE
'ptr', lpBuffer, ; LPVOID
'uint', nBufferLength, ; DWORD
'int' , bWatchSubtree, ; BOOL
'uint', dwNotifyFilter, ; DWORD
'uint*', lpBytesReturned, ; LPDWORD
'ptr' , lpOverlapped, ; LPOVERLAPPED
'ptr' , lpCompletionRoutine, ; LPOVERLAPPED_COMPLETION_ROUTINE
'int' ; BOOL
)
throw exception(a_thisfunc . ' failed.', -1, a_lasterror)
return true
}
CreateFileW(
lpFileName,
dwDesiredAccess,
dwShareMode,
lpSecurityAttributes,
dwCreationDisposition,
dwFlagsAndAttributes,
hTemplateFile) {
local
if !h := dllcall('kernel32.dll\CreateFileW',
'ptr', lpFileName, ; LPCWSTR
'uint', dwDesiredAccess, ; DWORD
'uint', dwShareMode, ; DWORD
'ptr', lpSecurityAttributes, ; LPSECURITY_ATTRIBUTES
'uint', dwCreationDisposition, ; DWORD
'uint', dwFlagsAndAttributes, ; DWORD
'ptr', hTemplateFile, ; HANDLE
'ptr' ; HANDLE
)
throw exception(a_thisfunc . ' failed.', -1, a_lasterror)
return h
}
CloseHandle(
hObject ) {
if !dllcall('kernel32.dll\CloseHandle',
'ptr', hObject, ; HANDLE
'int' ; BOOL
)
throw exception(a_thisfunc . ' failed.', -1, a_lasterror)
return true
}
CancelIoEx(
hFile,
lpOverlapped) {
static ERROR_NOT_FOUND := 1168
local
if (!r := dllcall('kernel32.dll\CancelIoEx',
'ptr', hFile, ; HANDLE
'ptr', lpOverlapped, ; LPOVERLAPPED
'int' ; BOOL
) )
&& a_lasterror !== ERROR_NOT_FOUND
throw exception(a_thisfunc . ' failed.', -1, a_lasterror)
return r
}
SleepEx(
dwMilliseconds,
bAlertable) {
return dllcall('kernel32\SleepEx',
'uint', dwMilliseconds, ; DWORD
'int', bAlertable, ; BOOL
'uint' ; DWORD
)
}