PageRenderTime 145ms CodeModel.GetById 23ms app.highlight 103ms RepoModel.GetById 1ms app.codeStats 1ms

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

Large files files are truncated, but you can click here to view the full file