source: trunk/ab5.0/ablib/src/api_system.sbp@ 628

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

winnls.ab, winsvc.abを追加

File size: 47.3 KB
Line 
1' api_system.sbp - System API
2
3#ifdef UNICODE
4Const _FuncName_AddAtom = "AddAtomW"
5Const _FuncName_CopyFile = "CopyFileW"
6Const _FuncName_CreateDirectory = "CreateDirectoryW"
7Const _FuncName_CreateEvent = "CreateEventW"
8Const _FuncName_CreateMutex = "CreateMutexW"
9Const _FuncName_CreateSemaphore = "CreateSemaphoreW"
10Const _FuncName_CreateWaitableTimer = "CreateWaitableTimerW"
11Const _FuncName_CreateFile = "CreateFileW"
12Const _FuncName_CreateFileMapping = "CreateFileMappingW"
13Const _FuncName_OpenFileMapping = "OpenFileMappingW"
14Const _FuncName_CreateMailslot = "CreateMailslotW"
15Const _FuncName_CreateProcess = "CreateProcessW"
16Const _FuncName_DeleteFile = "DeleteFileW"
17Const _FuncName_ExpandEnvironmentStrings = "ExpandEnvironmentStringsW"
18Const _FuncName_FatalAppExit = "FatalAppExitW"
19Const _FuncName_FindAtom = "FindAtomW"
20Const _FuncName_FindFirstChangeNotification = "FindFirstChangeNotificationW"
21Const _FuncName_FindFirstFile = "FindFirstFileW"
22Const _FuncName_FindNextFile = "FindNextFileW"
23Const _FuncName_FindResource = "FindResourceW"
24Const _FuncName_FormatMessage = "FormatMessageW"
25Const _FuncName_FreeEnvironmentStrings = "FreeEnvironmentStringsW"
26Const _FuncName_GetCompressedFileSize = "GetCompressedFileSizeW"
27Const _FuncName_GetComputerName = "GetComputerNameW"
28Const _FuncName_GetCurrentDirectory = "GetCurrentDirectoryW"
29Const _FuncName_GetDiskFreeSpace = "GetDiskFreeSpaceW"
30Const _FuncName_GetDiskFreeSpaceEx = "GetDiskFreeSpaceExW"
31Const _FuncName_GetVolumeInformation = "GetVolumeInformationW"
32Const _FuncName_GetDriveType = "GetDriveTypeW"
33Const _FuncName_GetEnvironmentVariable = "GetEnvironmentVariableW"
34Const _FuncName_GetEnvironmentStrings = "GetEnvironmentStringsW"
35Const _FuncName_GetFileAttributes = "GetFileAttributesW"
36Const _FuncName_GetFullPathName = "GetFullPathNameW"
37Const _FuncName_GetAtomName = "GetAtomNameW"
38Const _FuncName_GlobalAddAtom = "GlobalAddAtomW"
39Const _FuncName_GlobalFindAtom = "GlobalFindAtomW"
40Const _FuncName_GlobalGetAtomName = "GlobalGetAtomNameW"
41Const _FuncName_GetLogicalDriveStrings = "GetLogicalDriveStringsW"
42Const _FuncName_GetLongPathName = "GetLongPathNameW"
43Const _FuncName_GetModuleFileName = "GetModuleFileNameW"
44Const _FuncName_GetModuleHandle = "GetModuleHandleW"
45Const _FuncName_GetShortPathName = "GetShortPathNameW"
46Const _FuncName_GetStartupInfo = "GetStartupInfoW"
47Const _FuncName_GetSystemDirectory = "GetSystemDirectoryW"
48Const _FuncName_GetTempFileName = "GetTempFileNameW"
49Const _FuncName_GetTempPath = "GetTempPathW"
50Const _FuncName_GetUserName = "GetUserNameW"
51Const _FuncName_GetVersionEx = "GetVersionExW"
52Const _FuncName_GetWindowsDirectory = "GetWindowsDirectoryW"
53Const _FuncName_LoadLibrary = "LoadLibraryW"
54Const _FuncName_LoadLibraryEx = "LoadLibraryExW"
55Const _FuncName_LookupPrivilegeValue = "LookupPrivilegeValueW"
56Const _FuncName_lstrcat = "lstrcatW"
57Const _FuncName_lstrcmp = "lstrcmpW"
58Const _FuncName_lstrcmpi = "lstrcmpiW"
59Const _FuncName_lstrcpy = "lstrcpyW"
60Const _FuncName_lstrcpyn = "lstrcpynW"
61Const _FuncName_MoveFile = "MoveFileW"
62Const _FuncName_OpenEvent = "OpenEventW"
63Const _FuncName_OpenMutex = "OpenMutexW"
64Const _FuncName_OpenSemaphore = "OpenSemaphoreW"
65Const _FuncName_OpenWaitableTimer = "OpenWaitableTimerW"
66Const _FuncName_RemoveDirectory = "RemoveDirectoryW"
67Const _FuncName_SetComputerName = "SetComputerNameW"
68Const _FuncName_SetCurrentDirectory = "SetCurrentDirectoryW"
69Const _FuncName_SearchPath = "SearchPathW"
70Const _FuncName_SetEnvironmentVariable = "SetEnvironmentVariableW"
71Const _FuncName_SetFileAttributes = "SetFileAttributesW"
72#else
73Const _FuncName_AddAtom = "AddAtomA"
74Const _FuncName_CopyFile = "CopyFileA"
75Const _FuncName_CreateDirectory = "CreateDirectoryA"
76Const _FuncName_CreateEvent = "CreateEventA"
77Const _FuncName_CreateMutex = "CreateMutexA"
78Const _FuncName_CreateSemaphore = "CreateSemaphoreA"
79Const _FuncName_CreateWaitableTimer = "CreateWaitableTimerA"
80Const _FuncName_CreateFile = "CreateFileA"
81Const _FuncName_CreateFileMapping = "CreateFileMappingA"
82Const _FuncName_OpenFileMapping = "OpenFileMappingA"
83Const _FuncName_CreateMailslot = "CreateMailslotA"
84Const _FuncName_CreateProcess = "CreateProcessA"
85Const _FuncName_DeleteFile = "DeleteFileA"
86Const _FuncName_ExpandEnvironmentStrings = "ExpandEnvironmentStringsA"
87Const _FuncName_FatalAppExit = "FatalAppExitA"
88Const _FuncName_FindAtom = "FindAtomA"
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_GetAtomName = "GetAtomNameA"
96Const _FuncName_GlobalAddAtom = "GlobalAddAtomA"
97Const _FuncName_GlobalFindAtom = "GlobalFindAtomA"
98Const _FuncName_GlobalGetAtomName = "GlobalGetAtomNameA"
99Const _FuncName_GetCompressedFileSize = "GetCompressedFileSizeA"
100Const _FuncName_GetComputerName = "GetComputerNameA"
101Const _FuncName_GetCurrentDirectory = "GetCurrentDirectoryA"
102Const _FuncName_GetDiskFreeSpace = "GetDiskFreeSpaceA"
103Const _FuncName_GetDiskFreeSpaceEx = "GetDiskFreeSpaceExA"
104Const _FuncName_GetVolumeInformation = "GetVolumeInformationA"
105Const _FuncName_GetDriveType = "GetDriveTypeA"
106Const _FuncName_GetEnvironmentVariable = "GetEnvironmentVariableA"
107Const _FuncName_GetEnvironmentStrings = "GetEnvironmentStringsA"
108Const _FuncName_GetFileAttributes = "GetFileAttributesA"
109Const _FuncName_GetFullPathName = "GetFullPathNameA"
110Const _FuncName_GetLogicalDriveStrings = "GetLogicalDriveStringsA"
111Const _FuncName_GetLongPathName = "GetLongPathNameA"
112Const _FuncName_GetModuleFileName = "GetModuleFileNameA"
113Const _FuncName_GetModuleHandle = "GetModuleHandleA"
114Const _FuncName_GetShortPathName = "GetShortPathNameA"
115Const _FuncName_GetStartupInfo = "GetStartupInfoA"
116Const _FuncName_GetSystemDirectory = "GetSystemDirectoryA"
117Const _FuncName_GetTempFileName = "GetTempFileNameA"
118Const _FuncName_GetTempPath = "GetTempPathA"
119Const _FuncName_GetUserName = "GetUserNameA"
120Const _FuncName_GetVersionEx = "GetVersionExA"
121Const _FuncName_GetWindowsDirectory = "GetWindowsDirectoryA"
122Const _FuncName_LoadLibrary = "LoadLibraryA"
123Const _FuncName_LoadLibraryEx = "LoadLibraryExA"
124Const _FuncName_LookupPrivilegeValue = "LookupPrivilegeValueA"
125Const _FuncName_lstrcat = "lstrcatA"
126Const _FuncName_lstrcmp = "lstrcmpA"
127Const _FuncName_lstrcmpi = "lstrcmpiA"
128Const _FuncName_lstrcpy = "lstrcpyA"
129Const _FuncName_lstrcpyn = "lstrcpynA"
130Const _FuncName_MoveFile = "MoveFileA"
131Const _FuncName_OpenEvent = "OpenEventA"
132Const _FuncName_OpenMutex = "OpenMutexA"
133Const _FuncName_OpenSemaphore = "OpenSemaphoreA"
134Const _FuncName_OpenWaitableTimer = "OpenWaitableTimerA"
135Const _FuncName_RemoveDirectory = "RemoveDirectoryA"
136Const _FuncName_SetComputerName = "SetComputerNameA"
137Const _FuncName_SetCurrentDirectory = "SetCurrentDirectoryA"
138Const _FuncName_SearchPath = "SearchPathA"
139Const _FuncName_SetEnvironmentVariable = "SetEnvironmentVariableA"
140Const _FuncName_SetFileAttributes = "SetFileAttributesA"
141#endif
142
143
144'-------------------
145' default constants
146Const INVALID_HANDLE_VALUE = -1 As HANDLE
147Const INVALID_FILE_SIZE = &HFFFFFFFF As DWord
148Const INVALID_SET_FILE_POINTER = &HFFFFFFFF As DWord
149Const INVALID_FILE_ATTRIBUTES = &HFFFFFFFF As DWord
150
151'-----------------
152' data structs
153
154'variable type - System
155TypeDef HFILE = Long
156Type _System_DeclareHandle_HANDLE:unused As DWord:End Type
157TypeDef HRSRC = *_System_DeclareHandle_HANDLE
158
159' File structure
160Type SECURITY_ATTRIBUTES
161 nLength As DWord
162 lpSecurityDescriptor As VoidPtr
163 bInheritHandle As BOOL
164End Type
165
166Type OVERLAPPED
167 Internal As ULONG_PTR
168 InternalHigh As ULONG_PTR
169 Offset As DWord
170 OffsetHigh As DWord
171 hEvent As HANDLE
172End Type
173
174' System time
175Type SYSTEMTIME
176 wYear As Word
177 wMonth As Word
178 wDayOfWeek As Word
179 wDay As Word
180 wHour As Word
181 wMinute As Word
182 wSecond As Word
183 wMilliseconds As Word
184End Type
185
186' Global Memory Flags
187Const GMEM_FIXED = &H0000
188Const GMEM_MOVEABLE = &H0002
189Const GMEM_NOCOMPACT = &H0010
190Const GMEM_NODISCARD = &H0020
191Const GMEM_ZEROINIT = &H0040
192Const GMEM_MODIFY = &H0080
193Const GMEM_DISCARDABLE = &H0100
194Const GMEM_NOT_BANKED = &H1000
195Const GMEM_SHARE = &H2000
196Const GMEM_DDESHARE = &H2000
197Const GMEM_INVALID_HANDLE = &H8000
198Const GHND = GMEM_MOVEABLE or GMEM_ZEROINIT
199Const GPTR = GMEM_FIXED or GMEM_ZEROINIT
200Const GMEM_DISCARDED = &H4000
201
202'Critical Section
203Type CRITICAL_SECTION
204 DebugInfo As VoidPtr
205 LockCount As Long
206 RecursionCount As Long
207 OwningThread As HANDLE
208 LockSemaphore As HANDLE
209 SpinCount As ULONG_PTR
210End Type
211
212'Mutex
213Const MUTEX_ALL_ACCESS = MUTANT_ALL_ACCESS
214
215'Lmcons.ab
216Const UNLEN = 256
217
218'----------------------
219' Kernel Operation API
220#ifdef _WIN64
221Function InterlockedIncrement(ByRef lpAddend As Long) As Long
222 lpAddend++
223 Return lpAddend
224End Function
225Function InterlockedDecrement(ByRef lpAddend As Long) As Long
226 lpAddend--
227 Return lpAddend
228End Function
229Function InterlockedExchange(ByRef Target As Long, Value As Long) As Long
230 InterlockedExchange=Target
231 Target = Value
232End Function
233Function InterlockedCompareExchange(ByRef Destination As Long, Exchange As Long, Comperand As Long) As Long
234 InterlockedCompareExchange = Destination
235 If Destination = Comperand Then
236 Destination = Exchange
237 End If
238End Function
239Function InterlockedExchangeAdd(ByRef Addend As Long, Value As Long) As Long
240 InterlockedExchangeAdd = Addend
241 Addend += Value
242End Function
243Function InterlockedExchangePointer(ByRef Target As VoidPtr, Value As VoidPtr) As VoidPtr
244 InterlockedExchangePointer = Target
245 Target = Value
246End Function
247Function InterlockedCompareExchangePointer(ByRef Destination As VoidPtr, Exchange As VoidPtr, Comperand As VoidPtr) As VoidPtr
248 InterlockedCompareExchangePointer = Destination
249 If Destination = Comperand Then
250 Destination = Exchange
251 End If
252End Function
253#else
254Declare Function InterlockedIncrement Lib "kernel32" (ByRef lpAddend As Long) As Long
255Declare Function InterlockedDecrement Lib "kernel32" (ByRef lpAddend As Long) As Long
256Declare Function InterlockedExchange Lib "kernel32" (ByRef Target As Long, Value As Long) As Long
257Declare Function InterlockedCompareExchange Lib "kernel32" (ByRef Destination As Long, Exchange As Long, Comperand As Long) As Long
258Declare Function InterlockedExchangeAdd Lib "kernel32" (ByRef Addend As Long, Value As Long) As Long
259Declare Function InterlockedCompareExchangePointer Lib "kernel32" Alias "InterlockedCompareExchange" (ByRef Destination As VoidPtr, Exchange As VoidPtr, Comperand As VoidPtr) As VoidPtr
260Declare Function InterlockedExchangePointer Lib "kernel32" Alias "InterlockedExchange" (ByRef Target As VoidPtr, Value As VoidPtr) As VoidPtr
261#endif
262
263Declare Function Beep Lib "kernel32" (dwFreq As DWord, dwDuration As DWord) As BOOL
264Declare Function CloseHandle Lib "kernel32" (hObject As HANDLE) As BOOL
265
266Declare Function CompareFileTime Lib "kernel32" (ByRef FileTime1 As FILETIME, ByRef FileTime2 As FILETIME) As Long
267
268Declare Function CopyFile Lib "kernel32" Alias _FuncName_CopyFile (pExistingFileName As PCTSTR, pNewFileName As PCTSTR, bFailIfExists As BOOL) As BOOL
269Declare Function CreateDirectory Lib "kernel32" Alias _FuncName_CreateDirectory (pPathName As PCTSTR, pSecurityAttributes As *SECURITY_ATTRIBUTES) As BOOL
270Declare Function CreateEvent Lib "kernel32" Alias _FuncName_CreateEvent (pEventAttributes As *SECURITY_ATTRIBUTES, bManualReset As BOOL, bInitialState As BOOL, pName As PCTSTR) As HANDLE
271Declare Function CreateMutex Lib "kernel32" Alias _FuncName_CreateMutex (lpMutexAttributes As *SECURITY_ATTRIBUTES, bInitialOwner As BOOL, lpName As PCTSTR) As HANDLE
272Declare Function CreatePipe Lib "Kernel32" (
273 ByRef hReadPipe As HANDLE,
274 ByRef hWritePipe As HANDLE,
275 ByVal pPipeAttributes As *SECURITY_ATTRIBUTES,
276 ByVal nSize As DWord) As Long
277Declare Function CreateSemaphore Lib "kernel32" Alias _FuncName_CreateSemaphore (pSemaphoreAttributes As *SECURITY_ATTRIBUTES, lInitialCount As Long, lMaximumCount As Long, pName As PCTSTR) As HANDLE
278
279TypeDef PTIMERAPCROUTINE = *Sub(lpArgToCompletionRoutine As VoidPtr, dwTimerLowValue As DWord, dwTimerHighValue As DWord)
280Declare Function CreateWaitableTimer Lib "kernel32" Alias _FuncName_CreateWaitableTimer (pTimerAttributes As *SECURITY_ATTRIBUTES, bManualReset As BOOL, pTimerName As PCTSTR) As HANDLE
281Declare Function OpenWaitableTimer Lib "kernel32" Alias _FuncName_OpenWaitableTimer (dwDesiredAccess As DWord, bInheritHandle As BOOL, pTimerName As PCTSTR) As HANDLE
282Declare 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
283Declare Function CancelWaitableTimer Lib "kernel32" (hTimer As HANDLE) As BOOL
284
285Const CREATE_NEW = 1
286Const CREATE_ALWAYS = 2
287Const OPEN_EXISTING = 3
288Const OPEN_ALWAYS = 4
289Const TRUNCATE_EXISTING = 5
290Const FILE_FLAG_WRITE_THROUGH = &H80000000
291Const FILE_FLAG_OVERLAPPED = &H40000000
292Const FILE_FLAG_NO_BUFFERING = &H20000000
293Const FILE_FLAG_RANDOM_ACCESS = &H10000000
294Const FILE_FLAG_SEQUENTIAL_SCAN = &H08000000
295Const FILE_FLAG_DELETE_ON_CLOSE = &H04000000
296Const FILE_FLAG_BACKUP_SEMANTICS = &H02000000
297Const FILE_FLAG_POSIX_SEMANTICS = &H01000000
298Const FILE_FLAG_OPEN_REPARSE_POINT = &H00200000
299Const FILE_FLAG_OPEN_NO_RECALL = &H00100000
300Declare 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
301
302Const FILE_MAP_COPY = SECTION_QUERY
303Const FILE_MAP_WRITE = SECTION_MAP_WRITE
304Const FILE_MAP_READ = SECTION_MAP_READ
305Const FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS
306Declare 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
307Declare Function OpenFileMapping Lib "kernel32" Alias _FuncName_OpenFileMapping (dwDesiredAccess As DWord, bInheritHandle As BOOL, pName As PCSTR) As HANDLE
308Declare Function MapViewOfFile Lib "kernel32" (hFileMappingObject As HANDLE, dwDesiredAccess As DWord, dwFileOffsetHigh As DWord, dwFileOffsetLow As DWord, dwNumberOfBytesToMap As DWord) As VoidPtr
309Declare Function MapViewOfFileEx Lib "kernel32" (hFileMappingObject As HANDLE, dwDesiredAccess As DWord, dwFileOffsetHigh As DWord, dwFileOffsetLow As DWord, dwNumberOfBytesToMap As DWord, lpBaseAddress As VoidPtr) As VoidPtr
310Declare Function FlushViewOfFile Lib "kernel32" (lpBaseAddress As VoidPtr, dwNumberOfBytesToFlush As DWord) As BOOL
311Declare Function UnmapViewOfFile Lib "kernel32" (lpBaseAddress As VoidPtr) As BOOL
312Declare Function CreateMailslot Lib "kernel32" Alias _FuncName_CreateMailslot (pName As PCTSTR, nMaxMessageSize As DWord, lReadTimeout As DWord, pSecurityAttributes As *SECURITY_ATTRIBUTES) As HANDLE
313
314Const DEBUG_PROCESS = &H00000001
315Const DEBUG_ONLY_THIS_PROCESS = &H00000002
316Const CREATE_SUSPENDED = &H00000004
317Const DETACHED_PROCESS = &H00000008
318Const CREATE_NEW_CONSOLE = &H00000010
319Const NORMAL_PRIORITY_CLASS = &H00000020
320Const IDLE_PRIORITY_CLASS = &H00000040
321Const HIGH_PRIORITY_CLASS = &H00000080
322Const REALTIME_PRIORITY_CLASS = &H00000100
323Const CREATE_NEW_PROCESS_GROUP = &H00000200
324Const CREATE_UNICODE_ENVIRONMENT = &H00000400
325Const CREATE_SEPARATE_WOW_VDM = &H00000800
326Const CREATE_SHARED_WOW_VDM = &H00001000
327Const CREATE_FORCEDOS = &H00002000
328Const CREATE_DEFAULT_ERROR_MODE = &H04000000
329Const CREATE_NO_WINDOW = &H08000000
330Const PROFILE_USER = &H10000000
331Const PROFILE_KERNEL = &H20000000
332Const PROFILE_SERVER = &H40000000
333
334Const STARTF_USESHOWWINDOW = &H00000001
335Const STARTF_USESIZE = &H00000002
336Const STARTF_USEPOSITION = &H00000004
337Const STARTF_USECOUNTCHARS = &H00000008
338Const STARTF_USEFILLATTRIBUTE = &H00000010
339Const STARTF_RUNFULLSCREEN = &H00000020
340Const STARTF_FORCEONFEEDBACK = &H00000040
341Const STARTF_FORCEOFFFEEDBACK = &H00000080
342Const STARTF_USESTDHANDLES = &H00000100
343Const STARTF_USEHOTKEY = &H00000200
344Type STARTUPINFOW
345 cb As DWord
346 lpReserved As LPWSTR
347 lpDesktop As LPWSTR
348 lpTitle As LPWSTR
349 dwX As DWord
350 dwY As DWord
351 dwXSize As DWord
352 dwYSize As DWord
353 dwXCountChars As DWord
354 dwYCountChars As DWord
355 dwFillAttribute As DWord
356 dwFlags As DWord
357 wShowWindow As Word
358 cbReserved2 As Word
359 lpReserved2 As *Byte
360 hStdInput As HANDLE
361 hStdOutput As HANDLE
362 hStdError As HANDLE
363End Type
364Type STARTUPINFOA
365 cb As DWord
366 lpReserved As LPSTR
367 lpDesktop As LPSTR
368 lpTitle As LPSTR
369 dwX As DWord
370 dwY As DWord
371 dwXSize As DWord
372 dwYSize As DWord
373 dwXCountChars As DWord
374 dwYCountChars As DWord
375 dwFillAttribute As DWord
376 dwFlags As DWord
377 wShowWindow As Word
378 cbReserved2 As Word
379 lpReserved2 As *Byte
380 hStdInput As HANDLE
381 hStdOutput As HANDLE
382 hStdError As HANDLE
383End Type
384#ifdef UNICODE
385TypeDef STARTUPINFO = STARTUPINFOW
386#else
387TypeDef STARTUPINFO = STARTUPINFOA
388#endif
389Type PROCESS_INFORMATION
390 hProcess As HANDLE
391 hThread As HANDLE
392 dwProcessId As DWord
393 dwThreadId As DWord
394End Type
395Declare 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
396
397TypeDef LPTHREAD_START_ROUTINE = *Function(lpThreadParameter As VoidPtr) As DWord
398Declare 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
399
400Declare Sub DebugBreak Lib "kernel32" ()
401Declare Sub DeleteCriticalSection Lib "kernel32" (ByRef CriticalSection As CRITICAL_SECTION)
402Declare Function DeleteFile Lib "kernel32" Alias _FuncName_DeleteFile (pFileName As PCTSTR) As BOOL
403Declare Function DeviceIoControl Lib "Kernel32" (
404 hDevice As HANDLE,
405 dwIoControlCode As DWord,
406 pInBuffer As VoidPtr,
407 nInBufferSize As DWord,
408 pOutBuffer As VoidPtr,
409 nOutBufferSize As DWord,
410 pBytesReturned As DWordPtr,
411 pOverlapped As *OVERLAPPED
412) As Long
413Declare Function DisableThreadLibraryCalls Lib "kernel32" (hLibModule As HINSTANCE) As BOOL
414Declare Function DosDateTimeToFileTime Lib "kernel32" (wFatDate As Word, wFatTime As Word, ByRef FileTime As FILETIME) As BOOL
415Declare 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
416Declare Sub EnterCriticalSection Lib "kernel32" (ByRef lpCriticalSection As CRITICAL_SECTION)
417Declare Sub ExitProcess Lib "kernel32" (dwExitCode As DWord)
418Declare Sub ExitThread Lib "kernel32" (dwExitCode As DWord)
419Declare Sub FatalAppExit Lib "kernel32" Alias _FuncName_FatalAppExit (Action As DWord, pMessageText As PCTSTR)
420Declare Function FileTimeToDosDateTime Lib "kernel32" (ByRef lpFileTime As FILETIME, ByRef lpFatDate As Word, ByRef lpFatTime As Word) As BOOL
421Declare Function FileTimeToLocalFileTime Lib "kernel32" (ByRef lpFileTime As FILETIME, ByRef lpLocalFileTime As FILETIME) As BOOL
422Declare Function FileTimeToSystemTime Lib "kernel32" (ByRef lpFileTime As FILETIME, ByRef lpSystemTime As SYSTEMTIME) As BOOL
423Declare Sub FillMemory Lib "kernel32" Alias "RtlFillMemory" (pDest As VoidPtr, stLength As SIZE_T, c As Byte)
424Declare Function FindClose Lib "kernel32" (hFindFile As HANDLE) As BOOL
425Declare Function FindCloseChangeNotification Lib "kernel32" (hChangeHandle As HANDLE) As BOOL
426Declare Function FindFirstChangeNotification Lib "kernel32" Alias _FuncName_FindFirstChangeNotification (
427 pPathName As PCTSTR,
428 bWatchSubtree As BOOL,
429 dwNotifyFilter As DWord
430) As HANDLE
431
432Type WIN32_FIND_DATAW
433 dwFileAttributes As DWord
434 ftCreationTime As FILETIME
435 ftLastAccessTime As FILETIME
436 ftLastWriteTime As FILETIME
437 nFileSizeHigh As DWord
438 nFileSizeLow As DWord
439 dwReserved0 As DWord
440 dwReserved1 As DWord
441 cFileName[ELM(MAX_PATH)] As WCHAR
442 cAlternateFileName[13] As WCHAR
443End Type
444Type WIN32_FIND_DATAA
445 dwFileAttributes As DWord
446 ftCreationTime As FILETIME
447 ftLastAccessTime As FILETIME
448 ftLastWriteTime As FILETIME
449 nFileSizeHigh As DWord
450 nFileSizeLow As DWord
451 dwReserved0 As DWord
452 dwReserved1 As DWord
453 cFileName[ELM(MAX_PATH)] As SByte
454 cAlternateFileName[13] As SByte
455End Type
456#ifdef UNICODE
457TypeDef WIN32_FIND_DATA = WIN32_FIND_DATAW
458#else
459TypeDef WIN32_FIND_DATA = WIN32_FIND_DATAA
460#endif
461TypeDef LPWIN32_FIND_DATA = *WIN32_FIND_DATA
462Declare Function FindFirstFile Lib "kernel32" Alias _FuncName_FindFirstFile (pFileName As PCTSTR, ByRef FindFildData As WIN32_FIND_DATA) As HANDLE
463Declare Function FindNextChangeNotification Lib "kernel32" (hChangeHandle As HANDLE) As BOOL
464Declare Function FindNextFile Lib "kernel32" Alias _FuncName_FindNextFile (hFindFile As HANDLE, ByRef FindFildData As WIN32_FIND_DATA) As BOOL
465Declare Function FlushFileBuffers Lib "kernel32" (hFile As HANDLE) As BOOL
466Declare Function FlushInstructionCache Lib "kernel32" (hProcess As HANDLE, pBaseAddress As VoidPtr, Size As SIZE_T) As BOOL
467
468Const FORMAT_MESSAGE_ALLOCATE_BUFFER = &H00000100
469Const FORMAT_MESSAGE_IGNORE_INSERTS = &H00000200
470Const FORMAT_MESSAGE_FROM_STRING = &H00000400
471Const FORMAT_MESSAGE_FROM_HMODULE = &H00000800
472Const FORMAT_MESSAGE_FROM_SYSTEM = &H00001000
473Const FORMAT_MESSAGE_ARGUMENT_ARRAY = &H00002000
474Declare 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
475Declare Function FreeEnvironmentStrings Lib "kernel32" Alias _FuncName_FreeEnvironmentStrings (pszEnvironmentBlock As PCTSTR) As BOOL
476Declare Function FreeLibrary Lib "kernel32" (hLibModule As HINSTANCE) As BOOL
477Declare Sub FreeLibraryAndExitThread Lib "kernel32" (hModule As HANDLE, dwExitCode As DWord)
478Declare Function GetCommandLineA Lib "kernel32" () As PCSTR
479Declare Function GetCommandLineW Lib "kernel32" () As PCWSTR
480#ifdef UNICODE
481Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineW" () As PCWSTR
482#else
483Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineA" () As PCSTR
484#endif
485Declare Function GetCompressedFileSize Lib "kernel32" Alias _FuncName_GetCompressedFileSize (pFileName As PCTSTR, ByRef FileSizeHigh As DWord) As DWord
486
487Const MAX_COMPUTERNAME_LENGTH = 15
488Declare Function GetComputerName Lib "kernel32" Alias _FuncName_GetComputerName (pBuffer As PTSTR, ByRef nSize As DWord) As BOOL
489
490Declare Function GetCurrentDirectory Lib "kernel32" Alias _FuncName_GetCurrentDirectory (nBufferLength As DWord, pBuffer As PTSTR) As DWord
491Declare Function GetCurrentProcess Lib "kernel32" () As HANDLE
492Declare Function GetCurrentProcessId Lib "kernel32" () As DWord
493Declare Function GetCurrentThread Lib "kernel32" () As HANDLE
494Declare Function GetCurrentThreadId Lib "kernel32" () As DWord
495
496Declare Function GetDiskFreeSpace Lib "kernel32" Alias _FuncName_GetDiskFreeSpace (pRootPathName As PCTSTR, lpSectorsPerCluster As *DWord, pBytesPerSector As *DWord, pNumberOfFreeClusters As *DWord, pTotalNumberOfClusters As *DWord) As BOOL
497Declare 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
498
499Const DRIVE_UNKNOWN = 0
500Const DRIVE_NO_ROOT_DIR = 1
501Const DRIVE_REMOVABLE = 2
502Const DRIVE_FIXED = 3
503Const DRIVE_REMOTE = 4
504Const DRIVE_CDROM = 5
505Const DRIVE_RAMDISK = 6
506Declare 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
507Declare Function GetDriveType Lib "kernel32" Alias _FuncName_GetDriveType (lpRootPathName As PCTSTR) As DWord
508
509Declare Function GetEnvironmentVariable Lib "kernel32" Alias _FuncName_GetEnvironmentVariable (lpName As PCTSTR, lpBuffer As PTSTR, nSize As DWord) As DWord
510Declare Function GetEnvironmentStrings Lib "kernel32" Alias _FuncName_GetEnvironmentStrings () As VoidPtr
511Const STILL_ACTIVE = &H00000103
512Declare Function GetExitCodeProcess Lib "kernel32" (hProcess As HANDLE, ByRef lpExitCode As DWord) As BOOL
513Declare Function GetExitCodeThread Lib "kernel32" (hThread As HANDLE, ByRef lpExitCode As DWord) As BOOL
514
515Declare Function GetFileAttributes Lib "kernel32" Alias _FuncName_GetFileAttributes (lpFileName As PCTSTR) As DWord
516Type BY_HANDLE_FILE_INFORMATION
517 dwFileAttributes As DWord
518 ftCreationTime As FILETIME
519 ftLastAccessTime As FILETIME
520 ftLastWriteTime As FILETIME
521 dwVolumeSerialNumber As DWord
522 nFileSizeHigh As DWord
523 nFileSizeLow As DWord
524 nNumberOfLinks As DWord
525 nFileIndexHigh As DWord
526 nFileIndexLow As DWord
527End Type
528Declare Function GetFileInformationByHandle Lib "kernel32" (
529 ByVal hFile As HANDLE,
530 ByRef FileInformation As BY_HANDLE_FILE_INFORMATION
531) As BOOL
532Declare Function GetFileSize Lib "kernel32" (hFile As HANDLE, pFileSizeHigh As *DWord) As DWord
533'Declare Function GetFileSizeEx Lib "kernel32" (hFile As HANDLE, pFileSizeHigh As *QWord) As BOOL
534Declare Function GetFileTime Lib "kernel32" (hFile As HANDLE, ByRef lpCreationTime As FILETIME, ByRef lpLastAccessTime As FILETIME, ByRef lpLastWriteTime As FILETIME) As BOOL
535
536Const FILE_TYPE_UNKNOWN = &H0000
537Const FILE_TYPE_DISK = &H0001
538Const FILE_TYPE_CHAR = &H0002
539Const FILE_TYPE_PIPE = &H0003
540Const FILE_TYPE_REMOTE = &H8000
541Declare Function GetFileType Lib "kernel32" (hFile As HANDLE) As DWord
542
543Declare Function GetFullPathName Lib "kernel32" Alias _FuncName_GetFullPathName (lpFileName As PCSTR, nBufferLength As DWord, pBuffer As PSTR, lpFilePart As *DWord) As DWord
544Declare Function GetLastError Lib "kernel32" () As DWord
545Declare Sub GetLocalTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME)
546Declare Function GetLogicalDrives Lib "kernel32" () As DWord
547Declare Function GetLogicalDriveStrings Lib "kernel32" Alias _FuncName_GetLogicalDriveStrings (nBufferLength As DWord, pBuffer As PTSTR) As DWord
548Declare Function GetLongPathName Lib "kernel32" Alias _FuncName_GetLongPathName (lpszShortPath As LPCTSTR, lpszLongPath As LPTSTR, cchBuffer As DWord) As DWord
549Declare Function GetModuleFileName Lib "kernel32" Alias _FuncName_GetModuleFileName (hModule As HINSTANCE, lpFileName As PTSTR, nSize As DWord) As DWord
550Declare Function GetModuleHandle Lib "kernel32" Alias _FuncName_GetModuleHandle (lpModuleName As PTSTR) As HINSTANCE
551Declare Function GetOverlappedResult Lib "kernel32" (
552 hFile As HANDLE,
553 ByRef Overlapped As OVERLAPPED,
554 ByRef pNumberOfBytesTransferred As DWord,
555 bWait As BOOL
556) As BOOL
557Type SYSTEM_POWER_STATUS
558 ACLineStatus As Byte
559 BatteryFlag As Byte
560 BatteryLifePercent As Byte
561 Reserved1 As Byte
562 BatteryLifeTime As Long
563 BatteryFullLifeTime As Long
564End Type
565Declare Function GetSystemPowerStatus Lib "kernel32" (ByRef SystemPowerStatus As SYSTEM_POWER_STATUS) As Long
566Declare Function GetPriorityClass Lib "kernel32" (hProcess As HANDLE) As DWord
567Declare Function GetProcAddress Lib "kernel32" (hModule As HINSTANCE, pProcName As PCSTR) As DWord
568Declare Function GetProcessAffinityMask Lib "kernel32" (
569 hProcess As HANDLE,
570 ByRef ProcessAffinityMask As ULONG_PTR,
571 ByRef SystemAffinityMask As ULONG_PTR
572) As BOOL
573Declare Function GetProcessHeap Lib "kernel32" () As HANDLE
574Declare Function GetShortPathName Lib "kernel32" Alias _FuncName_GetShortPathName (
575 pszLongPath As PCTSTR,
576 pszShortPath As PTSTR,
577 cchBuffer As DWord
578) As DWord
579
580Declare Sub GetStartupInfo Lib "kernel32" Alias _FuncName_GetStartupInfo (ByRef StartupInfo As STARTUPINFO)
581
582Const STD_INPUT_HANDLE = -10
583Const STD_OUTPUT_HANDLE = -11
584Const STD_ERROR_HANDLE = -12
585Declare Function GetStdHandle Lib "kernel32" (nStdHandle As DWord) As HANDLE
586
587Declare Function GetSystemDirectory Lib "kernel32" Alias _FuncName_GetSystemDirectory (pBuffer As PTSTR, uSize As DWord) As DWord
588
589Type SYSTEM_INFO
590 dwOemId As DWord
591 dwPageSize As DWord
592 lpMinimumApplicationAddress As VoidPtr
593 lpMaximumApplicationAddress As VoidPtr
594 dwActiveProcessorMask As ULONG_PTR
595 dwNumberOfProcessors As DWord
596 dwProcessorType As DWord
597 dwAllocationGranularity As DWord
598 wProcessorLevel As Word
599 wProcessorRevision As Word
600End Type
601Declare Sub GetSystemInfo Lib "kernel32" (ByRef SystemInfo As SYSTEM_INFO)
602
603Declare Sub GetSystemTime Lib "kernel32" (ByRef SystemTime As SYSTEMTIME)
604Declare Sub GetSystemTimeAsFileTime Lib "kernel32" (ByRef SystemTimeAsFileTime As FILETIME)
605
606Declare Function GetTempFileName Lib "kernel32" Alias _FuncName_GetTempFileName (
607 pPathName As PCTSTR,
608 pPrefixString As PCTSTR,
609 uUnique As DWord,
610 pTempFileName As PTSTR
611) As DWord
612Declare Function GetTempPath Lib "kernel32" Alias _FuncName_GetTempPath (nBufferLength As DWord, lpBuffer As PTSTR) As DWord
613Declare Function GetThreadContext Lib "kernel32" (hThread As HANDLE, ByRef Context As CONTEXT) As BOOL
614/*
615Const THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN
616Const THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST+1
617Const THREAD_PRIORITY_NORMAL = 0
618Const THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX
619Const THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST-1
620Const THREAD_PRIORITY_ERROR_RETURN = LONG_MAX
621Const THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT
622Const THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE
623*/
624Declare Function GetThreadPriority Lib "kernel32" (hThread As HANDLE) As Long
625Declare Function GetThreadPriorityBoost Lib "kernel32" (
626 hThread As HANDLE,
627 ByRef pDisablePriorityBoost As BOOL) As BOOL
628Declare Function GetTickCount Lib "kernel32" () As DWord
629
630Declare Function GetUserName Lib "advapi32" Alias _FuncName_GetUserName (pBuffer As PTSTR, ByRef nSize As DWord) As BOOL
631Declare Function GetVersionEx Lib "kernel32" Alias _FuncName_GetVersionEx (ByRef VersionInformation As OSVERSIONINFO) As BOOL
632Declare Function GetWindowsDirectory Lib "kernel32" Alias _FuncName_GetWindowsDirectory (pBuffer As PTSTR, uSize As DWord) As DWord
633Declare Function GlobalAlloc Lib "kernel32" (uFlags As DWord, dwBytes As SIZE_T) As HGLOBAL
634Declare Function GlobalFrags Lib "kernel32" (hMem As HGLOBAL) As DWord
635Declare Function GlobalFree Lib "kernel32" (hMem As HGLOBAL) As HGLOBAL
636Declare Function GlobalHandle Lib "kernel32" (pMem As VoidPtr) As HGLOBAL
637Declare Function GlobalLock Lib "kernel32" (hMem As HGLOBAL) As VoidPtr
638
639Type MEMORYSTATUS
640 dwLength As DWord
641 dwMemoryLoad As DWord
642 dwTotalPhys As SIZE_T
643 dwAvailPhys As SIZE_T
644 dwTotalPageFile As SIZE_T
645 dwAvailPageFile As SIZE_T
646 dwTotalVirtual As SIZE_T
647 dwAvailVirtual As SIZE_T
648End Type
649Declare Sub GlobalMemoryStatus Lib "kernel32" (ByRef lpMemStatus As MEMORYSTATUS)
650
651Declare Function GlobalReAlloc Lib "kernel32" (hMem As HGLOBAL, dwBytes As SIZE_T, uFlags As DWord) As HGLOBAL
652Declare Function GlobalSize Lib "kernel32" (hMem As HGLOBAL) As SIZE_T
653Declare Function GlobalUnlock Lib "kernel32" (hMem As HGLOBAL) As BOOL
654Declare Function HeapAlloc Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, dwBytes As SIZE_T) As VoidPtr
655Declare Function HeapCreate Lib "kernel32" (flOptions As DWord, dwInitialSize As SIZE_T, dwMaximumSize As SIZE_T) As HANDLE
656Declare Function HeapDestroy Lib "kernel32" (hHeap As HANDLE) As Long
657Declare Function HeapFree Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As Long
658Declare Function HeapReAlloc Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr, dwBytes As SIZE_T) As VoidPtr
659Declare Function HeapSize Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As SIZE_T
660Declare Function HeapValidate Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As BOOL
661Declare Sub InitializeCriticalSection Lib "kernel32" (ByRef CriticalSection As CRITICAL_SECTION)
662Declare Function IsBadReadPtr Lib "kernel32" (lp As VoidPtr, ucb As ULONG_PTR) As BOOL
663Declare Function IsBadWritePtr Lib "kernel32" (lp As VoidPtr, ucb As ULONG_PTR) As BOOL
664
665#ifdef _WIN64
666Declare Function IsWow64Process Lib "kernel32" (hProcess As HANDLE, ByRef bWow64Process As BOOL) As BOOL
667#endif
668
669Declare Sub LeaveCriticalSection Lib "kernel32" (ByRef lpCriticalSection As CRITICAL_SECTION)
670Declare Function LocalAlloc Lib "kernel32" (uFlags As DWord, uBytes As SIZE_T) As HLOCAL
671Declare Function LocalFileTimeToFileTime Lib "kernel32" (ByRef lpLocalFileTime As FILETIME, ByRef lpFileTime As FILETIME) As BOOL
672Declare Function LocalFree Lib "kernel32" (hMem As HLOCAL) As HLOCAL
673Declare Function LocalHandle Lib "kernel32" (pMem As VoidPtr) As HLOCAL
674Declare Function LocalLock Lib "kernel32" (hMem As HLOCAL) As VoidPtr
675Declare Function LocalReAlloc Lib "kernel32" (hMem As HLOCAL, dwBytes As SIZE_T, uFlags As DWord) As HLOCAL
676Declare Function LocalSize Lib "kernel32" (hMem As HLOCAL) As SIZE_T
677Declare Function LocalUnlock Lib "kernel32" (hMem As HLOCAL) As BOOL
678Declare Function LockFile Lib "kernel32" (hFile As HANDLE, dwFileOffsetLow As DWord, dwFileOffsetHigh As DWord, nNumberOfBytesToLockLow As DWord, nNumberOfBytesToLockHigh As DWord) As BOOL
679Declare Function LoadLibrary Lib "kernel32" Alias _FuncName_LoadLibrary (pLibFileName As PCTSTR) As HINSTANCE
680
681Const DONT_RESOLVE_DLL_REFERENCES = &h00000001
682Const LOAD_LIBRARY_AS_DATAFILE = &h00000002
683Const LOAD_WITH_ALTERED_SEARCH_PATH = &h00000008
684Const LOAD_IGNORE_CODE_AUTHZ_LEVEL = &h00000010
685Declare Function LoadLibraryEx Lib "kernel32" Alias _FuncName_LoadLibraryEx (pLibFileName As PCTSTR, hFile As HANDLE, dwFlags As DWord) As HINSTANCE
686
687Declare Function lstrcat Lib "kernel32" Alias _FuncName_lstrcat (lpString1 As LPTSTR, lpString2 As LPCTSTR) As LPTSTR
688Declare Function lstrcmp Lib "kernel32" Alias _FuncName_lstrcmp (lpString1 As LPCTSTR, lpString2 As LPCTSTR) As Long
689Declare Function lstrcmpi Lib "kernel32" Alias _FuncName_lstrcmpi (lpString1 As LPCTSTR, lpString2 As LPCTSTR) As Long
690Declare Function lstrcpy Lib "kernel32" Alias _FuncName_lstrcpy (lpString1 As LPTSTR, lpString2 As LPCTSTR) As LPTSTR
691Declare Function lstrcpyn Lib "kernel32" Alias _FuncName_lstrcpyn (lpString1 As LPTSTR,ByVal lpString2 As LPCTSTR,ByVal iMaxLength As Long) As LPTSTR
692Declare Function lstrlenA Lib "kernel32" (lpString As LPCSTR) As Long
693Declare Function lstrlenW Lib "kernel32" (lpString As LPCWSTR) As Long
694#ifdef UNICODE
695Declare Function lstrlen Lib "kernel32" Alias "lstrlenW" (lpString As LPCWSTR) As Long
696#else
697Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (lpString As LPCSTR) As Long
698#endif
699Declare Sub memcpy Lib "kernel32" Alias "RtlMoveMemory" (pDest As VoidPtr, pSrc As VoidPtr, length As SIZE_T)
700Declare Function MoveFile Lib "kernel32" Alias _FuncName_MoveFile (lpExistingFileName As LPCTSTR, lpNewFileName As LPCTSTR) As BOOL
701Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As PVOID, pSrc As VoidPtr, length As SIZE_T)
702
703Declare Function MulDiv Lib "kernel32" (
704 nNumber As Long,
705 nNumerator As Long,
706 nDenominator As Long
707) As Long
708
709Declare Function OpenEvent Lib "kernel32" Alias _FuncName_OpenEvent (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE
710Declare Function OpenMutex Lib "kernel32" Alias _FuncName_OpenMutex (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE
711Declare Function OpenSemaphore Lib "kernel32" Alias _FuncName_OpenSemaphore (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE
712Declare Function OpenProcess Lib "kernel32" (dwDesiredAccess As DWord, bInheritHandle As Long, dwProcessId As DWord) As HANDLE
713Declare Sub OutputDebugStringA Lib "kernel32" (pOutputString As PCSTR)
714Declare Sub OutputDebugStringW Lib "kernel32" (pOutputString As PCWSTR)
715#ifdef UNICODE
716Declare Sub OutputDebugString Lib "kernel32" Alias "OutputDebugStringW" (pOutputString As PCWSTR)
717#else
718Declare Sub OutputDebugString Lib "kernel32" Alias "OutputDebugStringA" (pOutputString As PCSTR)
719#endif
720Declare Function PulseEvent Lib "kernel32" (hEvent As HANDLE) As BOOL
721Declare Sub RaiseException Lib "kernel32" (
722 dwExceptionCode As DWord,
723 dwExceptionFlags As DWord,
724 NumberOfArguments As DWord,
725 pArguments As *ULONG_PTR)
726Declare Function ReadFile Lib "kernel32" (hFile As HANDLE, lpBuffer As VoidPtr, nNumberOfBytesToRead As DWord, lpNumberOfBytesRead As *DWord, ByRef Overlapped As OVERLAPPED) As BOOL
727Declare Function ReadProcessMemory Lib "Kernel32" (hProcess As HANDLE, lpBaseAddress As VoidPtr, lpBuffer As VoidPtr, nSize As SIZE_T, lpNumberOfBytesRead As *SIZE_T) As BOOL
728Declare Function ReleaseMutex Lib "kernel32" (hMutex As HANDLE) As BOOL
729Declare Function ReleaseSemaphore Lib "kernel32" (hSemaphore As HANDLE, lReleaseCount As Long, ByRef lpPreviousCount As Long) As BOOL
730Declare Function RemoveDirectory Lib "kernel32" Alias _FuncName_RemoveDirectory (lpPathName As LPCTSTR) As BOOL
731Declare Function ResetEvent Lib "kernel32" (hEvent As HANDLE) As BOOL
732Declare Function ResumeThread Lib "kernel32" (hThread As HANDLE) As DWord
733Declare Function SetComputerName Lib "kernel32" Alias _FuncName_SetComputerName (lpComputerName As LPCTSTR) As BOOL
734Declare Function SetCurrentDirectory Lib "kernel32" Alias _FuncName_SetCurrentDirectory (lpPathName As LPCTSTR) As BOOL
735Declare 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
736Declare Function SetEndOfFile Lib "kernel32" (hFile As HANDLE) As BOOL
737Declare Function SetEnvironmentVariable Lib "kernel32" Alias _FuncName_SetEnvironmentVariable (lpName As LPCTSTR, lpValue As LPTSTR) As BOOL
738
739Const SEM_FAILCRITICALERRORS = &h0001
740Const SEM_NOGPFAULTERRORBOX = &h0002
741Const SEM_NOALIGNMENTFAULTEXCEPT = &h0004
742Const SEM_NOOPENFILEERRORBOX = &h8000
743Declare Function SetErrorMode Lib "kernel32" (uMode As DWord) As DWord
744Declare Function SetEvent Lib "kernel32" (hEvent As HANDLE) As BOOL
745Declare Function SetFileAttributes Lib "kernel32" Alias _FuncName_SetFileAttributes (lpFileName As LPCTSTR, dwFileAttributes As DWord) As BOOL
746
747Const FILE_BEGIN = 0
748Const FILE_CURRENT = 1
749Const FILE_END = 2
750Declare Function SetFilePointer Lib "kernel32" (hFile As HANDLE, lDistanceToMove As Long, lpDistanceToMoveHigh As *Long, dwMoveMethod As DWord) As DWord
751
752Declare Function SetFileTime Lib "kernel32" (hFile As HANDLE, ByRef lpCreationTime As FILETIME, ByRef lpLastAccessTime As FILETIME, ByRef lpLastWriteTime As FILETIME) As BOOL
753Declare Sub SetLastError Lib "kernel32" (dwErrCode As DWord)
754Declare Sub SetLastErrorEx Lib "kernel32" (dwErrCode As DWord, dwType As DWord)
755Declare Function SetLocalTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME) As BOOL
756Declare Function SetPriorityClass Lib "kernel32" (hProcess As HANDLE, dwPriorityClass As DWord) As BOOL
757Declare Function SetThreadContext Lib "kernel32" (hThread As HANDLE, ByRef Context As CONTEXT) As BOOL
758Declare Function SetThreadPriority Lib "kernel32" (hThread As HANDLE, nPriority As Long) As BOOL
759Declare Function SetThreadPriorityBoost Lib "kernel32" (
760 hThread As HANDLE,
761 DisablePriorityBoost As BOOL
762) As BOOL
763
764TypeDef PTOP_LEVEL_EXCEPTION_FILTER = *Function(ByRef ExceptionInfo As EXCEPTION_POINTERS) As Long
765
766Declare Function SetUnhandledExceptionFilter Lib "kernel32" (pTopLevelExceptionFilter As PTOP_LEVEL_EXCEPTION_FILTER) As PTOP_LEVEL_EXCEPTION_FILTER
767
768Const INFINITE = &HFFFFFFFF
769Declare Sub Sleep Lib "kernel32" (dwMilliseconds As DWord)
770Declare Function SleepEx Lib "kernel32" (dwMilliseconds As DWord, bAlertable As BOOL) As DWord
771
772Declare Function SuspendThread Lib "kernel32" (hThread As HANDLE) As DWord
773Declare Function SystemTimeToFileTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME, ByRef lpFileTime As FILETIME) As BOOL
774Declare Function TerminateProcess Lib "kernel32" (hProcess As HANDLE, dwExitCode As DWord) As BOOL
775Declare Function TerminateThread Lib "kernel32" (hThread As HANDLE, dwExitCode As DWord) As BOOL
776
777Const TLS_OUT_OF_INDEXES = &hffffffff As DWord
778Declare Function TlsAlloc Lib "kernel32" () As DWord
779Declare Function TlsFree Lib "kernel32" (dwTlsIndex As DWord) As BOOL
780Declare Function TlsGetValue Lib "kernel32" (dwTlsIndex As DWord) As VoidPtr
781Declare Function TlsSetValue Lib "kernel32" (dwTlsIndex As DWord, pTlsValue As VoidPtr) As BOOL
782Declare Function UnlockFile Lib "kernel32" (hFile As HANDLE, dwFileOffsetLow As DWord, dwFileOffsetHigh As DWord, nNumberOfBytesToUnlockLow As DWord, nNumberOfBytesToUnlockHigh As DWord) As BOOL
783Declare Function UnhandledExceptionFilter Lib "kernel32" (ByRef ExceptionInfo As EXCEPTION_POINTERS) As Long
784Declare Function VirtualAlloc Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T, flAllocationType As DWord, flProtect As DWord) As VoidPtr
785Declare Function VirtualFree Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T, dwFreeType As DWord) As BOOL
786Declare Function VirtualLock Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T) As BOOL
787Declare Function VirtualProtect Lib "kernel32" (
788 pAddress As VoidPtr,
789 Size As SIZE_T,
790 flNewProtect As DWord,
791 ByRef flOldProtect As DWord
792) As BOOL
793Declare Function VirtualProtectEx Lib "kernel32" (
794 hProcess As HANDLE,
795 pAddress As VoidPtr,
796 Size As SIZE_T,
797 flNewProtect As DWord,
798 ByRef flOldProtect As DWord
799) As BOOL
800Declare Function VirtualQuery Lib "kernel32" (
801 pAddress As VoidPtr,
802 ByRef mbi As MEMORY_BASIC_INFORMATION,
803 Length As SIZE_T
804) As SIZE_T
805Declare Function VirtualQueryEx Lib "kernel32" (
806 hProcess As HANDLE,
807 pAddress As VoidPtr,
808 ByRef mbi As MEMORY_BASIC_INFORMATION,
809 Length As SIZE_T
810) As SIZE_T
811Declare Function VirtualUnlock Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T) As BOOL
812Declare Function WaitForMultipleObjects Lib "kernel32" (nCount As DWord, pHandles As *HANDLE, fWaitAll As BOOL, dwMilliseconds As DWord) As DWord
813Declare Function WaitForMultipleObjectsEx Lib "kernel32" (nCount As DWord, pHandles As *HANDLE, fWaitAll As BOOL, dwMilliseconds As DWord, bAlertable As BOOL) As DWord
814Declare Function WaitForSingleObject Lib "kernel32" (hHandle As HANDLE, dwMilliseconds As DWord) As DWord
815Declare Function WaitForSingleObjectEx Lib "kernel32" (hHandle As HANDLE, dwMilliseconds As DWord, bAlertable As BOOL) As DWord
816
817Declare Function WriteFile Lib "kernel32" (hFile As HANDLE, lpBuffer As VoidPtr, nNumberOfBytesToWrite As DWord, lpNumberOfBytesWritten As *DWord, ByRef pOverlapped As OVERLAPPED) As BOOL
818Declare Sub ZeroMemory Lib "kernel32" Alias "RtlZeroMemory" (Destination As VoidPtr, dwLength As DWord)
819
820'
821' Wait functions' results.
822'
823Const WAIT_FAILED = (&hFFFFFFFF As DWord)
824Const WAIT_OBJECT_0 = ((STATUS_WAIT_0 ) + 0)
825
826Const WAIT_ABANDONED = ((STATUS_ABANDONED_WAIT_0 ) + 0)
827Const WAIT_ABANDONED_0 = ((STATUS_ABANDONED_WAIT_0 ) + 0)
828
829Const WAIT_IO_COMPLETION = STATUS_USER_APC
830
831Declare Function FindResource Lib "kernel32" Alias _FuncName_FindResource (hInstance As HINSTANCE, lpName As LPCTSTR, lpType As LPCTSTR) As HRSRC
832Declare Function LoadResource Lib "kernel32" (hModule As HMODULE, hResInfo As HRSRC) As HGLOBAL
833Declare Function FreeResource Lib "kernel32" (hResData As HGLOBAL) As BOOL
834Declare Function LockResource Lib "kernel32" (hResData As HGLOBAL) As VoidPtr
835Declare Function SizeofResource Lib "kernel32" (hModule As HANDLE, hResInfo As HRSRC) As DWord
836
837Declare Function ExpandEnvironmentStrings Lib "kernel32" Alias _FuncName_ExpandEnvironmentStrings (lpSrc As LPCTSTR, lpDst As LPTSTR, nSize As DWord) As DWord
838
839Type DCB
840 DCBlength As DWord
841 BaudRate As DWord
842 fBitFields As DWord
843 wReserved As Word
844 XonLim As Word
845 XoffLim As Word
846 ByteSize As Byte
847 Parity As Byte
848 StopBits As Byte
849 XonChar As CHAR
850 XoffChar As CHAR
851 ErrorChar As CHAR
852 EofChar As CHAR
853 EvtChar As CHAR
854 wReserved1 As Word
855End Type
856
857Type COMMTIMEOUTS
858 ReadIntervalTimeout As DWord
859 ReadTotalTimeoutMultiplier As DWord
860 ReadTotalTimeoutConstant As DWord
861 WriteTotalTimeoutMultiplier As DWord
862 WriteTotalTimeoutConstant As DWord
863End Type
864
865Type COMSTAT
866 fCoBitFlds As Long 'See Comment in Win32API.Txt
867 cbInQue As DWord
868 cbOutQue As DWord
869End Type
870
871Declare Function SetCommState Lib "kernel32" (hCommDev As HANDLE, ByRef dcb As DCB) As BOOL
872Declare Function SetCommTimeouts Lib "kernel32" (hFile As HANDLE ,ByRef pCommTimeouts As COMMTIMEOUTS) As BOOL
873Declare Function ClearCommError Lib "kernel32" (hCommDevs As HANDLE, ByRef Errors As DWord, ByRef Stat As COMSTAT) As BOOL
874Declare Function EscapeCommFunction Lib "kernel32" (nCid As HANDLE, ByVal nFunc As DWord) As BOOL
875Declare Function GetCommModemStatus Lib "kernel32" (hFile As HANDLE, ByRef ModemStat As DWord) As BOOL
876Declare Function SetCommMask Lib "kernel32" (hFile As HANDLE, dwEvtMask As DWord) As BOOL
877Declare Function WaitCommEvent Lib "kernel32" (hFile As HANDLE, ByRef EvtMask As DWord, lpOverlapped As *OVERLAPPED) As BOOL
878
879Const PURGE_TXABORT = &H0001
880Const PURGE_RXABORT = &H0002
881Const PURGE_TXCLEAR = &H0004
882Const PURGE_RXCLEAR = &H0008
883Declare Function PurgeComm Lib "kernel32" (hFile As HANDLE, dwFlags As DWord) As BOOL
884
885Declare Function OpenProcessToken Lib "advapi32" (ProcessHandle As HANDLE, DesiredAccess As DWord, ByRef TokenHandle As HANDLE) As BOOL
886Declare Function LookupPrivilegeValue Lib "advapi32" Alias _FuncName_LookupPrivilegeValue (lpSystemName As LPCTSTR, lpName As LPCTSTR, ByRef Luid As LUID) As Long
887Declare Function AdjustTokenPrivileges Lib "advapi32" (TokenHandle As Long, DisableAllPrivileges As Long,_
888 ByRef NewState As TOKEN_PRIVILEGES, BufferLength As Long,
889 ByRef PreviousState As TOKEN_PRIVILEGES, ByRef ReturnLength As Long) As Long
890
891Declare Function AddAtom Lib "kernel32" Alias _FuncName_AddAtom (lpString As LPCTSTR) As ATOM
892Declare Function DeleteAtom Lib "kernel32" (nAtom As ATOM) As ATOM
893Declare Function FindAtom Lib "kernel32" Alias _FuncName_AddAtom (lpString As LPCTSTR) As ATOM
894Declare Function GetAtomName Lib "kernel32" Alias _FuncName_GetAtomName (nAtom As ATOM, lpBuffer As LPCTSTR, nSize As Long) As DWord
895
896Declare Function GlobalAddAtom Lib "kernel32" Alias _FuncName_GlobalAddAtom (lpString As LPCTSTR) As ATOM
897Declare Function GlobalDeleteAtom Lib "kernel32" (a As ATOM) As ATOM
898Declare Function GlobalFindAtom Lib "kernel32" Alias _FuncName_GlobalAddAtom (lpString As LPCTSTR) As ATOM
899Declare Function GlobalGetAtomName Lib "kernel32" Alias _FuncName_GlobalGetAtomName (nAtom As ATOM, lpBuffer As LPCTSTR, nSize As Long) As DWord
900
901Declare Function InitAtomTable Lib "kernel32" (nSize As DWord) As BOOL
902
903Const MAXINTATOM = &hC000
904Const MAKEINTATOM(i) = (i As Word As ULONG_PTR As LPTSTR)
905Const INVALID_ATOM = 0 As ATOM
906
907'#if _WIN32_WINNT > &h0500
908TypeDef WAITORTIMERCALLBACK = WAITORTIMERCALLBACKFUNC
909
910'#endif
Note: See TracBrowser for help on using the repository browser.