/binding/win32/winbase.d

http://github.com/wilkie/djehuty · D · 10445 lines · 8157 code · 1877 blank · 411 comment · 215 complexity · 05ea4678f52a2975e34e288e325d5799 MD5 · raw file

Large files are truncated click here to view the full file

  1. /*
  2. * winbase.d
  3. *
  4. * This module is a port of winbase.h to D.
  5. * The original copyright notice appears after this information block.
  6. *
  7. * Author: Dave Wilkinson
  8. * Originated: November 24th, 2009
  9. *
  10. */
  11. module binding.win32.winbase;
  12. import binding.c;
  13. import binding.win32.guiddef;
  14. import binding.win32.windef;
  15. import binding.win32.winnt;
  16. import binding.win32.ntstatus;
  17. extern(System):
  18. /************************************************************************
  19. * *
  20. * winbase.h -- This module defines the 32-Bit Windows Base APIs *
  21. * *
  22. * Copyright (c) Microsoft Corp. All rights reserved. *
  23. * *
  24. ************************************************************************/
  25. const auto INVALID_HANDLE_VALUE = (cast(HANDLE)cast(LONG_PTR)-1);
  26. const auto INVALID_FILE_SIZE = (cast(DWORD)0xFFFFFFFF);
  27. const auto INVALID_SET_FILE_POINTER = (cast(DWORD)-1);
  28. const auto INVALID_FILE_ATTRIBUTES = (cast(DWORD)-1);
  29. const auto FILE_BEGIN = 0;
  30. const auto FILE_CURRENT = 1;
  31. const auto FILE_END = 2;
  32. const auto TIME_ZONE_ID_INVALID = (cast(DWORD)0xFFFFFFFF);
  33. const auto WAIT_FAILED = (cast(DWORD)0xFFFFFFFF);
  34. const auto WAIT_OBJECT_0 = ((STATUS_WAIT_0 ) + 0 );
  35. const auto WAIT_ABANDONED = ((STATUS_ABANDONED_WAIT_0 ) + 0 );
  36. const auto WAIT_ABANDONED_0 = ((STATUS_ABANDONED_WAIT_0 ) + 0 );
  37. const auto WAIT_IO_COMPLETION = STATUS_USER_APC;
  38. const auto STILL_ACTIVE = STATUS_PENDING;
  39. const auto EXCEPTION_ACCESS_VIOLATION = STATUS_ACCESS_VIOLATION;
  40. const auto EXCEPTION_DATATYPE_MISALIGNMENT = STATUS_DATATYPE_MISALIGNMENT;
  41. const auto EXCEPTION_BREAKPOINT = STATUS_BREAKPOINT;
  42. const auto EXCEPTION_SINGLE_STEP = STATUS_SINGLE_STEP;
  43. const auto EXCEPTION_ARRAY_BOUNDS_EXCEEDED = STATUS_ARRAY_BOUNDS_EXCEEDED;
  44. const auto EXCEPTION_FLT_DENORMAL_OPERAND = STATUS_FLOAT_DENORMAL_OPERAND;
  45. const auto EXCEPTION_FLT_DIVIDE_BY_ZERO = STATUS_FLOAT_DIVIDE_BY_ZERO;
  46. const auto EXCEPTION_FLT_INEXACT_RESULT = STATUS_FLOAT_INEXACT_RESULT;
  47. const auto EXCEPTION_FLT_INVALID_OPERATION = STATUS_FLOAT_INVALID_OPERATION;
  48. const auto EXCEPTION_FLT_OVERFLOW = STATUS_FLOAT_OVERFLOW;
  49. const auto EXCEPTION_FLT_STACK_CHECK = STATUS_FLOAT_STACK_CHECK;
  50. const auto EXCEPTION_FLT_UNDERFLOW = STATUS_FLOAT_UNDERFLOW;
  51. const auto EXCEPTION_INT_DIVIDE_BY_ZERO = STATUS_INTEGER_DIVIDE_BY_ZERO;
  52. const auto EXCEPTION_INT_OVERFLOW = STATUS_INTEGER_OVERFLOW;
  53. const auto EXCEPTION_PRIV_INSTRUCTION = STATUS_PRIVILEGED_INSTRUCTION;
  54. const auto EXCEPTION_IN_PAGE_ERROR = STATUS_IN_PAGE_ERROR;
  55. const auto EXCEPTION_ILLEGAL_INSTRUCTION = STATUS_ILLEGAL_INSTRUCTION;
  56. const auto EXCEPTION_NONCONTINUABLE_EXCEPTION = STATUS_NONCONTINUABLE_EXCEPTION;
  57. const auto EXCEPTION_STACK_OVERFLOW = STATUS_STACK_OVERFLOW;
  58. const auto EXCEPTION_INVALID_DISPOSITION = STATUS_INVALID_DISPOSITION;
  59. const auto EXCEPTION_GUARD_PAGE = STATUS_GUARD_PAGE_VIOLATION;
  60. const auto EXCEPTION_INVALID_HANDLE = STATUS_INVALID_HANDLE;
  61. const auto EXCEPTION_POSSIBLE_DEADLOCK = STATUS_POSSIBLE_DEADLOCK;
  62. const auto CONTROL_C_EXIT = STATUS_CONTROL_C_EXIT;
  63. alias RtlMoveMemory MoveMemory;
  64. alias RtlCopyMemory CopyMemory;
  65. alias RtlFillMemory FillMemory;
  66. alias RtlZeroMemory ZeroMemory;
  67. //alias SecureZeroMemory RtlSecureZeroMemory;
  68. //alias CaptureStackBackTrace RtlCaptureStackBackTrace;
  69. //
  70. // File creation flags must start at the high end since they
  71. // are combined with the attributes
  72. //
  73. const auto FILE_FLAG_WRITE_THROUGH = 0x80000000;
  74. const auto FILE_FLAG_OVERLAPPED = 0x40000000;
  75. const auto FILE_FLAG_NO_BUFFERING = 0x20000000;
  76. const auto FILE_FLAG_RANDOM_ACCESS = 0x10000000;
  77. const auto FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000;
  78. const auto FILE_FLAG_DELETE_ON_CLOSE = 0x04000000;
  79. const auto FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
  80. const auto FILE_FLAG_POSIX_SEMANTICS = 0x01000000;
  81. const auto FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000;
  82. const auto FILE_FLAG_OPEN_NO_RECALL = 0x00100000;
  83. const auto FILE_FLAG_FIRST_PIPE_INSTANCE = 0x00080000;
  84. const auto CREATE_NEW = 1;
  85. const auto CREATE_ALWAYS = 2;
  86. const auto OPEN_EXISTING = 3;
  87. const auto OPEN_ALWAYS = 4;
  88. const auto TRUNCATE_EXISTING = 5;
  89. //
  90. // Define possible return codes from the CopyFileEx callback routine
  91. //
  92. const auto PROGRESS_CONTINUE = 0;
  93. const auto PROGRESS_CANCEL = 1;
  94. const auto PROGRESS_STOP = 2;
  95. const auto PROGRESS_QUIET = 3;
  96. //
  97. // Define CopyFileEx callback routine state change values
  98. //
  99. const auto CALLBACK_CHUNK_FINISHED = 0x00000000;
  100. const auto CALLBACK_STREAM_SWITCH = 0x00000001;
  101. //
  102. // Define CopyFileEx option flags
  103. //
  104. const auto COPY_FILE_FAIL_IF_EXISTS = 0x00000001;
  105. const auto COPY_FILE_RESTARTABLE = 0x00000002;
  106. const auto COPY_FILE_OPEN_SOURCE_FOR_WRITE = 0x00000004;
  107. const auto COPY_FILE_ALLOW_DECRYPTED_DESTINATION = 0x00000008;
  108. //
  109. // Gap for private copyfile flags
  110. //
  111. const auto COPY_FILE_COPY_SYMLINK = 0x00000800;
  112. //
  113. // Define ReplaceFile option flags
  114. //
  115. const auto REPLACEFILE_WRITE_THROUGH = 0x00000001;
  116. const auto REPLACEFILE_IGNORE_MERGE_ERRORS = 0x00000002;
  117. //
  118. // Define the NamedPipe definitions
  119. //
  120. //
  121. // Define the dwOpenMode values for CreateNamedPipe
  122. //
  123. const auto PIPE_ACCESS_INBOUND = 0x00000001;
  124. const auto PIPE_ACCESS_OUTBOUND = 0x00000002;
  125. const auto PIPE_ACCESS_DUPLEX = 0x00000003;
  126. //
  127. // Define the Named Pipe End flags for GetNamedPipeInfo
  128. //
  129. const auto PIPE_CLIENT_END = 0x00000000;
  130. const auto PIPE_SERVER_END = 0x00000001;
  131. //
  132. // Define the dwPipeMode values for CreateNamedPipe
  133. //
  134. const auto PIPE_WAIT = 0x00000000;
  135. const auto PIPE_NOWAIT = 0x00000001;
  136. const auto PIPE_READMODE_BYTE = 0x00000000;
  137. const auto PIPE_READMODE_MESSAGE = 0x00000002;
  138. const auto PIPE_TYPE_BYTE = 0x00000000;
  139. const auto PIPE_TYPE_MESSAGE = 0x00000004;
  140. const auto PIPE_ACCEPT_REMOTE_CLIENTS = 0x00000000;
  141. const auto PIPE_REJECT_REMOTE_CLIENTS = 0x00000008;
  142. //
  143. // Define the well known values for CreateNamedPipe nMaxInstances
  144. //
  145. const auto PIPE_UNLIMITED_INSTANCES = 255;
  146. //
  147. // Define the Security Quality of Service bits to be passed
  148. // into CreateFile
  149. //
  150. const auto SECURITY_ANONYMOUS = ( SECURITY_IMPERSONATION_LEVEL.SecurityAnonymous << 16 );
  151. const auto SECURITY_IDENTIFICATION = ( SECURITY_IMPERSONATION_LEVEL.SecurityIdentification << 16 );
  152. const auto SECURITY_IMPERSONATION = ( SECURITY_IMPERSONATION_LEVEL.SecurityImpersonation << 16 );
  153. const auto SECURITY_DELEGATION = ( SECURITY_IMPERSONATION_LEVEL.SecurityDelegation << 16 );
  154. const auto SECURITY_CONTEXT_TRACKING = 0x00040000;
  155. const auto SECURITY_EFFECTIVE_ONLY = 0x00080000;
  156. const auto SECURITY_SQOS_PRESENT = 0x00100000;
  157. const auto SECURITY_VALID_SQOS_FLAGS = 0x001F0000;
  158. //
  159. // File structures
  160. //
  161. struct OVERLAPPED {
  162. ULONG_PTR Internal;
  163. ULONG_PTR InternalHigh;
  164. union _inner_union {
  165. struct _inner_struct {
  166. DWORD Offset;
  167. DWORD OffsetHigh;
  168. }
  169. _inner_struct data;
  170. PVOID Pointer;
  171. }
  172. _inner_union fields;
  173. HANDLE hEvent;
  174. }
  175. alias OVERLAPPED* LPOVERLAPPED;
  176. struct OVERLAPPED_ENTRY {
  177. ULONG_PTR lpCompletionKey;
  178. LPOVERLAPPED lpOverlapped;
  179. ULONG_PTR Internal;
  180. DWORD dwNumberOfBytesTransferred;
  181. }
  182. alias OVERLAPPED_ENTRY* LPOVERLAPPED_ENTRY;
  183. struct SECURITY_ATTRIBUTES {
  184. DWORD nLength;
  185. LPVOID lpSecurityDescriptor;
  186. BOOL bInheritHandle;
  187. }
  188. alias SECURITY_ATTRIBUTES* PSECURITY_ATTRIBUTES;
  189. alias SECURITY_ATTRIBUTES* LPSECURITY_ATTRIBUTES;
  190. struct PROCESS_INFORMATION {
  191. HANDLE hProcess;
  192. HANDLE hThread;
  193. DWORD dwProcessId;
  194. DWORD dwThreadId;
  195. }
  196. alias PROCESS_INFORMATION* PPROCESS_INFORMATION;
  197. alias PROCESS_INFORMATION* LPPROCESS_INFORMATION;
  198. //
  199. // File System time stamps are represented with the following structure:
  200. //
  201. struct FILETIME {
  202. DWORD dwLowDateTime;
  203. DWORD dwHighDateTime;
  204. }
  205. alias FILETIME* PFILETIME;
  206. alias FILETIME* LPFILETIME;
  207. //
  208. // System time is represented with the following structure:
  209. //
  210. struct SYSTEMTIME {
  211. WORD wYear;
  212. WORD wMonth;
  213. WORD wDayOfWeek;
  214. WORD wDay;
  215. WORD wHour;
  216. WORD wMinute;
  217. WORD wSecond;
  218. WORD wMilliseconds;
  219. }
  220. alias SYSTEMTIME* PSYSTEMTIME;
  221. alias SYSTEMTIME* LPSYSTEMTIME;
  222. alias DWORD function(LPVOID lpThreadParameter) PTHREAD_START_ROUTINE;
  223. alias PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;
  224. alias VOID function(LPVOID) PFIBER_START_ROUTINE;
  225. alias PFIBER_START_ROUTINE LPFIBER_START_ROUTINE;
  226. alias RTL_CRITICAL_SECTION CRITICAL_SECTION;
  227. alias PRTL_CRITICAL_SECTION PCRITICAL_SECTION;
  228. alias PRTL_CRITICAL_SECTION LPCRITICAL_SECTION;
  229. alias RTL_CRITICAL_SECTION_DEBUG CRITICAL_SECTION_DEBUG;
  230. alias PRTL_CRITICAL_SECTION_DEBUG PCRITICAL_SECTION_DEBUG;
  231. alias PRTL_CRITICAL_SECTION_DEBUG LPCRITICAL_SECTION_DEBUG;
  232. //
  233. // Define one-time initialization primitive
  234. //
  235. alias RTL_RUN_ONCE INIT_ONCE;
  236. alias PRTL_RUN_ONCE PINIT_ONCE;
  237. alias PRTL_RUN_ONCE LPINIT_ONCE;
  238. const auto INIT_ONCE_STATIC_INIT = RTL_RUN_ONCE_INIT;
  239. //
  240. // Run once flags
  241. //
  242. const auto INIT_ONCE_CHECK_ONLY = RTL_RUN_ONCE_CHECK_ONLY;
  243. const auto INIT_ONCE_ASYNC = RTL_RUN_ONCE_ASYNC;
  244. const auto INIT_ONCE_INIT_FAILED = RTL_RUN_ONCE_INIT_FAILED;
  245. //
  246. // The context stored in the run once structure must leave the following number
  247. // of low order bits unused.
  248. //
  249. const auto INIT_ONCE_CTX_RESERVED_BITS = RTL_RUN_ONCE_CTX_RESERVED_BITS;
  250. alias BOOL function(PINIT_ONCE InitOnce, PVOID Parameter, PVOID* Context) PINIT_ONCE_FN;
  251. VOID InitOnceInitialize (
  252. PINIT_ONCE InitOnce
  253. );
  254. BOOL InitOnceExecuteOnce (
  255. PINIT_ONCE InitOnce,
  256. PINIT_ONCE_FN InitFn,
  257. PVOID Parameter,
  258. LPVOID *Context
  259. );
  260. BOOL InitOnceBeginInitialize (
  261. LPINIT_ONCE lpInitOnce,
  262. DWORD dwFlags,
  263. PBOOL fPending,
  264. LPVOID *lpContext
  265. );
  266. BOOL InitOnceComplete (
  267. LPINIT_ONCE lpInitOnce,
  268. DWORD dwFlags,
  269. LPVOID lpContext
  270. );
  271. //
  272. // Define the slim r/w lock
  273. //
  274. alias RTL_SRWLOCK SRWLOCK;
  275. alias RTL_SRWLOCK* PSRWLOCK;
  276. const auto SRWLOCK_INIT = RTL_SRWLOCK_INIT;
  277. VOID InitializeSRWLock (
  278. PSRWLOCK SRWLock
  279. );
  280. VOID ReleaseSRWLockExclusive (
  281. PSRWLOCK SRWLock
  282. );
  283. VOID ReleaseSRWLockShared (
  284. PSRWLOCK SRWLock
  285. );
  286. VOID AcquireSRWLockExclusive (
  287. PSRWLOCK SRWLock
  288. );
  289. VOID AcquireSRWLockShared (
  290. PSRWLOCK SRWLock
  291. );
  292. //
  293. // Define condition variable
  294. //
  295. alias RTL_CONDITION_VARIABLE CONDITION_VARIABLE;
  296. alias RTL_CONDITION_VARIABLE* PCONDITION_VARIABLE;
  297. VOID InitializeConditionVariable (
  298. PCONDITION_VARIABLE ConditionVariable
  299. );
  300. VOID WakeConditionVariable (
  301. PCONDITION_VARIABLE ConditionVariable
  302. );
  303. VOID WakeAllConditionVariable (
  304. PCONDITION_VARIABLE ConditionVariable
  305. );
  306. BOOL SleepConditionVariableCS (
  307. PCONDITION_VARIABLE ConditionVariable,
  308. PCRITICAL_SECTION CriticalSection,
  309. DWORD dwMilliseconds
  310. );
  311. BOOL SleepConditionVariableSRW (
  312. PCONDITION_VARIABLE ConditionVariable,
  313. PSRWLOCK SRWLock,
  314. DWORD dwMilliseconds,
  315. ULONG Flags
  316. );
  317. //
  318. // Static initializer for the condition variable
  319. //
  320. const auto CONDITION_VARIABLE_INIT = RTL_CONDITION_VARIABLE_INIT;
  321. //
  322. // Flags for condition variables
  323. //
  324. const auto CONDITION_VARIABLE_LOCKMODE_SHARED = RTL_CONDITION_VARIABLE_LOCKMODE_SHARED;
  325. PVOID EncodePointer (
  326. PVOID Ptr
  327. );
  328. PVOID DecodePointer (
  329. PVOID Ptr
  330. );
  331. PVOID EncodeSystemPointer (
  332. PVOID Ptr
  333. );
  334. PVOID DecodeSystemPointer (
  335. PVOID Ptr
  336. );
  337. version(X86) {
  338. //alias PLDT_ENTRY LPLDT_ENTRY;
  339. alias LPVOID LPLDT_ENTRY;
  340. }
  341. else {
  342. alias LPVOID LPLDT_ENTRY;
  343. }
  344. const auto MUTEX_MODIFY_STATE = MUTANT_QUERY_STATE;
  345. const auto MUTEX_ALL_ACCESS = MUTANT_ALL_ACCESS;
  346. //
  347. // Serial provider type.
  348. //
  349. const auto SP_SERIALCOMM = (cast(DWORD)0x00000001);
  350. //
  351. // Provider SubTypes
  352. //
  353. const auto PST_UNSPECIFIED = (cast(DWORD)0x00000000);
  354. const auto PST_RS232 = (cast(DWORD)0x00000001);
  355. const auto PST_PARALLELPORT = (cast(DWORD)0x00000002);
  356. const auto PST_RS422 = (cast(DWORD)0x00000003);
  357. const auto PST_RS423 = (cast(DWORD)0x00000004);
  358. const auto PST_RS449 = (cast(DWORD)0x00000005);
  359. const auto PST_MODEM = (cast(DWORD)0x00000006);
  360. const auto PST_FAX = (cast(DWORD)0x00000021);
  361. const auto PST_SCANNER = (cast(DWORD)0x00000022);
  362. const auto PST_NETWORK_BRIDGE = (cast(DWORD)0x00000100);
  363. const auto PST_LAT = (cast(DWORD)0x00000101);
  364. const auto PST_TCPIP_TELNET = (cast(DWORD)0x00000102);
  365. const auto PST_X25 = (cast(DWORD)0x00000103);
  366. //
  367. // Provider capabilities flags.
  368. //
  369. const auto PCF_DTRDSR = (cast(DWORD)0x0001);
  370. const auto PCF_RTSCTS = (cast(DWORD)0x0002);
  371. const auto PCF_RLSD = (cast(DWORD)0x0004);
  372. const auto PCF_PARITY_CHECK = (cast(DWORD)0x0008);
  373. const auto PCF_XONXOFF = (cast(DWORD)0x0010);
  374. const auto PCF_SETXCHAR = (cast(DWORD)0x0020);
  375. const auto PCF_TOTALTIMEOUTS = (cast(DWORD)0x0040);
  376. const auto PCF_INTTIMEOUTS = (cast(DWORD)0x0080);
  377. const auto PCF_SPECIALCHARS = (cast(DWORD)0x0100);
  378. const auto PCF_16BITMODE = (cast(DWORD)0x0200);
  379. //
  380. // Comm provider settable parameters.
  381. //
  382. const auto SP_PARITY = (cast(DWORD)0x0001);
  383. const auto SP_BAUD = (cast(DWORD)0x0002);
  384. const auto SP_DATABITS = (cast(DWORD)0x0004);
  385. const auto SP_STOPBITS = (cast(DWORD)0x0008);
  386. const auto SP_HANDSHAKING = (cast(DWORD)0x0010);
  387. const auto SP_PARITY_CHECK = (cast(DWORD)0x0020);
  388. const auto SP_RLSD = (cast(DWORD)0x0040);
  389. //
  390. // Settable baud rates in the provider.
  391. //
  392. const auto BAUD_075 = (cast(DWORD)0x00000001);
  393. const auto BAUD_110 = (cast(DWORD)0x00000002);
  394. const auto BAUD_134_5 = (cast(DWORD)0x00000004);
  395. const auto BAUD_150 = (cast(DWORD)0x00000008);
  396. const auto BAUD_300 = (cast(DWORD)0x00000010);
  397. const auto BAUD_600 = (cast(DWORD)0x00000020);
  398. const auto BAUD_1200 = (cast(DWORD)0x00000040);
  399. const auto BAUD_1800 = (cast(DWORD)0x00000080);
  400. const auto BAUD_2400 = (cast(DWORD)0x00000100);
  401. const auto BAUD_4800 = (cast(DWORD)0x00000200);
  402. const auto BAUD_7200 = (cast(DWORD)0x00000400);
  403. const auto BAUD_9600 = (cast(DWORD)0x00000800);
  404. const auto BAUD_14400 = (cast(DWORD)0x00001000);
  405. const auto BAUD_19200 = (cast(DWORD)0x00002000);
  406. const auto BAUD_38400 = (cast(DWORD)0x00004000);
  407. const auto BAUD_56K = (cast(DWORD)0x00008000);
  408. const auto BAUD_128K = (cast(DWORD)0x00010000);
  409. const auto BAUD_115200 = (cast(DWORD)0x00020000);
  410. const auto BAUD_57600 = (cast(DWORD)0x00040000);
  411. const auto BAUD_USER = (cast(DWORD)0x10000000);
  412. //
  413. // Settable Data Bits
  414. //
  415. const auto DATABITS_5 = (cast(WORD)0x0001);
  416. const auto DATABITS_6 = (cast(WORD)0x0002);
  417. const auto DATABITS_7 = (cast(WORD)0x0004);
  418. const auto DATABITS_8 = (cast(WORD)0x0008);
  419. const auto DATABITS_16 = (cast(WORD)0x0010);
  420. const auto DATABITS_16X = (cast(WORD)0x0020);
  421. //
  422. // Settable Stop and Parity bits.
  423. //
  424. const auto STOPBITS_10 = (cast(WORD)0x0001);
  425. const auto STOPBITS_15 = (cast(WORD)0x0002);
  426. const auto STOPBITS_20 = (cast(WORD)0x0004);
  427. const auto PARITY_NONE = (cast(WORD)0x0100);
  428. const auto PARITY_ODD = (cast(WORD)0x0200);
  429. const auto PARITY_EVEN = (cast(WORD)0x0400);
  430. const auto PARITY_MARK = (cast(WORD)0x0800);
  431. const auto PARITY_SPACE = (cast(WORD)0x1000);
  432. struct COMMPROP {
  433. WORD wPacketLength;
  434. WORD wPacketVersion;
  435. DWORD dwServiceMask;
  436. DWORD dwReserved1;
  437. DWORD dwMaxTxQueue;
  438. DWORD dwMaxRxQueue;
  439. DWORD dwMaxBaud;
  440. DWORD dwProvSubType;
  441. DWORD dwProvCapabilities;
  442. DWORD dwSettableParams;
  443. DWORD dwSettableBaud;
  444. WORD wSettableData;
  445. WORD wSettableStopParity;
  446. DWORD dwCurrentTxQueue;
  447. DWORD dwCurrentRxQueue;
  448. DWORD dwProvSpec1;
  449. DWORD dwProvSpec2;
  450. WCHAR[1] wcProvChar;
  451. }
  452. alias COMMPROP* LPCOMMPROP;
  453. //
  454. // Set dwProvSpec1 to COMMPROP_INITIALIZED to indicate that wPacketLength
  455. // is valid before a call to GetCommProperties().
  456. //
  457. const auto COMMPROP_INITIALIZED = (cast(DWORD)0xE73CF52E);
  458. struct COMSTAT {
  459. DWORD flags;
  460. /* DWORD fCtsHold : 1;
  461. DWORD fDsrHold : 1;
  462. DWORD fRlsdHold : 1;
  463. DWORD fXoffHold : 1;
  464. DWORD fXoffSent : 1;
  465. DWORD fEof : 1;
  466. DWORD fTxim : 1;
  467. DWORD fReserved : 25;
  468. */
  469. DWORD cbInQue;
  470. DWORD cbOutQue;
  471. }
  472. alias COMSTAT* LPCOMSTAT;
  473. //
  474. // DTR Control Flow Values.
  475. //
  476. const auto DTR_CONTROL_DISABLE = 0x00;
  477. const auto DTR_CONTROL_ENABLE = 0x01;
  478. const auto DTR_CONTROL_HANDSHAKE = 0x02;
  479. //
  480. // RTS Control Flow Values
  481. //
  482. const auto RTS_CONTROL_DISABLE = 0x00;
  483. const auto RTS_CONTROL_ENABLE = 0x01;
  484. const auto RTS_CONTROL_HANDSHAKE = 0x02;
  485. const auto RTS_CONTROL_TOGGLE = 0x03;
  486. struct DCB {
  487. DWORD DCBlength; /* sizeof(DCB) */
  488. DWORD BaudRate; /* Baudrate at which running */
  489. DWORD flags;
  490. /+ DWORD fBinary: 1; /* Binary Mode (skip EOF check) */
  491. DWORD fParity: 1; /* Enable parity checking */
  492. DWORD fOutxCtsFlow:1; /* CTS handshaking on output */
  493. DWORD fOutxDsrFlow:1; /* DSR handshaking on output */
  494. DWORD fDtrControl:2; /* DTR Flow control */
  495. DWORD fDsrSensitivity:1; /* DSR Sensitivity */
  496. DWORD fTXContinueOnXoff: 1; /* Continue TX when Xoff sent */
  497. DWORD fOutX: 1; /* Enable output X-ON/X-OFF */
  498. DWORD fInX: 1; /* Enable input X-ON/X-OFF */
  499. DWORD fErrorChar: 1; /* Enable Err Replacement */
  500. DWORD fNull: 1; /* Enable Null stripping */
  501. DWORD fRtsControl:2; /* Rts Flow control */
  502. DWORD fAbortOnError:1; /* Abort all reads and writes on Error */
  503. DWORD fDummy2:17; /* Reserved */
  504. +/
  505. WORD wReserved; /* Not currently used */
  506. WORD XonLim; /* Transmit X-ON threshold */
  507. WORD XoffLim; /* Transmit X-OFF threshold */
  508. BYTE ByteSize; /* Number of bits/byte, 4-8 */
  509. BYTE Parity; /* 0-4=None,Odd,Even,Mark,Space */
  510. BYTE StopBits; /* 0,1,2 = 1, 1.5, 2 */
  511. char XonChar; /* Tx and Rx X-ON character */
  512. char XoffChar; /* Tx and Rx X-OFF character */
  513. char ErrorChar; /* Error replacement char */
  514. char EofChar; /* End of Input character */
  515. char EvtChar; /* Received Event character */
  516. WORD wReserved1; /* Fill for now. */
  517. }
  518. alias DCB* LPDCB;
  519. struct COMMTIMEOUTS {
  520. DWORD ReadIntervalTimeout; /* Maximum time between read chars. */
  521. DWORD ReadTotalTimeoutMultiplier; /* Multiplier of characters. */
  522. DWORD ReadTotalTimeoutConstant; /* Constant in milliseconds. */
  523. DWORD WriteTotalTimeoutMultiplier; /* Multiplier of characters. */
  524. DWORD WriteTotalTimeoutConstant; /* Constant in milliseconds. */
  525. }
  526. alias COMMTIMEOUTS* LPCOMMTIMEOUTS;
  527. struct COMMCONFIG {
  528. DWORD dwSize; /* Size of the entire struct */
  529. WORD wVersion; /* version of the structure */
  530. WORD wReserved; /* alignment */
  531. DCB dcb; /* device control block */
  532. DWORD dwProviderSubType; /* ordinal value for identifying
  533. provider-defined data structure format*/
  534. DWORD dwProviderOffset; /* Specifies the offset of provider specific
  535. data field in bytes from the start */
  536. DWORD dwProviderSize; /* size of the provider-specific data field */
  537. WCHAR wcProviderData[1]; /* provider-specific data */
  538. }
  539. alias COMMCONFIG* LPCOMMCONFIG;
  540. struct SYSTEM_INFO {
  541. WORD wProcessorArchitecture;
  542. WORD wReserved;
  543. DWORD dwPageSize;
  544. LPVOID lpMinimumApplicationAddress;
  545. LPVOID lpMaximumApplicationAddress;
  546. DWORD_PTR dwActiveProcessorMask;
  547. DWORD dwNumberOfProcessors;
  548. DWORD dwProcessorType;
  549. DWORD dwAllocationGranularity;
  550. WORD wProcessorLevel;
  551. WORD wProcessorRevision;
  552. }
  553. alias SYSTEM_INFO* LPSYSTEM_INFO;
  554. //
  555. //
  556. alias FreeLibrary FreeModule;
  557. //const auto MakeProcInstance(lpProc,hInstance) = (lpProc);
  558. //const auto FreeProcInstance(lpProc) = (lpProc);
  559. /* Global Memory Flags */
  560. const auto GMEM_FIXED = 0x0000;
  561. const auto GMEM_MOVEABLE = 0x0002;
  562. const auto GMEM_NOCOMPACT = 0x0010;
  563. const auto GMEM_NODISCARD = 0x0020;
  564. const auto GMEM_ZEROINIT = 0x0040;
  565. const auto GMEM_MODIFY = 0x0080;
  566. const auto GMEM_DISCARDABLE = 0x0100;
  567. const auto GMEM_NOT_BANKED = 0x1000;
  568. const auto GMEM_SHARE = 0x2000;
  569. const auto GMEM_DDESHARE = 0x2000;
  570. const auto GMEM_NOTIFY = 0x4000;
  571. const auto GMEM_LOWER = GMEM_NOT_BANKED;
  572. const auto GMEM_VALID_FLAGS = 0x7F72;
  573. const auto GMEM_INVALID_HANDLE = 0x8000;
  574. const auto GHND = (GMEM_MOVEABLE | GMEM_ZEROINIT);
  575. const auto GPTR = (GMEM_FIXED | GMEM_ZEROINIT);
  576. //const auto GlobalLRUNewest( = h ) ((HANDLE)(h));
  577. //const auto GlobalLRUOldest( = h ) ((HANDLE)(h));
  578. //const auto GlobalDiscard( = h ) GlobalReAlloc( (h), 0, GMEM_MOVEABLE );
  579. /* Flags returned by GlobalFlags (in addition to GMEM_DISCARDABLE) */
  580. const auto GMEM_DISCARDED = 0x4000;
  581. const auto GMEM_LOCKCOUNT = 0x00FF;
  582. struct MEMORYSTATUS {
  583. DWORD dwLength;
  584. DWORD dwMemoryLoad;
  585. SIZE_T dwTotalPhys;
  586. SIZE_T dwAvailPhys;
  587. SIZE_T dwTotalPageFile;
  588. SIZE_T dwAvailPageFile;
  589. SIZE_T dwTotalVirtual;
  590. SIZE_T dwAvailVirtual;
  591. }
  592. alias MEMORYSTATUS* LPMEMORYSTATUS;
  593. /* Local Memory Flags */
  594. const auto LMEM_FIXED = 0x0000;
  595. const auto LMEM_MOVEABLE = 0x0002;
  596. const auto LMEM_NOCOMPACT = 0x0010;
  597. const auto LMEM_NODISCARD = 0x0020;
  598. const auto LMEM_ZEROINIT = 0x0040;
  599. const auto LMEM_MODIFY = 0x0080;
  600. const auto LMEM_DISCARDABLE = 0x0F00;
  601. const auto LMEM_VALID_FLAGS = 0x0F72;
  602. const auto LMEM_INVALID_HANDLE = 0x8000;
  603. const auto LHND = (LMEM_MOVEABLE | LMEM_ZEROINIT);
  604. const auto LPTR = (LMEM_FIXED | LMEM_ZEROINIT);
  605. const auto NONZEROLHND = (LMEM_MOVEABLE);
  606. const auto NONZEROLPTR = (LMEM_FIXED);
  607. //const auto LocalDiscard( = h ) LocalReAlloc( (h), 0, LMEM_MOVEABLE );
  608. /* Flags returned by LocalFlags (in addition to LMEM_DISCARDABLE) */
  609. const auto LMEM_DISCARDED = 0x4000;
  610. const auto LMEM_LOCKCOUNT = 0x00FF;
  611. //
  612. // NUMA values
  613. //
  614. const auto NUMA_NO_PREFERRED_NODE = (cast(DWORD) -1);
  615. //
  616. // dwCreationFlag values
  617. //
  618. const auto DEBUG_PROCESS = 0x00000001;
  619. const auto DEBUG_ONLY_THIS_PROCESS = 0x00000002;
  620. const auto CREATE_SUSPENDED = 0x00000004;
  621. const auto DETACHED_PROCESS = 0x00000008;
  622. const auto CREATE_NEW_CONSOLE = 0x00000010;
  623. const auto NORMAL_PRIORITY_CLASS = 0x00000020;
  624. const auto IDLE_PRIORITY_CLASS = 0x00000040;
  625. const auto HIGH_PRIORITY_CLASS = 0x00000080;
  626. const auto REALTIME_PRIORITY_CLASS = 0x00000100;
  627. const auto CREATE_NEW_PROCESS_GROUP = 0x00000200;
  628. const auto CREATE_UNICODE_ENVIRONMENT = 0x00000400;
  629. const auto CREATE_SEPARATE_WOW_VDM = 0x00000800;
  630. const auto CREATE_SHARED_WOW_VDM = 0x00001000;
  631. const auto CREATE_FORCEDOS = 0x00002000;
  632. const auto BELOW_NORMAL_PRIORITY_CLASS = 0x00004000;
  633. const auto ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000;
  634. const auto STACK_SIZE_PARAM_IS_A_RESERVATION = 0x00010000;
  635. const auto INHERIT_CALLER_PRIORITY = 0x00020000;
  636. const auto CREATE_PROTECTED_PROCESS = 0x00040000;
  637. const auto EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
  638. const auto PROCESS_MODE_BACKGROUND_BEGIN = 0x00100000;
  639. const auto PROCESS_MODE_BACKGROUND_END = 0x00200000;
  640. const auto CREATE_BREAKAWAY_FROM_JOB = 0x01000000;
  641. const auto CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000;
  642. const auto CREATE_DEFAULT_ERROR_MODE = 0x04000000;
  643. const auto CREATE_NO_WINDOW = 0x08000000;
  644. const auto PROFILE_USER = 0x10000000;
  645. const auto PROFILE_KERNEL = 0x20000000;
  646. const auto PROFILE_SERVER = 0x40000000;
  647. const auto CREATE_IGNORE_SYSTEM_DEFAULT = 0x80000000;
  648. const auto THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN;
  649. const auto THREAD_PRIORITY_BELOW_NORMAL = (THREAD_PRIORITY_LOWEST+1);
  650. const auto THREAD_PRIORITY_NORMAL = 0;
  651. const auto THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX;
  652. const auto THREAD_PRIORITY_ABOVE_NORMAL = (THREAD_PRIORITY_HIGHEST-1);
  653. const auto THREAD_PRIORITY_ERROR_RETURN = (MAXLONG);
  654. const auto THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT;
  655. const auto THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE;
  656. const auto THREAD_MODE_BACKGROUND_BEGIN = 0x00010000;
  657. const auto THREAD_MODE_BACKGROUND_END = 0x00020000;
  658. //
  659. // GetFinalPathNameByHandle
  660. //
  661. const auto VOLUME_NAME_DOS = 0x0 ; //default
  662. const auto VOLUME_NAME_GUID = 0x1;
  663. const auto VOLUME_NAME_NT = 0x2;
  664. const auto VOLUME_NAME_NONE = 0x4;
  665. const auto FILE_NAME_NORMALIZED = 0x0 ; //default
  666. const auto FILE_NAME_OPENED = 0x8;
  667. //
  668. // Debug APIs
  669. //
  670. const auto EXCEPTION_DEBUG_EVENT = 1;
  671. const auto CREATE_THREAD_DEBUG_EVENT = 2;
  672. const auto CREATE_PROCESS_DEBUG_EVENT = 3;
  673. const auto EXIT_THREAD_DEBUG_EVENT = 4;
  674. const auto EXIT_PROCESS_DEBUG_EVENT = 5;
  675. const auto LOAD_DLL_DEBUG_EVENT = 6;
  676. const auto UNLOAD_DLL_DEBUG_EVENT = 7;
  677. const auto OUTPUT_DEBUG_STRING_EVENT = 8;
  678. const auto RIP_EVENT = 9;
  679. struct EXCEPTION_DEBUG_INFO {
  680. EXCEPTION_RECORD ExceptionRecord;
  681. DWORD dwFirstChance;
  682. }
  683. alias EXCEPTION_DEBUG_INFO* LPEXCEPTION_DEBUG_INFO;
  684. struct CREATE_THREAD_DEBUG_INFO {
  685. HANDLE hThread;
  686. LPVOID lpThreadLocalBase;
  687. LPTHREAD_START_ROUTINE lpStartAddress;
  688. }
  689. alias CREATE_THREAD_DEBUG_INFO* LPCREATE_THREAD_DEBUG_INFO;
  690. struct CREATE_PROCESS_DEBUG_INFO {
  691. HANDLE hFile;
  692. HANDLE hProcess;
  693. HANDLE hThread;
  694. LPVOID lpBaseOfImage;
  695. DWORD dwDebugInfoFileOffset;
  696. DWORD nDebugInfoSize;
  697. LPVOID lpThreadLocalBase;
  698. LPTHREAD_START_ROUTINE lpStartAddress;
  699. LPVOID lpImageName;
  700. WORD fUnicode;
  701. }
  702. alias CREATE_PROCESS_DEBUG_INFO* LPCREATE_PROCESS_DEBUG_INFO;
  703. struct EXIT_THREAD_DEBUG_INFO {
  704. DWORD dwExitCode;
  705. }
  706. alias EXIT_THREAD_DEBUG_INFO* LPEXIT_THREAD_DEBUG_INFO;
  707. struct EXIT_PROCESS_DEBUG_INFO {
  708. DWORD dwExitCode;
  709. }
  710. alias EXIT_PROCESS_DEBUG_INFO* LPEXIT_PROCESS_DEBUG_INFO;
  711. struct LOAD_DLL_DEBUG_INFO {
  712. HANDLE hFile;
  713. LPVOID lpBaseOfDll;
  714. DWORD dwDebugInfoFileOffset;
  715. DWORD nDebugInfoSize;
  716. LPVOID lpImageName;
  717. WORD fUnicode;
  718. }
  719. alias LOAD_DLL_DEBUG_INFO* LPLOAD_DLL_DEBUG_INFO;
  720. struct UNLOAD_DLL_DEBUG_INFO {
  721. LPVOID lpBaseOfDll;
  722. }
  723. alias UNLOAD_DLL_DEBUG_INFO* LPUNLOAD_DLL_DEBUG_INFO;
  724. struct OUTPUT_DEBUG_STRING_INFO {
  725. LPSTR lpDebugStringData;
  726. WORD fUnicode;
  727. WORD nDebugStringLength;
  728. }
  729. alias OUTPUT_DEBUG_STRING_INFO* LPOUTPUT_DEBUG_STRING_INFO;
  730. struct RIP_INFO {
  731. DWORD dwError;
  732. DWORD dwType;
  733. }
  734. alias RIP_INFO* LPRIP_INFO;
  735. struct DEBUG_EVENT {
  736. DWORD dwDebugEventCode;
  737. DWORD dwProcessId;
  738. DWORD dwThreadId;
  739. union _inner_union {
  740. EXCEPTION_DEBUG_INFO Exception;
  741. CREATE_THREAD_DEBUG_INFO CreateThread;
  742. CREATE_PROCESS_DEBUG_INFO CreateProcessInfo;
  743. EXIT_THREAD_DEBUG_INFO ExitThread;
  744. EXIT_PROCESS_DEBUG_INFO ExitProcess;
  745. LOAD_DLL_DEBUG_INFO LoadDll;
  746. UNLOAD_DLL_DEBUG_INFO UnloadDll;
  747. OUTPUT_DEBUG_STRING_INFO DebugString;
  748. RIP_INFO RipInfo;
  749. }
  750. _inner_union u;
  751. }
  752. alias DEBUG_EVENT* LPDEBUG_EVENT;
  753. //
  754. // JIT Debugging Info. This structure is defined to have constant size in
  755. // both the emulated and native environment.
  756. //
  757. struct JIT_DEBUG_INFO {
  758. DWORD dwSize;
  759. DWORD dwProcessorArchitecture;
  760. DWORD dwThreadID;
  761. DWORD dwReserved0;
  762. ULONG64 lpExceptionAddress;
  763. ULONG64 lpExceptionRecord;
  764. ULONG64 lpContextRecord;
  765. }
  766. alias JIT_DEBUG_INFO* LPJIT_DEBUG_INFO;
  767. alias JIT_DEBUG_INFO JIT_DEBUG_INFO32;
  768. alias JIT_DEBUG_INFO* LPJIT_DEBUG_INFO32;
  769. alias JIT_DEBUG_INFO JIT_DEBUG_INFO64;
  770. alias JIT_DEBUG_INFO* LPJIT_DEBUG_INFO64;
  771. alias PCONTEXT LPCONTEXT;
  772. alias PEXCEPTION_RECORD LPEXCEPTION_RECORD;
  773. alias PEXCEPTION_POINTERS LPEXCEPTION_POINTERS;
  774. const auto DRIVE_UNKNOWN = 0;
  775. const auto DRIVE_NO_ROOT_DIR = 1;
  776. const auto DRIVE_REMOVABLE = 2;
  777. const auto DRIVE_FIXED = 3;
  778. const auto DRIVE_REMOTE = 4;
  779. const auto DRIVE_CDROM = 5;
  780. const auto DRIVE_RAMDISK = 6;
  781. DWORD GetFreeSpace(uint w) { return (0x100000); }
  782. const auto FILE_TYPE_UNKNOWN = 0x0000;
  783. const auto FILE_TYPE_DISK = 0x0001;
  784. const auto FILE_TYPE_CHAR = 0x0002;
  785. const auto FILE_TYPE_PIPE = 0x0003;
  786. const auto FILE_TYPE_REMOTE = 0x8000;
  787. const auto STD_INPUT_HANDLE = (cast(DWORD)-10);
  788. const auto STD_OUTPUT_HANDLE = (cast(DWORD)-11);
  789. const auto STD_ERROR_HANDLE = (cast(DWORD)-12);
  790. const auto NOPARITY = 0;
  791. const auto ODDPARITY = 1;
  792. const auto EVENPARITY = 2;
  793. const auto MARKPARITY = 3;
  794. const auto SPACEPARITY = 4;
  795. const auto ONESTOPBIT = 0;
  796. const auto ONE5STOPBITS = 1;
  797. const auto TWOSTOPBITS = 2;
  798. const auto IGNORE = 0 ; // Ignore signal
  799. const auto INFINITE = 0xFFFFFFFF ; // Infinite timeout
  800. //
  801. // Baud rates at which the communication device operates
  802. //
  803. const auto CBR_110 = 110;
  804. const auto CBR_300 = 300;
  805. const auto CBR_600 = 600;
  806. const auto CBR_1200 = 1200;
  807. const auto CBR_2400 = 2400;
  808. const auto CBR_4800 = 4800;
  809. const auto CBR_9600 = 9600;
  810. const auto CBR_14400 = 14400;
  811. const auto CBR_19200 = 19200;
  812. const auto CBR_38400 = 38400;
  813. const auto CBR_56000 = 56000;
  814. const auto CBR_57600 = 57600;
  815. const auto CBR_115200 = 115200;
  816. const auto CBR_128000 = 128000;
  817. const auto CBR_256000 = 256000;
  818. //
  819. // Error Flags
  820. //
  821. const auto CE_RXOVER = 0x0001 ; // Receive Queue overflow
  822. const auto CE_OVERRUN = 0x0002 ; // Receive Overrun Error
  823. const auto CE_RXPARITY = 0x0004 ; // Receive Parity Error
  824. const auto CE_FRAME = 0x0008 ; // Receive Framing error
  825. const auto CE_BREAK = 0x0010 ; // Break Detected
  826. const auto CE_TXFULL = 0x0100 ; // TX Queue is full
  827. const auto CE_PTO = 0x0200 ; // LPTx Timeout
  828. const auto CE_IOE = 0x0400 ; // LPTx I/O Error
  829. const auto CE_DNS = 0x0800 ; // LPTx Device not selected
  830. const auto CE_OOP = 0x1000 ; // LPTx Out-Of-Paper
  831. const auto CE_MODE = 0x8000 ; // Requested mode unsupported
  832. const auto IE_BADID = (-1) ; // Invalid or unsupported id
  833. const auto IE_OPEN = (-2) ; // Device Already Open
  834. const auto IE_NOPEN = (-3) ; // Device Not Open
  835. const auto IE_MEMORY = (-4) ; // Unable to allocate queues
  836. const auto IE_DEFAULT = (-5) ; // Error in default parameters
  837. const auto IE_HARDWARE = (-10) ; // Hardware Not Present
  838. const auto IE_BYTESIZE = (-11) ; // Illegal Byte Size
  839. const auto IE_BAUDRATE = (-12) ; // Unsupported BaudRate
  840. //
  841. // Events
  842. //
  843. const auto EV_RXCHAR = 0x0001 ; // Any Character received
  844. const auto EV_RXFLAG = 0x0002 ; // Received certain character
  845. const auto EV_TXEMPTY = 0x0004 ; // Transmitt Queue Empty
  846. const auto EV_CTS = 0x0008 ; // CTS changed state
  847. const auto EV_DSR = 0x0010 ; // DSR changed state
  848. const auto EV_RLSD = 0x0020 ; // RLSD changed state
  849. const auto EV_BREAK = 0x0040 ; // BREAK received
  850. const auto EV_ERR = 0x0080 ; // Line status error occurred
  851. const auto EV_RING = 0x0100 ; // Ring signal detected
  852. const auto EV_PERR = 0x0200 ; // Printer error occured
  853. const auto EV_RX80FULL = 0x0400 ; // Receive buffer is 80 percent full
  854. const auto EV_EVENT1 = 0x0800 ; // Provider specific event 1
  855. const auto EV_EVENT2 = 0x1000 ; // Provider specific event 2
  856. //
  857. // Escape Functions
  858. //
  859. const auto SETXOFF = 1 ; // Simulate XOFF received
  860. const auto SETXON = 2 ; // Simulate XON received
  861. const auto SETRTS = 3 ; // Set RTS high
  862. const auto CLRRTS = 4 ; // Set RTS low
  863. const auto SETDTR = 5 ; // Set DTR high
  864. const auto CLRDTR = 6 ; // Set DTR low
  865. const auto RESETDEV = 7 ; // Reset device if possible
  866. const auto SETBREAK = 8 ; // Set the device break line.
  867. const auto CLRBREAK = 9 ; // Clear the device break line.
  868. //
  869. // PURGE function flags.
  870. //
  871. const auto PURGE_TXABORT = 0x0001 ; // Kill the pending/current writes to the comm port.
  872. const auto PURGE_RXABORT = 0x0002 ; // Kill the pending/current reads to the comm port.
  873. const auto PURGE_TXCLEAR = 0x0004 ; // Kill the transmit queue if there.
  874. const auto PURGE_RXCLEAR = 0x0008 ; // Kill the typeahead buffer if there.
  875. const auto LPTx = 0x80 ; // Set if ID is for LPT device
  876. //
  877. // Modem Status Flags
  878. //
  879. const auto MS_CTS_ON = (cast(DWORD)0x0010);
  880. const auto MS_DSR_ON = (cast(DWORD)0x0020);
  881. const auto MS_RING_ON = (cast(DWORD)0x0040);
  882. const auto MS_RLSD_ON = (cast(DWORD)0x0080);
  883. //
  884. // WaitSoundState() Constants
  885. //
  886. const auto S_QUEUEEMPTY = 0;
  887. const auto S_THRESHOLD = 1;
  888. const auto S_ALLTHRESHOLD = 2;
  889. //
  890. // Accent Modes
  891. //
  892. const auto S_NORMAL = 0;
  893. const auto S_LEGATO = 1;
  894. const auto S_STACCATO = 2;
  895. //
  896. // SetSoundNoise() Sources
  897. //
  898. const auto S_PERIOD512 = 0 ; // Freq = N/512 high pitch, less coarse hiss
  899. const auto S_PERIOD1024 = 1 ; // Freq = N/1024
  900. const auto S_PERIOD2048 = 2 ; // Freq = N/2048 low pitch, more coarse hiss
  901. const auto S_PERIODVOICE = 3 ; // Source is frequency from voice channel (3)
  902. const auto S_WHITE512 = 4 ; // Freq = N/512 high pitch, less coarse hiss
  903. const auto S_WHITE1024 = 5 ; // Freq = N/1024
  904. const auto S_WHITE2048 = 6 ; // Freq = N/2048 low pitch, more coarse hiss
  905. const auto S_WHITEVOICE = 7 ; // Source is frequency from voice channel (3)
  906. const auto S_SERDVNA = (-1) ; // Device not available
  907. const auto S_SEROFM = (-2) ; // Out of memory
  908. const auto S_SERMACT = (-3) ; // Music active
  909. const auto S_SERQFUL = (-4) ; // Queue full
  910. const auto S_SERBDNT = (-5) ; // Invalid note
  911. const auto S_SERDLN = (-6) ; // Invalid note length
  912. const auto S_SERDCC = (-7) ; // Invalid note count
  913. const auto S_SERDTP = (-8) ; // Invalid tempo
  914. const auto S_SERDVL = (-9) ; // Invalid volume
  915. const auto S_SERDMD = (-10) ; // Invalid mode
  916. const auto S_SERDSH = (-11) ; // Invalid shape
  917. const auto S_SERDPT = (-12) ; // Invalid pitch
  918. const auto S_SERDFQ = (-13) ; // Invalid frequency
  919. const auto S_SERDDR = (-14) ; // Invalid duration
  920. const auto S_SERDSR = (-15) ; // Invalid source
  921. const auto S_SERDST = (-16) ; // Invalid state
  922. const auto NMPWAIT_WAIT_FOREVER = 0xffffffff;
  923. const auto NMPWAIT_NOWAIT = 0x00000001;
  924. const auto NMPWAIT_USE_DEFAULT_WAIT = 0x00000000;
  925. const auto FS_CASE_IS_PRESERVED = FILE_CASE_PRESERVED_NAMES;
  926. const auto FS_CASE_SENSITIVE = FILE_CASE_SENSITIVE_SEARCH;
  927. const auto FS_UNICODE_STORED_ON_DISK = FILE_UNICODE_ON_DISK;
  928. const auto FS_PERSISTENT_ACLS = FILE_PERSISTENT_ACLS;
  929. const auto FS_VOL_IS_COMPRESSED = FILE_VOLUME_IS_COMPRESSED;
  930. const auto FS_FILE_COMPRESSION = FILE_FILE_COMPRESSION;
  931. const auto FS_FILE_ENCRYPTION = FILE_SUPPORTS_ENCRYPTION;
  932. const auto FILE_MAP_COPY = SECTION_QUERY;
  933. const auto FILE_MAP_WRITE = SECTION_MAP_WRITE;
  934. const auto FILE_MAP_READ = SECTION_MAP_READ;
  935. const auto FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS;
  936. const auto FILE_MAP_EXECUTE = SECTION_MAP_EXECUTE_EXPLICIT ; // not included in FILE_MAP_ALL_ACCESS
  937. const auto OF_READ = 0x00000000;
  938. const auto OF_WRITE = 0x00000001;
  939. const auto OF_READWRITE = 0x00000002;
  940. const auto OF_SHARE_COMPAT = 0x00000000;
  941. const auto OF_SHARE_EXCLUSIVE = 0x00000010;
  942. const auto OF_SHARE_DENY_WRITE = 0x00000020;
  943. const auto OF_SHARE_DENY_READ = 0x00000030;
  944. const auto OF_SHARE_DENY_NONE = 0x00000040;
  945. const auto OF_PARSE = 0x00000100;
  946. const auto OF_DELETE = 0x00000200;
  947. const auto OF_VERIFY = 0x00000400;
  948. const auto OF_CANCEL = 0x00000800;
  949. const auto OF_CREATE = 0x00001000;
  950. const auto OF_PROMPT = 0x00002000;
  951. const auto OF_EXIST = 0x00004000;
  952. const auto OF_REOPEN = 0x00008000;
  953. const auto OFS_MAXPATHNAME = 128;
  954. struct OFSTRUCT {
  955. BYTE cBytes;
  956. BYTE fFixedDisk;
  957. WORD nErrCode;
  958. WORD Reserved1;
  959. WORD Reserved2;
  960. CHAR szPathName[OFS_MAXPATHNAME];
  961. }
  962. alias OFSTRUCT* LPOFSTRUCT;
  963. alias OFSTRUCT* POFSTRUCT;
  964. version(NOWINBASEINTERLOCK) {
  965. }
  966. else {
  967. LONG InterlockedIncrement (
  968. LONG* lpAddend
  969. );
  970. LONG InterlockedDecrement (
  971. LONG* lpAddend
  972. );
  973. LONG InterlockedExchange (
  974. LONG* Target,
  975. LONG Value
  976. );
  977. //const auto InterlockedExchangePointer(Target, = Value) \;
  978. // (PVOID)InterlockedExchange((PLONG)(Target), (LONG)(Value))
  979. LONG InterlockedExchangeAdd (
  980. LONG *Addend,
  981. LONG Value
  982. );
  983. LONG InterlockedCompareExchange (
  984. LONG* Destination,
  985. LONG Exchange,
  986. LONG Comperand
  987. );
  988. LONGLONG InterlockedCompareExchange64 (
  989. LONGLONG *Destination,
  990. LONGLONG Exchange,
  991. LONGLONG Comperand
  992. );
  993. alias InterlockedIncrement InterlockedIncrementAcquire;
  994. alias InterlockedIncrement InterlockedIncrementRelease;
  995. alias InterlockedDecrement InterlockedDecrementAcquire;
  996. alias InterlockedDecrement InterlockedDecrementRelease;
  997. alias InterlockedIncrement InterlockedIncrementAcquire;
  998. alias InterlockedIncrement InterlockedIncrementRelease;
  999. alias InterlockedCompareExchange InterlockedCompareExchangeAcquire;
  1000. alias InterlockedCompareExchange InterlockedCompareExchangeRelease;
  1001. alias InterlockedCompareExchange64 InterlockedCompareExchangeAcquire64;
  1002. alias InterlockedCompareExchange64 InterlockedCompareExchangeRelease64;
  1003. //alias InterlockedCompareExchangePointer InterlockedCompareExchangePointerAcquire;
  1004. //alias InterlockedCompareExchangePointer InterlockedCompareExchangePointerRelease;
  1005. VOID InitializeSListHead (
  1006. PSLIST_HEADER ListHead
  1007. );
  1008. PSLIST_ENTRY InterlockedPopEntrySList (
  1009. PSLIST_HEADER ListHead
  1010. );
  1011. PSLIST_ENTRY InterlockedPushEntrySList (
  1012. PSLIST_HEADER ListHead,
  1013. PSLIST_ENTRY ListEntry
  1014. );
  1015. PSLIST_ENTRY InterlockedFlushSList (
  1016. PSLIST_HEADER ListHead
  1017. );
  1018. USHORT QueryDepthSList (
  1019. PSLIST_HEADER ListHead
  1020. );
  1021. }
  1022. BOOL FreeResource(
  1023. HGLOBAL hResData
  1024. );
  1025. LPVOID LockResource(
  1026. HGLOBAL hResData
  1027. );
  1028. //const auto UnlockResource(hResData) = ((hResData), 0);
  1029. const auto MAXINTATOM = 0xC000;
  1030. template MAKEINTATOM(WORD i) {
  1031. const LPTSTR MAKEINTATOM = cast(LPTSTR)(cast(ULONG_PTR)(cast(WORD)(i)));
  1032. }
  1033. const auto INVALID_ATOM = (cast(ATOM)0);
  1034. int WinMain (
  1035. HINSTANCE hInstance,
  1036. HINSTANCE hPrevInstance,
  1037. LPSTR lpCmdLine,
  1038. int nShowCmd
  1039. );
  1040. int wWinMain(
  1041. HINSTANCE hInstance,
  1042. HINSTANCE hPrevInstance,
  1043. LPWSTR lpCmdLine,
  1044. int nShowCmd
  1045. );
  1046. BOOL FreeLibrary (
  1047. HMODULE hLibModule
  1048. );
  1049. VOID FreeLibraryAndExitThread (
  1050. HMODULE hLibModule,
  1051. DWORD dwExitCode
  1052. );
  1053. BOOL DisableThreadLibraryCalls (
  1054. HMODULE hLibModule
  1055. );
  1056. FARPROC GetProcAddress (
  1057. HMODULE hModule,
  1058. LPCSTR lpProcName
  1059. );
  1060. DWORD GetVersion (
  1061. );
  1062. HGLOBAL GlobalAlloc (
  1063. UINT uFlags,
  1064. SIZE_T dwBytes
  1065. );
  1066. HGLOBAL GlobalReAlloc (
  1067. HGLOBAL hMem,
  1068. SIZE_T dwBytes,
  1069. UINT uFlags
  1070. );
  1071. SIZE_T GlobalSize (
  1072. HGLOBAL hMem
  1073. );
  1074. UINT GlobalFlags (
  1075. HGLOBAL hMem
  1076. );
  1077. LPVOID GlobalLock (
  1078. HGLOBAL hMem
  1079. );
  1080. HGLOBAL GlobalHandle (
  1081. LPCVOID pMem
  1082. );
  1083. BOOL GlobalUnlock(
  1084. HGLOBAL hMem
  1085. );
  1086. HGLOBAL GlobalFree(
  1087. HGLOBAL hMem
  1088. );
  1089. SIZE_T GlobalCompact(
  1090. DWORD dwMinFree
  1091. );
  1092. VOID GlobalFix(
  1093. HGLOBAL hMem
  1094. );
  1095. VOID GlobalUnfix(
  1096. HGLOBAL hMem
  1097. );
  1098. LPVOID GlobalWire(
  1099. HGLOBAL hMem
  1100. );
  1101. BOOL GlobalUnWire(
  1102. HGLOBAL hMem
  1103. );
  1104. VOID GlobalMemoryStatus(
  1105. LPMEMORYSTATUS lpBuffer
  1106. );
  1107. struct MEMORYSTATUSEX {
  1108. DWORD dwLength;
  1109. DWORD dwMemoryLoad;
  1110. DWORDLONG ullTotalPhys;
  1111. DWORDLONG ullAvailPhys;
  1112. DWORDLONG ullTotalPageFile;
  1113. DWORDLONG ullAvailPageFile;
  1114. DWORDLONG ullTotalVirtual;
  1115. DWORDLONG ullAvailVirtual;
  1116. DWORDLONG ullAvailExtendedVirtual;
  1117. }
  1118. alias MEMORYSTATUSEX* LPMEMORYSTATUSEX;
  1119. BOOL GlobalMemoryStatusEx(
  1120. LPMEMORYSTATUSEX lpBuffer
  1121. );
  1122. HLOCAL LocalAlloc(
  1123. UINT uFlags,
  1124. SIZE_T uBytes
  1125. );
  1126. HLOCAL LocalReAlloc(
  1127. HLOCAL hMem,
  1128. SIZE_T uBytes,
  1129. UINT uFlags
  1130. );
  1131. LPVOID LocalLock(
  1132. HLOCAL hMem
  1133. );
  1134. HLOCAL LocalHandle(
  1135. LPCVOID pMem
  1136. );
  1137. BOOL LocalUnlock(
  1138. HLOCAL hMem
  1139. );
  1140. SIZE_T LocalSize(
  1141. HLOCAL hMem
  1142. );
  1143. UINT LocalFlags(
  1144. HLOCAL hMem
  1145. );
  1146. HLOCAL LocalFree(
  1147. HLOCAL hMem
  1148. );
  1149. SIZE_T LocalShrink(
  1150. HLOCAL hMem,
  1151. UINT cbNewSize
  1152. );
  1153. SIZE_T LocalCompact(
  1154. UINT uMinFree
  1155. );
  1156. BOOL FlushInstructionCache(
  1157. HANDLE hProcess,
  1158. LPCVOID lpBaseAddress,
  1159. SIZE_T dwSize
  1160. );
  1161. VOID FlushProcessWriteBuffers();
  1162. BOOL QueryThreadCycleTime (
  1163. HANDLE ThreadHandle,
  1164. PULONG64 CycleTime
  1165. );
  1166. BOOL QueryProcessCycleTime (
  1167. HANDLE ProcessHandle,
  1168. PULONG64 CycleTime
  1169. );
  1170. BOOL QueryIdleProcessorCycleTime (
  1171. PULONG BufferLength,
  1172. PULONG64 ProcessorIdleCycleTime
  1173. );
  1174. LPVOID VirtualAlloc(
  1175. LPVOID lpAddress,
  1176. SIZE_T dwSize,
  1177. DWORD flAllocationType,
  1178. DWORD flProtect
  1179. );
  1180. BOOL VirtualFree(
  1181. LPVOID lpAddress,
  1182. SIZE_T dwSize,
  1183. DWORD dwFreeType
  1184. );
  1185. BOOL VirtualProtect(
  1186. LPVOID lpAddress,
  1187. SIZE_T dwSize,
  1188. DWORD flNewProtect,
  1189. PDWORD lpflOldProtect
  1190. );
  1191. SIZE_T VirtualQuery(
  1192. LPCVOID lpAddress,
  1193. PMEMORY_BASIC_INFORMATION lpBuffer,
  1194. SIZE_T dwLength
  1195. );
  1196. LPVOID VirtualAllocEx(
  1197. HANDLE hProcess,
  1198. LPVOID lpAddress,
  1199. SIZE_T dwSize,
  1200. DWORD flAllocationType,
  1201. DWORD flProtect
  1202. );
  1203. LPVOID VirtualAllocExNuma(
  1204. HANDLE hProcess,
  1205. LPVOID lpAddress,
  1206. SIZE_T dwSize,
  1207. DWORD flAllocationType,
  1208. DWORD flProtect,
  1209. DWORD nndPreferred
  1210. );
  1211. UINT GetWriteWatch(
  1212. DWORD dwFlags,
  1213. PVOID lpBaseAddress,
  1214. SIZE_T dwRegionSize,
  1215. PVOID *lpAddresses,
  1216. ULONG_PTR *lpdwCount,
  1217. PULONG lpdwGranularity
  1218. );
  1219. UINT ResetWriteWatch(
  1220. LPVOID lpBaseAddress,
  1221. SIZE_T dwRegionSize
  1222. );
  1223. SIZE_T GetLargePageMinimum();
  1224. UINT EnumSystemFirmwareTables(
  1225. DWORD FirmwareTableProviderSignature,
  1226. PVOID pFirmwareTableEnumBuffer,
  1227. DWORD BufferSize
  1228. );
  1229. UINT GetSystemFirmwareTable(
  1230. DWORD FirmwareTableProviderSignature,
  1231. DWORD FirmwareTableID,
  1232. PVOID pFirmwareTableBuffer,
  1233. DWORD BufferSize
  1234. );
  1235. BOOL VirtualFreeEx(
  1236. HANDLE hProcess,
  1237. LPVOID lpAddress,
  1238. SIZE_T dwSize,
  1239. DWORD dwFreeType
  1240. );
  1241. BOOL VirtualProtectEx(
  1242. HANDLE hProcess,
  1243. LPVOID lpAddress,
  1244. SIZE_T dwSize,
  1245. DWORD flNewProtect,
  1246. PDWORD lpflOldProtect
  1247. );
  1248. SIZE_T VirtualQueryEx(
  1249. HANDLE hProcess,
  1250. LPCVOID lpAddress,
  1251. PMEMORY_BASIC_INFORMATION lpBuffer,
  1252. SIZE_T dwLength
  1253. );
  1254. HANDLE HeapCreate(
  1255. DWORD flOptions,
  1256. SIZE_T dwInitialSize,
  1257. SIZE_T dwMaximumSize
  1258. );
  1259. BOOL HeapDestroy(
  1260. HANDLE hHeap
  1261. );
  1262. LPVOID HeapAlloc(
  1263. HANDLE hHeap,
  1264. DWORD dwFlags,
  1265. SIZE_T dwBytes
  1266. );
  1267. LPVOID HeapReAlloc(
  1268. HANDLE hHeap,
  1269. DWORD dwFlags,
  1270. LPVOID lpMem,
  1271. SIZE_T dwBytes
  1272. );
  1273. BOOL HeapFree(
  1274. HANDLE hHeap,
  1275. DWORD dwFlags,
  1276. LPVOID lpMem
  1277. );
  1278. SIZE_T HeapSize(
  1279. HANDLE hHeap,
  1280. DWORD dwFlags,
  1281. LPCVOID lpMem
  1282. );
  1283. BOOL HeapValidate(
  1284. HANDLE hHeap,
  1285. DWORD dwFlags,
  1286. LPCVOID lpMem
  1287. );
  1288. SIZE_T HeapCompact(
  1289. HANDLE hHeap,
  1290. DWORD dwFlags
  1291. );
  1292. HANDLE GetProcessHeap();
  1293. DWORD GetProcessHeaps(
  1294. DWORD NumberOfHeaps,
  1295. PHANDLE ProcessHeaps
  1296. );
  1297. struct PROCESS_HEAP_ENTRY {
  1298. PVOID lpData;
  1299. DWORD cbData;
  1300. BYTE cbOverhead;
  1301. BYTE iRegionIndex;
  1302. WORD wFlags;
  1303. union _inner_union {
  1304. struct _inner_struct {
  1305. HANDLE hMem;
  1306. DWORD[3] dwReserved;
  1307. }
  1308. _inner_struct Block;
  1309. struct _inner_struct2 {
  1310. DWORD dwCommittedSize;
  1311. DWORD dwUnCommittedSize;
  1312. LPVOID lpFirstBlock;
  1313. LPVOID lpLastBlock;
  1314. }
  1315. _inner_struct2 Region;
  1316. }
  1317. _inner_union fields;
  1318. }
  1319. alias PROCESS_HEAP_ENTRY* LPPROCESS_HEAP_ENTRY;
  1320. alias PROCESS_HEAP_ENTRY* PPROCESS_HEAP_ENTRY;
  1321. const auto PROCESS_HEAP_REGION = 0x0001;
  1322. const auto PROCESS_HEAP_UNCOMMITTED_RANGE = 0x0002;
  1323. const auto PROCESS_HEAP_ENTRY_BUSY = 0x0004;
  1324. const auto PROCESS_HEAP_ENTRY_MOVEABLE = 0x0010;
  1325. const auto PROCESS_HEAP_ENTRY_DDESHARE = 0x0020;
  1326. BOOL HeapLock(
  1327. HANDLE hHeap
  1328. );
  1329. BOOL HeapUnlock(
  1330. HANDLE hHeap
  1331. );
  1332. BOOL HeapWalk(
  1333. HANDLE hHeap,
  1334. LPPROCESS_HEAP_ENTRY lpEntry
  1335. );
  1336. BOOL HeapSetInformation (
  1337. HANDLE HeapHandle,
  1338. HEAP_INFORMATION_CLASS HeapInformationClass,
  1339. PVOID HeapInformation,
  1340. SIZE_T HeapInformationLength
  1341. );
  1342. BOOL HeapQueryInformation (
  1343. HANDLE HeapHandle,
  1344. HEAP_INFORMATION_CLASS HeapInformationClass,
  1345. PVOID HeapInformation,
  1346. SIZE_T HeapInformationLength,
  1347. PSIZE_T ReturnLength
  1348. );
  1349. // GetBinaryType return values.
  1350. const auto SCS_32BIT_BINARY = 0;
  1351. const auto SCS_DOS_BINARY = 1;
  1352. const auto SCS_WOW_BINARY = 2;
  1353. const auto SCS_PIF_BINARY = 3;
  1354. const auto SCS_POSIX_BINARY = 4;
  1355. const auto SCS_OS216_BINARY = 5;
  1356. const auto SCS_64BIT_BINARY = 6;
  1357. version(X86_64) {
  1358. const auto SCS_THIS_PLATFORM_BINARY = SCS_64BIT_BINARY;
  1359. }
  1360. else {
  1361. const auto SCS_THIS_PLATFORM_BINARY = SCS_32BIT_BINARY;
  1362. }
  1363. BOOL GetBinaryTypeA(
  1364. LPCSTR lpApplicationName,
  1365. LPDWORD lpBinaryType
  1366. );
  1367. BOOL GetBinaryTypeW(
  1368. LPCWSTR lpApplicationName,
  1369. LPDWORD lpBinaryType
  1370. );
  1371. version(UNICODE) {
  1372. alias GetBinaryTypeW GetBinaryType;
  1373. }
  1374. else {
  1375. alias GetBinaryTypeA GetBinaryType;
  1376. }
  1377. DWORD GetShortPathNameA(
  1378. LPCSTR lpszLongPath,
  1379. LPSTR lpszShortPath,
  1380. DWORD cchBuffer
  1381. );
  1382. DWORD GetShortPathNameW(
  1383. LPCWSTR lpszLongPath,
  1384. LPWSTR lpszShortPath,
  1385. DWORD cchBuffer
  1386. );
  1387. version(UNICODE) {
  1388. alias GetShortPathNameW GetShortPathName;
  1389. }
  1390. else {
  1391. alias GetShortPathNameA GetShortPathName;
  1392. }
  1393. DWORD GetLongPathNameA(
  1394. LPCSTR lpszShortPath,
  1395. LPSTR lpszLongPath,
  1396. DWORD cchBuffer
  1397. );
  1398. DWORD GetLongPathNameW(
  1399. LPCWSTR lpszShortPath,
  1400. LPWSTR lpszLongPath,
  1401. DWORD cchBuffer
  1402. );
  1403. version(UNICODE) {
  1404. alias GetLongPathNameW GetLongPathName;
  1405. }
  1406. else {
  1407. alias GetLongPathNameA GetLongPathName;
  1408. }
  1409. DWORD GetLongPathNameTransactedA(
  1410. LPCSTR lpszShortPath,
  1411. LPSTR lpszLongPath,
  1412. DWORD cchBuffer,
  1413. HANDLE hTransaction
  1414. );
  1415. DWORD GetLongPathNameTransactedW(
  1416. LPCWSTR lpszShortPath,
  1417. LPWSTR lpszLongPath,
  1418. DWORD cchBuffer,
  1419. HANDLE hTransaction
  1420. );
  1421. version(UNICODE) {
  1422. alias GetLongPathNameTransactedW GetLongPathNameTransacted;
  1423. }
  1424. else {
  1425. alias GetLongPathNameTransactedA GetLongPathNameTransacted;
  1426. }
  1427. BOOL GetProcessAffinityMask(
  1428. HANDLE hProcess,
  1429. PDWORD_PTR lpProcessAffinityMask,
  1430. PDWORD_PTR lpSystemAffinityMask
  1431. );
  1432. BOOL SetProcessAffinityMask(
  1433. HANDLE hProcess,
  1434. DWORD_PTR dwProcessAffinityMask
  1435. );
  1436. BOOL GetProcessHandleCount(
  1437. HANDLE hProcess,
  1438. PDWORD pdwHandleCount
  1439. );
  1440. BOOL GetProcessTimes(
  1441. HANDLE hProcess,
  1442. LPFILETIME lpCreationTime,
  1443. LPFILETIME lpExitTime,
  1444. LPFILETIME lpKernelTime,
  1445. LPFILETIME lpUserTime
  1446. );
  1447. BOOL GetProcessIoCounters(
  1448. HANDLE hProcess,
  1449. PIO_COUNTERS lpIoCounters
  1450. );
  1451. BOOL GetProcessWorkingSetSize(
  1452. HANDLE hProcess,
  1453. PSIZE_T lpMinimumWorkingSetSize,
  1454. PSIZE_T lpMaximumWorkingSetSize
  1455. );
  1456. BOOL GetProcessWorkingSetSizeEx(
  1457. HANDLE hProcess,
  1458. PSIZE_T lpMinimumWorkingSetSize,
  1459. PSIZE_T lpMaximumWorkingSetSize,
  1460. PDWORD Flags
  1461. );
  1462. BOOL SetProcessWorkingSetSize(
  1463. HANDLE hProcess,
  1464. SIZE_T dwMinimumWorkingSetSize,
  1465. SIZE_T dwMaximumWorkingSetSize
  1466. );
  1467. BOOL SetProcessWork