2 /* Windows is a registered trademark of Microsoft Corporation in the United
3 States and other countries. */
5 module core.sys.windows.windows;
12 static assert(0); // Windows only
20 alias USHORT *PUSHORT;
34 mixin("alias const(CHAR) *LPCSTR;");
35 mixin("alias const(CHAR) *PCSTR;");
42 alias LPSTR LPTCH, PTCH;
43 alias LPSTR PTSTR, LPTSTR;
49 mixin("alias const(WCHAR)* LPCWSTR, PCWSTR;");
53 alias WCHAR* LPCWSTR, PCWSTR;
79 // ULONG_PTR must be able to store a pointer as an integral type
85 alias ulong ULONG_PTR;
86 alias long * PINT_PTR;
87 alias ulong * PUINT_PTR;
88 alias long * PLONG_PTR;
89 alias ulong * PULONG_PTR;
98 alias uint * PUINT_PTR;
99 alias int * PLONG_PTR;
100 alias uint * PULONG_PTR;
103 typedef void *HANDLE;
105 alias HANDLE HGLOBAL;
109 alias HANDLE HINSTANCE;
110 alias HINSTANCE HMODULE;
113 alias HANDLE HGDIOBJ;
115 alias HANDLE HBITMAP;
117 alias HANDLE HCOLORSPACE;
121 alias HANDLE HENHMETAFILE;
125 alias HANDLE HMETAFILE;
126 alias HANDLE HPALETTE;
132 alias HANDLE HWINSTA;
138 alias DWORD ACCESS_MASK;
139 alias ACCESS_MASK *PACCESS_MASK;
140 alias ACCESS_MASK REGSAM;
142 alias int (*FARPROC)();
148 alias DWORD COLORREF;
149 alias DWORD *LPCOLORREF;
153 { // Properly prototyped versions
154 alias BOOL function(HWND, UINT, WPARAM, LPARAM) DLGPROC;
155 alias VOID function(HWND, UINT, UINT, DWORD) TIMERPROC;
156 alias BOOL function(HDC, LPARAM, int) GRAYSTRINGPROC;
157 alias BOOL function(HWND, LPARAM) WNDENUMPROC;
158 alias LRESULT function(int code, WPARAM wParam, LPARAM lParam) HOOKPROC;
159 alias VOID function(HWND, UINT, DWORD, LRESULT) SENDASYNCPROC;
160 alias BOOL function(HWND, LPCSTR, HANDLE) PROPENUMPROCA;
161 alias BOOL function(HWND, LPCWSTR, HANDLE) PROPENUMPROCW;
162 alias BOOL function(HWND, LPSTR, HANDLE, DWORD) PROPENUMPROCEXA;
163 alias BOOL function(HWND, LPWSTR, HANDLE, DWORD) PROPENUMPROCEXW;
164 alias int function(LPSTR lpch, int ichCurrent, int cch, int code)
166 alias int function(LPWSTR lpch, int ichCurrent, int cch, int code)
168 alias BOOL function(HDC hdc, LPARAM lData, WPARAM wData, int cx, int cy)
173 alias FARPROC DLGPROC;
174 alias FARPROC TIMERPROC;
175 alias FARPROC GRAYSTRINGPROC;
176 alias FARPROC WNDENUMPROC;
177 alias FARPROC HOOKPROC;
178 alias FARPROC SENDASYNCPROC;
179 alias FARPROC EDITWORDBREAKPROCA;
180 alias FARPROC EDITWORDBREAKPROCW;
181 alias FARPROC PROPENUMPROCA;
182 alias FARPROC PROPENUMPROCW;
183 alias FARPROC PROPENUMPROCEXA;
184 alias FARPROC PROPENUMPROCEXW;
185 alias FARPROC DRAWSTATEPROC;
190 WORD HIWORD(int l) { return cast(WORD)((l >> 16) & 0xFFFF); }
191 WORD LOWORD(int l) { return cast(WORD)l; }
192 bool FAILED(int status) { return status < 0; }
193 bool SUCCEEDED(int Status) { return Status >= 0; }
205 HINSTANCE_ERROR = 32,
211 ERROR_INVALID_FUNCTION = 1,
212 ERROR_FILE_NOT_FOUND = 2,
213 ERROR_PATH_NOT_FOUND = 3,
214 ERROR_TOO_MANY_OPEN_FILES = 4,
215 ERROR_ACCESS_DENIED = 5,
216 ERROR_INVALID_HANDLE = 6,
217 ERROR_NO_MORE_FILES = 18,
218 ERROR_MORE_DATA = 234,
219 ERROR_NO_MORE_ITEMS = 259,
224 DLL_PROCESS_ATTACH = 1,
225 DLL_THREAD_ATTACH = 2,
226 DLL_THREAD_DETACH = 3,
227 DLL_PROCESS_DETACH = 0,
240 READ_CONTROL = 0x00020000,
241 WRITE_DAC = 0x00040000,
242 WRITE_OWNER = 0x00080000,
243 SYNCHRONIZE = 0x00100000,
245 STANDARD_RIGHTS_REQUIRED = 0x000F0000,
246 STANDARD_RIGHTS_READ = READ_CONTROL,
247 STANDARD_RIGHTS_WRITE = READ_CONTROL,
248 STANDARD_RIGHTS_EXECUTE = READ_CONTROL,
249 STANDARD_RIGHTS_ALL = 0x001F0000,
250 SPECIFIC_RIGHTS_ALL = 0x0000FFFF,
251 ACCESS_SYSTEM_SECURITY = 0x01000000,
252 MAXIMUM_ALLOWED = 0x02000000,
254 GENERIC_READ = 0x80000000,
255 GENERIC_WRITE = 0x40000000,
256 GENERIC_EXECUTE = 0x20000000,
257 GENERIC_ALL = 0x10000000,
262 FILE_SHARE_READ = 0x00000001,
263 FILE_SHARE_WRITE = 0x00000002,
264 FILE_SHARE_DELETE = 0x00000004,
265 FILE_ATTRIBUTE_READONLY = 0x00000001,
266 FILE_ATTRIBUTE_HIDDEN = 0x00000002,
267 FILE_ATTRIBUTE_SYSTEM = 0x00000004,
268 FILE_ATTRIBUTE_DIRECTORY = 0x00000010,
269 FILE_ATTRIBUTE_ARCHIVE = 0x00000020,
270 FILE_ATTRIBUTE_NORMAL = 0x00000080,
271 FILE_ATTRIBUTE_TEMPORARY = 0x00000100,
272 FILE_ATTRIBUTE_COMPRESSED = 0x00000800,
273 FILE_ATTRIBUTE_OFFLINE = 0x00001000,
274 FILE_NOTIFY_CHANGE_FILE_NAME = 0x00000001,
275 FILE_NOTIFY_CHANGE_DIR_NAME = 0x00000002,
276 FILE_NOTIFY_CHANGE_ATTRIBUTES = 0x00000004,
277 FILE_NOTIFY_CHANGE_SIZE = 0x00000008,
278 FILE_NOTIFY_CHANGE_LAST_WRITE = 0x00000010,
279 FILE_NOTIFY_CHANGE_LAST_ACCESS = 0x00000020,
280 FILE_NOTIFY_CHANGE_CREATION = 0x00000040,
281 FILE_NOTIFY_CHANGE_SECURITY = 0x00000100,
282 FILE_ACTION_ADDED = 0x00000001,
283 FILE_ACTION_REMOVED = 0x00000002,
284 FILE_ACTION_MODIFIED = 0x00000003,
285 FILE_ACTION_RENAMED_OLD_NAME = 0x00000004,
286 FILE_ACTION_RENAMED_NEW_NAME = 0x00000005,
287 FILE_CASE_SENSITIVE_SEARCH = 0x00000001,
288 FILE_CASE_PRESERVED_NAMES = 0x00000002,
289 FILE_UNICODE_ON_DISK = 0x00000004,
290 FILE_PERSISTENT_ACLS = 0x00000008,
291 FILE_FILE_COMPRESSION = 0x00000010,
292 FILE_VOLUME_IS_COMPRESSED = 0x00008000,
297 MAILSLOT_NO_MESSAGE = cast(DWORD)-1,
298 MAILSLOT_WAIT_FOREVER = cast(DWORD)-1,
303 FILE_FLAG_WRITE_THROUGH = 0x80000000,
304 FILE_FLAG_OVERLAPPED = 0x40000000,
305 FILE_FLAG_NO_BUFFERING = 0x20000000,
306 FILE_FLAG_RANDOM_ACCESS = 0x10000000,
307 FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000,
308 FILE_FLAG_DELETE_ON_CLOSE = 0x04000000,
309 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000,
310 FILE_FLAG_POSIX_SEMANTICS = 0x01000000,
319 TRUNCATE_EXISTING = 5,
327 HANDLE INVALID_HANDLE_VALUE = cast(HANDLE)-1,
328 DWORD INVALID_SET_FILE_POINTER = cast(DWORD)-1,
329 DWORD INVALID_FILE_SIZE = cast(DWORD)0xFFFFFFFF,
334 const HANDLE INVALID_HANDLE_VALUE = cast(HANDLE)-1;
338 INVALID_SET_FILE_POINTER = cast(DWORD)-1,
339 INVALID_FILE_SIZE = cast(DWORD)0xFFFFFFFF,
351 struct SECURITY_ATTRIBUTES {
353 void *lpSecurityDescriptor;
357 alias SECURITY_ATTRIBUTES* PSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES;
361 DWORD dwHighDateTime;
363 alias FILETIME* PFILETIME, LPFILETIME;
365 struct WIN32_FIND_DATA {
366 DWORD dwFileAttributes;
367 FILETIME ftCreationTime;
368 FILETIME ftLastAccessTime;
369 FILETIME ftLastWriteTime;
374 char cFileName[MAX_PATH];
375 char cAlternateFileName[ 14 ];
378 struct WIN32_FIND_DATAW {
379 DWORD dwFileAttributes;
380 FILETIME ftCreationTime;
381 FILETIME ftLastAccessTime;
382 FILETIME ftLastWriteTime;
387 wchar cFileName[ 260 ];
388 wchar cAlternateFileName[ 14 ];
398 alias _LIST_ENTRY LIST_ENTRY;
400 struct _RTL_CRITICAL_SECTION_DEBUG
403 WORD CreatorBackTraceIndex;
404 _RTL_CRITICAL_SECTION *CriticalSection;
405 LIST_ENTRY ProcessLocksList;
407 DWORD ContentionCount;
410 alias _RTL_CRITICAL_SECTION_DEBUG RTL_CRITICAL_SECTION_DEBUG;
412 struct _RTL_CRITICAL_SECTION
414 RTL_CRITICAL_SECTION_DEBUG * DebugInfo;
417 // The following three fields control entering and exiting the critical
418 // section for the resource
423 HANDLE OwningThread; // from the thread's ClientId->UniqueThread
424 HANDLE LockSemaphore;
425 ULONG_PTR SpinCount; // force size on 64-bit systems when packed
427 alias _RTL_CRITICAL_SECTION CRITICAL_SECTION;
432 STD_INPUT_HANDLE = cast(DWORD)-10,
433 STD_OUTPUT_HANDLE = cast(DWORD)-11,
434 STD_ERROR_HANDLE = cast(DWORD)-12,
439 BOOL SetCurrentDirectoryA(LPCSTR lpPathName);
440 BOOL SetCurrentDirectoryW(LPCWSTR lpPathName);
441 DWORD GetCurrentDirectoryA(DWORD nBufferLength, LPSTR lpBuffer);
442 DWORD GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer);
443 BOOL CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
444 BOOL CreateDirectoryW(LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
445 BOOL CreateDirectoryExA(LPCSTR lpTemplateDirectory, LPCSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
446 BOOL CreateDirectoryExW(LPCWSTR lpTemplateDirectory, LPCWSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
447 BOOL RemoveDirectoryA(LPCSTR lpPathName);
448 BOOL RemoveDirectoryW(LPCWSTR lpPathName);
450 BOOL CloseHandle(HANDLE hObject);
452 HANDLE CreateFileA(in char* lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
453 SECURITY_ATTRIBUTES *lpSecurityAttributes, DWORD dwCreationDisposition,
454 DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
455 HANDLE CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
456 SECURITY_ATTRIBUTES *lpSecurityAttributes, DWORD dwCreationDisposition,
457 DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
459 BOOL DeleteFileA(in char *lpFileName);
460 BOOL DeleteFileW(LPCWSTR lpFileName);
462 BOOL FindClose(HANDLE hFindFile);
463 HANDLE FindFirstFileA(in char *lpFileName, WIN32_FIND_DATA* lpFindFileData);
464 HANDLE FindFirstFileW(in LPCWSTR lpFileName, WIN32_FIND_DATAW* lpFindFileData);
465 BOOL FindNextFileA(HANDLE hFindFile, WIN32_FIND_DATA* lpFindFileData);
466 BOOL FindNextFileW(HANDLE hFindFile, WIN32_FIND_DATAW* lpFindFileData);
467 BOOL GetExitCodeThread(HANDLE hThread, DWORD *lpExitCode);
468 DWORD GetLastError();
469 DWORD GetFileAttributesA(in char *lpFileName);
470 DWORD GetFileAttributesW(in wchar *lpFileName);
471 DWORD GetFileSize(HANDLE hFile, DWORD *lpFileSizeHigh);
472 BOOL CopyFileA(LPCSTR lpExistingFileName, LPCSTR lpNewFileName, BOOL bFailIfExists);
473 BOOL CopyFileW(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, BOOL bFailIfExists);
474 BOOL MoveFileA(in char *from, in char *to);
475 BOOL MoveFileW(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName);
476 BOOL ReadFile(HANDLE hFile, void *lpBuffer, DWORD nNumberOfBytesToRead,
477 DWORD *lpNumberOfBytesRead, OVERLAPPED *lpOverlapped);
478 DWORD SetFilePointer(HANDLE hFile, LONG lDistanceToMove,
479 LONG *lpDistanceToMoveHigh, DWORD dwMoveMethod);
480 BOOL WriteFile(HANDLE hFile, in void *lpBuffer, DWORD nNumberOfBytesToWrite,
481 DWORD *lpNumberOfBytesWritten, OVERLAPPED *lpOverlapped);
482 DWORD GetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize);
483 HANDLE GetStdHandle(DWORD nStdHandle);
484 BOOL SetStdHandle(DWORD nStdHandle, HANDLE hHandle);
487 struct MEMORYSTATUS {
492 DWORD dwTotalPageFile;
493 DWORD dwAvailPageFile;
494 DWORD dwTotalVirtual;
495 DWORD dwAvailVirtual;
497 alias MEMORYSTATUS *LPMEMORYSTATUS;
499 HMODULE LoadLibraryA(LPCSTR lpLibFileName);
500 FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName);
502 BOOL FreeLibrary(HMODULE hLibModule);
503 void FreeLibraryAndExitThread(HMODULE hLibModule, DWORD dwExitCode);
504 BOOL DisableThreadLibraryCalls(HMODULE hLibModule);
507 // Registry Specific Access Rights.
512 KEY_QUERY_VALUE = 0x0001,
513 KEY_SET_VALUE = 0x0002,
514 KEY_CREATE_SUB_KEY = 0x0004,
515 KEY_ENUMERATE_SUB_KEYS = 0x0008,
517 KEY_CREATE_LINK = 0x0020,
519 KEY_READ = cast(int)((STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY) & ~SYNCHRONIZE),
520 KEY_WRITE = cast(int)((STANDARD_RIGHTS_WRITE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY) & ~SYNCHRONIZE),
521 KEY_EXECUTE = cast(int)(KEY_READ & ~SYNCHRONIZE),
522 KEY_ALL_ACCESS = cast(int)((STANDARD_RIGHTS_ALL | KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY | KEY_CREATE_LINK) & ~SYNCHRONIZE),
526 // Key creation/open disposition
531 REG_CREATED_NEW_KEY = 0x00000001, // New Registry Key created
532 REG_OPENED_EXISTING_KEY = 0x00000002, // Existing Key opened
537 // Predefined Value Types.
541 REG_NONE = 0, // No value type
542 REG_SZ = 1, // Unicode nul terminated string
543 REG_EXPAND_SZ = 2, // Unicode nul terminated string
544 // (with environment variable references)
545 REG_BINARY = 3, // Free form binary
546 REG_DWORD = 4, // 32-bit number
547 REG_DWORD_LITTLE_ENDIAN = 4, // 32-bit number (same as REG_DWORD)
548 REG_DWORD_BIG_ENDIAN = 5, // 32-bit number
549 REG_LINK = 6, // Symbolic Link (unicode)
550 REG_MULTI_SZ = 7, // Multiple Unicode strings
551 REG_RESOURCE_LIST = 8, // Resource list in the resource map
552 REG_FULL_RESOURCE_DESCRIPTOR = 9, // Resource list in the hardware description
553 REG_RESOURCE_REQUIREMENTS_LIST = 10,
555 REG_QWORD_LITTLE_ENDIAN = 11,
564 MB_OKCANCEL = 0x00000001,
565 MB_ABORTRETRYIGNORE = 0x00000002,
566 MB_YESNOCANCEL = 0x00000003,
567 MB_YESNO = 0x00000004,
568 MB_RETRYCANCEL = 0x00000005,
571 MB_ICONHAND = 0x00000010,
572 MB_ICONQUESTION = 0x00000020,
573 MB_ICONEXCLAMATION = 0x00000030,
574 MB_ICONASTERISK = 0x00000040,
577 MB_USERICON = 0x00000080,
578 MB_ICONWARNING = MB_ICONEXCLAMATION,
579 MB_ICONERROR = MB_ICONHAND,
582 MB_ICONINFORMATION = MB_ICONASTERISK,
583 MB_ICONSTOP = MB_ICONHAND,
585 MB_DEFBUTTON1 = 0x00000000,
586 MB_DEFBUTTON2 = 0x00000100,
587 MB_DEFBUTTON3 = 0x00000200,
589 MB_DEFBUTTON4 = 0x00000300,
592 MB_APPLMODAL = 0x00000000,
593 MB_SYSTEMMODAL = 0x00001000,
594 MB_TASKMODAL = 0x00002000,
596 MB_HELP = 0x00004000, // Help Button
599 MB_NOFOCUS = 0x00008000,
600 MB_SETFOREGROUND = 0x00010000,
601 MB_DEFAULT_DESKTOP_ONLY = 0x00020000,
604 MB_TOPMOST = 0x00040000,
605 MB_RIGHT = 0x00080000,
606 MB_RTLREADING = 0x00100000,
609 MB_TYPEMASK = 0x0000000F,
610 MB_ICONMASK = 0x000000F0,
611 MB_DEFMASK = 0x00000F00,
612 MB_MODEMASK = 0x00003000,
613 MB_MISCMASK = 0x0000C000,
617 int MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);
618 int MessageBoxExA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType, WORD wLanguageId);
625 HKEY_CLASSES_ROOT = cast(HKEY)(0x80000000),
626 HKEY_CURRENT_USER = cast(HKEY)(0x80000001),
627 HKEY_LOCAL_MACHINE = cast(HKEY)(0x80000002),
628 HKEY_USERS = cast(HKEY)(0x80000003),
629 HKEY_PERFORMANCE_DATA = cast(HKEY)(0x80000004),
630 HKEY_PERFORMANCE_TEXT = cast(HKEY)(0x80000050),
631 HKEY_PERFORMANCE_NLSTEXT = cast(HKEY)(0x80000060),
632 HKEY_CURRENT_CONFIG = cast(HKEY)(0x80000005),
633 HKEY_DYN_DATA = cast(HKEY)(0x80000006),
638 const HKEY_CLASSES_ROOT = cast(HKEY)(0x80000000);
639 const HKEY_CURRENT_USER = cast(HKEY)(0x80000001);
640 const HKEY_LOCAL_MACHINE = cast(HKEY)(0x80000002);
641 const HKEY_USERS = cast(HKEY)(0x80000003);
642 const HKEY_PERFORMANCE_DATA = cast(HKEY)(0x80000004);
643 const HKEY_PERFORMANCE_TEXT = cast(HKEY)(0x80000050);
644 const HKEY_PERFORMANCE_NLSTEXT = cast(HKEY)(0x80000060);
645 const HKEY_CURRENT_CONFIG = cast(HKEY)(0x80000005);
646 const HKEY_DYN_DATA = cast(HKEY)(0x80000006);
652 REG_OPTION_RESERVED = (0x00000000), // Parameter is reserved
654 REG_OPTION_NON_VOLATILE = (0x00000000), // Key is preserved
655 // when system is rebooted
657 REG_OPTION_VOLATILE = (0x00000001), // Key is not preserved
658 // when system is rebooted
660 REG_OPTION_CREATE_LINK = (0x00000002), // Created key is a
663 REG_OPTION_BACKUP_RESTORE = (0x00000004), // open for backup or restore
664 // special access rules
665 // privilege required
667 REG_OPTION_OPEN_LINK = (0x00000008), // Open symbolic link
669 REG_LEGAL_OPTION = (REG_OPTION_RESERVED | REG_OPTION_NON_VOLATILE | REG_OPTION_VOLATILE | REG_OPTION_CREATE_LINK | REG_OPTION_BACKUP_RESTORE | REG_OPTION_OPEN_LINK),
672 export LONG RegDeleteKeyA(HKEY hKey, LPCSTR lpSubKey);
673 export LONG RegDeleteValueA(HKEY hKey, LPCSTR lpValueName);
675 export LONG RegEnumKeyExA(HKEY hKey, DWORD dwIndex, LPSTR lpName, LPDWORD lpcbName, LPDWORD lpReserved, LPSTR lpClass, LPDWORD lpcbClass, FILETIME* lpftLastWriteTime);
676 export LONG RegEnumValueA(HKEY hKey, DWORD dwIndex, LPSTR lpValueName, LPDWORD lpcbValueName, LPDWORD lpReserved,
677 LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData);
679 export LONG RegCloseKey(HKEY hKey);
680 export LONG RegFlushKey(HKEY hKey);
682 export LONG RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult);
683 export LONG RegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult);
685 export LONG RegQueryInfoKeyA(HKEY hKey, LPSTR lpClass, LPDWORD lpcbClass,
686 LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcbMaxSubKeyLen, LPDWORD lpcbMaxClassLen,
687 LPDWORD lpcValues, LPDWORD lpcbMaxValueNameLen, LPDWORD lpcbMaxValueLen, LPDWORD lpcbSecurityDescriptor,
688 PFILETIME lpftLastWriteTime);
690 export LONG RegQueryValueA(HKEY hKey, LPCSTR lpSubKey, LPSTR lpValue,
693 export LONG RegCreateKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD Reserved, LPSTR lpClass,
694 DWORD dwOptions, REGSAM samDesired, SECURITY_ATTRIBUTES* lpSecurityAttributes,
695 PHKEY phkResult, LPDWORD lpdwDisposition);
697 export LONG RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, BYTE* lpData, DWORD cbData);
699 struct MEMORY_BASIC_INFORMATION {
701 PVOID AllocationBase;
702 DWORD AllocationProtect;
708 alias MEMORY_BASIC_INFORMATION* PMEMORY_BASIC_INFORMATION;
712 SECTION_QUERY = 0x0001,
713 SECTION_MAP_WRITE = 0x0002,
714 SECTION_MAP_READ = 0x0004,
715 SECTION_MAP_EXECUTE = 0x0008,
716 SECTION_EXTEND_SIZE = 0x0010,
718 SECTION_ALL_ACCESS = cast(int)(STANDARD_RIGHTS_REQUIRED|SECTION_QUERY| SECTION_MAP_WRITE | SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_EXTEND_SIZE),
719 PAGE_NOACCESS = 0x01,
720 PAGE_READONLY = 0x02,
721 PAGE_READWRITE = 0x04,
722 PAGE_WRITECOPY = 0x08,
724 PAGE_EXECUTE_READ = 0x20,
725 PAGE_EXECUTE_READWRITE = 0x40,
726 PAGE_EXECUTE_WRITECOPY = 0x80,
728 PAGE_NOCACHE = 0x200,
730 MEM_RESERVE = 0x2000,
731 MEM_DECOMMIT = 0x4000,
732 MEM_RELEASE = 0x8000,
734 MEM_PRIVATE = 0x20000,
735 MEM_MAPPED = 0x40000,
737 MEM_TOP_DOWN = 0x100000,
739 SEC_IMAGE = 0x1000000,
740 SEC_RESERVE = 0x4000000,
741 SEC_COMMIT = 0x8000000,
742 SEC_NOCACHE = 0x10000000,
743 MEM_IMAGE = SEC_IMAGE,
748 FILE_MAP_COPY = SECTION_QUERY,
749 FILE_MAP_WRITE = SECTION_MAP_WRITE,
750 FILE_MAP_READ = SECTION_MAP_READ,
751 FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS,
756 // Define access rights to files and directories
760 // The FILE_READ_DATA and FILE_WRITE_DATA constants are also defined in
761 // devioctl.h as FILE_READ_ACCESS and FILE_WRITE_ACCESS. The values for these
762 // constants *MUST* always be in sync.
763 // The values are redefined in devioctl.h because they must be available to
769 FILE_READ_DATA = ( 0x0001 ), // file & pipe
770 FILE_LIST_DIRECTORY = ( 0x0001 ), // directory
772 FILE_WRITE_DATA = ( 0x0002 ), // file & pipe
773 FILE_ADD_FILE = ( 0x0002 ), // directory
775 FILE_APPEND_DATA = ( 0x0004 ), // file
776 FILE_ADD_SUBDIRECTORY = ( 0x0004 ), // directory
777 FILE_CREATE_PIPE_INSTANCE = ( 0x0004 ), // named pipe
779 FILE_READ_EA = ( 0x0008 ), // file & directory
781 FILE_WRITE_EA = ( 0x0010 ), // file & directory
783 FILE_EXECUTE = ( 0x0020 ), // file
784 FILE_TRAVERSE = ( 0x0020 ), // directory
786 FILE_DELETE_CHILD = ( 0x0040 ), // directory
788 FILE_READ_ATTRIBUTES = ( 0x0080 ), // all
790 FILE_WRITE_ATTRIBUTES = ( 0x0100 ), // all
792 FILE_ALL_ACCESS = cast(int)(STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF),
794 FILE_GENERIC_READ = cast(int)(STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE),
796 FILE_GENERIC_WRITE = cast(int)(STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE),
798 FILE_GENERIC_EXECUTE = cast(int)(STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE),
803 BOOL FreeResource(HGLOBAL hResData);
804 LPVOID LockResource(HGLOBAL hResData);
805 BOOL GlobalUnlock(HGLOBAL hMem);
806 HGLOBAL GlobalFree(HGLOBAL hMem);
807 UINT GlobalCompact(DWORD dwMinFree);
808 void GlobalFix(HGLOBAL hMem);
809 void GlobalUnfix(HGLOBAL hMem);
810 LPVOID GlobalWire(HGLOBAL hMem);
811 BOOL GlobalUnWire(HGLOBAL hMem);
812 void GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer);
813 HLOCAL LocalAlloc(UINT uFlags, UINT uBytes);
814 HLOCAL LocalReAlloc(HLOCAL hMem, UINT uBytes, UINT uFlags);
815 LPVOID LocalLock(HLOCAL hMem);
816 HLOCAL LocalHandle(LPCVOID pMem);
817 BOOL LocalUnlock(HLOCAL hMem);
818 UINT LocalSize(HLOCAL hMem);
819 UINT LocalFlags(HLOCAL hMem);
820 HLOCAL LocalFree(HLOCAL hMem);
821 UINT LocalShrink(HLOCAL hMem, UINT cbNewSize);
822 UINT LocalCompact(UINT uMinFree);
823 BOOL FlushInstructionCache(HANDLE hProcess, LPCVOID lpBaseAddress, DWORD dwSize);
824 LPVOID VirtualAlloc(LPVOID lpAddress, DWORD dwSize, DWORD flAllocationType, DWORD flProtect);
825 BOOL VirtualFree(LPVOID lpAddress, DWORD dwSize, DWORD dwFreeType);
826 BOOL VirtualProtect(LPVOID lpAddress, DWORD dwSize, DWORD flNewProtect, PDWORD lpflOldProtect);
827 DWORD VirtualQuery(LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, DWORD dwLength);
828 LPVOID VirtualAllocEx(HANDLE hProcess, LPVOID lpAddress, DWORD dwSize, DWORD flAllocationType, DWORD flProtect);
829 BOOL VirtualFreeEx(HANDLE hProcess, LPVOID lpAddress, DWORD dwSize, DWORD dwFreeType);
830 BOOL VirtualProtectEx(HANDLE hProcess, LPVOID lpAddress, DWORD dwSize, DWORD flNewProtect, PDWORD lpflOldProtect);
831 DWORD VirtualQueryEx(HANDLE hProcess, LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, DWORD dwLength);
846 struct TIME_ZONE_INFORMATION {
848 WCHAR StandardName[ 32 ];
849 SYSTEMTIME StandardDate;
851 WCHAR DaylightName[ 32 ];
852 SYSTEMTIME DaylightDate;
858 TIME_ZONE_ID_UNKNOWN = 0,
859 TIME_ZONE_ID_STANDARD = 1,
860 TIME_ZONE_ID_DAYLIGHT = 2,
863 export void GetSystemTime(SYSTEMTIME* lpSystemTime);
864 export void GetSystemTimeAsFileTime(FILETIME* lpSystemTimeAsFileTime);
865 export BOOL SetSystemTime(SYSTEMTIME* lpSystemTime);
866 export void GetLocalTime(SYSTEMTIME* lpSystemTime);
867 export BOOL SetLocalTime(SYSTEMTIME* lpSystemTime);
868 export BOOL SystemTimeToTzSpecificLocalTime(TIME_ZONE_INFORMATION* lpTimeZoneInformation, SYSTEMTIME* lpUniversalTime, SYSTEMTIME* lpLocalTime);
869 export DWORD GetTimeZoneInformation(TIME_ZONE_INFORMATION* lpTimeZoneInformation);
870 export BOOL SetTimeZoneInformation(TIME_ZONE_INFORMATION* lpTimeZoneInformation);
872 export BOOL SystemTimeToFileTime(in SYSTEMTIME *lpSystemTime, FILETIME* lpFileTime);
873 export BOOL FileTimeToLocalFileTime(in FILETIME *lpFileTime, FILETIME* lpLocalFileTime);
874 export BOOL LocalFileTimeToFileTime(in FILETIME *lpLocalFileTime, FILETIME* lpFileTime);
875 export BOOL FileTimeToSystemTime(in FILETIME *lpFileTime, SYSTEMTIME* lpSystemTime);
876 export LONG CompareFileTime(in FILETIME *lpFileTime1, in FILETIME *lpFileTime2);
877 export BOOL FileTimeToDosDateTime(in FILETIME *lpFileTime, WORD* lpFatDate, WORD* lpFatTime);
878 export BOOL DosDateTimeToFileTime(WORD wFatDate, WORD wFatTime, FILETIME* lpFileTime);
879 export DWORD GetTickCount();
880 export BOOL SetSystemTimeAdjustment(DWORD dwTimeAdjustment, BOOL bTimeAdjustmentDisabled);
881 export BOOL GetSystemTimeAdjustment(DWORD* lpTimeAdjustment, DWORD* lpTimeIncrement, BOOL* lpTimeAdjustmentDisabled);
882 export DWORD FormatMessageA(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, void* *Arguments);export DWORD FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, void* *Arguments);
886 FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100,
887 FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200,
888 FORMAT_MESSAGE_FROM_STRING = 0x00000400,
889 FORMAT_MESSAGE_FROM_HMODULE = 0x00000800,
890 FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000,
891 FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000,
892 FORMAT_MESSAGE_MAX_WIDTH_MASK = 0x000000FF,
899 // The following two combinations of primary language ID and
900 // sublanguage ID have special semantics:
902 // Primary Language ID Sublanguage ID Result
903 // ------------------- --------------- ------------------------
904 // LANG_NEUTRAL SUBLANG_NEUTRAL Language neutral
905 // LANG_NEUTRAL SUBLANG_DEFAULT User default language
906 // LANG_NEUTRAL SUBLANG_SYS_DEFAULT System default language
910 // Primary language IDs.
917 LANG_AFRIKAANS = 0x36,
918 LANG_ALBANIAN = 0x1c,
921 LANG_BELARUSIAN = 0x23,
922 LANG_BULGARIAN = 0x02,
925 LANG_CROATIAN = 0x1a,
930 LANG_ESTONIAN = 0x25,
931 LANG_FAEROESE = 0x38,
938 LANG_HUNGARIAN = 0x0e,
939 LANG_ICELANDIC = 0x0f,
940 LANG_INDONESIAN = 0x21,
942 LANG_JAPANESE = 0x11,
945 LANG_LITHUANIAN = 0x27,
946 LANG_NORWEGIAN = 0x14,
948 LANG_PORTUGUESE = 0x16,
949 LANG_ROMANIAN = 0x18,
953 LANG_SLOVENIAN = 0x24,
958 LANG_UKRAINIAN = 0x22,
959 LANG_VIETNAMESE = 0x2a,
964 // The name immediately following SUBLANG_ dictates which primary
965 // language ID that sublanguage ID can be combined with to form a
966 // valid language ID.
970 SUBLANG_NEUTRAL = 0x00, // language neutral
971 SUBLANG_DEFAULT = 0x01, // user default
972 SUBLANG_SYS_DEFAULT = 0x02, // system default
974 SUBLANG_ARABIC_SAUDI_ARABIA = 0x01, // Arabic (Saudi Arabia)
975 SUBLANG_ARABIC_IRAQ = 0x02, // Arabic (Iraq)
976 SUBLANG_ARABIC_EGYPT = 0x03, // Arabic (Egypt)
977 SUBLANG_ARABIC_LIBYA = 0x04, // Arabic (Libya)
978 SUBLANG_ARABIC_ALGERIA = 0x05, // Arabic (Algeria)
979 SUBLANG_ARABIC_MOROCCO = 0x06, // Arabic (Morocco)
980 SUBLANG_ARABIC_TUNISIA = 0x07, // Arabic (Tunisia)
981 SUBLANG_ARABIC_OMAN = 0x08, // Arabic (Oman)
982 SUBLANG_ARABIC_YEMEN = 0x09, // Arabic (Yemen)
983 SUBLANG_ARABIC_SYRIA = 0x0a, // Arabic (Syria)
984 SUBLANG_ARABIC_JORDAN = 0x0b, // Arabic (Jordan)
985 SUBLANG_ARABIC_LEBANON = 0x0c, // Arabic (Lebanon)
986 SUBLANG_ARABIC_KUWAIT = 0x0d, // Arabic (Kuwait)
987 SUBLANG_ARABIC_UAE = 0x0e, // Arabic (U.A.E)
988 SUBLANG_ARABIC_BAHRAIN = 0x0f, // Arabic (Bahrain)
989 SUBLANG_ARABIC_QATAR = 0x10, // Arabic (Qatar)
990 SUBLANG_CHINESE_TRADITIONAL = 0x01, // Chinese (Taiwan)
991 SUBLANG_CHINESE_SIMPLIFIED = 0x02, // Chinese (PR China)
992 SUBLANG_CHINESE_HONGKONG = 0x03, // Chinese (Hong Kong)
993 SUBLANG_CHINESE_SINGAPORE = 0x04, // Chinese (Singapore)
994 SUBLANG_DUTCH = 0x01, // Dutch
995 SUBLANG_DUTCH_BELGIAN = 0x02, // Dutch (Belgian)
996 SUBLANG_ENGLISH_US = 0x01, // English (USA)
997 SUBLANG_ENGLISH_UK = 0x02, // English (UK)
998 SUBLANG_ENGLISH_AUS = 0x03, // English (Australian)
999 SUBLANG_ENGLISH_CAN = 0x04, // English (Canadian)
1000 SUBLANG_ENGLISH_NZ = 0x05, // English (New Zealand)
1001 SUBLANG_ENGLISH_EIRE = 0x06, // English (Irish)
1002 SUBLANG_ENGLISH_SOUTH_AFRICA = 0x07, // English (South Africa)
1003 SUBLANG_ENGLISH_JAMAICA = 0x08, // English (Jamaica)
1004 SUBLANG_ENGLISH_CARIBBEAN = 0x09, // English (Caribbean)
1005 SUBLANG_ENGLISH_BELIZE = 0x0a, // English (Belize)
1006 SUBLANG_ENGLISH_TRINIDAD = 0x0b, // English (Trinidad)
1007 SUBLANG_FRENCH = 0x01, // French
1008 SUBLANG_FRENCH_BELGIAN = 0x02, // French (Belgian)
1009 SUBLANG_FRENCH_CANADIAN = 0x03, // French (Canadian)
1010 SUBLANG_FRENCH_SWISS = 0x04, // French (Swiss)
1011 SUBLANG_FRENCH_LUXEMBOURG = 0x05, // French (Luxembourg)
1012 SUBLANG_GERMAN = 0x01, // German
1013 SUBLANG_GERMAN_SWISS = 0x02, // German (Swiss)
1014 SUBLANG_GERMAN_AUSTRIAN = 0x03, // German (Austrian)
1015 SUBLANG_GERMAN_LUXEMBOURG = 0x04, // German (Luxembourg)
1016 SUBLANG_GERMAN_LIECHTENSTEIN = 0x05, // German (Liechtenstein)
1017 SUBLANG_ITALIAN = 0x01, // Italian
1018 SUBLANG_ITALIAN_SWISS = 0x02, // Italian (Swiss)
1019 SUBLANG_KOREAN = 0x01, // Korean (Extended Wansung)
1020 SUBLANG_KOREAN_JOHAB = 0x02, // Korean (Johab)
1021 SUBLANG_NORWEGIAN_BOKMAL = 0x01, // Norwegian (Bokmal)
1022 SUBLANG_NORWEGIAN_NYNORSK = 0x02, // Norwegian (Nynorsk)
1023 SUBLANG_PORTUGUESE = 0x02, // Portuguese
1024 SUBLANG_PORTUGUESE_BRAZILIAN = 0x01, // Portuguese (Brazilian)
1025 SUBLANG_SERBIAN_LATIN = 0x02, // Serbian (Latin)
1026 SUBLANG_SERBIAN_CYRILLIC = 0x03, // Serbian (Cyrillic)
1027 SUBLANG_SPANISH = 0x01, // Spanish (Castilian)
1028 SUBLANG_SPANISH_MEXICAN = 0x02, // Spanish (Mexican)
1029 SUBLANG_SPANISH_MODERN = 0x03, // Spanish (Modern)
1030 SUBLANG_SPANISH_GUATEMALA = 0x04, // Spanish (Guatemala)
1031 SUBLANG_SPANISH_COSTA_RICA = 0x05, // Spanish (Costa Rica)
1032 SUBLANG_SPANISH_PANAMA = 0x06, // Spanish (Panama)
1033 SUBLANG_SPANISH_DOMINICAN_REPUBLIC = 0x07, // Spanish (Dominican Republic)
1034 SUBLANG_SPANISH_VENEZUELA = 0x08, // Spanish (Venezuela)
1035 SUBLANG_SPANISH_COLOMBIA = 0x09, // Spanish (Colombia)
1036 SUBLANG_SPANISH_PERU = 0x0a, // Spanish (Peru)
1037 SUBLANG_SPANISH_ARGENTINA = 0x0b, // Spanish (Argentina)
1038 SUBLANG_SPANISH_ECUADOR = 0x0c, // Spanish (Ecuador)
1039 SUBLANG_SPANISH_CHILE = 0x0d, // Spanish (Chile)
1040 SUBLANG_SPANISH_URUGUAY = 0x0e, // Spanish (Uruguay)
1041 SUBLANG_SPANISH_PARAGUAY = 0x0f, // Spanish (Paraguay)
1042 SUBLANG_SPANISH_BOLIVIA = 0x10, // Spanish (Bolivia)
1043 SUBLANG_SPANISH_EL_SALVADOR = 0x11, // Spanish (El Salvador)
1044 SUBLANG_SPANISH_HONDURAS = 0x12, // Spanish (Honduras)
1045 SUBLANG_SPANISH_NICARAGUA = 0x13, // Spanish (Nicaragua)
1046 SUBLANG_SPANISH_PUERTO_RICO = 0x14, // Spanish (Puerto Rico)
1047 SUBLANG_SWEDISH = 0x01, // Swedish
1048 SUBLANG_SWEDISH_FINLAND = 0x02, // Swedish (Finland)
1056 SORT_DEFAULT = 0x0, // sorting default
1058 SORT_JAPANESE_XJIS = 0x0, // Japanese XJIS order
1059 SORT_JAPANESE_UNICODE = 0x1, // Japanese Unicode order
1061 SORT_CHINESE_BIG5 = 0x0, // Chinese BIG5 order
1062 SORT_CHINESE_PRCP = 0x0, // PRC Chinese Phonetic order
1063 SORT_CHINESE_UNICODE = 0x1, // Chinese Unicode order
1064 SORT_CHINESE_PRC = 0x2, // PRC Chinese Stroke Count order
1066 SORT_KOREAN_KSC = 0x0, // Korean KSC order
1067 SORT_KOREAN_UNICODE = 0x1, // Korean Unicode order
1069 SORT_GERMAN_PHONE_BOOK = 0x1, // German Phone Book order
1075 // A language ID is a 16 bit value which is the combination of a
1076 // primary language ID and a secondary language ID. The bits are
1077 // allocated as follows:
1079 // +-----------------------+-------------------------+
1080 // | Sublanguage ID | Primary Language ID |
1081 // +-----------------------+-------------------------+
1085 // Language ID creation/extraction macros:
1087 // MAKELANGID - construct language id from a primary language id and
1088 // a sublanguage id.
1089 // PRIMARYLANGID - extract primary language id from a language id.
1090 // SUBLANGID - extract sublanguage id from a language id.
1093 int MAKELANGID(int p, int s) { return ((cast(WORD)s) << 10) | cast(WORD)p; }
1094 WORD PRIMARYLANGID(int lgid) { return cast(WORD)(lgid & 0x3ff); }
1095 WORD SUBLANGID(int lgid) { return cast(WORD)(lgid >> 10); }
1098 struct FLOATING_SAVE_AREA {
1103 DWORD ErrorSelector;
1106 BYTE RegisterArea[80 ];
1112 SIZE_OF_80387_REGISTERS = 80,
1114 // The following flags control the contents of the CONTEXT structure.
1116 CONTEXT_i386 = 0x00010000, // this assumes that i386 and
1117 CONTEXT_i486 = 0x00010000, // i486 have identical context records
1119 CONTEXT_CONTROL = (CONTEXT_i386 | 0x00000001), // SS:SP, CS:IP, FLAGS, BP
1120 CONTEXT_INTEGER = (CONTEXT_i386 | 0x00000002), // AX, BX, CX, DX, SI, DI
1121 CONTEXT_SEGMENTS = (CONTEXT_i386 | 0x00000004), // DS, ES, FS, GS
1122 CONTEXT_FLOATING_POINT = (CONTEXT_i386 | 0x00000008), // 387 state
1123 CONTEXT_DEBUG_REGISTERS = (CONTEXT_i386 | 0x00000010), // DB 0-3,6,7
1125 CONTEXT_FULL = (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS),
1132 // The flags values within this flag control the contents of
1133 // a CONTEXT record.
1135 // If the context record is used as an input parameter, then
1136 // for each portion of the context record controlled by a flag
1137 // whose value is set, it is assumed that that portion of the
1138 // context record contains valid context. If the context record
1139 // is being used to modify a threads context, then only that
1140 // portion of the threads context will be modified.
1142 // If the context record is used as an IN OUT parameter to capture
1143 // the context of a thread, then only those portions of the thread's
1144 // context corresponding to set flags will be returned.
1146 // The context record is never used as an OUT only parameter.
1152 // This section is specified/returned if CONTEXT_DEBUG_REGISTERS is
1153 // set in ContextFlags. Note that CONTEXT_DEBUG_REGISTERS is NOT
1154 // included in CONTEXT_FULL.
1165 // This section is specified/returned if the
1166 // ContextFlags word contians the flag CONTEXT_FLOATING_POINT.
1169 FLOATING_SAVE_AREA FloatSave;
1172 // This section is specified/returned if the
1173 // ContextFlags word contians the flag CONTEXT_SEGMENTS.
1182 // This section is specified/returned if the
1183 // ContextFlags word contians the flag CONTEXT_INTEGER.
1194 // This section is specified/returned if the
1195 // ContextFlags word contians the flag CONTEXT_CONTROL.
1200 DWORD SegCs; // MUST BE SANITIZED
1201 DWORD EFlags; // MUST BE SANITIZED
1208 THREAD_BASE_PRIORITY_LOWRT = 15, // value that gets a thread to LowRealtime-1
1209 THREAD_BASE_PRIORITY_MAX = 2, // maximum thread base priority boost
1210 THREAD_BASE_PRIORITY_MIN = -2, // minimum thread base priority boost
1211 THREAD_BASE_PRIORITY_IDLE = -15, // value that gets a thread to idle
1213 THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN,
1214 THREAD_PRIORITY_BELOW_NORMAL = (THREAD_PRIORITY_LOWEST+1),
1215 THREAD_PRIORITY_NORMAL = 0,
1216 THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX,
1217 THREAD_PRIORITY_ABOVE_NORMAL = (THREAD_PRIORITY_HIGHEST-1),
1218 THREAD_PRIORITY_ERROR_RETURN = int.max,
1220 THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT,
1221 THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE,
1224 export HANDLE GetCurrentThread();
1225 export BOOL GetProcessTimes(HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime);
1226 export HANDLE GetCurrentProcess();
1227 export DWORD GetCurrentProcessId();
1228 export BOOL DuplicateHandle (HANDLE sourceProcess, HANDLE sourceThread,
1229 HANDLE targetProcessHandle, HANDLE *targetHandle, DWORD access,
1230 BOOL inheritHandle, DWORD options);
1231 export DWORD GetCurrentThreadId();
1232 export BOOL SetThreadPriority(HANDLE hThread, int nPriority);
1233 export BOOL SetThreadPriorityBoost(HANDLE hThread, BOOL bDisablePriorityBoost);
1234 export BOOL GetThreadPriorityBoost(HANDLE hThread, PBOOL pDisablePriorityBoost);
1235 export BOOL GetThreadTimes(HANDLE hThread, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime);
1236 export int GetThreadPriority(HANDLE hThread);
1237 export BOOL GetThreadContext(HANDLE hThread, CONTEXT* lpContext);
1238 export BOOL SetThreadContext(HANDLE hThread, CONTEXT* lpContext);
1239 export DWORD SuspendThread(HANDLE hThread);
1240 export DWORD ResumeThread(HANDLE hThread);
1241 export DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds);
1242 export DWORD WaitForMultipleObjects(DWORD nCount, HANDLE *lpHandles, BOOL bWaitAll, DWORD dwMilliseconds);
1243 export void Sleep(DWORD dwMilliseconds);
1249 LONG InterlockedIncrement(LPLONG lpAddend);
1250 LONG InterlockedDecrement(LPLONG lpAddend);
1251 LONG InterlockedExchange(LPLONG Target, LONG Value);
1252 LONG InterlockedExchangeAdd(LPLONG Addend, LONG Value);
1253 PVOID InterlockedCompareExchange(PVOID *Destination, PVOID Exchange, PVOID Comperand);
1255 void InitializeCriticalSection(CRITICAL_SECTION * lpCriticalSection);
1256 void EnterCriticalSection(CRITICAL_SECTION * lpCriticalSection);
1257 BOOL TryEnterCriticalSection(CRITICAL_SECTION * lpCriticalSection);
1258 void LeaveCriticalSection(CRITICAL_SECTION * lpCriticalSection);
1259 void DeleteCriticalSection(CRITICAL_SECTION * lpCriticalSection);
1265 export BOOL QueryPerformanceCounter(long* lpPerformanceCount);
1266 export BOOL QueryPerformanceFrequency(long* lpFrequency);
1271 WM_INPUTLANGCHANGEREQUEST = 0x0050,
1272 WM_INPUTLANGCHANGE = 0x0051,
1275 WM_USERCHANGED = 0x0054,
1276 WM_NOTIFYFORMAT = 0x0055,
1283 WM_CONTEXTMENU = 0x007B,
1284 WM_STYLECHANGING = 0x007C,
1285 WM_STYLECHANGED = 0x007D,
1286 WM_DISPLAYCHANGE = 0x007E,
1287 WM_GETICON = 0x007F,
1288 WM_SETICON = 0x0080,
1292 WM_NCCREATE = 0x0081,
1293 WM_NCDESTROY = 0x0082,
1294 WM_NCCALCSIZE = 0x0083,
1295 WM_NCHITTEST = 0x0084,
1296 WM_NCPAINT = 0x0085,
1297 WM_NCACTIVATE = 0x0086,
1298 WM_GETDLGCODE = 0x0087,
1300 WM_NCMOUSEMOVE = 0x00A0,
1301 WM_NCLBUTTONDOWN = 0x00A1,
1302 WM_NCLBUTTONUP = 0x00A2,
1303 WM_NCLBUTTONDBLCLK = 0x00A3,
1304 WM_NCRBUTTONDOWN = 0x00A4,
1305 WM_NCRBUTTONUP = 0x00A5,
1306 WM_NCRBUTTONDBLCLK = 0x00A6,
1307 WM_NCMBUTTONDOWN = 0x00A7,
1308 WM_NCMBUTTONUP = 0x00A8,
1309 WM_NCMBUTTONDBLCLK = 0x00A9,
1311 WM_KEYFIRST = 0x0100,
1312 WM_KEYDOWN = 0x0100,
1315 WM_DEADCHAR = 0x0103,
1316 WM_SYSKEYDOWN = 0x0104,
1317 WM_SYSKEYUP = 0x0105,
1318 WM_SYSCHAR = 0x0106,
1319 WM_SYSDEADCHAR = 0x0107,
1320 WM_KEYLAST = 0x0108,
1323 WM_IME_STARTCOMPOSITION = 0x010D,
1324 WM_IME_ENDCOMPOSITION = 0x010E,
1325 WM_IME_COMPOSITION = 0x010F,
1326 WM_IME_KEYLAST = 0x010F,
1329 WM_INITDIALOG = 0x0110,
1330 WM_COMMAND = 0x0111,
1331 WM_SYSCOMMAND = 0x0112,
1333 WM_HSCROLL = 0x0114,
1334 WM_VSCROLL = 0x0115,
1335 WM_INITMENU = 0x0116,
1336 WM_INITMENUPOPUP = 0x0117,
1337 WM_MENUSELECT = 0x011F,
1338 WM_MENUCHAR = 0x0120,
1339 WM_ENTERIDLE = 0x0121,
1341 WM_CTLCOLORMSGBOX = 0x0132,
1342 WM_CTLCOLOREDIT = 0x0133,
1343 WM_CTLCOLORLISTBOX = 0x0134,
1344 WM_CTLCOLORBTN = 0x0135,
1345 WM_CTLCOLORDLG = 0x0136,
1346 WM_CTLCOLORSCROLLBAR = 0x0137,
1347 WM_CTLCOLORSTATIC = 0x0138,
1351 WM_MOUSEFIRST = 0x0200,
1352 WM_MOUSEMOVE = 0x0200,
1353 WM_LBUTTONDOWN = 0x0201,
1354 WM_LBUTTONUP = 0x0202,
1355 WM_LBUTTONDBLCLK = 0x0203,
1356 WM_RBUTTONDOWN = 0x0204,
1357 WM_RBUTTONUP = 0x0205,
1358 WM_RBUTTONDBLCLK = 0x0206,
1359 WM_MBUTTONDOWN = 0x0207,
1360 WM_MBUTTONUP = 0x0208,
1361 WM_MBUTTONDBLCLK = 0x0209,
1365 WM_MOUSELAST = 0x0209,
1374 WM_PARENTNOTIFY = 0x0210,
1375 MENULOOP_WINDOW = 0,
1377 WM_ENTERMENULOOP = 0x0211,
1378 WM_EXITMENULOOP = 0x0212,
1381 WM_NEXTMENU = 0x0213,
1387 * Dialog Box Command IDs
1406 * Control Manager Structures and Definitions
1414 * Edit Control Styles
1419 ES_MULTILINE = 0x0004,
1420 ES_UPPERCASE = 0x0008,
1421 ES_LOWERCASE = 0x0010,
1422 ES_PASSWORD = 0x0020,
1423 ES_AUTOVSCROLL = 0x0040,
1424 ES_AUTOHSCROLL = 0x0080,
1425 ES_NOHIDESEL = 0x0100,
1426 ES_OEMCONVERT = 0x0400,
1427 ES_READONLY = 0x0800,
1428 ES_WANTRETURN = 0x1000,
1438 * Edit Control Notification Codes
1440 EN_SETFOCUS = 0x0100,
1441 EN_KILLFOCUS = 0x0200,
1444 EN_ERRSPACE = 0x0500,
1445 EN_MAXTEXT = 0x0501,
1446 EN_HSCROLL = 0x0601,
1447 EN_VSCROLL = 0x0602,
1450 /* Edit control EM_SETMARGIN parameters */
1451 EC_LEFTMARGIN = 0x0001,
1452 EC_RIGHTMARGIN = 0x0002,
1453 EC_USEFONTINFO = 0xffff,
1461 * Edit Control Messages
1465 EM_GETRECT = 0x00B2,
1466 EM_SETRECT = 0x00B3,
1467 EM_SETRECTNP = 0x00B4,
1469 EM_LINESCROLL = 0x00B6,
1470 EM_SCROLLCARET = 0x00B7,
1471 EM_GETMODIFY = 0x00B8,
1472 EM_SETMODIFY = 0x00B9,
1473 EM_GETLINECOUNT = 0x00BA,
1474 EM_LINEINDEX = 0x00BB,
1475 EM_SETHANDLE = 0x00BC,
1476 EM_GETHANDLE = 0x00BD,
1477 EM_GETTHUMB = 0x00BE,
1478 EM_LINELENGTH = 0x00C1,
1479 EM_REPLACESEL = 0x00C2,
1480 EM_GETLINE = 0x00C4,
1481 EM_LIMITTEXT = 0x00C5,
1482 EM_CANUNDO = 0x00C6,
1484 EM_FMTLINES = 0x00C8,
1485 EM_LINEFROMCHAR = 0x00C9,
1486 EM_SETTABSTOPS = 0x00CB,
1487 EM_SETPASSWORDCHAR = 0x00CC,
1488 EM_EMPTYUNDOBUFFER = 0x00CD,
1489 EM_GETFIRSTVISIBLELINE = 0x00CE,
1490 EM_SETREADONLY = 0x00CF,
1491 EM_SETWORDBREAKPROC = 0x00D0,
1492 EM_GETWORDBREAKPROC = 0x00D1,
1493 EM_GETPASSWORDCHAR = 0x00D2,
1495 EM_SETMARGINS = 0x00D3,
1496 EM_GETMARGINS = 0x00D4,
1497 EM_SETLIMITTEXT = EM_LIMITTEXT, /* ;win40 Name change */
1498 EM_GETLIMITTEXT = 0x00D5,
1499 EM_POSFROMCHAR = 0x00D6,
1500 EM_CHARFROMPOS = 0x00D7,
1508 * EDITWORDBREAKPROC code values
1517 * Button Control Styles
1519 BS_PUSHBUTTON = 0x00000000,
1520 BS_DEFPUSHBUTTON = 0x00000001,
1521 BS_CHECKBOX = 0x00000002,
1522 BS_AUTOCHECKBOX = 0x00000003,
1523 BS_RADIOBUTTON = 0x00000004,
1524 BS_3STATE = 0x00000005,
1525 BS_AUTO3STATE = 0x00000006,
1526 BS_GROUPBOX = 0x00000007,
1527 BS_USERBUTTON = 0x00000008,
1528 BS_AUTORADIOBUTTON = 0x00000009,
1529 BS_OWNERDRAW = 0x0000000B,
1530 BS_LEFTTEXT = 0x00000020,
1532 BS_TEXT = 0x00000000,
1533 BS_ICON = 0x00000040,
1534 BS_BITMAP = 0x00000080,
1535 BS_LEFT = 0x00000100,
1536 BS_RIGHT = 0x00000200,
1537 BS_CENTER = 0x00000300,
1538 BS_TOP = 0x00000400,
1539 BS_BOTTOM = 0x00000800,
1540 BS_VCENTER = 0x00000C00,
1541 BS_PUSHLIKE = 0x00001000,
1542 BS_MULTILINE = 0x00002000,
1543 BS_NOTIFY = 0x00004000,
1544 BS_FLAT = 0x00008000,
1545 BS_RIGHTBUTTON = BS_LEFTTEXT,
1550 * User Button Notification Codes
1557 BN_DOUBLECLICKED = 5,
1559 BN_PUSHED = BN_HILITE,
1560 BN_UNPUSHED = BN_UNHILITE,
1561 BN_DBLCLK = BN_DOUBLECLICKED,
1566 * Button Control Messages
1568 BM_GETCHECK = 0x00F0,
1569 BM_SETCHECK = 0x00F1,
1570 BM_GETSTATE = 0x00F2,
1571 BM_SETSTATE = 0x00F3,
1572 BM_SETSTYLE = 0x00F4,
1575 BM_GETIMAGE = 0x00F6,
1576 BM_SETIMAGE = 0x00F7,
1578 BST_UNCHECKED = 0x0000,
1579 BST_CHECKED = 0x0001,
1580 BST_INDETERMINATE = 0x0002,
1581 BST_PUSHED = 0x0004,
1586 * Static Control Constants
1588 SS_LEFT = 0x00000000,
1589 SS_CENTER = 0x00000001,
1590 SS_RIGHT = 0x00000002,
1591 SS_ICON = 0x00000003,
1592 SS_BLACKRECT = 0x00000004,
1593 SS_GRAYRECT = 0x00000005,
1594 SS_WHITERECT = 0x00000006,
1595 SS_BLACKFRAME = 0x00000007,
1596 SS_GRAYFRAME = 0x00000008,
1597 SS_WHITEFRAME = 0x00000009,
1598 SS_USERITEM = 0x0000000A,
1599 SS_SIMPLE = 0x0000000B,
1600 SS_LEFTNOWORDWRAP = 0x0000000C,
1602 SS_OWNERDRAW = 0x0000000D,
1603 SS_BITMAP = 0x0000000E,
1604 SS_ENHMETAFILE = 0x0000000F,
1605 SS_ETCHEDHORZ = 0x00000010,
1606 SS_ETCHEDVERT = 0x00000011,
1607 SS_ETCHEDFRAME = 0x00000012,
1608 SS_TYPEMASK = 0x0000001F,
1610 SS_NOPREFIX = 0x00000080, /* Don't do "&" character translation */
1612 SS_NOTIFY = 0x00000100,
1613 SS_CENTERIMAGE = 0x00000200,
1614 SS_RIGHTJUST = 0x00000400,
1615 SS_REALSIZEIMAGE = 0x00000800,
1616 SS_SUNKEN = 0x00001000,
1617 SS_ENDELLIPSIS = 0x00004000,
1618 SS_PATHELLIPSIS = 0x00008000,
1619 SS_WORDELLIPSIS = 0x0000C000,
1620 SS_ELLIPSISMASK = 0x0000C000,
1627 * Static Control Mesages
1629 STM_SETICON = 0x0170,
1630 STM_GETICON = 0x0171,
1632 STM_SETIMAGE = 0x0172,
1633 STM_GETIMAGE = 0x0173,
1639 STM_MSGMAX = 0x0174,
1651 WM_DESTROY = 0x0002,
1655 WM_ACTIVATE = 0x0006,
1657 * WM_ACTIVATE state values
1663 WM_SETFOCUS = 0x0007,
1664 WM_KILLFOCUS = 0x0008,
1666 WM_SETREDRAW = 0x000B,
1667 WM_SETTEXT = 0x000C,
1668 WM_GETTEXT = 0x000D,
1669 WM_GETTEXTLENGTH = 0x000E,
1672 WM_QUERYENDSESSION = 0x0011,
1674 WM_QUERYOPEN = 0x0013,
1675 WM_ERASEBKGND = 0x0014,
1676 WM_SYSCOLORCHANGE = 0x0015,
1677 WM_ENDSESSION = 0x0016,
1678 WM_SHOWWINDOW = 0x0018,
1679 WM_WININICHANGE = 0x001A,
1681 WM_SETTINGCHANGE = WM_WININICHANGE,
1685 WM_DEVMODECHANGE = 0x001B,
1686 WM_ACTIVATEAPP = 0x001C,
1687 WM_FONTCHANGE = 0x001D,
1688 WM_TIMECHANGE = 0x001E,
1689 WM_CANCELMODE = 0x001F,
1690 WM_SETCURSOR = 0x0020,
1691 WM_MOUSEACTIVATE = 0x0021,
1692 WM_CHILDACTIVATE = 0x0022,
1693 WM_QUEUESYNC = 0x0023,
1695 WM_GETMINMAXINFO = 0x0024,
1705 alias RECT* PRECT, NPRECT, LPRECT;
1707 struct PAINTSTRUCT {
1713 BYTE rgbReserved[32];
1715 alias PAINTSTRUCT* PPAINTSTRUCT, NPPAINTSTRUCT, LPPAINTSTRUCT;
1717 // flags for GetDCEx()
1721 DCX_WINDOW = 0x00000001,
1722 DCX_CACHE = 0x00000002,
1723 DCX_NORESETATTRS = 0x00000004,
1724 DCX_CLIPCHILDREN = 0x00000008,
1725 DCX_CLIPSIBLINGS = 0x00000010,
1726 DCX_PARENTCLIP = 0x00000020,
1727 DCX_EXCLUDERGN = 0x00000040,
1728 DCX_INTERSECTRGN = 0x00000080,
1729 DCX_EXCLUDEUPDATE = 0x00000100,
1730 DCX_INTERSECTUPDATE = 0x00000200,
1731 DCX_LOCKWINDOWUPDATE = 0x00000400,
1732 DCX_VALIDATE = 0x00200000,
1737 BOOL UpdateWindow(HWND hWnd);
1738 HWND SetActiveWindow(HWND hWnd);
1739 HWND GetForegroundWindow();
1740 BOOL PaintDesktop(HDC hdc);
1741 BOOL SetForegroundWindow(HWND hWnd);
1742 HWND WindowFromDC(HDC hDC);
1743 HDC GetDC(HWND hWnd);
1744 HDC GetDCEx(HWND hWnd, HRGN hrgnClip, DWORD flags);
1745 HDC GetWindowDC(HWND hWnd);
1746 int ReleaseDC(HWND hWnd, HDC hDC);
1747 HDC BeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint);
1748 BOOL EndPaint(HWND hWnd, PAINTSTRUCT *lpPaint);
1749 BOOL GetUpdateRect(HWND hWnd, LPRECT lpRect, BOOL bErase);
1750 int GetUpdateRgn(HWND hWnd, HRGN hRgn, BOOL bErase);
1751 int SetWindowRgn(HWND hWnd, HRGN hRgn, BOOL bRedraw);
1752 int GetWindowRgn(HWND hWnd, HRGN hRgn);
1753 int ExcludeUpdateRgn(HDC hDC, HWND hWnd);
1754 BOOL InvalidateRect(HWND hWnd, RECT *lpRect, BOOL bErase);
1755 BOOL ValidateRect(HWND hWnd, RECT *lpRect);
1756 BOOL InvalidateRgn(HWND hWnd, HRGN hRgn, BOOL bErase);
1757 BOOL ValidateRgn(HWND hWnd, HRGN hRgn);
1758 BOOL RedrawWindow(HWND hWnd, RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags);
1761 // flags for RedrawWindow()
1764 RDW_INVALIDATE = 0x0001,
1765 RDW_INTERNALPAINT = 0x0002,
1767 RDW_VALIDATE = 0x0008,
1768 RDW_NOINTERNALPAINT = 0x0010,
1769 RDW_NOERASE = 0x0020,
1770 RDW_NOCHILDREN = 0x0040,
1771 RDW_ALLCHILDREN = 0x0080,
1772 RDW_UPDATENOW = 0x0100,
1773 RDW_ERASENOW = 0x0200,
1775 RDW_NOFRAME = 0x0800,
1780 BOOL GetClientRect(HWND hWnd, LPRECT lpRect);
1781 BOOL GetWindowRect(HWND hWnd, LPRECT lpRect);
1782 BOOL AdjustWindowRect(LPRECT lpRect, DWORD dwStyle, BOOL bMenu);
1783 BOOL AdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle);
1784 HFONT CreateFontA(int, int, int, int, int, DWORD,
1785 DWORD, DWORD, DWORD, DWORD, DWORD,
1786 DWORD, DWORD, LPCSTR);
1787 HFONT CreateFontW(int, int, int, int, int, DWORD,
1788 DWORD, DWORD, DWORD, DWORD, DWORD,
1789 DWORD, DWORD, LPCWSTR);
1794 OUT_DEFAULT_PRECIS = 0,
1795 OUT_STRING_PRECIS = 1,
1796 OUT_CHARACTER_PRECIS = 2,
1797 OUT_STROKE_PRECIS = 3,
1799 OUT_DEVICE_PRECIS = 5,
1800 OUT_RASTER_PRECIS = 6,
1801 OUT_TT_ONLY_PRECIS = 7,
1802 OUT_OUTLINE_PRECIS = 8,
1803 OUT_SCREEN_OUTLINE_PRECIS = 9,
1805 CLIP_DEFAULT_PRECIS = 0,
1806 CLIP_CHARACTER_PRECIS = 1,
1807 CLIP_STROKE_PRECIS = 2,
1809 CLIP_LH_ANGLES = (1<<4),
1810 CLIP_TT_ALWAYS = (2<<4),
1811 CLIP_EMBEDDED = (8<<4),
1813 DEFAULT_QUALITY = 0,
1817 NONANTIALIASED_QUALITY = 3,
1818 ANTIALIASED_QUALITY = 4,
1829 DEFAULT_CHARSET = 1,
1831 SHIFTJIS_CHARSET = 128,
1832 HANGEUL_CHARSET = 129,
1833 GB2312_CHARSET = 134,
1834 CHINESEBIG5_CHARSET = 136,
1837 JOHAB_CHARSET = 130,
1838 HEBREW_CHARSET = 177,
1839 ARABIC_CHARSET = 178,
1840 GREEK_CHARSET = 161,
1841 TURKISH_CHARSET = 162,
1842 VIETNAMESE_CHARSET = 163,
1844 EASTEUROPE_CHARSET = 238,
1845 RUSSIAN_CHARSET = 204,
1848 BALTIC_CHARSET = 186,
1850 FS_LATIN1 = 0x00000001L,
1851 FS_LATIN2 = 0x00000002L,
1852 FS_CYRILLIC = 0x00000004L,
1853 FS_GREEK = 0x00000008L,
1854 FS_TURKISH = 0x00000010L,
1855 FS_HEBREW = 0x00000020L,
1856 FS_ARABIC = 0x00000040L,
1857 FS_BALTIC = 0x00000080L,
1858 FS_VIETNAMESE = 0x00000100L,
1859 FS_THAI = 0x00010000L,
1860 FS_JISJAPAN = 0x00020000L,
1861 FS_CHINESESIMP = 0x00040000L,
1862 FS_WANSUNG = 0x00080000L,
1863 FS_CHINESETRAD = 0x00100000L,
1864 FS_JOHAB = 0x00200000L,
1865 FS_SYMBOL = cast(int)0x80000000L,
1869 FF_DONTCARE = (0<<4), /* Don't care or don't know. */
1870 FF_ROMAN = (1<<4), /* Variable stroke width, serifed. */
1871 /* Times Roman, Century Schoolbook, etc. */
1872 FF_SWISS = (2<<4), /* Variable stroke width, sans-serifed. */
1873 /* Helvetica, Swiss, etc. */
1874 FF_MODERN = (3<<4), /* Constant stroke width, serifed or sans-serifed. */
1875 /* Pica, Elite, Courier, etc. */
1876 FF_SCRIPT = (4<<4), /* Cursive, etc. */
1877 FF_DECORATIVE = (5<<4), /* Old English, etc. */
1882 FW_EXTRALIGHT = 200,
1891 FW_ULTRALIGHT = FW_EXTRALIGHT,
1892 FW_REGULAR = FW_NORMAL,
1893 FW_DEMIBOLD = FW_SEMIBOLD,
1894 FW_ULTRABOLD = FW_EXTRABOLD,
1895 FW_BLACK = FW_HEAVY,
1898 PAN_FAMILYTYPE_INDEX = 0,
1899 PAN_SERIFSTYLE_INDEX = 1,
1900 PAN_WEIGHT_INDEX = 2,
1901 PAN_PROPORTION_INDEX = 3,
1902 PAN_CONTRAST_INDEX = 4,
1903 PAN_STROKEVARIATION_INDEX = 5,
1904 PAN_ARMSTYLE_INDEX = 6,
1905 PAN_LETTERFORM_INDEX = 7,
1906 PAN_MIDLINE_INDEX = 8,
1907 PAN_XHEIGHT_INDEX = 9,
1909 PAN_CULTURE_LATIN = 0,
1918 alias RGBQUAD* LPRGBQUAD;
1920 struct BITMAPINFOHEADER
1927 DWORD biCompression;
1929 LONG biXPelsPerMeter;
1930 LONG biYPelsPerMeter;
1932 DWORD biClrImportant;
1934 alias BITMAPINFOHEADER* LPBITMAPINFOHEADER, PBITMAPINFOHEADER;
1937 BITMAPINFOHEADER bmiHeader;
1938 RGBQUAD bmiColors[1];
1940 alias BITMAPINFO* LPBITMAPINFO, PBITMAPINFO;
1942 struct PALETTEENTRY {
1948 alias PALETTEENTRY* PPALETTEENTRY, LPPALETTEENTRY;
1953 PALETTEENTRY palPalEntry[1];
1955 alias LOGPALETTE* PLOGPALETTE, NPLOGPALETTE, LPLOGPALETTE;
1957 /* Pixel format descriptor */
1958 struct PIXELFORMATDESCRIPTOR
1975 BYTE cAccumGreenBits;
1976 BYTE cAccumBlueBits;
1977 BYTE cAccumAlphaBits;
1984 DWORD dwVisibleMask;
1987 alias PIXELFORMATDESCRIPTOR* PPIXELFORMATDESCRIPTOR, LPPIXELFORMATDESCRIPTOR;
1992 BOOL RoundRect(HDC, int, int, int, int, int, int);
1993 BOOL ResizePalette(HPALETTE, UINT);
1995 int SelectClipRgn(HDC, HRGN);
1996 int ExtSelectClipRgn(HDC, HRGN, int);
1997 int SetMetaRgn(HDC);
1998 HGDIOBJ SelectObject(HDC, HGDIOBJ);
1999 HPALETTE SelectPalette(HDC, HPALETTE, BOOL);
2000 COLORREF SetBkColor(HDC, COLORREF);
2001 int SetBkMode(HDC, int);
2002 LONG SetBitmapBits(HBITMAP, DWORD, void *);
2003 UINT SetBoundsRect(HDC, RECT *, UINT);
2004 int SetDIBits(HDC, HBITMAP, UINT, UINT, void *, BITMAPINFO *, UINT);
2005 int SetDIBitsToDevice(HDC, int, int, DWORD, DWORD, int,
2006 int, UINT, UINT, void *, BITMAPINFO *, UINT);
2007 DWORD SetMapperFlags(HDC, DWORD);
2008 int SetGraphicsMode(HDC hdc, int iMode);
2009 int SetMapMode(HDC, int);
2010 HMETAFILE SetMetaFileBitsEx(UINT, BYTE *);
2011 UINT SetPaletteEntries(HPALETTE, UINT, UINT, PALETTEENTRY *);
2012 COLORREF SetPixel(HDC, int, int, COLORREF);
2013 BOOL SetPixelV(HDC, int, int, COLORREF);
2014 BOOL SetPixelFormat(HDC, int, PIXELFORMATDESCRIPTOR *);
2015 int SetPolyFillMode(HDC, int);
2016 BOOL StretchBlt(HDC, int, int, int, int, HDC, int, int, int, int, DWORD);
2017 BOOL SetRectRgn(HRGN, int, int, int, int);
2018 int StretchDIBits(HDC, int, int, int, int, int, int, int, int,
2019 void *, BITMAPINFO *, UINT, DWORD);
2020 int SetROP2(HDC, int);
2021 int SetStretchBltMode(HDC, int);
2022 UINT SetSystemPaletteUse(HDC, UINT);
2023 int SetTextCharacterExtra(HDC, int);
2024 COLORREF SetTextColor(HDC, COLORREF);
2025 UINT SetTextAlign(HDC, UINT);
2026 BOOL SetTextJustification(HDC, int, int);
2027 BOOL UpdateColors(HDC);
2030 /* Text Alignment Options */
2044 TA_RTLREADING = 256,
2045 TA_MASK = (TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING),
2053 alias POINT* PPOINT, NPPOINT, LPPOINT;
2058 BOOL MoveToEx(HDC, int, int, LPPOINT);
2059 BOOL TextOutA(HDC, int, int, LPCSTR, int);
2060 BOOL TextOutW(HDC, int, int, LPCWSTR, int);
2063 export void PostQuitMessage(int nExitCode);
2064 export LRESULT DefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
2065 export HMODULE GetModuleHandleA(LPCSTR lpModuleName);
2067 alias LRESULT (* WNDPROC)(HWND, UINT, WPARAM, LPARAM);
2069 struct WNDCLASSEXA {
2073 WNDPROC lpfnWndProc;
2076 HINSTANCE hInstance;
2079 HBRUSH hbrBackground;
2080 LPCSTR lpszMenuName;
2081 LPCSTR lpszClassName;
2085 alias WNDCLASSEXA* PWNDCLASSEXA, NPWNDCLASSEXA, LPWNDCLASSEXA;
2090 WNDPROC lpfnWndProc;
2093 HINSTANCE hInstance;
2096 HBRUSH hbrBackground;
2097 LPCSTR lpszMenuName;
2098 LPCSTR lpszClassName;
2100 alias WNDCLASSA* PWNDCLASSA, NPWNDCLASSA, LPWNDCLASSA;
2101 alias WNDCLASSA WNDCLASS;
2108 WS_OVERLAPPED = 0x00000000,
2109 WS_POPUP = 0x80000000,
2110 WS_CHILD = 0x40000000,
2111 WS_MINIMIZE = 0x20000000,
2112 WS_VISIBLE = 0x10000000,
2113 WS_DISABLED = 0x08000000,
2114 WS_CLIPSIBLINGS = 0x04000000,
2115 WS_CLIPCHILDREN = 0x02000000,
2116 WS_MAXIMIZE = 0x01000000,
2117 WS_CAPTION = 0x00C00000, /* WS_BORDER | WS_DLGFRAME */
2118 WS_BORDER = 0x00800000,
2119 WS_DLGFRAME = 0x00400000,
2120 WS_VSCROLL = 0x00200000,
2121 WS_HSCROLL = 0x00100000,
2122 WS_SYSMENU = 0x00080000,
2123 WS_THICKFRAME = 0x00040000,
2124 WS_GROUP = 0x00020000,
2125 WS_TABSTOP = 0x00010000,
2127 WS_MINIMIZEBOX = 0x00020000,
2128 WS_MAXIMIZEBOX = 0x00010000,
2130 WS_TILED = WS_OVERLAPPED,
2131 WS_ICONIC = WS_MINIMIZE,
2132 WS_SIZEBOX = WS_THICKFRAME,
2135 * Common Window Styles
2137 WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX),
2138 WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW,
2139 WS_POPUPWINDOW = (WS_POPUP | WS_BORDER | WS_SYSMENU),
2140 WS_CHILDWINDOW = (WS_CHILD),
2148 CS_VREDRAW = 0x0001,
2149 CS_HREDRAW = 0x0002,
2150 CS_KEYCVTWINDOW = 0x0004,
2151 CS_DBLCLKS = 0x0008,
2153 CS_CLASSDC = 0x0040,
2154 CS_PARENTDC = 0x0080,
2155 CS_NOKEYCVT = 0x0100,
2156 CS_NOCLOSE = 0x0200,
2157 CS_SAVEBITS = 0x0800,
2158 CS_BYTEALIGNCLIENT = 0x1000,
2159 CS_BYTEALIGNWINDOW = 0x2000,
2160 CS_GLOBALCLASS = 0x4000,
2163 CS_IME = 0x00010000,
2168 HICON LoadIconA(HINSTANCE hInstance, LPCSTR lpIconName);
2169 HICON LoadIconW(HINSTANCE hInstance, LPCWSTR lpIconName);
2170 HCURSOR LoadCursorA(HINSTANCE hInstance, LPCSTR lpCursorName);
2171 HCURSOR LoadCursorW(HINSTANCE hInstance, LPCWSTR lpCursorName);
2179 IDI_APPLICATION = cast(LPSTR)(32512),
2181 IDC_ARROW = cast(LPSTR)(32512),
2182 IDC_CROSS = cast(LPSTR)(32515),
2187 const IDI_APPLICATION = cast(LPSTR)(32512);
2189 const IDC_ARROW = cast(LPSTR)(32512);
2190 const IDC_CROSS = cast(LPSTR)(32515);
2198 CTLCOLOR_MSGBOX = 0,
2200 CTLCOLOR_LISTBOX = 2,
2203 CTLCOLOR_SCROLLBAR = 5,
2204 CTLCOLOR_STATIC = 6,
2207 COLOR_SCROLLBAR = 0,
2208 COLOR_BACKGROUND = 1,
2209 COLOR_ACTIVECAPTION = 2,
2210 COLOR_INACTIVECAPTION = 3,
2213 COLOR_WINDOWFRAME = 6,
2215 COLOR_WINDOWTEXT = 8,
2216 COLOR_CAPTIONTEXT = 9,
2217 COLOR_ACTIVEBORDER = 10,
2218 COLOR_INACTIVEBORDER = 11,
2219 COLOR_APPWORKSPACE = 12,
2220 COLOR_HIGHLIGHT = 13,
2221 COLOR_HIGHLIGHTTEXT = 14,
2223 COLOR_BTNSHADOW = 16,
2224 COLOR_GRAYTEXT = 17,
2226 COLOR_INACTIVECAPTIONTEXT = 19,
2227 COLOR_BTNHIGHLIGHT = 20,
2230 COLOR_3DDKSHADOW = 21,
2232 COLOR_INFOTEXT = 23,
2235 COLOR_DESKTOP = COLOR_BACKGROUND,
2236 COLOR_3DFACE = COLOR_BTNFACE,
2237 COLOR_3DSHADOW = COLOR_BTNSHADOW,
2238 COLOR_3DHIGHLIGHT = COLOR_BTNHIGHLIGHT,
2239 COLOR_3DHILIGHT = COLOR_BTNHIGHLIGHT,
2240 COLOR_BTNHILIGHT = COLOR_BTNHIGHLIGHT,
2245 CW_USEDEFAULT = cast(int)0x80000000
2249 * Special value for CreateWindow, et al.
2256 HWND_DESKTOP = cast(HWND)0,
2261 const HWND_DESKTOP = cast(HWND)0;
2264 export ATOM RegisterClassA(WNDCLASSA *lpWndClass);
2266 export HWND CreateWindowExA(
2269 LPCSTR lpWindowName,
2277 HINSTANCE hInstance,
2283 LPCSTR lpWindowName,
2291 HINSTANCE hInstance,
2294 return CreateWindowExA(0, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
2308 alias MSG* PMSG, NPMSG, LPMSG;
2312 BOOL GetMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax);
2313 BOOL TranslateMessage(MSG *lpMsg);
2314 LONG DispatchMessageA(MSG *lpMsg);
2315 BOOL PeekMessageA(MSG *lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg);
2319 export DWORD ExpandEnvironmentStringsA(LPCSTR lpSrc, LPSTR lpDst, DWORD nSize);
2323 BOOL IsValidCodePage(UINT CodePage);
2326 //BOOL GetCPInfo(UINT CodePage, LPCPINFO lpCPInfo);
2327 BOOL IsDBCSLeadByte(BYTE TestChar);
2328 BOOL IsDBCSLeadByteEx(UINT CodePage, BYTE TestChar);
2329 int MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cchMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
2330 int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cchMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar);
2333 export HANDLE CreateFileMappingA(HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName);
2334 export HANDLE CreateFileMappingW(HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCWSTR lpName);
2336 export BOOL GetMailslotInfo(HANDLE hMailslot, LPDWORD lpMaxMessageSize, LPDWORD lpNextSize, LPDWORD lpMessageCount, LPDWORD lpReadTimeout);
2337 export BOOL SetMailslotInfo(HANDLE hMailslot, DWORD lReadTimeout);
2338 export LPVOID MapViewOfFile(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, DWORD dwNumberOfBytesToMap);
2339 export LPVOID MapViewOfFileEx(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, DWORD dwNumberOfBytesToMap, LPVOID lpBaseAddress);
2340 export BOOL FlushViewOfFile(LPCVOID lpBaseAddress, DWORD dwNumberOfBytesToFlush);
2341 export BOOL UnmapViewOfFile(LPCVOID lpBaseAddress);
2343 export HGDIOBJ GetStockObject(int);
2344 export BOOL ShowWindow(HWND hWnd, int nCmdShow);
2346 /* Stock Logical Objects */
2354 HOLLOW_BRUSH = NULL_BRUSH,
2358 OEM_FIXED_FONT = 10,
2359 ANSI_FIXED_FONT = 11,
2362 DEVICE_DEFAULT_FONT = 14,
2363 DEFAULT_PALETTE = 15,
2364 SYSTEM_FIXED_FONT = 16,
2365 DEFAULT_GUI_FONT = 17,
2370 * ShowWindow() Commands
2376 SW_SHOWMINIMIZED = 2,
2377 SW_SHOWMAXIMIZED = 3,
2379 SW_SHOWNOACTIVATE = 4,
2382 SW_SHOWMINNOACTIVE = 7,
2385 SW_SHOWDEFAULT = 10,
2394 LONG tmInternalLeading;
2395 LONG tmExternalLeading;
2396 LONG tmAveCharWidth;
2397 LONG tmMaxCharWidth;
2400 LONG tmDigitizedAspectX;
2401 LONG tmDigitizedAspectY;
2409 BYTE tmPitchAndFamily;
2413 export BOOL GetTextMetricsA(HDC, TEXTMETRICA*);
2416 * Scroll Bar Constants
2426 * Scroll Bar Commands
2437 SB_THUMBPOSITION = 4,
2446 export int SetScrollPos(HWND hWnd, int nBar, int nPos, BOOL bRedraw);
2447 export int GetScrollPos(HWND hWnd, int nBar);
2448 export BOOL SetScrollRange(HWND hWnd, int nBar, int nMinPos, int nMaxPos, BOOL bRedraw);
2449 export BOOL GetScrollRange(HWND hWnd, int nBar, LPINT lpMinPos, LPINT lpMaxPos);
2450 export BOOL ShowScrollBar(HWND hWnd, int wBar, BOOL bShow);
2451 export BOOL EnableScrollBar(HWND hWnd, UINT wSBflags, UINT wArrows);
2454 * LockWindowUpdate API
2457 export BOOL LockWindowUpdate(HWND hWndLock);
2458 export BOOL ScrollWindow(HWND hWnd, int XAmount, int YAmount, RECT* lpRect, RECT* lpClipRect);
2459 export BOOL ScrollDC(HDC hDC, int dx, int dy, RECT* lprcScroll, RECT* lprcClip, HRGN hrgnUpdate, LPRECT lprcUpdate);
2460 export int ScrollWindowEx(HWND hWnd, int dx, int dy, RECT* prcScroll, RECT* prcClip, HRGN hrgnUpdate, LPRECT prcUpdate, UINT flags);
2463 * Virtual Keys, Standard Set
2466 { VK_LBUTTON = 0x01,
2469 VK_MBUTTON = 0x04, /* NOT contiguous with L & RBUTTON */
2503 /* VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */
2504 /* VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */
2522 VK_SEPARATOR = 0x6C,
2555 * VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys.
2556 * Used only as parameters to GetAsyncKeyState() and GetKeyState().
2557 * No other API or message will distinguish left and right keys in this way.
2567 VK_PROCESSKEY = 0xE5,
2578 VK_OEM_CLEAR = 0xFE,
2581 export LRESULT SendMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
2583 alias UINT (*LPOFNHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
2585 struct OPENFILENAMEA {
2588 HINSTANCE hInstance;
2590 LPSTR lpstrCustomFilter;
2591 DWORD nMaxCustFilter;
2595 LPSTR lpstrFileTitle;
2596 DWORD nMaxFileTitle;
2597 LPCSTR lpstrInitialDir;
2601 WORD nFileExtension;
2604 LPOFNHOOKPROC lpfnHook;
2605 LPCSTR lpTemplateName;
2607 alias OPENFILENAMEA *LPOPENFILENAMEA;
2609 struct OPENFILENAMEW {
2612 HINSTANCE hInstance;
2613 LPCWSTR lpstrFilter;
2614 LPWSTR lpstrCustomFilter;
2615 DWORD nMaxCustFilter;
2619 LPWSTR lpstrFileTitle;
2620 DWORD nMaxFileTitle;
2621 LPCWSTR lpstrInitialDir;
2625 WORD nFileExtension;
2626 LPCWSTR lpstrDefExt;
2628 LPOFNHOOKPROC lpfnHook;
2629 LPCWSTR lpTemplateName;
2631 alias OPENFILENAMEW *LPOPENFILENAMEW;
2633 BOOL GetOpenFileNameA(LPOPENFILENAMEA);
2634 BOOL GetOpenFileNameW(LPOPENFILENAMEW);
2636 BOOL GetSaveFileNameA(LPOPENFILENAMEA);
2637 BOOL GetSaveFileNameW(LPOPENFILENAMEW);
2639 short GetFileTitleA(LPCSTR, LPSTR, WORD);
2640 short GetFileTitleW(LPCWSTR, LPWSTR, WORD);
2644 PM_NOREMOVE = 0x0000,
2646 PM_NOYIELD = 0x0002,
2649 /* Bitmap Header Definition */
2660 alias BITMAP* PBITMAP, NPBITMAP, LPBITMAP;
2663 export HDC CreateCompatibleDC(HDC);
2665 export int GetObjectA(HGDIOBJ, int, LPVOID);
2666 export int GetObjectW(HGDIOBJ, int, LPVOID);
2667 export BOOL DeleteDC(HDC);
2680 BYTE lfOutPrecision;
2681 BYTE lfClipPrecision;
2683 BYTE lfPitchAndFamily;
2684 CHAR lfFaceName[32 ];
2686 alias LOGFONTA* PLOGFONTA, NPLOGFONTA, LPLOGFONTA;
2688 export HMENU LoadMenuA(HINSTANCE hInstance, LPCSTR lpMenuName);
2689 export HMENU LoadMenuW(HINSTANCE hInstance, LPCWSTR lpMenuName);
2691 export HMENU GetSubMenu(HMENU hMenu, int nPos);
2693 export HBITMAP LoadBitmapA(HINSTANCE hInstance, LPCSTR lpBitmapName);
2694 export HBITMAP LoadBitmapW(HINSTANCE hInstance, LPCWSTR lpBitmapName);
2696 LPSTR MAKEINTRESOURCEA(int i) { return cast(LPSTR)(cast(DWORD)(cast(WORD)(i))); }
2698 export HFONT CreateFontIndirectA(LOGFONTA *);
2700 export BOOL MessageBeep(UINT uType);
2701 export int ShowCursor(BOOL bShow);
2702 export BOOL SetCursorPos(int X, int Y);
2703 export HCURSOR SetCursor(HCURSOR hCursor);
2704 export BOOL GetCursorPos(LPPOINT lpPoint);
2705 export BOOL ClipCursor( RECT *lpRect);
2706 export BOOL GetClipCursor(LPRECT lpRect);
2707 export HCURSOR GetCursor();
2708 export BOOL CreateCaret(HWND hWnd, HBITMAP hBitmap , int nWidth, int nHeight);
2709 export UINT GetCaretBlinkTime();
2710 export BOOL SetCaretBlinkTime(UINT uMSeconds);
2711 export BOOL DestroyCaret();
2712 export BOOL HideCaret(HWND hWnd);
2713 export BOOL ShowCaret(HWND hWnd);
2714 export BOOL SetCaretPos(int X, int Y);
2715 export BOOL GetCaretPos(LPPOINT lpPoint);
2716 export BOOL ClientToScreen(HWND hWnd, LPPOINT lpPoint);
2717 export BOOL ScreenToClient(HWND hWnd, LPPOINT lpPoint);
2718 export int MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints);
2719 export HWND WindowFromPoint(POINT Point);
2720 export HWND ChildWindowFromPoint(HWND hWndParent, POINT Point);
2723 export BOOL TrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y,
2724 int nReserved, HWND hWnd, RECT *prcRect);
2726 align (2) struct DLGTEMPLATE {
2728 DWORD dwExtendedStyle;
2735 alias DLGTEMPLATE *LPDLGTEMPLATEA;
2736 alias DLGTEMPLATE *LPDLGTEMPLATEW;
2739 alias LPDLGTEMPLATEA LPDLGTEMPLATE;
2741 alias DLGTEMPLATE *LPCDLGTEMPLATEA;
2742 alias DLGTEMPLATE *LPCDLGTEMPLATEW;
2745 alias LPCDLGTEMPLATEA LPCDLGTEMPLATE;
2748 export int DialogBoxParamA(HINSTANCE hInstance, LPCSTR lpTemplateName,
2749 HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam);
2750 export int DialogBoxIndirectParamA(HINSTANCE hInstance,
2751 LPCDLGTEMPLATEA hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc,
2752 LPARAM dwInitParam);
2756 SRCCOPY = cast(DWORD)0x00CC0020, /* dest = source */
2757 SRCPAINT = cast(DWORD)0x00EE0086, /* dest = source OR dest */
2758 SRCAND = cast(DWORD)0x008800C6, /* dest = source AND dest */
2759 SRCINVERT = cast(DWORD)0x00660046, /* dest = source XOR dest */
2760 SRCERASE = cast(DWORD)0x00440328, /* dest = source AND (NOT dest) */
2761 NOTSRCCOPY = cast(DWORD)0x00330008, /* dest = (NOT source) */
2762 NOTSRCERASE = cast(DWORD)0x001100A6, /* dest = (NOT src) AND (NOT dest) */
2763 MERGECOPY = cast(DWORD)0x00C000CA, /* dest = (source AND pattern) */
2764 MERGEPAINT = cast(DWORD)0x00BB0226, /* dest = (NOT source) OR dest */
2765 PATCOPY = cast(DWORD)0x00F00021, /* dest = pattern */
2766 PATPAINT = cast(DWORD)0x00FB0A09, /* dest = DPSnoo */
2767 PATINVERT = cast(DWORD)0x005A0049, /* dest = pattern XOR dest */
2768 DSTINVERT = cast(DWORD)0x00550009, /* dest = (NOT dest) */
2769 BLACKNESS = cast(DWORD)0x00000042, /* dest = BLACK */
2770 WHITENESS = cast(DWORD)0x00FF0062, /* dest = WHITE */
2775 SND_SYNC = 0x0000, /* play synchronously (default) */
2776 SND_ASYNC = 0x0001, /* play asynchronously */
2777 SND_NODEFAULT = 0x0002, /* silence (!default) if sound not found */
2778 SND_MEMORY = 0x0004, /* pszSound points to a memory file */
2779 SND_LOOP = 0x0008, /* loop the sound until next sndPlaySound */
2780 SND_NOSTOP = 0x0010, /* don't stop any currently playing sound */
2782 SND_NOWAIT = 0x00002000, /* don't wait if the driver is busy */
2783 SND_ALIAS = 0x00010000, /* name is a registry alias */
2784 SND_ALIAS_ID = 0x00110000, /* alias is a predefined ID */
2785 SND_FILENAME = 0x00020000, /* name is file name */
2786 SND_RESOURCE = 0x00040004, /* name is resource name or atom */
2788 SND_PURGE = 0x0040, /* purge non-static events for task */
2789 SND_APPLICATION = 0x0080, /* look for application specific association */
2792 SND_ALIAS_START = 0, /* alias base */
2795 export BOOL PlaySoundA(LPCSTR pszSound, HMODULE hmod, DWORD fdwSound);
2796 export BOOL PlaySoundW(LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound);
2798 export int GetClipBox(HDC, LPRECT);
2799 export int GetClipRgn(HDC, HRGN);
2800 export int GetMetaRgn(HDC, HRGN);
2801 export HGDIOBJ GetCurrentObject(HDC, UINT);
2802 export BOOL GetCurrentPositionEx(HDC, LPPOINT);
2803 export int GetDeviceCaps(HDC, int);
2811 alias LOGPEN* PLOGPEN, NPLOGPEN, LPLOGPEN;
2816 PS_DASH = 1, /* ------- */
2817 PS_DOT = 2, /* ....... */
2818 PS_DASHDOT = 3, /* _._._._ */
2819 PS_DASHDOTDOT = 4, /* _.._.._ */
2824 PS_STYLE_MASK = 0x0000000F,
2826 PS_ENDCAP_ROUND = 0x00000000,
2827 PS_ENDCAP_SQUARE = 0x00000100,
2828 PS_ENDCAP_FLAT = 0x00000200,
2829 PS_ENDCAP_MASK = 0x00000F00,
2831 PS_JOIN_ROUND = 0x00000000,
2832 PS_JOIN_BEVEL = 0x00001000,
2833 PS_JOIN_MITER = 0x00002000,
2834 PS_JOIN_MASK = 0x0000F000,
2836 PS_COSMETIC = 0x00000000,
2837 PS_GEOMETRIC = 0x00010000,
2838 PS_TYPE_MASK = 0x000F0000,
2841 export HPALETTE CreatePalette(LOGPALETTE *);
2842 export HPEN CreatePen(int, int, COLORREF);
2843 export HPEN CreatePenIndirect(LOGPEN *);
2844 export HRGN CreatePolyPolygonRgn(POINT *, INT *, int, int);
2845 export HBRUSH CreatePatternBrush(HBITMAP);
2846 export HRGN CreateRectRgn(int, int, int, int);
2847 export HRGN CreateRectRgnIndirect(RECT *);
2848 export HRGN CreateRoundRectRgn(int, int, int, int, int, int);
2849 export BOOL CreateScalableFontResourceA(DWORD, LPCSTR, LPCSTR, LPCSTR);
2850 export BOOL CreateScalableFontResourceW(DWORD, LPCWSTR, LPCWSTR, LPCWSTR);
2852 COLORREF RGB(int r, int g, int b)
2854 return cast(COLORREF)
2855 ((cast(BYTE)r|(cast(WORD)(cast(BYTE)g)<<8))|((cast(DWORD)cast(BYTE)b)<<16));
2858 export BOOL LineTo(HDC, int, int);
2859 export BOOL DeleteObject(HGDIOBJ);
2860 export int FillRect(HDC hDC, RECT *lprc, HBRUSH hbr);
2863 export BOOL EndDialog(HWND hDlg, int nResult);
2864 export HWND GetDlgItem(HWND hDlg, int nIDDlgItem);
2866 export BOOL SetDlgItemInt(HWND hDlg, int nIDDlgItem, UINT uValue, BOOL bSigned);
2867 export UINT GetDlgItemInt(HWND hDlg, int nIDDlgItem, BOOL *lpTranslated,
2870 export BOOL SetDlgItemTextA(HWND hDlg, int nIDDlgItem, LPCSTR lpString);
2871 export BOOL SetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPCWSTR lpString);
2873 export UINT GetDlgItemTextA(HWND hDlg, int nIDDlgItem, LPSTR lpString, int nMaxCount);
2874 export UINT GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount);
2876 export BOOL CheckDlgButton(HWND hDlg, int nIDButton, UINT uCheck);
2877 export BOOL CheckRadioButton(HWND hDlg, int nIDFirstButton, int nIDLastButton,
2878 int nIDCheckButton);
2880 export UINT IsDlgButtonChecked(HWND hDlg, int nIDButton);
2882 export HWND SetFocus(HWND hWnd);
2884 export int wsprintfA(LPSTR, LPCSTR, ...);
2885 export int wsprintfW(LPWSTR, LPCWSTR, ...);
2889 INFINITE = uint.max,
2893 export HANDLE CreateSemaphoreA(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCTSTR lpName);
2894 export HANDLE OpenSemaphoreA(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCTSTR lpName);
2895 export BOOL ReleaseSemaphore(HANDLE hSemaphore, LONG lReleaseCount, LPLONG lpPreviousCount);
2901 alias COORD *PCOORD;
2909 alias SMALL_RECT *PSMALL_RECT;
2911 struct KEY_EVENT_RECORD {
2914 WORD wVirtualKeyCode;
2915 WORD wVirtualScanCode;
2920 DWORD dwControlKeyState;
2922 alias KEY_EVENT_RECORD *PKEY_EVENT_RECORD;
2925 // ControlKeyState flags
2930 RIGHT_ALT_PRESSED = 0x0001, // the right alt key is pressed.
2931 LEFT_ALT_PRESSED = 0x0002, // the left alt key is pressed.
2932 RIGHT_CTRL_PRESSED = 0x0004, // the right ctrl key is pressed.
2933 LEFT_CTRL_PRESSED = 0x0008, // the left ctrl key is pressed.
2934 SHIFT_PRESSED = 0x0010, // the shift key is pressed.
2935 NUMLOCK_ON = 0x0020, // the numlock light is on.
2936 SCROLLLOCK_ON = 0x0040, // the scrolllock light is on.
2937 CAPSLOCK_ON = 0x0080, // the capslock light is on.
2938 ENHANCED_KEY = 0x0100, // the key is enhanced.
2941 struct MOUSE_EVENT_RECORD {
2942 COORD dwMousePosition;
2943 DWORD dwButtonState;
2944 DWORD dwControlKeyState;
2947 alias MOUSE_EVENT_RECORD *PMOUSE_EVENT_RECORD;
2950 // ButtonState flags
2954 FROM_LEFT_1ST_BUTTON_PRESSED = 0x0001,
2955 RIGHTMOST_BUTTON_PRESSED = 0x0002,
2956 FROM_LEFT_2ND_BUTTON_PRESSED = 0x0004,
2957 FROM_LEFT_3RD_BUTTON_PRESSED = 0x0008,
2958 FROM_LEFT_4TH_BUTTON_PRESSED = 0x0010,
2967 MOUSE_MOVED = 0x0001,
2968 DOUBLE_CLICK = 0x0002,
2971 struct WINDOW_BUFFER_SIZE_RECORD {
2974 alias WINDOW_BUFFER_SIZE_RECORD *PWINDOW_BUFFER_SIZE_RECORD;
2976 struct MENU_EVENT_RECORD {
2979 alias MENU_EVENT_RECORD *PMENU_EVENT_RECORD;
2981 struct FOCUS_EVENT_RECORD {
2984 alias FOCUS_EVENT_RECORD *PFOCUS_EVENT_RECORD;
2986 struct INPUT_RECORD {
2989 KEY_EVENT_RECORD KeyEvent;
2990 MOUSE_EVENT_RECORD MouseEvent;
2991 WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
2992 MENU_EVENT_RECORD MenuEvent;
2993 FOCUS_EVENT_RECORD FocusEvent;
2996 alias INPUT_RECORD *PINPUT_RECORD;
3004 KEY_EVENT = 0x0001, // Event contains key event record
3005 MOUSE_EVENT = 0x0002, // Event contains mouse event record
3006 WINDOW_BUFFER_SIZE_EVENT = 0x0004, // Event contains window change event record
3007 MENU_EVENT = 0x0008, // Event contains menu event record
3008 FOCUS_EVENT = 0x0010, // event contains focus change
3018 alias CHAR_INFO *PCHAR_INFO;
3021 // Attributes flags:
3026 FOREGROUND_BLUE = 0x0001, // text color contains blue.
3027 FOREGROUND_GREEN = 0x0002, // text color contains green.
3028 FOREGROUND_RED = 0x0004, // text color contains red.
3029 FOREGROUND_INTENSITY = 0x0008, // text color is intensified.
3030 BACKGROUND_BLUE = 0x0010, // background color contains blue.
3031 BACKGROUND_GREEN = 0x0020, // background color contains green.
3032 BACKGROUND_RED = 0x0040, // background color contains red.
3033 BACKGROUND_INTENSITY = 0x0080, // background color is intensified.
3036 struct CONSOLE_SCREEN_BUFFER_INFO {
3038 COORD dwCursorPosition;
3040 SMALL_RECT srWindow;
3041 COORD dwMaximumWindowSize;
3043 alias CONSOLE_SCREEN_BUFFER_INFO *PCONSOLE_SCREEN_BUFFER_INFO;
3045 struct CONSOLE_CURSOR_INFO {
3049 alias CONSOLE_CURSOR_INFO *PCONSOLE_CURSOR_INFO;
3053 ENABLE_PROCESSED_INPUT = 0x0001,
3054 ENABLE_LINE_INPUT = 0x0002,
3055 ENABLE_ECHO_INPUT = 0x0004,
3056 ENABLE_WINDOW_INPUT = 0x0008,
3057 ENABLE_MOUSE_INPUT = 0x0010,
3062 ENABLE_PROCESSED_OUTPUT = 0x0001,
3063 ENABLE_WRAP_AT_EOL_OUTPUT = 0x0002,
3066 BOOL PeekConsoleInputA(HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead);
3067 BOOL PeekConsoleInputW(HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead);
3068 BOOL ReadConsoleInputA(HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead);
3069 BOOL ReadConsoleInputW(HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead);
3070 BOOL WriteConsoleInputA(HANDLE hConsoleInput, in INPUT_RECORD *lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsWritten);
3071 BOOL WriteConsoleInputW(HANDLE hConsoleInput, in INPUT_RECORD *lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsWritten);
3072 BOOL ReadConsoleOutputA(HANDLE hConsoleOutput, PCHAR_INFO lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, PSMALL_RECT lpReadRegion);
3073 BOOL ReadConsoleOutputW(HANDLE hConsoleOutput, PCHAR_INFO lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, PSMALL_RECT lpReadRegion);
3074 BOOL WriteConsoleOutputA(HANDLE hConsoleOutput, in CHAR_INFO *lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, PSMALL_RECT lpWriteRegion);
3075 BOOL WriteConsoleOutputW(HANDLE hConsoleOutput, in CHAR_INFO *lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, PSMALL_RECT lpWriteRegion);
3076 BOOL ReadConsoleOutputCharacterA(HANDLE hConsoleOutput, LPSTR lpCharacter, DWORD nLength, COORD dwReadCoord, LPDWORD lpNumberOfCharsRead);
3077 BOOL ReadConsoleOutputCharacterW(HANDLE hConsoleOutput, LPWSTR lpCharacter, DWORD nLength, COORD dwReadCoord, LPDWORD lpNumberOfCharsRead);
3078 BOOL ReadConsoleOutputAttribute(HANDLE hConsoleOutput, LPWORD lpAttribute, DWORD nLength, COORD dwReadCoord, LPDWORD lpNumberOfAttrsRead);
3079 BOOL WriteConsoleOutputCharacterA(HANDLE hConsoleOutput, LPCSTR lpCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfCharsWritten);
3080 BOOL WriteConsoleOutputCharacterW(HANDLE hConsoleOutput, LPCWSTR lpCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfCharsWritten);
3081 BOOL WriteConsoleOutputAttribute(HANDLE hConsoleOutput, in WORD *lpAttribute, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfAttrsWritten);
3082 BOOL FillConsoleOutputCharacterA(HANDLE hConsoleOutput, CHAR cCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfCharsWritten);
3083 BOOL FillConsoleOutputCharacterW(HANDLE hConsoleOutput, WCHAR cCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfCharsWritten);
3084 BOOL FillConsoleOutputAttribute(HANDLE hConsoleOutput, WORD wAttribute, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfAttrsWritten);
3085 BOOL GetConsoleMode(HANDLE hConsoleHandle, LPDWORD lpMode);
3086 BOOL GetNumberOfConsoleInputEvents(HANDLE hConsoleInput, LPDWORD lpNumberOfEvents);
3087 BOOL GetConsoleScreenBufferInfo(HANDLE hConsoleOutput, PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
3088 COORD GetLargestConsoleWindowSize( HANDLE hConsoleOutput);
3089 BOOL GetConsoleCursorInfo(HANDLE hConsoleOutput, PCONSOLE_CURSOR_INFO lpConsoleCursorInfo);
3090 BOOL GetNumberOfConsoleMouseButtons( LPDWORD lpNumberOfMouseButtons);
3091 BOOL SetConsoleMode(HANDLE hConsoleHandle, DWORD dwMode);
3092 BOOL SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput);
3093 BOOL FlushConsoleInputBuffer(HANDLE hConsoleInput);
3094 BOOL SetConsoleScreenBufferSize(HANDLE hConsoleOutput, COORD dwSize);
3095 BOOL SetConsoleCursorPosition(HANDLE hConsoleOutput, COORD dwCursorPosition);
3096 BOOL SetConsoleCursorInfo(HANDLE hConsoleOutput, in CONSOLE_CURSOR_INFO *lpConsoleCursorInfo);
3097 BOOL ScrollConsoleScreenBufferA(HANDLE hConsoleOutput, in SMALL_RECT *lpScrollRectangle, in SMALL_RECT *lpClipRectangle, COORD dwDestinationOrigin, in CHAR_INFO *lpFill);
3098 BOOL ScrollConsoleScreenBufferW(HANDLE hConsoleOutput, in SMALL_RECT *lpScrollRectangle, in SMALL_RECT *lpClipRectangle, COORD dwDestinationOrigin, in CHAR_INFO *lpFill);
3099 BOOL SetConsoleWindowInfo(HANDLE hConsoleOutput, BOOL bAbsolute, in SMALL_RECT *lpConsoleWindow);
3100 BOOL SetConsoleTextAttribute(HANDLE hConsoleOutput, WORD wAttributes);
3101 alias BOOL(*PHANDLER_ROUTINE)(DWORD CtrlType);
3102 BOOL SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, BOOL Add);
3103 BOOL GenerateConsoleCtrlEvent( DWORD dwCtrlEvent, DWORD dwProcessGroupId);
3104 BOOL AllocConsole();
3106 DWORD GetConsoleTitleA(LPSTR lpConsoleTitle, DWORD nSize);
3107 DWORD GetConsoleTitleW(LPWSTR lpConsoleTitle, DWORD nSize);
3108 BOOL SetConsoleTitleA(LPCSTR lpConsoleTitle);
3109 BOOL SetConsoleTitleW(LPCWSTR lpConsoleTitle);
3110 BOOL ReadConsoleA(HANDLE hConsoleInput, LPVOID lpBuffer, DWORD nNumberOfCharsToRead, LPDWORD lpNumberOfCharsRead, LPVOID lpReserved);
3111 BOOL ReadConsoleW(HANDLE hConsoleInput, LPVOID lpBuffer, DWORD nNumberOfCharsToRead, LPDWORD lpNumberOfCharsRead, LPVOID lpReserved);
3112 BOOL WriteConsoleA(HANDLE hConsoleOutput, in void *lpBuffer, DWORD nNumberOfCharsToWrite, LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved);
3113 BOOL WriteConsoleW(HANDLE hConsoleOutput, in void *lpBuffer, DWORD nNumberOfCharsToWrite, LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved);
3114 HANDLE CreateConsoleScreenBuffer(DWORD dwDesiredAccess, DWORD dwShareMode, in SECURITY_ATTRIBUTES *lpSecurityAttributes, DWORD dwFlags, LPVOID lpScreenBufferData);
3115 UINT GetConsoleCP();
3116 BOOL SetConsoleCP( UINT wCodePageID);
3117 UINT GetConsoleOutputCP();
3118 BOOL SetConsoleOutputCP(UINT wCodePageID);
3122 CONSOLE_TEXTMODE_BUFFER = 1,
3143 SM_CXFULLSCREEN = 16,
3144 SM_CYFULLSCREEN = 17,
3145 SM_CYKANJIWINDOW = 18,
3146 SM_MOUSEPRESENT = 19,
3163 SM_CXDOUBLECLK = 36,
3164 SM_CYDOUBLECLK = 37,
3165 SM_CXICONSPACING = 38,
3166 SM_CYICONSPACING = 39,
3167 SM_MENUDROPALIGNMENT = 40,
3169 SM_DBCSENABLED = 42,
3170 SM_CMOUSEBUTTONS = 43,
3173 SM_CXFIXEDFRAME = SM_CXDLGFRAME,
3174 SM_CYFIXEDFRAME = SM_CYDLGFRAME,
3175 SM_CXSIZEFRAME = SM_CXFRAME,
3176 SM_CYSIZEFRAME = SM_CYFRAME,
3181 SM_CXMINSPACING = 47,
3182 SM_CYMINSPACING = 48,
3185 SM_CYSMCAPTION = 51,
3191 SM_CXMINIMIZED = 57,
3192 SM_CYMINIMIZED = 58,
3195 SM_CXMAXIMIZED = 61,
3196 SM_CYMAXIMIZED = 62,
3202 SM_CXMENUCHECK = 71,
3203 SM_CYMENUCHECK = 72,
3204 SM_SLOWMACHINE = 73,
3205 SM_MIDEASTENABLED = 74,
3209 int GetSystemMetrics(int nIndex);
3213 STILL_ACTIVE = (0x103),
3217 LPVOID TlsGetValue(DWORD);
3218 BOOL TlsSetValue(DWORD, LPVOID);
3219 BOOL TlsFree(DWORD);