1 // Copyright © 2015, Peter Atashian
2 // Licensed under the MIT License <LICENSE.md>
3 //! This module defines the 32-Bit Windows Base APIs
4 STRUCT
!{struct SECURITY_ATTRIBUTES
{
6 lpSecurityDescriptor
: ::LPVOID
,
7 bInheritHandle
: ::BOOL
,
9 pub type PSECURITY_ATTRIBUTES
= *mut SECURITY_ATTRIBUTES
;
10 pub type LPSECURITY_ATTRIBUTES
= *mut SECURITY_ATTRIBUTES
;
11 STRUCT
!{struct OVERLAPPED
{
12 Internal
: ::ULONG_PTR
,
13 InternalHigh
: ::ULONG_PTR
,
18 UNION
!(OVERLAPPED
, Offset
, Pointer
, Pointer_mut
, ::PVOID
);
19 pub type LPOVERLAPPED
= *mut OVERLAPPED
;
20 STRUCT
!{struct OVERLAPPED_ENTRY
{
21 lpCompletionKey
: ::ULONG_PTR
,
22 lpOverlapped
: LPOVERLAPPED
,
23 Internal
: ::ULONG_PTR
,
24 dwNumberOfBytesTransferred
: ::DWORD
,
26 pub type LPOVERLAPPED_ENTRY
= *mut OVERLAPPED_ENTRY
;
27 STRUCT
!{struct SYSTEMTIME
{
35 wMilliseconds
: ::WORD
,
37 pub type PSYSTEMTIME
= *mut SYSTEMTIME
;
38 pub type LPSYSTEMTIME
= *mut SYSTEMTIME
;
39 STRUCT
!{nodebug
struct WIN32_FIND_DATAA
{
40 dwFileAttributes
: ::DWORD
,
41 ftCreationTime
: ::FILETIME
,
42 ftLastAccessTime
: ::FILETIME
,
43 ftLastWriteTime
: ::FILETIME
,
44 nFileSizeHigh
: ::DWORD
,
45 nFileSizeLow
: ::DWORD
,
48 cFileName
: [::CHAR
; ::MAX_PATH
],
49 cAlternateFileName
: [::CHAR
; 14],
51 pub type PWIN32_FIND_DATAA
= *mut WIN32_FIND_DATAA
;
52 pub type LPWIN32_FIND_DATAA
= *mut WIN32_FIND_DATAA
;
53 STRUCT
!{nodebug
struct WIN32_FIND_DATAW
{
54 dwFileAttributes
: ::DWORD
,
55 ftCreationTime
: ::FILETIME
,
56 ftLastAccessTime
: ::FILETIME
,
57 ftLastWriteTime
: ::FILETIME
,
58 nFileSizeHigh
: ::DWORD
,
59 nFileSizeLow
: ::DWORD
,
62 cFileName
: [::WCHAR
; ::MAX_PATH
],
63 cAlternateFileName
: [::WCHAR
; 14],
65 pub type PWIN32_FIND_DATAW
= *mut WIN32_FIND_DATAW
;
66 pub type LPWIN32_FIND_DATAW
= *mut WIN32_FIND_DATAW
;
67 ENUM
!{enum FINDEX_INFO_LEVELS
{
70 FindExInfoMaxInfoLevel
,
72 pub const FIND_FIRST_EX_CASE_SENSITIVE
: ::DWORD
= 0x00000001;
73 pub const FIND_FIRST_EX_LARGE_FETCH
: ::DWORD
= 0x00000002;
74 ENUM
!{enum FINDEX_SEARCH_OPS
{
75 FindExSearchNameMatch
,
76 FindExSearchLimitToDirectories
,
77 FindExSearchLimitToDevices
,
78 FindExSearchMaxSearchOp
,
80 ENUM
!{enum GET_FILEEX_INFO_LEVELS
{
81 GetFileExInfoStandard
,
82 GetFileExMaxInfoLevel
,
84 ENUM
!{enum FILE_INFO_BY_HANDLE_CLASS
{
95 FileIdBothDirectoryInfo
,
96 FileIdBothDirectoryRestartInfo
,
97 FileIoPriorityHintInfo
,
98 FileRemoteProtocolInfo
,
99 FileFullDirectoryInfo
,
100 FileFullDirectoryRestartInfo
,
104 FileIdExtdDirectoryInfo
,
105 FileIdExtdDirectoryRestartInfo
,
106 MaximumFileInfoByHandleClass
,
108 pub type PFILE_INFO_BY_HANDLE_CLASS
= *mut FILE_INFO_BY_HANDLE_CLASS
;
109 pub type CRITICAL_SECTION
= ::RTL_CRITICAL_SECTION
;
110 pub type PCRITICAL_SECTION
= ::PRTL_CRITICAL_SECTION
;
111 pub type LPCRITICAL_SECTION
= ::PRTL_CRITICAL_SECTION
;
112 pub type CRITICAL_SECTION_DEBUG
= ::RTL_CRITICAL_SECTION_DEBUG
;
113 pub type PCRITICAL_SECTION_DEBUG
= ::PRTL_CRITICAL_SECTION_DEBUG
;
114 pub type LPCRITICAL_SECTION_DEBUG
= ::PRTL_CRITICAL_SECTION_DEBUG
;
115 pub type LPOVERLAPPED_COMPLETION_ROUTINE
= Option
<unsafe extern "system" fn(
116 dwErrorCode
: ::DWORD
, dwNumberOfBytesTransfered
: ::DWORD
, lpOverlapped
: LPOVERLAPPED
,
118 pub const LOCKFILE_FAIL_IMMEDIATELY
: ::DWORD
= 0x00000001;
119 pub const LOCKFILE_EXCLUSIVE_LOCK
: ::DWORD
= 0x00000002;
120 STRUCT
!{struct PROCESS_HEAP_ENTRY_Block
{
122 dwReserved
: [::DWORD
; 3],
124 STRUCT
!{struct PROCESS_HEAP_ENTRY_Region
{
125 dwCommittedSize
: ::DWORD
,
126 dwUnCommittedSize
: ::DWORD
,
127 lpFirstBlock
: ::LPVOID
,
128 lpLastBlock
: ::LPVOID
,
130 STRUCT
!{struct PROCESS_HEAP_ENTRY
{
134 iRegionIndex
: ::BYTE
,
136 Region
: PROCESS_HEAP_ENTRY_Region
,
138 UNION
!(PROCESS_HEAP_ENTRY
, Region
, Block
, Block_mut
, PROCESS_HEAP_ENTRY_Block
);
139 pub type LPPROCESS_HEAP_ENTRY
= *mut PROCESS_HEAP_ENTRY
;
140 pub type PPROCESS_HEAP_ENTRY
= *mut PROCESS_HEAP_ENTRY
;
141 pub const PROCESS_HEAP_REGION
: ::WORD
= 0x0001;
142 pub const PROCESS_HEAP_UNCOMMITTED_RANGE
: ::WORD
= 0x0002;
143 pub const PROCESS_HEAP_ENTRY_BUSY
: ::WORD
= 0x0004;
144 pub const PROCESS_HEAP_SEG_ALLOC
: ::WORD
= 0x0008;
145 pub const PROCESS_HEAP_ENTRY_MOVEABLE
: ::WORD
= 0x0010;
146 pub const PROCESS_HEAP_ENTRY_DDESHARE
: ::WORD
= 0x0020;
147 pub type PTHREAD_START_ROUTINE
= Option
<unsafe extern "system" fn(
148 lpThreadParameter
: ::LPVOID
,
150 pub type LPTHREAD_START_ROUTINE
= PTHREAD_START_ROUTINE
;
151 pub type LPCONTEXT
= ::PCONTEXT
;
152 STRUCT
!{struct REASON_CONTEXT_Detailed
{
153 LocalizedReasonModule
: ::HMODULE
,
154 LocalizedReasonId
: ::ULONG
,
155 ReasonStringCount
: ::ULONG
,
156 ReasonStrings
: *mut ::LPWSTR
,
158 STRUCT
!{struct REASON_CONTEXT
{
161 Reason
: REASON_CONTEXT_Detailed
,
163 UNION
!(REASON_CONTEXT
, Reason
, SimpleReasonString
, SimpleReasonString_mut
, ::LPWSTR
);
164 pub type PREASON_CONTEXT
= *mut REASON_CONTEXT
;
165 pub const EXCEPTION_DEBUG_EVENT
: ::DWORD
= 1;
166 pub const CREATE_THREAD_DEBUG_EVENT
: ::DWORD
= 2;
167 pub const CREATE_PROCESS_DEBUG_EVENT
: ::DWORD
= 3;
168 pub const EXIT_THREAD_DEBUG_EVENT
: ::DWORD
= 4;
169 pub const EXIT_PROCESS_DEBUG_EVENT
: ::DWORD
= 5;
170 pub const LOAD_DLL_DEBUG_EVENT
: ::DWORD
= 6;
171 pub const UNLOAD_DLL_DEBUG_EVENT
: ::DWORD
= 7;
172 pub const OUTPUT_DEBUG_STRING_EVENT
: ::DWORD
= 8;
173 pub const RIP_EVENT
: ::DWORD
= 9;
174 STRUCT
!{struct EXCEPTION_DEBUG_INFO
{
175 ExceptionRecord
: ::EXCEPTION_RECORD
,
176 dwFirstChance
: ::DWORD
,
178 pub type LPEXCEPTION_DEBUG_INFO
= *mut EXCEPTION_DEBUG_INFO
;
179 STRUCT
!{nodebug
struct CREATE_THREAD_DEBUG_INFO
{
181 lpThreadLocalBase
: ::LPVOID
,
182 lpStartAddress
: LPTHREAD_START_ROUTINE
,
184 pub type LPCREATE_THREAD_DEBUG_INFO
= *mut CREATE_THREAD_DEBUG_INFO
;
185 STRUCT
!{nodebug
struct CREATE_PROCESS_DEBUG_INFO
{
189 lpBaseOfImage
: ::LPVOID
,
190 dwDebugInfoFileOffset
: ::DWORD
,
191 nDebugInfoSize
: ::DWORD
,
192 lpThreadLocalBase
: ::LPVOID
,
193 lpStartAddress
: LPTHREAD_START_ROUTINE
,
194 lpImageName
: ::LPVOID
,
197 pub type LPCREATE_PROCESS_DEBUG_INFO
= *mut CREATE_PROCESS_DEBUG_INFO
;
198 STRUCT
!{struct EXIT_THREAD_DEBUG_INFO
{
201 pub type LPEXIT_THREAD_DEBUG_INFO
= *mut EXIT_THREAD_DEBUG_INFO
;
202 STRUCT
!{struct EXIT_PROCESS_DEBUG_INFO
{
205 pub type LPEXIT_PROCESS_DEBUG_INFO
= *mut EXIT_PROCESS_DEBUG_INFO
;
206 STRUCT
!{struct LOAD_DLL_DEBUG_INFO
{
208 lpBaseOfDll
: ::LPVOID
,
209 dwDebugInfoFileOffset
: ::DWORD
,
210 nDebugInfoSize
: ::DWORD
,
211 lpImageName
: ::LPVOID
,
214 pub type LPLOAD_DLL_DEBUG_INFO
= *mut LOAD_DLL_DEBUG_INFO
;
215 STRUCT
!{struct UNLOAD_DLL_DEBUG_INFO
{
216 lpBaseOfDll
: ::LPVOID
,
218 pub type LPUNLOAD_DLL_DEBUG_INFO
= *mut UNLOAD_DLL_DEBUG_INFO
;
219 STRUCT
!{struct OUTPUT_DEBUG_STRING_INFO
{
220 lpDebugStringData
: ::LPSTR
,
222 nDebugStringLength
: ::WORD
,
224 pub type LPOUTPUT_DEBUG_STRING_INFO
= *mut OUTPUT_DEBUG_STRING_INFO
;
225 STRUCT
!{struct RIP_INFO
{
229 pub type LPRIP_INFO
= *mut RIP_INFO
;
230 #[cfg(target_arch="x86_64")]
231 STRUCT
!{nodebug
struct DEBUG_EVENT
{
232 dwDebugEventCode
: ::DWORD
,
233 dwProcessId
: ::DWORD
,
237 #[cfg(target_arch="x86")]
238 STRUCT
!{nodebug
struct DEBUG_EVENT
{
239 dwDebugEventCode
: ::DWORD
,
240 dwProcessId
: ::DWORD
,
244 UNION
!(DEBUG_EVENT
, u
, Exception
, Exception_mut
, EXCEPTION_DEBUG_INFO
);
245 UNION
!(DEBUG_EVENT
, u
, CreateThread
, CreateThread_mut
, CREATE_THREAD_DEBUG_INFO
);
246 UNION
!(DEBUG_EVENT
, u
, CreateProcessInfo
, CreateProcessInfo_mut
, CREATE_PROCESS_DEBUG_INFO
);
247 UNION
!(DEBUG_EVENT
, u
, ExitThread
, ExitThread_mut
, EXIT_THREAD_DEBUG_INFO
);
248 UNION
!(DEBUG_EVENT
, u
, ExitProcess
, ExitProcess_mut
, EXIT_PROCESS_DEBUG_INFO
);
249 UNION
!(DEBUG_EVENT
, u
, LoadDll
, LoadDll_mut
, LOAD_DLL_DEBUG_INFO
);
250 UNION
!(DEBUG_EVENT
, u
, UnloadDll
, UnloadDll_mut
, UNLOAD_DLL_DEBUG_INFO
);
251 UNION
!(DEBUG_EVENT
, u
, DebugString
, DebugString_mut
, OUTPUT_DEBUG_STRING_INFO
);
252 UNION
!(DEBUG_EVENT
, u
, RipInfo
, RipInfo_mut
, RIP_INFO
);
253 pub type LPDEBUG_EVENT
= *mut DEBUG_EVENT
;