win-ffi 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/win-ffi/enums/comdlg32/find_replace.rb +27 -27
- data/lib/win-ffi/enums/comdlg32/font.rb +32 -32
- data/lib/win-ffi/enums/system_info.rb +53 -53
- data/lib/win-ffi/enums/user32/pointer_flags.rb +81 -81
- data/lib/win-ffi/functions/advapi32/process.rb +32 -32
- data/lib/win-ffi/functions/advapi32/system_info.rb +16 -16
- data/lib/win-ffi/functions/comdlg32.rb +6 -6
- data/lib/win-ffi/functions/comdlg32/error.rb +5 -5
- data/lib/win-ffi/functions/comdlg32/find_replace.rb +9 -9
- data/lib/win-ffi/functions/msvcrt/handle.rb +12 -12
- data/lib/win-ffi/functions/ntdll/system_info.rb +13 -13
- data/lib/win-ffi/functions/secur32/system_info.rb +29 -29
- data/lib/win-ffi/functions/thread.rb +229 -229
- data/lib/win-ffi/functions/user32/cursor.rb +2 -0
- data/lib/win-ffi/functions/user32/mouse.rb +1 -1
- data/lib/win-ffi/functions/user32/window/window.rb +12 -11
- data/lib/win-ffi/functions/winmm.rb +546 -546
- data/lib/win-ffi/functions/wtsapi32/process.rb +11 -11
- data/lib/win-ffi/struct.rb +15 -15
- data/lib/win-ffi/structs/comdlg32/choose_color.rb +22 -22
- data/lib/win-ffi/structs/comdlg32/choose_font.rb +27 -27
- data/lib/win-ffi/structs/comdlg32/find_replace.rb +23 -23
- data/lib/win-ffi/structs/gdi32/abc.rb +8 -8
- data/lib/win-ffi/structs/gdi32/abcfloat.rb +10 -10
- data/lib/win-ffi/structs/gdi32/bitmap.rb +12 -12
- data/lib/win-ffi/structs/gdi32/bitmap_info.rb +10 -10
- data/lib/win-ffi/structs/gdi32/bitmap_info_header.rb +16 -16
- data/lib/win-ffi/structs/gdi32/blend_function.rb +9 -9
- data/lib/win-ffi/structs/gdi32/display_device.rb +11 -11
- data/lib/win-ffi/structs/gdi32/handle_table.rb +6 -6
- data/lib/win-ffi/structs/gdi32/kerning_pair.rb +8 -8
- data/lib/win-ffi/structs/gdi32/log_brush.rb +10 -10
- data/lib/win-ffi/structs/gdi32/meta_file_pict.rb +9 -9
- data/lib/win-ffi/structs/gdi32/palette_entry.rb +9 -9
- data/lib/win-ffi/structs/gdi32/pixel_format_descriptor.rb +56 -56
- data/lib/win-ffi/structs/gdi32/rgb_quad.rb +9 -9
- data/lib/win-ffi/structs/os_version_info.rb +9 -9
- data/lib/win-ffi/structs/point.rb +9 -9
- data/lib/win-ffi/structs/rect.rb +41 -27
- data/lib/win-ffi/structs/size.rb +5 -5
- data/lib/win-ffi/structs/user32/controls/combobox_info.rb +14 -12
- data/lib/win-ffi/structs/user32/controls/scroll_info.rb +12 -12
- data/lib/win-ffi/structs/user32/controls/scrollbar_info.rb +14 -12
- data/lib/win-ffi/structs/user32/cursor_info.rb +11 -9
- data/lib/win-ffi/structs/user32/display_device.rb +11 -11
- data/lib/win-ffi/structs/user32/draw_text_params.rb +10 -10
- data/lib/win-ffi/structs/user32/icon_info.rb +10 -10
- data/lib/win-ffi/structs/user32/icon_info_ex.rb +14 -14
- data/lib/win-ffi/structs/user32/last_input_info.rb +7 -7
- data/lib/win-ffi/structs/user32/mouse_move_point.rb +9 -9
- data/lib/win-ffi/structs/user32/msg.rb +18 -16
- data/lib/win-ffi/structs/user32/pointer_info.rb +24 -24
- data/lib/win-ffi/structs/user32/pointer_pen_info.rb +18 -18
- data/lib/win-ffi/structs/user32/pointer_touch_info.rb +18 -17
- data/lib/win-ffi/structs/user32/raw_input_device_list.rb +9 -9
- data/lib/win-ffi/structs/user32/raw_input_header.rb +9 -9
- data/lib/win-ffi/structs/user32/touch_hit_testing_input.rb +13 -10
- data/lib/win-ffi/structs/user32/touch_hit_testing_proximity_evaluation.rb +9 -7
- data/lib/win-ffi/structs/user32/track_mouse_event.rb +9 -9
- data/lib/win-ffi/structs/user32/window/alt_tab_info.rb +17 -17
- data/lib/win-ffi/structs/user32/window/bs_info.rb +11 -11
- data/lib/win-ffi/structs/user32/window/dlg_template.rb +13 -13
- data/lib/win-ffi/structs/user32/window/flashw_info.rb +1 -1
- data/lib/win-ffi/structs/user32/window/gui_thread_info.rb +17 -17
- data/lib/win-ffi/structs/user32/window/luid.rb +7 -7
- data/lib/win-ffi/structs/user32/window/menu_info.rb +12 -12
- data/lib/win-ffi/structs/user32/window/menu_item_info.rb +17 -17
- data/lib/win-ffi/structs/user32/window/menu_item_template.rb +8 -8
- data/lib/win-ffi/structs/user32/window/menubar_info.rb +13 -11
- data/lib/win-ffi/structs/user32/window/msgbox_params.rb +15 -15
- data/lib/win-ffi/structs/user32/window/title_bar_info.rb +3 -1
- data/lib/win-ffi/structs/user32/window/tpm_params.rb +9 -7
- data/lib/win-ffi/structs/user32/window/update_layered_window_info.rb +21 -21
- data/lib/win-ffi/structs/user32/window/window_placement.rb +32 -32
- data/lib/win-ffi/structs/user32/window/window_pos.rb +46 -46
- data/lib/win-ffi/version.rb +1 -1
- metadata +5 -6
@@ -1,17 +1,17 @@
|
|
1
|
-
module WinFFI
|
2
|
-
module Advapi32
|
3
|
-
extend LibBase
|
4
|
-
|
5
|
-
ffi_lib 'advapi32'
|
6
|
-
|
7
|
-
#BOOL WINAPI GetCurrentHwProfile( _Out_ LPHW_PROFILE_INFO lpHwProfileInfo )
|
8
|
-
attach_function 'GetCurrentHwProfileA', [:pointer], :bool
|
9
|
-
attach_function 'GetCurrentHwProfileW', [:pointer], :bool
|
10
|
-
|
11
|
-
#BOOL WINAPI GetUserName(
|
12
|
-
# _Out_ LPTSTR lpBuffer,
|
13
|
-
# _Inout_ LPDWORD lpnSize )
|
14
|
-
attach_function 'GetUserNameA', [:pointer, :pointer], :bool
|
15
|
-
attach_function 'GetUserNameW', [:pointer, :pointer], :bool
|
16
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
module Advapi32
|
3
|
+
extend LibBase
|
4
|
+
|
5
|
+
ffi_lib 'advapi32'
|
6
|
+
|
7
|
+
#BOOL WINAPI GetCurrentHwProfile( _Out_ LPHW_PROFILE_INFO lpHwProfileInfo )
|
8
|
+
attach_function 'GetCurrentHwProfileA', [:pointer], :bool
|
9
|
+
attach_function 'GetCurrentHwProfileW', [:pointer], :bool
|
10
|
+
|
11
|
+
#BOOL WINAPI GetUserName(
|
12
|
+
# _Out_ LPTSTR lpBuffer,
|
13
|
+
# _Inout_ LPDWORD lpnSize )
|
14
|
+
attach_function 'GetUserNameA', [:pointer, :pointer], :bool
|
15
|
+
attach_function 'GetUserNameW', [:pointer, :pointer], :bool
|
16
|
+
end
|
17
17
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
module WinFFI
|
2
|
-
module Comdlg32
|
3
|
-
extend LibBase
|
4
|
-
|
5
|
-
ffi_lib 'Comdlg32'
|
6
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
module Comdlg32
|
3
|
+
extend LibBase
|
4
|
+
|
5
|
+
ffi_lib 'Comdlg32'
|
6
|
+
end
|
7
7
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module WinFFI
|
2
|
-
module Comdlg32
|
3
|
-
#DWORD WINAPI CommDlgExtendedError(void)
|
4
|
-
attach_function 'CommDlgExtendedError', [], :dword
|
5
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
module Comdlg32
|
3
|
+
#DWORD WINAPI CommDlgExtendedError(void)
|
4
|
+
attach_function 'CommDlgExtendedError', [], :dword
|
5
|
+
end
|
6
6
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module WinFFI
|
2
|
-
module Comdlg32
|
3
|
-
#HWND WINAPI FindText( _In_ LPFINDREPLACE lpfr )
|
4
|
-
attach_function 'FindText', :FindTextA, [:pointer], :pointer
|
5
|
-
|
6
|
-
#HWND WINAPI ReplaceText( _Inout_ LPFINDREPLACE lpfr )
|
7
|
-
attach_function 'ReplaceText', :ReplaceTextA, [:pointer], :pointer
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
module Comdlg32
|
3
|
+
#HWND WINAPI FindText( _In_ LPFINDREPLACE lpfr )
|
4
|
+
attach_function 'FindText', :FindTextA, [:pointer], :pointer
|
5
|
+
|
6
|
+
#HWND WINAPI ReplaceText( _Inout_ LPFINDREPLACE lpfr )
|
7
|
+
attach_function 'ReplaceText', :ReplaceTextA, [:pointer], :pointer
|
8
|
+
end
|
9
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
module WinFFI
|
2
|
-
module Msvcrt
|
3
|
-
ffi_lib 'msvcrt'
|
4
|
-
|
5
|
-
#intptr_t _get_osfhandle( int fd )
|
6
|
-
attach_function '_get_osfhandle', [:int], :long
|
7
|
-
|
8
|
-
#int _open_osfhandle (
|
9
|
-
# intptr_t osfhandle,
|
10
|
-
# int flags )
|
11
|
-
attach_function '_open_osfhandle', [:long, :int], :int
|
12
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
module Msvcrt
|
3
|
+
ffi_lib 'msvcrt'
|
4
|
+
|
5
|
+
#intptr_t _get_osfhandle( int fd )
|
6
|
+
attach_function '_get_osfhandle', [:int], :long
|
7
|
+
|
8
|
+
#int _open_osfhandle (
|
9
|
+
# intptr_t osfhandle,
|
10
|
+
# int flags )
|
11
|
+
attach_function '_open_osfhandle', [:long, :int], :int
|
12
|
+
end
|
13
13
|
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
module WinFFI
|
2
|
-
module Ntdll
|
3
|
-
extend LibBase
|
4
|
-
|
5
|
-
ffi_lib 'Ntdll'
|
6
|
-
|
7
|
-
#NTSTATUS WINAPI NtQuerySystemInformation(
|
8
|
-
# _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass,
|
9
|
-
# _Inout_ PVOID SystemInformation,
|
10
|
-
# _In_ ULONG SystemInformationLength,
|
11
|
-
# _Out_opt_ PULONG ReturnLength )
|
12
|
-
attach_function 'NtQuerySystemInformation', [:pointer, :pointer, :ulong, :pointer], :int
|
13
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
module Ntdll
|
3
|
+
extend LibBase
|
4
|
+
|
5
|
+
ffi_lib 'Ntdll'
|
6
|
+
|
7
|
+
#NTSTATUS WINAPI NtQuerySystemInformation(
|
8
|
+
# _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass,
|
9
|
+
# _Inout_ PVOID SystemInformation,
|
10
|
+
# _In_ ULONG SystemInformationLength,
|
11
|
+
# _Out_opt_ PULONG ReturnLength )
|
12
|
+
attach_function 'NtQuerySystemInformation', [:pointer, :pointer, :ulong, :pointer], :int
|
13
|
+
end
|
14
14
|
end
|
@@ -1,30 +1,30 @@
|
|
1
|
-
module WinFII
|
2
|
-
module Secur32
|
3
|
-
extend LibBase
|
4
|
-
|
5
|
-
ffi_lib 'secur32'
|
6
|
-
|
7
|
-
#BOOLEAN WINAPI GetComputerObjectName(
|
8
|
-
# _In_ EXTENDED_NAME_FORMAT NameFormat,
|
9
|
-
# _Out_ LPTSTR lpNameBuffer,
|
10
|
-
# _Inout_ PULONG lpnSize )
|
11
|
-
attach_function 'GetComputerObjectNameA', [ExtendedNameFormat ,:pointer, :pointer], :bool
|
12
|
-
attach_function 'GetComputerObjectNameW', [ExtendedNameFormat ,:pointer, :pointer], :bool
|
13
|
-
|
14
|
-
#BOOLEAN WINAPI GetUserNameEx(
|
15
|
-
# _In_ EXTENDED_NAME_FORMAT NameFormat,
|
16
|
-
# _Out_ LPTSTR lpNameBuffer,
|
17
|
-
# _Inout_ PULONG lpnSize )
|
18
|
-
attach_function 'GetUserNameExA', [ExtendedNameFormat, :pointer, :pointer], :bool
|
19
|
-
attach_function 'GetUserNameExW', [ExtendedNameFormat, :pointer, :pointer], :bool
|
20
|
-
|
21
|
-
#BOOLEAN WINAPI TranslateName(
|
22
|
-
# _In_ LPCTSTR lpAccountName,
|
23
|
-
# _In_ EXTENDED_NAME_FORMAT AccountNameFormat,
|
24
|
-
# _In_ EXTENDED_NAME_FORMAT DesiredNameFormat,
|
25
|
-
# _Out_ LPTSTR lpTranslatedName,
|
26
|
-
# _Inout_ PULONG nSize )
|
27
|
-
attach_function 'TranslateNameA', [:string, ExtendedNameFormat, ExtendedNameFormat, :string, :pointer], :bool
|
28
|
-
attach_function 'TranslateNameW', [:string, ExtendedNameFormat, ExtendedNameFormat, :string, :pointer], :bool
|
29
|
-
end
|
1
|
+
module WinFII
|
2
|
+
module Secur32
|
3
|
+
extend LibBase
|
4
|
+
|
5
|
+
ffi_lib 'secur32'
|
6
|
+
|
7
|
+
#BOOLEAN WINAPI GetComputerObjectName(
|
8
|
+
# _In_ EXTENDED_NAME_FORMAT NameFormat,
|
9
|
+
# _Out_ LPTSTR lpNameBuffer,
|
10
|
+
# _Inout_ PULONG lpnSize )
|
11
|
+
attach_function 'GetComputerObjectNameA', [ExtendedNameFormat ,:pointer, :pointer], :bool
|
12
|
+
attach_function 'GetComputerObjectNameW', [ExtendedNameFormat ,:pointer, :pointer], :bool
|
13
|
+
|
14
|
+
#BOOLEAN WINAPI GetUserNameEx(
|
15
|
+
# _In_ EXTENDED_NAME_FORMAT NameFormat,
|
16
|
+
# _Out_ LPTSTR lpNameBuffer,
|
17
|
+
# _Inout_ PULONG lpnSize )
|
18
|
+
attach_function 'GetUserNameExA', [ExtendedNameFormat, :pointer, :pointer], :bool
|
19
|
+
attach_function 'GetUserNameExW', [ExtendedNameFormat, :pointer, :pointer], :bool
|
20
|
+
|
21
|
+
#BOOLEAN WINAPI TranslateName(
|
22
|
+
# _In_ LPCTSTR lpAccountName,
|
23
|
+
# _In_ EXTENDED_NAME_FORMAT AccountNameFormat,
|
24
|
+
# _In_ EXTENDED_NAME_FORMAT DesiredNameFormat,
|
25
|
+
# _Out_ LPTSTR lpTranslatedName,
|
26
|
+
# _Inout_ PULONG nSize )
|
27
|
+
attach_function 'TranslateNameA', [:string, ExtendedNameFormat, ExtendedNameFormat, :string, :pointer], :bool
|
28
|
+
attach_function 'TranslateNameW', [:string, ExtendedNameFormat, ExtendedNameFormat, :string, :pointer], :bool
|
29
|
+
end
|
30
30
|
end
|
@@ -1,230 +1,230 @@
|
|
1
|
-
module WinFFI
|
2
|
-
module Thread
|
3
|
-
extend LibBase
|
4
|
-
|
5
|
-
SYNCHRONIZE = 0x00100000
|
6
|
-
THREAD_ALL_ACCESS = 0x1F03FF
|
7
|
-
THREAD_DIRECT_IMPERSONATION = 0x0200
|
8
|
-
THREAD_GET_CONTEXT = 0x0008
|
9
|
-
THREAD_IMPERSONATE = 0x0100
|
10
|
-
THREAD_QUERY_INFORMATION = 0x0040
|
11
|
-
THREAD_SET_CONTEXT = 0x0010
|
12
|
-
THREAD_SET_INFORMATION = 0x0020
|
13
|
-
THREAD_SET_THREAD_TOKEN = 0x0080
|
14
|
-
THREAD_SUSPEND_RESUME = 0x0002
|
15
|
-
THREAD_TERMINATE = 0x0001
|
16
|
-
|
17
|
-
THREAD_PRIORITY_ABOVE_NORMAL = 1
|
18
|
-
THREAD_PRIORITY_BELOW_NORMAL = -1
|
19
|
-
THREAD_PRIORITY_HIGHEST = 2
|
20
|
-
THREAD_PRIORITY_IDLE = -15
|
21
|
-
THREAD_PRIORITY_LOWEST = -2
|
22
|
-
THREAD_PRIORITY_NORMAL = 0
|
23
|
-
THREAD_PRIORITY_TIME_CRITICAL = 15
|
24
|
-
|
25
|
-
if WindowsVersion >= 7
|
26
|
-
|
27
|
-
ffi_lib 'Avrt'
|
28
|
-
|
29
|
-
#BOOL WINAPI AvRevertMmThreadCharacteristics( _In_ HANDLE AvrtHandle )
|
30
|
-
attach_function 'AvRevertMmThreadCharacteristics', [:handle], :bool
|
31
|
-
|
32
|
-
#BOOL WINAPI AvRtCreateThreadOrderingGroup(
|
33
|
-
# _Out_ PHANDLE Context,
|
34
|
-
# _In_ PLARGE_INTEGER Period,
|
35
|
-
# _Inout_ GUID *ThreadOrderingGuid,
|
36
|
-
# _In_opt_ PLARGE_INTEGER Timeout )
|
37
|
-
attach_function 'AvRtCreateThreadOrderingGroup', [:pointer, :pointer, :pointer, :pointer], :bool
|
38
|
-
|
39
|
-
#BOOL WINAPI AvRtCreateThreadOrderingGroupEx(
|
40
|
-
# _Out_ PHANDLE Context,
|
41
|
-
# _In_ PLARGE_INTEGER Period,
|
42
|
-
# _Inout_ GUID *ThreadOrderingGuid,
|
43
|
-
# _In_opt_ PLARGE_INTEGER Timeout,
|
44
|
-
# _In_ LPCTSTR TaskName )
|
45
|
-
attach_function 'AvRtCreateThreadOrderingGroupExA', [:pointer, :pointer, :pointer, :pointer, :string], :bool
|
46
|
-
attach_function 'AvRtCreateThreadOrderingGroupExW', [:pointer, :pointer, :pointer, :pointer, :string], :bool
|
47
|
-
|
48
|
-
#BOOL WINAPI AvRtDeleteThreadOrderingGroup( _In_ HANDLE Context )
|
49
|
-
attach_function 'AvRtDeleteThreadOrderingGroup', [:handle], :bool
|
50
|
-
|
51
|
-
#BOOL WINAPI AvRtJoinThreadOrderingGroup(
|
52
|
-
# _Out_ PHANDLE Context,
|
53
|
-
# _In_ GUID *ThreadOrderingGuid,
|
54
|
-
# _In_ BOOL Before )
|
55
|
-
attach_function 'AvRtJoinThreadOrderingGroup', [:pointer, :pointer, :bool], :bool
|
56
|
-
|
57
|
-
#BOOL WINAPI AvRtWaitOnThreadOrderingGroup( _In_ HANDLE Context )
|
58
|
-
attach_function 'AvRtWaitOnThreadOrderingGroup', [:handle], :bool
|
59
|
-
|
60
|
-
#HANDLE WINAPI AvSetMmMaxThreadCharacteristics(
|
61
|
-
# _In_ LPCTSTR FirstTask,
|
62
|
-
# _In_ LPCTSTR SecondTask,
|
63
|
-
# _Inout_ LPDWORD TaskIndex )
|
64
|
-
attach_function 'AvSetMmMaxThreadCharacteristicsA', [:string, :string, :pointer], :handle
|
65
|
-
attach_function 'AvSetMmMaxThreadCharacteristicsW', [:string, :string, :pointer], :handle
|
66
|
-
|
67
|
-
#HANDLE WINAPI AvSetMmThreadCharacteristics(
|
68
|
-
# _In_ LPCTSTR TaskName,
|
69
|
-
# _Inout_ LPDWORD TaskIndex )
|
70
|
-
attach_function 'AvSetMmThreadCharacteristicsA', [:string, :pointer], :handle
|
71
|
-
attach_function 'AvSetMmThreadCharacteristicsW', [:string, :pointer], :handle
|
72
|
-
|
73
|
-
#BOOL WINAPI AvSetMmThreadPriority(
|
74
|
-
# _In_ HANDLE AvrtHandle,
|
75
|
-
# _In_ AVRT_PRIORITY Priority )
|
76
|
-
attach_function 'AvSetMmThreadPriority', [:handle, :int], :bool
|
77
|
-
|
78
|
-
end
|
79
|
-
|
80
|
-
ffi_lib 'kernel32'
|
81
|
-
|
82
|
-
#HANDLE WINAPI CreateRemoteThread(
|
83
|
-
# _In_ HANDLE hProcess,
|
84
|
-
# _In_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
85
|
-
# _In_ SIZE_T dwStackSize,
|
86
|
-
# _In_ LPTHREAD_START_ROUTINE lpStartAddress,
|
87
|
-
# _In_ LPVOID lpParameter,
|
88
|
-
# _In_ DWORD dwCreationFlags,
|
89
|
-
# _Out_ LPDWORD lpThreadId )
|
90
|
-
attach_function 'CreateRemoteThread', [:handle, :pointer, :size_t, :pointer, :pointer, :dword, :pointer], :handle
|
91
|
-
|
92
|
-
#HANDLE WINAPI CreateThread(
|
93
|
-
# _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
94
|
-
# _In_ SIZE_T dwStackSize,
|
95
|
-
# _In_ LPTHREAD_START_ROUTINE lpStartAddress,
|
96
|
-
# _In_opt_ LPVOID lpParameter,
|
97
|
-
# _In_ DWORD dwCreationFlags,
|
98
|
-
# _Out_opt_ LPDWORD lpThreadId )
|
99
|
-
attach_function 'CreateThread', [:pointer, :size_t, :pointer, :pointer, :dword, :pointer], :handle
|
100
|
-
|
101
|
-
#VOID WINAPI ExitThread( _In_ DWORD dwExitCode )
|
102
|
-
attach_function 'ExitThread', [:dword], :void
|
103
|
-
|
104
|
-
#HANDLE WINAPI GetCurrentThread(void)
|
105
|
-
attach_function 'GetCurrentThread', [], :handle
|
106
|
-
|
107
|
-
#DWORD WINAPI GetCurrentThreadId(void)
|
108
|
-
attach_function 'GetCurrentThreadId', [], :ulong
|
109
|
-
|
110
|
-
#BOOL WINAPI GetExitCodeThread(
|
111
|
-
# _In_ HANDLE hThread,
|
112
|
-
# _Out_ LPDWORD lpExitCode )
|
113
|
-
attach_function 'GetExitCodeThread', [:handle, :pointer], :bool
|
114
|
-
|
115
|
-
#int WINAPI GetThreadPriority( _In_ HANDLE hThread )
|
116
|
-
attach_function 'GetThreadPriority', [:handle], :int
|
117
|
-
|
118
|
-
#BOOL WINAPI GetThreadPriorityBoost(
|
119
|
-
# _In_ HANDLE hThread,
|
120
|
-
# _Out_ PBOOL pDisablePriorityBoost )
|
121
|
-
attach_function 'GetThreadPriorityBoost', [:pointer, :pointer], :bool
|
122
|
-
|
123
|
-
#BOOL WINAPI GetThreadTimes(
|
124
|
-
# _In_ HANDLE hThread,
|
125
|
-
# _Out_ LPFILETIME lpCreationTime,
|
126
|
-
# _Out_ LPFILETIME lpExitTime,
|
127
|
-
# _Out_ LPFILETIME lpKernelTime,
|
128
|
-
# _Out_ LPFILETIME lpUserTime )
|
129
|
-
attach_function 'GetThreadTimes', [:handle, :pointer, :pointer, :pointer, :pointer], :bool
|
130
|
-
|
131
|
-
#HANDLE WINAPI OpenThread(
|
132
|
-
# _In_ DWORD dwDesiredAccess,
|
133
|
-
# _In_ BOOL bInheritHandle,
|
134
|
-
# _In_ DWORD dwThreadId )
|
135
|
-
attach_function 'OpenThread', [:dword, :bool, :dword], :handle
|
136
|
-
|
137
|
-
#DWORD WINAPI ResumeThread( _In_ HANDLE hThread )
|
138
|
-
attach_function 'ResumeThread', [:handle], :dword
|
139
|
-
|
140
|
-
#DWORD_PTR WINAPI SetThreadAffinityMask(
|
141
|
-
# _In_ HANDLE hThread,
|
142
|
-
# _In_ DWORD_PTR dwThreadAffinityMask )
|
143
|
-
attach_function 'SetThreadAffinityMask', [:handle, :pointer], :ulong
|
144
|
-
|
145
|
-
#DWORD WINAPI SetThreadIdealProcessor(
|
146
|
-
# _In_ HANDLE hThread,
|
147
|
-
# _In_ DWORD dwIdealProcessor )
|
148
|
-
attach_function 'SetThreadIdealProcessor', [:handle, :dword], :dword
|
149
|
-
|
150
|
-
#BOOL WINAPI SetThreadPriority(
|
151
|
-
# _In_ HANDLE hThread,
|
152
|
-
# _In_ int nPriority )
|
153
|
-
attach_function 'SetThreadPriority', [:handle, :int], :bool
|
154
|
-
|
155
|
-
#BOOL WINAPI SetThreadPriorityBoost(
|
156
|
-
# _In_ HANDLE hThread,
|
157
|
-
# _In_ BOOL DisablePriorityBoost )
|
158
|
-
attach_function 'SetThreadPriorityBoost', [:handle, :bool], :bool
|
159
|
-
|
160
|
-
#VOID WINAPI Sleep( _In_ DWORD dwMilliseconds )
|
161
|
-
attach_function 'Sleep', [:dword], :void
|
162
|
-
|
163
|
-
#DWORD WINAPI SleepEx(
|
164
|
-
# _In_ DWORD dwMilliseconds,
|
165
|
-
# _In_ BOOL bAlertable )
|
166
|
-
attach_function 'SleepEx', [:dword, :bool], :dword
|
167
|
-
|
168
|
-
#DWORD WINAPI SuspendThread( _In_ HANDLE hThread )
|
169
|
-
attach_function 'SuspendThread', [:handle], :dword
|
170
|
-
|
171
|
-
#BOOL WINAPI SwitchToThread(void)
|
172
|
-
attach_function 'SwitchToThread', [], :bool
|
173
|
-
|
174
|
-
#BOOL WINAPI TerminateThread(
|
175
|
-
# _Inout_ HANDLE hThread,
|
176
|
-
# _In_ DWORD dwExitCode )
|
177
|
-
attach_function 'TerminateThread', [:handle, :dword], :bool
|
178
|
-
|
179
|
-
#DWORD WINAPI TlsAlloc(void)
|
180
|
-
attach_function 'TlsAlloc', [], :dword
|
181
|
-
|
182
|
-
#BOOL WINAPI TlsFree( _In_ DWORD dwTlsIndex )
|
183
|
-
attach_function 'TlsFree', [:dword], :bool
|
184
|
-
|
185
|
-
#LPVOID WINAPI TlsGetValue( _In_ DWORD dwTlsIndex )
|
186
|
-
attach_function 'TlsGetValue', [:dword], :pointer
|
187
|
-
|
188
|
-
#BOOL WINAPI TlsSetValue(
|
189
|
-
# _In_ DWORD dwTlsIndex,
|
190
|
-
# _In_opt_ LPVOID lpTlsValue )
|
191
|
-
attach_function 'TlsSetValue', [:dword, :pointer], :bool
|
192
|
-
|
193
|
-
if WindowsVersion >= 7
|
194
|
-
|
195
|
-
#HANDLE CreateRemoteThreadEx(
|
196
|
-
# _In_ HANDLE hProcess,
|
197
|
-
# _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
198
|
-
# _In_ SIZE_T dwStackSize,
|
199
|
-
# _In_ LPTHREAD_START_ROUTINE lpStartAddress,
|
200
|
-
# _In_opt_ LPVOID lpParameter,
|
201
|
-
# _In_ DWORD dwCreationFlags,
|
202
|
-
# _In_opt_ LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList,
|
203
|
-
# _Out_opt_ LPDWORD lpThreadId )
|
204
|
-
attach_function 'CreateRemoteThreadEx', [:handle, :pointer, :size_t, :pointer, :pointer, :dword, :pointer, :pointer], :bool
|
205
|
-
end
|
206
|
-
|
207
|
-
if WindowsVersion >= :xp
|
208
|
-
|
209
|
-
ffi_lib 'user32'
|
210
|
-
|
211
|
-
#BOOL WINAPI AttachThreadInput(
|
212
|
-
# _In_ DWORD idAttach,
|
213
|
-
# _In_ DWORD idAttachTo,
|
214
|
-
# _In_ BOOL fAttach )
|
215
|
-
attach_function 'AttachThreadInput', [:dword, :dword, :bool], :bool
|
216
|
-
|
217
|
-
if WindowsVersion.sp >= 1
|
218
|
-
|
219
|
-
ffi_lib 'kernel32'
|
220
|
-
|
221
|
-
#BOOL WINAPI GetThreadIOPendingFlag(
|
222
|
-
# _In_ HANDLE hThread,
|
223
|
-
# _Inout_ PBOOL lpIOIsPending )
|
224
|
-
attach_function 'GetThreadIOPendingFlag', [:ulong, :pointer], :bool
|
225
|
-
|
226
|
-
end
|
227
|
-
|
228
|
-
end
|
229
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
module Thread
|
3
|
+
extend LibBase
|
4
|
+
|
5
|
+
SYNCHRONIZE = 0x00100000
|
6
|
+
THREAD_ALL_ACCESS = 0x1F03FF
|
7
|
+
THREAD_DIRECT_IMPERSONATION = 0x0200
|
8
|
+
THREAD_GET_CONTEXT = 0x0008
|
9
|
+
THREAD_IMPERSONATE = 0x0100
|
10
|
+
THREAD_QUERY_INFORMATION = 0x0040
|
11
|
+
THREAD_SET_CONTEXT = 0x0010
|
12
|
+
THREAD_SET_INFORMATION = 0x0020
|
13
|
+
THREAD_SET_THREAD_TOKEN = 0x0080
|
14
|
+
THREAD_SUSPEND_RESUME = 0x0002
|
15
|
+
THREAD_TERMINATE = 0x0001
|
16
|
+
|
17
|
+
THREAD_PRIORITY_ABOVE_NORMAL = 1
|
18
|
+
THREAD_PRIORITY_BELOW_NORMAL = -1
|
19
|
+
THREAD_PRIORITY_HIGHEST = 2
|
20
|
+
THREAD_PRIORITY_IDLE = -15
|
21
|
+
THREAD_PRIORITY_LOWEST = -2
|
22
|
+
THREAD_PRIORITY_NORMAL = 0
|
23
|
+
THREAD_PRIORITY_TIME_CRITICAL = 15
|
24
|
+
|
25
|
+
if WindowsVersion >= 7
|
26
|
+
|
27
|
+
ffi_lib 'Avrt'
|
28
|
+
|
29
|
+
#BOOL WINAPI AvRevertMmThreadCharacteristics( _In_ HANDLE AvrtHandle )
|
30
|
+
attach_function 'AvRevertMmThreadCharacteristics', [:handle], :bool
|
31
|
+
|
32
|
+
#BOOL WINAPI AvRtCreateThreadOrderingGroup(
|
33
|
+
# _Out_ PHANDLE Context,
|
34
|
+
# _In_ PLARGE_INTEGER Period,
|
35
|
+
# _Inout_ GUID *ThreadOrderingGuid,
|
36
|
+
# _In_opt_ PLARGE_INTEGER Timeout )
|
37
|
+
attach_function 'AvRtCreateThreadOrderingGroup', [:pointer, :pointer, :pointer, :pointer], :bool
|
38
|
+
|
39
|
+
#BOOL WINAPI AvRtCreateThreadOrderingGroupEx(
|
40
|
+
# _Out_ PHANDLE Context,
|
41
|
+
# _In_ PLARGE_INTEGER Period,
|
42
|
+
# _Inout_ GUID *ThreadOrderingGuid,
|
43
|
+
# _In_opt_ PLARGE_INTEGER Timeout,
|
44
|
+
# _In_ LPCTSTR TaskName )
|
45
|
+
attach_function 'AvRtCreateThreadOrderingGroupExA', [:pointer, :pointer, :pointer, :pointer, :string], :bool
|
46
|
+
attach_function 'AvRtCreateThreadOrderingGroupExW', [:pointer, :pointer, :pointer, :pointer, :string], :bool
|
47
|
+
|
48
|
+
#BOOL WINAPI AvRtDeleteThreadOrderingGroup( _In_ HANDLE Context )
|
49
|
+
attach_function 'AvRtDeleteThreadOrderingGroup', [:handle], :bool
|
50
|
+
|
51
|
+
#BOOL WINAPI AvRtJoinThreadOrderingGroup(
|
52
|
+
# _Out_ PHANDLE Context,
|
53
|
+
# _In_ GUID *ThreadOrderingGuid,
|
54
|
+
# _In_ BOOL Before )
|
55
|
+
attach_function 'AvRtJoinThreadOrderingGroup', [:pointer, :pointer, :bool], :bool
|
56
|
+
|
57
|
+
#BOOL WINAPI AvRtWaitOnThreadOrderingGroup( _In_ HANDLE Context )
|
58
|
+
attach_function 'AvRtWaitOnThreadOrderingGroup', [:handle], :bool
|
59
|
+
|
60
|
+
#HANDLE WINAPI AvSetMmMaxThreadCharacteristics(
|
61
|
+
# _In_ LPCTSTR FirstTask,
|
62
|
+
# _In_ LPCTSTR SecondTask,
|
63
|
+
# _Inout_ LPDWORD TaskIndex )
|
64
|
+
attach_function 'AvSetMmMaxThreadCharacteristicsA', [:string, :string, :pointer], :handle
|
65
|
+
attach_function 'AvSetMmMaxThreadCharacteristicsW', [:string, :string, :pointer], :handle
|
66
|
+
|
67
|
+
#HANDLE WINAPI AvSetMmThreadCharacteristics(
|
68
|
+
# _In_ LPCTSTR TaskName,
|
69
|
+
# _Inout_ LPDWORD TaskIndex )
|
70
|
+
attach_function 'AvSetMmThreadCharacteristicsA', [:string, :pointer], :handle
|
71
|
+
attach_function 'AvSetMmThreadCharacteristicsW', [:string, :pointer], :handle
|
72
|
+
|
73
|
+
#BOOL WINAPI AvSetMmThreadPriority(
|
74
|
+
# _In_ HANDLE AvrtHandle,
|
75
|
+
# _In_ AVRT_PRIORITY Priority )
|
76
|
+
attach_function 'AvSetMmThreadPriority', [:handle, :int], :bool
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
ffi_lib 'kernel32'
|
81
|
+
|
82
|
+
#HANDLE WINAPI CreateRemoteThread(
|
83
|
+
# _In_ HANDLE hProcess,
|
84
|
+
# _In_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
85
|
+
# _In_ SIZE_T dwStackSize,
|
86
|
+
# _In_ LPTHREAD_START_ROUTINE lpStartAddress,
|
87
|
+
# _In_ LPVOID lpParameter,
|
88
|
+
# _In_ DWORD dwCreationFlags,
|
89
|
+
# _Out_ LPDWORD lpThreadId )
|
90
|
+
attach_function 'CreateRemoteThread', [:handle, :pointer, :size_t, :pointer, :pointer, :dword, :pointer], :handle
|
91
|
+
|
92
|
+
#HANDLE WINAPI CreateThread(
|
93
|
+
# _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
94
|
+
# _In_ SIZE_T dwStackSize,
|
95
|
+
# _In_ LPTHREAD_START_ROUTINE lpStartAddress,
|
96
|
+
# _In_opt_ LPVOID lpParameter,
|
97
|
+
# _In_ DWORD dwCreationFlags,
|
98
|
+
# _Out_opt_ LPDWORD lpThreadId )
|
99
|
+
attach_function 'CreateThread', [:pointer, :size_t, :pointer, :pointer, :dword, :pointer], :handle
|
100
|
+
|
101
|
+
#VOID WINAPI ExitThread( _In_ DWORD dwExitCode )
|
102
|
+
attach_function 'ExitThread', [:dword], :void
|
103
|
+
|
104
|
+
#HANDLE WINAPI GetCurrentThread(void)
|
105
|
+
attach_function 'GetCurrentThread', [], :handle
|
106
|
+
|
107
|
+
#DWORD WINAPI GetCurrentThreadId(void)
|
108
|
+
attach_function 'GetCurrentThreadId', [], :ulong
|
109
|
+
|
110
|
+
#BOOL WINAPI GetExitCodeThread(
|
111
|
+
# _In_ HANDLE hThread,
|
112
|
+
# _Out_ LPDWORD lpExitCode )
|
113
|
+
attach_function 'GetExitCodeThread', [:handle, :pointer], :bool
|
114
|
+
|
115
|
+
#int WINAPI GetThreadPriority( _In_ HANDLE hThread )
|
116
|
+
attach_function 'GetThreadPriority', [:handle], :int
|
117
|
+
|
118
|
+
#BOOL WINAPI GetThreadPriorityBoost(
|
119
|
+
# _In_ HANDLE hThread,
|
120
|
+
# _Out_ PBOOL pDisablePriorityBoost )
|
121
|
+
attach_function 'GetThreadPriorityBoost', [:pointer, :pointer], :bool
|
122
|
+
|
123
|
+
#BOOL WINAPI GetThreadTimes(
|
124
|
+
# _In_ HANDLE hThread,
|
125
|
+
# _Out_ LPFILETIME lpCreationTime,
|
126
|
+
# _Out_ LPFILETIME lpExitTime,
|
127
|
+
# _Out_ LPFILETIME lpKernelTime,
|
128
|
+
# _Out_ LPFILETIME lpUserTime )
|
129
|
+
attach_function 'GetThreadTimes', [:handle, :pointer, :pointer, :pointer, :pointer], :bool
|
130
|
+
|
131
|
+
#HANDLE WINAPI OpenThread(
|
132
|
+
# _In_ DWORD dwDesiredAccess,
|
133
|
+
# _In_ BOOL bInheritHandle,
|
134
|
+
# _In_ DWORD dwThreadId )
|
135
|
+
attach_function 'OpenThread', [:dword, :bool, :dword], :handle
|
136
|
+
|
137
|
+
#DWORD WINAPI ResumeThread( _In_ HANDLE hThread )
|
138
|
+
attach_function 'ResumeThread', [:handle], :dword
|
139
|
+
|
140
|
+
#DWORD_PTR WINAPI SetThreadAffinityMask(
|
141
|
+
# _In_ HANDLE hThread,
|
142
|
+
# _In_ DWORD_PTR dwThreadAffinityMask )
|
143
|
+
attach_function 'SetThreadAffinityMask', [:handle, :pointer], :ulong
|
144
|
+
|
145
|
+
#DWORD WINAPI SetThreadIdealProcessor(
|
146
|
+
# _In_ HANDLE hThread,
|
147
|
+
# _In_ DWORD dwIdealProcessor )
|
148
|
+
attach_function 'SetThreadIdealProcessor', [:handle, :dword], :dword
|
149
|
+
|
150
|
+
#BOOL WINAPI SetThreadPriority(
|
151
|
+
# _In_ HANDLE hThread,
|
152
|
+
# _In_ int nPriority )
|
153
|
+
attach_function 'SetThreadPriority', [:handle, :int], :bool
|
154
|
+
|
155
|
+
#BOOL WINAPI SetThreadPriorityBoost(
|
156
|
+
# _In_ HANDLE hThread,
|
157
|
+
# _In_ BOOL DisablePriorityBoost )
|
158
|
+
attach_function 'SetThreadPriorityBoost', [:handle, :bool], :bool
|
159
|
+
|
160
|
+
#VOID WINAPI Sleep( _In_ DWORD dwMilliseconds )
|
161
|
+
attach_function 'Sleep', [:dword], :void
|
162
|
+
|
163
|
+
#DWORD WINAPI SleepEx(
|
164
|
+
# _In_ DWORD dwMilliseconds,
|
165
|
+
# _In_ BOOL bAlertable )
|
166
|
+
attach_function 'SleepEx', [:dword, :bool], :dword
|
167
|
+
|
168
|
+
#DWORD WINAPI SuspendThread( _In_ HANDLE hThread )
|
169
|
+
attach_function 'SuspendThread', [:handle], :dword
|
170
|
+
|
171
|
+
#BOOL WINAPI SwitchToThread(void)
|
172
|
+
attach_function 'SwitchToThread', [], :bool
|
173
|
+
|
174
|
+
#BOOL WINAPI TerminateThread(
|
175
|
+
# _Inout_ HANDLE hThread,
|
176
|
+
# _In_ DWORD dwExitCode )
|
177
|
+
attach_function 'TerminateThread', [:handle, :dword], :bool
|
178
|
+
|
179
|
+
#DWORD WINAPI TlsAlloc(void)
|
180
|
+
attach_function 'TlsAlloc', [], :dword
|
181
|
+
|
182
|
+
#BOOL WINAPI TlsFree( _In_ DWORD dwTlsIndex )
|
183
|
+
attach_function 'TlsFree', [:dword], :bool
|
184
|
+
|
185
|
+
#LPVOID WINAPI TlsGetValue( _In_ DWORD dwTlsIndex )
|
186
|
+
attach_function 'TlsGetValue', [:dword], :pointer
|
187
|
+
|
188
|
+
#BOOL WINAPI TlsSetValue(
|
189
|
+
# _In_ DWORD dwTlsIndex,
|
190
|
+
# _In_opt_ LPVOID lpTlsValue )
|
191
|
+
attach_function 'TlsSetValue', [:dword, :pointer], :bool
|
192
|
+
|
193
|
+
if WindowsVersion >= 7
|
194
|
+
|
195
|
+
#HANDLE CreateRemoteThreadEx(
|
196
|
+
# _In_ HANDLE hProcess,
|
197
|
+
# _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
198
|
+
# _In_ SIZE_T dwStackSize,
|
199
|
+
# _In_ LPTHREAD_START_ROUTINE lpStartAddress,
|
200
|
+
# _In_opt_ LPVOID lpParameter,
|
201
|
+
# _In_ DWORD dwCreationFlags,
|
202
|
+
# _In_opt_ LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList,
|
203
|
+
# _Out_opt_ LPDWORD lpThreadId )
|
204
|
+
attach_function 'CreateRemoteThreadEx', [:handle, :pointer, :size_t, :pointer, :pointer, :dword, :pointer, :pointer], :bool
|
205
|
+
end
|
206
|
+
|
207
|
+
if WindowsVersion >= :xp
|
208
|
+
|
209
|
+
ffi_lib 'user32'
|
210
|
+
|
211
|
+
#BOOL WINAPI AttachThreadInput(
|
212
|
+
# _In_ DWORD idAttach,
|
213
|
+
# _In_ DWORD idAttachTo,
|
214
|
+
# _In_ BOOL fAttach )
|
215
|
+
attach_function 'AttachThreadInput', [:dword, :dword, :bool], :bool
|
216
|
+
|
217
|
+
if WindowsVersion.sp >= 1
|
218
|
+
|
219
|
+
ffi_lib 'kernel32'
|
220
|
+
|
221
|
+
#BOOL WINAPI GetThreadIOPendingFlag(
|
222
|
+
# _In_ HANDLE hThread,
|
223
|
+
# _Inout_ PBOOL lpIOIsPending )
|
224
|
+
attach_function 'GetThreadIOPendingFlag', [:ulong, :pointer], :bool
|
225
|
+
|
226
|
+
end
|
227
|
+
|
228
|
+
end
|
229
|
+
end
|
230
230
|
end
|