Index: Include/api_system.sbp
===================================================================
--- Include/api_system.sbp	(revision 1)
+++ Include/api_system.sbp	(revision 35)
@@ -251,7 +251,4 @@
 #endif
 
-' Overlapped I/O operation is in progress.
-Const ERROR_IO_PENDING = 997
-
 ' Global Memory Flags
 Const GMEM_FIXED =          &H0000
@@ -306,6 +303,6 @@
 
 'Event
-Const EVENT_MODIFY_STATE = &H0002 
-Const EVENT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &H3) 
+Const EVENT_MODIFY_STATE = &H0002
+Const EVENT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &H3)
 
 'Mutex
@@ -314,6 +311,6 @@
 
 'Semaphore
-Const SEMAPHORE_MODIFY_STATE = &H0002 
-Const SEMAPHORE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &H3) 
+Const SEMAPHORE_MODIFY_STATE = &H0002
+Const SEMAPHORE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &H3)
 
 'Timer
@@ -348,5 +345,5 @@
 Const CSTR_EQUAL =        2
 Const CSTR_GREATER_THAN = 3
-Declare Function CompareString Lib "kernel32" Alias "CompareStringA" (Locale As LCID, dwCmpFlags As DWord, lpString1 As PSTR, cchCount1 As Long, lpString2 As PSTR, cchCount2 As Long) As Long
+Declare Function CompareString Lib "kernel32" Alias "CompareStringA" (Locale As LCID, dwCmpFlags As DWord, pString1 As PCSTR, cchCount1 As Long, pString2 As PCSTR, cchCount2 As Long) As Long
 
 Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (lpExistingFileName As LPCSTR, lpNewFileName As LPCSTR, bFailIfExists As BOOL) As BOOL
@@ -531,4 +528,5 @@
 Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (hFindFile As HANDLE, ByRef lpFindFildData 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
@@ -619,9 +617,14 @@
 Declare Function GetPriorityClass Lib "kernel32" (hProcess As HANDLE) As DWord
 Declare Function GetProcAddress Lib "kernel32" (hModule As HINSTANCE, lpProcName As BytePtr) 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 "GetShortPathNameA" (
-  pszLongPath As PCSTR,
-  lpszShortPath As PSTR,
-  cchBuffer As DWord
+	pszLongPath As PCSTR,
+	pszShortPath As PSTR,
+	cchBuffer As DWord
 ) As DWord
 
@@ -633,5 +636,5 @@
 Declare Function GetStdHandle Lib "kernel32" (nStdHandle As DWord) As HANDLE
 
-Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (lpBuffer As BytePtr, uSize As DWord) As DWord
+Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (pBuffer As PSTR, uSize As DWord) As DWord
 
 Type SYSTEM_INFO
@@ -686,5 +689,5 @@
 
 Declare Function GetUserDefaultLCID Lib "kernel32" () As LCID
-Declare Function GetUserName Lib "advapi32" Alias "GetUserNameA" (lpBuffer As BytePtr, ByRef nSize As DWord) As BOOL
+Declare Function GetUserName Lib "advapi32" Alias "GetUserNameA" (pBuffer As PSTR, ByRef nSize As DWord) As BOOL
 
 Const VER_PLATFORM_WIN32s        = 0
@@ -701,7 +704,9 @@
 Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (ByRef lpVersionInformation As OSVERSIONINFO) As BOOL
 
-Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (lpBuffer As BytePtr, uSize As DWord) As DWord
+Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (pBuffer As PSTR, 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
 
@@ -753,6 +758,11 @@
 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 DWord, dwFileOffsetLow As DWord, dwFileOffsetHigh As DWord, nNumberOfBytesToLockLow As DWord, nNumberOfBytesToLockHigh As DWord) As BOOL
-Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (lpLibFileName As BytePtr) As HINSTANCE
+Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (pLibFileName As PCSTR) As HINSTANCE
 
 Const DONT_RESOLVE_DLL_REFERENCES   = &h00000001
@@ -876,5 +886,5 @@
 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
-Declare Sub TlsAlloc Lib "kernel32" ()
+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
@@ -907,4 +917,37 @@
 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
+Type MEMORY_BASIC_INFORMATION
+	BaseAddress As VoidPtr
+	AllocationBase As VoidPtr
+	AllocationProtect As DWord
+	RegionSize As SIZE_T
+	State As DWord
+	Protect As DWord
+	MBIType As DWord
+End Type
+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
@@ -931,6 +974,4 @@
 Declare Function WriteFile Lib "kernel32" (hFile As HANDLE, lpBuffer As VoidPtr, nNumberOfBytesToWrite As DWord, lpNumberOfBytesWritten As DWordPtr, ByRef lpOverlapped As OVERLAPPED) As BOOL
 Declare Sub ZeroMemory Lib "kernel32" Alias "RtlZeroMemory" (Destination As VoidPtr, dwLength As DWord)
-
-
 
 Const MAKELCID(lgid, srtid) = ((((srtid As Word) As DWord)<<16) or ((lgid As Word) As DWord))
@@ -1126,6 +1167,6 @@
 
 
-Const LANG_SYSTEM_DEFAULT =  (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
-Const LANG_USER_DEFAULT   =  (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
+Const LANG_SYSTEM_DEFAULT = (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
+Const LANG_USER_DEFAULT   = (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
 
 
@@ -1166,6 +1207,4 @@
 
 Const WAIT_IO_COMPLETION = &h000000C0 'STATUS_USER_APC
-Const WAIT_TIMEOUT = &h000000C0
-
 
 #endif '_INC_SYSTEM
