' api_system.sbp - System API #ifdef UNICODE Const _FuncName_AddAtom = "AddAtomW" Const _FuncName_CopyFile = "CopyFileW" Const _FuncName_CreateDirectory = "CreateDirectoryW" Const _FuncName_CreateEvent = "CreateEventW" Const _FuncName_CreateMutex = "CreateMutexW" Const _FuncName_CreateSemaphore = "CreateSemaphoreW" Const _FuncName_CreateWaitableTimer = "CreateWaitableTimerW" Const _FuncName_CreateFile = "CreateFileW" Const _FuncName_CreateFileMapping = "CreateFileMappingW" Const _FuncName_OpenFileMapping = "OpenFileMappingW" Const _FuncName_CreateMailslot = "CreateMailslotW" Const _FuncName_CreateProcess = "CreateProcessW" Const _FuncName_DeleteFile = "DeleteFileW" Const _FuncName_ExpandEnvironmentStrings = "ExpandEnvironmentStringsW" Const _FuncName_FatalAppExit = "FatalAppExitW" Const _FuncName_FindAtom = "FindAtomW" Const _FuncName_FindFirstChangeNotification = "FindFirstChangeNotificationW" Const _FuncName_FindFirstFile = "FindFirstFileW" Const _FuncName_FindNextFile = "FindNextFileW" Const _FuncName_FindResource = "FindResourceW" Const _FuncName_FormatMessage = "FormatMessageW" Const _FuncName_FreeEnvironmentStrings = "FreeEnvironmentStringsW" Const _FuncName_GetCompressedFileSize = "GetCompressedFileSizeW" Const _FuncName_GetComputerName = "GetComputerNameW" Const _FuncName_GetCurrentDirectory = "GetCurrentDirectoryW" Const _FuncName_GetDiskFreeSpace = "GetDiskFreeSpaceW" Const _FuncName_GetDiskFreeSpaceEx = "GetDiskFreeSpaceExW" Const _FuncName_GetVolumeInformation = "GetVolumeInformationW" Const _FuncName_GetDriveType = "GetDriveTypeW" Const _FuncName_GetEnvironmentVariable = "GetEnvironmentVariableW" Const _FuncName_GetEnvironmentStrings = "GetEnvironmentStringsW" Const _FuncName_GetFileAttributes = "GetFileAttributesW" Const _FuncName_GetFullPathName = "GetFullPathNameW" Const _FuncName_GetAtomName = "GetAtomNameW" Const _FuncName_GlobalAddAtom = "GlobalAddAtomW" Const _FuncName_GlobalFindAtom = "GlobalFindAtomW" Const _FuncName_GlobalGetAtomName = "GlobalGetAtomNameW" Const _FuncName_GetLogicalDriveStrings = "GetLogicalDriveStringsW" Const _FuncName_GetLongPathName = "GetLongPathNameW" Const _FuncName_GetModuleFileName = "GetModuleFileNameW" Const _FuncName_GetModuleHandle = "GetModuleHandleW" Const _FuncName_GetShortPathName = "GetShortPathNameW" Const _FuncName_GetStartupInfo = "GetStartupInfoW" Const _FuncName_GetSystemDirectory = "GetSystemDirectoryW" Const _FuncName_GetTempFileName = "GetTempFileNameW" Const _FuncName_GetTempPath = "GetTempPathW" Const _FuncName_GetUserName = "GetUserNameW" Const _FuncName_GetVersionEx = "GetVersionExW" Const _FuncName_GetWindowsDirectory = "GetWindowsDirectoryW" Const _FuncName_LoadLibrary = "LoadLibraryW" Const _FuncName_LoadLibraryEx = "LoadLibraryExW" Const _FuncName_LookupPrivilegeValue = "LookupPrivilegeValueW" Const _FuncName_lstrcat = "lstrcatW" Const _FuncName_lstrcmp = "lstrcmpW" Const _FuncName_lstrcmpi = "lstrcmpiW" Const _FuncName_lstrcpy = "lstrcpyW" Const _FuncName_lstrcpyn = "lstrcpynW" Const _FuncName_MoveFile = "MoveFileW" Const _FuncName_OpenEvent = "OpenEventW" Const _FuncName_OpenMutex = "OpenMutexW" Const _FuncName_OpenSemaphore = "OpenSemaphoreW" Const _FuncName_OpenWaitableTimer = "OpenWaitableTimerW" Const _FuncName_RemoveDirectory = "RemoveDirectoryW" Const _FuncName_SetComputerName = "SetComputerNameW" Const _FuncName_SetCurrentDirectory = "SetCurrentDirectoryW" Const _FuncName_SearchPath = "SearchPathW" Const _FuncName_SetEnvironmentVariable = "SetEnvironmentVariableW" Const _FuncName_SetFileAttributes = "SetFileAttributesW" #else Const _FuncName_AddAtom = "AddAtomA" Const _FuncName_CopyFile = "CopyFileA" Const _FuncName_CreateDirectory = "CreateDirectoryA" Const _FuncName_CreateEvent = "CreateEventA" Const _FuncName_CreateMutex = "CreateMutexA" Const _FuncName_CreateSemaphore = "CreateSemaphoreA" Const _FuncName_CreateWaitableTimer = "CreateWaitableTimerA" Const _FuncName_CreateFile = "CreateFileA" Const _FuncName_CreateFileMapping = "CreateFileMappingA" Const _FuncName_OpenFileMapping = "OpenFileMappingA" Const _FuncName_CreateMailslot = "CreateMailslotA" Const _FuncName_CreateProcess = "CreateProcessA" Const _FuncName_DeleteFile = "DeleteFileA" Const _FuncName_ExpandEnvironmentStrings = "ExpandEnvironmentStringsA" Const _FuncName_FatalAppExit = "FatalAppExitA" Const _FuncName_FindAtom = "FindAtomA" Const _FuncName_FindFirstChangeNotification = "FindFirstChangeNotificationA" Const _FuncName_FindFirstFile = "FindFirstFileA" Const _FuncName_FindNextFile = "FindNextFileA" Const _FuncName_FindResource = "FindResourceA" Const _FuncName_FormatMessage = "FormatMessageA" Const _FuncName_FreeEnvironmentStrings = "FreeEnvironmentStringsA" Const _FuncName_GetAtomName = "GetAtomNameA" Const _FuncName_GlobalAddAtom = "GlobalAddAtomA" Const _FuncName_GlobalFindAtom = "GlobalFindAtomA" Const _FuncName_GlobalGetAtomName = "GlobalGetAtomNameA" Const _FuncName_GetCompressedFileSize = "GetCompressedFileSizeA" Const _FuncName_GetComputerName = "GetComputerNameA" Const _FuncName_GetCurrentDirectory = "GetCurrentDirectoryA" Const _FuncName_GetDiskFreeSpace = "GetDiskFreeSpaceA" Const _FuncName_GetDiskFreeSpaceEx = "GetDiskFreeSpaceExA" Const _FuncName_GetVolumeInformation = "GetVolumeInformationA" Const _FuncName_GetDriveType = "GetDriveTypeA" Const _FuncName_GetEnvironmentVariable = "GetEnvironmentVariableA" Const _FuncName_GetEnvironmentStrings = "GetEnvironmentStringsA" Const _FuncName_GetFileAttributes = "GetFileAttributesA" Const _FuncName_GetFullPathName = "GetFullPathNameA" Const _FuncName_GetLogicalDriveStrings = "GetLogicalDriveStringsA" Const _FuncName_GetLongPathName = "GetLongPathNameA" Const _FuncName_GetModuleFileName = "GetModuleFileNameA" Const _FuncName_GetModuleHandle = "GetModuleHandleA" Const _FuncName_GetShortPathName = "GetShortPathNameA" Const _FuncName_GetStartupInfo = "GetStartupInfoA" Const _FuncName_GetSystemDirectory = "GetSystemDirectoryA" Const _FuncName_GetTempFileName = "GetTempFileNameA" Const _FuncName_GetTempPath = "GetTempPathA" Const _FuncName_GetUserName = "GetUserNameA" Const _FuncName_GetVersionEx = "GetVersionExA" Const _FuncName_GetWindowsDirectory = "GetWindowsDirectoryA" Const _FuncName_LoadLibrary = "LoadLibraryA" Const _FuncName_LoadLibraryEx = "LoadLibraryExA" Const _FuncName_LookupPrivilegeValue = "LookupPrivilegeValueA" Const _FuncName_lstrcat = "lstrcatA" Const _FuncName_lstrcmp = "lstrcmpA" Const _FuncName_lstrcmpi = "lstrcmpiA" Const _FuncName_lstrcpy = "lstrcpyA" Const _FuncName_lstrcpyn = "lstrcpynA" Const _FuncName_MoveFile = "MoveFileA" Const _FuncName_OpenEvent = "OpenEventA" Const _FuncName_OpenMutex = "OpenMutexA" Const _FuncName_OpenSemaphore = "OpenSemaphoreA" Const _FuncName_OpenWaitableTimer = "OpenWaitableTimerA" Const _FuncName_RemoveDirectory = "RemoveDirectoryA" Const _FuncName_SetComputerName = "SetComputerNameA" Const _FuncName_SetCurrentDirectory = "SetCurrentDirectoryA" Const _FuncName_SearchPath = "SearchPathA" Const _FuncName_SetEnvironmentVariable = "SetEnvironmentVariableA" Const _FuncName_SetFileAttributes = "SetFileAttributesA" #endif '------------------- ' default constants Const INVALID_HANDLE_VALUE = -1 As HANDLE Const INVALID_FILE_SIZE = &HFFFFFFFF As DWord Const INVALID_SET_FILE_POINTER = &HFFFFFFFF As DWord Const INVALID_FILE_ATTRIBUTES = &HFFFFFFFF As DWord '----------------- ' data structs 'variable type - System TypeDef HFILE = Long Type _System_DeclareHandle_HANDLE:unused As DWord:End Type TypeDef HRSRC = *_System_DeclareHandle_HANDLE ' File structure Type SECURITY_ATTRIBUTES nLength As DWord lpSecurityDescriptor As VoidPtr bInheritHandle As BOOL End Type Type OVERLAPPED Internal As ULONG_PTR InternalHigh As ULONG_PTR Offset As DWord OffsetHigh As DWord hEvent As HANDLE End Type ' System time Type SYSTEMTIME wYear As Word wMonth As Word wDayOfWeek As Word wDay As Word wHour As Word wMinute As Word wSecond As Word wMilliseconds As Word End Type ' Global Memory Flags Const GMEM_FIXED = &H0000 Const GMEM_MOVEABLE = &H0002 Const GMEM_NOCOMPACT = &H0010 Const GMEM_NODISCARD = &H0020 Const GMEM_ZEROINIT = &H0040 Const GMEM_MODIFY = &H0080 Const GMEM_DISCARDABLE = &H0100 Const GMEM_NOT_BANKED = &H1000 Const GMEM_SHARE = &H2000 Const GMEM_DDESHARE = &H2000 Const GMEM_INVALID_HANDLE = &H8000 Const GHND = GMEM_MOVEABLE or GMEM_ZEROINIT Const GPTR = GMEM_FIXED or GMEM_ZEROINIT Const GMEM_DISCARDED = &H4000 'Critical Section Type CRITICAL_SECTION DebugInfo As VoidPtr LockCount As Long RecursionCount As Long OwningThread As HANDLE LockSemaphore As HANDLE SpinCount As ULONG_PTR End Type 'Mutex Const MUTEX_ALL_ACCESS = MUTANT_ALL_ACCESS 'Lmcons.ab Const UNLEN = 256 '---------------------- ' Kernel Operation API #ifdef _WIN64 Function InterlockedIncrement(ByRef lpAddend As Long) As Long lpAddend++ Return lpAddend End Function Function InterlockedDecrement(ByRef lpAddend As Long) As Long lpAddend-- Return lpAddend End Function Function InterlockedExchange(ByRef Target As Long, Value As Long) As Long InterlockedExchange=Target Target = Value End Function Function InterlockedCompareExchange(ByRef Destination As Long, Exchange As Long, Comperand As Long) As Long InterlockedCompareExchange = Destination If Destination = Comperand Then Destination = Exchange End If End Function Function InterlockedExchangeAdd(ByRef Addend As Long, Value As Long) As Long InterlockedExchangeAdd = Addend Addend += Value End Function Function InterlockedExchangePointer(ByRef Target As VoidPtr, Value As VoidPtr) As VoidPtr InterlockedExchangePointer = Target Target = Value End Function Function InterlockedCompareExchangePointer(ByRef Destination As VoidPtr, Exchange As VoidPtr, Comperand As VoidPtr) As VoidPtr InterlockedCompareExchangePointer = Destination If Destination = Comperand Then Destination = Exchange End If End Function #else Declare Function InterlockedIncrement Lib "kernel32" (ByRef lpAddend As Long) As Long Declare Function InterlockedDecrement Lib "kernel32" (ByRef lpAddend As Long) As Long Declare Function InterlockedExchange Lib "kernel32" (ByRef Target As Long, Value As Long) As Long Declare Function InterlockedCompareExchange Lib "kernel32" (ByRef Destination As Long, Exchange As Long, Comperand As Long) As Long Declare Function InterlockedExchangeAdd Lib "kernel32" (ByRef Addend As Long, Value As Long) As Long Declare Function InterlockedCompareExchangePointer Lib "kernel32" Alias "InterlockedCompareExchange" (ByRef Destination As VoidPtr, Exchange As VoidPtr, Comperand As VoidPtr) As VoidPtr Declare Function InterlockedExchangePointer Lib "kernel32" Alias "InterlockedExchange" (ByRef Target As VoidPtr, Value As VoidPtr) As VoidPtr #endif Declare Function Beep Lib "kernel32" (dwFreq As DWord, dwDuration As DWord) As BOOL Declare Function CloseHandle Lib "kernel32" (hObject As HANDLE) As BOOL Declare Function CompareFileTime Lib "kernel32" (ByRef FileTime1 As FILETIME, ByRef FileTime2 As FILETIME) As Long Declare Function CopyFile Lib "kernel32" Alias _FuncName_CopyFile (pExistingFileName As PCTSTR, pNewFileName As PCTSTR, bFailIfExists As BOOL) As BOOL Declare Function CreateDirectory Lib "kernel32" Alias _FuncName_CreateDirectory (pPathName As PCTSTR, pSecurityAttributes As *SECURITY_ATTRIBUTES) As BOOL Declare Function CreateEvent Lib "kernel32" Alias _FuncName_CreateEvent (pEventAttributes As *SECURITY_ATTRIBUTES, bManualReset As BOOL, bInitialState As BOOL, pName As PCTSTR) As HANDLE Declare Function CreateMutex Lib "kernel32" Alias _FuncName_CreateMutex (lpMutexAttributes As *SECURITY_ATTRIBUTES, bInitialOwner As BOOL, lpName As PCTSTR) As HANDLE Declare Function CreatePipe Lib "Kernel32" ( ByRef hReadPipe As HANDLE, ByRef hWritePipe As HANDLE, ByVal pPipeAttributes As *SECURITY_ATTRIBUTES, ByVal nSize As DWord) As Long Declare Function CreateSemaphore Lib "kernel32" Alias _FuncName_CreateSemaphore (pSemaphoreAttributes As *SECURITY_ATTRIBUTES, lInitialCount As Long, lMaximumCount As Long, pName As PCTSTR) As HANDLE TypeDef PTIMERAPCROUTINE = *Sub(lpArgToCompletionRoutine As VoidPtr, dwTimerLowValue As DWord, dwTimerHighValue As DWord) Declare Function CreateWaitableTimer Lib "kernel32" Alias _FuncName_CreateWaitableTimer (pTimerAttributes As *SECURITY_ATTRIBUTES, bManualReset As BOOL, pTimerName As PCTSTR) As HANDLE Declare Function OpenWaitableTimer Lib "kernel32" Alias _FuncName_OpenWaitableTimer (dwDesiredAccess As DWord, bInheritHandle As BOOL, pTimerName As PCTSTR) As HANDLE Declare 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 Declare Function CancelWaitableTimer Lib "kernel32" (hTimer As HANDLE) As BOOL Const CREATE_NEW = 1 Const CREATE_ALWAYS = 2 Const OPEN_EXISTING = 3 Const OPEN_ALWAYS = 4 Const TRUNCATE_EXISTING = 5 Const FILE_FLAG_WRITE_THROUGH = &H80000000 Const FILE_FLAG_OVERLAPPED = &H40000000 Const FILE_FLAG_NO_BUFFERING = &H20000000 Const FILE_FLAG_RANDOM_ACCESS = &H10000000 Const FILE_FLAG_SEQUENTIAL_SCAN = &H08000000 Const FILE_FLAG_DELETE_ON_CLOSE = &H04000000 Const FILE_FLAG_BACKUP_SEMANTICS = &H02000000 Const FILE_FLAG_POSIX_SEMANTICS = &H01000000 Const FILE_FLAG_OPEN_REPARSE_POINT = &H00200000 Const FILE_FLAG_OPEN_NO_RECALL = &H00100000 Declare 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 Const FILE_MAP_COPY = SECTION_QUERY Const FILE_MAP_WRITE = SECTION_MAP_WRITE Const FILE_MAP_READ = SECTION_MAP_READ Const FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS Declare 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 Declare Function OpenFileMapping Lib "kernel32" Alias _FuncName_OpenFileMapping (dwDesiredAccess As DWord, bInheritHandle As BOOL, pName As PCSTR) As HANDLE Declare Function MapViewOfFile Lib "kernel32" (hFileMappingObject As HANDLE, dwDesiredAccess As DWord, dwFileOffsetHigh As DWord, dwFileOffsetLow As DWord, dwNumberOfBytesToMap As DWord) As VoidPtr Declare Function MapViewOfFileEx Lib "kernel32" (hFileMappingObject As HANDLE, dwDesiredAccess As DWord, dwFileOffsetHigh As DWord, dwFileOffsetLow As DWord, dwNumberOfBytesToMap As DWord, lpBaseAddress As VoidPtr) As VoidPtr Declare Function FlushViewOfFile Lib "kernel32" (lpBaseAddress As VoidPtr, dwNumberOfBytesToFlush As DWord) As BOOL Declare Function UnmapViewOfFile Lib "kernel32" (lpBaseAddress As VoidPtr) As BOOL Declare Function CreateMailslot Lib "kernel32" Alias _FuncName_CreateMailslot (pName As PCTSTR, nMaxMessageSize As DWord, lReadTimeout As DWord, pSecurityAttributes As *SECURITY_ATTRIBUTES) As HANDLE Const DEBUG_PROCESS = &H00000001 Const DEBUG_ONLY_THIS_PROCESS = &H00000002 Const CREATE_SUSPENDED = &H00000004 Const DETACHED_PROCESS = &H00000008 Const CREATE_NEW_CONSOLE = &H00000010 Const NORMAL_PRIORITY_CLASS = &H00000020 Const IDLE_PRIORITY_CLASS = &H00000040 Const HIGH_PRIORITY_CLASS = &H00000080 Const REALTIME_PRIORITY_CLASS = &H00000100 Const CREATE_NEW_PROCESS_GROUP = &H00000200 Const CREATE_UNICODE_ENVIRONMENT = &H00000400 Const CREATE_SEPARATE_WOW_VDM = &H00000800 Const CREATE_SHARED_WOW_VDM = &H00001000 Const CREATE_FORCEDOS = &H00002000 Const BELOW_NORMAL_PRIORITY_CLASS = &H00004000 Const ABOVE_NORMAL_PRIORITY_CLASS = &H00008000 Const CREATE_DEFAULT_ERROR_MODE = &H04000000 Const CREATE_NO_WINDOW = &H08000000 Const PROFILE_USER = &H10000000 Const PROFILE_KERNEL = &H20000000 Const PROFILE_SERVER = &H40000000 Const STARTF_USESHOWWINDOW = &H00000001 Const STARTF_USESIZE = &H00000002 Const STARTF_USEPOSITION = &H00000004 Const STARTF_USECOUNTCHARS = &H00000008 Const STARTF_USEFILLATTRIBUTE = &H00000010 Const STARTF_RUNFULLSCREEN = &H00000020 Const STARTF_FORCEONFEEDBACK = &H00000040 Const STARTF_FORCEOFFFEEDBACK = &H00000080 Const STARTF_USESTDHANDLES = &H00000100 Const STARTF_USEHOTKEY = &H00000200 Type STARTUPINFOW cb As DWord lpReserved As LPWSTR lpDesktop As LPWSTR lpTitle As LPWSTR dwX As DWord dwY As DWord dwXSize As DWord dwYSize As DWord dwXCountChars As DWord dwYCountChars As DWord dwFillAttribute As DWord dwFlags As DWord wShowWindow As Word cbReserved2 As Word lpReserved2 As *Byte hStdInput As HANDLE hStdOutput As HANDLE hStdError As HANDLE End Type Type STARTUPINFOA cb As DWord lpReserved As LPSTR lpDesktop As LPSTR lpTitle As LPSTR dwX As DWord dwY As DWord dwXSize As DWord dwYSize As DWord dwXCountChars As DWord dwYCountChars As DWord dwFillAttribute As DWord dwFlags As DWord wShowWindow As Word cbReserved2 As Word lpReserved2 As *Byte hStdInput As HANDLE hStdOutput As HANDLE hStdError As HANDLE End Type #ifdef UNICODE TypeDef STARTUPINFO = STARTUPINFOW #else TypeDef STARTUPINFO = STARTUPINFOA #endif Type PROCESS_INFORMATION hProcess As HANDLE hThread As HANDLE dwProcessId As DWord dwThreadId As DWord End Type Declare 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 TypeDef LPTHREAD_START_ROUTINE = *Function(lpThreadParameter As VoidPtr) As DWord Declare 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 Declare Sub DebugBreak Lib "kernel32" () Declare Sub DeleteCriticalSection Lib "kernel32" (ByRef CriticalSection As CRITICAL_SECTION) Declare Function DeleteFile Lib "kernel32" Alias _FuncName_DeleteFile (pFileName As PCTSTR) As BOOL Declare Function DeviceIoControl Lib "Kernel32" ( hDevice As HANDLE, dwIoControlCode As DWord, pInBuffer As VoidPtr, nInBufferSize As DWord, pOutBuffer As VoidPtr, nOutBufferSize As DWord, pBytesReturned As DWordPtr, pOverlapped As *OVERLAPPED ) As Long Declare Function DisableThreadLibraryCalls Lib "kernel32" (hLibModule As HINSTANCE) As BOOL Declare Function DosDateTimeToFileTime Lib "kernel32" (wFatDate As Word, wFatTime As Word, ByRef FileTime As FILETIME) As BOOL Declare 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 Declare Sub EnterCriticalSection Lib "kernel32" (ByRef lpCriticalSection As CRITICAL_SECTION) Declare Sub ExitProcess Lib "kernel32" (dwExitCode As DWord) Declare Sub ExitThread Lib "kernel32" (dwExitCode As DWord) Declare Sub FatalAppExit Lib "kernel32" Alias _FuncName_FatalAppExit (Action As DWord, pMessageText As PCTSTR) Declare Function FileTimeToDosDateTime Lib "kernel32" (ByRef lpFileTime As FILETIME, ByRef lpFatDate As Word, ByRef lpFatTime As Word) As BOOL Declare Function FileTimeToLocalFileTime Lib "kernel32" (ByRef lpFileTime As FILETIME, ByRef lpLocalFileTime As FILETIME) As BOOL Declare Function FileTimeToSystemTime Lib "kernel32" (ByRef lpFileTime As FILETIME, ByRef lpSystemTime As SYSTEMTIME) As BOOL Declare Sub FillMemory Lib "kernel32" Alias "RtlFillMemory" (pDest As VoidPtr, stLength As SIZE_T, c As Byte) Declare Function FindClose Lib "kernel32" (hFindFile As HANDLE) As BOOL Declare Function FindCloseChangeNotification Lib "kernel32" (hChangeHandle As HANDLE) As BOOL Declare Function FindFirstChangeNotification Lib "kernel32" Alias _FuncName_FindFirstChangeNotification ( pPathName As PCTSTR, bWatchSubtree As BOOL, dwNotifyFilter As DWord ) As HANDLE Type WIN32_FIND_DATAW dwFileAttributes As DWord ftCreationTime As FILETIME ftLastAccessTime As FILETIME ftLastWriteTime As FILETIME nFileSizeHigh As DWord nFileSizeLow As DWord dwReserved0 As DWord dwReserved1 As DWord cFileName[ELM(MAX_PATH)] As WCHAR cAlternateFileName[13] As WCHAR End Type Type WIN32_FIND_DATAA dwFileAttributes As DWord ftCreationTime As FILETIME ftLastAccessTime As FILETIME ftLastWriteTime As FILETIME nFileSizeHigh As DWord nFileSizeLow As DWord dwReserved0 As DWord dwReserved1 As DWord cFileName[ELM(MAX_PATH)] As SByte cAlternateFileName[13] As SByte End Type #ifdef UNICODE TypeDef WIN32_FIND_DATA = WIN32_FIND_DATAW #else TypeDef WIN32_FIND_DATA = WIN32_FIND_DATAA #endif TypeDef LPWIN32_FIND_DATA = *WIN32_FIND_DATA Declare Function FindFirstFile Lib "kernel32" Alias _FuncName_FindFirstFile (pFileName As PCTSTR, ByRef FindFildData As WIN32_FIND_DATA) As HANDLE Declare Function FindNextChangeNotification Lib "kernel32" (hChangeHandle As HANDLE) As BOOL Declare Function FindNextFile Lib "kernel32" Alias _FuncName_FindNextFile (hFindFile As HANDLE, ByRef FindFildData As WIN32_FIND_DATA) As BOOL Declare Function FlushFileBuffers Lib "kernel32" (hFile As HANDLE) As BOOL Declare Function FlushInstructionCache Lib "kernel32" (hProcess As HANDLE, pBaseAddress As VoidPtr, Size As SIZE_T) As BOOL Const FORMAT_MESSAGE_ALLOCATE_BUFFER = &H00000100 Const FORMAT_MESSAGE_IGNORE_INSERTS = &H00000200 Const FORMAT_MESSAGE_FROM_STRING = &H00000400 Const FORMAT_MESSAGE_FROM_HMODULE = &H00000800 Const FORMAT_MESSAGE_FROM_SYSTEM = &H00001000 Const FORMAT_MESSAGE_ARGUMENT_ARRAY = &H00002000 Declare 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 Declare Function FreeEnvironmentStrings Lib "kernel32" Alias _FuncName_FreeEnvironmentStrings (pszEnvironmentBlock As PCTSTR) As BOOL Declare Function FreeLibrary Lib "kernel32" (hLibModule As HINSTANCE) As BOOL Declare Sub FreeLibraryAndExitThread Lib "kernel32" (hModule As HANDLE, dwExitCode As DWord) Declare Function GetCommandLineA Lib "kernel32" () As PCSTR Declare Function GetCommandLineW Lib "kernel32" () As PCWSTR #ifdef UNICODE Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineW" () As PCWSTR #else Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineA" () As PCSTR #endif Declare Function GetCompressedFileSize Lib "kernel32" Alias _FuncName_GetCompressedFileSize (pFileName As PCTSTR, ByRef FileSizeHigh As DWord) As DWord Const MAX_COMPUTERNAME_LENGTH = 15 Declare Function GetComputerName Lib "kernel32" Alias _FuncName_GetComputerName (pBuffer As PTSTR, ByRef nSize As DWord) As BOOL Declare Function GetCurrentDirectory Lib "kernel32" Alias _FuncName_GetCurrentDirectory (nBufferLength As DWord, pBuffer As PTSTR) As DWord Declare Function GetCurrentProcess Lib "kernel32" () As HANDLE Declare Function GetCurrentProcessId Lib "kernel32" () As DWord Declare Function GetCurrentThread Lib "kernel32" () As HANDLE Declare Function GetCurrentThreadId Lib "kernel32" () As DWord Declare Function GetDiskFreeSpace Lib "kernel32" Alias _FuncName_GetDiskFreeSpace (pRootPathName As PCTSTR, lpSectorsPerCluster As *DWord, pBytesPerSector As *DWord, pNumberOfFreeClusters As *DWord, pTotalNumberOfClusters As *DWord) As BOOL Declare 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 Const DRIVE_UNKNOWN = 0 Const DRIVE_NO_ROOT_DIR = 1 Const DRIVE_REMOVABLE = 2 Const DRIVE_FIXED = 3 Const DRIVE_REMOTE = 4 Const DRIVE_CDROM = 5 Const DRIVE_RAMDISK = 6 Declare 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 Declare Function GetDriveType Lib "kernel32" Alias _FuncName_GetDriveType (lpRootPathName As PCTSTR) As DWord Declare Function GetEnvironmentVariable Lib "kernel32" Alias _FuncName_GetEnvironmentVariable (lpName As PCTSTR, lpBuffer As PTSTR, nSize As DWord) As DWord Declare Function GetEnvironmentStrings Lib "kernel32" Alias _FuncName_GetEnvironmentStrings () As VoidPtr Const STILL_ACTIVE = &H00000103 Declare Function GetExitCodeProcess Lib "kernel32" (hProcess As HANDLE, ByRef lpExitCode As DWord) As BOOL Declare Function GetExitCodeThread Lib "kernel32" (hThread As HANDLE, ByRef lpExitCode As DWord) As BOOL Declare Function GetFileAttributes Lib "kernel32" Alias _FuncName_GetFileAttributes (lpFileName As PCTSTR) As DWord Type BY_HANDLE_FILE_INFORMATION dwFileAttributes As DWord ftCreationTime As FILETIME ftLastAccessTime As FILETIME ftLastWriteTime As FILETIME dwVolumeSerialNumber As DWord nFileSizeHigh As DWord nFileSizeLow As DWord nNumberOfLinks As DWord nFileIndexHigh As DWord nFileIndexLow As DWord End Type Declare Function GetFileInformationByHandle Lib "kernel32" ( ByVal hFile As HANDLE, ByRef FileInformation As BY_HANDLE_FILE_INFORMATION ) As BOOL Declare Function GetFileSize Lib "kernel32" (hFile As HANDLE, pFileSizeHigh As *DWord) As DWord 'Declare Function GetFileSizeEx Lib "kernel32" (hFile As HANDLE, pFileSizeHigh As *QWord) As BOOL Declare Function GetFileTime Lib "kernel32" (hFile As HANDLE, ByRef lpCreationTime As FILETIME, ByRef lpLastAccessTime As FILETIME, ByRef lpLastWriteTime As FILETIME) As BOOL Const FILE_TYPE_UNKNOWN = &H0000 Const FILE_TYPE_DISK = &H0001 Const FILE_TYPE_CHAR = &H0002 Const FILE_TYPE_PIPE = &H0003 Const FILE_TYPE_REMOTE = &H8000 Declare Function GetFileType Lib "kernel32" (hFile As HANDLE) As DWord Declare Function GetFullPathName Lib "kernel32" Alias _FuncName_GetFullPathName (lpFileName As PCSTR, nBufferLength As DWord, pBuffer As PSTR, lpFilePart As *DWord) As DWord Declare Function GetLastError Lib "kernel32" () As DWord Declare Sub GetLocalTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME) Declare Function GetLogicalDrives Lib "kernel32" () As DWord Declare Function GetLogicalDriveStrings Lib "kernel32" Alias _FuncName_GetLogicalDriveStrings (nBufferLength As DWord, pBuffer As PTSTR) As DWord Declare Function GetLongPathName Lib "kernel32" Alias _FuncName_GetLongPathName (lpszShortPath As LPCTSTR, lpszLongPath As LPTSTR, cchBuffer As DWord) As DWord Declare Function GetModuleFileName Lib "kernel32" Alias _FuncName_GetModuleFileName (hModule As HINSTANCE, lpFileName As PTSTR, nSize As DWord) As DWord Declare Function GetModuleHandle Lib "kernel32" Alias _FuncName_GetModuleHandle (lpModuleName As PTSTR) As HINSTANCE Declare Function GetOverlappedResult Lib "kernel32" ( hFile As HANDLE, ByRef Overlapped As OVERLAPPED, ByRef pNumberOfBytesTransferred As DWord, bWait As BOOL ) As BOOL Type SYSTEM_POWER_STATUS ACLineStatus As Byte BatteryFlag As Byte BatteryLifePercent As Byte Reserved1 As Byte BatteryLifeTime As Long BatteryFullLifeTime As Long End Type Declare Function GetSystemPowerStatus Lib "kernel32" (ByRef SystemPowerStatus As SYSTEM_POWER_STATUS) As Long Declare Function GetPriorityClass Lib "kernel32" (hProcess As HANDLE) As DWord Declare Function GetProcAddress Lib "kernel32" (hModule As HINSTANCE, pProcName As PCSTR) As DWord Declare Function GetProcessAffinityMask Lib "kernel32" ( hProcess As HANDLE, ByRef ProcessAffinityMask As ULONG_PTR, ByRef SystemAffinityMask As ULONG_PTR ) As BOOL Declare Function GetProcessHeap Lib "kernel32" () As HANDLE Declare Function GetShortPathName Lib "kernel32" Alias _FuncName_GetShortPathName ( pszLongPath As PCTSTR, pszShortPath As PTSTR, cchBuffer As DWord ) As DWord Declare Sub GetStartupInfo Lib "kernel32" Alias _FuncName_GetStartupInfo (ByRef StartupInfo As STARTUPINFO) Const STD_INPUT_HANDLE = -10 Const STD_OUTPUT_HANDLE = -11 Const STD_ERROR_HANDLE = -12 Declare Function GetStdHandle Lib "kernel32" (nStdHandle As DWord) As HANDLE Declare Function GetSystemDirectory Lib "kernel32" Alias _FuncName_GetSystemDirectory (pBuffer As PTSTR, uSize As DWord) As DWord Type SYSTEM_INFO dwOemId As DWord dwPageSize As DWord lpMinimumApplicationAddress As VoidPtr lpMaximumApplicationAddress As VoidPtr dwActiveProcessorMask As ULONG_PTR dwNumberOfProcessors As DWord dwProcessorType As DWord dwAllocationGranularity As DWord wProcessorLevel As Word wProcessorRevision As Word End Type Declare Sub GetSystemInfo Lib "kernel32" (ByRef SystemInfo As SYSTEM_INFO) Declare Sub GetSystemTime Lib "kernel32" (ByRef SystemTime As SYSTEMTIME) Declare Sub GetSystemTimeAsFileTime Lib "kernel32" (ByRef SystemTimeAsFileTime As FILETIME) Declare Function GetTempFileName Lib "kernel32" Alias _FuncName_GetTempFileName ( pPathName As PCTSTR, pPrefixString As PCTSTR, uUnique As DWord, pTempFileName As PTSTR ) As DWord Declare Function GetTempPath Lib "kernel32" Alias _FuncName_GetTempPath (nBufferLength As DWord, lpBuffer As PTSTR) As DWord Declare Function GetThreadContext Lib "kernel32" (hThread As HANDLE, ByRef Context As CONTEXT) As BOOL Const THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN Const THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST+1 Const THREAD_PRIORITY_NORMAL = 0 Const THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX Const THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST-1 Const THREAD_PRIORITY_ERROR_RETURN = LONG_MAX Const THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT Const THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE Declare Function GetThreadPriority Lib "kernel32" (hThread As HANDLE) As Long Declare Function GetThreadPriorityBoost Lib "kernel32" ( hThread As HANDLE, ByRef pDisablePriorityBoost As BOOL) As BOOL Declare Function GetTickCount Lib "kernel32" () As DWord Declare Function GetUserName Lib "advapi32" Alias _FuncName_GetUserName (pBuffer As PTSTR, ByRef nSize As DWord) As BOOL Declare Function GetVersionEx Lib "kernel32" Alias _FuncName_GetVersionEx (ByRef VersionInformation As OSVERSIONINFO) As BOOL Declare Function GetWindowsDirectory Lib "kernel32" Alias _FuncName_GetWindowsDirectory (pBuffer As PTSTR, uSize As DWord) As DWord Declare Function GlobalAlloc Lib "kernel32" (uFlags As DWord, dwBytes As SIZE_T) As HGLOBAL Declare Function GlobalFrags Lib "kernel32" (hMem As HGLOBAL) As DWord Declare Function GlobalFree Lib "kernel32" (hMem As HGLOBAL) As HGLOBAL Declare Function GlobalHandle Lib "kernel32" (pMem As VoidPtr) As HGLOBAL Declare Function GlobalLock Lib "kernel32" (hMem As HGLOBAL) As VoidPtr Type MEMORYSTATUS dwLength As DWord dwMemoryLoad As DWord dwTotalPhys As SIZE_T dwAvailPhys As SIZE_T dwTotalPageFile As SIZE_T dwAvailPageFile As SIZE_T dwTotalVirtual As SIZE_T dwAvailVirtual As SIZE_T End Type Declare Sub GlobalMemoryStatus Lib "kernel32" (ByRef lpMemStatus As MEMORYSTATUS) Declare Function GlobalReAlloc Lib "kernel32" (hMem As HGLOBAL, dwBytes As SIZE_T, uFlags As DWord) As HGLOBAL Declare Function GlobalSize Lib "kernel32" (hMem As HGLOBAL) As SIZE_T Declare Function GlobalUnlock Lib "kernel32" (hMem As HGLOBAL) As BOOL Declare Function HeapAlloc Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, dwBytes As SIZE_T) As VoidPtr Declare Function HeapCreate Lib "kernel32" (flOptions As DWord, dwInitialSize As SIZE_T, dwMaximumSize As SIZE_T) As HANDLE Declare Function HeapDestroy Lib "kernel32" (hHeap As HANDLE) As Long Declare Function HeapFree Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As Long Declare Function HeapReAlloc Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr, dwBytes As SIZE_T) As VoidPtr Declare Function HeapSize Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As SIZE_T Declare Function HeapValidate Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As BOOL Declare Sub InitializeCriticalSection Lib "kernel32" (ByRef CriticalSection As CRITICAL_SECTION) Declare Function IsBadReadPtr Lib "kernel32" (lp As VoidPtr, ucb As ULONG_PTR) As BOOL Declare Function IsBadWritePtr Lib "kernel32" (lp As VoidPtr, ucb As ULONG_PTR) As BOOL #ifdef _WIN64 Declare Function IsWow64Process Lib "kernel32" (hProcess As HANDLE, ByRef bWow64Process As BOOL) As BOOL #endif Declare Sub LeaveCriticalSection Lib "kernel32" (ByRef lpCriticalSection As CRITICAL_SECTION) Declare Function LocalAlloc Lib "kernel32" (uFlags As DWord, uBytes As SIZE_T) As HLOCAL Declare Function LocalFileTimeToFileTime Lib "kernel32" (ByRef lpLocalFileTime As FILETIME, ByRef lpFileTime As FILETIME) As BOOL Declare Function LocalFree Lib "kernel32" (hMem As HLOCAL) As HLOCAL Declare Function LocalHandle Lib "kernel32" (pMem As VoidPtr) As HLOCAL Declare Function LocalLock Lib "kernel32" (hMem As HLOCAL) As VoidPtr Declare Function LocalReAlloc Lib "kernel32" (hMem As HLOCAL, dwBytes As SIZE_T, uFlags As DWord) As HLOCAL Declare Function LocalSize Lib "kernel32" (hMem As HLOCAL) As SIZE_T Declare Function LocalUnlock Lib "kernel32" (hMem As HLOCAL) As BOOL Declare Function LockFile Lib "kernel32" (hFile As HANDLE, dwFileOffsetLow As DWord, dwFileOffsetHigh As DWord, nNumberOfBytesToLockLow As DWord, nNumberOfBytesToLockHigh As DWord) As BOOL Declare Function LoadLibrary Lib "kernel32" Alias _FuncName_LoadLibrary (pLibFileName As PCTSTR) As HINSTANCE Const DONT_RESOLVE_DLL_REFERENCES = &h00000001 Const LOAD_LIBRARY_AS_DATAFILE = &h00000002 Const LOAD_WITH_ALTERED_SEARCH_PATH = &h00000008 Const LOAD_IGNORE_CODE_AUTHZ_LEVEL = &h00000010 Declare Function LoadLibraryEx Lib "kernel32" Alias _FuncName_LoadLibraryEx (pLibFileName As PCTSTR, hFile As HANDLE, dwFlags As DWord) As HINSTANCE Declare Function lstrcat Lib "kernel32" Alias _FuncName_lstrcat (lpString1 As LPTSTR, lpString2 As LPCTSTR) As LPTSTR Declare Function lstrcmp Lib "kernel32" Alias _FuncName_lstrcmp (lpString1 As LPCTSTR, lpString2 As LPCTSTR) As Long Declare Function lstrcmpi Lib "kernel32" Alias _FuncName_lstrcmpi (lpString1 As LPCTSTR, lpString2 As LPCTSTR) As Long Declare Function lstrcpy Lib "kernel32" Alias _FuncName_lstrcpy (lpString1 As LPTSTR, lpString2 As LPCTSTR) As LPTSTR Declare Function lstrcpyn Lib "kernel32" Alias _FuncName_lstrcpyn (lpString1 As LPTSTR,ByVal lpString2 As LPCTSTR,ByVal iMaxLength As Long) As LPTSTR Declare Function lstrlenA Lib "kernel32" (lpString As LPCSTR) As Long Declare Function lstrlenW Lib "kernel32" (lpString As LPCWSTR) As Long #ifdef UNICODE Declare Function lstrlen Lib "kernel32" Alias "lstrlenW" (lpString As LPCWSTR) As Long #else Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (lpString As LPCSTR) As Long #endif Declare Sub memcpy Lib "kernel32" Alias "RtlMoveMemory" (pDest As VoidPtr, pSrc As VoidPtr, length As SIZE_T) Declare Function MoveFile Lib "kernel32" Alias _FuncName_MoveFile (lpExistingFileName As LPCTSTR, lpNewFileName As LPCTSTR) As BOOL Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As PVOID, pSrc As VoidPtr, length As SIZE_T) Declare Function MulDiv Lib "kernel32" ( nNumber As Long, nNumerator As Long, nDenominator As Long ) As Long Declare Function OpenEvent Lib "kernel32" Alias _FuncName_OpenEvent (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE Declare Function OpenMutex Lib "kernel32" Alias _FuncName_OpenMutex (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE Declare Function OpenSemaphore Lib "kernel32" Alias _FuncName_OpenSemaphore (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE Declare Function OpenProcess Lib "kernel32" (dwDesiredAccess As DWord, bInheritHandle As Long, dwProcessId As DWord) As HANDLE Declare Sub OutputDebugStringA Lib "kernel32" (pOutputString As PCSTR) Declare Sub OutputDebugStringW Lib "kernel32" (pOutputString As PCWSTR) #ifdef UNICODE Declare Sub OutputDebugString Lib "kernel32" Alias "OutputDebugStringW" (pOutputString As PCWSTR) #else Declare Sub OutputDebugString Lib "kernel32" Alias "OutputDebugStringA" (pOutputString As PCSTR) #endif Declare Function PulseEvent Lib "kernel32" (hEvent As HANDLE) As BOOL Declare Sub RaiseException Lib "kernel32" ( dwExceptionCode As DWord, dwExceptionFlags As DWord, NumberOfArguments As DWord, pArguments As *ULONG_PTR) Declare Function ReadFile Lib "kernel32" (hFile As HANDLE, lpBuffer As VoidPtr, nNumberOfBytesToRead As DWord, lpNumberOfBytesRead As *DWord, ByRef Overlapped As OVERLAPPED) As BOOL Declare Function ReadProcessMemory Lib "Kernel32" (hProcess As HANDLE, lpBaseAddress As VoidPtr, lpBuffer As VoidPtr, nSize As SIZE_T, lpNumberOfBytesRead As *SIZE_T) As BOOL Declare Function ReleaseMutex Lib "kernel32" (hMutex As HANDLE) As BOOL Declare Function ReleaseSemaphore Lib "kernel32" (hSemaphore As HANDLE, lReleaseCount As Long, ByRef lpPreviousCount As Long) As BOOL Declare Function RemoveDirectory Lib "kernel32" Alias _FuncName_RemoveDirectory (lpPathName As LPCTSTR) As BOOL Declare Function ResetEvent Lib "kernel32" (hEvent As HANDLE) As BOOL Declare Function ResumeThread Lib "kernel32" (hThread As HANDLE) As DWord Declare Function SetComputerName Lib "kernel32" Alias _FuncName_SetComputerName (lpComputerName As LPCTSTR) As BOOL Declare Function SetCurrentDirectory Lib "kernel32" Alias _FuncName_SetCurrentDirectory (lpPathName As LPCTSTR) As BOOL Declare 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 Declare Function SetEndOfFile Lib "kernel32" (hFile As HANDLE) As BOOL Declare Function SetEnvironmentVariable Lib "kernel32" Alias _FuncName_SetEnvironmentVariable (lpName As LPCTSTR, lpValue As LPTSTR) As BOOL Const SEM_FAILCRITICALERRORS = &h0001 Const SEM_NOGPFAULTERRORBOX = &h0002 Const SEM_NOALIGNMENTFAULTEXCEPT = &h0004 Const SEM_NOOPENFILEERRORBOX = &h8000 Declare Function SetErrorMode Lib "kernel32" (uMode As DWord) As DWord Declare Function SetEvent Lib "kernel32" (hEvent As HANDLE) As BOOL Declare Function SetFileAttributes Lib "kernel32" Alias _FuncName_SetFileAttributes (lpFileName As LPCTSTR, dwFileAttributes As DWord) As BOOL Const FILE_BEGIN = 0 Const FILE_CURRENT = 1 Const FILE_END = 2 Declare Function SetFilePointer Lib "kernel32" (hFile As HANDLE, lDistanceToMove As Long, lpDistanceToMoveHigh As *Long, dwMoveMethod As DWord) As DWord Declare Function SetFileTime Lib "kernel32" (hFile As HANDLE, ByRef lpCreationTime As FILETIME, ByRef lpLastAccessTime As FILETIME, ByRef lpLastWriteTime As FILETIME) As BOOL Declare Sub SetLastError Lib "kernel32" (dwErrCode As DWord) Declare Sub SetLastErrorEx Lib "kernel32" (dwErrCode As DWord, dwType As DWord) Declare Function SetLocalTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME) As BOOL Declare Function SetPriorityClass Lib "kernel32" (hProcess As HANDLE, dwPriorityClass As DWord) As BOOL Declare Function SetThreadContext Lib "kernel32" (hThread As HANDLE, ByRef Context As CONTEXT) As BOOL Declare Function SetThreadPriority Lib "kernel32" (hThread As HANDLE, nPriority As Long) As BOOL Declare Function SetThreadPriorityBoost Lib "kernel32" ( hThread As HANDLE, DisablePriorityBoost As BOOL ) As BOOL TypeDef PTOP_LEVEL_EXCEPTION_FILTER = *Function(ByRef ExceptionInfo As EXCEPTION_POINTERS) As Long Declare Function SetUnhandledExceptionFilter Lib "kernel32" (pTopLevelExceptionFilter As PTOP_LEVEL_EXCEPTION_FILTER) As PTOP_LEVEL_EXCEPTION_FILTER Const INFINITE = &HFFFFFFFF Declare Sub Sleep Lib "kernel32" (dwMilliseconds As DWord) Declare Function SleepEx Lib "kernel32" (dwMilliseconds As DWord, bAlertable As BOOL) As DWord Declare Function SuspendThread Lib "kernel32" (hThread As HANDLE) As DWord Declare Function SystemTimeToFileTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME, ByRef lpFileTime As FILETIME) As BOOL Declare Function TerminateProcess Lib "kernel32" (hProcess As HANDLE, dwExitCode As DWord) As BOOL Declare Function TerminateThread Lib "kernel32" (hThread As HANDLE, dwExitCode As DWord) As BOOL Const TLS_OUT_OF_INDEXES = &hffffffff As DWord Declare Function TlsAlloc Lib "kernel32" () As DWord Declare Function TlsFree Lib "kernel32" (dwTlsIndex As DWord) As BOOL Declare Function TlsGetValue Lib "kernel32" (dwTlsIndex As DWord) As VoidPtr Declare Function TlsSetValue Lib "kernel32" (dwTlsIndex As DWord, pTlsValue As VoidPtr) As BOOL Declare Function UnlockFile Lib "kernel32" (hFile As HANDLE, dwFileOffsetLow As DWord, dwFileOffsetHigh As DWord, nNumberOfBytesToUnlockLow As DWord, nNumberOfBytesToUnlockHigh As DWord) As BOOL Declare Function UnhandledExceptionFilter Lib "kernel32" (ByRef ExceptionInfo As EXCEPTION_POINTERS) As Long Declare Function VirtualAlloc Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T, flAllocationType As DWord, flProtect As DWord) As VoidPtr Declare Function VirtualFree Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T, dwFreeType As DWord) As BOOL Declare Function VirtualLock Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T) As BOOL Declare Function VirtualProtect Lib "kernel32" ( pAddress As VoidPtr, Size As SIZE_T, flNewProtect As DWord, ByRef flOldProtect As DWord ) As BOOL Declare Function VirtualProtectEx Lib "kernel32" ( hProcess As HANDLE, pAddress As VoidPtr, Size As SIZE_T, flNewProtect As DWord, ByRef flOldProtect As DWord ) As BOOL Declare Function VirtualQuery Lib "kernel32" ( pAddress As VoidPtr, ByRef mbi As MEMORY_BASIC_INFORMATION, Length As SIZE_T ) As SIZE_T Declare Function VirtualQueryEx Lib "kernel32" ( hProcess As HANDLE, pAddress As VoidPtr, ByRef mbi As MEMORY_BASIC_INFORMATION, Length As SIZE_T ) As SIZE_T Declare Function VirtualUnlock Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T) As BOOL Declare Function WaitForMultipleObjects Lib "kernel32" (nCount As DWord, pHandles As *HANDLE, fWaitAll As BOOL, dwMilliseconds As DWord) As DWord Declare Function WaitForMultipleObjectsEx Lib "kernel32" (nCount As DWord, pHandles As *HANDLE, fWaitAll As BOOL, dwMilliseconds As DWord, bAlertable As BOOL) As DWord Declare Function WaitForSingleObject Lib "kernel32" (hHandle As HANDLE, dwMilliseconds As DWord) As DWord Declare Function WaitForSingleObjectEx Lib "kernel32" (hHandle As HANDLE, dwMilliseconds As DWord, bAlertable As BOOL) As DWord Declare Function WriteFile Lib "kernel32" (hFile As HANDLE, lpBuffer As VoidPtr, nNumberOfBytesToWrite As DWord, lpNumberOfBytesWritten As *DWord, ByRef pOverlapped As OVERLAPPED) As BOOL Declare Sub ZeroMemory Lib "kernel32" Alias "RtlZeroMemory" (Destination As VoidPtr, dwLength As DWord) ' ' Wait functions' results. ' Const WAIT_FAILED = (&hFFFFFFFF As DWord) Const WAIT_OBJECT_0 = ((STATUS_WAIT_0 ) + 0) Const WAIT_ABANDONED = ((STATUS_ABANDONED_WAIT_0 ) + 0) Const WAIT_ABANDONED_0 = ((STATUS_ABANDONED_WAIT_0 ) + 0) Const WAIT_IO_COMPLETION = STATUS_USER_APC Declare Function FindResource Lib "kernel32" Alias _FuncName_FindResource (hInstance As HINSTANCE, lpName As LPCTSTR, lpType As LPCTSTR) As HRSRC Declare Function LoadResource Lib "kernel32" (hModule As HMODULE, hResInfo As HRSRC) As HGLOBAL Declare Function FreeResource Lib "kernel32" (hResData As HGLOBAL) As BOOL Declare Function LockResource Lib "kernel32" (hResData As HGLOBAL) As VoidPtr Declare Function SizeofResource Lib "kernel32" (hModule As HANDLE, hResInfo As HRSRC) As DWord Declare Function ExpandEnvironmentStrings Lib "kernel32" Alias _FuncName_ExpandEnvironmentStrings (lpSrc As LPCTSTR, lpDst As LPTSTR, nSize As DWord) As DWord Type DCB DCBlength As DWord BaudRate As DWord fBitFields As DWord wReserved As Word XonLim As Word XoffLim As Word ByteSize As Byte Parity As Byte StopBits As Byte XonChar As CHAR XoffChar As CHAR ErrorChar As CHAR EofChar As CHAR EvtChar As CHAR wReserved1 As Word End Type Type COMMTIMEOUTS ReadIntervalTimeout As DWord ReadTotalTimeoutMultiplier As DWord ReadTotalTimeoutConstant As DWord WriteTotalTimeoutMultiplier As DWord WriteTotalTimeoutConstant As DWord End Type Type COMSTAT fCoBitFlds As Long 'See Comment in Win32API.Txt cbInQue As DWord cbOutQue As DWord End Type Declare Function SetCommState Lib "kernel32" (hCommDev As HANDLE, ByRef dcb As DCB) As BOOL Declare Function SetCommTimeouts Lib "kernel32" (hFile As HANDLE ,ByRef pCommTimeouts As COMMTIMEOUTS) As BOOL Declare Function ClearCommError Lib "kernel32" (hCommDevs As HANDLE, ByRef Errors As DWord, ByRef Stat As COMSTAT) As BOOL Declare Function EscapeCommFunction Lib "kernel32" (nCid As HANDLE, ByVal nFunc As DWord) As BOOL Declare Function GetCommModemStatus Lib "kernel32" (hFile As HANDLE, ByRef ModemStat As DWord) As BOOL Declare Function SetCommMask Lib "kernel32" (hFile As HANDLE, dwEvtMask As DWord) As BOOL Declare Function WaitCommEvent Lib "kernel32" (hFile As HANDLE, ByRef EvtMask As DWord, lpOverlapped As *OVERLAPPED) As BOOL Const PURGE_TXABORT = &H0001 Const PURGE_RXABORT = &H0002 Const PURGE_TXCLEAR = &H0004 Const PURGE_RXCLEAR = &H0008 Declare Function PurgeComm Lib "kernel32" (hFile As HANDLE, dwFlags As DWord) As BOOL Declare Function OpenProcessToken Lib "advapi32" (ProcessHandle As HANDLE, DesiredAccess As DWord, ByRef TokenHandle As HANDLE) As BOOL Declare Function LookupPrivilegeValue Lib "advapi32" Alias _FuncName_LookupPrivilegeValue (lpSystemName As LPCTSTR, lpName As LPCTSTR, ByRef Luid As LUID) As Long Declare Function AdjustTokenPrivileges Lib "advapi32" (TokenHandle As Long, DisableAllPrivileges As Long,_ ByRef NewState As TOKEN_PRIVILEGES, BufferLength As Long, ByRef PreviousState As TOKEN_PRIVILEGES, ByRef ReturnLength As Long) As Long Declare Function AddAtom Lib "kernel32" Alias _FuncName_AddAtom (lpString As LPCTSTR) As ATOM Declare Function DeleteAtom Lib "kernel32" (nAtom As ATOM) As ATOM Declare Function FindAtom Lib "kernel32" Alias _FuncName_AddAtom (lpString As LPCTSTR) As ATOM Declare Function GetAtomName Lib "kernel32" Alias _FuncName_GetAtomName (nAtom As ATOM, lpBuffer As LPCTSTR, nSize As Long) As DWord Declare Function GlobalAddAtom Lib "kernel32" Alias _FuncName_GlobalAddAtom (lpString As LPCTSTR) As ATOM Declare Function GlobalDeleteAtom Lib "kernel32" (a As ATOM) As ATOM Declare Function GlobalFindAtom Lib "kernel32" Alias _FuncName_GlobalAddAtom (lpString As LPCTSTR) As ATOM Declare Function GlobalGetAtomName Lib "kernel32" Alias _FuncName_GlobalGetAtomName (nAtom As ATOM, lpBuffer As LPCTSTR, nSize As Long) As DWord Declare Function InitAtomTable Lib "kernel32" (nSize As DWord) As BOOL Const MAXINTATOM = &hC000 Const MAKEINTATOM(i) = (i As Word As ULONG_PTR As LPTSTR) Const INVALID_ATOM = 0 As ATOM '#if _WIN32_WINNT > &h0500 TypeDef WAITORTIMERCALLBACK = WAITORTIMERCALLBACKFUNC '#endif