source: trunk/Include/api_system.sbp@ 492

Last change on this file since 492 was 466, checked in by OverTaker, 17 years ago

File.ab,FileInfo.abをそれなりに実装

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