source: Include/api_system.sbp@ 166

Last change on this file since 166 was 160, checked in by イグトランス (egtra), 18 years ago

API宣言の追加(主にフォーラムに投稿されたものより)

File size: 69.5 KB
Line 
1' api_system.sbp - System API
2
3#ifndef _INC_SYSTEM
4#define _INC_SYSTEM
5
6#ifdef UNICODE
7Const _FuncName_CompareString = "CompareStringW"
8Const _FuncName_CopyFile = "CopyFileW"
9Const _FuncName_CreateDirectory = "CreateDirectoryW"
10Const _FuncName_CreateEvent = "CreateEventW"
11Const _FuncName_CreateMutex = "CreateMutexW"
12Const _FuncName_CreateSemaphore = "CreateSemaphoreW"
13Const _FuncName_CreateWaitableTimer = "CreateWaitableTimerW"
14Const _FuncName_CreateFile = "CreateFileW"
15Const _FuncName_CreateFileMapping = "CreateFileMappingW"
16Const _FuncName_OpenFileMapping = "OpenFileMappingW"
17Const _FuncName_CreateMailslot = "CreateMailslotW"
18Const _FuncName_CreateProcess = "CreateProcessW"
19Const _FuncName_DeleteFile = "DeleteFileW"
20Const _FuncName_ExpandEnvironmentStrings = "ExpandEnvironmentStringsW"
21Const _FuncName_FatalAppExit = "FatalAppExitW"
22Const _FuncName_FindFirstChangeNotification = "FindFirstChangeNotificationW"
23Const _FuncName_FindFirstFile = "FindFirstFileW"
24Const _FuncName_FindNextFile = "FindNextFileW"
25Const _FuncName_FindResource = "FindResourceW"
26Const _FuncName_FormatMessage = "FormatMessageW"
27Const _FuncName_FreeEnvironmentStrings = "FreeEnvironmentStringsW"
28Const _FuncName_GetCompressedFileSize = "GetCompressedFileSizeW"
29Const _FuncName_GetComputerName = "GetComputerNameW"
30Const _FuncName_GetCurrentDirectory = "GetCurrentDirectoryW"
31Const _FuncName_GetDateFormat = "GetDateFormatW"
32Const _FuncName_GetDiskFreeSpace = "GetDiskFreeSpaceW"
33Const _FuncName_GetDiskFreeSpaceEx = "GetDiskFreeSpaceExW"
34Const _FuncName_GetVolumeInformation = "GetVolumeInformationW"
35Const _FuncName_GetDriveType = "GetDriveTypeW"
36Const _FuncName_GetEnvironmentVariable = "GetEnvironmentVariableW"
37Const _FuncName_GetEnvironmentStrings = "GetEnvironmentStringsW"
38Const _FuncName_GetFileAttributes = "GetFileAttributesW"
39Const _FuncName_GetFullPathName = "GetFullPathNameW"
40Const _FuncName_GetLogicalDriveStrings = "GetLogicalDriveStringsW"
41Const _FuncName_GetLongPathName = "GetLongPathNameW"
42Const _FuncName_GetModuleFileName = "GetModuleFileNameW"
43Const _FuncName_GetModuleHandle = "GetModuleHandleW"
44Const _FuncName_GetShortPathName = "GetShortPathNameW"
45Const _FuncName_GetStartupInfo = "GetStartupInfoW"
46Const _FuncName_GetSystemDirectory = "GetSystemDirectoryW"
47Const _FuncName_GetTempFileName = "GetTempFileNameW"
48Const _FuncName_GetTempPath = "GetTempPathW"
49Const _FuncName_GetTimeFormat = "GetTimeFormatW"
50Const _FuncName_GetUserName = "GetUserNameW"
51Const _FuncName_GetVersionEx = "GetVersionExW"
52Const _FuncName_GetWindowsDirectory = "GetWindowsDirectoryW"
53Const _FuncName_LCMapString = "LCMapStringW"
54Const _FuncName_LoadLibrary = "LoadLibraryW"
55Const _FuncName_LoadLibraryEx = "LoadLibraryExW"
56Const _FuncName_LookupPrivilegeValue = "LookupPrivilegeValueW"
57Const _FuncName_lstrcat = "lstrcatW"
58Const _FuncName_lstrcmp = "lstrcmpW"
59Const _FuncName_lstrcmpi = "lstrcmpiW"
60Const _FuncName_lstrcpy = "lstrcpyW"
61Const _FuncName_lstrcpyn = "lstrcpynW"
62Const _FuncName_MoveFile = "MoveFileW"
63Const _FuncName_OpenEvent = "OpenEventW"
64Const _FuncName_OpenMutex = "OpenMutexW"
65Const _FuncName_OpenSemaphore = "OpenSemaphoreW"
66Const _FuncName_OpenWaitableTimer = "OpenWaitableTimerW"
67Const _FuncName_RemoveDirectory = "RemoveDirectoryW"
68Const _FuncName_SetComputerName = "SetComputerNameW"
69Const _FuncName_SetCurrentDirectory = "SetCurrentDirectoryW"
70Const _FuncName_SearchPath = "SearchPathW"
71Const _FuncName_SetEnvironmentVariable = "SetEnvironmentVariableW"
72Const _FuncName_SetFileAttributes = "SetFileAttributesW"
73#else
74Const _FuncName_CompareString = "CompareStringA"
75Const _FuncName_CopyFile = "CopyFileA"
76Const _FuncName_CreateDirectory = "CreateDirectoryA"
77Const _FuncName_CreateEvent = "CreateEventA"
78Const _FuncName_CreateMutex = "CreateMutexA"
79Const _FuncName_CreateSemaphore = "CreateSemaphoreA"
80Const _FuncName_CreateWaitableTimer = "CreateWaitableTimerA"
81Const _FuncName_CreateFile = "CreateFileA"
82Const _FuncName_CreateFileMapping = "CreateFileMappingA"
83Const _FuncName_OpenFileMapping = "OpenFileMappingA"
84Const _FuncName_CreateMailslot = "CreateMailslotA"
85Const _FuncName_CreateProcess = "CreateProcessA"
86Const _FuncName_DeleteFile = "DeleteFileA"
87Const _FuncName_ExpandEnvironmentStrings = "ExpandEnvironmentStringsA"
88Const _FuncName_FatalAppExit = "FatalAppExitA"
89Const _FuncName_FindFirstChangeNotification = "FindFirstChangeNotificationA"
90Const _FuncName_FindFirstFile = "FindFirstFileA"
91Const _FuncName_FindNextFile = "FindNextFileA"
92Const _FuncName_FindResource = "FindResourceA"
93Const _FuncName_FormatMessage = "FormatMessageA"
94Const _FuncName_FreeEnvironmentStrings = "FreeEnvironmentStringsA"
95Const _FuncName_GetCompressedFileSize = "GetCompressedFileSizeA"
96Const _FuncName_GetComputerName = "GetComputerNameA"
97Const _FuncName_GetCurrentDirectory = "GetCurrentDirectoryA"
98Const _FuncName_GetDateFormat = "GetDateFormatA"
99Const _FuncName_GetDiskFreeSpace = "GetDiskFreeSpaceA"
100Const _FuncName_GetDiskFreeSpaceEx = "GetDiskFreeSpaceExA"
101Const _FuncName_GetVolumeInformation = "GetVolumeInformationA"
102Const _FuncName_GetDriveType = "GetDriveTypeA"
103Const _FuncName_GetEnvironmentVariable = "GetEnvironmentVariableA"
104Const _FuncName_GetEnvironmentStrings = "GetEnvironmentStringsA"
105Const _FuncName_GetFileAttributes = "GetFileAttributesA"
106Const _FuncName_GetFullPathName = "GetFullPathNameA"
107Const _FuncName_GetLogicalDriveStrings = "GetLogicalDriveStringsA"
108Const _FuncName_GetLongPathName = "GetLongPathNameA"
109Const _FuncName_GetModuleFileName = "GetModuleFileNameA"
110Const _FuncName_GetModuleHandle = "GetModuleHandleA"
111Const _FuncName_GetShortPathName = "GetShortPathNameA"
112Const _FuncName_GetStartupInfo = "GetStartupInfoA"
113Const _FuncName_GetSystemDirectory = "GetSystemDirectoryA"
114Const _FuncName_GetTempFileName = "GetTempFileNameA"
115Const _FuncName_GetTempPath = "GetTempPathA"
116Const _FuncName_GetTimeFormat = "GetTimeFormatA"
117Const _FuncName_GetUserName = "GetUserNameA"
118Const _FuncName_GetVersionEx = "GetVersionExA"
119Const _FuncName_GetWindowsDirectory = "GetWindowsDirectoryA"
120Const _FuncName_LCMapString = "LCMapStringA"
121Const _FuncName_LoadLibrary = "LoadLibraryA"
122Const _FuncName_LoadLibraryEx = "LoadLibraryExA"
123Const _FuncName_LookupPrivilegeValue = "LookupPrivilegeValueA"
124Const _FuncName_lstrcat = "lstrcatA"
125Const _FuncName_lstrcmp = "lstrcmpA"
126Const _FuncName_lstrcmpi = "lstrcmpiA"
127Const _FuncName_lstrcpy = "lstrcpyA"
128Const _FuncName_lstrcpyn = "lstrcpynA"
129Const _FuncName_MoveFile = "MoveFileA"
130Const _FuncName_OpenEvent = "OpenEventA"
131Const _FuncName_OpenMutex = "OpenMutexA"
132Const _FuncName_OpenSemaphore = "OpenSemaphoreA"
133Const _FuncName_OpenWaitableTimer = "OpenWaitableTimerA"
134Const _FuncName_RemoveDirectory = "RemoveDirectoryA"
135Const _FuncName_SetComputerName = "SetComputerNameA"
136Const _FuncName_SetCurrentDirectory = "SetCurrentDirectoryA"
137Const _FuncName_SearchPath = "SearchPathA"
138Const _FuncName_SetEnvironmentVariable = "SetEnvironmentVariableA"
139Const _FuncName_SetFileAttributes = "SetFileAttributesA"
140#endif
141
142
143'-------------------
144' default constants
145Const NULL = 0
146Const TRUE = 1
147Const FALSE = 0
148
149Const _System_TRUE = -1
150Const _System_FALSE = 0
151
152Const MAX_PATH = 260
153Const INVALID_HANDLE_VALUE = -1 As HANDLE
154Const INVALID_SET_FILE_POINTER = &HFFFFFFFF
155
156Const SYNCHRONIZE = &H00100000
157Const STANDARD_RIGHTS_REQUIRED = &H000F0000
158
159Const MAXIMUM_WAIT_OBJECTS = 64
160
161'-----------------
162' data structs
163Type LARGE_INTEGER
164 LowPart As DWord
165 HighPart As Long
166End Type
167Type ULARGE_INTEGER
168 LowPart As DWord
169 HighPart As DWord
170End Type
171
172
173'Globally Unique Identifier 128 bit(16 byte)
174Type GUID
175 Data1 As DWord
176 Data2 As Word
177 Data3 As Word
178 Data4[7] As Byte
179End Type
180
181' File structure
182Type SECURITY_ATTRIBUTES
183 nLength As DWord
184 lpSecurityDescriptor As VoidPtr
185 bInheritHandle As BOOL
186End Type
187
188Type OVERLAPPED
189 Internal As ULONG_PTR
190 InternalHigh As ULONG_PTR
191 Offset As DWord
192 OffsetHigh As DWord
193 hEvent As HANDLE
194End Type
195
196Type FILETIME
197 dwLowDateTime As DWord
198 dwHighDateTime As DWord
199End Type
200
201' System time
202Type SYSTEMTIME
203 wYear As Word
204 wMonth As Word
205 wDayOfWeek As Word
206 wDay As Word
207 wHour As Word
208 wMinute As Word
209 wSecond As Word
210 wMilliseconds As Word
211End Type
212
213#ifdef _WIN64
214Const CONTEXT_AMD64 = &h100000
215
216Const CONTEXT_CONTROL = (CONTEXT_AMD64 Or &h1)
217Const CONTEXT_INTEGER = (CONTEXT_AMD64 Or &h2)
218Const CONTEXT_SEGMENTS = (CONTEXT_AMD64 Or &h4)
219Const CONTEXT_FLOATING_POINT = (CONTEXT_AMD64 Or &h8)
220Const CONTEXT_DEBUG_REGISTERS = (CONTEXT_AMD64 Or &h10)
221
222Const CONTEXT_FULL = (CONTEXT_CONTROL Or CONTEXT_INTEGER Or CONTEXT_FLOATING_POINT)
223
224Const CONTEXT_ALL = (CONTEXT_CONTROL Or CONTEXT_INTEGER Or CONTEXT_SEGMENTS Or CONTEXT_FLOATING_POINT Or CONTEXT_DEBUG_REGISTERS)
225
226Type Align(16) M128
227 Low As QWord
228 High As Int64
229End Type
230
231Type LEGACY_SAVE_AREA 'Winnt.h
232 ControlWord As Word
233 Reserved0 As Word
234 StatusWord As Word
235 Reserved1 As Word
236 TagWord As Word
237 Reserved2 As Word
238 ErrorOffset As DWord
239 ErrorSelector As Word
240 ErrorOpcode As Word
241 DataOffset As DWord
242 DataSelector As Word
243 Reserved3 As Word
244 FloatRegisters[ELM(8 * 10)] As Byte
245End Type
246
247Type Align(16) CONTEXT 'Winnt.h
248 'Register parameter home addresses.
249 P1Home As QWord
250 P2Home As QWord
251 P3Home As QWord
252 P4Home As QWord
253 P5Home As QWord
254 P6Home As QWord
255 'Control flags.
256 ContextFlags As DWord
257 MxCsr As DWord
258 'Segment Registers and processor flags.
259 SegCs As Word
260 SegDs As Word
261 SegEs As Word
262 SegFs As Word
263 SegGs As Word
264 SegSs As Word
265 EFlags As DWord
266 'Debug registers
267 Dr0 As QWord
268 Dr1 As QWord
269 Dr2 As QWord
270 Dr3 As QWord
271 Dr6 As QWord
272 Dr7 As QWord
273 'Integer registers.
274 Rax As QWord
275 Rcx As QWord
276 Rdx As QWord
277 Rbx As QWord
278 Rsp As QWord
279 Rbp As QWord
280 Rsi As QWord
281 Rdi As QWord
282 R8 As QWord
283 R9 As QWord
284 R10 As QWord
285 R11 As QWord
286 R12 As QWord
287 R13 As QWord
288 R14 As QWord
289 R15 As QWord
290 'Program counter.
291 Rip As QWord
292 'MMX/floating point state.
293 Header[ELM(2)] As M128
294 Legacy[ELM(8)] As M128
295 Xmm0 As M128
296 Xmm1 As M128
297 Xmm2 As M128
298 Xmm3 As M128
299 Xmm4 As M128
300 Xmm5 As M128
301 Xmm6 As M128
302 Xmm7 As M128
303 Xmm8 As M128
304 Xmm9 As M128
305 Xmm10 As M128
306 Xmm11 As M128
307 Xmm12 As M128
308 Xmm13 As M128
309 Xmm14 As M128
310 Xmm15 As M128
311 Reserve[ELM(96)] As Byte
312 'Vector registers
313 VectorRegisters[ELM(26)] As M128
314 VectorControl As QWord
315 'Special debug control registers.
316 DebugControl As QWord
317 LastBranchToRip As QWord
318 LastBranchFromRip As QWord
319 LastExceptionToRip As QWord
320 LastExceptionFromRip As QWord
321End Type
322
323#else
324
325Const SIZE_OF_80387_REGISTERS = 80
326Const MAXIMUM_SUPPORTED_EXTENSION = 512
327
328Type FLOATING_SAVE_AREA
329 ControlWord As DWord
330 StatusWord As DWord
331 TagWord As DWord
332 ErrorOffset As DWord
333 ErrorSelector As DWord
334 DataOffset As DWord
335 DataSelector As DWord
336 RegisterArea[ELM(SIZE_OF_80387_REGISTERS)] As Byte
337 Cr0NpxState As DWord
338End Type
339
340Const CONTEXT_i386 = &h00010000
341Const CONTEXT_i486 = &h00010000
342
343Const CONTEXT_CONTROL = (CONTEXT_i386 Or &h00000001) 'SS:SP, CS:IP, FLAGS, BP
344Const CONTEXT_INTEGER = (CONTEXT_i386 Or &h00000002) 'AX, BX, CX, DX, SI, DI
345Const CONTEXT_SEGMENTS = (CONTEXT_i386 Or &h00000004) 'DS, ES, FS, GS
346Const CONTEXT_FLOATING_POINT = (CONTEXT_i386 Or &h00000008) '387 state
347Const CONTEXT_DEBUG_REGISTERS = (CONTEXT_i386 Or &h00000010) 'DB 0-3,6,7
348Const CONTEXT_EXTENDED_REGISTERS = (CONTEXT_i386 Or &h0000002) 'cpu specific extensions
349
350Const CONTEXT_FULL = (CONTEXT_CONTROL Or CONTEXT_INTEGER Or CONTEXT_SEGMENTS)
351
352Const CONTEXT_ALL = (CONTEXT_CONTROL Or CONTEXT_INTEGER Or CONTEXT_SEGMENTS Or CONTEXT_FLOATING_POINT Or CONTEXT_DEBUG_REGISTERS Or CONTEXT_EXTENDED_REGISTERS)
353
354Type CONTEXT
355 ContextFlags As DWord
356
357 Dr0 As DWord
358 Dr1 As DWord
359 Dr2 As DWord
360 Dr3 As DWord
361 Dr6 As DWord
362 Dr7 As DWord
363
364 FloatSave As FLOATING_SAVE_AREA
365
366 SegGs As DWord
367 SegFs As DWord
368 SegEs As DWord
369 SegDs As DWord
370
371 Edi As DWord
372 Esi As DWord
373 Ebx As DWord
374 Edx As DWord
375 Ecx As DWord
376 Eax As DWord
377
378 Ebp As DWord
379 Eip As DWord
380 SegCs As DWord
381 EFlags As DWord
382 Esp As DWord
383 SegSs As DWord
384
385 ExtendedRegisters[ELM(MAXIMUM_SUPPORTED_EXTENSION)] As Byte
386End Type
387
388#endif
389
390' Global Memory Flags
391Const GMEM_FIXED = &H0000
392Const GMEM_MOVEABLE = &H0002
393Const GMEM_NOCOMPACT = &H0010
394Const GMEM_NODISCARD = &H0020
395Const GMEM_ZEROINIT = &H0040
396Const GMEM_MODIFY = &H0080
397Const GMEM_DISCARDABLE = &H0100
398Const GMEM_NOT_BANKED = &H1000
399Const GMEM_SHARE = &H2000
400Const GMEM_DDESHARE = &H2000
401Const GMEM_INVALID_HANDLE = &H8000
402Const GHND = GMEM_MOVEABLE or GMEM_ZEROINIT
403Const GPTR = GMEM_FIXED or GMEM_ZEROINIT
404Const GMEM_DISCARDED = &H4000
405
406
407' Heap
408Const HEAP_NO_SERIALIZE = &H00000001
409Const HEAP_GROWABLE = &H00000002
410Const HEAP_GENERATE_EXCEPTIONS = &H00000004
411Const HEAP_ZERO_MEMORY = &H00000008
412Const HEAP_REALLOC_IN_PLACE_ONLY = &H00000010
413
414
415' Locale
416Const LOCALE_SYSTEM_DEFAULT = &H400 'Standard Systemsprache
417Const LOCALE_USER_DEFAULT = &H800 'Standard Benutzersprache
418
419
420' Locale flag
421Const LOCALE_NOUSEROVERRIDE = &H80000000
422
423
424'Critical Section
425Type CRITICAL_SECTION
426 DebugInfo As VoidPtr
427 LockCount As Long
428 RecursionCount As Long
429 OwningThread As HANDLE
430 LockSemaphore As HANDLE
431 SpinCount As ULONG_PTR
432End Type
433
434
435'DllMain
436Const DLL_PROCESS_ATTACH = 1
437Const DLL_THREAD_ATTACH = 2
438Const DLL_THREAD_DETACH = 3
439Const DLL_PROCESS_DETACH = 0
440
441'Event
442Const EVENT_MODIFY_STATE = &H0002
443Const EVENT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &H3)
444
445'Mutex
446Const MUTANT_QUERY_STATE = &H0001
447Const MUTANT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or MUTANT_QUERY_STATE)
448Const MUTEX_ALL_ACCESS = MUTANT_ALL_ACCESS
449
450'Semaphore
451Const SEMAPHORE_MODIFY_STATE = &H0002
452Const SEMAPHORE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &H3)
453
454'Timer
455Const TIMER_QUERY_STATE = &H0001
456Const TIMER_MODIFY_STATE = &H0002
457Const TIMER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or TIMER_QUERY_STATE Or TIMER_MODIFY_STATE)
458
459'----------------------
460' Kernel Operation API
461Declare Function InterlockedIncrement Lib "kernel32" (ByRef lpAddend As Long) As Long
462Declare Function InterlockedDecrement Lib "kernel32" (ByRef lpAddend As Long) As Long
463Declare Function InterlockedExchange Lib "kernel32" (ByRef Target As Long, Value As Long) As Long
464Declare Function InterlockedCompareExchange Lib "kernel32" (ByRef Destination As Long, Exchange As Long, Comperand As Long) As Long
465Declare Function InterlockedExchangeAdd Lib "kernel32" (ByRef Addend As Long, Value As Long) As Long
466#ifdef _WIN64
467Declare Function InterlockedCompareExchangePointer Lib "kernel32" (ByRef Destination As VoidPtr, Exchange As VoidPtr, Comperand As VoidPtr) As VoidPtr
468Declare Function InterlockedExchangePointer Lib "kernel32" (ByRef Target As VoidPtr, Value As VoidPtr) As VoidPtr
469#else
470Declare Function InterlockedCompareExchangePointer Lib "kernel32" Alias "InterlockedCompareExchange" (ByRef Destination As VoidPtr, Exchange As VoidPtr, Comperand As VoidPtr) As VoidPtr
471Declare Function InterlockedExchangePointer Lib "kernel32" Alias "InterlockedExchange" (ByRef Target As VoidPtr, Value As VoidPtr) As VoidPtr
472#endif
473
474
475Declare Function Beep Lib "kernel32" (dwFreq As DWord, dwDuration As DWord) As BOOL
476Declare Function CloseHandle Lib "kernel32" (hObject As HANDLE) As BOOL
477
478Declare Function CompareFileTime Lib "kernel32" (ByRef FileTime1 As FILETIME, ByRef FileTime2 As FILETIME) As Long
479
480Const NORM_IGNORECASE = &H00000001
481Const NORM_IGNORENONSPACE = &H00000002
482Const NORM_IGNORESYMBOLS = &H00000004
483Const SORT_STRINGSORT = &H00001000
484Const NORM_IGNOREKANATYPE = &H00010000
485Const NORM_IGNOREWIDTH = &H00020000
486Const CSTR_LESS_THAN = 1
487Const CSTR_EQUAL = 2
488Const CSTR_GREATER_THAN = 3
489Declare Function CompareString Lib "kernel32" Alias _FuncName_CompareString (Locale As LCID, dwCmpFlags As DWord, pString1 As PCTSTR, cchCount1 As Long, pString2 As PCTSTR, cchCount2 As Long) As Long
490
491Declare Function CopyFile Lib "kernel32" Alias _FuncName_CopyFile (pExistingFileName As PCTSTR, pNewFileName As PCTSTR, bFailIfExists As BOOL) As BOOL
492Declare Function CreateDirectory Lib "kernel32" Alias _FuncName_CreateDirectory (pPathName As PCTSTR, pSecurityAttributes As *SECURITY_ATTRIBUTES) As BOOL
493Declare Function CreateEvent Lib "kernel32" Alias _FuncName_CreateEvent (pEventAttributes As *SECURITY_ATTRIBUTES, bManualReset As BOOL, bInitialState As BOOL, pName As PCTSTR) As HANDLE
494Declare Function CreateMutex Lib "kernel32" Alias _FuncName_CreateMutex (lpMutexAttributes As *SECURITY_ATTRIBUTES, bInitialOwner As BOOL, lpName As PCTSTR) As HANDLE
495Declare Function CreatePipe Lib "Kernel32" (
496 ByRef hReadPipe As HANDLE,
497 ByRef hWritePipe As HANDLE,
498 ByVal pPipeAttributes As *SECURITY_ATTRIBUTES,
499 ByVal nSize As DWORD) As Long
500Declare Function CreateSemaphore Lib "kernel32" Alias _FuncName_CreateSemaphore (pSemaphoreAttributes As *SECURITY_ATTRIBUTES, lInitialCount As Long, lMaximumCount As Long, pName As PCTSTR) As HANDLE
501
502TypeDef PTIMERAPCROUTINE = *Sub(lpArgToCompletionRoutine As VoidPtr, dwTimerLowValue As DWord, dwTimerHighValue As DWord)
503Declare Function CreateWaitableTimer Lib "kernel32" Alias _FuncName_CreateWaitableTimer (pTimerAttributes As *SECURITY_ATTRIBUTES, bManualReset As BOOL, pTimerName As PCTSTR) As HANDLE
504Declare Function OpenWaitableTimer Lib "kernel32" Alias _FuncName_OpenWaitableTimer (dwDesiredAccess As DWord, bInheritHandle As BOOL, pTimerName As PCTSTR) As HANDLE
505Declare Function SetWaitableTimer Lib "kernel32" (hTimer As HANDLE, pDueTime As *LARGE_INTEGER, lPeriod As Long, pfnCompletionRoutine As PTIMERAPCROUTINE, pArgToCompletionRoutine As VoidPtr, fResume As BOOL) As BOOL
506Declare Function CancelWaitableTimer Lib "kernel32" (hTimer As HANDLE) As BOOL
507
508Const GENERIC_READ = &H80000000
509Const GENERIC_WRITE = &H40000000
510Const FILE_SHARE_READ = &H00000001
511Const FILE_SHARE_WRITE = &H00000002
512Const FILE_SHARE_DELETE = &H00000004
513Const CREATE_NEW = 1
514Const CREATE_ALWAYS = 2
515Const OPEN_EXISTING = 3
516Const OPEN_ALWAYS = 4
517Const TRUNCATE_EXISTING = 5
518Const FILE_ATTRIBUTE_READONLY = &H00000001
519Const FILE_ATTRIBUTE_HIDDEN = &H00000002
520Const FILE_ATTRIBUTE_SYSTEM = &H00000004
521Const FILE_ATTRIBUTE_DIRECTORY = &H00000010
522Const FILE_ATTRIBUTE_ARCHIVE = &H00000020
523Const FILE_ATTRIBUTE_ENCRYPTED = &H00000040
524Const FILE_ATTRIBUTE_NORMAL = &H00000080
525Const FILE_ATTRIBUTE_TEMPORARY = &H00000100
526Const FILE_ATTRIBUTE_SPARSE_FILE = &H00000200
527Const FILE_ATTRIBUTE_REPARSE_POINT = &H00000400
528Const FILE_ATTRIBUTE_COMPRESSED = &H00000800
529Const FILE_ATTRIBUTE_OFFLINE = &H00001000
530Const FILE_FLAG_WRITE_THROUGH = &H80000000
531Const FILE_FLAG_OVERLAPPED = &H40000000
532Const FILE_FLAG_NO_BUFFERING = &H20000000
533Const FILE_FLAG_RANDOM_ACCESS = &H10000000
534Const FILE_FLAG_SEQUENTIAL_SCAN = &H08000000
535Const FILE_FLAG_DELETE_ON_CLOSE = &H04000000
536Const FILE_FLAG_BACKUP_SEMANTICS = &H02000000
537Const FILE_FLAG_POSIX_SEMANTICS = &H01000000
538Const FILE_FLAG_OPEN_REPARSE_POINT = &H00200000
539Const FILE_FLAG_OPEN_NO_RECALL = &H00100000
540Declare Function CreateFile Lib "kernel32" Alias _FuncName_CreateFile (pFileName As PCTSTR, dwDesiredAccess As DWord, dwShareMode As DWord, ByRef lpSecurityAttributes As SECURITY_ATTRIBUTES, dwCreationDisposition As DWord, dwFlagsAndAttributes As DWord, hTemplateFile As HANDLE) As HANDLE
541
542Const SECTION_QUERY = &H0001
543Const SECTION_MAP_WRITE = &H0002
544Const SECTION_MAP_READ = &H0004
545Const SECTION_MAP_EXECUTE = &H0008
546Const SECTION_EXTEND_SIZE = &H0010
547Const SECTION_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SECTION_QUERY Or SECTION_MAP_WRITE Or SECTION_MAP_READ Or SECTION_MAP_EXECUTE Or SECTION_EXTEND_SIZE)
548
549Const FILE_MAP_COPY = SECTION_QUERY
550Const FILE_MAP_WRITE = SECTION_MAP_WRITE
551Const FILE_MAP_READ = SECTION_MAP_READ
552Const FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS
553Declare Function CreateFileMapping Lib "kernel32" Alias _FuncName_CreateFileMapping (hFile As HANDLE, pFileMappingAttributes As *SECURITY_ATTRIBUTES, flProtect As DWord, dwMaximumSizeHigh As DWord, dwMaximumSizeLow As DWord, pName As PCSTR) As HANDLE
554Declare Function OpenFileMapping Lib "kernel32" Alias _FuncName_OpenFileMapping (dwDesiredAccess As DWord, bInheritHandle As BOOL, pName As PCSTR) As HANDLE
555Declare Function MapViewOfFile Lib "kernel32" (hFileMappingObject As HANDLE, dwDesiredAccess As DWord, dwFileOffsetHigh As DWord, dwFileOffsetLow As DWord, dwNumberOfBytesToMap As DWord) As VoidPtr
556Declare Function MapViewOfFileEx Lib "kernel32" (hFileMappingObject As HANDLE, dwDesiredAccess As DWord, dwFileOffsetHigh As DWord, dwFileOffsetLow As DWord, dwNumberOfBytesToMap As DWord, lpBaseAddress As VoidPtr) As VoidPtr
557Declare Function FlushViewOfFile Lib "kernel32" (lpBaseAddress As VoidPtr, dwNumberOfBytesToFlush As DWord) As BOOL
558Declare Function UnmapViewOfFile Lib "kernel32" (lpBaseAddress As VoidPtr) As BOOL
559
560Const MAILSLOT_WAIT_FOREVER = &HFFFFFFFF
561Declare Function CreateMailslot Lib "kernel32" Alias _FuncName_CreateMailslot (pName As PCTSTR, nMaxMessageSize As DWord, lReadTimeout As DWord, pSecurityAttributes As *SECURITY_ATTRIBUTES) As HANDLE
562
563Const DEBUG_PROCESS = &H00000001
564Const DEBUG_ONLY_THIS_PROCESS = &H00000002
565Const CREATE_SUSPENDED = &H00000004
566Const DETACHED_PROCESS = &H00000008
567Const CREATE_NEW_CONSOLE = &H00000010
568Const NORMAL_PRIORITY_CLASS = &H00000020
569Const IDLE_PRIORITY_CLASS = &H00000040
570Const HIGH_PRIORITY_CLASS = &H00000080
571Const REALTIME_PRIORITY_CLASS = &H00000100
572Const CREATE_NEW_PROCESS_GROUP = &H00000200
573Const CREATE_UNICODE_ENVIRONMENT = &H00000400
574Const CREATE_SEPARATE_WOW_VDM = &H00000800
575Const CREATE_SHARED_WOW_VDM = &H00001000
576Const CREATE_FORCEDOS = &H00002000
577Const CREATE_DEFAULT_ERROR_MODE = &H04000000
578Const CREATE_NO_WINDOW = &H08000000
579Const PROFILE_USER = &H10000000
580Const PROFILE_KERNEL = &H20000000
581Const PROFILE_SERVER = &H40000000
582
583Const STARTF_USESHOWWINDOW = &H00000001
584Const STARTF_USESIZE = &H00000002
585Const STARTF_USEPOSITION = &H00000004
586Const STARTF_USECOUNTCHARS = &H00000008
587Const STARTF_USEFILLATTRIBUTE = &H00000010
588Const STARTF_RUNFULLSCREEN = &H00000020
589Const STARTF_FORCEONFEEDBACK = &H00000040
590Const STARTF_FORCEOFFFEEDBACK = &H00000080
591Const STARTF_USESTDHANDLES = &H00000100
592Const STARTF_USEHOTKEY = &H00000200
593Type STARTUPINFOW
594 cb As DWord
595 lpReserved As LPWSTR
596 lpDesktop As LPWSTR
597 lpTitle As LPWSTR
598 dwX As DWord
599 dwY As DWord
600 dwXSize As DWord
601 dwYSize As DWord
602 dwXCountChars As DWord
603 dwYCountChars As DWord
604 dwFillAttribute As DWord
605 dwFlags As DWord
606 wShowWindow As Word
607 cbReserved2 As Word
608 lpReserved2 As *Byte
609 hStdInput As HANDLE
610 hStdOutput As HANDLE
611 hStdError As HANDLE
612End Type
613Type STARTUPINFOA
614 cb As DWord
615 lpReserved As LPSTR
616 lpDesktop As LPSTR
617 lpTitle As LPSTR
618 dwX As DWord
619 dwY As DWord
620 dwXSize As DWord
621 dwYSize As DWord
622 dwXCountChars As DWord
623 dwYCountChars As DWord
624 dwFillAttribute As DWord
625 dwFlags As DWord
626 wShowWindow As Word
627 cbReserved2 As Word
628 lpReserved2 As *Byte
629 hStdInput As HANDLE
630 hStdOutput As HANDLE
631 hStdError As HANDLE
632End Type
633#ifdef UNICODE
634TypeDef STARTUPINFO = STARTUPINFOW
635#else
636TypeDef STARTUPINFO = STARTUPINFOA
637#endif
638Type PROCESS_INFORMATION
639 hProcess As HANDLE
640 hThread As HANDLE
641 dwProcessId As DWord
642 dwThreadId As DWord
643End Type
644Declare Function CreateProcess Lib "kernel32" Alias _FuncName_CreateProcess (pApplicationName As PCTSTR, pCommandLine As PTSTR, ByRef ProcessAttributes As SECURITY_ATTRIBUTES, ByRef ThreadAttributes As SECURITY_ATTRIBUTES, bInheritHandles As BOOL, dwCreationFlags As DWord, lpEnvironment As VoidPtr, pCurrentDirectory As PCTSTR, ByRef lpStartupInfo As STARTUPINFO, ByRef lpProcessInformation As PROCESS_INFORMATION) As BOOL
645
646TypeDef LPTHREAD_START_ROUTINE = *Function(lpThreadParameter As VoidPtr) As DWord
647Declare Function CreateThread Lib "kernel32" (lpThreadAttributes As *SECURITY_ATTRIBUTES, dwStackSize As DWord, lpStartAddress As LPTHREAD_START_ROUTINE, pParameter As VoidPtr, dwCreationFlags As DWord, ByRef ThreadId As DWord) As HANDLE
648
649Declare Sub DebugBreak Lib "kernel32" ()
650Declare Sub DeleteCriticalSection Lib "kernel32" (ByRef CriticalSection As CRITICAL_SECTION)
651Declare Function DeleteFile Lib "kernel32" Alias _FuncName_DeleteFile (pFileName As PCTSTR) As BOOL
652Declare Function DeviceIoControl Lib "Kernel32" (
653 hDevice As HANDLE,
654 dwIoControlCode As DWord,
655 pInBuffer As VoidPtr,
656 nInBufferSize As DWord,
657 pOutBuffer As VoidPtr,
658 nOutBufferSize As DWord,
659 pBytesReturned As DWordPtr,
660 pOverlapped As *OVERLAPPED
661) As Long
662Declare Function DisableThreadLibraryCalls Lib "kernel32" (hLibModule As HINSTANCE) As BOOL
663Declare Function DosDateTimeToFileTime Lib "kernel32" (wFatDate As Word, wFatTime As Word, ByRef FileTime As FILETIME) As BOOL
664
665Const DUPLICATE_CLOSE_SOURCE = 1
666Const DUPLICATE_SAME_ACCESS = 2
667Declare Function DuplicateHandle Lib "kernel32" (hSourceProcessHandle As HANDLE, hSourceHandle As HANDLE, hTargetProcessHandle As HANDLE, ByRef TargetHandle As HANDLE, dwDesiredAccess As DWord, bInheritHandle As BOOL, dwOptions As DWord) As BOOL
668
669Declare Sub EnterCriticalSection Lib "kernel32" (ByRef lpCriticalSection As CRITICAL_SECTION)
670Declare Sub ExitProcess Lib "kernel32" (dwExitCode As DWord)
671Declare Sub ExitThread Lib "kernel32" (dwExitCode As DWord)
672Declare Sub FatalAppExit Lib "kernel32" Alias _FuncName_FatalAppExit (Action As DWord, pMessageText As PCTSTR)
673Declare Function FileTimeToDosDateTime Lib "kernel32" (ByRef lpFileTime As FILETIME, ByRef lpFatDate As Word, ByRef lpFatTime As Word) As BOOL
674Declare Function FileTimeToLocalFileTime Lib "kernel32" (ByRef lpFileTime As FILETIME, ByRef lpLocalFileTime As FILETIME) As BOOL
675Declare Function FileTimeToSystemTime Lib "kernel32" (ByRef lpFileTime As FILETIME, ByRef lpSystemTime As SYSTEMTIME) As BOOL
676Declare Sub FillMemory Lib "kernel32" Alias "RtlFillMemory" (pDest As VoidPtr, stLength As SIZE_T, c As Byte)
677Declare Function FindClose Lib "kernel32" (hFindFile As HANDLE) As BOOL
678Declare Function FindCloseChangeNotification Lib "kernel32" (hChangeHandle As HANDLE) As BOOL
679Declare Function FindFirstChangeNotification Lib "kernel32" Alias _FuncName_FindFirstChangeNotification (
680 pPathName As PCTSTR,
681 bWatchSubtree As BOOL,
682 dwNotifyFilter As DWord
683) As HANDLE
684
685Type WIN32_FIND_DATAW
686 dwFileAttributes As DWord
687 ftCreationTime As FILETIME
688 ftLastAccessTime As FILETIME
689 ftLastWriteTime As FILETIME
690 nFileSizeHigh As DWord
691 nFileSizeLow As DWord
692 dwReserved0 As DWord
693 dwReserved1 As DWord
694 cFileName[ELM(MAX_PATH)] As WCHAR
695 cAlternateFileName[13] As WCHAR
696End Type
697Type WIN32_FIND_DATAA
698 dwFileAttributes As DWord
699 ftCreationTime As FILETIME
700 ftLastAccessTime As FILETIME
701 ftLastWriteTime As FILETIME
702 nFileSizeHigh As DWord
703 nFileSizeLow As DWord
704 dwReserved0 As DWord
705 dwReserved1 As DWord
706 cFileName[ELM(MAX_PATH)] As SByte
707 cAlternateFileName[13] As SByte
708End Type
709#ifdef UNICODE
710TypeDef WIN32_FIND_DATA = WIN32_FIND_DATAW
711#else
712TypeDef WIN32_FIND_DATA = WIN32_FIND_DATAA
713#endif
714TypeDef LPWIN32_FIND_DATA = *WIN32_FIND_DATA
715Declare Function FindFirstFile Lib "kernel32" Alias _FuncName_FindFirstFile (pFileName As PCTSTR, ByRef FindFildData As WIN32_FIND_DATA) As HANDLE
716Declare Function FindNextChangeNotification Lib "kernel32" (hChangeHandle As HANDLE) As BOOL
717Declare Function FindNextFile Lib "kernel32" Alias _FuncName_FindNextFile (hFindFile As HANDLE, ByRef FindFildData As WIN32_FIND_DATA) As BOOL
718Declare Function FlushFileBuffers Lib "kernel32" (hFile As HANDLE) As BOOL
719Declare Function FlushInstructionCache Lib "kernel32"(hProcess As HANDLE, pBaseAddress As VoidPtr, Size As SIZE_T) As BOOL
720
721Const FORMAT_MESSAGE_ALLOCATE_BUFFER = &H00000100
722Const FORMAT_MESSAGE_IGNORE_INSERTS = &H00000200
723Const FORMAT_MESSAGE_FROM_STRING = &H00000400
724Const FORMAT_MESSAGE_FROM_HMODULE = &H00000800
725Const FORMAT_MESSAGE_FROM_SYSTEM = &H00001000
726Const FORMAT_MESSAGE_ARGUMENT_ARRAY = &H00002000
727Declare Function FormatMessage Lib "kernel32" Alias _FuncName_FormatMessage (dwFlags As DWord, lpSource As VoidPtr, dwMessageId As DWord, dwLanguageId As DWord, pBuffer As PTSTR, nSize As DWord, Arguments As *DWord) As DWord
728Declare Function FreeEnvironmentStrings Lib "kernel32" Alias _FuncName_FreeEnvironmentStrings (pszEnvironmentBlock As PCTSTR) As BOOL
729Declare Function FreeLibrary Lib "kernel32" (hLibModule As HINSTANCE) As BOOL
730Declare Sub FreeLibraryAndExitThread Lib "kernel32" (hModule As HANDLE, dwExitCode As DWord)
731Declare Function GetCommandLineA Lib "kernel32" () As PCSTR
732Declare Function GetCommandLineW Lib "kernel32" () As PCWSTR
733#ifdef UNICODE
734Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineW" () As PCWSTR
735#else
736Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineA" () As PCSTR
737#endif
738Declare Function GetCompressedFileSize Lib "kernel32" Alias _FuncName_GetCompressedFileSize (pFileName As PCTSTR, ByRef FileSizeHigh As DWord) As DWord
739
740Const MAX_COMPUTERNAME_LENGTH = 15
741Declare Function GetComputerName Lib "kernel32" Alias _FuncName_GetComputerName (pBuffer As PTSTR, ByRef nSize As Long) As Long
742
743Declare Function GetCurrentDirectory Lib "kernel32" Alias _FuncName_GetCurrentDirectory (nBufferLength As DWord, pBuffer As PTSTR) As DWord
744Declare Function GetCurrentProcess Lib "kernel32" () As HANDLE
745Declare Function GetCurrentProcessId Lib "kernel32" () As DWord
746Declare Function GetCurrentThread Lib "kernel32" () As HANDLE
747Declare Function GetCurrentThreadId Lib "kernel32" () As DWord
748
749Const DATE_SHORTDATE = &H00000001
750Const DATE_LONGDATE = &H00000002
751Const DATE_USE_ALT_CALENDAR = &H00000004
752Declare Function GetDateFormat Lib "kernel32" Alias _FuncName_GetDateFormat (Locale As LCID, dwFlags As DWord, ByRef Date As SYSTEMTIME, pFormat As PCTSTR, pDateStr As PTSTR, cchDate As Long) As Long
753
754Declare Function GetDiskFreeSpace Lib "kernel32" Alias _FuncName_GetDiskFreeSpace (pRootPathName As PCTSTR, lpSectorsPerCluster As *DWord, pBytesPerSector As *DWord, pNumberOfFreeClusters As *DWord, pTotalNumberOfClusters As *DWord) As BOOL
755Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias _FuncName_GetDiskFreeSpaceEx (pDirectoryName As PCTSTR, ByRef lpFreeBytesAvailableToCaller As ULARGE_INTEGER, ByRef TotalNumberOfBytes As ULARGE_INTEGER, ByRef TotalNumberOfFreeBytes As ULARGE_INTEGER) As BOOL
756
757Const DRIVE_UNKNOWN = 0
758Const DRIVE_NO_ROOT_DIR = 1
759Const DRIVE_REMOVABLE = 2
760Const DRIVE_FIXED = 3
761Const DRIVE_REMOTE = 4
762Const DRIVE_CDROM = 5
763Const DRIVE_RAMDISK = 6
764Declare Function GetVolumeInformation Lib "kernel32" Alias _FuncName_GetVolumeInformation (pRootPathName As PCTSTR, pVolumeNameBuffer As PTSTR, nVolumeNameSize As DWord, lpVolumeSerialNumber As *Word, lpMaximumComponentLength As *Word, lpFileSystemFlags As *Word, pFileSystemNameBuffer As PTSTR, nFileSystemNameSize As DWord) As BOOL
765Declare Function GetDriveType Lib "kernel32" Alias _FuncName_GetDriveType (lpRootPathName As PCTSTR) As DWord
766
767Declare Function GetEnvironmentVariable Lib "kernel32" Alias _FuncName_GetEnvironmentVariable (lpName As PCTSTR, lpBuffer As PTSTR, nSize As DWord) As DWord
768Declare Function GetEnvironmentStrings Lib "kernel32" Alias _FuncName_GetEnvironmentStrings () As VoidPtr
769Const STILL_ACTIVE = &H00000103
770Declare Function GetExitCodeProcess Lib "kernel32" (hProcess As HANDLE, ByRef lpExitCode As DWord) As BOOL
771Declare Function GetExitCodeThread Lib "kernel32" (hThread As HANDLE, ByRef lpExitCode As DWord) As BOOL
772
773Declare Function GetFileAttributes Lib "kernel32" Alias _FuncName_GetFileAttributes (lpFileName As PCTSTR) As DWord
774Type BY_HANDLE_FILE_INFORMATION
775 dwFileAttributes As DWord
776 ftCreationTime As FILETIME
777 ftLastAccessTime As FILETIME
778 ftLastWriteTime As FILETIME
779 dwVolumeSerialNumber As DWord
780 nFileSizeHigh As DWord
781 nFileSizeLow As DWord
782 nNumberOfLinks As DWord
783 nFileIndexHigh As DWord
784 nFileIndexLow As DWord
785End Type
786Declare Function GetFileInformationByHandle Lib "kernel32" (
787 ByVal hFile As HANDLE,
788 ByRef FileInformation As BY_HANDLE_FILE_INFORMATION
789) As BOOL
790Declare Function GetFileSize Lib "kernel32" (hFile As HANDLE, pFileSizeHigh As *DWord) As DWord
791Declare Function GetFileTime Lib "kernel32" (hFile As HANDLE, ByRef lpCreationTime As FILETIME, ByRef lpLastAccessTime As FILETIME, ByRef lpLastWriteTime As FILETIME) As BOOL
792
793Const FILE_TYPE_UNKNOWN = &H0000
794Const FILE_TYPE_DISK = &H0001
795Const FILE_TYPE_CHAR = &H0002
796Const FILE_TYPE_PIPE = &H0003
797Const FILE_TYPE_REMOTE = &H8000
798Declare Function GetFileType Lib "kernel32" (hFile As HANDLE) As DWord
799
800Declare Function GetFullPathName Lib "kernel32" Alias _FuncName_GetFullPathName (lpFileName As PCSTR, nBufferLength As DWord, pBuffer As PSTR, lpFilePart As *DWord) As DWord
801Declare Function GetLastError Lib "kernel32" () As DWord
802Declare Sub GetLocalTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME)
803Declare Function GetLogicalDrives Lib "kernel32" () As DWord
804Declare Function GetLogicalDriveStrings Lib "kernel32" Alias _FuncName_GetLogicalDriveStrings (nBufferLength As DWord, pBuffer As PTSTR) As DWord
805Declare Function GetLongPathName Lib "kernel32" Alias _FuncName_GetLongPathName (lpszShortPath As LPCTSTR, lpszLongPath As LPTSTR, cchBuffer As DWord) As DWord
806Declare Function GetModuleFileName Lib "kernel32" Alias _FuncName_GetModuleFileName (hModule As HINSTANCE, lpFileName As PTSTR, nSize As DWord) As DWord
807Declare Function GetModuleHandle Lib "kernel32" Alias _FuncName_GetModuleHandle (lpModuleName As PTSTR) As HINSTANCE
808Declare Function GetOverlappedResult Lib "kernel32" (
809 hFile As HANDLE,
810 pOverlapped As *OVERLAPPED,
811 pNumberOfBytesTransferred AS *DWord,
812 bWait As BOOL
813) As BOOL
814Type SYSTEM_POWER_STATUS
815 ACLineStatus As Byte
816 BatteryFlag As Byte
817 BatteryLifePercent As Byte
818 Reserved1 As Byte
819 BatteryLifeTime As Long
820 BatteryFullLifeTime As Long
821End Type
822Declare Function GetSystemPowerStatus Lib "kernel32" (ByRef SystemPowerStatus As SYSTEM_POWER_STATUS) As Long
823Declare Function GetPriorityClass Lib "kernel32" (hProcess As HANDLE) As DWord
824Declare Function GetProcAddress Lib "kernel32" (hModule As HINSTANCE, pProcName As PCSTR) As DWord
825Declare Function GetProcessAffinityMask Lib "kernel32" (
826 hProcess As HANDLE,
827 ByRef ProcessAffinityMask As ULONG_PTR,
828 ByRef SystemAffinityMask As ULONG_PTR
829) As BOOL
830Declare Function GetProcessHeap Lib "kernel32" () As HANDLE
831Declare Function GetShortPathName Lib "kernel32" Alias _FuncName_GetShortPathName (
832 pszLongPath As PCTSTR,
833 pszShortPath As PTSTR,
834 cchBuffer As DWord
835) As DWord
836
837Declare Sub GetStartupInfo Lib "kernel32" Alias _FuncName_GetStartupInfo (ByRef StartupInfo As STARTUPINFO)
838
839Const STD_INPUT_HANDLE = -10
840Const STD_OUTPUT_HANDLE = -11
841Const STD_ERROR_HANDLE = -12
842Declare Function GetStdHandle Lib "kernel32" (nStdHandle As DWord) As HANDLE
843
844Declare Function GetSystemDirectory Lib "kernel32" Alias _FuncName_GetSystemDirectory (pBuffer As PTSTR, uSize As DWord) As DWord
845
846Type SYSTEM_INFO
847 dwOemId As DWord
848 dwPageSize As DWord
849 lpMinimumApplicationAddress As VoidPtr
850 lpMaximumApplicationAddress As VoidPtr
851 dwActiveProcessorMask As ULONG_PTR
852 dwNumberOfProcessors As DWord
853 dwProcessorType As DWord
854 dwAllocationGranularity As DWord
855 wProcessorLevel As Word
856 wProcessorRevision As Word
857End Type
858Declare Sub GetSystemInfo Lib "kernel32" (ByRef SystemInfo As SYSTEM_INFO)
859
860Declare Sub GetSystemTime Lib "kernel32" (ByRef SystemTime As SYSTEMTIME)
861Declare Sub GetSystemTimeAsFileTime Lib "kernel32" (ByRef SystemTimeAsFileTime As FILETIME)
862
863Declare Function GetTempFileName Lib "kernel32" Alias _FuncName_GetTempFileName (
864 pPathName As PCTSTR,
865 pPrefixString As PCTSTR,
866 uUnique As DWord,
867 pTempFileName As PTSTR
868) As DWord
869Declare Function GetTempPath Lib "kernel32" Alias _FuncName_GetTempPath (nBufferLength As DWord, lpBuffer As PTSTR) As DWord
870Declare Function GetThreadContext Lib "kernel32" (hThread As HANDLE, ByRef Context As CONTEXT) As BOOL
871
872Const THREAD_BASE_PRIORITY_LOWRT = 15
873Const THREAD_BASE_PRIORITY_MAX = 2
874Const THREAD_BASE_PRIORITY_MIN = -2
875Const THREAD_BASE_PRIORITY_IDLE = -15
876Const THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN
877Const THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST+1
878Const THREAD_PRIORITY_NORMAL = 0
879Const THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX
880Const THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST-1
881Const THREAD_PRIORITY_ERROR_RETURN = LONG_MAX
882Const THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT
883Const THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE
884Declare Function GetThreadPriority Lib "kernel32" (hThread As HANDLE) As Long
885Declare Function GetThreadPriorityBoost Lib "kernel32" (
886 hThread As HANDLE,
887 ByRef pDisablePriorityBoost As BOOL) As BOOL
888Declare Function GetTickCount Lib "kernel32" () As DWord
889
890Const TIME_NOMINUTESORSECONDS = &H00000001
891Const TIME_NOSECONDS = &H00000002
892Const TIME_NOTIMEMARKER = &H00000004
893Const TIME_FORCE24HOURFORMAT = &H00000008
894Declare Function GetTimeFormat Lib "kernel32" Alias _FuncName_GetTimeFormat (Locale As LCID, dwFlags As DWord, ByRef Time As SYSTEMTIME, lpFormat As PCTSTR, lpTimeStr As PTSTR, cchTime As DWord) As BOOL
895Declare Function GetUserDefaultLCID Lib "kernel32" () As LCID
896Declare Function GetUserName Lib "advapi32" Alias _FuncName_GetUserName (pBuffer As PTSTR, ByRef nSize As DWord) As BOOL
897
898Const VER_PLATFORM_WIN32s = 0
899Const VER_PLATFORM_WIN32_WINDOWS = 1
900Const VER_PLATFORM_WIN32_NT = 2
901Const VER_PLATFORM_WIN32_CE = 3
902Type OSVERSIONINFOW
903 dwOSVersionInfoSize As DWord
904 dwMajorVersion As DWord
905 dwMinorVersion As DWord
906 dwBuildNumber As DWord
907 dwPlatformId As DWord
908 szCSDVersion[ELM(128)] As WCHAR
909End Type
910Type OSVERSIONINFOA
911 dwOSVersionInfoSize As DWord
912 dwMajorVersion As DWord
913 dwMinorVersion As DWord
914 dwBuildNumber As DWord
915 dwPlatformId As DWord
916 szCSDVersion[ELM(128)] As SByte
917End Type
918#ifdef UNICODE
919TypeDef OSVERSIONINFO = OSVERSIONINFOW
920#else
921TypeDef OSVERSIONINFO = OSVERSIONINFOA
922#endif
923Declare Function GetVersionEx Lib "kernel32" Alias _FuncName_GetVersionEx (ByRef VersionInformation As OSVERSIONINFO) As BOOL
924
925Declare Function GetWindowsDirectory Lib "kernel32" Alias _FuncName_GetWindowsDirectory (pBuffer As PTSTR, uSize As DWord) As DWord
926Declare Function GlobalAlloc Lib "kernel32" (uFlags As DWord, dwBytes As SIZE_T) As HGLOBAL
927Declare Function GlobalFrags Lib "kernel32" (hMem As HGLOBAL) As DWord
928Declare Function GlobalFree Lib "kernel32" (hMem As HGLOBAL) As HGLOBAL
929Declare Function GlobalHandle Lib "kernel32" (pMem As VoidPtr) As HGLOBAL
930Declare Function GlobalLock Lib "kernel32" (hMem As HGLOBAL) As VoidPtr
931
932Type MEMORYSTATUS
933 dwLength As DWord
934 dwMemoryLoad As DWord
935 dwTotalPhys As SIZE_T
936 dwAvailPhys As SIZE_T
937 dwTotalPageFile As SIZE_T
938 dwAvailPageFile As SIZE_T
939 dwTotalVirtual As SIZE_T
940 dwAvailVirtual As SIZE_T
941End Type
942Declare Sub GlobalMemoryStatus Lib "kernel32" (ByRef lpMemStatus As MEMORYSTATUS)
943
944Declare Function GlobalReAlloc Lib "kernel32" (hMem As HGLOBAL, dwBytes As SIZE_T, uFlags As DWord) As HGLOBAL
945Declare Function GlobalSize Lib "kernel32" (hMem As HGLOBAL) As SIZE_T
946Declare Function GlobalUnlock Lib "kernel32" (hMem As HGLOBAL) As BOOL
947Declare Function HeapAlloc Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, dwBytes As SIZE_T) As VoidPtr
948Declare Function HeapCreate Lib "kernel32" (flOptions As DWord, dwInitialSize As SIZE_T, dwMaximumSize As SIZE_T) As HANDLE
949Declare Function HeapDestroy Lib "kernel32" (hHeap As HANDLE) As Long
950Declare Function HeapFree Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As Long
951Declare Function HeapReAlloc Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr, dwBytes As SIZE_T) As VoidPtr
952Declare Function HeapSize Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As SIZE_T
953Declare Sub InitializeCriticalSection Lib "kernel32" (ByRef CriticalSection As CRITICAL_SECTION)
954Declare Function IsBadReadPtr Lib "kernel32" (lp As VoidPtr, ucb As ULONG_PTR) As BOOL
955Declare Function IsBadWritePtr Lib "kernel32" (lp As VoidPtr, ucb As ULONG_PTR) As BOOL
956Declare Function IsDBCSLeadByte Lib "kernel32" (TestChar As Byte) As BOOL
957
958#ifdef _WIN64
959Declare Function IsWow64Process Lib "kernel32" (hProcess As HANDLE, ByRef bWow64Process As BOOL) As BOOL
960#endif
961
962Const LCMAP_LOWERCASE = &H00000100 ' lower case letters
963Const LCMAP_UPPERCASE = &H00000200 ' upper case letters
964Const LCMAP_SORTKEY = &H00000400 ' WC sort key (normalize)
965Const LCMAP_BYTEREV = &H00000800 ' byte reversal
966Const LCMAP_HIRAGANA = &H00100000 ' map katakana to hiragana
967Const LCMAP_KATAKANA = &H00200000 ' map hiragana to katakana
968Const LCMAP_HALFWIDTH = &H00400000 ' map double byte to single byte
969Const LCMAP_FULLWIDTH = &H00800000 ' map single byte to double byte
970Const LCMAP_LINGUISTIC_CASING = &H01000000 ' use linguistic rules for casing
971Const LCMAP_SIMPLIFIED_CHINESE = &H02000000 ' map traditional chinese to simplified chinese
972Const LCMAP_TRADITIONAL_CHINESE = &H04000000 ' map simplified chinese to traditional chinese
973Declare Function LCMapString Lib "kernel32" Alias _FuncName_LCMapString (Locale As LCID, dwMapFlags As DWord, lpSrcStr As LPCTSTR, cchSrc As Long, lpDestStr As LPTSTR, cchDest As Long) As Long
974
975Declare Sub LeaveCriticalSection Lib "kernel32" (ByRef lpCriticalSection As CRITICAL_SECTION)
976Declare Function LocalAlloc Lib "kernel32" (uFlags As DWord, uBytes As SIZE_T) As HLOCAL
977Declare Function LocalFileTimeToFileTime Lib "kernel32" (ByRef lpLocalFileTime As FILETIME, ByRef lpFileTime As FILETIME) As BOOL
978Declare Function LocalFree Lib "kernel32" (hMem As HLOCAL) As HLOCAL
979Declare Function LocalHandle Lib "kernel32" (pMem As VoidPtr) As HLOCAL
980Declare Function LocalLock Lib "kernel32" (hMem As HLOCAL) As VoidPtr
981Declare Function LocalReAlloc Lib "kernel32" (hMem As HLOCAL, dwBytes As SIZE_T, uFlags As DWord) As HLOCAL
982Declare Function LocalSize Lib "kernel32" (hMem As HLOCAL) As SIZE_T
983Declare Function LocalUnlock Lib "kernel32" (hMem As HLOCAL) As BOOL
984Declare Function LockFile Lib "kernel32" (hFile As DWord, dwFileOffsetLow As DWord, dwFileOffsetHigh As DWord, nNumberOfBytesToLockLow As DWord, nNumberOfBytesToLockHigh As DWord) As BOOL
985Declare Function LoadLibrary Lib "kernel32" Alias _FuncName_LoadLibrary (pLibFileName As PCTSTR) As HINSTANCE
986
987Const DONT_RESOLVE_DLL_REFERENCES = &h00000001
988Const LOAD_LIBRARY_AS_DATAFILE = &h00000002
989Const LOAD_WITH_ALTERED_SEARCH_PATH = &h00000008
990Const LOAD_IGNORE_CODE_AUTHZ_LEVEL = &h00000010
991Declare Function LoadLibraryEx Lib "kernel32" Alias _FuncName_LoadLibraryEx (pLibFileName As PCTSTR, hFile As HANDLE, dwFlags As DWord) As HINSTANCE
992
993Declare Function lstrcat Lib "kernel32" Alias _FuncName_lstrcat (lpString1 As LPTSTR, lpString2 As LPCTSTR) As LPTSTR
994Declare Function lstrcmp Lib "kernel32" Alias _FuncName_lstrcmp (lpString1 As LPCTSTR, lpString2 As LPCTSTR) As Long
995Declare Function lstrcmpi Lib "kernel32" Alias _FuncName_lstrcmpi (lpString1 As LPCTSTR, lpString2 As LPCTSTR) As Long
996Declare Function lstrcpy Lib "kernel32" Alias _FuncName_lstrcpy (lpString1 As LPTSTR, lpString2 As LPCTSTR) As LPTSTR
997Declare Function lstrcpyn Lib "kernel32" Alias _FuncName_lstrcpyn (lpString1 As LPTSTR,ByVal lpString2 As LPCTSTR,ByVal iMaxLength As Long) As LPTSTR
998Declare Function lstrlenA Lib "kernel32" (lpString As LPCSTR) As Long
999Declare Function lstrlenW Lib "kernel32" (lpString As LPCWSTR) As Long
1000#ifdef UNICODE
1001Declare Function lstrlen Lib "kernel32" Alias "lstrlenW" (lpString As LPCWSTR) As Long
1002#else
1003Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (lpString As LPCSTR) As Long
1004#endif
1005Declare Sub memcpy Lib "kernel32" Alias "RtlMoveMemory" (pDest As VoidPtr, pSrc As VoidPtr, length As SIZE_T)
1006Declare Function MoveFile Lib "kernel32" Alias _FuncName_MoveFile (lpExistingFileName As LPCTSTR, lpNewFileName As LPCTSTR) As BOOL
1007Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As PVOID, pSrc As VoidPtr, length As SIZE_T)
1008
1009Declare Function MulDiv Lib "kernel32" (
1010 nNumber As Long,
1011 nNumerator As Long,
1012 nDenominator As Long
1013) As Long
1014
1015Const CP_ACP = 0 'default to ANSI code page
1016Const CP_OEMCP = 1 'default to OEM code page
1017Const CP_MACCP = 2 'default to MAC code page
1018Const CP_THREAD_ACP = 3 'current thread's ANSI code page
1019Const CP_SYMBOL = 42 'SYMBOL translations
1020Const CP_UTF7 = 65000 'UTF-7 translation
1021Const CP_UTF8 = 65001 'UTF-8 translation
1022
1023Declare Function MultiByteToWideChar Lib "kernel32" (CodePage As DWord, dwFlags As DWord, pMultiByteStr As PCSTR, cchMultiByte As Long, pWideCharStr As PWSTR, cchWideChar As Long) As Long
1024
1025Declare Function OpenEvent Lib "kernel32" Alias _FuncName_OpenEvent (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE
1026Declare Function OpenMutex Lib "kernel32" Alias _FuncName_OpenMutex (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE
1027Declare Function OpenSemaphore Lib "kernel32" Alias _FuncName_OpenSemaphore (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE
1028
1029Const PROCESS_TERMINATE = &H0001
1030Const PROCESS_CREATE_THREAD = &H0002
1031Const PROCESS_SET_SESSIONID = &H0004
1032Const PROCESS_VM_OPERATION = &H0008
1033Const PROCESS_VM_READ = &H0010
1034Const PROCESS_VM_WRITE = &H0020
1035Const PROCESS_DUP_HANDLE = &H0040
1036Const PROCESS_CREATE_PROCESS = &H0080
1037Const PROCESS_SET_QUOTA = &H0100
1038Const PROCESS_SET_INFORMATION = &H0200
1039Const PROCESS_QUERY_INFORMATION = &H0400
1040Const PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or &HFFF
1041Declare Function OpenProcess Lib "kernel32" (dwDesiredAccess As DWord, bInheritHandle As Long, dwProcessId As DWord) As HANDLE
1042
1043Declare Sub OutputDebugStringA Lib "kernel32" (pOutputString As PCSTR)
1044Declare Sub OutputDebugStringW Lib "kernel32" (pOutputString As PCWSTR)
1045#ifdef UNICODE
1046Declare Sub OutputDebugString Lib "kernel32" Alias "OutputDebugStringW" (pOutputString As PCWSTR)
1047#else
1048Declare Sub OutputDebugString Lib "kernel32" Alias "OutputDebugStringA" (pOutputString As PCSTR)
1049#endif
1050Declare Function PulseEvent Lib "kernel32" (hEvent As HANDLE) As BOOL
1051Declare Sub RaiseException Lib "kernel32" (
1052 dwExceptionCode As DWord,
1053 dwExceptionFlags As DWord,
1054 NumberOfArguments As DWord,
1055 pArguments As *ULONG_PTR)
1056Declare Function ReadFile Lib "kernel32" (hFile As HANDLE, lpBuffer As VoidPtr, nNumberOfBytesToRead As DWord, lpNumberOfBytesRead As DWordPtr, ByRef lpOverlapped As OVERLAPPED) As BOOL
1057Declare Function ReadProcessMemory Lib "Kernel32" (hProcess As HANDLE, lpBaseAddress As VoidPtr, lpBuffer As VoidPtr, nSize As SIZE_T, lpNumberOfBytesRead As *SIZE_T) As BOOL
1058Declare Function ReleaseMutex Lib "kernel32" (hMutex As HANDLE) As BOOL
1059Declare Function ReleaseSemaphore Lib "kernel32" (hSemaphore As HANDLE, lReleaseCount As Long, ByRef lpPreviousCount As Long) As BOOL
1060Declare Function RemoveDirectory Lib "kernel32" Alias _FuncName_RemoveDirectory (lpPathName As LPCTSTR) As BOOL
1061Declare Function ResetEvent Lib "kernel32" (hEvent As HANDLE) As BOOL
1062Declare Function ResumeThread Lib "kernel32" (hThread As HANDLE) As DWord
1063Declare Function SetComputerName Lib "kernel32" Alias _FuncName_SetComputerName (lpComputerName As LPCTSTR) As BOOL
1064Declare Function SetCurrentDirectory Lib "kernel32" Alias _FuncName_SetCurrentDirectory (lpPathName As LPCTSTR) As BOOL
1065Declare Function SearchPath Lib "kernel32" Alias _FuncName_SearchPath (pPath As PCSTR, pFileName As PCTSTR, pExtension As PCTSTR, BufferLength As DWord, pBuffer As PTSTR, ByRef pFilePart As PTSTR) As DWord
1066Declare Function SetEndOfFile Lib "kernel32" (hFile As HANDLE) As BOOL
1067Declare Function SetEnvironmentVariable Lib "kernel32" Alias _FuncName_SetEnvironmentVariable (lpName As LPCTSTR, lpValue As LPTSTR) As BOOL
1068
1069Const SEM_FAILCRITICALERRORS = &h0001
1070Const SEM_NOGPFAULTERRORBOX = &h0002
1071Const SEM_NOALIGNMENTFAULTEXCEPT = &h0004
1072Const SEM_NOOPENFILEERRORBOX = &h8000
1073Declare Function SetErrorMode Lib "kernel32" (uMode As DWord) As DWord
1074Declare Function SetEvent Lib "kernel32" (hEvent As HANDLE) As BOOL
1075Declare Function SetFileAttributes Lib "kernel32" Alias _FuncName_SetFileAttributes (lpFileName As LPCTSTR, dwFileAttributes As DWord) As BOOL
1076
1077Const FILE_BEGIN = 0
1078Const FILE_CURRENT = 1
1079Const FILE_END = 2
1080Declare Function SetFilePointer Lib "kernel32" (hFile As HANDLE, lDistanceToMove As Long, lpDistanceToMoveHigh As DWordPtr, dwMoveMethod As DWord) As DWord
1081
1082Declare Function SetFileTime Lib "kernel32" (hFile As HANDLE, ByRef lpCreationTime As FILETIME, ByRef lpLastAccessTime As FILETIME, ByRef lpLastWriteTime As FILETIME) As BOOL
1083Declare Function SetLastError Lib "kernel32" (dwErrCode As DWord)
1084Declare Function SetLastErrorEx Lib "kernel32" (dwErrCode As DWord, dwType As DWord)
1085Declare Function SetLocalTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME) As BOOL
1086Declare Function SetPriorityClass Lib "kernel32" (hProcess As HANDLE, dwPriorityClass As DWord) As BOOL
1087Declare Function SetThreadContext Lib "kernel32" (hThread As HANDLE, ByRef Context As CONTEXT) As BOOL
1088Declare Function SetThreadPriority Lib "kernel32" (hThread As HANDLE, nPriority As Long) As BOOL
1089Declare Function SetThreadPriorityBoost Lib "kernel32" (
1090 hThread As HANDLE,
1091 DisablePriorityBoost As BOOL
1092) As BOOL
1093
1094Const EXCEPTION_MAXIMUM_PARAMETERS = 15
1095
1096Type EXCEPTION_RECORD
1097 ExceptionCode As DWord
1098 ExceptionFlags As DWord
1099 ExceptionRecord As *EXCEPTION_RECORD
1100 ExceptionAddress As VoidPtr
1101 NumberParameters As DWord
1102 ExceptionInformation[ELM(EXCEPTION_MAXIMUM_PARAMETERS)] As ULONG_PTR
1103End Type
1104
1105Type EXCEPTION_POINTERS
1106 ExceptionRecord As *EXCEPTION_RECORD
1107 ContextRecord As *CONTEXT
1108End Type
1109
1110TypeDef PTOP_LEVEL_EXCEPTION_FILTER = *Function(ByRef ExceptionInfo As EXCEPTION_POINTERS) As Long
1111
1112Declare Function SetUnhandledExceptionFilter Lib "kernel32" (pTopLevelExceptionFilter As PTOP_LEVEL_EXCEPTION_FILTER) As PTOP_LEVEL_EXCEPTION_FILTER
1113
1114Const INFINITE = &HFFFFFFFF
1115Declare Sub Sleep Lib "kernel32" (dwMilliseconds As DWord)
1116Declare Function SleepEx Lib "kernel32" (dwMilliseconds As DWord, bAlertable As BOOL) As DWord
1117
1118Declare Function SuspendThread Lib "kernel32" (hThread As HANDLE) As DWord
1119Declare Function SystemTimeToFileTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME, ByRef lpFileTime As FILETIME) As BOOL
1120Declare Function TerminateProcess Lib "kernel32" (hProcess As HANDLE, dwExitCode As DWord) As BOOL
1121Declare Function TerminateThread Lib "kernel32" (hThread As HANDLE, dwExitCode As DWord) As BOOL
1122Declare Function TlsAlloc Lib "kernel32" () As DWord
1123Declare Function TlsFree Lib "kernel32" (dwTlsIndex As DWord) As BOOL
1124Declare Function TlsGetValue Lib "kernel32" (dwTlsIndex As DWord) As VoidPtr
1125Declare Function TlsSetValue Lib "kernel32" (dwTlsIndex As DWord, pTlsValue As VoidPtr) As BOOL
1126Declare Function UnlockFile Lib "kernel32" (hFile As HANDLE, dwFileOffsetLow As DWord, dwFileOffsetHigh As DWord, nNumberOfBytesToUnlockLow As DWord, nNumberOfBytesToUnlockHigh As DWord) As BOOL
1127Declare Function UnhandledExceptionFilter Lib "kernel32" (ByRef ExceptionInfo As EXCEPTION_POINTERS) As Long
1128
1129Const PAGE_NOACCESS = &H01
1130Const PAGE_READONLY = &H02
1131Const PAGE_READWRITE = &H04
1132Const PAGE_WRITECOPY = &H08
1133Const PAGE_EXECUTE = &H10
1134Const PAGE_EXECUTE_READ = &H20
1135Const PAGE_EXECUTE_READWRITE = &H40
1136Const PAGE_EXECUTE_WRITECOPY = &H80
1137Const PAGE_GUARD = &H100
1138Const PAGE_NOCACHE = &H200
1139Const PAGE_WRITECOMBINE = &H400
1140Const MEM_COMMIT = &H1000
1141Const MEM_RESERVE = &H2000
1142Const MEM_DECOMMIT = &H4000
1143Const MEM_RELEASE = &H8000
1144Const MEM_FREE = &H10000
1145Const MEM_PRIVATE = &H20000
1146Const MEM_MAPPED = &H40000
1147Const MEM_RESET = &H80000
1148Const MEM_TOP_DOWN = &H100000
1149Const MEM_4MB_PAGES = &H80000000
1150Declare Function VirtualAlloc Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T, flAllocationType As DWord, flProtect As DWord) As VoidPtr
1151Declare Function VirtualFree Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T, dwFreeType As DWord) As BOOL
1152Declare Function VirtualLock Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T) As BOOL
1153Declare Function VirtualProtect Lib "kernel32" (
1154 pAddress As VoidPtr,
1155 Size As SIZE_T,
1156 flNewProtect As DWord,
1157 ByRef flOldProtect As DWord
1158) As BOOL
1159Declare Function VirtualProtectEx Lib "kernel32" (
1160 hProcess As HANDLE,
1161 pAddress As VoidPtr,
1162 Size As SIZE_T,
1163 flNewProtect As DWord,
1164 ByRef flOldProtect As DWord
1165) As BOOL
1166Type MEMORY_BASIC_INFORMATION
1167 BaseAddress As VoidPtr
1168 AllocationBase As VoidPtr
1169 AllocationProtect As DWord
1170 RegionSize As SIZE_T
1171 State As DWord
1172 Protect As DWord
1173 MBIType As DWord
1174End Type
1175Declare Function VirtualQuery Lib "kernel32" (
1176 pAddress As VoidPtr,
1177 ByRef mbi As MEMORY_BASIC_INFORMATION,
1178 Length As SIZE_T
1179) As SIZE_T
1180Declare Function VirtualQueryEx Lib "kernel32" (
1181 hProcess As HANDLE,
1182 pAddress As VoidPtr,
1183 ByRef mbi As MEMORY_BASIC_INFORMATION,
1184 Length As SIZE_T
1185) As SIZE_T
1186Declare Function VirtualUnlock Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T) As BOOL
1187Declare Function WaitForMultipleObjects Lib "kernel32" (nCount As DWord, pHandles As *HANDLE, fWaitAll As BOOL, dwMilliseconds As DWord) As DWord
1188Declare Function WaitForMultipleObjectsEx Lib "kernel32" (nCount As DWord, pHandles As *HANDLE, fWaitAll As BOOL, dwMilliseconds As DWord, bAlertable As BOOL) As DWord
1189Declare Function WaitForSingleObject Lib "kernel32" (hHandle As HANDLE, dwMilliseconds As DWord) As DWord
1190Declare Function WaitForSingleObjectEx Lib "kernel32" (hHandle As HANDLE, dwMilliseconds As DWord, bAlertable As BOOL) As DWord
1191
1192Const WC_COMPOSITECHECK = &H00000200
1193Const WC_DISCARDNS = &H00000010
1194Const WC_SEPCHARS = &H00000020
1195Const WC_DEFAULTCHAR = &H00000040
1196Const WC_NO_BEST_FIT_CHARS = &H00000400
1197Declare Function WideCharToMultiByte Lib "Kernel32" (
1198 CodePage As DWord,
1199 dwFlags As DWord,
1200 pWideCharStr As PCWSTR,
1201 cchWideChar As Long,
1202 pMultiByteStr As PSTR,
1203 cbMultiByte As Long,
1204 pDefaultChar As PCSTR,
1205 pUsedDefaultChar As *BOOL
1206) As Long
1207
1208Declare Function WriteFile Lib "kernel32" (hFile As HANDLE, lpBuffer As VoidPtr, nNumberOfBytesToWrite As DWord, lpNumberOfBytesWritten As DWordPtr, ByRef lpOverlapped As OVERLAPPED) As BOOL
1209Declare Sub ZeroMemory Lib "kernel32" Alias "RtlZeroMemory" (Destination As VoidPtr, dwLength As DWord)
1210
1211Const MAKELCID(lgid, srtid) = ((((srtid As Word) As DWord)<<16) or ((lgid As Word) As DWord))
1212Const MAKELANGID(p, s) = (((s As Word) << 10) or (p As Word))
1213Const PRIMARYLANGID(lgid) = ((lgid As Word) and &H3ff)
1214Const SUBLANGID(lgid) = ((lgid As Word) >> 10)
1215
1216
1217'
1218' Primary language IDs.
1219'
1220
1221Const LANG_NEUTRAL = &H00
1222Const LANG_INVARIANT = &H7f
1223
1224Const LANG_AFRIKAANS = &H36
1225Const LANG_ALBANIAN = &H1c
1226Const LANG_ARABIC = &H01
1227Const LANG_ARMENIAN = &H2b
1228Const LANG_ASSAMESE = &H4d
1229Const LANG_AZERI = &H2c
1230Const LANG_BASQUE = &H2d
1231Const LANG_BELARUSIAN = &H23
1232Const LANG_BENGALI = &H45
1233Const LANG_BULGARIAN = &H02
1234Const LANG_CATALAN = &H03
1235Const LANG_CHINESE = &H04
1236Const LANG_CROATIAN = &H1a
1237Const LANG_CZECH = &H05
1238Const LANG_DANISH = &H06
1239Const LANG_DIVEHI = &H65
1240Const LANG_DUTCH = &H13
1241Const LANG_ENGLISH = &H09
1242Const LANG_ESTONIAN = &H25
1243Const LANG_FAEROESE = &H38
1244Const LANG_FARSI = &H29
1245Const LANG_FINNISH = &H0b
1246Const LANG_FRENCH = &H0c
1247Const LANG_GALICIAN = &H56
1248Const LANG_GEORGIAN = &H37
1249Const LANG_GERMAN = &H07
1250Const LANG_GREEK = &H08
1251Const LANG_GUJARATI = &H47
1252Const LANG_HEBREW = &H0d
1253Const LANG_HINDI = &H39
1254Const LANG_HUNGARIAN = &H0e
1255Const LANG_ICELANDIC = &H0f
1256Const LANG_INDONESIAN = &H21
1257Const LANG_ITALIAN = &H10
1258Const LANG_JAPANESE = &H11
1259Const LANG_KANNADA = &H4b
1260Const LANG_KASHMIRI = &H60
1261Const LANG_KAZAK = &H3f
1262Const LANG_KONKANI = &H57
1263Const LANG_KOREAN = &H12
1264Const LANG_KYRGYZ = &H40
1265Const LANG_LATVIAN = &H26
1266Const LANG_LITHUANIAN = &H27
1267Const LANG_MACEDONIAN = &H2f ' the Former Yugoslav Republic of Macedonia
1268Const LANG_MALAY = &H3e
1269Const LANG_MALAYALAM = &H4c
1270Const LANG_MANIPURI = &H58
1271Const LANG_MARATHI = &H4e
1272Const LANG_MONGOLIAN = &H50
1273Const LANG_NEPALI = &H61
1274Const LANG_NORWEGIAN = &H14
1275Const LANG_ORIYA = &H48
1276Const LANG_POLISH = &H15
1277Const LANG_PORTUGUESE = &H16
1278Const LANG_PUNJABI = &H46
1279Const LANG_ROMANIAN = &H18
1280Const LANG_RUSSIAN = &H19
1281Const LANG_SANSKRIT = &H4f
1282Const LANG_SERBIAN = &H1a
1283Const LANG_SINDHI = &H59
1284Const LANG_SLOVAK = &H1b
1285Const LANG_SLOVENIAN = &H24
1286Const LANG_SPANISH = &H0a
1287Const LANG_SWAHILI = &H41
1288Const LANG_SWEDISH = &H1d
1289Const LANG_SYRIAC = &H5a
1290Const LANG_TAMIL = &H49
1291Const LANG_TATAR = &H44
1292Const LANG_TELUGU = &H4a
1293Const LANG_THAI = &H1e
1294Const LANG_TURKISH = &H1f
1295Const LANG_UKRAINIAN = &H22
1296Const LANG_URDU = &H20
1297Const LANG_UZBEK = &H43
1298Const LANG_VIETNAMESE = &H2a
1299
1300'
1301' Sublanguage IDs.
1302'
1303' The name immediately following SUBLANG_ dictates which primary
1304' language ID that sublanguage ID can be combined with to form a
1305' valid language ID.
1306'
1307
1308Const SUBLANG_NEUTRAL = &H00 ' language neutral
1309Const SUBLANG_DEFAULT = &H01 ' user default
1310Const SUBLANG_SYS_DEFAULT = &H02 ' system default
1311
1312Const SUBLANG_ARABIC_SAUDI_ARABIA = &H01 ' Arabic (Saudi Arabia)
1313Const SUBLANG_ARABIC_IRAQ = &H02 ' Arabic (Iraq)
1314Const SUBLANG_ARABIC_EGYPT = &H03 ' Arabic (Egypt)
1315Const SUBLANG_ARABIC_LIBYA = &H04 ' Arabic (Libya)
1316Const SUBLANG_ARABIC_ALGERIA = &H05 ' Arabic (Algeria)
1317Const SUBLANG_ARABIC_MOROCCO = &H06 ' Arabic (Morocco)
1318Const SUBLANG_ARABIC_TUNISIA = &H07 ' Arabic (Tunisia)
1319Const SUBLANG_ARABIC_OMAN = &H08 ' Arabic (Oman)
1320Const SUBLANG_ARABIC_YEMEN = &H09 ' Arabic (Yemen)
1321Const SUBLANG_ARABIC_SYRIA = &H0a ' Arabic (Syria)
1322Const SUBLANG_ARABIC_JORDAN = &H0b ' Arabic (Jordan)
1323Const SUBLANG_ARABIC_LEBANON = &H0c ' Arabic (Lebanon)
1324Const SUBLANG_ARABIC_KUWAIT = &H0d ' Arabic (Kuwait)
1325Const SUBLANG_ARABIC_UAE = &H0e ' Arabic (U.A.E)
1326Const SUBLANG_ARABIC_BAHRAIN = &H0f ' Arabic (Bahrain)
1327Const SUBLANG_ARABIC_QATAR = &H10 ' Arabic (Qatar)
1328Const SUBLANG_AZERI_LATIN = &H01 ' Azeri (Latin)
1329Const SUBLANG_AZERI_CYRILLIC = &H02 ' Azeri (Cyrillic)
1330Const SUBLANG_CHINESE_TRADITIONAL = &H01 ' Chinese (Taiwan)
1331Const SUBLANG_CHINESE_SIMPLIFIED = &H02 ' Chinese (PR China)
1332Const SUBLANG_CHINESE_HONGKONG = &H03 ' Chinese (Hong Kong S.A.R., P.R.C.)
1333Const SUBLANG_CHINESE_SINGAPORE = &H04 ' Chinese (Singapore)
1334Const SUBLANG_CHINESE_MACAU = &H05 ' Chinese (Macau S.A.R.)
1335Const SUBLANG_DUTCH = &H01 ' Dutch
1336Const SUBLANG_DUTCH_BELGIAN = &H02 ' Dutch (Belgian)
1337Const SUBLANG_ENGLISH_US = &H01 ' English (USA)
1338Const SUBLANG_ENGLISH_UK = &H02 ' English (UK)
1339Const SUBLANG_ENGLISH_AUS = &H03 ' English (Australian)
1340Const SUBLANG_ENGLISH_CAN = &H04 ' English (Canadian)
1341Const SUBLANG_ENGLISH_NZ = &H05 ' English (New Zealand)
1342Const SUBLANG_ENGLISH_EIRE = &H06 ' English (Irish)
1343Const SUBLANG_ENGLISH_SOUTH_AFRICA = &H07 ' English (South Africa)
1344Const SUBLANG_ENGLISH_JAMAICA = &H08 ' English (Jamaica)
1345Const SUBLANG_ENGLISH_CARIBBEAN = &H09 ' English (Caribbean)
1346Const SUBLANG_ENGLISH_BELIZE = &H0a ' English (Belize)
1347Const SUBLANG_ENGLISH_TRINIDAD = &H0b ' English (Trinidad)
1348Const SUBLANG_ENGLISH_ZIMBABWE = &H0c ' English (Zimbabwe)
1349Const SUBLANG_ENGLISH_PHILIPPINES = &H0d ' English (Philippines)
1350Const SUBLANG_FRENCH = &H01 ' French
1351Const SUBLANG_FRENCH_BELGIAN = &H02 ' French (Belgian)
1352Const SUBLANG_FRENCH_CANADIAN = &H03 ' French (Canadian)
1353Const SUBLANG_FRENCH_SWISS = &H04 ' French (Swiss)
1354Const SUBLANG_FRENCH_LUXEMBOURG = &H05 ' French (Luxembourg)
1355Const SUBLANG_FRENCH_MONACO = &H06 ' French (Monaco)
1356Const SUBLANG_GERMAN = &H01 ' German
1357Const SUBLANG_GERMAN_SWISS = &H02 ' German (Swiss)
1358Const SUBLANG_GERMAN_AUSTRIAN = &H03 ' German (Austrian)
1359Const SUBLANG_GERMAN_LUXEMBOURG = &H04 ' German (Luxembourg)
1360Const SUBLANG_GERMAN_LIECHTENSTEIN = &H05 ' German (Liechtenstein)
1361Const SUBLANG_ITALIAN = &H01 ' Italian
1362Const SUBLANG_ITALIAN_SWISS = &H02 ' Italian (Swiss)
1363Const SUBLANG_KASHMIRI_SASIA = &H02 ' Kashmiri (South Asia)
1364Const SUBLANG_KOREAN = &H01 ' Korean (Extended Wansung)
1365Const SUBLANG_LITHUANIAN = &H01 ' Lithuanian
1366Const SUBLANG_MALAY_MALAYSIA = &H01 ' Malay (Malaysia)
1367Const SUBLANG_MALAY_BRUNEI_DARUSSALAM = &H02 ' Malay (Brunei Darussalam)
1368Const SUBLANG_NEPALI_INDIA = &H02 ' Nepali (India)
1369Const SUBLANG_NORWEGIAN_BOKMAL = &H01 ' Norwegian (Bokmal)
1370Const SUBLANG_NORWEGIAN_NYNORSK = &H02 ' Norwegian (Nynorsk)
1371Const SUBLANG_PORTUGUESE = &H02 ' Portuguese
1372Const SUBLANG_PORTUGUESE_BRAZILIAN = &H01 ' Portuguese (Brazilian)
1373Const SUBLANG_SERBIAN_LATIN = &H02 ' Serbian (Latin)
1374Const SUBLANG_SERBIAN_CYRILLIC = &H03 ' Serbian (Cyrillic)
1375Const SUBLANG_SPANISH = &H01 ' Spanish (Castilian)
1376Const SUBLANG_SPANISH_MEXICAN = &H02 ' Spanish (Mexican)
1377Const SUBLANG_SPANISH_MODERN = &H03 ' Spanish (Spain)
1378Const SUBLANG_SPANISH_GUATEMALA = &H04 ' Spanish (Guatemala)
1379Const SUBLANG_SPANISH_COSTA_RICA = &H05 ' Spanish (Costa Rica)
1380Const SUBLANG_SPANISH_PANAMA = &H06 ' Spanish (Panama)
1381Const SUBLANG_SPANISH_DOMINICAN_REPUBLIC = &H07 ' Spanish (Dominican Republic)
1382Const SUBLANG_SPANISH_VENEZUELA = &H08 ' Spanish (Venezuela)
1383Const SUBLANG_SPANISH_COLOMBIA = &H09 ' Spanish (Colombia)
1384Const SUBLANG_SPANISH_PERU = &H0a ' Spanish (Peru)
1385Const SUBLANG_SPANISH_ARGENTINA = &H0b ' Spanish (Argentina)
1386Const SUBLANG_SPANISH_ECUADOR = &H0c ' Spanish (Ecuador)
1387Const SUBLANG_SPANISH_CHILE = &H0d ' Spanish (Chile)
1388Const SUBLANG_SPANISH_URUGUAY = &H0e ' Spanish (Uruguay)
1389Const SUBLANG_SPANISH_PARAGUAY = &H0f ' Spanish (Paraguay)
1390Const SUBLANG_SPANISH_BOLIVIA = &H10 ' Spanish (Bolivia)
1391Const SUBLANG_SPANISH_EL_SALVADOR = &H11 ' Spanish (El Salvador)
1392Const SUBLANG_SPANISH_HONDURAS = &H12 ' Spanish (Honduras)
1393Const SUBLANG_SPANISH_NICARAGUA = &H13 ' Spanish (Nicaragua)
1394Const SUBLANG_SPANISH_PUERTO_RICO = &H14 ' Spanish (Puerto Rico)
1395Const SUBLANG_SWEDISH = &H01 ' Swedish
1396Const SUBLANG_SWEDISH_FINLAND = &H02 ' Swedish (Finland)
1397Const SUBLANG_URDU_PAKISTAN = &H01 ' Urdu (Pakistan)
1398Const SUBLANG_URDU_INDIA = &H02 ' Urdu (India)
1399Const SUBLANG_UZBEK_LATIN = &H01 ' Uzbek (Latin)
1400Const SUBLANG_UZBEK_CYRILLIC = &H02 ' Uzbek (Cyrillic)
1401
1402
1403Const LANG_SYSTEM_DEFAULT = (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
1404Const LANG_USER_DEFAULT = (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
1405
1406
1407'
1408' Sorting IDs.
1409'
1410
1411Const SORT_DEFAULT = &H0 ' sorting default
1412
1413Const SORT_JAPANESE_XJIS = &H0 ' Japanese XJIS order
1414Const SORT_JAPANESE_UNICODE = &H1 ' Japanese Unicode order
1415
1416Const SORT_CHINESE_BIG5 = &H0 ' Chinese BIG5 order
1417Const SORT_CHINESE_PRCP = &H0 ' PRC Chinese Phonetic order
1418Const SORT_CHINESE_UNICODE = &H1 ' Chinese Unicode order
1419Const SORT_CHINESE_PRC = &H2 ' PRC Chinese Stroke Count order
1420Const SORT_CHINESE_BOPOMOFO = &H3 ' Traditional Chinese Bopomofo order
1421
1422Const SORT_KOREAN_KSC = &H0 ' Korean KSC order
1423Const SORT_KOREAN_UNICODE = &H1 ' Korean Unicode order
1424
1425Const SORT_GERMAN_PHONE_BOOK = &H1 ' German Phone Book order
1426
1427Const SORT_HUNGARIAN_DEFAULT = &H0 ' Hungarian Default order
1428Const SORT_HUNGARIAN_TECHNICAL = &H1 ' Hungarian Technical order
1429
1430Const SORT_GEORGIAN_TRADITIONAL = &H0 ' Georgian Traditional order
1431Const SORT_GEORGIAN_MODERN = &H1 ' Georgian Modern order
1432
1433'
1434' Wait functions' results.
1435'
1436Const WAIT_FAILED = (&hFFFFFFFF As DWord)
1437Const WAIT_OBJECT_0 = 0 '((STATUS_WAIT_0 ) + 0)
1438
1439Const WAIT_ABANDONED = &h00000080 As DWord '((STATUS_ABANDONED_WAIT_0 ) + 0)
1440Const WAIT_ABANDONED_0 = WAIT_ABANDONED '((STATUS_ABANDONED_WAIT_0 ) + 0)
1441
1442Const WAIT_IO_COMPLETION = &h000000C0 'STATUS_USER_APC
1443
1444Declare Function FindResource Lib "kernel32" Alias _FuncName_FindResource (hInstance As HINSTANCE, lpName As LPCTSTR, lpType As LPCTSTR) As HRSRC
1445Declare Function LoadResource Lib "kernel32" (hModule As HMODULE, hResInfo As HRSRC) As HGLOBAL
1446Declare Function FreeResource Lib "kernel32" (hResData As HGLOBAL) As BOOL
1447Declare Function LockResource Lib "kernel32" (hResData As HGLOBAL) As VoidPtr
1448Declare Function SizeofResource Lib "kernel32" (hModule As HANDLE, hResInfo As HRSRC) As DWord
1449
1450Declare Function ExpandEnvironmentStrings Lib "kernel32" Alias _FuncName_ExpandEnvironmentStrings (lpSrc As LPCTSTR, lpDst As LPTSTR, nSize As DWord) As DWord
1451
1452Type DCB
1453 DCBlength As DWord
1454 BaudRate As DWord
1455 fBitFields As DWord
1456 wReserved As Word
1457 XonLim As Word
1458 XoffLim As Word
1459 ByteSize As Byte
1460 Parity As Byte
1461 StopBits As Byte
1462 XonChar As CHAR
1463 XoffChar As CHAR
1464 ErrorChar As CHAR
1465 EofChar As CHAR
1466 EvtChar As CHAR
1467 wReserved1 As Word
1468End Type
1469
1470Type COMMTIMEOUTS
1471 ReadIntervalTimeout As DWord
1472 ReadTotalTimeoutMultiplier As DWord
1473 ReadTotalTimeoutConstant As DWord
1474 WriteTotalTimeoutMultiplier As DWord
1475 WriteTotalTimeoutConstant As DWord
1476End Type
1477Type COMSTAT
1478 fCoBitFlds As Long 'See Comment in Win32API.Txt
1479 cbInQue As DWord
1480 cbOutQue As DWord
1481End Type
1482Declare Function SetCommState Lib "kernel32" (hCommDev As HANDLE, ByRef dcb As DCB) As BOOL
1483Declare Function SetCommTimeouts Lib "kernel32" (hFile As HANDLE ,ByRef pCommTimeouts As COMMTIMEOUTS) As BOOL
1484Declare Function ClearCommError Lib "kernel32" (hCommDevs As HANDLE, ByRef Errors As DWord, ByRef Stat As COMSTAT) As BOOL
1485Declare Function EscapeCommFunction Lib "kernel32" (nCid As HANDLE, ByVal nFunc As DWord) As BOOL
1486Declare Function GetCommModemStatus Lib "kernel32" (hFile As HANDLE, ByRef ModemStat As DWord) As BOOL
1487Declare Function SetCommMask Lib "kernel32" (hFile As HANDLE, dwEvtMask As DWord) As BOOL
1488Declare Function WaitCommEvent Lib "kernel32" (hFile As HANDLE, ByRef EvtMask As DWord, lpOverlapped As *OVERLAPPED) As BOOL
1489
1490Const ANYSIZE_ARRAY = 1
1491Type LUID
1492 LowPart As DWord
1493 HighPart As Long
1494End Type
1495Type LUID_AND_ATTRIBUTES
1496 Luid As LUID
1497 Attributes As DWord
1498End Type
1499TypeDef PLUID_AND_ATTRIBUTES = *LUID_AND_ATTRIBUTES
1500'TypeDef LUID_AND_ATTRIBUTES_ARRAY = LUID_AND_ATTRIBUTES[ANYSIZE_ARRAY]
1501'TypeDef PLUID_AND_ATTRIBUTES_ARRAY = *LUID_AND_ATTRIBUTES_ARRAY
1502
1503Type TOKEN_PRIVILEGES
1504 PrivilegeCount As DWord
1505 Privileges[ELM(ANYSIZE_ARRAY)] As LUID_AND_ATTRIBUTES
1506End Type
1507
1508Declare Function OpenProcessToken Lib "advapi32" (ProcessHandle As HANDLE, DesiredAccess As DWord, ByRef TokenHandle As HANDLE) As BOOL
1509Declare Function LookupPrivilegeValue Lib "advapi32" Alias _FuncName_LookupPrivilegeValue (lpSystemName As LPCTSTR, lpName As LPCTSTR, ByRef Luid As LUID) As Long
1510Declare Function AdjustTokenPrivileges Lib "advapi32" (TokenHandle As Long, DisableAllPrivileges As Long,_
1511 ByRef NewState As TOKEN_PRIVILEGES, BufferLength As Long,
1512 ByRef PreviousState As TOKEN_PRIVILEGES, ByRef ReturnLength As Long) As Long
1513
1514#endif '_INC_SYSTEM
Note: See TracBrowser for help on using the repository browser.