/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
- /*
- * winbase.d
- *
- * This module is a port of winbase.h to D.
- * The original copyright notice appears after this information block.
- *
- * Author: Dave Wilkinson
- * Originated: November 24th, 2009
- *
- */
- module binding.win32.winbase;
- import binding.c;
- import binding.win32.guiddef;
- import binding.win32.windef;
- import binding.win32.winnt;
- import binding.win32.ntstatus;
- extern(System):
- /************************************************************************
- * *
- * winbase.h -- This module defines the 32-Bit Windows Base APIs *
- * *
- * Copyright (c) Microsoft Corp. All rights reserved. *
- * *
- ************************************************************************/
- const auto INVALID_HANDLE_VALUE = (cast(HANDLE)cast(LONG_PTR)-1);
- const auto INVALID_FILE_SIZE = (cast(DWORD)0xFFFFFFFF);
- const auto INVALID_SET_FILE_POINTER = (cast(DWORD)-1);
- const auto INVALID_FILE_ATTRIBUTES = (cast(DWORD)-1);
- const auto FILE_BEGIN = 0;
- const auto FILE_CURRENT = 1;
- const auto FILE_END = 2;
- const auto TIME_ZONE_ID_INVALID = (cast(DWORD)0xFFFFFFFF);
- const auto WAIT_FAILED = (cast(DWORD)0xFFFFFFFF);
- const auto WAIT_OBJECT_0 = ((STATUS_WAIT_0 ) + 0 );
- const auto WAIT_ABANDONED = ((STATUS_ABANDONED_WAIT_0 ) + 0 );
- const auto WAIT_ABANDONED_0 = ((STATUS_ABANDONED_WAIT_0 ) + 0 );
- const auto WAIT_IO_COMPLETION = STATUS_USER_APC;
- const auto STILL_ACTIVE = STATUS_PENDING;
- const auto EXCEPTION_ACCESS_VIOLATION = STATUS_ACCESS_VIOLATION;
- const auto EXCEPTION_DATATYPE_MISALIGNMENT = STATUS_DATATYPE_MISALIGNMENT;
- const auto EXCEPTION_BREAKPOINT = STATUS_BREAKPOINT;
- const auto EXCEPTION_SINGLE_STEP = STATUS_SINGLE_STEP;
- const auto EXCEPTION_ARRAY_BOUNDS_EXCEEDED = STATUS_ARRAY_BOUNDS_EXCEEDED;
- const auto EXCEPTION_FLT_DENORMAL_OPERAND = STATUS_FLOAT_DENORMAL_OPERAND;
- const auto EXCEPTION_FLT_DIVIDE_BY_ZERO = STATUS_FLOAT_DIVIDE_BY_ZERO;
- const auto EXCEPTION_FLT_INEXACT_RESULT = STATUS_FLOAT_INEXACT_RESULT;
- const auto EXCEPTION_FLT_INVALID_OPERATION = STATUS_FLOAT_INVALID_OPERATION;
- const auto EXCEPTION_FLT_OVERFLOW = STATUS_FLOAT_OVERFLOW;
- const auto EXCEPTION_FLT_STACK_CHECK = STATUS_FLOAT_STACK_CHECK;
- const auto EXCEPTION_FLT_UNDERFLOW = STATUS_FLOAT_UNDERFLOW;
- const auto EXCEPTION_INT_DIVIDE_BY_ZERO = STATUS_INTEGER_DIVIDE_BY_ZERO;
- const auto EXCEPTION_INT_OVERFLOW = STATUS_INTEGER_OVERFLOW;
- const auto EXCEPTION_PRIV_INSTRUCTION = STATUS_PRIVILEGED_INSTRUCTION;
- const auto EXCEPTION_IN_PAGE_ERROR = STATUS_IN_PAGE_ERROR;
- const auto EXCEPTION_ILLEGAL_INSTRUCTION = STATUS_ILLEGAL_INSTRUCTION;
- const auto EXCEPTION_NONCONTINUABLE_EXCEPTION = STATUS_NONCONTINUABLE_EXCEPTION;
- const auto EXCEPTION_STACK_OVERFLOW = STATUS_STACK_OVERFLOW;
- const auto EXCEPTION_INVALID_DISPOSITION = STATUS_INVALID_DISPOSITION;
- const auto EXCEPTION_GUARD_PAGE = STATUS_GUARD_PAGE_VIOLATION;
- const auto EXCEPTION_INVALID_HANDLE = STATUS_INVALID_HANDLE;
- const auto EXCEPTION_POSSIBLE_DEADLOCK = STATUS_POSSIBLE_DEADLOCK;
- const auto CONTROL_C_EXIT = STATUS_CONTROL_C_EXIT;
- alias RtlMoveMemory MoveMemory;
- alias RtlCopyMemory CopyMemory;
- alias RtlFillMemory FillMemory;
- alias RtlZeroMemory ZeroMemory;
- //alias SecureZeroMemory RtlSecureZeroMemory;
- //alias CaptureStackBackTrace RtlCaptureStackBackTrace;
- //
- // File creation flags must start at the high end since they
- // are combined with the attributes
- //
- const auto FILE_FLAG_WRITE_THROUGH = 0x80000000;
- const auto FILE_FLAG_OVERLAPPED = 0x40000000;
- const auto FILE_FLAG_NO_BUFFERING = 0x20000000;
- const auto FILE_FLAG_RANDOM_ACCESS = 0x10000000;
- const auto FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000;
- const auto FILE_FLAG_DELETE_ON_CLOSE = 0x04000000;
- const auto FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
- const auto FILE_FLAG_POSIX_SEMANTICS = 0x01000000;
- const auto FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000;
- const auto FILE_FLAG_OPEN_NO_RECALL = 0x00100000;
- const auto FILE_FLAG_FIRST_PIPE_INSTANCE = 0x00080000;
- const auto CREATE_NEW = 1;
- const auto CREATE_ALWAYS = 2;
- const auto OPEN_EXISTING = 3;
- const auto OPEN_ALWAYS = 4;
- const auto TRUNCATE_EXISTING = 5;
- //
- // Define possible return codes from the CopyFileEx callback routine
- //
- const auto PROGRESS_CONTINUE = 0;
- const auto PROGRESS_CANCEL = 1;
- const auto PROGRESS_STOP = 2;
- const auto PROGRESS_QUIET = 3;
- //
- // Define CopyFileEx callback routine state change values
- //
- const auto CALLBACK_CHUNK_FINISHED = 0x00000000;
- const auto CALLBACK_STREAM_SWITCH = 0x00000001;
- //
- // Define CopyFileEx option flags
- //
- const auto COPY_FILE_FAIL_IF_EXISTS = 0x00000001;
- const auto COPY_FILE_RESTARTABLE = 0x00000002;
- const auto COPY_FILE_OPEN_SOURCE_FOR_WRITE = 0x00000004;
- const auto COPY_FILE_ALLOW_DECRYPTED_DESTINATION = 0x00000008;
- //
- // Gap for private copyfile flags
- //
- const auto COPY_FILE_COPY_SYMLINK = 0x00000800;
- //
- // Define ReplaceFile option flags
- //
- const auto REPLACEFILE_WRITE_THROUGH = 0x00000001;
- const auto REPLACEFILE_IGNORE_MERGE_ERRORS = 0x00000002;
- //
- // Define the NamedPipe definitions
- //
- //
- // Define the dwOpenMode values for CreateNamedPipe
- //
- const auto PIPE_ACCESS_INBOUND = 0x00000001;
- const auto PIPE_ACCESS_OUTBOUND = 0x00000002;
- const auto PIPE_ACCESS_DUPLEX = 0x00000003;
- //
- // Define the Named Pipe End flags for GetNamedPipeInfo
- //
- const auto PIPE_CLIENT_END = 0x00000000;
- const auto PIPE_SERVER_END = 0x00000001;
- //
- // Define the dwPipeMode values for CreateNamedPipe
- //
- const auto PIPE_WAIT = 0x00000000;
- const auto PIPE_NOWAIT = 0x00000001;
- const auto PIPE_READMODE_BYTE = 0x00000000;
- const auto PIPE_READMODE_MESSAGE = 0x00000002;
- const auto PIPE_TYPE_BYTE = 0x00000000;
- const auto PIPE_TYPE_MESSAGE = 0x00000004;
- const auto PIPE_ACCEPT_REMOTE_CLIENTS = 0x00000000;
- const auto PIPE_REJECT_REMOTE_CLIENTS = 0x00000008;
- //
- // Define the well known values for CreateNamedPipe nMaxInstances
- //
- const auto PIPE_UNLIMITED_INSTANCES = 255;
- //
- // Define the Security Quality of Service bits to be passed
- // into CreateFile
- //
- const auto SECURITY_ANONYMOUS = ( SECURITY_IMPERSONATION_LEVEL.SecurityAnonymous << 16 );
- const auto SECURITY_IDENTIFICATION = ( SECURITY_IMPERSONATION_LEVEL.SecurityIdentification << 16 );
- const auto SECURITY_IMPERSONATION = ( SECURITY_IMPERSONATION_LEVEL.SecurityImpersonation << 16 );
- const auto SECURITY_DELEGATION = ( SECURITY_IMPERSONATION_LEVEL.SecurityDelegation << 16 );
- const auto SECURITY_CONTEXT_TRACKING = 0x00040000;
- const auto SECURITY_EFFECTIVE_ONLY = 0x00080000;
- const auto SECURITY_SQOS_PRESENT = 0x00100000;
- const auto SECURITY_VALID_SQOS_FLAGS = 0x001F0000;
- //
- // File structures
- //
- struct OVERLAPPED {
- ULONG_PTR Internal;
- ULONG_PTR InternalHigh;
- union _inner_union {
- struct _inner_struct {
- DWORD Offset;
- DWORD OffsetHigh;
- }
- _inner_struct data;
- PVOID Pointer;
- }
- _inner_union fields;
- HANDLE hEvent;
- }
- alias OVERLAPPED* LPOVERLAPPED;
- struct OVERLAPPED_ENTRY {
- ULONG_PTR lpCompletionKey;
- LPOVERLAPPED lpOverlapped;
- ULONG_PTR Internal;
- DWORD dwNumberOfBytesTransferred;
- }
- alias OVERLAPPED_ENTRY* LPOVERLAPPED_ENTRY;
- struct SECURITY_ATTRIBUTES {
- DWORD nLength;
- LPVOID lpSecurityDescriptor;
- BOOL bInheritHandle;
- }
- alias SECURITY_ATTRIBUTES* PSECURITY_ATTRIBUTES;
- alias SECURITY_ATTRIBUTES* LPSECURITY_ATTRIBUTES;
- struct PROCESS_INFORMATION {
- HANDLE hProcess;
- HANDLE hThread;
- DWORD dwProcessId;
- DWORD dwThreadId;
- }
- alias PROCESS_INFORMATION* PPROCESS_INFORMATION;
- alias PROCESS_INFORMATION* LPPROCESS_INFORMATION;
- //
- // File System time stamps are represented with the following structure:
- //
- struct FILETIME {
- DWORD dwLowDateTime;
- DWORD dwHighDateTime;
- }
- alias FILETIME* PFILETIME;
- alias FILETIME* LPFILETIME;
- //
- // System time is represented with the following structure:
- //
- struct SYSTEMTIME {
- WORD wYear;
- WORD wMonth;
- WORD wDayOfWeek;
- WORD wDay;
- WORD wHour;
- WORD wMinute;
- WORD wSecond;
- WORD wMilliseconds;
- }
- alias SYSTEMTIME* PSYSTEMTIME;
- alias SYSTEMTIME* LPSYSTEMTIME;
- alias DWORD function(LPVOID lpThreadParameter) PTHREAD_START_ROUTINE;
- alias PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;
- alias VOID function(LPVOID) PFIBER_START_ROUTINE;
- alias PFIBER_START_ROUTINE LPFIBER_START_ROUTINE;
- alias RTL_CRITICAL_SECTION CRITICAL_SECTION;
- alias PRTL_CRITICAL_SECTION PCRITICAL_SECTION;
- alias PRTL_CRITICAL_SECTION LPCRITICAL_SECTION;
- alias RTL_CRITICAL_SECTION_DEBUG CRITICAL_SECTION_DEBUG;
- alias PRTL_CRITICAL_SECTION_DEBUG PCRITICAL_SECTION_DEBUG;
- alias PRTL_CRITICAL_SECTION_DEBUG LPCRITICAL_SECTION_DEBUG;
- //
- // Define one-time initialization primitive
- //
- alias RTL_RUN_ONCE INIT_ONCE;
- alias PRTL_RUN_ONCE PINIT_ONCE;
- alias PRTL_RUN_ONCE LPINIT_ONCE;
- const auto INIT_ONCE_STATIC_INIT = RTL_RUN_ONCE_INIT;
- //
- // Run once flags
- //
- const auto INIT_ONCE_CHECK_ONLY = RTL_RUN_ONCE_CHECK_ONLY;
- const auto INIT_ONCE_ASYNC = RTL_RUN_ONCE_ASYNC;
- const auto INIT_ONCE_INIT_FAILED = RTL_RUN_ONCE_INIT_FAILED;
- //
- // The context stored in the run once structure must leave the following number
- // of low order bits unused.
- //
- const auto INIT_ONCE_CTX_RESERVED_BITS = RTL_RUN_ONCE_CTX_RESERVED_BITS;
- alias BOOL function(PINIT_ONCE InitOnce, PVOID Parameter, PVOID* Context) PINIT_ONCE_FN;
- VOID InitOnceInitialize (
- PINIT_ONCE InitOnce
- );
- BOOL InitOnceExecuteOnce (
- PINIT_ONCE InitOnce,
- PINIT_ONCE_FN InitFn,
- PVOID Parameter,
- LPVOID *Context
- );
- BOOL InitOnceBeginInitialize (
- LPINIT_ONCE lpInitOnce,
- DWORD dwFlags,
- PBOOL fPending,
- LPVOID *lpContext
- );
- BOOL InitOnceComplete (
- LPINIT_ONCE lpInitOnce,
- DWORD dwFlags,
- LPVOID lpContext
- );
- //
- // Define the slim r/w lock
- //
- alias RTL_SRWLOCK SRWLOCK;
- alias RTL_SRWLOCK* PSRWLOCK;
- const auto SRWLOCK_INIT = RTL_SRWLOCK_INIT;
- VOID InitializeSRWLock (
- PSRWLOCK SRWLock
- );
- VOID ReleaseSRWLockExclusive (
- PSRWLOCK SRWLock
- );
- VOID ReleaseSRWLockShared (
- PSRWLOCK SRWLock
- );
- VOID AcquireSRWLockExclusive (
- PSRWLOCK SRWLock
- );
- VOID AcquireSRWLockShared (
- PSRWLOCK SRWLock
- );
- //
- // Define condition variable
- //
- alias RTL_CONDITION_VARIABLE CONDITION_VARIABLE;
- alias RTL_CONDITION_VARIABLE* PCONDITION_VARIABLE;
- VOID InitializeConditionVariable (
- PCONDITION_VARIABLE ConditionVariable
- );
- VOID WakeConditionVariable (
- PCONDITION_VARIABLE ConditionVariable
- );
- VOID WakeAllConditionVariable (
- PCONDITION_VARIABLE ConditionVariable
- );
- BOOL SleepConditionVariableCS (
- PCONDITION_VARIABLE ConditionVariable,
- PCRITICAL_SECTION CriticalSection,
- DWORD dwMilliseconds
- );
- BOOL SleepConditionVariableSRW (
- PCONDITION_VARIABLE ConditionVariable,
- PSRWLOCK SRWLock,
- DWORD dwMilliseconds,
- ULONG Flags
- );
- //
- // Static initializer for the condition variable
- //
- const auto CONDITION_VARIABLE_INIT = RTL_CONDITION_VARIABLE_INIT;
- //
- // Flags for condition variables
- //
- const auto CONDITION_VARIABLE_LOCKMODE_SHARED = RTL_CONDITION_VARIABLE_LOCKMODE_SHARED;
- PVOID EncodePointer (
- PVOID Ptr
- );
- PVOID DecodePointer (
- PVOID Ptr
- );
- PVOID EncodeSystemPointer (
- PVOID Ptr
- );
- PVOID DecodeSystemPointer (
- PVOID Ptr
- );
- version(X86) {
- //alias PLDT_ENTRY LPLDT_ENTRY;
- alias LPVOID LPLDT_ENTRY;
- }
- else {
- alias LPVOID LPLDT_ENTRY;
- }
- const auto MUTEX_MODIFY_STATE = MUTANT_QUERY_STATE;
- const auto MUTEX_ALL_ACCESS = MUTANT_ALL_ACCESS;
- //
- // Serial provider type.
- //
- const auto SP_SERIALCOMM = (cast(DWORD)0x00000001);
- //
- // Provider SubTypes
- //
- const auto PST_UNSPECIFIED = (cast(DWORD)0x00000000);
- const auto PST_RS232 = (cast(DWORD)0x00000001);
- const auto PST_PARALLELPORT = (cast(DWORD)0x00000002);
- const auto PST_RS422 = (cast(DWORD)0x00000003);
- const auto PST_RS423 = (cast(DWORD)0x00000004);
- const auto PST_RS449 = (cast(DWORD)0x00000005);
- const auto PST_MODEM = (cast(DWORD)0x00000006);
- const auto PST_FAX = (cast(DWORD)0x00000021);
- const auto PST_SCANNER = (cast(DWORD)0x00000022);
- const auto PST_NETWORK_BRIDGE = (cast(DWORD)0x00000100);
- const auto PST_LAT = (cast(DWORD)0x00000101);
- const auto PST_TCPIP_TELNET = (cast(DWORD)0x00000102);
- const auto PST_X25 = (cast(DWORD)0x00000103);
- //
- // Provider capabilities flags.
- //
- const auto PCF_DTRDSR = (cast(DWORD)0x0001);
- const auto PCF_RTSCTS = (cast(DWORD)0x0002);
- const auto PCF_RLSD = (cast(DWORD)0x0004);
- const auto PCF_PARITY_CHECK = (cast(DWORD)0x0008);
- const auto PCF_XONXOFF = (cast(DWORD)0x0010);
- const auto PCF_SETXCHAR = (cast(DWORD)0x0020);
- const auto PCF_TOTALTIMEOUTS = (cast(DWORD)0x0040);
- const auto PCF_INTTIMEOUTS = (cast(DWORD)0x0080);
- const auto PCF_SPECIALCHARS = (cast(DWORD)0x0100);
- const auto PCF_16BITMODE = (cast(DWORD)0x0200);
- //
- // Comm provider settable parameters.
- //
- const auto SP_PARITY = (cast(DWORD)0x0001);
- const auto SP_BAUD = (cast(DWORD)0x0002);
- const auto SP_DATABITS = (cast(DWORD)0x0004);
- const auto SP_STOPBITS = (cast(DWORD)0x0008);
- const auto SP_HANDSHAKING = (cast(DWORD)0x0010);
- const auto SP_PARITY_CHECK = (cast(DWORD)0x0020);
- const auto SP_RLSD = (cast(DWORD)0x0040);
- //
- // Settable baud rates in the provider.
- //
- const auto BAUD_075 = (cast(DWORD)0x00000001);
- const auto BAUD_110 = (cast(DWORD)0x00000002);
- const auto BAUD_134_5 = (cast(DWORD)0x00000004);
- const auto BAUD_150 = (cast(DWORD)0x00000008);
- const auto BAUD_300 = (cast(DWORD)0x00000010);
- const auto BAUD_600 = (cast(DWORD)0x00000020);
- const auto BAUD_1200 = (cast(DWORD)0x00000040);
- const auto BAUD_1800 = (cast(DWORD)0x00000080);
- const auto BAUD_2400 = (cast(DWORD)0x00000100);
- const auto BAUD_4800 = (cast(DWORD)0x00000200);
- const auto BAUD_7200 = (cast(DWORD)0x00000400);
- const auto BAUD_9600 = (cast(DWORD)0x00000800);
- const auto BAUD_14400 = (cast(DWORD)0x00001000);
- const auto BAUD_19200 = (cast(DWORD)0x00002000);
- const auto BAUD_38400 = (cast(DWORD)0x00004000);
- const auto BAUD_56K = (cast(DWORD)0x00008000);
- const auto BAUD_128K = (cast(DWORD)0x00010000);
- const auto BAUD_115200 = (cast(DWORD)0x00020000);
- const auto BAUD_57600 = (cast(DWORD)0x00040000);
- const auto BAUD_USER = (cast(DWORD)0x10000000);
- //
- // Settable Data Bits
- //
- const auto DATABITS_5 = (cast(WORD)0x0001);
- const auto DATABITS_6 = (cast(WORD)0x0002);
- const auto DATABITS_7 = (cast(WORD)0x0004);
- const auto DATABITS_8 = (cast(WORD)0x0008);
- const auto DATABITS_16 = (cast(WORD)0x0010);
- const auto DATABITS_16X = (cast(WORD)0x0020);
- //
- // Settable Stop and Parity bits.
- //
- const auto STOPBITS_10 = (cast(WORD)0x0001);
- const auto STOPBITS_15 = (cast(WORD)0x0002);
- const auto STOPBITS_20 = (cast(WORD)0x0004);
- const auto PARITY_NONE = (cast(WORD)0x0100);
- const auto PARITY_ODD = (cast(WORD)0x0200);
- const auto PARITY_EVEN = (cast(WORD)0x0400);
- const auto PARITY_MARK = (cast(WORD)0x0800);
- const auto PARITY_SPACE = (cast(WORD)0x1000);
- struct COMMPROP {
- WORD wPacketLength;
- WORD wPacketVersion;
- DWORD dwServiceMask;
- DWORD dwReserved1;
- DWORD dwMaxTxQueue;
- DWORD dwMaxRxQueue;
- DWORD dwMaxBaud;
- DWORD dwProvSubType;
- DWORD dwProvCapabilities;
- DWORD dwSettableParams;
- DWORD dwSettableBaud;
- WORD wSettableData;
- WORD wSettableStopParity;
- DWORD dwCurrentTxQueue;
- DWORD dwCurrentRxQueue;
- DWORD dwProvSpec1;
- DWORD dwProvSpec2;
- WCHAR[1] wcProvChar;
- }
- alias COMMPROP* LPCOMMPROP;
- //
- // Set dwProvSpec1 to COMMPROP_INITIALIZED to indicate that wPacketLength
- // is valid before a call to GetCommProperties().
- //
- const auto COMMPROP_INITIALIZED = (cast(DWORD)0xE73CF52E);
- struct COMSTAT {
- DWORD flags;
- /* DWORD fCtsHold : 1;
- DWORD fDsrHold : 1;
- DWORD fRlsdHold : 1;
- DWORD fXoffHold : 1;
- DWORD fXoffSent : 1;
- DWORD fEof : 1;
- DWORD fTxim : 1;
- DWORD fReserved : 25;
- */
- DWORD cbInQue;
- DWORD cbOutQue;
- }
- alias COMSTAT* LPCOMSTAT;
- //
- // DTR Control Flow Values.
- //
- const auto DTR_CONTROL_DISABLE = 0x00;
- const auto DTR_CONTROL_ENABLE = 0x01;
- const auto DTR_CONTROL_HANDSHAKE = 0x02;
- //
- // RTS Control Flow Values
- //
- const auto RTS_CONTROL_DISABLE = 0x00;
- const auto RTS_CONTROL_ENABLE = 0x01;
- const auto RTS_CONTROL_HANDSHAKE = 0x02;
- const auto RTS_CONTROL_TOGGLE = 0x03;
- struct DCB {
- DWORD DCBlength; /* sizeof(DCB) */
- DWORD BaudRate; /* Baudrate at which running */
- DWORD flags;
- /+ DWORD fBinary: 1; /* Binary Mode (skip EOF check) */
- DWORD fParity: 1; /* Enable parity checking */
- DWORD fOutxCtsFlow:1; /* CTS handshaking on output */
- DWORD fOutxDsrFlow:1; /* DSR handshaking on output */
- DWORD fDtrControl:2; /* DTR Flow control */
- DWORD fDsrSensitivity:1; /* DSR Sensitivity */
- DWORD fTXContinueOnXoff: 1; /* Continue TX when Xoff sent */
- DWORD fOutX: 1; /* Enable output X-ON/X-OFF */
- DWORD fInX: 1; /* Enable input X-ON/X-OFF */
- DWORD fErrorChar: 1; /* Enable Err Replacement */
- DWORD fNull: 1; /* Enable Null stripping */
- DWORD fRtsControl:2; /* Rts Flow control */
- DWORD fAbortOnError:1; /* Abort all reads and writes on Error */
- DWORD fDummy2:17; /* Reserved */
- +/
- WORD wReserved; /* Not currently used */
- WORD XonLim; /* Transmit X-ON threshold */
- WORD XoffLim; /* Transmit X-OFF threshold */
- BYTE ByteSize; /* Number of bits/byte, 4-8 */
- BYTE Parity; /* 0-4=None,Odd,Even,Mark,Space */
- BYTE StopBits; /* 0,1,2 = 1, 1.5, 2 */
- char XonChar; /* Tx and Rx X-ON character */
- char XoffChar; /* Tx and Rx X-OFF character */
- char ErrorChar; /* Error replacement char */
- char EofChar; /* End of Input character */
- char EvtChar; /* Received Event character */
- WORD wReserved1; /* Fill for now. */
- }
- alias DCB* LPDCB;
- struct COMMTIMEOUTS {
- DWORD ReadIntervalTimeout; /* Maximum time between read chars. */
- DWORD ReadTotalTimeoutMultiplier; /* Multiplier of characters. */
- DWORD ReadTotalTimeoutConstant; /* Constant in milliseconds. */
- DWORD WriteTotalTimeoutMultiplier; /* Multiplier of characters. */
- DWORD WriteTotalTimeoutConstant; /* Constant in milliseconds. */
- }
- alias COMMTIMEOUTS* LPCOMMTIMEOUTS;
- struct COMMCONFIG {
- DWORD dwSize; /* Size of the entire struct */
- WORD wVersion; /* version of the structure */
- WORD wReserved; /* alignment */
- DCB dcb; /* device control block */
- DWORD dwProviderSubType; /* ordinal value for identifying
- provider-defined data structure format*/
- DWORD dwProviderOffset; /* Specifies the offset of provider specific
- data field in bytes from the start */
- DWORD dwProviderSize; /* size of the provider-specific data field */
- WCHAR wcProviderData[1]; /* provider-specific data */
- }
- alias COMMCONFIG* LPCOMMCONFIG;
- struct SYSTEM_INFO {
- WORD wProcessorArchitecture;
- WORD wReserved;
- DWORD dwPageSize;
- LPVOID lpMinimumApplicationAddress;
- LPVOID lpMaximumApplicationAddress;
- DWORD_PTR dwActiveProcessorMask;
- DWORD dwNumberOfProcessors;
- DWORD dwProcessorType;
- DWORD dwAllocationGranularity;
- WORD wProcessorLevel;
- WORD wProcessorRevision;
- }
- alias SYSTEM_INFO* LPSYSTEM_INFO;
- //
- //
- alias FreeLibrary FreeModule;
- //const auto MakeProcInstance(lpProc,hInstance) = (lpProc);
- //const auto FreeProcInstance(lpProc) = (lpProc);
- /* Global Memory Flags */
- const auto GMEM_FIXED = 0x0000;
- const auto GMEM_MOVEABLE = 0x0002;
- const auto GMEM_NOCOMPACT = 0x0010;
- const auto GMEM_NODISCARD = 0x0020;
- const auto GMEM_ZEROINIT = 0x0040;
- const auto GMEM_MODIFY = 0x0080;
- const auto GMEM_DISCARDABLE = 0x0100;
- const auto GMEM_NOT_BANKED = 0x1000;
- const auto GMEM_SHARE = 0x2000;
- const auto GMEM_DDESHARE = 0x2000;
- const auto GMEM_NOTIFY = 0x4000;
- const auto GMEM_LOWER = GMEM_NOT_BANKED;
- const auto GMEM_VALID_FLAGS = 0x7F72;
- const auto GMEM_INVALID_HANDLE = 0x8000;
- const auto GHND = (GMEM_MOVEABLE | GMEM_ZEROINIT);
- const auto GPTR = (GMEM_FIXED | GMEM_ZEROINIT);
- //const auto GlobalLRUNewest( = h ) ((HANDLE)(h));
- //const auto GlobalLRUOldest( = h ) ((HANDLE)(h));
- //const auto GlobalDiscard( = h ) GlobalReAlloc( (h), 0, GMEM_MOVEABLE );
- /* Flags returned by GlobalFlags (in addition to GMEM_DISCARDABLE) */
- const auto GMEM_DISCARDED = 0x4000;
- const auto GMEM_LOCKCOUNT = 0x00FF;
- struct MEMORYSTATUS {
- DWORD dwLength;
- DWORD dwMemoryLoad;
- SIZE_T dwTotalPhys;
- SIZE_T dwAvailPhys;
- SIZE_T dwTotalPageFile;
- SIZE_T dwAvailPageFile;
- SIZE_T dwTotalVirtual;
- SIZE_T dwAvailVirtual;
- }
- alias MEMORYSTATUS* LPMEMORYSTATUS;
- /* Local Memory Flags */
- const auto LMEM_FIXED = 0x0000;
- const auto LMEM_MOVEABLE = 0x0002;
- const auto LMEM_NOCOMPACT = 0x0010;
- const auto LMEM_NODISCARD = 0x0020;
- const auto LMEM_ZEROINIT = 0x0040;
- const auto LMEM_MODIFY = 0x0080;
- const auto LMEM_DISCARDABLE = 0x0F00;
- const auto LMEM_VALID_FLAGS = 0x0F72;
- const auto LMEM_INVALID_HANDLE = 0x8000;
- const auto LHND = (LMEM_MOVEABLE | LMEM_ZEROINIT);
- const auto LPTR = (LMEM_FIXED | LMEM_ZEROINIT);
- const auto NONZEROLHND = (LMEM_MOVEABLE);
- const auto NONZEROLPTR = (LMEM_FIXED);
- //const auto LocalDiscard( = h ) LocalReAlloc( (h), 0, LMEM_MOVEABLE );
- /* Flags returned by LocalFlags (in addition to LMEM_DISCARDABLE) */
- const auto LMEM_DISCARDED = 0x4000;
- const auto LMEM_LOCKCOUNT = 0x00FF;
- //
- // NUMA values
- //
- const auto NUMA_NO_PREFERRED_NODE = (cast(DWORD) -1);
- //
- // dwCreationFlag values
- //
- const auto DEBUG_PROCESS = 0x00000001;
- const auto DEBUG_ONLY_THIS_PROCESS = 0x00000002;
- const auto CREATE_SUSPENDED = 0x00000004;
- const auto DETACHED_PROCESS = 0x00000008;
- const auto CREATE_NEW_CONSOLE = 0x00000010;
- const auto NORMAL_PRIORITY_CLASS = 0x00000020;
- const auto IDLE_PRIORITY_CLASS = 0x00000040;
- const auto HIGH_PRIORITY_CLASS = 0x00000080;
- const auto REALTIME_PRIORITY_CLASS = 0x00000100;
- const auto CREATE_NEW_PROCESS_GROUP = 0x00000200;
- const auto CREATE_UNICODE_ENVIRONMENT = 0x00000400;
- const auto CREATE_SEPARATE_WOW_VDM = 0x00000800;
- const auto CREATE_SHARED_WOW_VDM = 0x00001000;
- const auto CREATE_FORCEDOS = 0x00002000;
- const auto BELOW_NORMAL_PRIORITY_CLASS = 0x00004000;
- const auto ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000;
- const auto STACK_SIZE_PARAM_IS_A_RESERVATION = 0x00010000;
- const auto INHERIT_CALLER_PRIORITY = 0x00020000;
- const auto CREATE_PROTECTED_PROCESS = 0x00040000;
- const auto EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
- const auto PROCESS_MODE_BACKGROUND_BEGIN = 0x00100000;
- const auto PROCESS_MODE_BACKGROUND_END = 0x00200000;
- const auto CREATE_BREAKAWAY_FROM_JOB = 0x01000000;
- const auto CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000;
- const auto CREATE_DEFAULT_ERROR_MODE = 0x04000000;
- const auto CREATE_NO_WINDOW = 0x08000000;
- const auto PROFILE_USER = 0x10000000;
- const auto PROFILE_KERNEL = 0x20000000;
- const auto PROFILE_SERVER = 0x40000000;
- const auto CREATE_IGNORE_SYSTEM_DEFAULT = 0x80000000;
- const auto THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN;
- const auto THREAD_PRIORITY_BELOW_NORMAL = (THREAD_PRIORITY_LOWEST+1);
- const auto THREAD_PRIORITY_NORMAL = 0;
- const auto THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX;
- const auto THREAD_PRIORITY_ABOVE_NORMAL = (THREAD_PRIORITY_HIGHEST-1);
- const auto THREAD_PRIORITY_ERROR_RETURN = (MAXLONG);
- const auto THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT;
- const auto THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE;
- const auto THREAD_MODE_BACKGROUND_BEGIN = 0x00010000;
- const auto THREAD_MODE_BACKGROUND_END = 0x00020000;
- //
- // GetFinalPathNameByHandle
- //
- const auto VOLUME_NAME_DOS = 0x0 ; //default
- const auto VOLUME_NAME_GUID = 0x1;
- const auto VOLUME_NAME_NT = 0x2;
- const auto VOLUME_NAME_NONE = 0x4;
- const auto FILE_NAME_NORMALIZED = 0x0 ; //default
- const auto FILE_NAME_OPENED = 0x8;
- //
- // Debug APIs
- //
- const auto EXCEPTION_DEBUG_EVENT = 1;
- const auto CREATE_THREAD_DEBUG_EVENT = 2;
- const auto CREATE_PROCESS_DEBUG_EVENT = 3;
- const auto EXIT_THREAD_DEBUG_EVENT = 4;
- const auto EXIT_PROCESS_DEBUG_EVENT = 5;
- const auto LOAD_DLL_DEBUG_EVENT = 6;
- const auto UNLOAD_DLL_DEBUG_EVENT = 7;
- const auto OUTPUT_DEBUG_STRING_EVENT = 8;
- const auto RIP_EVENT = 9;
- struct EXCEPTION_DEBUG_INFO {
- EXCEPTION_RECORD ExceptionRecord;
- DWORD dwFirstChance;
- }
- alias EXCEPTION_DEBUG_INFO* LPEXCEPTION_DEBUG_INFO;
- struct CREATE_THREAD_DEBUG_INFO {
- HANDLE hThread;
- LPVOID lpThreadLocalBase;
- LPTHREAD_START_ROUTINE lpStartAddress;
- }
- alias CREATE_THREAD_DEBUG_INFO* LPCREATE_THREAD_DEBUG_INFO;
- struct CREATE_PROCESS_DEBUG_INFO {
- HANDLE hFile;
- HANDLE hProcess;
- HANDLE hThread;
- LPVOID lpBaseOfImage;
- DWORD dwDebugInfoFileOffset;
- DWORD nDebugInfoSize;
- LPVOID lpThreadLocalBase;
- LPTHREAD_START_ROUTINE lpStartAddress;
- LPVOID lpImageName;
- WORD fUnicode;
- }
- alias CREATE_PROCESS_DEBUG_INFO* LPCREATE_PROCESS_DEBUG_INFO;
- struct EXIT_THREAD_DEBUG_INFO {
- DWORD dwExitCode;
- }
- alias EXIT_THREAD_DEBUG_INFO* LPEXIT_THREAD_DEBUG_INFO;
- struct EXIT_PROCESS_DEBUG_INFO {
- DWORD dwExitCode;
- }
- alias EXIT_PROCESS_DEBUG_INFO* LPEXIT_PROCESS_DEBUG_INFO;
- struct LOAD_DLL_DEBUG_INFO {
- HANDLE hFile;
- LPVOID lpBaseOfDll;
- DWORD dwDebugInfoFileOffset;
- DWORD nDebugInfoSize;
- LPVOID lpImageName;
- WORD fUnicode;
- }
- alias LOAD_DLL_DEBUG_INFO* LPLOAD_DLL_DEBUG_INFO;
- struct UNLOAD_DLL_DEBUG_INFO {
- LPVOID lpBaseOfDll;
- }
- alias UNLOAD_DLL_DEBUG_INFO* LPUNLOAD_DLL_DEBUG_INFO;
- struct OUTPUT_DEBUG_STRING_INFO {
- LPSTR lpDebugStringData;
- WORD fUnicode;
- WORD nDebugStringLength;
- }
- alias OUTPUT_DEBUG_STRING_INFO* LPOUTPUT_DEBUG_STRING_INFO;
- struct RIP_INFO {
- DWORD dwError;
- DWORD dwType;
- }
- alias RIP_INFO* LPRIP_INFO;
- struct DEBUG_EVENT {
- DWORD dwDebugEventCode;
- DWORD dwProcessId;
- DWORD dwThreadId;
- union _inner_union {
- EXCEPTION_DEBUG_INFO Exception;
- CREATE_THREAD_DEBUG_INFO CreateThread;
- CREATE_PROCESS_DEBUG_INFO CreateProcessInfo;
- EXIT_THREAD_DEBUG_INFO ExitThread;
- EXIT_PROCESS_DEBUG_INFO ExitProcess;
- LOAD_DLL_DEBUG_INFO LoadDll;
- UNLOAD_DLL_DEBUG_INFO UnloadDll;
- OUTPUT_DEBUG_STRING_INFO DebugString;
- RIP_INFO RipInfo;
- }
- _inner_union u;
- }
- alias DEBUG_EVENT* LPDEBUG_EVENT;
- //
- // JIT Debugging Info. This structure is defined to have constant size in
- // both the emulated and native environment.
- //
- struct JIT_DEBUG_INFO {
- DWORD dwSize;
- DWORD dwProcessorArchitecture;
- DWORD dwThreadID;
- DWORD dwReserved0;
- ULONG64 lpExceptionAddress;
- ULONG64 lpExceptionRecord;
- ULONG64 lpContextRecord;
- }
- alias JIT_DEBUG_INFO* LPJIT_DEBUG_INFO;
- alias JIT_DEBUG_INFO JIT_DEBUG_INFO32;
- alias JIT_DEBUG_INFO* LPJIT_DEBUG_INFO32;
- alias JIT_DEBUG_INFO JIT_DEBUG_INFO64;
- alias JIT_DEBUG_INFO* LPJIT_DEBUG_INFO64;
- alias PCONTEXT LPCONTEXT;
- alias PEXCEPTION_RECORD LPEXCEPTION_RECORD;
- alias PEXCEPTION_POINTERS LPEXCEPTION_POINTERS;
- const auto DRIVE_UNKNOWN = 0;
- const auto DRIVE_NO_ROOT_DIR = 1;
- const auto DRIVE_REMOVABLE = 2;
- const auto DRIVE_FIXED = 3;
- const auto DRIVE_REMOTE = 4;
- const auto DRIVE_CDROM = 5;
- const auto DRIVE_RAMDISK = 6;
- DWORD GetFreeSpace(uint w) { return (0x100000); }
- const auto FILE_TYPE_UNKNOWN = 0x0000;
- const auto FILE_TYPE_DISK = 0x0001;
- const auto FILE_TYPE_CHAR = 0x0002;
- const auto FILE_TYPE_PIPE = 0x0003;
- const auto FILE_TYPE_REMOTE = 0x8000;
- const auto STD_INPUT_HANDLE = (cast(DWORD)-10);
- const auto STD_OUTPUT_HANDLE = (cast(DWORD)-11);
- const auto STD_ERROR_HANDLE = (cast(DWORD)-12);
- const auto NOPARITY = 0;
- const auto ODDPARITY = 1;
- const auto EVENPARITY = 2;
- const auto MARKPARITY = 3;
- const auto SPACEPARITY = 4;
- const auto ONESTOPBIT = 0;
- const auto ONE5STOPBITS = 1;
- const auto TWOSTOPBITS = 2;
- const auto IGNORE = 0 ; // Ignore signal
- const auto INFINITE = 0xFFFFFFFF ; // Infinite timeout
- //
- // Baud rates at which the communication device operates
- //
- const auto CBR_110 = 110;
- const auto CBR_300 = 300;
- const auto CBR_600 = 600;
- const auto CBR_1200 = 1200;
- const auto CBR_2400 = 2400;
- const auto CBR_4800 = 4800;
- const auto CBR_9600 = 9600;
- const auto CBR_14400 = 14400;
- const auto CBR_19200 = 19200;
- const auto CBR_38400 = 38400;
- const auto CBR_56000 = 56000;
- const auto CBR_57600 = 57600;
- const auto CBR_115200 = 115200;
- const auto CBR_128000 = 128000;
- const auto CBR_256000 = 256000;
- //
- // Error Flags
- //
- const auto CE_RXOVER = 0x0001 ; // Receive Queue overflow
- const auto CE_OVERRUN = 0x0002 ; // Receive Overrun Error
- const auto CE_RXPARITY = 0x0004 ; // Receive Parity Error
- const auto CE_FRAME = 0x0008 ; // Receive Framing error
- const auto CE_BREAK = 0x0010 ; // Break Detected
- const auto CE_TXFULL = 0x0100 ; // TX Queue is full
- const auto CE_PTO = 0x0200 ; // LPTx Timeout
- const auto CE_IOE = 0x0400 ; // LPTx I/O Error
- const auto CE_DNS = 0x0800 ; // LPTx Device not selected
- const auto CE_OOP = 0x1000 ; // LPTx Out-Of-Paper
- const auto CE_MODE = 0x8000 ; // Requested mode unsupported
- const auto IE_BADID = (-1) ; // Invalid or unsupported id
- const auto IE_OPEN = (-2) ; // Device Already Open
- const auto IE_NOPEN = (-3) ; // Device Not Open
- const auto IE_MEMORY = (-4) ; // Unable to allocate queues
- const auto IE_DEFAULT = (-5) ; // Error in default parameters
- const auto IE_HARDWARE = (-10) ; // Hardware Not Present
- const auto IE_BYTESIZE = (-11) ; // Illegal Byte Size
- const auto IE_BAUDRATE = (-12) ; // Unsupported BaudRate
- //
- // Events
- //
- const auto EV_RXCHAR = 0x0001 ; // Any Character received
- const auto EV_RXFLAG = 0x0002 ; // Received certain character
- const auto EV_TXEMPTY = 0x0004 ; // Transmitt Queue Empty
- const auto EV_CTS = 0x0008 ; // CTS changed state
- const auto EV_DSR = 0x0010 ; // DSR changed state
- const auto EV_RLSD = 0x0020 ; // RLSD changed state
- const auto EV_BREAK = 0x0040 ; // BREAK received
- const auto EV_ERR = 0x0080 ; // Line status error occurred
- const auto EV_RING = 0x0100 ; // Ring signal detected
- const auto EV_PERR = 0x0200 ; // Printer error occured
- const auto EV_RX80FULL = 0x0400 ; // Receive buffer is 80 percent full
- const auto EV_EVENT1 = 0x0800 ; // Provider specific event 1
- const auto EV_EVENT2 = 0x1000 ; // Provider specific event 2
- //
- // Escape Functions
- //
- const auto SETXOFF = 1 ; // Simulate XOFF received
- const auto SETXON = 2 ; // Simulate XON received
- const auto SETRTS = 3 ; // Set RTS high
- const auto CLRRTS = 4 ; // Set RTS low
- const auto SETDTR = 5 ; // Set DTR high
- const auto CLRDTR = 6 ; // Set DTR low
- const auto RESETDEV = 7 ; // Reset device if possible
- const auto SETBREAK = 8 ; // Set the device break line.
- const auto CLRBREAK = 9 ; // Clear the device break line.
- //
- // PURGE function flags.
- //
- const auto PURGE_TXABORT = 0x0001 ; // Kill the pending/current writes to the comm port.
- const auto PURGE_RXABORT = 0x0002 ; // Kill the pending/current reads to the comm port.
- const auto PURGE_TXCLEAR = 0x0004 ; // Kill the transmit queue if there.
- const auto PURGE_RXCLEAR = 0x0008 ; // Kill the typeahead buffer if there.
- const auto LPTx = 0x80 ; // Set if ID is for LPT device
- //
- // Modem Status Flags
- //
- const auto MS_CTS_ON = (cast(DWORD)0x0010);
- const auto MS_DSR_ON = (cast(DWORD)0x0020);
- const auto MS_RING_ON = (cast(DWORD)0x0040);
- const auto MS_RLSD_ON = (cast(DWORD)0x0080);
- //
- // WaitSoundState() Constants
- //
- const auto S_QUEUEEMPTY = 0;
- const auto S_THRESHOLD = 1;
- const auto S_ALLTHRESHOLD = 2;
- //
- // Accent Modes
- //
- const auto S_NORMAL = 0;
- const auto S_LEGATO = 1;
- const auto S_STACCATO = 2;
- //
- // SetSoundNoise() Sources
- //
- const auto S_PERIOD512 = 0 ; // Freq = N/512 high pitch, less coarse hiss
- const auto S_PERIOD1024 = 1 ; // Freq = N/1024
- const auto S_PERIOD2048 = 2 ; // Freq = N/2048 low pitch, more coarse hiss
- const auto S_PERIODVOICE = 3 ; // Source is frequency from voice channel (3)
- const auto S_WHITE512 = 4 ; // Freq = N/512 high pitch, less coarse hiss
- const auto S_WHITE1024 = 5 ; // Freq = N/1024
- const auto S_WHITE2048 = 6 ; // Freq = N/2048 low pitch, more coarse hiss
- const auto S_WHITEVOICE = 7 ; // Source is frequency from voice channel (3)
- const auto S_SERDVNA = (-1) ; // Device not available
- const auto S_SEROFM = (-2) ; // Out of memory
- const auto S_SERMACT = (-3) ; // Music active
- const auto S_SERQFUL = (-4) ; // Queue full
- const auto S_SERBDNT = (-5) ; // Invalid note
- const auto S_SERDLN = (-6) ; // Invalid note length
- const auto S_SERDCC = (-7) ; // Invalid note count
- const auto S_SERDTP = (-8) ; // Invalid tempo
- const auto S_SERDVL = (-9) ; // Invalid volume
- const auto S_SERDMD = (-10) ; // Invalid mode
- const auto S_SERDSH = (-11) ; // Invalid shape
- const auto S_SERDPT = (-12) ; // Invalid pitch
- const auto S_SERDFQ = (-13) ; // Invalid frequency
- const auto S_SERDDR = (-14) ; // Invalid duration
- const auto S_SERDSR = (-15) ; // Invalid source
- const auto S_SERDST = (-16) ; // Invalid state
- const auto NMPWAIT_WAIT_FOREVER = 0xffffffff;
- const auto NMPWAIT_NOWAIT = 0x00000001;
- const auto NMPWAIT_USE_DEFAULT_WAIT = 0x00000000;
- const auto FS_CASE_IS_PRESERVED = FILE_CASE_PRESERVED_NAMES;
- const auto FS_CASE_SENSITIVE = FILE_CASE_SENSITIVE_SEARCH;
- const auto FS_UNICODE_STORED_ON_DISK = FILE_UNICODE_ON_DISK;
- const auto FS_PERSISTENT_ACLS = FILE_PERSISTENT_ACLS;
- const auto FS_VOL_IS_COMPRESSED = FILE_VOLUME_IS_COMPRESSED;
- const auto FS_FILE_COMPRESSION = FILE_FILE_COMPRESSION;
- const auto FS_FILE_ENCRYPTION = FILE_SUPPORTS_ENCRYPTION;
- const auto FILE_MAP_COPY = SECTION_QUERY;
- const auto FILE_MAP_WRITE = SECTION_MAP_WRITE;
- const auto FILE_MAP_READ = SECTION_MAP_READ;
- const auto FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS;
- const auto FILE_MAP_EXECUTE = SECTION_MAP_EXECUTE_EXPLICIT ; // not included in FILE_MAP_ALL_ACCESS
- const auto OF_READ = 0x00000000;
- const auto OF_WRITE = 0x00000001;
- const auto OF_READWRITE = 0x00000002;
- const auto OF_SHARE_COMPAT = 0x00000000;
- const auto OF_SHARE_EXCLUSIVE = 0x00000010;
- const auto OF_SHARE_DENY_WRITE = 0x00000020;
- const auto OF_SHARE_DENY_READ = 0x00000030;
- const auto OF_SHARE_DENY_NONE = 0x00000040;
- const auto OF_PARSE = 0x00000100;
- const auto OF_DELETE = 0x00000200;
- const auto OF_VERIFY = 0x00000400;
- const auto OF_CANCEL = 0x00000800;
- const auto OF_CREATE = 0x00001000;
- const auto OF_PROMPT = 0x00002000;
- const auto OF_EXIST = 0x00004000;
- const auto OF_REOPEN = 0x00008000;
- const auto OFS_MAXPATHNAME = 128;
- struct OFSTRUCT {
- BYTE cBytes;
- BYTE fFixedDisk;
- WORD nErrCode;
- WORD Reserved1;
- WORD Reserved2;
- CHAR szPathName[OFS_MAXPATHNAME];
- }
- alias OFSTRUCT* LPOFSTRUCT;
- alias OFSTRUCT* POFSTRUCT;
- version(NOWINBASEINTERLOCK) {
- }
- else {
- LONG InterlockedIncrement (
- LONG* lpAddend
- );
-
- LONG InterlockedDecrement (
- LONG* lpAddend
- );
-
- LONG InterlockedExchange (
- LONG* Target,
- LONG Value
- );
-
- //const auto InterlockedExchangePointer(Target, = Value) \;
- // (PVOID)InterlockedExchange((PLONG)(Target), (LONG)(Value))
-
- LONG InterlockedExchangeAdd (
- LONG *Addend,
- LONG Value
- );
-
- LONG InterlockedCompareExchange (
- LONG* Destination,
- LONG Exchange,
- LONG Comperand
- );
-
- LONGLONG InterlockedCompareExchange64 (
- LONGLONG *Destination,
- LONGLONG Exchange,
- LONGLONG Comperand
- );
-
- alias InterlockedIncrement InterlockedIncrementAcquire;
- alias InterlockedIncrement InterlockedIncrementRelease;
- alias InterlockedDecrement InterlockedDecrementAcquire;
- alias InterlockedDecrement InterlockedDecrementRelease;
- alias InterlockedIncrement InterlockedIncrementAcquire;
- alias InterlockedIncrement InterlockedIncrementRelease;
- alias InterlockedCompareExchange InterlockedCompareExchangeAcquire;
- alias InterlockedCompareExchange InterlockedCompareExchangeRelease;
- alias InterlockedCompareExchange64 InterlockedCompareExchangeAcquire64;
- alias InterlockedCompareExchange64 InterlockedCompareExchangeRelease64;
- //alias InterlockedCompareExchangePointer InterlockedCompareExchangePointerAcquire;
- //alias InterlockedCompareExchangePointer InterlockedCompareExchangePointerRelease;
- VOID InitializeSListHead (
- PSLIST_HEADER ListHead
- );
- PSLIST_ENTRY InterlockedPopEntrySList (
- PSLIST_HEADER ListHead
- );
- PSLIST_ENTRY InterlockedPushEntrySList (
- PSLIST_HEADER ListHead,
- PSLIST_ENTRY ListEntry
- );
- PSLIST_ENTRY InterlockedFlushSList (
- PSLIST_HEADER ListHead
- );
- USHORT QueryDepthSList (
- PSLIST_HEADER ListHead
- );
- }
- BOOL FreeResource(
- HGLOBAL hResData
- );
- LPVOID LockResource(
- HGLOBAL hResData
- );
- //const auto UnlockResource(hResData) = ((hResData), 0);
- const auto MAXINTATOM = 0xC000;
- template MAKEINTATOM(WORD i) {
- const LPTSTR MAKEINTATOM = cast(LPTSTR)(cast(ULONG_PTR)(cast(WORD)(i)));
- }
- const auto INVALID_ATOM = (cast(ATOM)0);
- int WinMain (
- HINSTANCE hInstance,
- HINSTANCE hPrevInstance,
- LPSTR lpCmdLine,
- int nShowCmd
- );
- int wWinMain(
- HINSTANCE hInstance,
- HINSTANCE hPrevInstance,
- LPWSTR lpCmdLine,
- int nShowCmd
- );
- BOOL FreeLibrary (
- HMODULE hLibModule
- );
- VOID FreeLibraryAndExitThread (
- HMODULE hLibModule,
- DWORD dwExitCode
- );
- BOOL DisableThreadLibraryCalls (
- HMODULE hLibModule
- );
- FARPROC GetProcAddress (
- HMODULE hModule,
- LPCSTR lpProcName
- );
- DWORD GetVersion (
- );
- HGLOBAL GlobalAlloc (
- UINT uFlags,
- SIZE_T dwBytes
- );
- HGLOBAL GlobalReAlloc (
- HGLOBAL hMem,
- SIZE_T dwBytes,
- UINT uFlags
- );
- SIZE_T GlobalSize (
- HGLOBAL hMem
- );
- UINT GlobalFlags (
- HGLOBAL hMem
- );
- LPVOID GlobalLock (
- HGLOBAL hMem
- );
- HGLOBAL GlobalHandle (
- LPCVOID pMem
- );
- BOOL GlobalUnlock(
- HGLOBAL hMem
- );
- HGLOBAL GlobalFree(
- HGLOBAL hMem
- );
- SIZE_T GlobalCompact(
- DWORD dwMinFree
- );
- VOID GlobalFix(
- HGLOBAL hMem
- );
- VOID GlobalUnfix(
- HGLOBAL hMem
- );
- LPVOID GlobalWire(
- HGLOBAL hMem
- );
- BOOL GlobalUnWire(
- HGLOBAL hMem
- );
- VOID GlobalMemoryStatus(
- LPMEMORYSTATUS lpBuffer
- );
- struct MEMORYSTATUSEX {
- DWORD dwLength;
- DWORD dwMemoryLoad;
- DWORDLONG ullTotalPhys;
- DWORDLONG ullAvailPhys;
- DWORDLONG ullTotalPageFile;
- DWORDLONG ullAvailPageFile;
- DWORDLONG ullTotalVirtual;
- DWORDLONG ullAvailVirtual;
- DWORDLONG ullAvailExtendedVirtual;
- }
- alias MEMORYSTATUSEX* LPMEMORYSTATUSEX;
- BOOL GlobalMemoryStatusEx(
- LPMEMORYSTATUSEX lpBuffer
- );
- HLOCAL LocalAlloc(
- UINT uFlags,
- SIZE_T uBytes
- );
- HLOCAL LocalReAlloc(
- HLOCAL hMem,
- SIZE_T uBytes,
- UINT uFlags
- );
- LPVOID LocalLock(
- HLOCAL hMem
- );
- HLOCAL LocalHandle(
- LPCVOID pMem
- );
- BOOL LocalUnlock(
- HLOCAL hMem
- );
- SIZE_T LocalSize(
- HLOCAL hMem
- );
- UINT LocalFlags(
- HLOCAL hMem
- );
- HLOCAL LocalFree(
- HLOCAL hMem
- );
- SIZE_T LocalShrink(
- HLOCAL hMem,
- UINT cbNewSize
- );
- SIZE_T LocalCompact(
- UINT uMinFree
- );
- BOOL FlushInstructionCache(
- HANDLE hProcess,
- LPCVOID lpBaseAddress,
- SIZE_T dwSize
- );
- VOID FlushProcessWriteBuffers();
- BOOL QueryThreadCycleTime (
- HANDLE ThreadHandle,
- PULONG64 CycleTime
- );
- BOOL QueryProcessCycleTime (
- HANDLE ProcessHandle,
- PULONG64 CycleTime
- );
- BOOL QueryIdleProcessorCycleTime (
- PULONG BufferLength,
- PULONG64 ProcessorIdleCycleTime
- );
- LPVOID VirtualAlloc(
- LPVOID lpAddress,
- SIZE_T dwSize,
- DWORD flAllocationType,
- DWORD flProtect
- );
- BOOL VirtualFree(
- LPVOID lpAddress,
- SIZE_T dwSize,
- DWORD dwFreeType
- );
- BOOL VirtualProtect(
- LPVOID lpAddress,
- SIZE_T dwSize,
- DWORD flNewProtect,
- PDWORD lpflOldProtect
- );
- SIZE_T VirtualQuery(
- LPCVOID lpAddress,
- PMEMORY_BASIC_INFORMATION lpBuffer,
- SIZE_T dwLength
- );
- LPVOID VirtualAllocEx(
- HANDLE hProcess,
- LPVOID lpAddress,
- SIZE_T dwSize,
- DWORD flAllocationType,
- DWORD flProtect
- );
- LPVOID VirtualAllocExNuma(
- HANDLE hProcess,
- LPVOID lpAddress,
- SIZE_T dwSize,
- DWORD flAllocationType,
- DWORD flProtect,
- DWORD nndPreferred
- );
- UINT GetWriteWatch(
- DWORD dwFlags,
- PVOID lpBaseAddress,
- SIZE_T dwRegionSize,
- PVOID *lpAddresses,
- ULONG_PTR *lpdwCount,
- PULONG lpdwGranularity
- );
- UINT ResetWriteWatch(
- LPVOID lpBaseAddress,
- SIZE_T dwRegionSize
- );
- SIZE_T GetLargePageMinimum();
- UINT EnumSystemFirmwareTables(
- DWORD FirmwareTableProviderSignature,
- PVOID pFirmwareTableEnumBuffer,
- DWORD BufferSize
- );
- UINT GetSystemFirmwareTable(
- DWORD FirmwareTableProviderSignature,
- DWORD FirmwareTableID,
- PVOID pFirmwareTableBuffer,
- DWORD BufferSize
- );
- BOOL VirtualFreeEx(
- HANDLE hProcess,
- LPVOID lpAddress,
- SIZE_T dwSize,
- DWORD dwFreeType
- );
- BOOL VirtualProtectEx(
- HANDLE hProcess,
- LPVOID lpAddress,
- SIZE_T dwSize,
- DWORD flNewProtect,
- PDWORD lpflOldProtect
- );
- SIZE_T VirtualQueryEx(
- HANDLE hProcess,
- LPCVOID lpAddress,
- PMEMORY_BASIC_INFORMATION lpBuffer,
- SIZE_T dwLength
- );
- HANDLE HeapCreate(
- DWORD flOptions,
- SIZE_T dwInitialSize,
- SIZE_T dwMaximumSize
- );
- BOOL HeapDestroy(
- HANDLE hHeap
- );
- LPVOID HeapAlloc(
- HANDLE hHeap,
- DWORD dwFlags,
- SIZE_T dwBytes
- );
- LPVOID HeapReAlloc(
- HANDLE hHeap,
- DWORD dwFlags,
- LPVOID lpMem,
- SIZE_T dwBytes
- );
- BOOL HeapFree(
- HANDLE hHeap,
- DWORD dwFlags,
- LPVOID lpMem
- );
- SIZE_T HeapSize(
- HANDLE hHeap,
- DWORD dwFlags,
- LPCVOID lpMem
- );
- BOOL HeapValidate(
- HANDLE hHeap,
- DWORD dwFlags,
- LPCVOID lpMem
- );
- SIZE_T HeapCompact(
- HANDLE hHeap,
- DWORD dwFlags
- );
- HANDLE GetProcessHeap();
- DWORD GetProcessHeaps(
- DWORD NumberOfHeaps,
- PHANDLE ProcessHeaps
- );
- struct PROCESS_HEAP_ENTRY {
- PVOID lpData;
- DWORD cbData;
- BYTE cbOverhead;
- BYTE iRegionIndex;
- WORD wFlags;
- union _inner_union {
- struct _inner_struct {
- HANDLE hMem;
- DWORD[3] dwReserved;
- }
- _inner_struct Block;
- struct _inner_struct2 {
- DWORD dwCommittedSize;
- DWORD dwUnCommittedSize;
- LPVOID lpFirstBlock;
- LPVOID lpLastBlock;
- }
- _inner_struct2 Region;
- }
- _inner_union fields;
- }
- alias PROCESS_HEAP_ENTRY* LPPROCESS_HEAP_ENTRY;
- alias PROCESS_HEAP_ENTRY* PPROCESS_HEAP_ENTRY;
- const auto PROCESS_HEAP_REGION = 0x0001;
- const auto PROCESS_HEAP_UNCOMMITTED_RANGE = 0x0002;
- const auto PROCESS_HEAP_ENTRY_BUSY = 0x0004;
- const auto PROCESS_HEAP_ENTRY_MOVEABLE = 0x0010;
- const auto PROCESS_HEAP_ENTRY_DDESHARE = 0x0020;
- BOOL HeapLock(
- HANDLE hHeap
- );
- BOOL HeapUnlock(
- HANDLE hHeap
- );
- BOOL HeapWalk(
- HANDLE hHeap,
- LPPROCESS_HEAP_ENTRY lpEntry
- );
- BOOL HeapSetInformation (
- HANDLE HeapHandle,
- HEAP_INFORMATION_CLASS HeapInformationClass,
- PVOID HeapInformation,
- SIZE_T HeapInformationLength
- );
- BOOL HeapQueryInformation (
- HANDLE HeapHandle,
- HEAP_INFORMATION_CLASS HeapInformationClass,
- PVOID HeapInformation,
- SIZE_T HeapInformationLength,
- PSIZE_T ReturnLength
- );
- // GetBinaryType return values.
- const auto SCS_32BIT_BINARY = 0;
- const auto SCS_DOS_BINARY = 1;
- const auto SCS_WOW_BINARY = 2;
- const auto SCS_PIF_BINARY = 3;
- const auto SCS_POSIX_BINARY = 4;
- const auto SCS_OS216_BINARY = 5;
- const auto SCS_64BIT_BINARY = 6;
- version(X86_64) {
- const auto SCS_THIS_PLATFORM_BINARY = SCS_64BIT_BINARY;
- }
- else {
- const auto SCS_THIS_PLATFORM_BINARY = SCS_32BIT_BINARY;
- }
- BOOL GetBinaryTypeA(
- LPCSTR lpApplicationName,
- LPDWORD lpBinaryType
- );
- BOOL GetBinaryTypeW(
- LPCWSTR lpApplicationName,
- LPDWORD lpBinaryType
- );
- version(UNICODE) {
- alias GetBinaryTypeW GetBinaryType;
- }
- else {
- alias GetBinaryTypeA GetBinaryType;
- }
- DWORD GetShortPathNameA(
- LPCSTR lpszLongPath,
- LPSTR lpszShortPath,
- DWORD cchBuffer
- );
- DWORD GetShortPathNameW(
- LPCWSTR lpszLongPath,
- LPWSTR lpszShortPath,
- DWORD cchBuffer
- );
- version(UNICODE) {
- alias GetShortPathNameW GetShortPathName;
- }
- else {
- alias GetShortPathNameA GetShortPathName;
- }
- DWORD GetLongPathNameA(
- LPCSTR lpszShortPath,
- LPSTR lpszLongPath,
- DWORD cchBuffer
- );
- DWORD GetLongPathNameW(
- LPCWSTR lpszShortPath,
- LPWSTR lpszLongPath,
- DWORD cchBuffer
- );
- version(UNICODE) {
- alias GetLongPathNameW GetLongPathName;
- }
- else {
- alias GetLongPathNameA GetLongPathName;
- }
- DWORD GetLongPathNameTransactedA(
- LPCSTR lpszShortPath,
- LPSTR lpszLongPath,
- DWORD cchBuffer,
- HANDLE hTransaction
- );
- DWORD GetLongPathNameTransactedW(
- LPCWSTR lpszShortPath,
- LPWSTR lpszLongPath,
- DWORD cchBuffer,
- HANDLE hTransaction
- );
- version(UNICODE) {
- alias GetLongPathNameTransactedW GetLongPathNameTransacted;
- }
- else {
- alias GetLongPathNameTransactedA GetLongPathNameTransacted;
- }
- BOOL GetProcessAffinityMask(
- HANDLE hProcess,
- PDWORD_PTR lpProcessAffinityMask,
- PDWORD_PTR lpSystemAffinityMask
- );
- BOOL SetProcessAffinityMask(
- HANDLE hProcess,
- DWORD_PTR dwProcessAffinityMask
- );
- BOOL GetProcessHandleCount(
- HANDLE hProcess,
- PDWORD pdwHandleCount
- );
- BOOL GetProcessTimes(
- HANDLE hProcess,
- LPFILETIME lpCreationTime,
- LPFILETIME lpExitTime,
- LPFILETIME lpKernelTime,
- LPFILETIME lpUserTime
- );
- BOOL GetProcessIoCounters(
- HANDLE hProcess,
- PIO_COUNTERS lpIoCounters
- );
- BOOL GetProcessWorkingSetSize(
- HANDLE hProcess,
- PSIZE_T lpMinimumWorkingSetSize,
- PSIZE_T lpMaximumWorkingSetSize
- );
- BOOL GetProcessWorkingSetSizeEx(
- HANDLE hProcess,
- PSIZE_T lpMinimumWorkingSetSize,
- PSIZE_T lpMaximumWorkingSetSize,
- PDWORD Flags
- );
- BOOL SetProcessWorkingSetSize(
- HANDLE hProcess,
- SIZE_T dwMinimumWorkingSetSize,
- SIZE_T dwMaximumWorkingSetSize
- );
- BOOL SetProcessWork…