source: trunk/Include/api_system.sbp@ 315

Last change on this file since 315 was 300, checked in by dai, 17 years ago

trunkディレクトリを作成。bin、Include、TestCaseをtrunkに移動した。
標準ライブラリのビルドバッチを追加。

File size: 48.1 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 INVALID_HANDLE_VALUE = -1 As HANDLE
146Const INVALID_SET_FILE_POINTER = &HFFFFFFFF
147
148'-----------------
149' data structs
150
151'variable type - System
152TypeDef HFILE = Long
153Type _System_DeclareHandle_HANDLE:unused As DWord:End Type
154TypeDef HRSRC = *_System_DeclareHandle_HANDLE
155
156' File structure
157Type SECURITY_ATTRIBUTES
158 nLength As DWord
159 lpSecurityDescriptor As VoidPtr
160 bInheritHandle As BOOL
161End Type
162
163Type OVERLAPPED
164 Internal As ULONG_PTR
165 InternalHigh As ULONG_PTR
166 Offset As DWord
167 OffsetHigh As DWord
168 hEvent As HANDLE
169End Type
170
171' System time
172Type SYSTEMTIME
173 wYear As Word
174 wMonth As Word
175 wDayOfWeek As Word
176 wDay As Word
177 wHour As Word
178 wMinute As Word
179 wSecond As Word
180 wMilliseconds As Word
181End Type
182
183' Global Memory Flags
184Const GMEM_FIXED = &H0000
185Const GMEM_MOVEABLE = &H0002
186Const GMEM_NOCOMPACT = &H0010
187Const GMEM_NODISCARD = &H0020
188Const GMEM_ZEROINIT = &H0040
189Const GMEM_MODIFY = &H0080
190Const GMEM_DISCARDABLE = &H0100
191Const GMEM_NOT_BANKED = &H1000
192Const GMEM_SHARE = &H2000
193Const GMEM_DDESHARE = &H2000
194Const GMEM_INVALID_HANDLE = &H8000
195Const GHND = GMEM_MOVEABLE or GMEM_ZEROINIT
196Const GPTR = GMEM_FIXED or GMEM_ZEROINIT
197Const GMEM_DISCARDED = &H4000
198
199' Locale flag
200Const LOCALE_NOUSEROVERRIDE = &H80000000
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
220Declare Function InterlockedIncrement Lib "kernel32" (ByRef lpAddend As Long) As Long
221Declare Function InterlockedDecrement Lib "kernel32" (ByRef lpAddend As Long) As Long
222Declare Function InterlockedExchange Lib "kernel32" (ByRef Target As Long, Value As Long) As Long
223Declare Function InterlockedCompareExchange Lib "kernel32" (ByRef Destination As Long, Exchange As Long, Comperand As Long) As Long
224Declare Function InterlockedExchangeAdd Lib "kernel32" (ByRef Addend As Long, Value As Long) As Long
225#ifdef _WIN64
226Declare Function InterlockedCompareExchangePointer Lib "kernel32" (ByRef Destination As VoidPtr, Exchange As VoidPtr, Comperand As VoidPtr) As VoidPtr
227Declare Function InterlockedExchangePointer Lib "kernel32" (ByRef Target As VoidPtr, Value As VoidPtr) As VoidPtr
228#else
229Declare Function InterlockedCompareExchangePointer Lib "kernel32" Alias "InterlockedCompareExchange" (ByRef Destination As VoidPtr, Exchange As VoidPtr, Comperand As VoidPtr) As VoidPtr
230Declare Function InterlockedExchangePointer Lib "kernel32" Alias "InterlockedExchange" (ByRef Target As VoidPtr, Value As VoidPtr) As VoidPtr
231#endif
232
233
234Declare Function Beep Lib "kernel32" (dwFreq As DWord, dwDuration As DWord) As BOOL
235Declare Function CloseHandle Lib "kernel32" (hObject As HANDLE) As BOOL
236
237Declare Function CompareFileTime Lib "kernel32" (ByRef FileTime1 As FILETIME, ByRef FileTime2 As FILETIME) As Long
238
239Const NORM_IGNORECASE = &H00000001
240Const NORM_IGNORENONSPACE = &H00000002
241Const NORM_IGNORESYMBOLS = &H00000004
242Const SORT_STRINGSORT = &H00001000
243Const NORM_IGNOREKANATYPE = &H00010000
244Const NORM_IGNOREWIDTH = &H00020000
245Const CSTR_LESS_THAN = 1
246Const CSTR_EQUAL = 2
247Const CSTR_GREATER_THAN = 3
248Declare 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
249
250Declare Function CopyFile Lib "kernel32" Alias _FuncName_CopyFile (pExistingFileName As PCTSTR, pNewFileName As PCTSTR, bFailIfExists As BOOL) As BOOL
251Declare Function CreateDirectory Lib "kernel32" Alias _FuncName_CreateDirectory (pPathName As PCTSTR, pSecurityAttributes As *SECURITY_ATTRIBUTES) As BOOL
252Declare Function CreateEvent Lib "kernel32" Alias _FuncName_CreateEvent (pEventAttributes As *SECURITY_ATTRIBUTES, bManualReset As BOOL, bInitialState As BOOL, pName As PCTSTR) As HANDLE
253Declare Function CreateMutex Lib "kernel32" Alias _FuncName_CreateMutex (lpMutexAttributes As *SECURITY_ATTRIBUTES, bInitialOwner As BOOL, lpName As PCTSTR) As HANDLE
254Declare Function CreatePipe Lib "Kernel32" (
255 ByRef hReadPipe As HANDLE,
256 ByRef hWritePipe As HANDLE,
257 ByVal pPipeAttributes As *SECURITY_ATTRIBUTES,
258 ByVal nSize As DWord) As Long
259Declare Function CreateSemaphore Lib "kernel32" Alias _FuncName_CreateSemaphore (pSemaphoreAttributes As *SECURITY_ATTRIBUTES, lInitialCount As Long, lMaximumCount As Long, pName As PCTSTR) As HANDLE
260
261TypeDef PTIMERAPCROUTINE = *Sub(lpArgToCompletionRoutine As VoidPtr, dwTimerLowValue As DWord, dwTimerHighValue As DWord)
262Declare Function CreateWaitableTimer Lib "kernel32" Alias _FuncName_CreateWaitableTimer (pTimerAttributes As *SECURITY_ATTRIBUTES, bManualReset As BOOL, pTimerName As PCTSTR) As HANDLE
263Declare Function OpenWaitableTimer Lib "kernel32" Alias _FuncName_OpenWaitableTimer (dwDesiredAccess As DWord, bInheritHandle As BOOL, pTimerName As PCTSTR) As HANDLE
264Declare 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
265Declare Function CancelWaitableTimer Lib "kernel32" (hTimer As HANDLE) As BOOL
266
267Const CREATE_NEW = 1
268Const CREATE_ALWAYS = 2
269Const OPEN_EXISTING = 3
270Const OPEN_ALWAYS = 4
271Const TRUNCATE_EXISTING = 5
272Const FILE_FLAG_WRITE_THROUGH = &H80000000
273Const FILE_FLAG_OVERLAPPED = &H40000000
274Const FILE_FLAG_NO_BUFFERING = &H20000000
275Const FILE_FLAG_RANDOM_ACCESS = &H10000000
276Const FILE_FLAG_SEQUENTIAL_SCAN = &H08000000
277Const FILE_FLAG_DELETE_ON_CLOSE = &H04000000
278Const FILE_FLAG_BACKUP_SEMANTICS = &H02000000
279Const FILE_FLAG_POSIX_SEMANTICS = &H01000000
280Const FILE_FLAG_OPEN_REPARSE_POINT = &H00200000
281Const FILE_FLAG_OPEN_NO_RECALL = &H00100000
282Declare 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
283
284Const FILE_MAP_COPY = SECTION_QUERY
285Const FILE_MAP_WRITE = SECTION_MAP_WRITE
286Const FILE_MAP_READ = SECTION_MAP_READ
287Const FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS
288Declare 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
289Declare Function OpenFileMapping Lib "kernel32" Alias _FuncName_OpenFileMapping (dwDesiredAccess As DWord, bInheritHandle As BOOL, pName As PCSTR) As HANDLE
290Declare Function MapViewOfFile Lib "kernel32" (hFileMappingObject As HANDLE, dwDesiredAccess As DWord, dwFileOffsetHigh As DWord, dwFileOffsetLow As DWord, dwNumberOfBytesToMap As DWord) As VoidPtr
291Declare Function MapViewOfFileEx Lib "kernel32" (hFileMappingObject As HANDLE, dwDesiredAccess As DWord, dwFileOffsetHigh As DWord, dwFileOffsetLow As DWord, dwNumberOfBytesToMap As DWord, lpBaseAddress As VoidPtr) As VoidPtr
292Declare Function FlushViewOfFile Lib "kernel32" (lpBaseAddress As VoidPtr, dwNumberOfBytesToFlush As DWord) As BOOL
293Declare Function UnmapViewOfFile Lib "kernel32" (lpBaseAddress As VoidPtr) As BOOL
294Declare Function CreateMailslot Lib "kernel32" Alias _FuncName_CreateMailslot (pName As PCTSTR, nMaxMessageSize As DWord, lReadTimeout As DWord, pSecurityAttributes As *SECURITY_ATTRIBUTES) As HANDLE
295
296Const DEBUG_PROCESS = &H00000001
297Const DEBUG_ONLY_THIS_PROCESS = &H00000002
298Const CREATE_SUSPENDED = &H00000004
299Const DETACHED_PROCESS = &H00000008
300Const CREATE_NEW_CONSOLE = &H00000010
301Const NORMAL_PRIORITY_CLASS = &H00000020
302Const IDLE_PRIORITY_CLASS = &H00000040
303Const HIGH_PRIORITY_CLASS = &H00000080
304Const REALTIME_PRIORITY_CLASS = &H00000100
305Const CREATE_NEW_PROCESS_GROUP = &H00000200
306Const CREATE_UNICODE_ENVIRONMENT = &H00000400
307Const CREATE_SEPARATE_WOW_VDM = &H00000800
308Const CREATE_SHARED_WOW_VDM = &H00001000
309Const CREATE_FORCEDOS = &H00002000
310Const CREATE_DEFAULT_ERROR_MODE = &H04000000
311Const CREATE_NO_WINDOW = &H08000000
312Const PROFILE_USER = &H10000000
313Const PROFILE_KERNEL = &H20000000
314Const PROFILE_SERVER = &H40000000
315
316Const STARTF_USESHOWWINDOW = &H00000001
317Const STARTF_USESIZE = &H00000002
318Const STARTF_USEPOSITION = &H00000004
319Const STARTF_USECOUNTCHARS = &H00000008
320Const STARTF_USEFILLATTRIBUTE = &H00000010
321Const STARTF_RUNFULLSCREEN = &H00000020
322Const STARTF_FORCEONFEEDBACK = &H00000040
323Const STARTF_FORCEOFFFEEDBACK = &H00000080
324Const STARTF_USESTDHANDLES = &H00000100
325Const STARTF_USEHOTKEY = &H00000200
326Type STARTUPINFOW
327 cb As DWord
328 lpReserved As LPWSTR
329 lpDesktop As LPWSTR
330 lpTitle As LPWSTR
331 dwX As DWord
332 dwY As DWord
333 dwXSize As DWord
334 dwYSize As DWord
335 dwXCountChars As DWord
336 dwYCountChars As DWord
337 dwFillAttribute As DWord
338 dwFlags As DWord
339 wShowWindow As Word
340 cbReserved2 As Word
341 lpReserved2 As *Byte
342 hStdInput As HANDLE
343 hStdOutput As HANDLE
344 hStdError As HANDLE
345End Type
346Type STARTUPINFOA
347 cb As DWord
348 lpReserved As LPSTR
349 lpDesktop As LPSTR
350 lpTitle As LPSTR
351 dwX As DWord
352 dwY As DWord
353 dwXSize As DWord
354 dwYSize As DWord
355 dwXCountChars As DWord
356 dwYCountChars As DWord
357 dwFillAttribute As DWord
358 dwFlags As DWord
359 wShowWindow As Word
360 cbReserved2 As Word
361 lpReserved2 As *Byte
362 hStdInput As HANDLE
363 hStdOutput As HANDLE
364 hStdError As HANDLE
365End Type
366#ifdef UNICODE
367TypeDef STARTUPINFO = STARTUPINFOW
368#else
369TypeDef STARTUPINFO = STARTUPINFOA
370#endif
371Type PROCESS_INFORMATION
372 hProcess As HANDLE
373 hThread As HANDLE
374 dwProcessId As DWord
375 dwThreadId As DWord
376End Type
377Declare 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
378
379TypeDef LPTHREAD_START_ROUTINE = *Function(lpThreadParameter As VoidPtr) As DWord
380Declare 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
381
382Declare Sub DebugBreak Lib "kernel32" ()
383Declare Sub DeleteCriticalSection Lib "kernel32" (ByRef CriticalSection As CRITICAL_SECTION)
384Declare Function DeleteFile Lib "kernel32" Alias _FuncName_DeleteFile (pFileName As PCTSTR) As BOOL
385Declare Function DeviceIoControl Lib "Kernel32" (
386 hDevice As HANDLE,
387 dwIoControlCode As DWord,
388 pInBuffer As VoidPtr,
389 nInBufferSize As DWord,
390 pOutBuffer As VoidPtr,
391 nOutBufferSize As DWord,
392 pBytesReturned As DWordPtr,
393 pOverlapped As *OVERLAPPED
394) As Long
395Declare Function DisableThreadLibraryCalls Lib "kernel32" (hLibModule As HINSTANCE) As BOOL
396Declare Function DosDateTimeToFileTime Lib "kernel32" (wFatDate As Word, wFatTime As Word, ByRef FileTime As FILETIME) As BOOL
397Declare 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
398Declare Sub EnterCriticalSection Lib "kernel32" (ByRef lpCriticalSection As CRITICAL_SECTION)
399Declare Sub ExitProcess Lib "kernel32" (dwExitCode As DWord)
400Declare Sub ExitThread Lib "kernel32" (dwExitCode As DWord)
401Declare Sub FatalAppExit Lib "kernel32" Alias _FuncName_FatalAppExit (Action As DWord, pMessageText As PCTSTR)
402Declare Function FileTimeToDosDateTime Lib "kernel32" (ByRef lpFileTime As FILETIME, ByRef lpFatDate As Word, ByRef lpFatTime As Word) As BOOL
403Declare Function FileTimeToLocalFileTime Lib "kernel32" (ByRef lpFileTime As FILETIME, ByRef lpLocalFileTime As FILETIME) As BOOL
404Declare Function FileTimeToSystemTime Lib "kernel32" (ByRef lpFileTime As FILETIME, ByRef lpSystemTime As SYSTEMTIME) As BOOL
405Declare Sub FillMemory Lib "kernel32" Alias "RtlFillMemory" (pDest As VoidPtr, stLength As SIZE_T, c As Byte)
406Declare Function FindClose Lib "kernel32" (hFindFile As HANDLE) As BOOL
407Declare Function FindCloseChangeNotification Lib "kernel32" (hChangeHandle As HANDLE) As BOOL
408Declare Function FindFirstChangeNotification Lib "kernel32" Alias _FuncName_FindFirstChangeNotification (
409 pPathName As PCTSTR,
410 bWatchSubtree As BOOL,
411 dwNotifyFilter As DWord
412) As HANDLE
413
414Type WIN32_FIND_DATAW
415 dwFileAttributes As DWord
416 ftCreationTime As FILETIME
417 ftLastAccessTime As FILETIME
418 ftLastWriteTime As FILETIME
419 nFileSizeHigh As DWord
420 nFileSizeLow As DWord
421 dwReserved0 As DWord
422 dwReserved1 As DWord
423 cFileName[ELM(MAX_PATH)] As WCHAR
424 cAlternateFileName[13] As WCHAR
425End Type
426Type WIN32_FIND_DATAA
427 dwFileAttributes As DWord
428 ftCreationTime As FILETIME
429 ftLastAccessTime As FILETIME
430 ftLastWriteTime As FILETIME
431 nFileSizeHigh As DWord
432 nFileSizeLow As DWord
433 dwReserved0 As DWord
434 dwReserved1 As DWord
435 cFileName[ELM(MAX_PATH)] As SByte
436 cAlternateFileName[13] As SByte
437End Type
438#ifdef UNICODE
439TypeDef WIN32_FIND_DATA = WIN32_FIND_DATAW
440#else
441TypeDef WIN32_FIND_DATA = WIN32_FIND_DATAA
442#endif
443TypeDef LPWIN32_FIND_DATA = *WIN32_FIND_DATA
444Declare Function FindFirstFile Lib "kernel32" Alias _FuncName_FindFirstFile (pFileName As PCTSTR, ByRef FindFildData As WIN32_FIND_DATA) As HANDLE
445Declare Function FindNextChangeNotification Lib "kernel32" (hChangeHandle As HANDLE) As BOOL
446Declare Function FindNextFile Lib "kernel32" Alias _FuncName_FindNextFile (hFindFile As HANDLE, ByRef FindFildData As WIN32_FIND_DATA) As BOOL
447Declare Function FlushFileBuffers Lib "kernel32" (hFile As HANDLE) As BOOL
448Declare Function FlushInstructionCache Lib "kernel32"(hProcess As HANDLE, pBaseAddress As VoidPtr, Size As SIZE_T) As BOOL
449
450Const FORMAT_MESSAGE_ALLOCATE_BUFFER = &H00000100
451Const FORMAT_MESSAGE_IGNORE_INSERTS = &H00000200
452Const FORMAT_MESSAGE_FROM_STRING = &H00000400
453Const FORMAT_MESSAGE_FROM_HMODULE = &H00000800
454Const FORMAT_MESSAGE_FROM_SYSTEM = &H00001000
455Const FORMAT_MESSAGE_ARGUMENT_ARRAY = &H00002000
456Declare 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
457Declare Function FreeEnvironmentStrings Lib "kernel32" Alias _FuncName_FreeEnvironmentStrings (pszEnvironmentBlock As PCTSTR) As BOOL
458Declare Function FreeLibrary Lib "kernel32" (hLibModule As HINSTANCE) As BOOL
459Declare Sub FreeLibraryAndExitThread Lib "kernel32" (hModule As HANDLE, dwExitCode As DWord)
460Declare Function GetCommandLineA Lib "kernel32" () As PCSTR
461Declare Function GetCommandLineW Lib "kernel32" () As PCWSTR
462#ifdef UNICODE
463Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineW" () As PCWSTR
464#else
465Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineA" () As PCSTR
466#endif
467Declare Function GetCompressedFileSize Lib "kernel32" Alias _FuncName_GetCompressedFileSize (pFileName As PCTSTR, ByRef FileSizeHigh As DWord) As DWord
468
469Const MAX_COMPUTERNAME_LENGTH = 15
470Declare Function GetComputerName Lib "kernel32" Alias _FuncName_GetComputerName (pBuffer As PTSTR, ByRef nSize As DWord) As BOOL
471
472Declare Function GetCurrentDirectory Lib "kernel32" Alias _FuncName_GetCurrentDirectory (nBufferLength As DWord, pBuffer As PTSTR) As DWord
473Declare Function GetCurrentProcess Lib "kernel32" () As HANDLE
474Declare Function GetCurrentProcessId Lib "kernel32" () As DWord
475Declare Function GetCurrentThread Lib "kernel32" () As HANDLE
476Declare Function GetCurrentThreadId Lib "kernel32" () As DWord
477
478Const DATE_SHORTDATE = &H00000001
479Const DATE_LONGDATE = &H00000002
480Const DATE_USE_ALT_CALENDAR = &H00000004
481Declare 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
482
483Declare Function GetDiskFreeSpace Lib "kernel32" Alias _FuncName_GetDiskFreeSpace (pRootPathName As PCTSTR, lpSectorsPerCluster As *DWord, pBytesPerSector As *DWord, pNumberOfFreeClusters As *DWord, pTotalNumberOfClusters As *DWord) As BOOL
484Declare 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
485
486Const DRIVE_UNKNOWN = 0
487Const DRIVE_NO_ROOT_DIR = 1
488Const DRIVE_REMOVABLE = 2
489Const DRIVE_FIXED = 3
490Const DRIVE_REMOTE = 4
491Const DRIVE_CDROM = 5
492Const DRIVE_RAMDISK = 6
493Declare 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
494Declare Function GetDriveType Lib "kernel32" Alias _FuncName_GetDriveType (lpRootPathName As PCTSTR) As DWord
495
496Declare Function GetEnvironmentVariable Lib "kernel32" Alias _FuncName_GetEnvironmentVariable (lpName As PCTSTR, lpBuffer As PTSTR, nSize As DWord) As DWord
497Declare Function GetEnvironmentStrings Lib "kernel32" Alias _FuncName_GetEnvironmentStrings () As VoidPtr
498Const STILL_ACTIVE = &H00000103
499Declare Function GetExitCodeProcess Lib "kernel32" (hProcess As HANDLE, ByRef lpExitCode As DWord) As BOOL
500Declare Function GetExitCodeThread Lib "kernel32" (hThread As HANDLE, ByRef lpExitCode As DWord) As BOOL
501
502Declare Function GetFileAttributes Lib "kernel32" Alias _FuncName_GetFileAttributes (lpFileName As PCTSTR) As DWord
503Type BY_HANDLE_FILE_INFORMATION
504 dwFileAttributes As DWord
505 ftCreationTime As FILETIME
506 ftLastAccessTime As FILETIME
507 ftLastWriteTime As FILETIME
508 dwVolumeSerialNumber As DWord
509 nFileSizeHigh As DWord
510 nFileSizeLow As DWord
511 nNumberOfLinks As DWord
512 nFileIndexHigh As DWord
513 nFileIndexLow As DWord
514End Type
515Declare Function GetFileInformationByHandle Lib "kernel32" (
516 ByVal hFile As HANDLE,
517 ByRef FileInformation As BY_HANDLE_FILE_INFORMATION
518) As BOOL
519Declare Function GetFileSize Lib "kernel32" (hFile As HANDLE, pFileSizeHigh As *DWord) As DWord
520Declare Function GetFileTime Lib "kernel32" (hFile As HANDLE, ByRef lpCreationTime As FILETIME, ByRef lpLastAccessTime As FILETIME, ByRef lpLastWriteTime As FILETIME) As BOOL
521
522Const FILE_TYPE_UNKNOWN = &H0000
523Const FILE_TYPE_DISK = &H0001
524Const FILE_TYPE_CHAR = &H0002
525Const FILE_TYPE_PIPE = &H0003
526Const FILE_TYPE_REMOTE = &H8000
527Declare Function GetFileType Lib "kernel32" (hFile As HANDLE) As DWord
528
529Declare Function GetFullPathName Lib "kernel32" Alias _FuncName_GetFullPathName (lpFileName As PCSTR, nBufferLength As DWord, pBuffer As PSTR, lpFilePart As *DWord) As DWord
530Declare Function GetLastError Lib "kernel32" () As DWord
531Declare Sub GetLocalTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME)
532Declare Function GetLogicalDrives Lib "kernel32" () As DWord
533Declare Function GetLogicalDriveStrings Lib "kernel32" Alias _FuncName_GetLogicalDriveStrings (nBufferLength As DWord, pBuffer As PTSTR) As DWord
534Declare Function GetLongPathName Lib "kernel32" Alias _FuncName_GetLongPathName (lpszShortPath As LPCTSTR, lpszLongPath As LPTSTR, cchBuffer As DWord) As DWord
535Declare Function GetModuleFileName Lib "kernel32" Alias _FuncName_GetModuleFileName (hModule As HINSTANCE, lpFileName As PTSTR, nSize As DWord) As DWord
536Declare Function GetModuleHandle Lib "kernel32" Alias _FuncName_GetModuleHandle (lpModuleName As PTSTR) As HINSTANCE
537Declare Function GetOverlappedResult Lib "kernel32" (
538 hFile As HANDLE,
539 pOverlapped As *OVERLAPPED,
540 pNumberOfBytesTransferred AS *DWord,
541 bWait As BOOL
542) As BOOL
543Type SYSTEM_POWER_STATUS
544 ACLineStatus As Byte
545 BatteryFlag As Byte
546 BatteryLifePercent As Byte
547 Reserved1 As Byte
548 BatteryLifeTime As Long
549 BatteryFullLifeTime As Long
550End Type
551Declare Function GetSystemPowerStatus Lib "kernel32" (ByRef SystemPowerStatus As SYSTEM_POWER_STATUS) As Long
552Declare Function GetPriorityClass Lib "kernel32" (hProcess As HANDLE) As DWord
553Declare Function GetProcAddress Lib "kernel32" (hModule As HINSTANCE, pProcName As PCSTR) As DWord
554Declare Function GetProcessAffinityMask Lib "kernel32" (
555 hProcess As HANDLE,
556 ByRef ProcessAffinityMask As ULONG_PTR,
557 ByRef SystemAffinityMask As ULONG_PTR
558) As BOOL
559Declare Function GetProcessHeap Lib "kernel32" () As HANDLE
560Declare Function GetShortPathName Lib "kernel32" Alias _FuncName_GetShortPathName (
561 pszLongPath As PCTSTR,
562 pszShortPath As PTSTR,
563 cchBuffer As DWord
564) As DWord
565
566Declare Sub GetStartupInfo Lib "kernel32" Alias _FuncName_GetStartupInfo (ByRef StartupInfo As STARTUPINFO)
567
568Const STD_INPUT_HANDLE = -10
569Const STD_OUTPUT_HANDLE = -11
570Const STD_ERROR_HANDLE = -12
571Declare Function GetStdHandle Lib "kernel32" (nStdHandle As DWord) As HANDLE
572
573Declare Function GetSystemDirectory Lib "kernel32" Alias _FuncName_GetSystemDirectory (pBuffer As PTSTR, uSize As DWord) As DWord
574
575Type SYSTEM_INFO
576 dwOemId As DWord
577 dwPageSize As DWord
578 lpMinimumApplicationAddress As VoidPtr
579 lpMaximumApplicationAddress As VoidPtr
580 dwActiveProcessorMask As ULONG_PTR
581 dwNumberOfProcessors As DWord
582 dwProcessorType As DWord
583 dwAllocationGranularity As DWord
584 wProcessorLevel As Word
585 wProcessorRevision As Word
586End Type
587Declare Sub GetSystemInfo Lib "kernel32" (ByRef SystemInfo As SYSTEM_INFO)
588
589Declare Sub GetSystemTime Lib "kernel32" (ByRef SystemTime As SYSTEMTIME)
590Declare Sub GetSystemTimeAsFileTime Lib "kernel32" (ByRef SystemTimeAsFileTime As FILETIME)
591
592Declare Function GetTempFileName Lib "kernel32" Alias _FuncName_GetTempFileName (
593 pPathName As PCTSTR,
594 pPrefixString As PCTSTR,
595 uUnique As DWord,
596 pTempFileName As PTSTR
597) As DWord
598Declare Function GetTempPath Lib "kernel32" Alias _FuncName_GetTempPath (nBufferLength As DWord, lpBuffer As PTSTR) As DWord
599Declare Function GetThreadContext Lib "kernel32" (hThread As HANDLE, ByRef Context As CONTEXT) As BOOL
600/*
601Const THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN
602Const THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST+1
603Const THREAD_PRIORITY_NORMAL = 0
604Const THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX
605Const THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST-1
606Const THREAD_PRIORITY_ERROR_RETURN = LONG_MAX
607Const THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT
608Const THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE
609*/
610Declare Function GetThreadPriority Lib "kernel32" (hThread As HANDLE) As Long
611Declare Function GetThreadPriorityBoost Lib "kernel32" (
612 hThread As HANDLE,
613 ByRef pDisablePriorityBoost As BOOL) As BOOL
614Declare Function GetTickCount Lib "kernel32" () As DWord
615
616Const TIME_NOMINUTESORSECONDS = &H00000001
617Const TIME_NOSECONDS = &H00000002
618Const TIME_NOTIMEMARKER = &H00000004
619Const TIME_FORCE24HOURFORMAT = &H00000008
620Declare 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
621Declare Function GetUserDefaultLCID Lib "kernel32" () As LCID
622Declare Function GetUserName Lib "advapi32" Alias _FuncName_GetUserName (pBuffer As PTSTR, ByRef nSize As DWord) As BOOL
623Declare Function GetVersionEx Lib "kernel32" Alias _FuncName_GetVersionEx (ByRef VersionInformation As OSVERSIONINFO) As BOOL
624Declare Function GetWindowsDirectory Lib "kernel32" Alias _FuncName_GetWindowsDirectory (pBuffer As PTSTR, uSize As DWord) As DWord
625Declare Function GlobalAlloc Lib "kernel32" (uFlags As DWord, dwBytes As SIZE_T) As HGLOBAL
626Declare Function GlobalFrags Lib "kernel32" (hMem As HGLOBAL) As DWord
627Declare Function GlobalFree Lib "kernel32" (hMem As HGLOBAL) As HGLOBAL
628Declare Function GlobalHandle Lib "kernel32" (pMem As VoidPtr) As HGLOBAL
629Declare Function GlobalLock Lib "kernel32" (hMem As HGLOBAL) As VoidPtr
630
631Type MEMORYSTATUS
632 dwLength As DWord
633 dwMemoryLoad As DWord
634 dwTotalPhys As SIZE_T
635 dwAvailPhys As SIZE_T
636 dwTotalPageFile As SIZE_T
637 dwAvailPageFile As SIZE_T
638 dwTotalVirtual As SIZE_T
639 dwAvailVirtual As SIZE_T
640End Type
641Declare Sub GlobalMemoryStatus Lib "kernel32" (ByRef lpMemStatus As MEMORYSTATUS)
642
643Declare Function GlobalReAlloc Lib "kernel32" (hMem As HGLOBAL, dwBytes As SIZE_T, uFlags As DWord) As HGLOBAL
644Declare Function GlobalSize Lib "kernel32" (hMem As HGLOBAL) As SIZE_T
645Declare Function GlobalUnlock Lib "kernel32" (hMem As HGLOBAL) As BOOL
646Declare Function HeapAlloc Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, dwBytes As SIZE_T) As VoidPtr
647Declare Function HeapCreate Lib "kernel32" (flOptions As DWord, dwInitialSize As SIZE_T, dwMaximumSize As SIZE_T) As HANDLE
648Declare Function HeapDestroy Lib "kernel32" (hHeap As HANDLE) As Long
649Declare Function HeapFree Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As Long
650Declare Function HeapReAlloc Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr, dwBytes As SIZE_T) As VoidPtr
651Declare Function HeapSize Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As SIZE_T
652Declare Sub InitializeCriticalSection Lib "kernel32" (ByRef CriticalSection As CRITICAL_SECTION)
653Declare Function IsBadReadPtr Lib "kernel32" (lp As VoidPtr, ucb As ULONG_PTR) As BOOL
654Declare Function IsBadWritePtr Lib "kernel32" (lp As VoidPtr, ucb As ULONG_PTR) As BOOL
655Declare Function IsDBCSLeadByte Lib "kernel32" (TestChar As Byte) As BOOL
656
657#ifdef _WIN64
658Declare Function IsWow64Process Lib "kernel32" (hProcess As HANDLE, ByRef bWow64Process As BOOL) As BOOL
659#endif
660
661Const LCMAP_LOWERCASE = &H00000100 ' lower case letters
662Const LCMAP_UPPERCASE = &H00000200 ' upper case letters
663Const LCMAP_SORTKEY = &H00000400 ' WC sort key (normalize)
664Const LCMAP_BYTEREV = &H00000800 ' byte reversal
665Const LCMAP_HIRAGANA = &H00100000 ' map katakana to hiragana
666Const LCMAP_KATAKANA = &H00200000 ' map hiragana to katakana
667Const LCMAP_HALFWIDTH = &H00400000 ' map double byte to single byte
668Const LCMAP_FULLWIDTH = &H00800000 ' map single byte to double byte
669Const LCMAP_LINGUISTIC_CASING = &H01000000 ' use linguistic rules for casing
670Const LCMAP_SIMPLIFIED_CHINESE = &H02000000 ' map traditional chinese to simplified chinese
671Const LCMAP_TRADITIONAL_CHINESE = &H04000000 ' map simplified chinese to traditional chinese
672Declare 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
673
674Declare Sub LeaveCriticalSection Lib "kernel32" (ByRef lpCriticalSection As CRITICAL_SECTION)
675Declare Function LocalAlloc Lib "kernel32" (uFlags As DWord, uBytes As SIZE_T) As HLOCAL
676Declare Function LocalFileTimeToFileTime Lib "kernel32" (ByRef lpLocalFileTime As FILETIME, ByRef lpFileTime As FILETIME) As BOOL
677Declare Function LocalFree Lib "kernel32" (hMem As HLOCAL) As HLOCAL
678Declare Function LocalHandle Lib "kernel32" (pMem As VoidPtr) As HLOCAL
679Declare Function LocalLock Lib "kernel32" (hMem As HLOCAL) As VoidPtr
680Declare Function LocalReAlloc Lib "kernel32" (hMem As HLOCAL, dwBytes As SIZE_T, uFlags As DWord) As HLOCAL
681Declare Function LocalSize Lib "kernel32" (hMem As HLOCAL) As SIZE_T
682Declare Function LocalUnlock Lib "kernel32" (hMem As HLOCAL) As BOOL
683Declare Function LockFile Lib "kernel32" (hFile As HANDLE, dwFileOffsetLow As DWord, dwFileOffsetHigh As DWord, nNumberOfBytesToLockLow As DWord, nNumberOfBytesToLockHigh As DWord) As BOOL
684Declare Function LoadLibrary Lib "kernel32" Alias _FuncName_LoadLibrary (pLibFileName As PCTSTR) As HINSTANCE
685
686Const DONT_RESOLVE_DLL_REFERENCES = &h00000001
687Const LOAD_LIBRARY_AS_DATAFILE = &h00000002
688Const LOAD_WITH_ALTERED_SEARCH_PATH = &h00000008
689Const LOAD_IGNORE_CODE_AUTHZ_LEVEL = &h00000010
690Declare Function LoadLibraryEx Lib "kernel32" Alias _FuncName_LoadLibraryEx (pLibFileName As PCTSTR, hFile As HANDLE, dwFlags As DWord) As HINSTANCE
691
692Declare Function lstrcat Lib "kernel32" Alias _FuncName_lstrcat (lpString1 As LPTSTR, lpString2 As LPCTSTR) As LPTSTR
693Declare Function lstrcmp Lib "kernel32" Alias _FuncName_lstrcmp (lpString1 As LPCTSTR, lpString2 As LPCTSTR) As Long
694Declare Function lstrcmpi Lib "kernel32" Alias _FuncName_lstrcmpi (lpString1 As LPCTSTR, lpString2 As LPCTSTR) As Long
695Declare Function lstrcpy Lib "kernel32" Alias _FuncName_lstrcpy (lpString1 As LPTSTR, lpString2 As LPCTSTR) As LPTSTR
696Declare Function lstrcpyn Lib "kernel32" Alias _FuncName_lstrcpyn (lpString1 As LPTSTR,ByVal lpString2 As LPCTSTR,ByVal iMaxLength As Long) As LPTSTR
697Declare Function lstrlenA Lib "kernel32" (lpString As LPCSTR) As Long
698Declare Function lstrlenW Lib "kernel32" (lpString As LPCWSTR) As Long
699#ifdef UNICODE
700Declare Function lstrlen Lib "kernel32" Alias "lstrlenW" (lpString As LPCWSTR) As Long
701#else
702Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (lpString As LPCSTR) As Long
703#endif
704Declare Sub memcpy Lib "kernel32" Alias "RtlMoveMemory" (pDest As VoidPtr, pSrc As VoidPtr, length As SIZE_T)
705Declare Function MoveFile Lib "kernel32" Alias _FuncName_MoveFile (lpExistingFileName As LPCTSTR, lpNewFileName As LPCTSTR) As BOOL
706Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As PVOID, pSrc As VoidPtr, length As SIZE_T)
707
708Declare Function MulDiv Lib "kernel32" (
709 nNumber As Long,
710 nNumerator As Long,
711 nDenominator As Long
712) As Long
713
714Const CP_ACP = 0 'default to ANSI code page
715Const CP_OEMCP = 1 'default to OEM code page
716Const CP_MACCP = 2 'default to MAC code page
717Const CP_THREAD_ACP = 3 'current thread's ANSI code page
718Const CP_SYMBOL = 42 'SYMBOL translations
719Const CP_UTF7 = 65000 'UTF-7 translation
720Const CP_UTF8 = 65001 'UTF-8 translation
721
722Declare Function MultiByteToWideChar Lib "kernel32" (CodePage As DWord, dwFlags As DWord, pMultiByteStr As PCSTR, cchMultiByte As Long, pWideCharStr As PWSTR, cchWideChar As Long) As Long
723Declare Function OpenEvent Lib "kernel32" Alias _FuncName_OpenEvent (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE
724Declare Function OpenMutex Lib "kernel32" Alias _FuncName_OpenMutex (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE
725Declare Function OpenSemaphore Lib "kernel32" Alias _FuncName_OpenSemaphore (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE
726Declare Function OpenProcess Lib "kernel32" (dwDesiredAccess As DWord, bInheritHandle As Long, dwProcessId As DWord) As HANDLE
727Declare Sub OutputDebugStringA Lib "kernel32" (pOutputString As PCSTR)
728Declare Sub OutputDebugStringW Lib "kernel32" (pOutputString As PCWSTR)
729#ifdef UNICODE
730Declare Sub OutputDebugString Lib "kernel32" Alias "OutputDebugStringW" (pOutputString As PCWSTR)
731#else
732Declare Sub OutputDebugString Lib "kernel32" Alias "OutputDebugStringA" (pOutputString As PCSTR)
733#endif
734Declare Function PulseEvent Lib "kernel32" (hEvent As HANDLE) As BOOL
735Declare Sub RaiseException Lib "kernel32" (
736 dwExceptionCode As DWord,
737 dwExceptionFlags As DWord,
738 NumberOfArguments As DWord,
739 pArguments As *ULONG_PTR)
740Declare Function ReadFile Lib "kernel32" (hFile As HANDLE, lpBuffer As VoidPtr, nNumberOfBytesToRead As DWord, lpNumberOfBytesRead As DWordPtr, ByRef lpOverlapped As OVERLAPPED) As BOOL
741Declare Function ReadProcessMemory Lib "Kernel32" (hProcess As HANDLE, lpBaseAddress As VoidPtr, lpBuffer As VoidPtr, nSize As SIZE_T, lpNumberOfBytesRead As *SIZE_T) As BOOL
742Declare Function ReleaseMutex Lib "kernel32" (hMutex As HANDLE) As BOOL
743Declare Function ReleaseSemaphore Lib "kernel32" (hSemaphore As HANDLE, lReleaseCount As Long, ByRef lpPreviousCount As Long) As BOOL
744Declare Function RemoveDirectory Lib "kernel32" Alias _FuncName_RemoveDirectory (lpPathName As LPCTSTR) As BOOL
745Declare Function ResetEvent Lib "kernel32" (hEvent As HANDLE) As BOOL
746Declare Function ResumeThread Lib "kernel32" (hThread As HANDLE) As DWord
747Declare Function SetComputerName Lib "kernel32" Alias _FuncName_SetComputerName (lpComputerName As LPCTSTR) As BOOL
748Declare Function SetCurrentDirectory Lib "kernel32" Alias _FuncName_SetCurrentDirectory (lpPathName As LPCTSTR) As BOOL
749Declare 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
750Declare Function SetEndOfFile Lib "kernel32" (hFile As HANDLE) As BOOL
751Declare Function SetEnvironmentVariable Lib "kernel32" Alias _FuncName_SetEnvironmentVariable (lpName As LPCTSTR, lpValue As LPTSTR) As BOOL
752
753Const SEM_FAILCRITICALERRORS = &h0001
754Const SEM_NOGPFAULTERRORBOX = &h0002
755Const SEM_NOALIGNMENTFAULTEXCEPT = &h0004
756Const SEM_NOOPENFILEERRORBOX = &h8000
757Declare Function SetErrorMode Lib "kernel32" (uMode As DWord) As DWord
758Declare Function SetEvent Lib "kernel32" (hEvent As HANDLE) As BOOL
759Declare Function SetFileAttributes Lib "kernel32" Alias _FuncName_SetFileAttributes (lpFileName As LPCTSTR, dwFileAttributes As DWord) As BOOL
760
761Const FILE_BEGIN = 0
762Const FILE_CURRENT = 1
763Const FILE_END = 2
764Declare Function SetFilePointer Lib "kernel32" (hFile As HANDLE, lDistanceToMove As Long, lpDistanceToMoveHigh As DWordPtr, dwMoveMethod As DWord) As DWord
765
766Declare Function SetFileTime Lib "kernel32" (hFile As HANDLE, ByRef lpCreationTime As FILETIME, ByRef lpLastAccessTime As FILETIME, ByRef lpLastWriteTime As FILETIME) As BOOL
767Declare Sub SetLastError Lib "kernel32" (dwErrCode As DWord)
768Declare Sub SetLastErrorEx Lib "kernel32" (dwErrCode As DWord, dwType As DWord)
769Declare Function SetLocalTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME) As BOOL
770Declare Function SetPriorityClass Lib "kernel32" (hProcess As HANDLE, dwPriorityClass As DWord) As BOOL
771Declare Function SetThreadContext Lib "kernel32" (hThread As HANDLE, ByRef Context As CONTEXT) As BOOL
772Declare Function SetThreadPriority Lib "kernel32" (hThread As HANDLE, nPriority As Long) As BOOL
773Declare Function SetThreadPriorityBoost Lib "kernel32" (
774 hThread As HANDLE,
775 DisablePriorityBoost As BOOL
776) As BOOL
777
778TypeDef PTOP_LEVEL_EXCEPTION_FILTER = *Function(ByRef ExceptionInfo As EXCEPTION_POINTERS) As Long
779
780Declare Function SetUnhandledExceptionFilter Lib "kernel32" (pTopLevelExceptionFilter As PTOP_LEVEL_EXCEPTION_FILTER) As PTOP_LEVEL_EXCEPTION_FILTER
781
782Const INFINITE = &HFFFFFFFF
783Declare Sub Sleep Lib "kernel32" (dwMilliseconds As DWord)
784Declare Function SleepEx Lib "kernel32" (dwMilliseconds As DWord, bAlertable As BOOL) As DWord
785
786Declare Function SuspendThread Lib "kernel32" (hThread As HANDLE) As DWord
787Declare Function SystemTimeToFileTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME, ByRef lpFileTime As FILETIME) As BOOL
788Declare Function TerminateProcess Lib "kernel32" (hProcess As HANDLE, dwExitCode As DWord) As BOOL
789Declare Function TerminateThread Lib "kernel32" (hThread As HANDLE, dwExitCode As DWord) As BOOL
790Declare Function TlsAlloc Lib "kernel32" () As DWord
791Declare Function TlsFree Lib "kernel32" (dwTlsIndex As DWord) As BOOL
792Declare Function TlsGetValue Lib "kernel32" (dwTlsIndex As DWord) As VoidPtr
793Declare Function TlsSetValue Lib "kernel32" (dwTlsIndex As DWord, pTlsValue As VoidPtr) As BOOL
794Declare Function UnlockFile Lib "kernel32" (hFile As HANDLE, dwFileOffsetLow As DWord, dwFileOffsetHigh As DWord, nNumberOfBytesToUnlockLow As DWord, nNumberOfBytesToUnlockHigh As DWord) As BOOL
795Declare Function UnhandledExceptionFilter Lib "kernel32" (ByRef ExceptionInfo As EXCEPTION_POINTERS) As Long
796Declare Function VirtualAlloc Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T, flAllocationType As DWord, flProtect As DWord) As VoidPtr
797Declare Function VirtualFree Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T, dwFreeType As DWord) As BOOL
798Declare Function VirtualLock Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T) As BOOL
799Declare Function VirtualProtect Lib "kernel32" (
800 pAddress As VoidPtr,
801 Size As SIZE_T,
802 flNewProtect As DWord,
803 ByRef flOldProtect As DWord
804) As BOOL
805Declare Function VirtualProtectEx Lib "kernel32" (
806 hProcess As HANDLE,
807 pAddress As VoidPtr,
808 Size As SIZE_T,
809 flNewProtect As DWord,
810 ByRef flOldProtect As DWord
811) As BOOL
812Declare Function VirtualQuery Lib "kernel32" (
813 pAddress As VoidPtr,
814 ByRef mbi As MEMORY_BASIC_INFORMATION,
815 Length As SIZE_T
816) As SIZE_T
817Declare Function VirtualQueryEx Lib "kernel32" (
818 hProcess As HANDLE,
819 pAddress As VoidPtr,
820 ByRef mbi As MEMORY_BASIC_INFORMATION,
821 Length As SIZE_T
822) As SIZE_T
823Declare Function VirtualUnlock Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T) As BOOL
824Declare Function WaitForMultipleObjects Lib "kernel32" (nCount As DWord, pHandles As *HANDLE, fWaitAll As BOOL, dwMilliseconds As DWord) As DWord
825Declare Function WaitForMultipleObjectsEx Lib "kernel32" (nCount As DWord, pHandles As *HANDLE, fWaitAll As BOOL, dwMilliseconds As DWord, bAlertable As BOOL) As DWord
826Declare Function WaitForSingleObject Lib "kernel32" (hHandle As HANDLE, dwMilliseconds As DWord) As DWord
827Declare Function WaitForSingleObjectEx Lib "kernel32" (hHandle As HANDLE, dwMilliseconds As DWord, bAlertable As BOOL) As DWord
828
829Const WC_COMPOSITECHECK = &H00000200
830Const WC_DISCARDNS = &H00000010
831Const WC_SEPCHARS = &H00000020
832Const WC_DEFAULTCHAR = &H00000040
833Const WC_NO_BEST_FIT_CHARS = &H00000400
834Declare Function WideCharToMultiByte Lib "Kernel32" (
835 CodePage As DWord,
836 dwFlags As DWord,
837 pWideCharStr As PCWSTR,
838 cchWideChar As Long,
839 pMultiByteStr As PSTR,
840 cbMultiByte As Long,
841 pDefaultChar As PCSTR,
842 pUsedDefaultChar As *BOOL
843) As Long
844
845Declare Function WriteFile Lib "kernel32" (hFile As HANDLE, lpBuffer As VoidPtr, nNumberOfBytesToWrite As DWord, lpNumberOfBytesWritten As DWordPtr, ByRef lpOverlapped As OVERLAPPED) As BOOL
846Declare Sub ZeroMemory Lib "kernel32" Alias "RtlZeroMemory" (Destination As VoidPtr, dwLength As DWord)
847
848'
849' Wait functions' results.
850'
851Const WAIT_FAILED = (&hFFFFFFFF As DWord)
852Const WAIT_OBJECT_0 = ((STATUS_WAIT_0 ) + 0)
853
854Const WAIT_ABANDONED = ((STATUS_ABANDONED_WAIT_0 ) + 0)
855Const WAIT_ABANDONED_0 = ((STATUS_ABANDONED_WAIT_0 ) + 0)
856
857Const WAIT_IO_COMPLETION = STATUS_USER_APC
858
859Declare Function FindResource Lib "kernel32" Alias _FuncName_FindResource (hInstance As HINSTANCE, lpName As LPCTSTR, lpType As LPCTSTR) As HRSRC
860Declare Function LoadResource Lib "kernel32" (hModule As HMODULE, hResInfo As HRSRC) As HGLOBAL
861Declare Function FreeResource Lib "kernel32" (hResData As HGLOBAL) As BOOL
862Declare Function LockResource Lib "kernel32" (hResData As HGLOBAL) As VoidPtr
863Declare Function SizeofResource Lib "kernel32" (hModule As HANDLE, hResInfo As HRSRC) As DWord
864
865Declare Function ExpandEnvironmentStrings Lib "kernel32" Alias _FuncName_ExpandEnvironmentStrings (lpSrc As LPCTSTR, lpDst As LPTSTR, nSize As DWord) As DWord
866
867Type DCB
868 DCBlength As DWord
869 BaudRate As DWord
870 fBitFields As DWord
871 wReserved As Word
872 XonLim As Word
873 XoffLim As Word
874 ByteSize As Byte
875 Parity As Byte
876 StopBits As Byte
877 XonChar As CHAR
878 XoffChar As CHAR
879 ErrorChar As CHAR
880 EofChar As CHAR
881 EvtChar As CHAR
882 wReserved1 As Word
883End Type
884
885Type COMMTIMEOUTS
886 ReadIntervalTimeout As DWord
887 ReadTotalTimeoutMultiplier As DWord
888 ReadTotalTimeoutConstant As DWord
889 WriteTotalTimeoutMultiplier As DWord
890 WriteTotalTimeoutConstant As DWord
891End Type
892Type COMSTAT
893 fCoBitFlds As Long 'See Comment in Win32API.Txt
894 cbInQue As DWord
895 cbOutQue As DWord
896End Type
897Declare Function SetCommState Lib "kernel32" (hCommDev As HANDLE, ByRef dcb As DCB) As BOOL
898Declare Function SetCommTimeouts Lib "kernel32" (hFile As HANDLE ,ByRef pCommTimeouts As COMMTIMEOUTS) As BOOL
899Declare Function ClearCommError Lib "kernel32" (hCommDevs As HANDLE, ByRef Errors As DWord, ByRef Stat As COMSTAT) As BOOL
900Declare Function EscapeCommFunction Lib "kernel32" (nCid As HANDLE, ByVal nFunc As DWord) As BOOL
901Declare Function GetCommModemStatus Lib "kernel32" (hFile As HANDLE, ByRef ModemStat As DWord) As BOOL
902Declare Function SetCommMask Lib "kernel32" (hFile As HANDLE, dwEvtMask As DWord) As BOOL
903Declare Function WaitCommEvent Lib "kernel32" (hFile As HANDLE, ByRef EvtMask As DWord, lpOverlapped As *OVERLAPPED) As BOOL
904
905Declare Function OpenProcessToken Lib "advapi32" (ProcessHandle As HANDLE, DesiredAccess As DWord, ByRef TokenHandle As HANDLE) As BOOL
906Declare Function LookupPrivilegeValue Lib "advapi32" Alias _FuncName_LookupPrivilegeValue (lpSystemName As LPCTSTR, lpName As LPCTSTR, ByRef Luid As LUID) As Long
907Declare Function AdjustTokenPrivileges Lib "advapi32" (TokenHandle As Long, DisableAllPrivileges As Long,_
908 ByRef NewState As TOKEN_PRIVILEGES, BufferLength As Long,
909 ByRef PreviousState As TOKEN_PRIVILEGES, ByRef ReturnLength As Long) As Long
910
911#endif '_INC_SYSTEM
Note: See TracBrowser for help on using the repository browser.