source: trunk/Include/api_system.sbp@ 435

Last change on this file since 435 was 415, checked in by NoWest, 16 years ago

InterlockedExchangeの戻り値は変更前の値ということなので修正して置きましたが、
64bit版はどのみ新しく用意しないといけないようなので必要な修正であったかは分かりません

File size: 50.7 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 GetFileTime Lib "kernel32" (hFile As HANDLE, ByRef lpCreationTime As FILETIME, ByRef lpLastAccessTime As FILETIME, ByRef lpLastWriteTime As FILETIME) As BOOL
565
566Const FILE_TYPE_UNKNOWN = &H0000
567Const FILE_TYPE_DISK = &H0001
568Const FILE_TYPE_CHAR = &H0002
569Const FILE_TYPE_PIPE = &H0003
570Const FILE_TYPE_REMOTE = &H8000
571Declare Function GetFileType Lib "kernel32" (hFile As HANDLE) As DWord
572
573Declare Function GetFullPathName Lib "kernel32" Alias _FuncName_GetFullPathName (lpFileName As PCSTR, nBufferLength As DWord, pBuffer As PSTR, lpFilePart As *DWord) As DWord
574Declare Function GetLastError Lib "kernel32" () As DWord
575Declare Sub GetLocalTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME)
576Declare Function GetLogicalDrives Lib "kernel32" () As DWord
577Declare Function GetLogicalDriveStrings Lib "kernel32" Alias _FuncName_GetLogicalDriveStrings (nBufferLength As DWord, pBuffer As PTSTR) As DWord
578Declare Function GetLongPathName Lib "kernel32" Alias _FuncName_GetLongPathName (lpszShortPath As LPCTSTR, lpszLongPath As LPTSTR, cchBuffer As DWord) As DWord
579Declare Function GetModuleFileName Lib "kernel32" Alias _FuncName_GetModuleFileName (hModule As HINSTANCE, lpFileName As PTSTR, nSize As DWord) As DWord
580Declare Function GetModuleHandle Lib "kernel32" Alias _FuncName_GetModuleHandle (lpModuleName As PTSTR) As HINSTANCE
581Declare Function GetOverlappedResult Lib "kernel32" (
582 hFile As HANDLE,
583 ByRef Overlapped As OVERLAPPED,
584 ByRef pNumberOfBytesTransferred As DWord,
585 bWait As BOOL
586) As BOOL
587Type SYSTEM_POWER_STATUS
588 ACLineStatus As Byte
589 BatteryFlag As Byte
590 BatteryLifePercent As Byte
591 Reserved1 As Byte
592 BatteryLifeTime As Long
593 BatteryFullLifeTime As Long
594End Type
595Declare Function GetSystemPowerStatus Lib "kernel32" (ByRef SystemPowerStatus As SYSTEM_POWER_STATUS) As Long
596Declare Function GetPriorityClass Lib "kernel32" (hProcess As HANDLE) As DWord
597Declare Function GetProcAddress Lib "kernel32" (hModule As HINSTANCE, pProcName As PCSTR) As DWord
598Declare Function GetProcessAffinityMask Lib "kernel32" (
599 hProcess As HANDLE,
600 ByRef ProcessAffinityMask As ULONG_PTR,
601 ByRef SystemAffinityMask As ULONG_PTR
602) As BOOL
603Declare Function GetProcessHeap Lib "kernel32" () As HANDLE
604Declare Function GetShortPathName Lib "kernel32" Alias _FuncName_GetShortPathName (
605 pszLongPath As PCTSTR,
606 pszShortPath As PTSTR,
607 cchBuffer As DWord
608) As DWord
609
610Declare Sub GetStartupInfo Lib "kernel32" Alias _FuncName_GetStartupInfo (ByRef StartupInfo As STARTUPINFO)
611
612Const STD_INPUT_HANDLE = -10
613Const STD_OUTPUT_HANDLE = -11
614Const STD_ERROR_HANDLE = -12
615Declare Function GetStdHandle Lib "kernel32" (nStdHandle As DWord) As HANDLE
616
617Declare Function GetSystemDirectory Lib "kernel32" Alias _FuncName_GetSystemDirectory (pBuffer As PTSTR, uSize As DWord) As DWord
618
619Type SYSTEM_INFO
620 dwOemId As DWord
621 dwPageSize As DWord
622 lpMinimumApplicationAddress As VoidPtr
623 lpMaximumApplicationAddress As VoidPtr
624 dwActiveProcessorMask As ULONG_PTR
625 dwNumberOfProcessors As DWord
626 dwProcessorType As DWord
627 dwAllocationGranularity As DWord
628 wProcessorLevel As Word
629 wProcessorRevision As Word
630End Type
631Declare Sub GetSystemInfo Lib "kernel32" (ByRef SystemInfo As SYSTEM_INFO)
632
633Declare Sub GetSystemTime Lib "kernel32" (ByRef SystemTime As SYSTEMTIME)
634Declare Sub GetSystemTimeAsFileTime Lib "kernel32" (ByRef SystemTimeAsFileTime As FILETIME)
635
636Declare Function GetTempFileName Lib "kernel32" Alias _FuncName_GetTempFileName (
637 pPathName As PCTSTR,
638 pPrefixString As PCTSTR,
639 uUnique As DWord,
640 pTempFileName As PTSTR
641) As DWord
642Declare Function GetTempPath Lib "kernel32" Alias _FuncName_GetTempPath (nBufferLength As DWord, lpBuffer As PTSTR) As DWord
643Declare Function GetThreadContext Lib "kernel32" (hThread As HANDLE, ByRef Context As CONTEXT) As BOOL
644/*
645Const THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN
646Const THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST+1
647Const THREAD_PRIORITY_NORMAL = 0
648Const THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX
649Const THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST-1
650Const THREAD_PRIORITY_ERROR_RETURN = LONG_MAX
651Const THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT
652Const THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE
653*/
654Declare Function GetThreadPriority Lib "kernel32" (hThread As HANDLE) As Long
655Declare Function GetThreadPriorityBoost Lib "kernel32" (
656 hThread As HANDLE,
657 ByRef pDisablePriorityBoost As BOOL) As BOOL
658Declare Function GetTickCount Lib "kernel32" () As DWord
659
660Const TIME_NOMINUTESORSECONDS = &H00000001
661Const TIME_NOSECONDS = &H00000002
662Const TIME_NOTIMEMARKER = &H00000004
663Const TIME_FORCE24HOURFORMAT = &H00000008
664Declare 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
665Declare Function GetUserDefaultLCID Lib "kernel32" () As LCID
666Declare Function GetUserName Lib "advapi32" Alias _FuncName_GetUserName (pBuffer As PTSTR, ByRef nSize As DWord) As BOOL
667Declare Function GetVersionEx Lib "kernel32" Alias _FuncName_GetVersionEx (ByRef VersionInformation As OSVERSIONINFO) As BOOL
668Declare Function GetWindowsDirectory Lib "kernel32" Alias _FuncName_GetWindowsDirectory (pBuffer As PTSTR, uSize As DWord) As DWord
669Declare Function GlobalAlloc Lib "kernel32" (uFlags As DWord, dwBytes As SIZE_T) As HGLOBAL
670Declare Function GlobalFrags Lib "kernel32" (hMem As HGLOBAL) As DWord
671Declare Function GlobalFree Lib "kernel32" (hMem As HGLOBAL) As HGLOBAL
672Declare Function GlobalHandle Lib "kernel32" (pMem As VoidPtr) As HGLOBAL
673Declare Function GlobalLock Lib "kernel32" (hMem As HGLOBAL) As VoidPtr
674
675Type MEMORYSTATUS
676 dwLength As DWord
677 dwMemoryLoad As DWord
678 dwTotalPhys As SIZE_T
679 dwAvailPhys As SIZE_T
680 dwTotalPageFile As SIZE_T
681 dwAvailPageFile As SIZE_T
682 dwTotalVirtual As SIZE_T
683 dwAvailVirtual As SIZE_T
684End Type
685Declare Sub GlobalMemoryStatus Lib "kernel32" (ByRef lpMemStatus As MEMORYSTATUS)
686
687Declare Function GlobalReAlloc Lib "kernel32" (hMem As HGLOBAL, dwBytes As SIZE_T, uFlags As DWord) As HGLOBAL
688Declare Function GlobalSize Lib "kernel32" (hMem As HGLOBAL) As SIZE_T
689Declare Function GlobalUnlock Lib "kernel32" (hMem As HGLOBAL) As BOOL
690Declare Function HeapAlloc Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, dwBytes As SIZE_T) As VoidPtr
691Declare Function HeapCreate Lib "kernel32" (flOptions As DWord, dwInitialSize As SIZE_T, dwMaximumSize As SIZE_T) As HANDLE
692Declare Function HeapDestroy Lib "kernel32" (hHeap As HANDLE) As Long
693Declare Function HeapFree Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As Long
694Declare Function HeapReAlloc Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr, dwBytes As SIZE_T) As VoidPtr
695Declare Function HeapSize Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As SIZE_T
696Declare Function HeapValidate Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As BOOL
697Declare Sub InitializeCriticalSection Lib "kernel32" (ByRef CriticalSection As CRITICAL_SECTION)
698Declare Function IsBadReadPtr Lib "kernel32" (lp As VoidPtr, ucb As ULONG_PTR) As BOOL
699Declare Function IsBadWritePtr Lib "kernel32" (lp As VoidPtr, ucb As ULONG_PTR) As BOOL
700Declare Function IsDBCSLeadByte Lib "kernel32" (TestChar As Byte) As BOOL
701
702#ifdef _WIN64
703Declare Function IsWow64Process Lib "kernel32" (hProcess As HANDLE, ByRef bWow64Process As BOOL) As BOOL
704#endif
705
706Const LCMAP_LOWERCASE = &H00000100 ' lower case letters
707Const LCMAP_UPPERCASE = &H00000200 ' upper case letters
708Const LCMAP_SORTKEY = &H00000400 ' WC sort key (normalize)
709Const LCMAP_BYTEREV = &H00000800 ' byte reversal
710Const LCMAP_HIRAGANA = &H00100000 ' map katakana to hiragana
711Const LCMAP_KATAKANA = &H00200000 ' map hiragana to katakana
712Const LCMAP_HALFWIDTH = &H00400000 ' map double byte to single byte
713Const LCMAP_FULLWIDTH = &H00800000 ' map single byte to double byte
714Const LCMAP_LINGUISTIC_CASING = &H01000000 ' use linguistic rules for casing
715Const LCMAP_SIMPLIFIED_CHINESE = &H02000000 ' map traditional chinese to simplified chinese
716Const LCMAP_TRADITIONAL_CHINESE = &H04000000 ' map simplified chinese to traditional chinese
717Declare 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
718
719Declare Sub LeaveCriticalSection Lib "kernel32" (ByRef lpCriticalSection As CRITICAL_SECTION)
720Declare Function LocalAlloc Lib "kernel32" (uFlags As DWord, uBytes As SIZE_T) As HLOCAL
721Declare Function LocalFileTimeToFileTime Lib "kernel32" (ByRef lpLocalFileTime As FILETIME, ByRef lpFileTime As FILETIME) As BOOL
722Declare Function LocalFree Lib "kernel32" (hMem As HLOCAL) As HLOCAL
723Declare Function LocalHandle Lib "kernel32" (pMem As VoidPtr) As HLOCAL
724Declare Function LocalLock Lib "kernel32" (hMem As HLOCAL) As VoidPtr
725Declare Function LocalReAlloc Lib "kernel32" (hMem As HLOCAL, dwBytes As SIZE_T, uFlags As DWord) As HLOCAL
726Declare Function LocalSize Lib "kernel32" (hMem As HLOCAL) As SIZE_T
727Declare Function LocalUnlock Lib "kernel32" (hMem As HLOCAL) As BOOL
728Declare Function LockFile Lib "kernel32" (hFile As HANDLE, dwFileOffsetLow As DWord, dwFileOffsetHigh As DWord, nNumberOfBytesToLockLow As DWord, nNumberOfBytesToLockHigh As DWord) As BOOL
729Declare Function LoadLibrary Lib "kernel32" Alias _FuncName_LoadLibrary (pLibFileName As PCTSTR) As HINSTANCE
730
731Const DONT_RESOLVE_DLL_REFERENCES = &h00000001
732Const LOAD_LIBRARY_AS_DATAFILE = &h00000002
733Const LOAD_WITH_ALTERED_SEARCH_PATH = &h00000008
734Const LOAD_IGNORE_CODE_AUTHZ_LEVEL = &h00000010
735Declare Function LoadLibraryEx Lib "kernel32" Alias _FuncName_LoadLibraryEx (pLibFileName As PCTSTR, hFile As HANDLE, dwFlags As DWord) As HINSTANCE
736
737Declare Function lstrcat Lib "kernel32" Alias _FuncName_lstrcat (lpString1 As LPTSTR, lpString2 As LPCTSTR) As LPTSTR
738Declare Function lstrcmp Lib "kernel32" Alias _FuncName_lstrcmp (lpString1 As LPCTSTR, lpString2 As LPCTSTR) As Long
739Declare Function lstrcmpi Lib "kernel32" Alias _FuncName_lstrcmpi (lpString1 As LPCTSTR, lpString2 As LPCTSTR) As Long
740Declare Function lstrcpy Lib "kernel32" Alias _FuncName_lstrcpy (lpString1 As LPTSTR, lpString2 As LPCTSTR) As LPTSTR
741Declare Function lstrcpyn Lib "kernel32" Alias _FuncName_lstrcpyn (lpString1 As LPTSTR,ByVal lpString2 As LPCTSTR,ByVal iMaxLength As Long) As LPTSTR
742Declare Function lstrlenA Lib "kernel32" (lpString As LPCSTR) As Long
743Declare Function lstrlenW Lib "kernel32" (lpString As LPCWSTR) As Long
744#ifdef UNICODE
745Declare Function lstrlen Lib "kernel32" Alias "lstrlenW" (lpString As LPCWSTR) As Long
746#else
747Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (lpString As LPCSTR) As Long
748#endif
749Declare Sub memcpy Lib "kernel32" Alias "RtlMoveMemory" (pDest As VoidPtr, pSrc As VoidPtr, length As SIZE_T)
750Declare Function MoveFile Lib "kernel32" Alias _FuncName_MoveFile (lpExistingFileName As LPCTSTR, lpNewFileName As LPCTSTR) As BOOL
751Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As PVOID, pSrc As VoidPtr, length As SIZE_T)
752
753Declare Function MulDiv Lib "kernel32" (
754 nNumber As Long,
755 nNumerator As Long,
756 nDenominator As Long
757) As Long
758
759Const CP_ACP = 0 'default to ANSI code page
760Const CP_OEMCP = 1 'default to OEM code page
761Const CP_MACCP = 2 'default to MAC code page
762Const CP_THREAD_ACP = 3 'current thread's ANSI code page
763Const CP_SYMBOL = 42 'SYMBOL translations
764Const CP_UTF7 = 65000 'UTF-7 translation
765Const CP_UTF8 = 65001 'UTF-8 translation
766
767Declare Function MultiByteToWideChar Lib "kernel32" (CodePage As DWord, dwFlags As DWord, pMultiByteStr As PCSTR, cchMultiByte As Long, pWideCharStr As PWSTR, cchWideChar As Long) As Long
768Declare Function OpenEvent Lib "kernel32" Alias _FuncName_OpenEvent (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE
769Declare Function OpenMutex Lib "kernel32" Alias _FuncName_OpenMutex (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE
770Declare Function OpenSemaphore Lib "kernel32" Alias _FuncName_OpenSemaphore (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE
771Declare Function OpenProcess Lib "kernel32" (dwDesiredAccess As DWord, bInheritHandle As Long, dwProcessId As DWord) As HANDLE
772Declare Sub OutputDebugStringA Lib "kernel32" (pOutputString As PCSTR)
773Declare Sub OutputDebugStringW Lib "kernel32" (pOutputString As PCWSTR)
774#ifdef UNICODE
775Declare Sub OutputDebugString Lib "kernel32" Alias "OutputDebugStringW" (pOutputString As PCWSTR)
776#else
777Declare Sub OutputDebugString Lib "kernel32" Alias "OutputDebugStringA" (pOutputString As PCSTR)
778#endif
779Declare Function PulseEvent Lib "kernel32" (hEvent As HANDLE) As BOOL
780Declare Sub RaiseException Lib "kernel32" (
781 dwExceptionCode As DWord,
782 dwExceptionFlags As DWord,
783 NumberOfArguments As DWord,
784 pArguments As *ULONG_PTR)
785Declare Function ReadFile Lib "kernel32" (hFile As HANDLE, lpBuffer As VoidPtr, nNumberOfBytesToRead As DWord, lpNumberOfBytesRead As *DWord, ByRef Overlapped As OVERLAPPED) As BOOL
786Declare Function ReadProcessMemory Lib "Kernel32" (hProcess As HANDLE, lpBaseAddress As VoidPtr, lpBuffer As VoidPtr, nSize As SIZE_T, lpNumberOfBytesRead As *SIZE_T) As BOOL
787Declare Function ReleaseMutex Lib "kernel32" (hMutex As HANDLE) As BOOL
788Declare Function ReleaseSemaphore Lib "kernel32" (hSemaphore As HANDLE, lReleaseCount As Long, ByRef lpPreviousCount As Long) As BOOL
789Declare Function RemoveDirectory Lib "kernel32" Alias _FuncName_RemoveDirectory (lpPathName As LPCTSTR) As BOOL
790Declare Function ResetEvent Lib "kernel32" (hEvent As HANDLE) As BOOL
791Declare Function ResumeThread Lib "kernel32" (hThread As HANDLE) As DWord
792Declare Function SetComputerName Lib "kernel32" Alias _FuncName_SetComputerName (lpComputerName As LPCTSTR) As BOOL
793Declare Function SetCurrentDirectory Lib "kernel32" Alias _FuncName_SetCurrentDirectory (lpPathName As LPCTSTR) As BOOL
794Declare 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
795Declare Function SetEndOfFile Lib "kernel32" (hFile As HANDLE) As BOOL
796Declare Function SetEnvironmentVariable Lib "kernel32" Alias _FuncName_SetEnvironmentVariable (lpName As LPCTSTR, lpValue As LPTSTR) As BOOL
797
798Const SEM_FAILCRITICALERRORS = &h0001
799Const SEM_NOGPFAULTERRORBOX = &h0002
800Const SEM_NOALIGNMENTFAULTEXCEPT = &h0004
801Const SEM_NOOPENFILEERRORBOX = &h8000
802Declare Function SetErrorMode Lib "kernel32" (uMode As DWord) As DWord
803Declare Function SetEvent Lib "kernel32" (hEvent As HANDLE) As BOOL
804Declare Function SetFileAttributes Lib "kernel32" Alias _FuncName_SetFileAttributes (lpFileName As LPCTSTR, dwFileAttributes As DWord) As BOOL
805
806Const FILE_BEGIN = 0
807Const FILE_CURRENT = 1
808Const FILE_END = 2
809Declare Function SetFilePointer Lib "kernel32" (hFile As HANDLE, lDistanceToMove As Long, lpDistanceToMoveHigh As DWordPtr, dwMoveMethod As DWord) As DWord
810
811Declare Function SetFileTime Lib "kernel32" (hFile As HANDLE, ByRef lpCreationTime As FILETIME, ByRef lpLastAccessTime As FILETIME, ByRef lpLastWriteTime As FILETIME) As BOOL
812Declare Sub SetLastError Lib "kernel32" (dwErrCode As DWord)
813Declare Sub SetLastErrorEx Lib "kernel32" (dwErrCode As DWord, dwType As DWord)
814Declare Function SetLocalTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME) As BOOL
815Declare Function SetPriorityClass Lib "kernel32" (hProcess As HANDLE, dwPriorityClass As DWord) As BOOL
816Declare Function SetThreadContext Lib "kernel32" (hThread As HANDLE, ByRef Context As CONTEXT) As BOOL
817Declare Function SetThreadPriority Lib "kernel32" (hThread As HANDLE, nPriority As Long) As BOOL
818Declare Function SetThreadPriorityBoost Lib "kernel32" (
819 hThread As HANDLE,
820 DisablePriorityBoost As BOOL
821) As BOOL
822
823TypeDef PTOP_LEVEL_EXCEPTION_FILTER = *Function(ByRef ExceptionInfo As EXCEPTION_POINTERS) As Long
824
825Declare Function SetUnhandledExceptionFilter Lib "kernel32" (pTopLevelExceptionFilter As PTOP_LEVEL_EXCEPTION_FILTER) As PTOP_LEVEL_EXCEPTION_FILTER
826
827Const INFINITE = &HFFFFFFFF
828Declare Sub Sleep Lib "kernel32" (dwMilliseconds As DWord)
829Declare Function SleepEx Lib "kernel32" (dwMilliseconds As DWord, bAlertable As BOOL) As DWord
830
831Declare Function SuspendThread Lib "kernel32" (hThread As HANDLE) As DWord
832Declare Function SystemTimeToFileTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME, ByRef lpFileTime As FILETIME) As BOOL
833Declare Function TerminateProcess Lib "kernel32" (hProcess As HANDLE, dwExitCode As DWord) As BOOL
834Declare Function TerminateThread Lib "kernel32" (hThread As HANDLE, dwExitCode As DWord) As BOOL
835Declare Function TlsAlloc Lib "kernel32" () As DWord
836Declare Function TlsFree Lib "kernel32" (dwTlsIndex As DWord) As BOOL
837Declare Function TlsGetValue Lib "kernel32" (dwTlsIndex As DWord) As VoidPtr
838Declare Function TlsSetValue Lib "kernel32" (dwTlsIndex As DWord, pTlsValue As VoidPtr) As BOOL
839Declare Function UnlockFile Lib "kernel32" (hFile As HANDLE, dwFileOffsetLow As DWord, dwFileOffsetHigh As DWord, nNumberOfBytesToUnlockLow As DWord, nNumberOfBytesToUnlockHigh As DWord) As BOOL
840Declare Function UnhandledExceptionFilter Lib "kernel32" (ByRef ExceptionInfo As EXCEPTION_POINTERS) As Long
841Declare Function VirtualAlloc Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T, flAllocationType As DWord, flProtect As DWord) As VoidPtr
842Declare Function VirtualFree Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T, dwFreeType As DWord) As BOOL
843Declare Function VirtualLock Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T) As BOOL
844Declare Function VirtualProtect Lib "kernel32" (
845 pAddress As VoidPtr,
846 Size As SIZE_T,
847 flNewProtect As DWord,
848 ByRef flOldProtect As DWord
849) As BOOL
850Declare Function VirtualProtectEx Lib "kernel32" (
851 hProcess As HANDLE,
852 pAddress As VoidPtr,
853 Size As SIZE_T,
854 flNewProtect As DWord,
855 ByRef flOldProtect As DWord
856) As BOOL
857Declare Function VirtualQuery Lib "kernel32" (
858 pAddress As VoidPtr,
859 ByRef mbi As MEMORY_BASIC_INFORMATION,
860 Length As SIZE_T
861) As SIZE_T
862Declare Function VirtualQueryEx Lib "kernel32" (
863 hProcess As HANDLE,
864 pAddress As VoidPtr,
865 ByRef mbi As MEMORY_BASIC_INFORMATION,
866 Length As SIZE_T
867) As SIZE_T
868Declare Function VirtualUnlock Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T) As BOOL
869Declare Function WaitForMultipleObjects Lib "kernel32" (nCount As DWord, pHandles As *HANDLE, fWaitAll As BOOL, dwMilliseconds As DWord) As DWord
870Declare Function WaitForMultipleObjectsEx Lib "kernel32" (nCount As DWord, pHandles As *HANDLE, fWaitAll As BOOL, dwMilliseconds As DWord, bAlertable As BOOL) As DWord
871Declare Function WaitForSingleObject Lib "kernel32" (hHandle As HANDLE, dwMilliseconds As DWord) As DWord
872Declare Function WaitForSingleObjectEx Lib "kernel32" (hHandle As HANDLE, dwMilliseconds As DWord, bAlertable As BOOL) As DWord
873
874Const WC_COMPOSITECHECK = &H00000200
875Const WC_DISCARDNS = &H00000010
876Const WC_SEPCHARS = &H00000020
877Const WC_DEFAULTCHAR = &H00000040
878Const WC_NO_BEST_FIT_CHARS = &H00000400
879Declare Function WideCharToMultiByte Lib "Kernel32" (
880 CodePage As DWord,
881 dwFlags As DWord,
882 pWideCharStr As PCWSTR,
883 cchWideChar As Long,
884 pMultiByteStr As PSTR,
885 cbMultiByte As Long,
886 pDefaultChar As PCSTR,
887 pUsedDefaultChar As *BOOL
888) As Long
889
890Declare Function WriteFile Lib "kernel32" (hFile As HANDLE, lpBuffer As VoidPtr, nNumberOfBytesToWrite As DWord, lpNumberOfBytesWritten As *DWord, ByRef pOverlapped As OVERLAPPED) As BOOL
891Declare Sub ZeroMemory Lib "kernel32" Alias "RtlZeroMemory" (Destination As VoidPtr, dwLength As DWord)
892
893'
894' Wait functions' results.
895'
896Const WAIT_FAILED = (&hFFFFFFFF As DWord)
897Const WAIT_OBJECT_0 = ((STATUS_WAIT_0 ) + 0)
898
899Const WAIT_ABANDONED = ((STATUS_ABANDONED_WAIT_0 ) + 0)
900Const WAIT_ABANDONED_0 = ((STATUS_ABANDONED_WAIT_0 ) + 0)
901
902Const WAIT_IO_COMPLETION = STATUS_USER_APC
903
904Declare Function FindResource Lib "kernel32" Alias _FuncName_FindResource (hInstance As HINSTANCE, lpName As LPCTSTR, lpType As LPCTSTR) As HRSRC
905Declare Function LoadResource Lib "kernel32" (hModule As HMODULE, hResInfo As HRSRC) As HGLOBAL
906Declare Function FreeResource Lib "kernel32" (hResData As HGLOBAL) As BOOL
907Declare Function LockResource Lib "kernel32" (hResData As HGLOBAL) As VoidPtr
908Declare Function SizeofResource Lib "kernel32" (hModule As HANDLE, hResInfo As HRSRC) As DWord
909
910Declare Function ExpandEnvironmentStrings Lib "kernel32" Alias _FuncName_ExpandEnvironmentStrings (lpSrc As LPCTSTR, lpDst As LPTSTR, nSize As DWord) As DWord
911
912Type DCB
913 DCBlength As DWord
914 BaudRate As DWord
915 fBitFields As DWord
916 wReserved As Word
917 XonLim As Word
918 XoffLim As Word
919 ByteSize As Byte
920 Parity As Byte
921 StopBits As Byte
922 XonChar As CHAR
923 XoffChar As CHAR
924 ErrorChar As CHAR
925 EofChar As CHAR
926 EvtChar As CHAR
927 wReserved1 As Word
928End Type
929
930Type COMMTIMEOUTS
931 ReadIntervalTimeout As DWord
932 ReadTotalTimeoutMultiplier As DWord
933 ReadTotalTimeoutConstant As DWord
934 WriteTotalTimeoutMultiplier As DWord
935 WriteTotalTimeoutConstant As DWord
936End Type
937Type COMSTAT
938 fCoBitFlds As Long 'See Comment in Win32API.Txt
939 cbInQue As DWord
940 cbOutQue As DWord
941End Type
942Declare Function SetCommState Lib "kernel32" (hCommDev As HANDLE, ByRef dcb As DCB) As BOOL
943Declare Function SetCommTimeouts Lib "kernel32" (hFile As HANDLE ,ByRef pCommTimeouts As COMMTIMEOUTS) As BOOL
944Declare Function ClearCommError Lib "kernel32" (hCommDevs As HANDLE, ByRef Errors As DWord, ByRef Stat As COMSTAT) As BOOL
945Declare Function EscapeCommFunction Lib "kernel32" (nCid As HANDLE, ByVal nFunc As DWord) As BOOL
946Declare Function GetCommModemStatus Lib "kernel32" (hFile As HANDLE, ByRef ModemStat As DWord) As BOOL
947Declare Function SetCommMask Lib "kernel32" (hFile As HANDLE, dwEvtMask As DWord) As BOOL
948Declare Function WaitCommEvent Lib "kernel32" (hFile As HANDLE, ByRef EvtMask As DWord, lpOverlapped As *OVERLAPPED) As BOOL
949
950Declare Function OpenProcessToken Lib "advapi32" (ProcessHandle As HANDLE, DesiredAccess As DWord, ByRef TokenHandle As HANDLE) As BOOL
951Declare Function LookupPrivilegeValue Lib "advapi32" Alias _FuncName_LookupPrivilegeValue (lpSystemName As LPCTSTR, lpName As LPCTSTR, ByRef Luid As LUID) As Long
952Declare Function AdjustTokenPrivileges Lib "advapi32" (TokenHandle As Long, DisableAllPrivileges As Long,_
953 ByRef NewState As TOKEN_PRIVILEGES, BufferLength As Long,
954 ByRef PreviousState As TOKEN_PRIVILEGES, ByRef ReturnLength As Long) As Long
955
956Declare Function AddAtom Lib "kernel32" Alias _FuncName_AddAtom (lpString As LPCTSTR) As ATOM
957Declare Function DeleteAtom Lib "kernel32" (nAtom As ATOM) As ATOM
958Declare Function FindAtom Lib "kernel32" Alias _FuncName_AddAtom (lpString As LPCTSTR) As ATOM
959Declare Function GetAtomName Lib "kernel32" Alias _FuncName_GetAtomName (nAtom As ATOM, lpBuffer As LPCTSTR, nSize As Long) As DWord
960
961Declare Function GlobalAddAtom Lib "kernel32" Alias _FuncName_GlobalAddAtom (lpString As LPCTSTR) As ATOM
962Declare Function GlobalDeleteAtom Lib "kernel32" (a As ATOM) As ATOM
963Declare Function GlobalFindAtom Lib "kernel32" Alias _FuncName_GlobalAddAtom (lpString As LPCTSTR) As ATOM
964Declare Function GlobalGetAtomName Lib "kernel32" Alias _FuncName_GlobalGetAtomName (nAtom As ATOM, lpBuffer As LPCTSTR, nSize As Long) As DWord
965
966Declare Function InitAtomTable Lib "kernel32" (nSize As DWord) As BOOL
967
968Const MAXINTATOM = &hC000
969Const MAKEINTATOM(i) = (i As Word As ULONG_PTR As LPTSTR)
970Const INVALID_ATOM = 0 As ATOM
971
972#endif '_INC_SYSTEM
Note: See TracBrowser for help on using the repository browser.