Artifact Content

Not logged in

Artifact 59684aebe49706fde9e320d54f3aff55272648d5


     1  module win32.winbase;
     2  
     3  // Translated from Microsoft Platform SDK August 2001 Edition
     4  // by Y.Tomino (demoonlit@inter7.jp)
     5  
     6  import win32.windef;
     7  
     8  // #ifndef _WINBASE_
     9  // #define _WINBASE_
    10  
    11  // #if _MSC_VER > 1000
    12  // #pragma once
    13  // #endif
    14  
    15  // #ifdef _MAC
    16  // #...
    17  // #endif //_MAC
    18  
    19  // #if !defined(_ADVAPI32_)
    20  // #define WINADVAPI DECLSPEC_IMPORT
    21  // #else
    22  // #...
    23  // #endif
    24  
    25  // #if !defined(_KERNEL32_)
    26  // #define WINBASEAPI DECLSPEC_IMPORT
    27  // #else
    28  // #...
    29  // #endif
    30  
    31  // #if !defined(_ZAWPROXY_)
    32  // #define ZAWPROXYAPI DECLSPEC_IMPORT
    33  // #else
    34  // #...
    35  // #endif
    36  
    37  // #ifdef __cplusplus
    38  // extern "C" {
    39  // #endif
    40  
    41  // #define DefineHandleTable(w) ((w),TRUE)
    42  // #define LimitEmsPages(dw)
    43  // #define SetSwapAreaSize(w) (w)
    44  // #define LockSegment(w) GlobalFix((HANDLE)(w))
    45  // #define UnlockSegment(w) GlobalUnfix((HANDLE)(w))
    46  alias GetTickCount GetCurrentTime;
    47  
    48  // #define Yield()
    49  
    50  HANDLE INVALID_HANDLE_VALUE = cast(HANDLE)-1;
    51  enum : uint { INVALID_FILE_SIZE = cast(DWORD)0xFFFFFFFF }
    52  enum : uint { INVALID_SET_FILE_POINTER = cast(DWORD)-1 }
    53  enum : uint { INVALID_FILE_ATTRIBUTES = cast(DWORD)-1 }
    54  
    55  enum : uint { FILE_BEGIN = 0 }
    56  enum : uint { FILE_CURRENT = 1 }
    57  enum : uint { FILE_END = 2 }
    58  
    59  enum : uint { TIME_ZONE_ID_INVALID = cast(DWORD)0xFFFFFFFF }
    60  
    61  enum : uint { WAIT_FAILED = cast(DWORD)0xFFFFFFFF }
    62  alias STATUS_WAIT_0 WAIT_OBJECT_0;
    63  
    64  alias STATUS_ABANDONED_WAIT_0 WAIT_ABANDONED;
    65  alias STATUS_ABANDONED_WAIT_0 WAIT_ABANDONED_0;
    66  
    67  alias STATUS_USER_APC WAIT_IO_COMPLETION;
    68  alias STATUS_PENDING STILL_ACTIVE;
    69  alias STATUS_ACCESS_VIOLATION EXCEPTION_ACCESS_VIOLATION;
    70  alias STATUS_DATATYPE_MISALIGNMENT EXCEPTION_DATATYPE_MISALIGNMENT;
    71  alias STATUS_BREAKPOINT EXCEPTION_BREAKPOINT;
    72  alias STATUS_SINGLE_STEP EXCEPTION_SINGLE_STEP;
    73  alias STATUS_ARRAY_BOUNDS_EXCEEDED EXCEPTION_ARRAY_BOUNDS_EXCEEDED;
    74  alias STATUS_FLOAT_DENORMAL_OPERAND EXCEPTION_FLT_DENORMAL_OPERAND;
    75  alias STATUS_FLOAT_DIVIDE_BY_ZERO EXCEPTION_FLT_DIVIDE_BY_ZERO;
    76  alias STATUS_FLOAT_INEXACT_RESULT EXCEPTION_FLT_INEXACT_RESULT;
    77  alias STATUS_FLOAT_INVALID_OPERATION EXCEPTION_FLT_INVALID_OPERATION;
    78  alias STATUS_FLOAT_OVERFLOW EXCEPTION_FLT_OVERFLOW;
    79  alias STATUS_FLOAT_STACK_CHECK EXCEPTION_FLT_STACK_CHECK;
    80  alias STATUS_FLOAT_UNDERFLOW EXCEPTION_FLT_UNDERFLOW;
    81  alias STATUS_INTEGER_DIVIDE_BY_ZERO EXCEPTION_INT_DIVIDE_BY_ZERO;
    82  alias STATUS_INTEGER_OVERFLOW EXCEPTION_INT_OVERFLOW;
    83  alias STATUS_PRIVILEGED_INSTRUCTION EXCEPTION_PRIV_INSTRUCTION;
    84  alias STATUS_IN_PAGE_ERROR EXCEPTION_IN_PAGE_ERROR;
    85  alias STATUS_ILLEGAL_INSTRUCTION EXCEPTION_ILLEGAL_INSTRUCTION;
    86  alias STATUS_NONCONTINUABLE_EXCEPTION EXCEPTION_NONCONTINUABLE_EXCEPTION;
    87  alias STATUS_STACK_OVERFLOW EXCEPTION_STACK_OVERFLOW;
    88  alias STATUS_INVALID_DISPOSITION EXCEPTION_INVALID_DISPOSITION;
    89  alias STATUS_GUARD_PAGE_VIOLATION EXCEPTION_GUARD_PAGE;
    90  alias STATUS_INVALID_HANDLE EXCEPTION_INVALID_HANDLE;
    91  alias STATUS_CONTROL_C_EXIT CONTROL_C_EXIT;
    92  alias RtlMoveMemory MoveMemory;
    93  alias RtlCopyMemory CopyMemory;
    94  alias RtlFillMemory FillMemory;
    95  alias RtlZeroMemory ZeroMemory;
    96  
    97  enum : uint { FILE_FLAG_WRITE_THROUGH = 0x80000000 }
    98  enum : uint { FILE_FLAG_OVERLAPPED = 0x40000000 }
    99  enum : uint { FILE_FLAG_NO_BUFFERING = 0x20000000 }
   100  enum : uint { FILE_FLAG_RANDOM_ACCESS = 0x10000000 }
   101  enum : uint { FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000 }
   102  enum : uint { FILE_FLAG_DELETE_ON_CLOSE = 0x04000000 }
   103  enum : uint { FILE_FLAG_BACKUP_SEMANTICS = 0x02000000 }
   104  enum : uint { FILE_FLAG_POSIX_SEMANTICS = 0x01000000 }
   105  enum : uint { FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000 }
   106  enum : uint { FILE_FLAG_OPEN_NO_RECALL = 0x00100000 }
   107  enum : uint { FILE_FLAG_FIRST_PIPE_INSTANCE = 0x00080000 }
   108  
   109  enum : uint { CREATE_NEW = 1 }
   110  enum : uint { CREATE_ALWAYS = 2 }
   111  enum : uint { OPEN_EXISTING = 3 }
   112  enum : uint { OPEN_ALWAYS = 4 }
   113  enum : uint { TRUNCATE_EXISTING = 5 }
   114  
   115  // #if(_WIN32_WINNT >= 0x0400)
   116  
   117  enum : uint { PROGRESS_CONTINUE = 0 }
   118  enum : uint { PROGRESS_CANCEL = 1 }
   119  enum : uint { PROGRESS_STOP = 2 }
   120  enum : uint { PROGRESS_QUIET = 3 }
   121  
   122  enum : uint { CALLBACK_CHUNK_FINISHED = 0x00000000 }
   123  enum : uint { CALLBACK_STREAM_SWITCH = 0x00000001 }
   124  
   125  enum : uint { COPY_FILE_FAIL_IF_EXISTS = 0x00000001 }
   126  enum : uint { COPY_FILE_RESTARTABLE = 0x00000002 }
   127  enum : uint { COPY_FILE_OPEN_SOURCE_FOR_WRITE = 0x00000004 }
   128  enum : uint { COPY_FILE_ALLOW_DECRYPTED_DESTINATION = 0x00000008 }
   129  // #endif /* _WIN32_WINNT >= 0x0400 */
   130  
   131  // #if (_WIN32_WINNT >= 0x0500)
   132  
   133  enum : uint { REPLACEFILE_WRITE_THROUGH = 0x00000001 }
   134  enum : uint { REPLACEFILE_IGNORE_MERGE_ERRORS = 0x00000002 }
   135  
   136  // #endif // #if (_WIN32_WINNT >= 0x0500)
   137  
   138  enum : uint { PIPE_ACCESS_INBOUND = 0x00000001 }
   139  enum : uint { PIPE_ACCESS_OUTBOUND = 0x00000002 }
   140  enum : uint { PIPE_ACCESS_DUPLEX = 0x00000003 }
   141  
   142  enum : uint { PIPE_CLIENT_END = 0x00000000 }
   143  enum : uint { PIPE_SERVER_END = 0x00000001 }
   144  
   145  enum : uint { PIPE_WAIT = 0x00000000 }
   146  enum : uint { PIPE_NOWAIT = 0x00000001 }
   147  enum : uint { PIPE_READMODE_BYTE = 0x00000000 }
   148  enum : uint { PIPE_READMODE_MESSAGE = 0x00000002 }
   149  enum : uint { PIPE_TYPE_BYTE = 0x00000000 }
   150  enum : uint { PIPE_TYPE_MESSAGE = 0x00000004 }
   151  
   152  enum : uint { PIPE_UNLIMITED_INSTANCES = 255 }
   153  
   154  enum : uint { SECURITY_ANONYMOUS =  SecurityAnonymous << 16  }
   155  enum : uint { SECURITY_IDENTIFICATION =  SecurityIdentification << 16  }
   156  enum : uint { SECURITY_IMPERSONATION =  SecurityImpersonation << 16  }
   157  enum : uint { SECURITY_DELEGATION =  SecurityDelegation << 16  }
   158  
   159  enum : uint { SECURITY_CONTEXT_TRACKING = 0x00040000 }
   160  enum : uint { SECURITY_EFFECTIVE_ONLY = 0x00080000 }
   161  
   162  enum : uint { SECURITY_SQOS_PRESENT = 0x00100000 }
   163  enum : uint { SECURITY_VALID_SQOS_FLAGS = 0x001F0000 }
   164  
   165  struct _OVERLAPPED {
   166    ULONG_PTR Internal;
   167    ULONG_PTR InternalHigh;
   168  union {
   169  struct {
   170    DWORD Offset;
   171    DWORD OffsetHigh;
   172  }
   173  
   174    PVOID Pointer;
   175  }
   176  
   177    HANDLE hEvent;
   178  }
   179  alias _OVERLAPPED OVERLAPPED;
   180  alias _OVERLAPPED* LPOVERLAPPED;
   181  
   182  struct _SECURITY_ATTRIBUTES {
   183    DWORD nLength;
   184    LPVOID lpSecurityDescriptor;
   185    BOOL bInheritHandle;
   186  }
   187  alias _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES;
   188  alias _SECURITY_ATTRIBUTES* PSECURITY_ATTRIBUTES;
   189  alias _SECURITY_ATTRIBUTES* LPSECURITY_ATTRIBUTES;
   190  
   191  struct _PROCESS_INFORMATION {
   192    HANDLE hProcess;
   193    HANDLE hThread;
   194    DWORD dwProcessId;
   195    DWORD dwThreadId;
   196  }
   197  alias _PROCESS_INFORMATION PROCESS_INFORMATION;
   198  alias _PROCESS_INFORMATION* PPROCESS_INFORMATION;
   199  alias _PROCESS_INFORMATION* LPPROCESS_INFORMATION;
   200  
   201  struct _FILETIME {
   202    DWORD dwLowDateTime;
   203    DWORD dwHighDateTime;
   204  }
   205  alias _FILETIME FILETIME;
   206  alias _FILETIME* PFILETIME;
   207  alias _FILETIME* LPFILETIME;
   208  
   209  struct _SYSTEMTIME {
   210    WORD wYear;
   211    WORD wMonth;
   212    WORD wDayOfWeek;
   213    WORD wDay;
   214    WORD wHour;
   215    WORD wMinute;
   216    WORD wSecond;
   217    WORD wMilliseconds;
   218  }
   219  alias _SYSTEMTIME SYSTEMTIME;
   220  alias _SYSTEMTIME* PSYSTEMTIME;
   221  alias _SYSTEMTIME* LPSYSTEMTIME;
   222  
   223  extern(Windows) alias DWORD function( LPVOID lpThreadParameter ) PTHREAD_START_ROUTINE;
   224  alias PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;
   225  
   226  // #if(_WIN32_WINNT >= 0x0400)
   227  extern(Windows) alias VOID function( LPVOID lpFiberParameter ) PFIBER_START_ROUTINE;
   228  alias PFIBER_START_ROUTINE LPFIBER_START_ROUTINE;
   229  // #endif /* _WIN32_WINNT >= 0x0400 */
   230  
   231  alias RTL_CRITICAL_SECTION CRITICAL_SECTION;
   232  alias PRTL_CRITICAL_SECTION PCRITICAL_SECTION;
   233  alias PRTL_CRITICAL_SECTION LPCRITICAL_SECTION;
   234  
   235  alias RTL_CRITICAL_SECTION_DEBUG CRITICAL_SECTION_DEBUG;
   236  alias PRTL_CRITICAL_SECTION_DEBUG PCRITICAL_SECTION_DEBUG;
   237  alias PRTL_CRITICAL_SECTION_DEBUG LPCRITICAL_SECTION_DEBUG;
   238  
   239  // #if defined(_X86_)
   240  alias PLDT_ENTRY LPLDT_ENTRY;
   241  // #else
   242  // ...
   243  // #endif
   244  
   245  alias MUTANT_QUERY_STATE MUTEX_MODIFY_STATE;
   246  alias MUTANT_ALL_ACCESS MUTEX_ALL_ACCESS;
   247  
   248  enum : uint { SP_SERIALCOMM = cast(DWORD)0x00000001 }
   249  
   250  enum : uint { PST_UNSPECIFIED = cast(DWORD)0x00000000 }
   251  enum : uint { PST_RS232 = cast(DWORD)0x00000001 }
   252  enum : uint { PST_PARALLELPORT = cast(DWORD)0x00000002 }
   253  enum : uint { PST_RS422 = cast(DWORD)0x00000003 }
   254  enum : uint { PST_RS423 = cast(DWORD)0x00000004 }
   255  enum : uint { PST_RS449 = cast(DWORD)0x00000005 }
   256  enum : uint { PST_MODEM = cast(DWORD)0x00000006 }
   257  enum : uint { PST_FAX = cast(DWORD)0x00000021 }
   258  enum : uint { PST_SCANNER = cast(DWORD)0x00000022 }
   259  enum : uint { PST_NETWORK_BRIDGE = cast(DWORD)0x00000100 }
   260  enum : uint { PST_LAT = cast(DWORD)0x00000101 }
   261  enum : uint { PST_TCPIP_TELNET = cast(DWORD)0x00000102 }
   262  enum : uint { PST_X25 = cast(DWORD)0x00000103 }
   263  
   264  enum : uint { PCF_DTRDSR = cast(DWORD)0x0001 }
   265  enum : uint { PCF_RTSCTS = cast(DWORD)0x0002 }
   266  enum : uint { PCF_RLSD = cast(DWORD)0x0004 }
   267  enum : uint { PCF_PARITY_CHECK = cast(DWORD)0x0008 }
   268  enum : uint { PCF_XONXOFF = cast(DWORD)0x0010 }
   269  enum : uint { PCF_SETXCHAR = cast(DWORD)0x0020 }
   270  enum : uint { PCF_TOTALTIMEOUTS = cast(DWORD)0x0040 }
   271  enum : uint { PCF_INTTIMEOUTS = cast(DWORD)0x0080 }
   272  enum : uint { PCF_SPECIALCHARS = cast(DWORD)0x0100 }
   273  enum : uint { PCF_16BITMODE = cast(DWORD)0x0200 }
   274  
   275  enum : uint { SP_PARITY = cast(DWORD)0x0001 }
   276  enum : uint { SP_BAUD = cast(DWORD)0x0002 }
   277  enum : uint { SP_DATABITS = cast(DWORD)0x0004 }
   278  enum : uint { SP_STOPBITS = cast(DWORD)0x0008 }
   279  enum : uint { SP_HANDSHAKING = cast(DWORD)0x0010 }
   280  enum : uint { SP_PARITY_CHECK = cast(DWORD)0x0020 }
   281  enum : uint { SP_RLSD = cast(DWORD)0x0040 }
   282  
   283  enum : uint { BAUD_075 = cast(DWORD)0x00000001 }
   284  enum : uint { BAUD_110 = cast(DWORD)0x00000002 }
   285  enum : uint { BAUD_134_5 = cast(DWORD)0x00000004 }
   286  enum : uint { BAUD_150 = cast(DWORD)0x00000008 }
   287  enum : uint { BAUD_300 = cast(DWORD)0x00000010 }
   288  enum : uint { BAUD_600 = cast(DWORD)0x00000020 }
   289  enum : uint { BAUD_1200 = cast(DWORD)0x00000040 }
   290  enum : uint { BAUD_1800 = cast(DWORD)0x00000080 }
   291  enum : uint { BAUD_2400 = cast(DWORD)0x00000100 }
   292  enum : uint { BAUD_4800 = cast(DWORD)0x00000200 }
   293  enum : uint { BAUD_7200 = cast(DWORD)0x00000400 }
   294  enum : uint { BAUD_9600 = cast(DWORD)0x00000800 }
   295  enum : uint { BAUD_14400 = cast(DWORD)0x00001000 }
   296  enum : uint { BAUD_19200 = cast(DWORD)0x00002000 }
   297  enum : uint { BAUD_38400 = cast(DWORD)0x00004000 }
   298  enum : uint { BAUD_56K = cast(DWORD)0x00008000 }
   299  enum : uint { BAUD_128K = cast(DWORD)0x00010000 }
   300  enum : uint { BAUD_115200 = cast(DWORD)0x00020000 }
   301  enum : uint { BAUD_57600 = cast(DWORD)0x00040000 }
   302  enum : uint { BAUD_USER = cast(DWORD)0x10000000 }
   303  
   304  enum : uint { DATABITS_5 = cast(WORD)0x0001 }
   305  enum : uint { DATABITS_6 = cast(WORD)0x0002 }
   306  enum : uint { DATABITS_7 = cast(WORD)0x0004 }
   307  enum : uint { DATABITS_8 = cast(WORD)0x0008 }
   308  enum : uint { DATABITS_16 = cast(WORD)0x0010 }
   309  enum : uint { DATABITS_16X = cast(WORD)0x0020 }
   310  
   311  enum : uint { STOPBITS_10 = cast(WORD)0x0001 }
   312  enum : uint { STOPBITS_15 = cast(WORD)0x0002 }
   313  enum : uint { STOPBITS_20 = cast(WORD)0x0004 }
   314  enum : uint { PARITY_NONE = cast(WORD)0x0100 }
   315  enum : uint { PARITY_ODD = cast(WORD)0x0200 }
   316  enum : uint { PARITY_EVEN = cast(WORD)0x0400 }
   317  enum : uint { PARITY_MARK = cast(WORD)0x0800 }
   318  enum : uint { PARITY_SPACE = cast(WORD)0x1000 }
   319  
   320  struct _COMMPROP {
   321    WORD wPacketLength;
   322    WORD wPacketVersion;
   323    DWORD dwServiceMask;
   324    DWORD dwReserved1;
   325    DWORD dwMaxTxQueue;
   326    DWORD dwMaxRxQueue;
   327    DWORD dwMaxBaud;
   328    DWORD dwProvSubType;
   329    DWORD dwProvCapabilities;
   330    DWORD dwSettableParams;
   331    DWORD dwSettableBaud;
   332    WORD wSettableData;
   333    WORD wSettableStopParity;
   334    DWORD dwCurrentTxQueue;
   335    DWORD dwCurrentRxQueue;
   336    DWORD dwProvSpec1;
   337    DWORD dwProvSpec2;
   338    WCHAR wcProvChar[1];
   339  }
   340  alias _COMMPROP COMMPROP;
   341  alias _COMMPROP* LPCOMMPROP;
   342  
   343  enum : uint { COMMPROP_INITIALIZED = cast(DWORD)0xE73CF52E }
   344  
   345  struct _COMSTAT {
   346  // DWORD fCtsHold : 1;
   347  // DWORD fDsrHold : 1;
   348  // DWORD fRlsdHold : 1;
   349  // DWORD fXoffHold : 1;
   350  // DWORD fXoffSent : 1;
   351  // DWORD fEof : 1;
   352  // DWORD fTxim : 1;
   353  // DWORD fReserved : 25;
   354    DWORD cbInQue;
   355    DWORD cbOutQue;
   356  }
   357  alias _COMSTAT COMSTAT;
   358  alias _COMSTAT* LPCOMSTAT;
   359  
   360  enum : uint { DTR_CONTROL_DISABLE = 0x00 }
   361  enum : uint { DTR_CONTROL_ENABLE = 0x01 }
   362  enum : uint { DTR_CONTROL_HANDSHAKE = 0x02 }
   363  
   364  enum : uint { RTS_CONTROL_DISABLE = 0x00 }
   365  enum : uint { RTS_CONTROL_ENABLE = 0x01 }
   366  enum : uint { RTS_CONTROL_HANDSHAKE = 0x02 }
   367  enum : uint { RTS_CONTROL_TOGGLE = 0x03 }
   368  
   369  struct _DCB {
   370    DWORD DCBlength;
   371    DWORD BaudRate;
   372  // DWORD fBinary: 1;
   373  // DWORD fParity: 1;
   374  // DWORD fOutxCtsFlow:1;
   375  // DWORD fOutxDsrFlow:1;
   376  // DWORD fDtrControl:2;
   377  // DWORD fDsrSensitivity:1;
   378  // DWORD fTXContinueOnXoff: 1;
   379  // DWORD fOutX: 1;
   380  // DWORD fInX: 1;
   381  // DWORD fErrorChar: 1;
   382  // DWORD fNull: 1;
   383  // DWORD fRtsControl:2;
   384  // DWORD fAbortOnError:1;
   385  // DWORD fDummy2:17;
   386    WORD wReserved;
   387    WORD XonLim;
   388    WORD XoffLim;
   389    BYTE ByteSize;
   390    BYTE Parity;
   391    BYTE StopBits;
   392    char XonChar;
   393    char XoffChar;
   394    char ErrorChar;
   395    char EofChar;
   396    char EvtChar;
   397    WORD wReserved1;
   398  }
   399  alias _DCB DCB;
   400  alias _DCB* LPDCB;
   401  
   402  struct _COMMTIMEOUTS {
   403    DWORD ReadIntervalTimeout;
   404    DWORD ReadTotalTimeoutMultiplier;
   405    DWORD ReadTotalTimeoutConstant;
   406    DWORD WriteTotalTimeoutMultiplier;
   407    DWORD WriteTotalTimeoutConstant;
   408  }
   409  alias _COMMTIMEOUTS COMMTIMEOUTS;
   410  alias _COMMTIMEOUTS* LPCOMMTIMEOUTS;
   411  
   412  struct _COMMCONFIG {
   413    DWORD dwSize;
   414    WORD wVersion;
   415    WORD wReserved;
   416    DCB dcb;
   417    DWORD dwProviderSubType;
   418    DWORD dwProviderOffset;
   419    DWORD dwProviderSize;
   420    WCHAR wcProviderData[1];
   421  }
   422  alias _COMMCONFIG COMMCONFIG;
   423  alias _COMMCONFIG* LPCOMMCONFIG;
   424  
   425  struct _SYSTEM_INFO {
   426  union {
   427    DWORD dwOemId;
   428  struct {
   429    WORD wProcessorArchitecture;
   430    WORD wReserved;
   431  }
   432  
   433  }
   434  
   435    DWORD dwPageSize;
   436    LPVOID lpMinimumApplicationAddress;
   437    LPVOID lpMaximumApplicationAddress;
   438    DWORD_PTR dwActiveProcessorMask;
   439    DWORD dwNumberOfProcessors;
   440    DWORD dwProcessorType;
   441    DWORD dwAllocationGranularity;
   442    WORD wProcessorLevel;
   443    WORD wProcessorRevision;
   444  }
   445  alias _SYSTEM_INFO SYSTEM_INFO;
   446  alias _SYSTEM_INFO* LPSYSTEM_INFO;
   447  
   448  alias FreeLibrary FreeModule;
   449  // #define MakeProcInstance(lpProc,hInstance) (lpProc)
   450  // #define FreeProcInstance(lpProc) (lpProc)
   451  
   452  enum : uint { GMEM_FIXED = 0x0000 }
   453  enum : uint { GMEM_MOVEABLE = 0x0002 }
   454  enum : uint { GMEM_NOCOMPACT = 0x0010 }
   455  enum : uint { GMEM_NODISCARD = 0x0020 }
   456  enum : uint { GMEM_ZEROINIT = 0x0040 }
   457  enum : uint { GMEM_MODIFY = 0x0080 }
   458  enum : uint { GMEM_DISCARDABLE = 0x0100 }
   459  enum : uint { GMEM_NOT_BANKED = 0x1000 }
   460  enum : uint { GMEM_SHARE = 0x2000 }
   461  enum : uint { GMEM_DDESHARE = 0x2000 }
   462  enum : uint { GMEM_NOTIFY = 0x4000 }
   463  alias GMEM_NOT_BANKED GMEM_LOWER;
   464  enum : uint { GMEM_VALID_FLAGS = 0x7F72 }
   465  enum : uint { GMEM_INVALID_HANDLE = 0x8000 }
   466  
   467  enum : uint { GHND = GMEM_MOVEABLE | GMEM_ZEROINIT }
   468  enum : uint { GPTR = GMEM_FIXED | GMEM_ZEROINIT }
   469  
   470  // #define GlobalLRUNewest( h ) ((HANDLE)(h))
   471  // #define GlobalLRUOldest( h ) ((HANDLE)(h))
   472  // #define GlobalDiscard( h ) GlobalReAlloc( (h), 0, GMEM_MOVEABLE )
   473  
   474  enum : uint { GMEM_DISCARDED = 0x4000 }
   475  enum : uint { GMEM_LOCKCOUNT = 0x00FF }
   476  
   477  struct _MEMORYSTATUS {
   478    DWORD dwLength;
   479    DWORD dwMemoryLoad;
   480    SIZE_T dwTotalPhys;
   481    SIZE_T dwAvailPhys;
   482    SIZE_T dwTotalPageFile;
   483    SIZE_T dwAvailPageFile;
   484    SIZE_T dwTotalVirtual;
   485    SIZE_T dwAvailVirtual;
   486  }
   487  alias _MEMORYSTATUS MEMORYSTATUS;
   488  alias _MEMORYSTATUS* LPMEMORYSTATUS;
   489  
   490  enum : uint { LMEM_FIXED = 0x0000 }
   491  enum : uint { LMEM_MOVEABLE = 0x0002 }
   492  enum : uint { LMEM_NOCOMPACT = 0x0010 }
   493  enum : uint { LMEM_NODISCARD = 0x0020 }
   494  enum : uint { LMEM_ZEROINIT = 0x0040 }
   495  enum : uint { LMEM_MODIFY = 0x0080 }
   496  enum : uint { LMEM_DISCARDABLE = 0x0F00 }
   497  enum : uint { LMEM_VALID_FLAGS = 0x0F72 }
   498  enum : uint { LMEM_INVALID_HANDLE = 0x8000 }
   499  
   500  enum : uint { LHND = LMEM_MOVEABLE | LMEM_ZEROINIT }
   501  enum : uint { LPTR = LMEM_FIXED | LMEM_ZEROINIT }
   502  
   503  enum : uint { NONZEROLHND = LMEM_MOVEABLE }
   504  enum : uint { NONZEROLPTR = LMEM_FIXED }
   505  
   506  // #define LocalDiscard( h ) LocalReAlloc( (h), 0, LMEM_MOVEABLE )
   507  
   508  enum : uint { LMEM_DISCARDED = 0x4000 }
   509  enum : uint { LMEM_LOCKCOUNT = 0x00FF }
   510  
   511  enum : uint { DEBUG_PROCESS = 0x00000001 }
   512  enum : uint { DEBUG_ONLY_THIS_PROCESS = 0x00000002 }
   513  
   514  enum : uint { CREATE_SUSPENDED = 0x00000004 }
   515  
   516  enum : uint { DETACHED_PROCESS = 0x00000008 }
   517  
   518  enum : uint { CREATE_NEW_CONSOLE = 0x00000010 }
   519  
   520  enum : uint { NORMAL_PRIORITY_CLASS = 0x00000020 }
   521  enum : uint { IDLE_PRIORITY_CLASS = 0x00000040 }
   522  enum : uint { HIGH_PRIORITY_CLASS = 0x00000080 }
   523  enum : uint { REALTIME_PRIORITY_CLASS = 0x00000100 }
   524  
   525  enum : uint { CREATE_NEW_PROCESS_GROUP = 0x00000200 }
   526  enum : uint { CREATE_UNICODE_ENVIRONMENT = 0x00000400 }
   527  
   528  enum : uint { CREATE_SEPARATE_WOW_VDM = 0x00000800 }
   529  enum : uint { CREATE_SHARED_WOW_VDM = 0x00001000 }
   530  enum : uint { CREATE_FORCEDOS = 0x00002000 }
   531  
   532  enum : uint { BELOW_NORMAL_PRIORITY_CLASS = 0x00004000 }
   533  enum : uint { ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000 }
   534  enum : uint { STACK_SIZE_PARAM_IS_A_RESERVATION = 0x00010000 }
   535  
   536  enum : uint { CREATE_BREAKAWAY_FROM_JOB = 0x01000000 }
   537  enum : uint { CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000 }
   538  
   539  enum : uint { CREATE_DEFAULT_ERROR_MODE = 0x04000000 }
   540  enum : uint { CREATE_NO_WINDOW = 0x08000000 }
   541  
   542  enum : uint { PROFILE_USER = 0x10000000 }
   543  enum : uint { PROFILE_KERNEL = 0x20000000 }
   544  enum : uint { PROFILE_SERVER = 0x40000000 }
   545  
   546  enum : uint { CREATE_IGNORE_SYSTEM_DEFAULT = 0x80000000 }
   547  
   548  alias THREAD_BASE_PRIORITY_MIN THREAD_PRIORITY_LOWEST;
   549  enum : uint { THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST+1 }
   550  enum : uint { THREAD_PRIORITY_NORMAL = 0 }
   551  alias THREAD_BASE_PRIORITY_MAX THREAD_PRIORITY_HIGHEST;
   552  enum : uint { THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST-1 }
   553  enum : uint { THREAD_PRIORITY_ERROR_RETURN = MAXLONG }
   554  
   555  alias THREAD_BASE_PRIORITY_LOWRT THREAD_PRIORITY_TIME_CRITICAL;
   556  alias THREAD_BASE_PRIORITY_IDLE THREAD_PRIORITY_IDLE;
   557  
   558  enum : uint { EXCEPTION_DEBUG_EVENT = 1 }
   559  enum : uint { CREATE_THREAD_DEBUG_EVENT = 2 }
   560  enum : uint { CREATE_PROCESS_DEBUG_EVENT = 3 }
   561  enum : uint { EXIT_THREAD_DEBUG_EVENT = 4 }
   562  enum : uint { EXIT_PROCESS_DEBUG_EVENT = 5 }
   563  enum : uint { LOAD_DLL_DEBUG_EVENT = 6 }
   564  enum : uint { UNLOAD_DLL_DEBUG_EVENT = 7 }
   565  enum : uint { OUTPUT_DEBUG_STRING_EVENT = 8 }
   566  enum : uint { RIP_EVENT = 9 }
   567  
   568  struct _EXCEPTION_DEBUG_INFO {
   569    EXCEPTION_RECORD ExceptionRecord;
   570    DWORD dwFirstChance;
   571  }
   572  alias _EXCEPTION_DEBUG_INFO EXCEPTION_DEBUG_INFO;
   573  alias _EXCEPTION_DEBUG_INFO* LPEXCEPTION_DEBUG_INFO;
   574  
   575  struct _CREATE_THREAD_DEBUG_INFO {
   576    HANDLE hThread;
   577    LPVOID lpThreadLocalBase;
   578    LPTHREAD_START_ROUTINE lpStartAddress;
   579  }
   580  alias _CREATE_THREAD_DEBUG_INFO CREATE_THREAD_DEBUG_INFO;
   581  alias _CREATE_THREAD_DEBUG_INFO* LPCREATE_THREAD_DEBUG_INFO;
   582  
   583  struct _CREATE_PROCESS_DEBUG_INFO {
   584    HANDLE hFile;
   585    HANDLE hProcess;
   586    HANDLE hThread;
   587    LPVOID lpBaseOfImage;
   588    DWORD dwDebugInfoFileOffset;
   589    DWORD nDebugInfoSize;
   590    LPVOID lpThreadLocalBase;
   591    LPTHREAD_START_ROUTINE lpStartAddress;
   592    LPVOID lpImageName;
   593    WORD fUnicode;
   594  }
   595  alias _CREATE_PROCESS_DEBUG_INFO CREATE_PROCESS_DEBUG_INFO;
   596  alias _CREATE_PROCESS_DEBUG_INFO* LPCREATE_PROCESS_DEBUG_INFO;
   597  
   598  struct _EXIT_THREAD_DEBUG_INFO {
   599    DWORD dwExitCode;
   600  }
   601  alias _EXIT_THREAD_DEBUG_INFO EXIT_THREAD_DEBUG_INFO;
   602  alias _EXIT_THREAD_DEBUG_INFO* LPEXIT_THREAD_DEBUG_INFO;
   603  
   604  struct _EXIT_PROCESS_DEBUG_INFO {
   605    DWORD dwExitCode;
   606  }
   607  alias _EXIT_PROCESS_DEBUG_INFO EXIT_PROCESS_DEBUG_INFO;
   608  alias _EXIT_PROCESS_DEBUG_INFO* LPEXIT_PROCESS_DEBUG_INFO;
   609  
   610  struct _LOAD_DLL_DEBUG_INFO {
   611    HANDLE hFile;
   612    LPVOID lpBaseOfDll;
   613    DWORD dwDebugInfoFileOffset;
   614    DWORD nDebugInfoSize;
   615    LPVOID lpImageName;
   616    WORD fUnicode;
   617  }
   618  alias _LOAD_DLL_DEBUG_INFO LOAD_DLL_DEBUG_INFO;
   619  alias _LOAD_DLL_DEBUG_INFO* LPLOAD_DLL_DEBUG_INFO;
   620  
   621  struct _UNLOAD_DLL_DEBUG_INFO {
   622    LPVOID lpBaseOfDll;
   623  }
   624  alias _UNLOAD_DLL_DEBUG_INFO UNLOAD_DLL_DEBUG_INFO;
   625  alias _UNLOAD_DLL_DEBUG_INFO* LPUNLOAD_DLL_DEBUG_INFO;
   626  
   627  struct _OUTPUT_DEBUG_STRING_INFO {
   628    LPSTR lpDebugStringData;
   629    WORD fUnicode;
   630    WORD nDebugStringLength;
   631  }
   632  alias _OUTPUT_DEBUG_STRING_INFO OUTPUT_DEBUG_STRING_INFO;
   633  alias _OUTPUT_DEBUG_STRING_INFO* LPOUTPUT_DEBUG_STRING_INFO;
   634  
   635  struct _RIP_INFO {
   636    DWORD dwError;
   637    DWORD dwType;
   638  }
   639  alias _RIP_INFO RIP_INFO;
   640  alias _RIP_INFO* LPRIP_INFO;
   641  
   642  struct _DEBUG_EVENT {
   643    DWORD dwDebugEventCode;
   644    DWORD dwProcessId;
   645    DWORD dwThreadId;
   646  union {
   647    EXCEPTION_DEBUG_INFO Exception;
   648    CREATE_THREAD_DEBUG_INFO CreateThread;
   649    CREATE_PROCESS_DEBUG_INFO CreateProcessInfo;
   650    EXIT_THREAD_DEBUG_INFO ExitThread;
   651    EXIT_PROCESS_DEBUG_INFO ExitProcess;
   652    LOAD_DLL_DEBUG_INFO LoadDll;
   653    UNLOAD_DLL_DEBUG_INFO UnloadDll;
   654    OUTPUT_DEBUG_STRING_INFO DebugString;
   655    RIP_INFO RipInfo;
   656  }
   657  
   658  }
   659  alias _DEBUG_EVENT DEBUG_EVENT;
   660  alias _DEBUG_EVENT* LPDEBUG_EVENT;
   661  
   662  // #if !defined(MIDL_PASS)
   663  alias PCONTEXT LPCONTEXT;
   664  alias PEXCEPTION_RECORD LPEXCEPTION_RECORD;
   665  alias PEXCEPTION_POINTERS LPEXCEPTION_POINTERS;
   666  // #endif
   667  
   668  enum : uint { DRIVE_UNKNOWN = 0 }
   669  enum : uint { DRIVE_NO_ROOT_DIR = 1 }
   670  enum : uint { DRIVE_REMOVABLE = 2 }
   671  enum : uint { DRIVE_FIXED = 3 }
   672  enum : uint { DRIVE_REMOTE = 4 }
   673  enum : uint { DRIVE_CDROM = 5 }
   674  enum : uint { DRIVE_RAMDISK = 6 }
   675  
   676  // #ifndef _MAC
   677  // #define GetFreeSpace(w) (0x100000L)
   678  // #else
   679  // ...
   680  // #endif
   681  
   682  enum : uint { FILE_TYPE_UNKNOWN = 0x0000 }
   683  enum : uint { FILE_TYPE_DISK = 0x0001 }
   684  enum : uint { FILE_TYPE_CHAR = 0x0002 }
   685  enum : uint { FILE_TYPE_PIPE = 0x0003 }
   686  enum : uint { FILE_TYPE_REMOTE = 0x8000 }
   687  
   688  enum : uint { STD_INPUT_HANDLE = cast(DWORD)-10 }
   689  enum : uint { STD_OUTPUT_HANDLE = cast(DWORD)-11 }
   690  enum : uint { STD_ERROR_HANDLE = cast(DWORD)-12 }
   691  
   692  enum : uint { NOPARITY = 0 }
   693  enum : uint { ODDPARITY = 1 }
   694  enum : uint { EVENPARITY = 2 }
   695  enum : uint { MARKPARITY = 3 }
   696  enum : uint { SPACEPARITY = 4 }
   697  
   698  enum : uint { ONESTOPBIT = 0 }
   699  enum : uint { ONE5STOPBITS = 1 }
   700  enum : uint { TWOSTOPBITS = 2 }
   701  
   702  enum : uint { IGNORE = 0 }
   703  enum : uint { INFINITE = 0xFFFFFFFF }
   704  
   705  enum : uint { CBR_110 = 110 }
   706  enum : uint { CBR_300 = 300 }
   707  enum : uint { CBR_600 = 600 }
   708  enum : uint { CBR_1200 = 1200 }
   709  enum : uint { CBR_2400 = 2400 }
   710  enum : uint { CBR_4800 = 4800 }
   711  enum : uint { CBR_9600 = 9600 }
   712  enum : uint { CBR_14400 = 14400 }
   713  enum : uint { CBR_19200 = 19200 }
   714  enum : uint { CBR_38400 = 38400 }
   715  enum : uint { CBR_56000 = 56000 }
   716  enum : uint { CBR_57600 = 57600 }
   717  enum : uint { CBR_115200 = 115200 }
   718  enum : uint { CBR_128000 = 128000 }
   719  enum : uint { CBR_256000 = 256000 }
   720  
   721  enum : uint { CE_RXOVER = 0x0001 }
   722  enum : uint { CE_OVERRUN = 0x0002 }
   723  enum : uint { CE_RXPARITY = 0x0004 }
   724  enum : uint { CE_FRAME = 0x0008 }
   725  enum : uint { CE_BREAK = 0x0010 }
   726  enum : uint { CE_TXFULL = 0x0100 }
   727  enum : uint { CE_PTO = 0x0200 }
   728  enum : uint { CE_IOE = 0x0400 }
   729  enum : uint { CE_DNS = 0x0800 }
   730  enum : uint { CE_OOP = 0x1000 }
   731  enum : uint { CE_MODE = 0x8000 }
   732  
   733  enum { IE_BADID = -1 }
   734  enum { IE_OPEN = -2 }
   735  enum { IE_NOPEN = -3 }
   736  enum { IE_MEMORY = -4 }
   737  enum { IE_DEFAULT = -5 }
   738  enum { IE_HARDWARE = -10 }
   739  enum { IE_BYTESIZE = -11 }
   740  enum { IE_BAUDRATE = -12 }
   741  
   742  enum : uint { EV_RXCHAR = 0x0001 }
   743  enum : uint { EV_RXFLAG = 0x0002 }
   744  enum : uint { EV_TXEMPTY = 0x0004 }
   745  enum : uint { EV_CTS = 0x0008 }
   746  enum : uint { EV_DSR = 0x0010 }
   747  enum : uint { EV_RLSD = 0x0020 }
   748  enum : uint { EV_BREAK = 0x0040 }
   749  enum : uint { EV_ERR = 0x0080 }
   750  enum : uint { EV_RING = 0x0100 }
   751  enum : uint { EV_PERR = 0x0200 }
   752  enum : uint { EV_RX80FULL = 0x0400 }
   753  enum : uint { EV_EVENT1 = 0x0800 }
   754  enum : uint { EV_EVENT2 = 0x1000 }
   755  
   756  enum : uint { SETXOFF = 1 }
   757  enum : uint { SETXON = 2 }
   758  enum : uint { SETRTS = 3 }
   759  enum : uint { CLRRTS = 4 }
   760  enum : uint { SETDTR = 5 }
   761  enum : uint { CLRDTR = 6 }
   762  enum : uint { RESETDEV = 7 }
   763  enum : uint { SETBREAK = 8 }
   764  enum : uint { CLRBREAK = 9 }
   765  
   766  enum : uint { PURGE_TXABORT = 0x0001 }
   767  enum : uint { PURGE_RXABORT = 0x0002 }
   768  enum : uint { PURGE_TXCLEAR = 0x0004 }
   769  enum : uint { PURGE_RXCLEAR = 0x0008 }
   770  
   771  enum : uint { LPTx = 0x80 }
   772  
   773  enum : uint { MS_CTS_ON = cast(DWORD)0x0010 }
   774  enum : uint { MS_DSR_ON = cast(DWORD)0x0020 }
   775  enum : uint { MS_RING_ON = cast(DWORD)0x0040 }
   776  enum : uint { MS_RLSD_ON = cast(DWORD)0x0080 }
   777  
   778  enum : uint { S_QUEUEEMPTY = 0 }
   779  enum : uint { S_THRESHOLD = 1 }
   780  enum : uint { S_ALLTHRESHOLD = 2 }
   781  
   782  enum : uint { S_NORMAL = 0 }
   783  enum : uint { S_LEGATO = 1 }
   784  enum : uint { S_STACCATO = 2 }
   785  
   786  enum : uint { S_PERIOD512 = 0 }
   787  enum : uint { S_PERIOD1024 = 1 }
   788  enum : uint { S_PERIOD2048 = 2 }
   789  enum : uint { S_PERIODVOICE = 3 }
   790  enum : uint { S_WHITE512 = 4 }
   791  enum : uint { S_WHITE1024 = 5 }
   792  enum : uint { S_WHITE2048 = 6 }
   793  enum : uint { S_WHITEVOICE = 7 }
   794  
   795  enum { S_SERDVNA = -1 }
   796  enum { S_SEROFM = -2 }
   797  enum { S_SERMACT = -3 }
   798  enum { S_SERQFUL = -4 }
   799  enum { S_SERBDNT = -5 }
   800  enum { S_SERDLN = -6 }
   801  enum { S_SERDCC = -7 }
   802  enum { S_SERDTP = -8 }
   803  enum { S_SERDVL = -9 }
   804  enum { S_SERDMD = -10 }
   805  enum { S_SERDSH = -11 }
   806  enum { S_SERDPT = -12 }
   807  enum { S_SERDFQ = -13 }
   808  enum { S_SERDDR = -14 }
   809  enum { S_SERDSR = -15 }
   810  enum { S_SERDST = -16 }
   811  
   812  enum : uint { NMPWAIT_WAIT_FOREVER = 0xffffffff }
   813  enum : uint { NMPWAIT_NOWAIT = 0x00000001 }
   814  enum : uint { NMPWAIT_USE_DEFAULT_WAIT = 0x00000000 }
   815  
   816  alias FILE_CASE_PRESERVED_NAMES FS_CASE_IS_PRESERVED;
   817  alias FILE_CASE_SENSITIVE_SEARCH FS_CASE_SENSITIVE;
   818  alias FILE_UNICODE_ON_DISK FS_UNICODE_STORED_ON_DISK;
   819  alias FILE_PERSISTENT_ACLS FS_PERSISTENT_ACLS;
   820  alias FILE_VOLUME_IS_COMPRESSED FS_VOL_IS_COMPRESSED;
   821  alias FILE_FILE_COMPRESSION FS_FILE_COMPRESSION;
   822  alias FILE_SUPPORTS_ENCRYPTION FS_FILE_ENCRYPTION;
   823  
   824  alias SECTION_QUERY FILE_MAP_COPY;
   825  alias SECTION_MAP_WRITE FILE_MAP_WRITE;
   826  alias SECTION_MAP_READ FILE_MAP_READ;
   827  alias SECTION_ALL_ACCESS FILE_MAP_ALL_ACCESS;
   828  
   829  enum : uint { OF_READ = 0x00000000 }
   830  enum : uint { OF_WRITE = 0x00000001 }
   831  enum : uint { OF_READWRITE = 0x00000002 }
   832  enum : uint { OF_SHARE_COMPAT = 0x00000000 }
   833  enum : uint { OF_SHARE_EXCLUSIVE = 0x00000010 }
   834  enum : uint { OF_SHARE_DENY_WRITE = 0x00000020 }
   835  enum : uint { OF_SHARE_DENY_READ = 0x00000030 }
   836  enum : uint { OF_SHARE_DENY_NONE = 0x00000040 }
   837  enum : uint { OF_PARSE = 0x00000100 }
   838  enum : uint { OF_DELETE = 0x00000200 }
   839  enum : uint { OF_VERIFY = 0x00000400 }
   840  enum : uint { OF_CANCEL = 0x00000800 }
   841  enum : uint { OF_CREATE = 0x00001000 }
   842  enum : uint { OF_PROMPT = 0x00002000 }
   843  enum : uint { OF_EXIST = 0x00004000 }
   844  enum : uint { OF_REOPEN = 0x00008000 }
   845  
   846  enum : uint { OFS_MAXPATHNAME = 128 }
   847  struct _OFSTRUCT {
   848    BYTE cBytes;
   849    BYTE fFixedDisk;
   850    WORD nErrCode;
   851    WORD Reserved1;
   852    WORD Reserved2;
   853    CHAR szPathName[OFS_MAXPATHNAME];
   854  }
   855  alias _OFSTRUCT OFSTRUCT;
   856  alias _OFSTRUCT* LPOFSTRUCT;
   857  alias _OFSTRUCT* POFSTRUCT;
   858  
   859  // #ifndef NOWINBASEINTERLOCK
   860  
   861  // #ifndef _NTOS_
   862  
   863  // #if defined(_M_IA64) && !defined(RC_INVOKED)
   864  
   865  // #...
   866  // #...
   867  // #...
   868  // #...
   869  // #...
   870  // #...
   871  // #...
   872  
   873  // ...
   874  
   875  // ...
   876  
   877  // ...
   878  
   879  // ...
   880  
   881  // ...
   882  
   883  // ...
   884  
   885  // ...
   886  
   887  // #...
   888  // #...
   889  // #...
   890  // #...
   891  // #...
   892  // #...
   893  // #...
   894  
   895  // #elif defined(_M_AMD64) && !defined(RC_INVOKED)
   896  
   897  // #...
   898  // #...
   899  // #...
   900  // #...
   901  // #...
   902  // #...
   903  // #...
   904  
   905  // ...
   906  
   907  // ...
   908  
   909  // ...
   910  
   911  // ...
   912  
   913  // ...
   914  
   915  // ...
   916  
   917  // ...
   918  
   919  // #...
   920  // #...
   921  // #...
   922  // #...
   923  // #...
   924  // #...
   925  // #...
   926  
   927  // #else           // X86 interlocked definitions
   928  
   929  extern(Windows) export LONG InterlockedIncrement(
   930    LONG *lpAddend);
   931  
   932  extern(Windows) export LONG InterlockedDecrement(
   933    LONG *lpAddend);
   934  
   935  extern(Windows) export LONG InterlockedExchange(
   936    LONG *Target,
   937    LONG Value);
   938  
   939  void* InterlockedExchangePointer(void** t, void* v){ return cast(void*)InterlockedExchange(cast(PLONG)t, cast(LONG)v); }
   940  
   941  extern(Windows) export LONG InterlockedExchangeAdd(
   942    LONG *Addend,
   943    LONG Value);
   944  
   945  extern(Windows) export LONG InterlockedCompareExchange(
   946    LONG *Destination,
   947    LONG Exchange,
   948    LONG Comperand);
   949  
   950  // #ifdef __cplusplus
   951  
   952  PVOID __InlineInterlockedCompareExchangePointer(PVOID* Destination, PVOID ExChange, PVOID Comperand){ return(cast(PVOID)cast(LONG_PTR)InterlockedCompareExchange(cast(LONG*)Destination, cast(LONG)cast(LONG_PTR)ExChange, cast(LONG)cast(LONG_PTR)Comperand)); }
   953  alias __InlineInterlockedCompareExchangePointer InterlockedCompareExchangePointer;
   954  
   955  // #else
   956  
   957  // #...
   958  // ...
   959  
   960  // #endif /* __cplusplus */
   961  
   962  // #endif /* X86 | IA64 */
   963  
   964  // #if defined(_SLIST_HEADER_) && !defined(_NTOSP_)
   965  
   966  // ...
   967  
   968  // ...
   969  
   970  // ...
   971  
   972  // ...
   973  
   974  // ...
   975  
   976  // #endif /* _SLIST_HEADER_ */
   977  // #endif /* _NTOS_ */
   978  
   979  // #endif /* NOWINBASEINTERLOCK */
   980  
   981  extern(Windows) export BOOL FreeResource(
   982    HGLOBAL hResData);
   983  
   984  extern(Windows) export LPVOID LockResource(
   985    HGLOBAL hResData);
   986  
   987  // #define UnlockResource(hResData) ((hResData), 0)
   988  enum : uint { MAXINTATOM = 0xC000 }
   989  // #define MAKEINTATOM(i) (LPTSTR)((ULONG_PTR)((WORD)(i)))
   990  enum : ATOM { INVALID_ATOM = 0 }
   991  
   992  // #ifndef _MAC
   993  // ???
   994  // ???
   995  // #else
   996  // ...
   997  // #endif
   998  // WinMain
   999  
  1000  extern(Windows) export BOOL FreeLibrary(
  1001    HMODULE hLibModule);
  1002  
  1003  extern(Windows) export VOID FreeLibraryAndExitThread(
  1004    HMODULE hLibModule,
  1005    DWORD dwExitCode);
  1006  
  1007  extern(Windows) export BOOL DisableThreadLibraryCalls(
  1008    HMODULE hLibModule);
  1009  
  1010  extern(Windows) export FARPROC GetProcAddress(
  1011    HMODULE hModule,
  1012    LPCSTR lpProcName);
  1013  
  1014  extern(Windows) export DWORD GetVersion();
  1015  
  1016  extern(Windows) export HGLOBAL GlobalAlloc(
  1017    UINT uFlags,
  1018    SIZE_T dwBytes);
  1019  
  1020  extern(Windows) export HGLOBAL GlobalReAlloc(
  1021    HGLOBAL hMem,
  1022    SIZE_T dwBytes,
  1023    UINT uFlags);
  1024  
  1025  extern(Windows) export SIZE_T GlobalSize(
  1026    HGLOBAL hMem);
  1027  
  1028  extern(Windows) export UINT GlobalFlags(
  1029    HGLOBAL hMem);
  1030  
  1031  extern(Windows) export LPVOID GlobalLock(
  1032    HGLOBAL hMem);
  1033  
  1034  extern(Windows) export HGLOBAL GlobalHandle(
  1035    LPCVOID pMem);
  1036  
  1037  extern(Windows) export BOOL GlobalUnlock(
  1038    HGLOBAL hMem);
  1039  
  1040  extern(Windows) export HGLOBAL GlobalFree(
  1041    HGLOBAL hMem);
  1042  
  1043  extern(Windows) export SIZE_T GlobalCompact(
  1044    DWORD dwMinFree);
  1045  
  1046  extern(Windows) export VOID GlobalFix(
  1047    HGLOBAL hMem);
  1048  
  1049  extern(Windows) export VOID GlobalUnfix(
  1050    HGLOBAL hMem);
  1051  
  1052  extern(Windows) export LPVOID GlobalWire(
  1053    HGLOBAL hMem);
  1054  
  1055  extern(Windows) export BOOL GlobalUnWire(
  1056    HGLOBAL hMem);
  1057  
  1058  extern(Windows) export VOID GlobalMemoryStatus(
  1059    LPMEMORYSTATUS lpBuffer);
  1060  
  1061  struct _MEMORYSTATUSEX {
  1062    DWORD dwLength;
  1063    DWORD dwMemoryLoad;
  1064    DWORDLONG ullTotalPhys;
  1065    DWORDLONG ullAvailPhys;
  1066    DWORDLONG ullTotalPageFile;
  1067    DWORDLONG ullAvailPageFile;
  1068    DWORDLONG ullTotalVirtual;
  1069    DWORDLONG ullAvailVirtual;
  1070    DWORDLONG ullAvailExtendedVirtual;
  1071  }
  1072  alias _MEMORYSTATUSEX MEMORYSTATUSEX;
  1073  alias _MEMORYSTATUSEX* LPMEMORYSTATUSEX;
  1074  
  1075  extern(Windows) export BOOL GlobalMemoryStatusEx(
  1076    LPMEMORYSTATUSEX lpBuffer);
  1077  
  1078  extern(Windows) export HLOCAL LocalAlloc(
  1079    UINT uFlags,
  1080    SIZE_T uBytes);
  1081  
  1082  extern(Windows) export HLOCAL LocalReAlloc(
  1083    HLOCAL hMem,
  1084    SIZE_T uBytes,
  1085    UINT uFlags);
  1086  
  1087  extern(Windows) export LPVOID LocalLock(
  1088    HLOCAL hMem);
  1089  
  1090  extern(Windows) export HLOCAL LocalHandle(
  1091    LPCVOID pMem);
  1092  
  1093  extern(Windows) export BOOL LocalUnlock(
  1094    HLOCAL hMem);
  1095  
  1096  extern(Windows) export SIZE_T LocalSize(
  1097    HLOCAL hMem);
  1098  
  1099  extern(Windows) export UINT LocalFlags(
  1100    HLOCAL hMem);
  1101  
  1102  extern(Windows) export HLOCAL LocalFree(
  1103    HLOCAL hMem);
  1104  
  1105  extern(Windows) export SIZE_T LocalShrink(
  1106    HLOCAL hMem,
  1107    UINT cbNewSize);
  1108  
  1109  extern(Windows) export SIZE_T LocalCompact(
  1110    UINT uMinFree);
  1111  
  1112  extern(Windows) export BOOL FlushInstructionCache(
  1113    HANDLE hProcess,
  1114    LPCVOID lpBaseAddress,
  1115    SIZE_T dwSize);
  1116  
  1117  extern(Windows) export LPVOID VirtualAlloc(
  1118    LPVOID lpAddress,
  1119    SIZE_T dwSize,
  1120    DWORD flAllocationType,
  1121    DWORD flProtect);
  1122  
  1123  extern(Windows) export BOOL VirtualFree(
  1124    LPVOID lpAddress,
  1125    SIZE_T dwSize,
  1126    DWORD dwFreeType);
  1127  
  1128  extern(Windows) export BOOL VirtualProtect(
  1129    LPVOID lpAddress,
  1130    SIZE_T dwSize,
  1131    DWORD flNewProtect,
  1132    PDWORD lpflOldProtect);
  1133  
  1134  extern(Windows) export SIZE_T VirtualQuery(
  1135    LPCVOID lpAddress,
  1136    PMEMORY_BASIC_INFORMATION lpBuffer,
  1137    SIZE_T dwLength);
  1138  
  1139  extern(Windows) export LPVOID VirtualAllocEx(
  1140    HANDLE hProcess,
  1141    LPVOID lpAddress,
  1142    SIZE_T dwSize,
  1143    DWORD flAllocationType,
  1144    DWORD flProtect);
  1145  
  1146  extern(Windows) export UINT GetWriteWatch(
  1147    DWORD dwFlags,
  1148    PVOID lpBaseAddress,
  1149    SIZE_T dwRegionSize,
  1150    PVOID *lpAddresses,
  1151    PULONG_PTR lpdwCount,
  1152    PULONG lpdwGranularity);
  1153  
  1154  extern(Windows) export UINT ResetWriteWatch(
  1155    LPVOID lpBaseAddress,
  1156    SIZE_T dwRegionSize);
  1157  
  1158  extern(Windows) export BOOL VirtualFreeEx(
  1159    HANDLE hProcess,
  1160    LPVOID lpAddress,
  1161    SIZE_T dwSize,
  1162    DWORD dwFreeType);
  1163  
  1164  extern(Windows) export BOOL VirtualProtectEx(
  1165    HANDLE hProcess,
  1166    LPVOID lpAddress,
  1167    SIZE_T dwSize,
  1168    DWORD flNewProtect,
  1169    PDWORD lpflOldProtect);
  1170  
  1171  extern(Windows) export SIZE_T VirtualQueryEx(
  1172    HANDLE hProcess,
  1173    LPCVOID lpAddress,
  1174    PMEMORY_BASIC_INFORMATION lpBuffer,
  1175    SIZE_T dwLength);
  1176  
  1177  extern(Windows) export HANDLE HeapCreate(
  1178    DWORD flOptions,
  1179    SIZE_T dwInitialSize,
  1180    SIZE_T dwMaximumSize);
  1181  
  1182  extern(Windows) export BOOL HeapDestroy(
  1183    HANDLE hHeap);
  1184  
  1185  extern(Windows) export LPVOID HeapAlloc(
  1186    HANDLE hHeap,
  1187    DWORD dwFlags,
  1188    SIZE_T dwBytes);
  1189  
  1190  extern(Windows) export LPVOID HeapReAlloc(
  1191    HANDLE hHeap,
  1192    DWORD dwFlags,
  1193    LPVOID lpMem,
  1194    SIZE_T dwBytes);
  1195  
  1196  extern(Windows) export BOOL HeapFree(
  1197    HANDLE hHeap,
  1198    DWORD dwFlags,
  1199    LPVOID lpMem);
  1200  
  1201  extern(Windows) export SIZE_T HeapSize(
  1202    HANDLE hHeap,
  1203    DWORD dwFlags,
  1204    LPCVOID lpMem);
  1205  
  1206  extern(Windows) export BOOL HeapValidate(
  1207    HANDLE hHeap,
  1208    DWORD dwFlags,
  1209    LPCVOID lpMem);
  1210  
  1211  extern(Windows) export SIZE_T HeapCompact(
  1212    HANDLE hHeap,
  1213    DWORD dwFlags);
  1214  
  1215  extern(Windows) export HANDLE GetProcessHeap();
  1216  
  1217  extern(Windows) export DWORD GetProcessHeaps(
  1218    DWORD NumberOfHeaps,
  1219    PHANDLE ProcessHeaps);
  1220  
  1221  struct _PROCESS_HEAP_ENTRY {
  1222    PVOID lpData;
  1223    DWORD cbData;
  1224    BYTE cbOverhead;
  1225    BYTE iRegionIndex;
  1226    WORD wFlags;
  1227  union {
  1228  struct {
  1229    HANDLE hMem;
  1230    DWORD dwReserved[ 3 ];
  1231  }
  1232  
  1233  struct {
  1234    DWORD dwCommittedSize;
  1235    DWORD dwUnCommittedSize;
  1236    LPVOID lpFirstBlock;
  1237    LPVOID lpLastBlock;
  1238  }
  1239  
  1240  }
  1241  
  1242  }
  1243  alias _PROCESS_HEAP_ENTRY PROCESS_HEAP_ENTRY;
  1244  alias _PROCESS_HEAP_ENTRY* LPPROCESS_HEAP_ENTRY;
  1245  alias _PROCESS_HEAP_ENTRY* PPROCESS_HEAP_ENTRY;
  1246  
  1247  enum : uint { PROCESS_HEAP_REGION = 0x0001 }
  1248  enum : uint { PROCESS_HEAP_UNCOMMITTED_RANGE = 0x0002 }
  1249  enum : uint { PROCESS_HEAP_ENTRY_BUSY = 0x0004 }
  1250  enum : uint { PROCESS_HEAP_ENTRY_MOVEABLE = 0x0010 }
  1251  enum : uint { PROCESS_HEAP_ENTRY_DDESHARE = 0x0020 }
  1252  
  1253  extern(Windows) export BOOL HeapLock(
  1254    HANDLE hHeap);
  1255  
  1256  extern(Windows) export BOOL HeapUnlock(
  1257    HANDLE hHeap);
  1258  
  1259  extern(Windows) export BOOL HeapWalk(
  1260    HANDLE hHeap,
  1261    LPPROCESS_HEAP_ENTRY lpEntry);
  1262  
  1263  extern(Windows) export BOOL HeapSetInformation(
  1264    PVOID HeapHandle, 
  1265    HEAP_INFORMATION_CLASS HeapInformationClass,
  1266    PVOID HeapInformation ,
  1267    SIZE_T HeapInformationLength );
  1268  
  1269  extern(Windows) export BOOL HeapQueryInformation(
  1270    PVOID HeapHandle, 
  1271    HEAP_INFORMATION_CLASS HeapInformationClass,
  1272    PVOID HeapInformation ,
  1273    SIZE_T HeapInformationLength ,
  1274    PSIZE_T ReturnLength );
  1275  
  1276  enum : uint { SCS_32BIT_BINARY = 0 }
  1277  enum : uint { SCS_DOS_BINARY = 1 }
  1278  enum : uint { SCS_WOW_BINARY = 2 }
  1279  enum : uint { SCS_PIF_BINARY = 3 }
  1280  enum : uint { SCS_POSIX_BINARY = 4 }
  1281  enum : uint { SCS_OS216_BINARY = 5 }
  1282  enum : uint { SCS_64BIT_BINARY = 6 }
  1283  
  1284  // #if defined(_WIN64)
  1285  // #...
  1286  // #else
  1287  alias SCS_32BIT_BINARY SCS_THIS_PLATFORM_BINARY;
  1288  // #endif
  1289  
  1290  extern(Windows) export BOOL GetBinaryTypeA(
  1291    LPCSTR lpApplicationName,
  1292    LPDWORD lpBinaryType);
  1293  extern(Windows) export BOOL GetBinaryTypeW(
  1294    LPCWSTR lpApplicationName,
  1295    LPDWORD lpBinaryType);
  1296  // #ifdef UNICODE
  1297  alias GetBinaryTypeW GetBinaryType;
  1298  // #else
  1299  // #...
  1300  // #endif // !UNICODE
  1301  
  1302  extern(Windows) export DWORD GetShortPathNameA(
  1303    LPCSTR lpszLongPath,
  1304    LPSTR lpszShortPath,
  1305    DWORD cchBuffer);
  1306  extern(Windows) export DWORD GetShortPathNameW(
  1307    LPCWSTR lpszLongPath,
  1308    LPWSTR lpszShortPath,
  1309    DWORD cchBuffer);
  1310  // #ifdef UNICODE
  1311  alias GetShortPathNameW GetShortPathName;
  1312  // #else
  1313  // #...
  1314  // #endif // !UNICODE
  1315  
  1316  extern(Windows) export DWORD GetLongPathNameA(
  1317    LPCSTR lpszShortPath,
  1318    LPSTR lpszLongPath,
  1319    DWORD cchBuffer);
  1320  extern(Windows) export DWORD GetLongPathNameW(
  1321    LPCWSTR lpszShortPath,
  1322    LPWSTR lpszLongPath,
  1323    DWORD cchBuffer);
  1324  // #ifdef UNICODE
  1325  alias GetLongPathNameW GetLongPathName;
  1326  // #else
  1327  // #...
  1328  // #endif // !UNICODE
  1329  
  1330  extern(Windows) export BOOL GetProcessAffinityMask(
  1331    HANDLE hProcess,
  1332    PDWORD_PTR lpProcessAffinityMask,
  1333    PDWORD_PTR lpSystemAffinityMask);
  1334  
  1335  extern(Windows) export BOOL SetProcessAffinityMask(
  1336    HANDLE hProcess,
  1337    DWORD_PTR dwProcessAffinityMask);
  1338  
  1339  extern(Windows) export BOOL GetProcessTimes(
  1340    HANDLE hProcess,
  1341    LPFILETIME lpCreationTime,
  1342    LPFILETIME lpExitTime,
  1343    LPFILETIME lpKernelTime,
  1344    LPFILETIME lpUserTime);
  1345  
  1346  extern(Windows) export BOOL GetProcessIoCounters(
  1347    HANDLE hProcess,
  1348    PIO_COUNTERS lpIoCounters);
  1349  
  1350  extern(Windows) export BOOL GetProcessWorkingSetSize(
  1351    HANDLE hProcess,
  1352    PSIZE_T lpMinimumWorkingSetSize,
  1353    PSIZE_T lpMaximumWorkingSetSize);
  1354  
  1355  extern(Windows) export BOOL SetProcessWorkingSetSize(
  1356    HANDLE hProcess,
  1357    SIZE_T dwMinimumWorkingSetSize,
  1358    SIZE_T dwMaximumWorkingSetSize);
  1359  
  1360  extern(Windows) export HANDLE OpenProcess(
  1361    DWORD dwDesiredAccess,
  1362    BOOL bInheritHandle,
  1363    DWORD dwProcessId);
  1364  
  1365  extern(Windows) export HANDLE GetCurrentProcess();
  1366  
  1367  extern(Windows) export DWORD GetCurrentProcessId();
  1368  
  1369  extern(Windows) export VOID ExitProcess(
  1370    UINT uExitCode);
  1371  
  1372  extern(Windows) export BOOL TerminateProcess(
  1373    HANDLE hProcess,
  1374    UINT uExitCode);
  1375  
  1376  extern(Windows) export BOOL GetExitCodeProcess(
  1377    HANDLE hProcess,
  1378    LPDWORD lpExitCode);
  1379  
  1380  extern(Windows) export VOID FatalExit(
  1381    int ExitCode);
  1382  
  1383  extern(Windows) export LPSTR GetEnvironmentStrings();
  1384  
  1385  extern(Windows) export LPWSTR GetEnvironmentStringsW();
  1386  
  1387  // #ifdef UNICODE
  1388  alias GetEnvironmentStringsW GetEnvironmentStrings;
  1389  // #else
  1390  // #...
  1391  // #endif // !UNICODE
  1392  
  1393  extern(Windows) export BOOL FreeEnvironmentStringsA(
  1394    LPSTR);
  1395  extern(Windows) export BOOL FreeEnvironmentStringsW(
  1396    LPWSTR);
  1397  // #ifdef UNICODE
  1398  alias FreeEnvironmentStringsW FreeEnvironmentStrings;
  1399  // #else
  1400  // #...
  1401  // #endif // !UNICODE
  1402  
  1403  extern(Windows) export VOID RaiseException(
  1404    DWORD dwExceptionCode,
  1405    DWORD dwExceptionFlags,
  1406    DWORD nNumberOfArguments,
  1407    ULONG_PTR *lpArguments);
  1408  
  1409  extern(Windows) export LONG UnhandledExceptionFilter(
  1410    _EXCEPTION_POINTERS *ExceptionInfo);
  1411  
  1412  extern(Windows) alias LONG function(  _EXCEPTION_POINTERS *ExceptionInfo ) PTOP_LEVEL_EXCEPTION_FILTER;
  1413  alias PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
  1414  
  1415  extern(Windows) export LPTOP_LEVEL_EXCEPTION_FILTER SetUnhandledExceptionFilter(
  1416    LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter);
  1417  
  1418  // #if(_WIN32_WINNT >= 0x0400)
  1419  
  1420  extern(Windows) export LPVOID CreateFiber(
  1421    SIZE_T dwStackSize,
  1422    LPFIBER_START_ROUTINE lpStartAddress,
  1423    LPVOID lpParameter);
  1424  
  1425  extern(Windows) export LPVOID CreateFiberEx(
  1426    SIZE_T dwStackCommitSize,
  1427    SIZE_T dwStackReserveSize,
  1428    DWORD dwFlags,
  1429    LPFIBER_START_ROUTINE lpStartAddress,
  1430    LPVOID lpParameter);
  1431  
  1432  extern(Windows) export VOID DeleteFiber(
  1433    LPVOID lpFiber);
  1434  
  1435  extern(Windows) export LPVOID ConvertThreadToFiber(
  1436    LPVOID lpParameter);
  1437  
  1438  extern(Windows) export BOOL ConvertFiberToThread();
  1439  
  1440  extern(Windows) export VOID SwitchToFiber(
  1441    LPVOID lpFiber);
  1442  
  1443  extern(Windows) export BOOL SwitchToThread();
  1444  // #endif /* _WIN32_WINNT >= 0x0400 */
  1445  
  1446  extern(Windows) export HANDLE CreateThread(
  1447    LPSECURITY_ATTRIBUTES lpThreadAttributes,
  1448    SIZE_T dwStackSize,
  1449    LPTHREAD_START_ROUTINE lpStartAddress,
  1450    LPVOID lpParameter,
  1451    DWORD dwCreationFlags,
  1452    LPDWORD lpThreadId);
  1453  
  1454  extern(Windows) export HANDLE CreateRemoteThread(
  1455    HANDLE hProcess,
  1456    LPSECURITY_ATTRIBUTES lpThreadAttributes,
  1457    SIZE_T dwStackSize,
  1458    LPTHREAD_START_ROUTINE lpStartAddress,
  1459    LPVOID lpParameter,
  1460    DWORD dwCreationFlags,
  1461    LPDWORD lpThreadId);
  1462  
  1463  extern(Windows) export HANDLE GetCurrentThread();
  1464  
  1465  extern(Windows) export DWORD GetCurrentThreadId();
  1466  
  1467  extern(Windows) export DWORD_PTR SetThreadAffinityMask(
  1468    HANDLE hThread,
  1469    DWORD_PTR dwThreadAffinityMask);
  1470  
  1471  // #if(_WIN32_WINNT >= 0x0400)
  1472  extern(Windows) export DWORD SetThreadIdealProcessor(
  1473    HANDLE hThread,
  1474    DWORD dwIdealProcessor);
  1475  // #endif /* _WIN32_WINNT >= 0x0400 */
  1476  
  1477  extern(Windows) export BOOL SetProcessPriorityBoost(
  1478    HANDLE hProcess,
  1479    BOOL bDisablePriorityBoost);
  1480  
  1481  extern(Windows) export BOOL GetProcessPriorityBoost(
  1482    HANDLE hProcess,
  1483    PBOOL pDisablePriorityBoost);
  1484  
  1485  extern(Windows) export BOOL RequestWakeupLatency(
  1486    LATENCY_TIME latency);
  1487  
  1488  extern(Windows) export BOOL IsSystemResumeAutomatic();
  1489  
  1490  extern(Windows) export HANDLE OpenThread(
  1491    DWORD dwDesiredAccess,
  1492    BOOL bInheritHandle,
  1493    DWORD dwThreadId);
  1494  
  1495  extern(Windows) export BOOL SetThreadPriority(
  1496    HANDLE hThread,
  1497    int nPriority);
  1498  
  1499  extern(Windows) export BOOL SetThreadPriorityBoost(
  1500    HANDLE hThread,
  1501    BOOL bDisablePriorityBoost);
  1502  
  1503  extern(Windows) export BOOL GetThreadPriorityBoost(
  1504    HANDLE hThread,
  1505    PBOOL pDisablePriorityBoost);
  1506  
  1507  extern(Windows) export int GetThreadPriority(
  1508    HANDLE hThread);
  1509  
  1510  extern(Windows) export BOOL GetThreadTimes(
  1511    HANDLE hThread,
  1512    LPFILETIME lpCreationTime,
  1513    LPFILETIME lpExitTime,
  1514    LPFILETIME lpKernelTime,
  1515    LPFILETIME lpUserTime);
  1516  
  1517  extern(Windows) export VOID ExitThread(
  1518    DWORD dwExitCode);
  1519  
  1520  extern(Windows) export BOOL TerminateThread(
  1521    HANDLE hThread,
  1522    DWORD dwExitCode);
  1523  
  1524  extern(Windows) export BOOL GetExitCodeThread(
  1525    HANDLE hThread,
  1526    LPDWORD lpExitCode);
  1527  
  1528  extern(Windows) export BOOL GetThreadSelectorEntry(
  1529    HANDLE hThread,
  1530    DWORD dwSelector,
  1531    LPLDT_ENTRY lpSelectorEntry);
  1532  
  1533  extern(Windows) export EXECUTION_STATE SetThreadExecutionState(
  1534    EXECUTION_STATE esFlags);
  1535  
  1536  extern(Windows) export DWORD GetLastError();
  1537  
  1538  extern(Windows) export VOID SetLastError(
  1539    DWORD dwErrCode);
  1540  
  1541  // #if !defined(RC_INVOKED) // RC warns because "WINBASE_DECLARE_RESTORE_LAST_ERROR" is a bit long.
  1542  
  1543  // #if defined(WINBASE_DECLARE_RESTORE_LAST_ERROR)
  1544  
  1545  // ...
  1546  
  1547  // ...
  1548  // #...
  1549  // #...
  1550  // #...
  1551  
  1552  // #endif
  1553  // #endif
  1554  
  1555  bit HasOverlappedIoCompleted(LPOVERLAPPED lpOverlapped){ return (*lpOverlapped).Internal != STATUS_PENDING; }
  1556  
  1557  extern(Windows) export BOOL GetOverlappedResult(
  1558    HANDLE hFile,
  1559    LPOVERLAPPED lpOverlapped,
  1560    LPDWORD lpNumberOfBytesTransferred,
  1561    BOOL bWait);
  1562  
  1563  extern(Windows) export HANDLE CreateIoCompletionPort(
  1564    HANDLE FileHandle,
  1565    HANDLE ExistingCompletionPort,
  1566    ULONG_PTR CompletionKey,
  1567    DWORD NumberOfConcurrentThreads);
  1568  
  1569  extern(Windows) export BOOL GetQueuedCompletionStatus(
  1570    HANDLE CompletionPort,
  1571    LPDWORD lpNumberOfBytesTransferred,
  1572    PULONG_PTR lpCompletionKey,
  1573    LPOVERLAPPED *lpOverlapped,
  1574    DWORD dwMilliseconds);
  1575  
  1576  extern(Windows) export BOOL PostQueuedCompletionStatus(
  1577    HANDLE CompletionPort,
  1578    DWORD dwNumberOfBytesTransferred,
  1579    ULONG_PTR dwCompletionKey,
  1580    LPOVERLAPPED lpOverlapped);
  1581  
  1582  enum : uint { SEM_FAILCRITICALERRORS = 0x0001 }
  1583  enum : uint { SEM_NOGPFAULTERRORBOX = 0x0002 }
  1584  enum : uint { SEM_NOALIGNMENTFAULTEXCEPT = 0x0004 }
  1585  enum : uint { SEM_NOOPENFILEERRORBOX = 0x8000 }
  1586  
  1587  extern(Windows) export UINT SetErrorMode(
  1588    UINT uMode);
  1589  
  1590  extern(Windows) export BOOL ReadProcessMemory(
  1591    HANDLE hProcess,
  1592    LPCVOID lpBaseAddress,
  1593    LPVOID lpBuffer,
  1594    SIZE_T nSize,
  1595    SIZE_T * lpNumberOfBytesRead);
  1596  
  1597  extern(Windows) export BOOL WriteProcessMemory(
  1598    HANDLE hProcess,
  1599    LPVOID lpBaseAddress,
  1600    LPCVOID lpBuffer,
  1601    SIZE_T nSize,
  1602    SIZE_T * lpNumberOfBytesWritten);
  1603  
  1604  // #if !defined(MIDL_PASS)
  1605  extern(Windows) export BOOL GetThreadContext(
  1606    HANDLE hThread,
  1607    LPCONTEXT lpContext);
  1608  
  1609  extern(Windows) export BOOL SetThreadContext(
  1610    HANDLE hThread,
  1611    CONTEXT *lpContext);
  1612  // #endif
  1613  
  1614  extern(Windows) export DWORD SuspendThread(
  1615    HANDLE hThread);
  1616  
  1617  extern(Windows) export DWORD ResumeThread(
  1618    HANDLE hThread);
  1619  
  1620  // #if(_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
  1621  
  1622  // ...
  1623  
  1624  // ...
  1625  
  1626  // #endif /* _WIN32_WINNT >= 0x0400 || _WIN32_WINDOWS > 0x0400 */
  1627  
  1628  // #if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
  1629  extern(Windows) export BOOL IsDebuggerPresent();
  1630  // #endif
  1631  
  1632  extern(Windows) export VOID DebugBreak();
  1633  
  1634  extern(Windows) export BOOL WaitForDebugEvent(
  1635    LPDEBUG_EVENT lpDebugEvent,
  1636    DWORD dwMilliseconds);
  1637  
  1638  extern(Windows) export BOOL ContinueDebugEvent(
  1639    DWORD dwProcessId,
  1640    DWORD dwThreadId,
  1641    DWORD dwContinueStatus);
  1642  
  1643  extern(Windows) export BOOL DebugActiveProcess(
  1644    DWORD dwProcessId);
  1645  
  1646  extern(Windows) export BOOL DebugActiveProcessStop(
  1647    DWORD dwProcessId);
  1648  
  1649  extern(Windows) export BOOL DebugSetProcessKillOnExit(
  1650    BOOL KillOnExit);
  1651  
  1652  extern(Windows) export BOOL DebugBreakProcess(
  1653    HANDLE Process);
  1654  
  1655  extern(Windows) export VOID InitializeCriticalSection(
  1656    LPCRITICAL_SECTION lpCriticalSection);
  1657  
  1658  extern(Windows) export VOID EnterCriticalSection(
  1659    LPCRITICAL_SECTION lpCriticalSection);
  1660  
  1661  extern(Windows) export VOID LeaveCriticalSection(
  1662    LPCRITICAL_SECTION lpCriticalSection);
  1663  
  1664  // #if (_WIN32_WINNT >= 0x0403)
  1665  extern(Windows) export BOOL InitializeCriticalSectionAndSpinCount(
  1666    LPCRITICAL_SECTION lpCriticalSection,
  1667    DWORD dwSpinCount);
  1668  
  1669  extern(Windows) export DWORD SetCriticalSectionSpinCount(
  1670    LPCRITICAL_SECTION lpCriticalSection,
  1671    DWORD dwSpinCount);
  1672  // #endif
  1673  
  1674  // #if(_WIN32_WINNT >= 0x0400)
  1675  extern(Windows) export BOOL TryEnterCriticalSection(
  1676    LPCRITICAL_SECTION lpCriticalSection);
  1677  // #endif /* _WIN32_WINNT >= 0x0400 */
  1678  
  1679  extern(Windows) export VOID DeleteCriticalSection(
  1680    LPCRITICAL_SECTION lpCriticalSection);
  1681  
  1682  extern(Windows) export BOOL SetEvent(
  1683    HANDLE hEvent);
  1684  
  1685  extern(Windows) export BOOL ResetEvent(
  1686    HANDLE hEvent);
  1687  
  1688  extern(Windows) export BOOL PulseEvent(
  1689    HANDLE hEvent);
  1690  
  1691  extern(Windows) export BOOL ReleaseSemaphore(
  1692    HANDLE hSemaphore,
  1693    LONG lReleaseCount,
  1694    LPLONG lpPreviousCount);
  1695  
  1696  extern(Windows) export BOOL ReleaseMutex(
  1697    HANDLE hMutex);
  1698  
  1699  extern(Windows) export DWORD WaitForSingleObject(
  1700    HANDLE hHandle,
  1701    DWORD dwMilliseconds);
  1702  
  1703  extern(Windows) export DWORD WaitForMultipleObjects(
  1704    DWORD nCount,
  1705    HANDLE *lpHandles,
  1706    BOOL bWaitAll,
  1707    DWORD dwMilliseconds);
  1708  
  1709  extern(Windows) export VOID Sleep(
  1710    DWORD dwMilliseconds);
  1711  
  1712  extern(Windows) export HGLOBAL LoadResource(
  1713    HMODULE hModule,
  1714    HRSRC hResInfo);
  1715  
  1716  extern(Windows) export DWORD SizeofResource(
  1717    HMODULE hModule,
  1718    HRSRC hResInfo);
  1719  
  1720  extern(Windows) export ATOM GlobalDeleteAtom(
  1721    ATOM nAtom);
  1722  
  1723  extern(Windows) export BOOL InitAtomTable(
  1724    DWORD nSize);
  1725  
  1726  extern(Windows) export ATOM DeleteAtom(
  1727    ATOM nAtom);
  1728  
  1729  extern(Windows) export UINT SetHandleCount(
  1730    UINT uNumber);
  1731  
  1732  extern(Windows) export DWORD GetLogicalDrives();
  1733  
  1734  extern(Windows) export BOOL LockFile(
  1735    HANDLE hFile,
  1736    DWORD dwFileOffsetLow,
  1737    DWORD dwFileOffsetHigh,
  1738    DWORD nNumberOfBytesToLockLow,
  1739    DWORD nNumberOfBytesToLockHigh);
  1740  
  1741  extern(Windows) export BOOL UnlockFile(
  1742    HANDLE hFile,
  1743    DWORD dwFileOffsetLow,
  1744    DWORD dwFileOffsetHigh,
  1745    DWORD nNumberOfBytesToUnlockLow,
  1746    DWORD nNumberOfBytesToUnlockHigh);
  1747  
  1748  extern(Windows) export BOOL LockFileEx(
  1749    HANDLE hFile,
  1750    DWORD dwFlags,
  1751    DWORD dwReserved,
  1752    DWORD nNumberOfBytesToLockLow,
  1753    DWORD nNumberOfBytesToLockHigh,
  1754    LPOVERLAPPED lpOverlapped);
  1755  
  1756  enum : uint { LOCKFILE_FAIL_IMMEDIATELY = 0x00000001 }
  1757  enum : uint { LOCKFILE_EXCLUSIVE_LOCK = 0x00000002 }
  1758  
  1759  extern(Windows) export BOOL UnlockFileEx(
  1760    HANDLE hFile,
  1761    DWORD dwReserved,
  1762    DWORD nNumberOfBytesToUnlockLow,
  1763    DWORD nNumberOfBytesToUnlockHigh,
  1764    LPOVERLAPPED lpOverlapped);
  1765  
  1766  struct _BY_HANDLE_FILE_INFORMATION {
  1767    DWORD dwFileAttributes;
  1768    FILETIME ftCreationTime;
  1769    FILETIME ftLastAccessTime;
  1770    FILETIME ftLastWriteTime;
  1771    DWORD dwVolumeSerialNumber;
  1772    DWORD nFileSizeHigh;
  1773    DWORD nFileSizeLow;
  1774    DWORD nNumberOfLinks;
  1775    DWORD nFileIndexHigh;
  1776    DWORD nFileIndexLow;
  1777  }
  1778  alias _BY_HANDLE_FILE_INFORMATION BY_HANDLE_FILE_INFORMATION;
  1779  alias _BY_HANDLE_FILE_INFORMATION* PBY_HANDLE_FILE_INFORMATION;
  1780  alias _BY_HANDLE_FILE_INFORMATION* LPBY_HANDLE_FILE_INFORMATION;
  1781  
  1782  extern(Windows) export BOOL GetFileInformationByHandle(
  1783    HANDLE hFile,
  1784    LPBY_HANDLE_FILE_INFORMATION lpFileInformation);
  1785  
  1786  extern(Windows) export DWORD GetFileType(
  1787    HANDLE hFile);
  1788  
  1789  extern(Windows) export DWORD GetFileSize(
  1790    HANDLE hFile,
  1791    LPDWORD lpFileSizeHigh);
  1792  
  1793  extern(Windows) export BOOL GetFileSizeEx(
  1794    HANDLE hFile,
  1795    PLARGE_INTEGER lpFileSize);
  1796  
  1797  extern(Windows) export HANDLE GetStdHandle(
  1798    DWORD nStdHandle);
  1799  
  1800  extern(Windows) export BOOL SetStdHandle(
  1801    DWORD nStdHandle,
  1802    HANDLE hHandle);
  1803  
  1804  extern(Windows) export BOOL WriteFile(
  1805    HANDLE hFile,
  1806    LPCVOID lpBuffer,
  1807    DWORD nNumberOfBytesToWrite,
  1808    LPDWORD lpNumberOfBytesWritten,
  1809    LPOVERLAPPED lpOverlapped);
  1810  
  1811  extern(Windows) export BOOL ReadFile(
  1812    HANDLE hFile,
  1813    LPVOID lpBuffer,
  1814    DWORD nNumberOfBytesToRead,
  1815    LPDWORD lpNumberOfBytesRead,
  1816    LPOVERLAPPED lpOverlapped);
  1817  
  1818  extern(Windows) export BOOL FlushFileBuffers(
  1819    HANDLE hFile);
  1820  
  1821  extern(Windows) export BOOL DeviceIoControl(
  1822    HANDLE hDevice,
  1823    DWORD dwIoControlCode,
  1824    LPVOID lpInBuffer,
  1825    DWORD nInBufferSize,
  1826    LPVOID lpOutBuffer,
  1827    DWORD nOutBufferSize,
  1828    LPDWORD lpBytesReturned,
  1829    LPOVERLAPPED lpOverlapped);
  1830  
  1831  extern(Windows) export BOOL RequestDeviceWakeup(
  1832    HANDLE hDevice);
  1833  
  1834  extern(Windows) export BOOL CancelDeviceWakeupRequest(
  1835    HANDLE hDevice);
  1836  
  1837  extern(Windows) export BOOL GetDevicePowerState(
  1838    HANDLE hDevice,
  1839    BOOL *pfOn);
  1840  
  1841  extern(Windows) export BOOL SetMessageWaitingIndicator(
  1842    HANDLE hMsgIndicator,
  1843    ULONG ulMsgCount);
  1844  
  1845  extern(Windows) export BOOL SetEndOfFile(
  1846    HANDLE hFile);
  1847  
  1848  extern(Windows) export DWORD SetFilePointer(
  1849    HANDLE hFile,
  1850    LONG lDistanceToMove,
  1851    PLONG lpDistanceToMoveHigh,
  1852    DWORD dwMoveMethod);
  1853  
  1854  extern(Windows) export BOOL SetFilePointerEx(
  1855    HANDLE hFile,
  1856    LARGE_INTEGER liDistanceToMove,
  1857    PLARGE_INTEGER lpNewFilePointer,
  1858    DWORD dwMoveMethod);
  1859  
  1860  extern(Windows) export BOOL FindClose(
  1861    HANDLE hFindFile);
  1862  
  1863  extern(Windows) export BOOL GetFileTime(
  1864    HANDLE hFile,
  1865    LPFILETIME lpCreationTime,
  1866    LPFILETIME lpLastAccessTime,
  1867    LPFILETIME lpLastWriteTime);
  1868  
  1869  extern(Windows) export BOOL SetFileTime(
  1870    HANDLE hFile,
  1871    FILETIME *lpCreationTime,
  1872    FILETIME *lpLastAccessTime,
  1873    FILETIME *lpLastWriteTime);
  1874  
  1875  extern(Windows) export BOOL SetFileValidData(
  1876    HANDLE hFile,
  1877    LONGLONG ValidDataLength);
  1878  
  1879  extern(Windows) export BOOL SetFileShortNameA(
  1880    HANDLE hFile,
  1881    LPCSTR lpShortName);
  1882  extern(Windows) export BOOL SetFileShortNameW(
  1883    HANDLE hFile,
  1884    LPCWSTR lpShortName);
  1885  // #ifdef UNICODE
  1886  alias SetFileShortNameW SetFileShortName;
  1887  // #else
  1888  // #...
  1889  // #endif // !UNICODE
  1890  
  1891  extern(Windows) export BOOL CloseHandle(
  1892    HANDLE hObject);
  1893  
  1894  extern(Windows) export BOOL DuplicateHandle(
  1895    HANDLE hSourceProcessHandle,
  1896    HANDLE hSourceHandle,
  1897    HANDLE hTargetProcessHandle,
  1898    LPHANDLE lpTargetHandle,
  1899    DWORD dwDesiredAccess,
  1900    BOOL bInheritHandle,
  1901    DWORD dwOptions);
  1902  
  1903  extern(Windows) export BOOL GetHandleInformation(
  1904    HANDLE hObject,
  1905    LPDWORD lpdwFlags);
  1906  
  1907  extern(Windows) export BOOL SetHandleInformation(
  1908    HANDLE hObject,
  1909    DWORD dwMask,
  1910    DWORD dwFlags);
  1911  
  1912  enum : uint { HANDLE_FLAG_INHERIT = 0x00000001 }
  1913  enum : uint { HANDLE_FLAG_PROTECT_FROM_CLOSE = 0x00000002 }
  1914  
  1915  enum : uint { HINSTANCE_ERROR = 32 }
  1916  
  1917  extern(Windows) export DWORD LoadModule(
  1918    LPCSTR lpModuleName,
  1919    LPVOID lpParameterBlock);
  1920  
  1921  extern(Windows) export UINT WinExec(
  1922    LPCSTR lpCmdLine,
  1923    UINT uCmdShow);
  1924  
  1925  extern(Windows) export BOOL ClearCommBreak(
  1926    HANDLE hFile);
  1927  
  1928  extern(Windows) export BOOL ClearCommError(
  1929    HANDLE hFile,
  1930    LPDWORD lpErrors,
  1931    LPCOMSTAT lpStat);
  1932  
  1933  extern(Windows) export BOOL SetupComm(
  1934    HANDLE hFile,
  1935    DWORD dwInQueue,
  1936    DWORD dwOutQueue);
  1937  
  1938  extern(Windows) export BOOL EscapeCommFunction(
  1939    HANDLE hFile,
  1940    DWORD dwFunc);
  1941  
  1942  extern(Windows) export BOOL GetCommConfig(
  1943    HANDLE hCommDev,
  1944    LPCOMMCONFIG lpCC,
  1945    LPDWORD lpdwSize);
  1946  
  1947  extern(Windows) export BOOL GetCommMask(
  1948    HANDLE hFile,
  1949    LPDWORD lpEvtMask);
  1950  
  1951  extern(Windows) export BOOL GetCommProperties(
  1952    HANDLE hFile,
  1953    LPCOMMPROP lpCommProp);
  1954  
  1955  extern(Windows) export BOOL GetCommModemStatus(
  1956    HANDLE hFile,
  1957    LPDWORD lpModemStat);
  1958  
  1959  extern(Windows) export BOOL GetCommState(
  1960    HANDLE hFile,
  1961    LPDCB lpDCB);
  1962  
  1963  extern(Windows) export BOOL GetCommTimeouts(
  1964    HANDLE hFile,
  1965    LPCOMMTIMEOUTS lpCommTimeouts);
  1966  
  1967  extern(Windows) export BOOL PurgeComm(
  1968    HANDLE hFile,
  1969    DWORD dwFlags);
  1970  
  1971  extern(Windows) export BOOL SetCommBreak(
  1972    HANDLE hFile);
  1973  
  1974  extern(Windows) export BOOL SetCommConfig(
  1975    HANDLE hCommDev,
  1976    LPCOMMCONFIG lpCC,
  1977    DWORD dwSize);
  1978  
  1979  extern(Windows) export BOOL SetCommMask(
  1980    HANDLE hFile,
  1981    DWORD dwEvtMask);
  1982  
  1983  extern(Windows) export BOOL SetCommState(
  1984    HANDLE hFile,
  1985    LPDCB lpDCB);
  1986  
  1987  extern(Windows) export BOOL SetCommTimeouts(
  1988    HANDLE hFile,
  1989    LPCOMMTIMEOUTS lpCommTimeouts);
  1990  
  1991  extern(Windows) export BOOL TransmitCommChar(
  1992    HANDLE hFile,
  1993    char cChar);
  1994  
  1995  extern(Windows) export BOOL WaitCommEvent(
  1996    HANDLE hFile,
  1997    LPDWORD lpEvtMask,
  1998    LPOVERLAPPED lpOverlapped);
  1999  
  2000  extern(Windows) export DWORD SetTapePosition(
  2001    HANDLE hDevice,
  2002    DWORD dwPositionMethod,
  2003    DWORD dwPartition,
  2004    DWORD dwOffsetLow,
  2005    DWORD dwOffsetHigh,
  2006    BOOL bImmediate);
  2007  
  2008  extern(Windows) export DWORD GetTapePosition(
  2009    HANDLE hDevice,
  2010    DWORD dwPositionType,
  2011    LPDWORD lpdwPartition,
  2012    LPDWORD lpdwOffsetLow,
  2013    LPDWORD lpdwOffsetHigh);
  2014  
  2015  extern(Windows) export DWORD PrepareTape(
  2016    HANDLE hDevice,
  2017    DWORD dwOperation,
  2018    BOOL bImmediate);
  2019  
  2020  extern(Windows) export DWORD EraseTape(
  2021    HANDLE hDevice,
  2022    DWORD dwEraseType,
  2023    BOOL bImmediate);
  2024  
  2025  extern(Windows) export DWORD CreateTapePartition(
  2026    HANDLE hDevice,
  2027    DWORD dwPartitionMethod,
  2028    DWORD dwCount,
  2029    DWORD dwSize);
  2030  
  2031  extern(Windows) export DWORD WriteTapemark(
  2032    HANDLE hDevice,
  2033    DWORD dwTapemarkType,
  2034    DWORD dwTapemarkCount,
  2035    BOOL bImmediate);
  2036  
  2037  extern(Windows) export DWORD GetTapeStatus(
  2038    HANDLE hDevice);
  2039  
  2040  extern(Windows) export DWORD GetTapeParameters(
  2041    HANDLE hDevice,
  2042    DWORD dwOperation,
  2043    LPDWORD lpdwSize,
  2044    LPVOID lpTapeInformation);
  2045  
  2046  enum : uint { GET_TAPE_MEDIA_INFORMATION = 0 }
  2047  enum : uint { GET_TAPE_DRIVE_INFORMATION = 1 }
  2048  
  2049  extern(Windows) export DWORD SetTapeParameters(
  2050    HANDLE hDevice,
  2051    DWORD dwOperation,
  2052    LPVOID lpTapeInformation);
  2053  
  2054  enum : uint { SET_TAPE_MEDIA_INFORMATION = 0 }
  2055  enum : uint { SET_TAPE_DRIVE_INFORMATION = 1 }
  2056  
  2057  extern(Windows) export BOOL Beep(
  2058    DWORD dwFreq,
  2059    DWORD dwDuration);
  2060  
  2061  extern(Windows) export int MulDiv(
  2062    int nNumber,
  2063    int nNumerator,
  2064    int nDenominator);
  2065  
  2066  extern(Windows) export VOID GetSystemTime(
  2067    LPSYSTEMTIME lpSystemTime);
  2068  
  2069  extern(Windows) export VOID GetSystemTimeAsFileTime(
  2070    LPFILETIME lpSystemTimeAsFileTime);
  2071  
  2072  extern(Windows) export BOOL SetSystemTime(
  2073    SYSTEMTIME *lpSystemTime);
  2074  
  2075  extern(Windows) export VOID GetLocalTime(
  2076    LPSYSTEMTIME lpSystemTime);
  2077  
  2078  extern(Windows) export BOOL SetLocalTime(
  2079    SYSTEMTIME *lpSystemTime);
  2080  
  2081  extern(Windows) export VOID GetSystemInfo(
  2082    LPSYSTEM_INFO lpSystemInfo);
  2083  
  2084  // #if _WIN32_WINNT >= 0x0501
  2085  extern(Windows) export VOID GetNativeSystemInfo(
  2086    LPSYSTEM_INFO lpSystemInfo);
  2087  // #endif
  2088  
  2089  extern(Windows) export BOOL IsProcessorFeaturePresent(
  2090    DWORD ProcessorFeature);
  2091  
  2092  struct _TIME_ZONE_INFORMATION {
  2093    LONG Bias;
  2094    WCHAR StandardName[ 32 ];
  2095    SYSTEMTIME StandardDate;
  2096    LONG StandardBias;
  2097    WCHAR DaylightName[ 32 ];
  2098    SYSTEMTIME DaylightDate;
  2099    LONG DaylightBias;
  2100  }
  2101  alias _TIME_ZONE_INFORMATION TIME_ZONE_INFORMATION;
  2102  alias _TIME_ZONE_INFORMATION* PTIME_ZONE_INFORMATION;
  2103  alias _TIME_ZONE_INFORMATION* LPTIME_ZONE_INFORMATION;
  2104  
  2105  extern(Windows) export BOOL SystemTimeToTzSpecificLocalTime(
  2106    LPTIME_ZONE_INFORMATION lpTimeZoneInformation,
  2107    LPSYSTEMTIME lpUniversalTime,
  2108    LPSYSTEMTIME lpLocalTime);
  2109  
  2110  extern(Windows) export BOOL TzSpecificLocalTimeToSystemTime(
  2111    LPTIME_ZONE_INFORMATION lpTimeZoneInformation,
  2112    LPSYSTEMTIME lpLocalTime,
  2113    LPSYSTEMTIME lpUniversalTime);
  2114  
  2115  extern(Windows) export DWORD GetTimeZoneInformation(
  2116    LPTIME_ZONE_INFORMATION lpTimeZoneInformation);
  2117  
  2118  extern(Windows) export BOOL SetTimeZoneInformation(
  2119    TIME_ZONE_INFORMATION *lpTimeZoneInformation);
  2120  
  2121  extern(Windows) export BOOL SystemTimeToFileTime(
  2122    SYSTEMTIME *lpSystemTime,
  2123    LPFILETIME lpFileTime);
  2124  
  2125  extern(Windows) export BOOL FileTimeToLocalFileTime(
  2126    FILETIME *lpFileTime,
  2127    LPFILETIME lpLocalFileTime);
  2128  
  2129  extern(Windows) export BOOL LocalFileTimeToFileTime(
  2130    FILETIME *lpLocalFileTime,
  2131    LPFILETIME lpFileTime);
  2132  
  2133  extern(Windows) export BOOL FileTimeToSystemTime(
  2134    FILETIME *lpFileTime,
  2135    LPSYSTEMTIME lpSystemTime);
  2136  
  2137  extern(Windows) export LONG CompareFileTime(
  2138    FILETIME *lpFileTime1,
  2139    FILETIME *lpFileTime2);
  2140  
  2141  extern(Windows) export BOOL FileTimeToDosDateTime(
  2142    FILETIME *lpFileTime,
  2143    LPWORD lpFatDate,
  2144    LPWORD lpFatTime);
  2145  
  2146  extern(Windows) export BOOL DosDateTimeToFileTime(
  2147    WORD wFatDate,
  2148    WORD wFatTime,
  2149    LPFILETIME lpFileTime);
  2150  
  2151  extern(Windows) export DWORD GetTickCount();
  2152  
  2153  extern(Windows) export BOOL SetSystemTimeAdjustment(
  2154    DWORD dwTimeAdjustment,
  2155    BOOL bTimeAdjustmentDisabled);
  2156  
  2157  extern(Windows) export BOOL GetSystemTimeAdjustment(
  2158    PDWORD lpTimeAdjustment,
  2159    PDWORD lpTimeIncrement,
  2160    PBOOL lpTimeAdjustmentDisabled);
  2161  
  2162  // #if !defined(MIDL_PASS)
  2163  extern(Windows) export DWORD FormatMessageA(
  2164    DWORD dwFlags,
  2165    LPCVOID lpSource,
  2166    DWORD dwMessageId,
  2167    DWORD dwLanguageId,
  2168    LPSTR lpBuffer,
  2169    DWORD nSize,
  2170    va_list *Arguments);
  2171  extern(Windows) export DWORD FormatMessageW(
  2172    DWORD dwFlags,
  2173    LPCVOID lpSource,
  2174    DWORD dwMessageId,
  2175    DWORD dwLanguageId,
  2176    LPWSTR lpBuffer,
  2177    DWORD nSize,
  2178    va_list *Arguments);
  2179  // #ifdef UNICODE
  2180  alias FormatMessageW FormatMessage;
  2181  // #else
  2182  // #...
  2183  // #endif // !UNICODE
  2184  // #endif
  2185  
  2186  enum : uint { FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100 }
  2187  enum : uint { FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200 }
  2188  enum : uint { FORMAT_MESSAGE_FROM_STRING = 0x00000400 }
  2189  enum : uint { FORMAT_MESSAGE_FROM_HMODULE = 0x00000800 }
  2190  enum : uint { FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000 }
  2191  enum : uint { FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000 }
  2192  enum : uint { FORMAT_MESSAGE_MAX_WIDTH_MASK = 0x000000FF }
  2193  
  2194  extern(Windows) export BOOL CreatePipe(
  2195    PHANDLE hReadPipe,
  2196    PHANDLE hWritePipe,
  2197    LPSECURITY_ATTRIBUTES lpPipeAttributes,
  2198    DWORD nSize);
  2199  
  2200  extern(Windows) export BOOL ConnectNamedPipe(
  2201    HANDLE hNamedPipe,
  2202    LPOVERLAPPED lpOverlapped);
  2203  
  2204  extern(Windows) export BOOL DisconnectNamedPipe(
  2205    HANDLE hNamedPipe);
  2206  
  2207  extern(Windows) export BOOL SetNamedPipeHandleState(
  2208    HANDLE hNamedPipe,
  2209    LPDWORD lpMode,
  2210    LPDWORD lpMaxCollectionCount,
  2211    LPDWORD lpCollectDataTimeout);
  2212  
  2213  extern(Windows) export BOOL GetNamedPipeInfo(
  2214    HANDLE hNamedPipe,
  2215    LPDWORD lpFlags,
  2216    LPDWORD lpOutBufferSize,
  2217    LPDWORD lpInBufferSize,
  2218    LPDWORD lpMaxInstances);
  2219  
  2220  extern(Windows) export BOOL PeekNamedPipe(
  2221    HANDLE hNamedPipe,
  2222    LPVOID lpBuffer,
  2223    DWORD nBufferSize,
  2224    LPDWORD lpBytesRead,
  2225    LPDWORD lpTotalBytesAvail,
  2226    LPDWORD lpBytesLeftThisMessage);
  2227  
  2228  extern(Windows) export BOOL TransactNamedPipe(
  2229    HANDLE hNamedPipe,
  2230    LPVOID lpInBuffer,
  2231    DWORD nInBufferSize,
  2232    LPVOID lpOutBuffer,
  2233    DWORD nOutBufferSize,
  2234    LPDWORD lpBytesRead,
  2235    LPOVERLAPPED lpOverlapped);
  2236  
  2237  extern(Windows) export HANDLE CreateMailslotA(
  2238    LPCSTR lpName,
  2239    DWORD nMaxMessageSize,
  2240    DWORD lReadTimeout,
  2241    LPSECURITY_ATTRIBUTES lpSecurityAttributes);
  2242  extern(Windows) export HANDLE CreateMailslotW(
  2243    LPCWSTR lpName,
  2244    DWORD nMaxMessageSize,
  2245    DWORD lReadTimeout,
  2246    LPSECURITY_ATTRIBUTES lpSecurityAttributes);
  2247  // #ifdef UNICODE
  2248  alias CreateMailslotW CreateMailslot;
  2249  // #else
  2250  // #...
  2251  // #endif // !UNICODE
  2252  
  2253  extern(Windows) export BOOL GetMailslotInfo(
  2254    HANDLE hMailslot,
  2255    LPDWORD lpMaxMessageSize,
  2256    LPDWORD lpNextSize,
  2257    LPDWORD lpMessageCount,
  2258    LPDWORD lpReadTimeout);
  2259  
  2260  extern(Windows) export BOOL SetMailslotInfo(
  2261    HANDLE hMailslot,
  2262    DWORD lReadTimeout);
  2263  
  2264  extern(Windows) export LPVOID MapViewOfFile(
  2265    HANDLE hFileMappingObject,
  2266    DWORD dwDesiredAccess,
  2267    DWORD dwFileOffsetHigh,
  2268    DWORD dwFileOffsetLow,
  2269    SIZE_T dwNumberOfBytesToMap);
  2270  
  2271  extern(Windows) export BOOL FlushViewOfFile(
  2272    LPCVOID lpBaseAddress,
  2273    SIZE_T dwNumberOfBytesToFlush);
  2274  
  2275  extern(Windows) export BOOL UnmapViewOfFile(
  2276    LPCVOID lpBaseAddress);
  2277  
  2278  extern(Windows) export BOOL EncryptFileA(
  2279    LPCSTR lpFileName);
  2280  extern(Windows) export BOOL EncryptFileW(
  2281    LPCWSTR lpFileName);
  2282  // #ifdef UNICODE
  2283  alias EncryptFileW EncryptFile;
  2284  // #else
  2285  // #...
  2286  // #endif // !UNICODE
  2287  
  2288  extern(Windows) export BOOL DecryptFileA(
  2289    LPCSTR lpFileName,
  2290    DWORD dwReserved);
  2291  extern(Windows) export BOOL DecryptFileW(
  2292    LPCWSTR lpFileName,
  2293    DWORD dwReserved);
  2294  // #ifdef UNICODE
  2295  alias DecryptFileW DecryptFile;
  2296  // #else
  2297  // #...
  2298  // #endif // !UNICODE
  2299  
  2300  enum : uint { FILE_ENCRYPTABLE = 0 }
  2301  enum : uint { FILE_IS_ENCRYPTED = 1 }
  2302  enum : uint { FILE_SYSTEM_ATTR = 2 }
  2303  enum : uint { FILE_ROOT_DIR = 3 }
  2304  enum : uint { FILE_SYSTEM_DIR = 4 }
  2305  enum : uint { FILE_UNKNOWN = 5 }
  2306  enum : uint { FILE_SYSTEM_NOT_SUPPORT = 6 }
  2307  enum : uint { FILE_USER_DISALLOWED = 7 }
  2308  enum : uint { FILE_READ_ONLY = 8 }
  2309  enum : uint { FILE_DIR_DISALLOWED = 9 }
  2310  
  2311  extern(Windows) export BOOL FileEncryptionStatusA(
  2312    LPCSTR lpFileName,
  2313    LPDWORD lpStatus);
  2314  extern(Windows) export BOOL FileEncryptionStatusW(
  2315    LPCWSTR lpFileName,
  2316    LPDWORD lpStatus);
  2317  // #ifdef UNICODE
  2318  alias FileEncryptionStatusW FileEncryptionStatus;
  2319  // #else
  2320  // #...
  2321  // #endif // !UNICODE
  2322  
  2323  enum : uint { EFS_USE_RECOVERY_KEYS = 0x1 }
  2324  
  2325  extern(Windows) alias DWORD function( PBYTE pbData, PVOID pvCallbackContext, ULONG ulLength ) PFE_EXPORT_FUNC;
  2326  
  2327  extern(Windows) alias DWORD function( PBYTE pbData, PVOID pvCallbackContext, PULONG ulLength ) PFE_IMPORT_FUNC;
  2328  
  2329  enum : uint { CREATE_FOR_IMPORT = 1 }
  2330  enum : uint { CREATE_FOR_DIR = 2 }
  2331  enum : uint { OVERWRITE_HIDDEN = 4 }
  2332  
  2333  extern(Windows) export DWORD OpenEncryptedFileRawA(
  2334    LPCSTR lpFileName,
  2335    ULONG ulFlags,
  2336    PVOID * pvContext);
  2337  extern(Windows) export DWORD OpenEncryptedFileRawW(
  2338    LPCWSTR lpFileName,
  2339    ULONG ulFlags,
  2340    PVOID * pvContext);
  2341  // #ifdef UNICODE
  2342  alias OpenEncryptedFileRawW OpenEncryptedFileRaw;
  2343  // #else
  2344  // #...
  2345  // #endif // !UNICODE
  2346  
  2347  extern(Windows) export DWORD ReadEncryptedFileRaw(
  2348    PFE_EXPORT_FUNC pfExportCallback,
  2349    PVOID pvCallbackContext,
  2350    PVOID pvContext);
  2351  
  2352  extern(Windows) export DWORD WriteEncryptedFileRaw(
  2353    PFE_IMPORT_FUNC pfImportCallback,
  2354    PVOID pvCallbackContext,
  2355    PVOID pvContext);
  2356  
  2357  extern(Windows) export VOID CloseEncryptedFileRaw(
  2358    PVOID pvContext);
  2359  
  2360  extern(Windows) export int lstrcmpA(
  2361    LPCSTR lpString1,
  2362    LPCSTR lpString2);
  2363  extern(Windows) export int lstrcmpW(
  2364    LPCWSTR lpString1,
  2365    LPCWSTR lpString2);
  2366  // #ifdef UNICODE
  2367  alias lstrcmpW lstrcmp;
  2368  // #else
  2369  // #...
  2370  // #endif // !UNICODE
  2371  
  2372  extern(Windows) export int lstrcmpiA(
  2373    LPCSTR lpString1,
  2374    LPCSTR lpString2);
  2375  extern(Windows) export int lstrcmpiW(
  2376    LPCWSTR lpString1,
  2377    LPCWSTR lpString2);
  2378  // #ifdef UNICODE
  2379  alias lstrcmpiW lstrcmpi;
  2380  // #else
  2381  // #...
  2382  // #endif // !UNICODE
  2383  
  2384  extern(Windows) export LPSTR lstrcpynA(
  2385    LPSTR lpString1,
  2386    LPCSTR lpString2,
  2387    int iMaxLength);
  2388  extern(Windows) export LPWSTR lstrcpynW(
  2389    LPWSTR lpString1,
  2390    LPCWSTR lpString2,
  2391    int iMaxLength);
  2392  // #ifdef UNICODE
  2393  alias lstrcpynW lstrcpyn;
  2394  // #else
  2395  // #...
  2396  // #endif // !UNICODE
  2397  
  2398  extern(Windows) export LPSTR lstrcpyA(
  2399    LPSTR lpString1,
  2400    LPCSTR lpString2);
  2401  extern(Windows) export LPWSTR lstrcpyW(
  2402    LPWSTR lpString1,
  2403    LPCWSTR lpString2);
  2404  // #ifdef UNICODE
  2405  alias lstrcpyW lstrcpy;
  2406  // #else
  2407  // #...
  2408  // #endif // !UNICODE
  2409  
  2410  extern(Windows) export LPSTR lstrcatA(
  2411    LPSTR lpString1,
  2412    LPCSTR lpString2);
  2413  extern(Windows) export LPWSTR lstrcatW(
  2414    LPWSTR lpString1,
  2415    LPCWSTR lpString2);
  2416  // #ifdef UNICODE
  2417  alias lstrcatW lstrcat;
  2418  // #else
  2419  // #...
  2420  // #endif // !UNICODE
  2421  
  2422  extern(Windows) export int lstrlenA(
  2423    LPCSTR lpString);
  2424  extern(Windows) export int lstrlenW(
  2425    LPCWSTR lpString);
  2426  // #ifdef UNICODE
  2427  alias lstrlenW lstrlen;
  2428  // #else
  2429  // #...
  2430  // #endif // !UNICODE
  2431  
  2432  extern(Windows) export HFILE OpenFile(
  2433    LPCSTR lpFileName,
  2434    LPOFSTRUCT lpReOpenBuff,
  2435    UINT uStyle);
  2436  
  2437  extern(Windows) export HFILE _lopen(
  2438    LPCSTR lpPathName,
  2439    int iReadWrite);
  2440  
  2441  extern(Windows) export HFILE _lcreat(
  2442    LPCSTR lpPathName,
  2443    int iAttribute);
  2444  
  2445  extern(Windows) export UINT _lread(
  2446    HFILE hFile,
  2447    LPVOID lpBuffer,
  2448    UINT uBytes);
  2449  
  2450  extern(Windows) export UINT _lwrite(
  2451    HFILE hFile,
  2452    LPCSTR lpBuffer,
  2453    UINT uBytes);
  2454  
  2455  extern(Windows) export int _hread(
  2456    HFILE hFile,
  2457    LPVOID lpBuffer,
  2458    int lBytes);
  2459  
  2460  extern(Windows) export int _hwrite(
  2461    HFILE hFile,
  2462    LPCSTR lpBuffer,
  2463    int lBytes);
  2464  
  2465  extern(Windows) export HFILE _lclose(
  2466    HFILE hFile);
  2467  
  2468  extern(Windows) export LONG _llseek(
  2469    HFILE hFile,
  2470    LONG lOffset,
  2471    int iOrigin);
  2472  
  2473  extern(Windows) export BOOL IsTextUnicode(
  2474    VOID* lpBuffer,
  2475    int cb,
  2476    LPINT lpi);
  2477  
  2478  extern(Windows) export DWORD TlsAlloc();
  2479  
  2480  enum : uint { TLS_OUT_OF_INDEXES = cast(DWORD)0xFFFFFFFF }
  2481  
  2482  extern(Windows) export LPVOID TlsGetValue(
  2483    DWORD dwTlsIndex);
  2484  
  2485  extern(Windows) export BOOL TlsSetValue(
  2486    DWORD dwTlsIndex,
  2487    LPVOID lpTlsValue);
  2488  
  2489  extern(Windows) export BOOL TlsFree(
  2490    DWORD dwTlsIndex);
  2491  
  2492  extern(Windows) alias VOID function( DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped ) LPOVERLAPPED_COMPLETION_ROUTINE;
  2493  
  2494  extern(Windows) export DWORD SleepEx(
  2495    DWORD dwMilliseconds,
  2496    BOOL bAlertable);
  2497  
  2498  extern(Windows) export DWORD WaitForSingleObjectEx(
  2499    HANDLE hHandle,
  2500    DWORD dwMilliseconds,
  2501    BOOL bAlertable);
  2502  
  2503  extern(Windows) export DWORD WaitForMultipleObjectsEx(
  2504    DWORD nCount,
  2505    HANDLE *lpHandles,
  2506    BOOL bWaitAll,
  2507    DWORD dwMilliseconds,
  2508    BOOL bAlertable);
  2509  
  2510  // #if(_WIN32_WINNT >= 0x0400)
  2511  extern(Windows) export DWORD SignalObjectAndWait(
  2512    HANDLE hObjectToSignal,
  2513    HANDLE hObjectToWaitOn,
  2514    DWORD dwMilliseconds,
  2515    BOOL bAlertable);
  2516  // #endif /* _WIN32_WINNT >= 0x0400 */
  2517  
  2518  extern(Windows) export BOOL ReadFileEx(
  2519    HANDLE hFile,
  2520    LPVOID lpBuffer,
  2521    DWORD nNumberOfBytesToRead,
  2522    LPOVERLAPPED lpOverlapped,
  2523    LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
  2524  
  2525  extern(Windows) export BOOL WriteFileEx(
  2526    HANDLE hFile,
  2527    LPCVOID lpBuffer,
  2528    DWORD nNumberOfBytesToWrite,
  2529    LPOVERLAPPED lpOverlapped,
  2530    LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
  2531  
  2532  extern(Windows) export BOOL BackupRead(
  2533    HANDLE hFile,
  2534    LPBYTE lpBuffer,
  2535    DWORD nNumberOfBytesToRead,
  2536    LPDWORD lpNumberOfBytesRead,
  2537    BOOL bAbort,
  2538    BOOL bProcessSecurity,
  2539    LPVOID *lpContext);
  2540  
  2541  extern(Windows) export BOOL BackupSeek(
  2542    HANDLE hFile,
  2543    DWORD dwLowBytesToSeek,
  2544    DWORD dwHighBytesToSeek,
  2545    LPDWORD lpdwLowByteSeeked,
  2546    LPDWORD lpdwHighByteSeeked,
  2547    LPVOID *lpContext);
  2548  
  2549  extern(Windows) export BOOL BackupWrite(
  2550    HANDLE hFile,
  2551    LPBYTE lpBuffer,
  2552    DWORD nNumberOfBytesToWrite,
  2553    LPDWORD lpNumberOfBytesWritten,
  2554    BOOL bAbort,
  2555    BOOL bProcessSecurity,
  2556    LPVOID *lpContext);
  2557  
  2558  struct _WIN32_STREAM_ID {
  2559    DWORD dwStreamId ;
  2560    DWORD dwStreamAttributes ;
  2561    LARGE_INTEGER Size ;
  2562    DWORD dwStreamNameSize ;
  2563    WCHAR cStreamName[ ANYSIZE_ARRAY ] ;
  2564  }
  2565  alias _WIN32_STREAM_ID WIN32_STREAM_ID;
  2566  alias _WIN32_STREAM_ID* LPWIN32_STREAM_ID;
  2567  
  2568  enum : uint { BACKUP_INVALID = 0x00000000 }
  2569  enum : uint { BACKUP_DATA = 0x00000001 }
  2570  enum : uint { BACKUP_EA_DATA = 0x00000002 }
  2571  enum : uint { BACKUP_SECURITY_DATA = 0x00000003 }
  2572  enum : uint { BACKUP_ALTERNATE_DATA = 0x00000004 }
  2573  enum : uint { BACKUP_LINK = 0x00000005 }
  2574  enum : uint { BACKUP_PROPERTY_DATA = 0x00000006 }
  2575  enum : uint { BACKUP_OBJECT_ID = 0x00000007 }
  2576  enum : uint { BACKUP_REPARSE_DATA = 0x00000008 }
  2577  enum : uint { BACKUP_SPARSE_BLOCK = 0x00000009 }
  2578  
  2579  enum : uint { STREAM_NORMAL_ATTRIBUTE = 0x00000000 }
  2580  enum : uint { STREAM_MODIFIED_WHEN_READ = 0x00000001 }
  2581  enum : uint { STREAM_CONTAINS_SECURITY = 0x00000002 }
  2582  enum : uint { STREAM_CONTAINS_PROPERTIES = 0x00000004 }
  2583  enum : uint { STREAM_SPARSE_ATTRIBUTE = 0x00000008 }
  2584  
  2585  extern(Windows) export BOOL ReadFileScatter(
  2586    HANDLE hFile,
  2587    FILE_SEGMENT_ELEMENT aSegmentArray[],
  2588    DWORD nNumberOfBytesToRead,
  2589    LPDWORD lpReserved,
  2590    LPOVERLAPPED lpOverlapped);
  2591  
  2592  extern(Windows) export BOOL WriteFileGather(
  2593    HANDLE hFile,
  2594    FILE_SEGMENT_ELEMENT aSegmentArray[],
  2595    DWORD nNumberOfBytesToWrite,
  2596    LPDWORD lpReserved,
  2597    LPOVERLAPPED lpOverlapped);
  2598  
  2599  enum : uint { STARTF_USESHOWWINDOW = 0x00000001 }
  2600  enum : uint { STARTF_USESIZE = 0x00000002 }
  2601  enum : uint { STARTF_USEPOSITION = 0x00000004 }
  2602  enum : uint { STARTF_USECOUNTCHARS = 0x00000008 }
  2603  enum : uint { STARTF_USEFILLATTRIBUTE = 0x00000010 }
  2604  enum : uint { STARTF_RUNFULLSCREEN = 0x00000020 }
  2605  enum : uint { STARTF_FORCEONFEEDBACK = 0x00000040 }
  2606  enum : uint { STARTF_FORCEOFFFEEDBACK = 0x00000080 }
  2607  enum : uint { STARTF_USESTDHANDLES = 0x00000100 }
  2608  
  2609  // #if(WINVER >= 0x0400)
  2610  
  2611  enum : uint { STARTF_USEHOTKEY = 0x00000200 }
  2612  // #endif /* WINVER >= 0x0400 */
  2613  
  2614  struct _STARTUPINFOA {
  2615    DWORD cb;
  2616    LPSTR lpReserved;
  2617    LPSTR lpDesktop;
  2618    LPSTR lpTitle;
  2619    DWORD dwX;
  2620    DWORD dwY;
  2621    DWORD dwXSize;
  2622    DWORD dwYSize;
  2623    DWORD dwXCountChars;
  2624    DWORD dwYCountChars;
  2625    DWORD dwFillAttribute;
  2626    DWORD dwFlags;
  2627    WORD wShowWindow;
  2628    WORD cbReserved2;
  2629    LPBYTE lpReserved2;
  2630    HANDLE hStdInput;
  2631    HANDLE hStdOutput;
  2632    HANDLE hStdError;
  2633  }
  2634  alias _STARTUPINFOA STARTUPINFOA;
  2635  alias _STARTUPINFOA* LPSTARTUPINFOA;
  2636  
  2637  struct _STARTUPINFOW {
  2638    DWORD cb;
  2639    LPWSTR lpReserved;
  2640    LPWSTR lpDesktop;
  2641    LPWSTR lpTitle;
  2642    DWORD dwX;
  2643    DWORD dwY;
  2644    DWORD dwXSize;
  2645    DWORD dwYSize;
  2646    DWORD dwXCountChars;
  2647    DWORD dwYCountChars;
  2648    DWORD dwFillAttribute;
  2649    DWORD dwFlags;
  2650    WORD wShowWindow;
  2651    WORD cbReserved2;
  2652    LPBYTE lpReserved2;
  2653    HANDLE hStdInput;
  2654    HANDLE hStdOutput;
  2655    HANDLE hStdError;
  2656  }
  2657  alias _STARTUPINFOW STARTUPINFOW;
  2658  alias _STARTUPINFOW* LPSTARTUPINFOW;
  2659  
  2660  // #ifdef UNICODE
  2661  alias STARTUPINFOW STARTUPINFO;
  2662  alias LPSTARTUPINFOW LPSTARTUPINFO;
  2663  // #else
  2664  // ...
  2665  // #endif // UNICODE
  2666  
  2667  enum : uint { SHUTDOWN_NORETRY = 0x00000001 }
  2668  
  2669  struct _WIN32_FIND_DATAA {
  2670    DWORD dwFileAttributes;
  2671    FILETIME ftCreationTime;
  2672    FILETIME ftLastAccessTime;
  2673    FILETIME ftLastWriteTime;
  2674    DWORD nFileSizeHigh;
  2675    DWORD nFileSizeLow;
  2676    DWORD dwReserved0;
  2677    DWORD dwReserved1;
  2678    CHAR cFileName[ MAX_PATH ];
  2679    CHAR cAlternateFileName[ 14 ];
  2680  // #ifdef _MAC
  2681  // ...
  2682  // #endif
  2683  }
  2684  alias _WIN32_FIND_DATAA WIN32_FIND_DATAA;
  2685  alias _WIN32_FIND_DATAA* PWIN32_FIND_DATAA;
  2686  alias _WIN32_FIND_DATAA* LPWIN32_FIND_DATAA;
  2687  
  2688  struct _WIN32_FIND_DATAW {
  2689    DWORD dwFileAttributes;
  2690    FILETIME ftCreationTime;
  2691    FILETIME ftLastAccessTime;
  2692    FILETIME ftLastWriteTime;
  2693    DWORD nFileSizeHigh;
  2694    DWORD nFileSizeLow;
  2695    DWORD dwReserved0;
  2696    DWORD dwReserved1;
  2697    WCHAR cFileName[ MAX_PATH ];
  2698    WCHAR cAlternateFileName[ 14 ];
  2699  // #ifdef _MAC
  2700  // ...
  2701  // #endif
  2702  }
  2703  alias _WIN32_FIND_DATAW WIN32_FIND_DATAW;
  2704  alias _WIN32_FIND_DATAW* PWIN32_FIND_DATAW;
  2705  alias _WIN32_FIND_DATAW* LPWIN32_FIND_DATAW;
  2706  
  2707  // #ifdef UNICODE
  2708  alias WIN32_FIND_DATAW WIN32_FIND_DATA;
  2709  alias PWIN32_FIND_DATAW PWIN32_FIND_DATA;
  2710  alias LPWIN32_FIND_DATAW LPWIN32_FIND_DATA;
  2711  // #else
  2712  // ...
  2713  // #endif // UNICODE
  2714  
  2715  struct _WIN32_FILE_ATTRIBUTE_DATA {
  2716    DWORD dwFileAttributes;
  2717    FILETIME ftCreationTime;
  2718    FILETIME ftLastAccessTime;
  2719    FILETIME ftLastWriteTime;
  2720    DWORD nFileSizeHigh;
  2721    DWORD nFileSizeLow;
  2722  }
  2723  alias _WIN32_FILE_ATTRIBUTE_DATA WIN32_FILE_ATTRIBUTE_DATA;
  2724  alias _WIN32_FILE_ATTRIBUTE_DATA* LPWIN32_FILE_ATTRIBUTE_DATA;
  2725  
  2726  extern(Windows) export HANDLE CreateMutexA(
  2727    LPSECURITY_ATTRIBUTES lpMutexAttributes,
  2728    BOOL bInitialOwner,
  2729    LPCSTR lpName);
  2730  extern(Windows) export HANDLE CreateMutexW(
  2731    LPSECURITY_ATTRIBUTES lpMutexAttributes,
  2732    BOOL bInitialOwner,
  2733    LPCWSTR lpName);
  2734  // #ifdef UNICODE
  2735  alias CreateMutexW CreateMutex;
  2736  // #else
  2737  // #...
  2738  // #endif // !UNICODE
  2739  
  2740  extern(Windows) export HANDLE OpenMutexA(
  2741    DWORD dwDesiredAccess,
  2742    BOOL bInheritHandle,
  2743    LPCSTR lpName);
  2744  extern(Windows) export HANDLE OpenMutexW(
  2745    DWORD dwDesiredAccess,
  2746    BOOL bInheritHandle,
  2747    LPCWSTR lpName);
  2748  // #ifdef UNICODE
  2749  alias OpenMutexW OpenMutex;
  2750  // #else
  2751  // #...
  2752  // #endif // !UNICODE
  2753  
  2754  extern(Windows) export HANDLE CreateEventA(
  2755    LPSECURITY_ATTRIBUTES lpEventAttributes,
  2756    BOOL bManualReset,
  2757    BOOL bInitialState,
  2758    LPCSTR lpName);
  2759  extern(Windows) export HANDLE CreateEventW(
  2760    LPSECURITY_ATTRIBUTES lpEventAttributes,
  2761    BOOL bManualReset,
  2762    BOOL bInitialState,
  2763    LPCWSTR lpName);
  2764  // #ifdef UNICODE
  2765  alias CreateEventW CreateEvent;
  2766  // #else
  2767  // #...
  2768  // #endif // !UNICODE
  2769  
  2770  extern(Windows) export HANDLE OpenEventA(
  2771    DWORD dwDesiredAccess,
  2772    BOOL bInheritHandle,
  2773    LPCSTR lpName);
  2774  extern(Windows) export HANDLE OpenEventW(
  2775    DWORD dwDesiredAccess,
  2776    BOOL bInheritHandle,
  2777    LPCWSTR lpName);
  2778  // #ifdef UNICODE
  2779  alias OpenEventW OpenEvent;
  2780  // #else
  2781  // #...
  2782  // #endif // !UNICODE
  2783  
  2784  extern(Windows) export HANDLE CreateSemaphoreA(
  2785    LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,
  2786    LONG lInitialCount,
  2787    LONG lMaximumCount,
  2788    LPCSTR lpName);
  2789  extern(Windows) export HANDLE CreateSemaphoreW(
  2790    LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,
  2791    LONG lInitialCount,
  2792    LONG lMaximumCount,
  2793    LPCWSTR lpName);
  2794  // #ifdef UNICODE
  2795  alias CreateSemaphoreW CreateSemaphore;
  2796  // #else
  2797  // #...
  2798  // #endif // !UNICODE
  2799  
  2800  extern(Windows) export HANDLE OpenSemaphoreA(
  2801    DWORD dwDesiredAccess,
  2802    BOOL bInheritHandle,
  2803    LPCSTR lpName);
  2804  extern(Windows) export HANDLE OpenSemaphoreW(
  2805    DWORD dwDesiredAccess,
  2806    BOOL bInheritHandle,
  2807    LPCWSTR lpName);
  2808  // #ifdef UNICODE
  2809  alias OpenSemaphoreW OpenSemaphore;
  2810  // #else
  2811  // #...
  2812  // #endif // !UNICODE
  2813  
  2814  // #if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
  2815  extern(Windows) alias VOID function( LPVOID lpArgToCompletionRoutine, DWORD dwTimerLowValue, DWORD dwTimerHighValue ) PTIMERAPCROUTINE;
  2816  
  2817  extern(Windows) export HANDLE CreateWaitableTimerA(
  2818    LPSECURITY_ATTRIBUTES lpTimerAttributes,
  2819    BOOL bManualReset,
  2820    LPCSTR lpTimerName);
  2821  extern(Windows) export HANDLE CreateWaitableTimerW(
  2822    LPSECURITY_ATTRIBUTES lpTimerAttributes,
  2823    BOOL bManualReset,
  2824    LPCWSTR lpTimerName);
  2825  // #ifdef UNICODE
  2826  alias CreateWaitableTimerW CreateWaitableTimer;
  2827  // #else
  2828  // #...
  2829  // #endif // !UNICODE
  2830  
  2831  extern(Windows) export HANDLE OpenWaitableTimerA(
  2832    DWORD dwDesiredAccess,
  2833    BOOL bInheritHandle,
  2834    LPCSTR lpTimerName);
  2835  extern(Windows) export HANDLE OpenWaitableTimerW(
  2836    DWORD dwDesiredAccess,
  2837    BOOL bInheritHandle,
  2838    LPCWSTR lpTimerName);
  2839  // #ifdef UNICODE
  2840  alias OpenWaitableTimerW OpenWaitableTimer;
  2841  // #else
  2842  // #...
  2843  // #endif // !UNICODE
  2844  
  2845  extern(Windows) export BOOL SetWaitableTimer(
  2846    HANDLE hTimer,
  2847    LARGE_INTEGER *lpDueTime,
  2848    LONG lPeriod,
  2849    PTIMERAPCROUTINE pfnCompletionRoutine,
  2850    LPVOID lpArgToCompletionRoutine,
  2851    BOOL fResume);
  2852  
  2853  extern(Windows) export BOOL CancelWaitableTimer(
  2854    HANDLE hTimer);
  2855  // #endif /* (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) */
  2856  
  2857  extern(Windows) export HANDLE CreateFileMappingA(
  2858    HANDLE hFile,
  2859    LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
  2860    DWORD flProtect,
  2861    DWORD dwMaximumSizeHigh,
  2862    DWORD dwMaximumSizeLow,
  2863    LPCSTR lpName);
  2864  extern(Windows) export HANDLE CreateFileMappingW(
  2865    HANDLE hFile,
  2866    LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
  2867    DWORD flProtect,
  2868    DWORD dwMaximumSizeHigh,
  2869    DWORD dwMaximumSizeLow,
  2870    LPCWSTR lpName);
  2871  // #ifdef UNICODE
  2872  alias CreateFileMappingW CreateFileMapping;
  2873  // #else
  2874  // #...
  2875  // #endif // !UNICODE
  2876  
  2877  extern(Windows) export HANDLE OpenFileMappingA(
  2878    DWORD dwDesiredAccess,
  2879    BOOL bInheritHandle,
  2880    LPCSTR lpName);
  2881  extern(Windows) export HANDLE OpenFileMappingW(
  2882    DWORD dwDesiredAccess,
  2883    BOOL bInheritHandle,
  2884    LPCWSTR lpName);
  2885  // #ifdef UNICODE
  2886  alias OpenFileMappingW OpenFileMapping;
  2887  // #else
  2888  // #...
  2889  // #endif // !UNICODE
  2890  
  2891  extern(Windows) export DWORD GetLogicalDriveStringsA(
  2892    DWORD nBufferLength,
  2893    LPSTR lpBuffer);
  2894  extern(Windows) export DWORD GetLogicalDriveStringsW(
  2895    DWORD nBufferLength,
  2896    LPWSTR lpBuffer);
  2897  // #ifdef UNICODE
  2898  alias GetLogicalDriveStringsW GetLogicalDriveStrings;
  2899  // #else
  2900  // #...
  2901  // #endif // !UNICODE
  2902  
  2903  // #if _WIN32_WINNT >= 0x0501
  2904  
  2905  alias int _MEMORY_RESOURCE_NOTIFICATION_TYPE;
  2906  enum {
  2907    LowMemoryResourceNotification,
  2908    HighMemoryResourceNotification,
  2909  }
  2910  alias _MEMORY_RESOURCE_NOTIFICATION_TYPE MEMORY_RESOURCE_NOTIFICATION_TYPE;
  2911  
  2912  extern(Windows) export HANDLE CreateMemoryResourceNotification(
  2913    MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType);
  2914  
  2915  extern(Windows) export BOOL QueryMemoryResourceNotification(
  2916    HANDLE ResourceNotificationHandle,
  2917    PBOOL ResourceState);
  2918  
  2919  // #endif // _WIN32_WINNT >= 0x0501
  2920  
  2921  extern(Windows) export HMODULE LoadLibraryA(
  2922    LPCSTR lpLibFileName);
  2923  extern(Windows) export HMODULE LoadLibraryW(
  2924    LPCWSTR lpLibFileName);
  2925  // #ifdef UNICODE
  2926  alias LoadLibraryW LoadLibrary;
  2927  // #else
  2928  // #...
  2929  // #endif // !UNICODE
  2930  
  2931  extern(Windows) export HMODULE LoadLibraryExA(
  2932    LPCSTR lpLibFileName,
  2933    HANDLE hFile,
  2934    DWORD dwFlags);
  2935  extern(Windows) export HMODULE LoadLibraryExW(
  2936    LPCWSTR lpLibFileName,
  2937    HANDLE hFile,
  2938    DWORD dwFlags);
  2939  // #ifdef UNICODE
  2940  alias LoadLibraryExW LoadLibraryEx;
  2941  // #else
  2942  // #...
  2943  // #endif // !UNICODE
  2944  
  2945  enum : uint { DONT_RESOLVE_DLL_REFERENCES = 0x00000001 }
  2946  enum : uint { LOAD_LIBRARY_AS_DATAFILE = 0x00000002 }
  2947  enum : uint { LOAD_WITH_ALTERED_SEARCH_PATH = 0x00000008 }
  2948  enum : uint { LOAD_IGNORE_CODE_AUTHZ_LEVEL = 0x00000010 }
  2949  
  2950  extern(Windows) export DWORD GetModuleFileNameA(
  2951    HMODULE hModule,
  2952    LPSTR lpFilename,
  2953    DWORD nSize);
  2954  extern(Windows) export DWORD GetModuleFileNameW(
  2955    HMODULE hModule,
  2956    LPWSTR lpFilename,
  2957    DWORD nSize);
  2958  // #ifdef UNICODE
  2959  alias GetModuleFileNameW GetModuleFileName;
  2960  // #else
  2961  // #...
  2962  // #endif // !UNICODE
  2963  
  2964  extern(Windows) export HMODULE GetModuleHandleA(
  2965    LPCSTR lpModuleName);
  2966  extern(Windows) export HMODULE GetModuleHandleW(
  2967    LPCWSTR lpModuleName);
  2968  // #ifdef UNICODE
  2969  alias GetModuleHandleW GetModuleHandle;
  2970  // #else
  2971  // #...
  2972  // #endif // !UNICODE
  2973  
  2974  // #if !defined(RC_INVOKED)
  2975  // #if _WIN32_WINNT > 0x0500 || defined(WINBASE_DECLARE_GET_MODULE_HANDLE_EX) || ISOLATION_AWARE_ENABLED
  2976  
  2977  enum : uint { GET_MODULE_HANDLE_EX_FLAG_PIN = 0x00000001 }
  2978  enum : uint { GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT = 0x00000002 }
  2979  enum : uint { GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS = 0x00000004 }
  2980  
  2981  extern(Windows) alias BOOL function(  DWORD dwFlags,  LPCSTR lpModuleName,  HMODULE* phModule ) PGET_MODULE_HANDLE_EXA;
  2982  extern(Windows) alias BOOL function(  DWORD dwFlags,  LPCWSTR lpModuleName,  HMODULE* phModule ) PGET_MODULE_HANDLE_EXW;
  2983  // #ifdef UNICODE
  2984  alias PGET_MODULE_HANDLE_EXW PGET_MODULE_HANDLE_EX;
  2985  // #else
  2986  // #...
  2987  // #endif // !UNICODE
  2988  
  2989  extern(Windows) export BOOL GetModuleHandleExA(
  2990    DWORD dwFlags,
  2991    LPCSTR lpModuleName,
  2992    HMODULE* phModule);
  2993  extern(Windows) export BOOL GetModuleHandleExW(
  2994    DWORD dwFlags,
  2995    LPCWSTR lpModuleName,
  2996    HMODULE* phModule);
  2997  // #ifdef UNICODE
  2998  alias GetModuleHandleExW GetModuleHandleEx;
  2999  // #else
  3000  // #...
  3001  // #endif // !UNICODE
  3002  
  3003  // #endif
  3004  // #endif
  3005  
  3006  extern(Windows) export BOOL CreateProcessA(
  3007    LPCSTR lpApplicationName,
  3008    LPSTR lpCommandLine,
  3009    LPSECURITY_ATTRIBUTES lpProcessAttributes,
  3010    LPSECURITY_ATTRIBUTES lpThreadAttributes,
  3011    BOOL bInheritHandles,
  3012    DWORD dwCreationFlags,
  3013    LPVOID lpEnvironment,
  3014    LPCSTR lpCurrentDirectory,
  3015    LPSTARTUPINFOA lpStartupInfo,
  3016    LPPROCESS_INFORMATION lpProcessInformation);
  3017  extern(Windows) export BOOL CreateProcessW(
  3018    LPCWSTR lpApplicationName,
  3019    LPWSTR lpCommandLine,
  3020    LPSECURITY_ATTRIBUTES lpProcessAttributes,
  3021    LPSECURITY_ATTRIBUTES lpThreadAttributes,
  3022    BOOL bInheritHandles,
  3023    DWORD dwCreationFlags,
  3024    LPVOID lpEnvironment,
  3025    LPCWSTR lpCurrentDirectory,
  3026    LPSTARTUPINFOW lpStartupInfo,
  3027    LPPROCESS_INFORMATION lpProcessInformation);
  3028  // #ifdef UNICODE
  3029  alias CreateProcessW CreateProcess;
  3030  // #else
  3031  // #...
  3032  // #endif // !UNICODE
  3033  
  3034  extern(Windows) export BOOL SetProcessShutdownParameters(
  3035    DWORD dwLevel,
  3036    DWORD dwFlags);
  3037  
  3038  extern(Windows) export BOOL GetProcessShutdownParameters(
  3039    LPDWORD lpdwLevel,
  3040    LPDWORD lpdwFlags);
  3041  
  3042  extern(Windows) export DWORD GetProcessVersion(
  3043    DWORD ProcessId);
  3044  
  3045  extern(Windows) export VOID FatalAppExitA(
  3046    UINT uAction,
  3047    LPCSTR lpMessageText);
  3048  extern(Windows) export VOID FatalAppExitW(
  3049    UINT uAction,
  3050    LPCWSTR lpMessageText);
  3051  // #ifdef UNICODE
  3052  alias FatalAppExitW FatalAppExit;
  3053  // #else
  3054  // #...
  3055  // #endif // !UNICODE
  3056  
  3057  extern(Windows) export VOID GetStartupInfoA(
  3058    LPSTARTUPINFOA lpStartupInfo);
  3059  extern(Windows) export VOID GetStartupInfoW(
  3060    LPSTARTUPINFOW lpStartupInfo);
  3061  // #ifdef UNICODE
  3062  alias GetStartupInfoW GetStartupInfo;
  3063  // #else
  3064  // #...
  3065  // #endif // !UNICODE
  3066  
  3067  extern(Windows) export LPSTR GetCommandLineA();
  3068  extern(Windows) export LPWSTR GetCommandLineW();
  3069  // #ifdef UNICODE
  3070  alias GetCommandLineW GetCommandLine;
  3071  // #else
  3072  // #...
  3073  // #endif // !UNICODE
  3074  
  3075  extern(Windows) export DWORD GetEnvironmentVariableA(
  3076    LPCSTR lpName,
  3077    LPSTR lpBuffer,
  3078    DWORD nSize);
  3079  extern(Windows) export DWORD GetEnvironmentVariableW(
  3080    LPCWSTR lpName,
  3081    LPWSTR lpBuffer,
  3082    DWORD nSize);
  3083  // #ifdef UNICODE
  3084  alias GetEnvironmentVariableW GetEnvironmentVariable;
  3085  // #else
  3086  // #...
  3087  // #endif // !UNICODE
  3088  
  3089  extern(Windows) export BOOL SetEnvironmentVariableA(
  3090    LPCSTR lpName,
  3091    LPCSTR lpValue);
  3092  extern(Windows) export BOOL SetEnvironmentVariableW(
  3093    LPCWSTR lpName,
  3094    LPCWSTR lpValue);
  3095  // #ifdef UNICODE
  3096  alias SetEnvironmentVariableW SetEnvironmentVariable;
  3097  // #else
  3098  // #...
  3099  // #endif // !UNICODE
  3100  
  3101  extern(Windows) export DWORD ExpandEnvironmentStringsA(
  3102    LPCSTR lpSrc,
  3103    LPSTR lpDst,
  3104    DWORD nSize);
  3105  extern(Windows) export DWORD ExpandEnvironmentStringsW(
  3106    LPCWSTR lpSrc,
  3107    LPWSTR lpDst,
  3108    DWORD nSize);
  3109  // #ifdef UNICODE
  3110  alias ExpandEnvironmentStringsW ExpandEnvironmentStrings;
  3111  // #else
  3112  // #...
  3113  // #endif // !UNICODE
  3114  
  3115  extern(Windows) export DWORD GetFirmwareEnvironmentVariableA(
  3116    LPCSTR lpName,
  3117    LPCSTR lpGuid,
  3118    PVOID pBuffer,
  3119    DWORD nSize);
  3120  extern(Windows) export DWORD GetFirmwareEnvironmentVariableW(
  3121    LPCWSTR lpName,
  3122    LPCWSTR lpGuid,
  3123    PVOID pBuffer,
  3124    DWORD nSize);
  3125  // #ifdef UNICODE
  3126  alias GetFirmwareEnvironmentVariableW GetFirmwareEnvironmentVariable;
  3127  // #else
  3128  // #...
  3129  // #endif // !UNICODE
  3130  
  3131  extern(Windows) export BOOL SetFirmwareEnvironmentVariableA(
  3132    LPCSTR lpName,
  3133    LPCSTR lpGuid,
  3134    PVOID pValue,
  3135    DWORD nSize);
  3136  extern(Windows) export BOOL SetFirmwareEnvironmentVariableW(
  3137    LPCWSTR lpName,
  3138    LPCWSTR lpGuid,
  3139    PVOID pValue,
  3140    DWORD nSize);
  3141  // #ifdef UNICODE
  3142  alias SetFirmwareEnvironmentVariableW SetFirmwareEnvironmentVariable;
  3143  // #else
  3144  // #...
  3145  // #endif // !UNICODE
  3146  
  3147  extern(Windows) export VOID OutputDebugStringA(
  3148    LPCSTR lpOutputString);
  3149  extern(Windows) export VOID OutputDebugStringW(
  3150    LPCWSTR lpOutputString);
  3151  // #ifdef UNICODE
  3152  alias OutputDebugStringW OutputDebugString;
  3153  // #else
  3154  // #...
  3155  // #endif // !UNICODE
  3156  
  3157  extern(Windows) export HRSRC FindResourceA(
  3158    HMODULE hModule,
  3159    LPCSTR lpName,
  3160    LPCSTR lpType);
  3161  extern(Windows) export HRSRC FindResourceW(
  3162    HMODULE hModule,
  3163    LPCWSTR lpName,
  3164    LPCWSTR lpType);
  3165  // #ifdef UNICODE
  3166  alias FindResourceW FindResource;
  3167  // #else
  3168  // #...
  3169  // #endif // !UNICODE
  3170  
  3171  extern(Windows) export HRSRC FindResourceExA(
  3172    HMODULE hModule,
  3173    LPCSTR lpType,
  3174    LPCSTR lpName,
  3175    WORD wLanguage);
  3176  extern(Windows) export HRSRC FindResourceExW(
  3177    HMODULE hModule,
  3178    LPCWSTR lpType,
  3179    LPCWSTR lpName,
  3180    WORD wLanguage);
  3181  // #ifdef UNICODE
  3182  alias FindResourceExW FindResourceEx;
  3183  // #else
  3184  // #...
  3185  // #endif // !UNICODE
  3186  
  3187  // #ifdef STRICT
  3188  extern(Windows) alias BOOL function(HMODULE hModule, LPSTR lpType, LONG_PTR lParam) ENUMRESTYPEPROCA;
  3189  extern(Windows) alias BOOL function(HMODULE hModule, LPWSTR lpType, LONG_PTR lParam) ENUMRESTYPEPROCW;
  3190  // #ifdef UNICODE
  3191  alias ENUMRESTYPEPROCW ENUMRESTYPEPROC;
  3192  // #else
  3193  // #...
  3194  // #endif // !UNICODE
  3195  extern(Windows) alias BOOL function(HMODULE hModule, LPCSTR lpType, LPSTR lpName, LONG_PTR lParam) ENUMRESNAMEPROCA;
  3196  extern(Windows) alias BOOL function(HMODULE hModule, LPCWSTR lpType, LPWSTR lpName, LONG_PTR lParam) ENUMRESNAMEPROCW;
  3197  // #ifdef UNICODE
  3198  alias ENUMRESNAMEPROCW ENUMRESNAMEPROC;
  3199  // #else
  3200  // #...
  3201  // #endif // !UNICODE
  3202  extern(Windows) alias BOOL function(HMODULE hModule, LPCSTR lpType, LPCSTR lpName, WORD wLanguage, LONG_PTR lParam) ENUMRESLANGPROCA;
  3203  extern(Windows) alias BOOL function(HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage, LONG_PTR lParam) ENUMRESLANGPROCW;
  3204  // #ifdef UNICODE
  3205  alias ENUMRESLANGPROCW ENUMRESLANGPROC;
  3206  // #else
  3207  // #...
  3208  // #endif // !UNICODE
  3209  // #else
  3210  // ...
  3211  // #ifdef UNICODE
  3212  // ...
  3213  // #else
  3214  // ...
  3215  // #endif // UNICODE
  3216  // ...
  3217  // #ifdef UNICODE
  3218  // ...
  3219  // #else
  3220  // ...
  3221  // #endif // UNICODE
  3222  // ...
  3223  // #ifdef UNICODE
  3224  // ...
  3225  // #else
  3226  // ...
  3227  // #endif // UNICODE
  3228  // #endif
  3229  
  3230  extern(Windows) export BOOL EnumResourceTypesA(
  3231    HMODULE hModule,
  3232    ENUMRESTYPEPROCA lpEnumFunc,
  3233    LONG_PTR lParam);
  3234  extern(Windows) export BOOL EnumResourceTypesW(
  3235    HMODULE hModule,
  3236    ENUMRESTYPEPROCW lpEnumFunc,
  3237    LONG_PTR lParam);
  3238  // #ifdef UNICODE
  3239  alias EnumResourceTypesW EnumResourceTypes;
  3240  // #else
  3241  // #...
  3242  // #endif // !UNICODE
  3243  
  3244  extern(Windows) export BOOL EnumResourceNamesA(
  3245    HMODULE hModule,
  3246    LPCSTR lpType,
  3247    ENUMRESNAMEPROCA lpEnumFunc,
  3248    LONG_PTR lParam);
  3249  extern(Windows) export BOOL EnumResourceNamesW(
  3250    HMODULE hModule,
  3251    LPCWSTR lpType,
  3252    ENUMRESNAMEPROCW lpEnumFunc,
  3253    LONG_PTR lParam);
  3254  // #ifdef UNICODE
  3255  alias EnumResourceNamesW EnumResourceNames;
  3256  // #else
  3257  // #...
  3258  // #endif // !UNICODE
  3259  
  3260  extern(Windows) export BOOL EnumResourceLanguagesA(
  3261    HMODULE hModule,
  3262    LPCSTR lpType,
  3263    LPCSTR lpName,
  3264    ENUMRESLANGPROCA lpEnumFunc,
  3265    LONG_PTR lParam);
  3266  extern(Windows) export BOOL EnumResourceLanguagesW(
  3267    HMODULE hModule,
  3268    LPCWSTR lpType,
  3269    LPCWSTR lpName,
  3270    ENUMRESLANGPROCW lpEnumFunc,
  3271    LONG_PTR lParam);
  3272  // #ifdef UNICODE
  3273  alias EnumResourceLanguagesW EnumResourceLanguages;
  3274  // #else
  3275  // #...
  3276  // #endif // !UNICODE
  3277  
  3278  extern(Windows) export HANDLE BeginUpdateResourceA(
  3279    LPCSTR pFileName,
  3280    BOOL bDeleteExistingResources);
  3281  extern(Windows) export HANDLE BeginUpdateResourceW(
  3282    LPCWSTR pFileName,
  3283    BOOL bDeleteExistingResources);
  3284  // #ifdef UNICODE
  3285  alias BeginUpdateResourceW BeginUpdateResource;
  3286  // #else
  3287  // #...
  3288  // #endif // !UNICODE
  3289  
  3290  extern(Windows) export BOOL UpdateResourceA(
  3291    HANDLE hUpdate,
  3292    LPCSTR lpType,
  3293    LPCSTR lpName,
  3294    WORD wLanguage,
  3295    LPVOID lpData,
  3296    DWORD cbData);
  3297  extern(Windows) export BOOL UpdateResourceW(
  3298    HANDLE hUpdate,
  3299    LPCWSTR lpType,
  3300    LPCWSTR lpName,
  3301    WORD wLanguage,
  3302    LPVOID lpData,
  3303    DWORD cbData);
  3304  // #ifdef UNICODE
  3305  alias UpdateResourceW UpdateResource;
  3306  // #else
  3307  // #...
  3308  // #endif // !UNICODE
  3309  
  3310  extern(Windows) export BOOL EndUpdateResourceA(
  3311    HANDLE hUpdate,
  3312    BOOL fDiscard);
  3313  extern(Windows) export BOOL EndUpdateResourceW(
  3314    HANDLE hUpdate,
  3315    BOOL fDiscard);
  3316  // #ifdef UNICODE
  3317  alias EndUpdateResourceW EndUpdateResource;
  3318  // #else
  3319  // #...
  3320  // #endif // !UNICODE
  3321  
  3322  extern(Windows) export ATOM GlobalAddAtomA(
  3323    LPCSTR lpString);
  3324  extern(Windows) export ATOM GlobalAddAtomW(
  3325    LPCWSTR lpString);
  3326  // #ifdef UNICODE
  3327  alias GlobalAddAtomW GlobalAddAtom;
  3328  // #else
  3329  // #...
  3330  // #endif // !UNICODE
  3331  
  3332  extern(Windows) export ATOM GlobalFindAtomA(
  3333    LPCSTR lpString);
  3334  extern(Windows) export ATOM GlobalFindAtomW(
  3335    LPCWSTR lpString);
  3336  // #ifdef UNICODE
  3337  alias GlobalFindAtomW GlobalFindAtom;
  3338  // #else
  3339  // #...
  3340  // #endif // !UNICODE
  3341  
  3342  extern(Windows) export UINT GlobalGetAtomNameA(
  3343    ATOM nAtom,
  3344    LPSTR lpBuffer,
  3345    int nSize);
  3346  extern(Windows) export UINT GlobalGetAtomNameW(
  3347    ATOM nAtom,
  3348    LPWSTR lpBuffer,
  3349    int nSize);
  3350  // #ifdef UNICODE
  3351  alias GlobalGetAtomNameW GlobalGetAtomName;
  3352  // #else
  3353  // #...
  3354  // #endif // !UNICODE
  3355  
  3356  extern(Windows) export ATOM AddAtomA(
  3357    LPCSTR lpString);
  3358  extern(Windows) export ATOM AddAtomW(
  3359    LPCWSTR lpString);
  3360  // #ifdef UNICODE
  3361  alias AddAtomW AddAtom;
  3362  // #else
  3363  // #...
  3364  // #endif // !UNICODE
  3365  
  3366  extern(Windows) export ATOM FindAtomA(
  3367    LPCSTR lpString);
  3368  extern(Windows) export ATOM FindAtomW(
  3369    LPCWSTR lpString);
  3370  // #ifdef UNICODE
  3371  alias FindAtomW FindAtom;
  3372  // #else
  3373  // #...
  3374  // #endif // !UNICODE
  3375  
  3376  extern(Windows) export UINT GetAtomNameA(
  3377    ATOM nAtom,
  3378    LPSTR lpBuffer,
  3379    int nSize);
  3380  extern(Windows) export UINT GetAtomNameW(
  3381    ATOM nAtom,
  3382    LPWSTR lpBuffer,
  3383    int nSize);
  3384  // #ifdef UNICODE
  3385  alias GetAtomNameW GetAtomName;
  3386  // #else
  3387  // #...
  3388  // #endif // !UNICODE
  3389  
  3390  extern(Windows) export UINT GetProfileIntA(
  3391    LPCSTR lpAppName,
  3392    LPCSTR lpKeyName,
  3393    INT nDefault);
  3394  extern(Windows) export UINT GetProfileIntW(
  3395    LPCWSTR lpAppName,
  3396    LPCWSTR lpKeyName,
  3397    INT nDefault);
  3398  // #ifdef UNICODE
  3399  alias GetProfileIntW GetProfileInt;
  3400  // #else
  3401  // #...
  3402  // #endif // !UNICODE
  3403  
  3404  extern(Windows) export DWORD GetProfileStringA(
  3405    LPCSTR lpAppName,
  3406    LPCSTR lpKeyName,
  3407    LPCSTR lpDefault,
  3408    LPSTR lpReturnedString,
  3409    DWORD nSize);
  3410  extern(Windows) export DWORD GetProfileStringW(
  3411    LPCWSTR lpAppName,
  3412    LPCWSTR lpKeyName,
  3413    LPCWSTR lpDefault,
  3414    LPWSTR lpReturnedString,
  3415    DWORD nSize);
  3416  // #ifdef UNICODE
  3417  alias GetProfileStringW GetProfileString;
  3418  // #else
  3419  // #...
  3420  // #endif // !UNICODE
  3421  
  3422  extern(Windows) export BOOL WriteProfileStringA(
  3423    LPCSTR lpAppName,
  3424    LPCSTR lpKeyName,
  3425    LPCSTR lpString);
  3426  extern(Windows) export BOOL WriteProfileStringW(
  3427    LPCWSTR lpAppName,
  3428    LPCWSTR lpKeyName,
  3429    LPCWSTR lpString);
  3430  // #ifdef UNICODE
  3431  alias WriteProfileStringW WriteProfileString;
  3432  // #else
  3433  // #...
  3434  // #endif // !UNICODE
  3435  
  3436  extern(Windows) export DWORD GetProfileSectionA(
  3437    LPCSTR lpAppName,
  3438    LPSTR lpReturnedString,
  3439    DWORD nSize);
  3440  extern(Windows) export DWORD GetProfileSectionW(
  3441    LPCWSTR lpAppName,
  3442    LPWSTR lpReturnedString,
  3443    DWORD nSize);
  3444  // #ifdef UNICODE
  3445  alias GetProfileSectionW GetProfileSection;
  3446  // #else
  3447  // #...
  3448  // #endif // !UNICODE
  3449  
  3450  extern(Windows) export BOOL WriteProfileSectionA(
  3451    LPCSTR lpAppName,
  3452    LPCSTR lpString);
  3453  extern(Windows) export BOOL WriteProfileSectionW(
  3454    LPCWSTR lpAppName,
  3455    LPCWSTR lpString);
  3456  // #ifdef UNICODE
  3457  alias WriteProfileSectionW WriteProfileSection;
  3458  // #else
  3459  // #...
  3460  // #endif // !UNICODE
  3461  
  3462  extern(Windows) export UINT GetPrivateProfileIntA(
  3463    LPCSTR lpAppName,
  3464    LPCSTR lpKeyName,
  3465    INT nDefault,
  3466    LPCSTR lpFileName);
  3467  extern(Windows) export UINT GetPrivateProfileIntW(
  3468    LPCWSTR lpAppName,
  3469    LPCWSTR lpKeyName,
  3470    INT nDefault,
  3471    LPCWSTR lpFileName);
  3472  // #ifdef UNICODE
  3473  alias GetPrivateProfileIntW GetPrivateProfileInt;
  3474  // #else
  3475  // #...
  3476  // #endif // !UNICODE
  3477  
  3478  extern(Windows) export DWORD GetPrivateProfileStringA(
  3479    LPCSTR lpAppName,
  3480    LPCSTR lpKeyName,
  3481    LPCSTR lpDefault,
  3482    LPSTR lpReturnedString,
  3483    DWORD nSize,
  3484    LPCSTR lpFileName);
  3485  extern(Windows) export DWORD GetPrivateProfileStringW(
  3486    LPCWSTR lpAppName,
  3487    LPCWSTR lpKeyName,
  3488    LPCWSTR lpDefault,
  3489    LPWSTR lpReturnedString,
  3490    DWORD nSize,
  3491    LPCWSTR lpFileName);
  3492  // #ifdef UNICODE
  3493  alias GetPrivateProfileStringW GetPrivateProfileString;
  3494  // #else
  3495  // #...
  3496  // #endif // !UNICODE
  3497  
  3498  extern(Windows) export BOOL WritePrivateProfileStringA(
  3499    LPCSTR lpAppName,
  3500    LPCSTR lpKeyName,
  3501    LPCSTR lpString,
  3502    LPCSTR lpFileName);
  3503  extern(Windows) export BOOL WritePrivateProfileStringW(
  3504    LPCWSTR lpAppName,
  3505    LPCWSTR lpKeyName,
  3506    LPCWSTR lpString,
  3507    LPCWSTR lpFileName);
  3508  // #ifdef UNICODE
  3509  alias WritePrivateProfileStringW WritePrivateProfileString;
  3510  // #else
  3511  // #...
  3512  // #endif // !UNICODE
  3513  
  3514  extern(Windows) export DWORD GetPrivateProfileSectionA(
  3515    LPCSTR lpAppName,
  3516    LPSTR lpReturnedString,
  3517    DWORD nSize,
  3518    LPCSTR lpFileName);
  3519  extern(Windows) export DWORD GetPrivateProfileSectionW(
  3520    LPCWSTR lpAppName,
  3521    LPWSTR lpReturnedString,
  3522    DWORD nSize,
  3523    LPCWSTR lpFileName);
  3524  // #ifdef UNICODE
  3525  alias GetPrivateProfileSectionW GetPrivateProfileSection;
  3526  // #else
  3527  // #...
  3528  // #endif // !UNICODE
  3529  
  3530  extern(Windows) export BOOL WritePrivateProfileSectionA(
  3531    LPCSTR lpAppName,
  3532    LPCSTR lpString,
  3533    LPCSTR lpFileName);
  3534  extern(Windows) export BOOL WritePrivateProfileSectionW(
  3535    LPCWSTR lpAppName,
  3536    LPCWSTR lpString,
  3537    LPCWSTR lpFileName);
  3538  // #ifdef UNICODE
  3539  alias WritePrivateProfileSectionW WritePrivateProfileSection;
  3540  // #else
  3541  // #...
  3542  // #endif // !UNICODE
  3543  
  3544  extern(Windows) export DWORD GetPrivateProfileSectionNamesA(
  3545    LPSTR lpszReturnBuffer,
  3546    DWORD nSize,
  3547    LPCSTR lpFileName);
  3548  extern(Windows) export DWORD GetPrivateProfileSectionNamesW(
  3549    LPWSTR lpszReturnBuffer,
  3550    DWORD nSize,
  3551    LPCWSTR lpFileName);
  3552  // #ifdef UNICODE
  3553  alias GetPrivateProfileSectionNamesW GetPrivateProfileSectionNames;
  3554  // #else
  3555  // #...
  3556  // #endif // !UNICODE
  3557  
  3558  extern(Windows) export BOOL GetPrivateProfileStructA(
  3559    LPCSTR lpszSection,
  3560    LPCSTR lpszKey,
  3561    LPVOID lpStruct,
  3562    UINT uSizeStruct,
  3563    LPCSTR szFile);
  3564  extern(Windows) export BOOL GetPrivateProfileStructW(
  3565    LPCWSTR lpszSection,
  3566    LPCWSTR lpszKey,
  3567    LPVOID lpStruct,
  3568    UINT uSizeStruct,
  3569    LPCWSTR szFile);
  3570  // #ifdef UNICODE
  3571  alias GetPrivateProfileStructW GetPrivateProfileStruct;
  3572  // #else
  3573  // #...
  3574  // #endif // !UNICODE
  3575  
  3576  extern(Windows) export BOOL WritePrivateProfileStructA(
  3577    LPCSTR lpszSection,
  3578    LPCSTR lpszKey,
  3579    LPVOID lpStruct,
  3580    UINT uSizeStruct,
  3581    LPCSTR szFile);
  3582  extern(Windows) export BOOL WritePrivateProfileStructW(
  3583    LPCWSTR lpszSection,
  3584    LPCWSTR lpszKey,
  3585    LPVOID lpStruct,
  3586    UINT uSizeStruct,
  3587    LPCWSTR szFile);
  3588  // #ifdef UNICODE
  3589  alias WritePrivateProfileStructW WritePrivateProfileStruct;
  3590  // #else
  3591  // #...
  3592  // #endif // !UNICODE
  3593  
  3594  extern(Windows) export UINT GetDriveTypeA(
  3595    LPCSTR lpRootPathName);
  3596  extern(Windows) export UINT GetDriveTypeW(
  3597    LPCWSTR lpRootPathName);
  3598  // #ifdef UNICODE
  3599  alias GetDriveTypeW GetDriveType;
  3600  // #else
  3601  // #...
  3602  // #endif // !UNICODE
  3603  
  3604  extern(Windows) export UINT GetSystemDirectoryA(
  3605    LPSTR lpBuffer,
  3606    UINT uSize);
  3607  extern(Windows) export UINT GetSystemDirectoryW(
  3608    LPWSTR lpBuffer,
  3609    UINT uSize);
  3610  // #ifdef UNICODE
  3611  alias GetSystemDirectoryW GetSystemDirectory;
  3612  // #else
  3613  // #...
  3614  // #endif // !UNICODE
  3615  
  3616  extern(Windows) export DWORD GetTempPathA(
  3617    DWORD nBufferLength,
  3618    LPSTR lpBuffer);
  3619  extern(Windows) export DWORD GetTempPathW(
  3620    DWORD nBufferLength,
  3621    LPWSTR lpBuffer);
  3622  // #ifdef UNICODE
  3623  alias GetTempPathW GetTempPath;
  3624  // #else
  3625  // #...
  3626  // #endif // !UNICODE
  3627  
  3628  extern(Windows) export UINT GetTempFileNameA(
  3629    LPCSTR lpPathName,
  3630    LPCSTR lpPrefixString,
  3631    UINT uUnique,
  3632    LPSTR lpTempFileName);
  3633  extern(Windows) export UINT GetTempFileNameW(
  3634    LPCWSTR lpPathName,
  3635    LPCWSTR lpPrefixString,
  3636    UINT uUnique,
  3637    LPWSTR lpTempFileName);
  3638  // #ifdef UNICODE
  3639  alias GetTempFileNameW GetTempFileName;
  3640  // #else
  3641  // #...
  3642  // #endif // !UNICODE
  3643  
  3644  extern(Windows) export UINT GetWindowsDirectoryA(
  3645    LPSTR lpBuffer,
  3646    UINT uSize);
  3647  extern(Windows) export UINT GetWindowsDirectoryW(
  3648    LPWSTR lpBuffer,
  3649    UINT uSize);
  3650  // #ifdef UNICODE
  3651  alias GetWindowsDirectoryW GetWindowsDirectory;
  3652  // #else
  3653  // #...
  3654  // #endif // !UNICODE
  3655  
  3656  extern(Windows) export UINT GetSystemWindowsDirectoryA(
  3657    LPSTR lpBuffer,
  3658    UINT uSize);
  3659  extern(Windows) export UINT GetSystemWindowsDirectoryW(
  3660    LPWSTR lpBuffer,
  3661    UINT uSize);
  3662  // #ifdef UNICODE
  3663  alias GetSystemWindowsDirectoryW GetSystemWindowsDirectory;
  3664  // #else
  3665  // #...
  3666  // #endif // !UNICODE
  3667  
  3668  // #if !defined(RC_INVOKED) // RC warns because "WINBASE_DECLARE_GET_SYSTEM_WOW64_DIRECTORY" is a bit long.
  3669  // #if _WIN32_WINNT >= 0x0501 || defined(WINBASE_DECLARE_GET_SYSTEM_WOW64_DIRECTORY)
  3670  
  3671  extern(Windows) export UINT GetSystemWow64DirectoryA(
  3672    LPSTR lpBuffer,
  3673    UINT uSize);
  3674  extern(Windows) export UINT GetSystemWow64DirectoryW(
  3675    LPWSTR lpBuffer,
  3676    UINT uSize);
  3677  // #ifdef UNICODE
  3678  alias GetSystemWow64DirectoryW GetSystemWow64Directory;
  3679  // #else
  3680  // #...
  3681  // #endif // !UNICODE
  3682  
  3683  extern(Windows) alias UINT function( LPSTR lpBuffer, UINT uSize) PGET_SYSTEM_WOW64_DIRECTORY_A;
  3684  extern(Windows) alias UINT function( LPWSTR lpBuffer, UINT uSize) PGET_SYSTEM_WOW64_DIRECTORY_W;
  3685  
  3686  const char[] GET_SYSTEM_WOW64_DIRECTORY_NAME_A_A = "GetSystemWow64DirectoryA";
  3687  const wchar[] GET_SYSTEM_WOW64_DIRECTORY_NAME_A_W = "GetSystemWow64DirectoryA";
  3688  const TCHAR[] GET_SYSTEM_WOW64_DIRECTORY_NAME_A_T = "GetSystemWow64DirectoryA";
  3689  const char[] GET_SYSTEM_WOW64_DIRECTORY_NAME_W_A = "GetSystemWow64DirectoryW";
  3690  const wchar[] GET_SYSTEM_WOW64_DIRECTORY_NAME_W_W = "GetSystemWow64DirectoryW";
  3691  const TCHAR[] GET_SYSTEM_WOW64_DIRECTORY_NAME_W_T = "GetSystemWow64DirectoryW";
  3692  
  3693  // #ifdef UNICODE
  3694  alias GET_SYSTEM_WOW64_DIRECTORY_NAME_W_A GET_SYSTEM_WOW64_DIRECTORY_NAME_T_A;
  3695  alias GET_SYSTEM_WOW64_DIRECTORY_NAME_W_W GET_SYSTEM_WOW64_DIRECTORY_NAME_T_W;
  3696  alias GET_SYSTEM_WOW64_DIRECTORY_NAME_W_T GET_SYSTEM_WOW64_DIRECTORY_NAME_T_T;
  3697  // #else
  3698  // #...
  3699  // #...
  3700  // #...
  3701  // #endif
  3702  
  3703  // #endif // _WIN32_WINNT >= 0x0501
  3704  // #endif
  3705  
  3706  extern(Windows) export BOOL SetCurrentDirectoryA(
  3707    LPCSTR lpPathName);
  3708  extern(Windows) export BOOL SetCurrentDirectoryW(
  3709    LPCWSTR lpPathName);
  3710  // #ifdef UNICODE
  3711  alias SetCurrentDirectoryW SetCurrentDirectory;
  3712  // #else
  3713  // #...
  3714  // #endif // !UNICODE
  3715  
  3716  extern(Windows) export DWORD GetCurrentDirectoryA(
  3717    DWORD nBufferLength,
  3718    LPSTR lpBuffer);
  3719  extern(Windows) export DWORD GetCurrentDirectoryW(
  3720    DWORD nBufferLength,
  3721    LPWSTR lpBuffer);
  3722  // #ifdef UNICODE
  3723  alias GetCurrentDirectoryW GetCurrentDirectory;
  3724  // #else
  3725  // #...
  3726  // #endif // !UNICODE
  3727  
  3728  extern(Windows) export BOOL GetDiskFreeSpaceA(
  3729    LPCSTR lpRootPathName,
  3730    LPDWORD lpSectorsPerCluster,
  3731    LPDWORD lpBytesPerSector,
  3732    LPDWORD lpNumberOfFreeClusters,
  3733    LPDWORD lpTotalNumberOfClusters);
  3734  extern(Windows) export BOOL GetDiskFreeSpaceW(
  3735    LPCWSTR lpRootPathName,
  3736    LPDWORD lpSectorsPerCluster,
  3737    LPDWORD lpBytesPerSector,
  3738    LPDWORD lpNumberOfFreeClusters,
  3739    LPDWORD lpTotalNumberOfClusters);
  3740  // #ifdef UNICODE
  3741  alias GetDiskFreeSpaceW GetDiskFreeSpace;
  3742  // #else
  3743  // #...
  3744  // #endif // !UNICODE
  3745  
  3746  extern(Windows) export BOOL GetDiskFreeSpaceExA(
  3747    LPCSTR lpDirectoryName,
  3748    PULARGE_INTEGER lpFreeBytesAvailableToCaller,
  3749    PULARGE_INTEGER lpTotalNumberOfBytes,
  3750    PULARGE_INTEGER lpTotalNumberOfFreeBytes);
  3751  extern(Windows) export BOOL GetDiskFreeSpaceExW(
  3752    LPCWSTR lpDirectoryName,
  3753    PULARGE_INTEGER lpFreeBytesAvailableToCaller,
  3754    PULARGE_INTEGER lpTotalNumberOfBytes,
  3755    PULARGE_INTEGER lpTotalNumberOfFreeBytes);
  3756  // #ifdef UNICODE
  3757  alias GetDiskFreeSpaceExW GetDiskFreeSpaceEx;
  3758  // #else
  3759  // #...
  3760  // #endif // !UNICODE
  3761  
  3762  extern(Windows) export BOOL CreateDirectoryA(
  3763    LPCSTR lpPathName,
  3764    LPSECURITY_ATTRIBUTES lpSecurityAttributes);
  3765  extern(Windows) export BOOL CreateDirectoryW(
  3766    LPCWSTR lpPathName,
  3767    LPSECURITY_ATTRIBUTES lpSecurityAttributes);
  3768  // #ifdef UNICODE
  3769  alias CreateDirectoryW CreateDirectory;
  3770  // #else
  3771  // #...
  3772  // #endif // !UNICODE
  3773  
  3774  extern(Windows) export BOOL CreateDirectoryExA(
  3775    LPCSTR lpTemplateDirectory,
  3776    LPCSTR lpNewDirectory,
  3777    LPSECURITY_ATTRIBUTES lpSecurityAttributes);
  3778  extern(Windows) export BOOL CreateDirectoryExW(
  3779    LPCWSTR lpTemplateDirectory,
  3780    LPCWSTR lpNewDirectory,
  3781    LPSECURITY_ATTRIBUTES lpSecurityAttributes);
  3782  // #ifdef UNICODE
  3783  alias CreateDirectoryExW CreateDirectoryEx;
  3784  // #else
  3785  // #...
  3786  // #endif // !UNICODE
  3787  
  3788  extern(Windows) export BOOL RemoveDirectoryA(
  3789    LPCSTR lpPathName);
  3790  extern(Windows) export BOOL RemoveDirectoryW(
  3791    LPCWSTR lpPathName);
  3792  // #ifdef UNICODE
  3793  alias RemoveDirectoryW RemoveDirectory;
  3794  // #else
  3795  // #...
  3796  // #endif // !UNICODE
  3797  
  3798  extern(Windows) export DWORD GetFullPathNameA(
  3799    LPCSTR lpFileName,
  3800    DWORD nBufferLength,
  3801    LPSTR lpBuffer,
  3802    LPSTR *lpFilePart);
  3803  extern(Windows) export DWORD GetFullPathNameW(
  3804    LPCWSTR lpFileName,
  3805    DWORD nBufferLength,
  3806    LPWSTR lpBuffer,
  3807    LPWSTR *lpFilePart);
  3808  // #ifdef UNICODE
  3809  alias GetFullPathNameW GetFullPathName;
  3810  // #else
  3811  // #...
  3812  // #endif // !UNICODE
  3813  
  3814  enum : uint { DDD_RAW_TARGET_PATH = 0x00000001 }
  3815  enum : uint { DDD_REMOVE_DEFINITION = 0x00000002 }
  3816  enum : uint { DDD_EXACT_MATCH_ON_REMOVE = 0x00000004 }
  3817  enum : uint { DDD_NO_BROADCAST_SYSTEM = 0x00000008 }
  3818  enum : uint { DDD_LUID_BROADCAST_DRIVE = 0x00000010 }
  3819  
  3820  extern(Windows) export BOOL DefineDosDeviceA(
  3821    DWORD dwFlags,
  3822    LPCSTR lpDeviceName,
  3823    LPCSTR lpTargetPath);
  3824  extern(Windows) export BOOL DefineDosDeviceW(
  3825    DWORD dwFlags,
  3826    LPCWSTR lpDeviceName,
  3827    LPCWSTR lpTargetPath);
  3828  // #ifdef UNICODE
  3829  alias DefineDosDeviceW DefineDosDevice;
  3830  // #else
  3831  // #...
  3832  // #endif // !UNICODE
  3833  
  3834  extern(Windows) export DWORD QueryDosDeviceA(
  3835    LPCSTR lpDeviceName,
  3836    LPSTR lpTargetPath,
  3837    DWORD ucchMax);
  3838  extern(Windows) export DWORD QueryDosDeviceW(
  3839    LPCWSTR lpDeviceName,
  3840    LPWSTR lpTargetPath,
  3841    DWORD ucchMax);
  3842  // #ifdef UNICODE
  3843  alias QueryDosDeviceW QueryDosDevice;
  3844  // #else
  3845  // #...
  3846  // #endif // !UNICODE
  3847  
  3848  // #define EXPAND_LOCAL_DRIVES
  3849  
  3850  extern(Windows) export HANDLE CreateFileA(
  3851    LPCSTR lpFileName,
  3852    DWORD dwDesiredAccess,
  3853    DWORD dwShareMode,
  3854    LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  3855    DWORD dwCreationDisposition,
  3856    DWORD dwFlagsAndAttributes,
  3857    HANDLE hTemplateFile);
  3858  extern(Windows) export HANDLE CreateFileW(
  3859    LPCWSTR lpFileName,
  3860    DWORD dwDesiredAccess,
  3861    DWORD dwShareMode,
  3862    LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  3863    DWORD dwCreationDisposition,
  3864    DWORD dwFlagsAndAttributes,
  3865    HANDLE hTemplateFile);
  3866  // #ifdef UNICODE
  3867  alias CreateFileW CreateFile;
  3868  // #else
  3869  // #...
  3870  // #endif // !UNICODE
  3871  
  3872  extern(Windows) export BOOL SetFileAttributesA(
  3873    LPCSTR lpFileName,
  3874    DWORD dwFileAttributes);
  3875  extern(Windows) export BOOL SetFileAttributesW(
  3876    LPCWSTR lpFileName,
  3877    DWORD dwFileAttributes);
  3878  // #ifdef UNICODE
  3879  alias SetFileAttributesW SetFileAttributes;
  3880  // #else
  3881  // #...
  3882  // #endif // !UNICODE
  3883  
  3884  extern(Windows) export DWORD GetFileAttributesA(
  3885    LPCSTR lpFileName);
  3886  extern(Windows) export DWORD GetFileAttributesW(
  3887    LPCWSTR lpFileName);
  3888  // #ifdef UNICODE
  3889  alias GetFileAttributesW GetFileAttributes;
  3890  // #else
  3891  // #...
  3892  // #endif // !UNICODE
  3893  
  3894  alias int _GET_FILEEX_INFO_LEVELS;
  3895  enum {
  3896    GetFileExInfoStandard,
  3897    GetFileExMaxInfoLevel,
  3898  }
  3899  alias _GET_FILEEX_INFO_LEVELS GET_FILEEX_INFO_LEVELS;
  3900  
  3901  extern(Windows) export BOOL GetFileAttributesExA(
  3902    LPCSTR lpFileName,
  3903    GET_FILEEX_INFO_LEVELS fInfoLevelId,
  3904    LPVOID lpFileInformation);
  3905  extern(Windows) export BOOL GetFileAttributesExW(
  3906    LPCWSTR lpFileName,
  3907    GET_FILEEX_INFO_LEVELS fInfoLevelId,
  3908    LPVOID lpFileInformation);
  3909  // #ifdef UNICODE
  3910  alias GetFileAttributesExW GetFileAttributesEx;
  3911  // #else
  3912  // #...
  3913  // #endif // !UNICODE
  3914  
  3915  extern(Windows) export DWORD GetCompressedFileSizeA(
  3916    LPCSTR lpFileName,
  3917    LPDWORD lpFileSizeHigh);
  3918  extern(Windows) export DWORD GetCompressedFileSizeW(
  3919    LPCWSTR lpFileName,
  3920    LPDWORD lpFileSizeHigh);
  3921  // #ifdef UNICODE
  3922  alias GetCompressedFileSizeW GetCompressedFileSize;
  3923  // #else
  3924  // #...
  3925  // #endif // !UNICODE
  3926  
  3927  extern(Windows) export BOOL DeleteFileA(
  3928    LPCSTR lpFileName);
  3929  extern(Windows) export BOOL DeleteFileW(
  3930    LPCWSTR lpFileName);
  3931  // #ifdef UNICODE
  3932  alias DeleteFileW DeleteFile;
  3933  // #else
  3934  // #...
  3935  // #endif // !UNICODE
  3936  
  3937  // #if(_WIN32_WINNT >= 0x0400)
  3938  alias int _FINDEX_INFO_LEVELS;
  3939  enum {
  3940    FindExInfoStandard,
  3941    FindExInfoMaxInfoLevel,
  3942  }
  3943  alias _FINDEX_INFO_LEVELS FINDEX_INFO_LEVELS;
  3944  
  3945  alias int _FINDEX_SEARCH_OPS;
  3946  enum {
  3947    FindExSearchNameMatch,
  3948    FindExSearchLimitToDirectories,
  3949    FindExSearchLimitToDevices,
  3950    FindExSearchMaxSearchOp,
  3951  }
  3952  alias _FINDEX_SEARCH_OPS FINDEX_SEARCH_OPS;
  3953  
  3954  enum : uint { FIND_FIRST_EX_CASE_SENSITIVE = 0x00000001 }
  3955  
  3956  extern(Windows) export HANDLE FindFirstFileExA(
  3957    LPCSTR lpFileName,
  3958    FINDEX_INFO_LEVELS fInfoLevelId,
  3959    LPVOID lpFindFileData,
  3960    FINDEX_SEARCH_OPS fSearchOp,
  3961    LPVOID lpSearchFilter,
  3962    DWORD dwAdditionalFlags);
  3963  extern(Windows) export HANDLE FindFirstFileExW(
  3964    LPCWSTR lpFileName,
  3965    FINDEX_INFO_LEVELS fInfoLevelId,
  3966    LPVOID lpFindFileData,
  3967    FINDEX_SEARCH_OPS fSearchOp,
  3968    LPVOID lpSearchFilter,
  3969    DWORD dwAdditionalFlags);
  3970  // #ifdef UNICODE
  3971  alias FindFirstFileExW FindFirstFileEx;
  3972  // #else
  3973  // #...
  3974  // #endif // !UNICODE
  3975  // #endif /* _WIN32_WINNT >= 0x0400 */
  3976  
  3977  extern(Windows) export HANDLE FindFirstFileA(
  3978    LPCSTR lpFileName,
  3979    LPWIN32_FIND_DATAA lpFindFileData);
  3980  extern(Windows) export HANDLE FindFirstFileW(
  3981    LPCWSTR lpFileName,
  3982    LPWIN32_FIND_DATAW lpFindFileData);
  3983  // #ifdef UNICODE
  3984  alias FindFirstFileW FindFirstFile;
  3985  // #else
  3986  // #...
  3987  // #endif // !UNICODE
  3988  
  3989  extern(Windows) export BOOL FindNextFileA(
  3990    HANDLE hFindFile,
  3991    LPWIN32_FIND_DATAA lpFindFileData);
  3992  extern(Windows) export BOOL FindNextFileW(
  3993    HANDLE hFindFile,
  3994    LPWIN32_FIND_DATAW lpFindFileData);
  3995  // #ifdef UNICODE
  3996  alias FindNextFileW FindNextFile;
  3997  // #else
  3998  // #...
  3999  // #endif // !UNICODE
  4000  
  4001  extern(Windows) export DWORD SearchPathA(
  4002    LPCSTR lpPath,
  4003    LPCSTR lpFileName,
  4004    LPCSTR lpExtension,
  4005    DWORD nBufferLength,
  4006    LPSTR lpBuffer,
  4007    LPSTR *lpFilePart);
  4008  extern(Windows) export DWORD SearchPathW(
  4009    LPCWSTR lpPath,
  4010    LPCWSTR lpFileName,
  4011    LPCWSTR lpExtension,
  4012    DWORD nBufferLength,
  4013    LPWSTR lpBuffer,
  4014    LPWSTR *lpFilePart);
  4015  // #ifdef UNICODE
  4016  alias SearchPathW SearchPath;
  4017  // #else
  4018  // #...
  4019  // #endif // !UNICODE
  4020  
  4021  extern(Windows) export BOOL CopyFileA(
  4022    LPCSTR lpExistingFileName,
  4023    LPCSTR lpNewFileName,
  4024    BOOL bFailIfExists);
  4025  extern(Windows) export BOOL CopyFileW(
  4026    LPCWSTR lpExistingFileName,
  4027    LPCWSTR lpNewFileName,
  4028    BOOL bFailIfExists);
  4029  // #ifdef UNICODE
  4030  alias CopyFileW CopyFile;
  4031  // #else
  4032  // #...
  4033  // #endif // !UNICODE
  4034  
  4035  // #if(_WIN32_WINNT >= 0x0400)
  4036  extern(Windows) alias DWORD function( LARGE_INTEGER TotalFileSize, LARGE_INTEGER TotalBytesTransferred, LARGE_INTEGER StreamSize, LARGE_INTEGER StreamBytesTransferred, DWORD dwStreamNumber, DWORD dwCallbackReason, HANDLE hSourceFile, HANDLE hDestinationFile, LPVOID lpData  ) LPPROGRESS_ROUTINE;
  4037  
  4038  extern(Windows) export BOOL CopyFileExA(
  4039    LPCSTR lpExistingFileName,
  4040    LPCSTR lpNewFileName,
  4041    LPPROGRESS_ROUTINE lpProgressRoutine ,
  4042    LPVOID lpData ,
  4043    LPBOOL pbCancel ,
  4044    DWORD dwCopyFlags);
  4045  extern(Windows) export BOOL CopyFileExW(
  4046    LPCWSTR lpExistingFileName,
  4047    LPCWSTR lpNewFileName,
  4048    LPPROGRESS_ROUTINE lpProgressRoutine ,
  4049    LPVOID lpData ,
  4050    LPBOOL pbCancel ,
  4051    DWORD dwCopyFlags);
  4052  // #ifdef UNICODE
  4053  alias CopyFileExW CopyFileEx;
  4054  // #else
  4055  // #...
  4056  // #endif // !UNICODE
  4057  // #endif /* _WIN32_WINNT >= 0x0400 */
  4058  
  4059  extern(Windows) export BOOL MoveFileA(
  4060    LPCSTR lpExistingFileName,
  4061    LPCSTR lpNewFileName);
  4062  extern(Windows) export BOOL MoveFileW(
  4063    LPCWSTR lpExistingFileName,
  4064    LPCWSTR lpNewFileName);
  4065  // #ifdef UNICODE
  4066  alias MoveFileW MoveFile;
  4067  // #else
  4068  // #...
  4069  // #endif // !UNICODE
  4070  
  4071  extern(Windows) export BOOL MoveFileExA(
  4072    LPCSTR lpExistingFileName,
  4073    LPCSTR lpNewFileName,
  4074    DWORD dwFlags);
  4075  extern(Windows) export BOOL MoveFileExW(
  4076    LPCWSTR lpExistingFileName,
  4077    LPCWSTR lpNewFileName,
  4078    DWORD dwFlags);
  4079  // #ifdef UNICODE
  4080  alias MoveFileExW MoveFileEx;
  4081  // #else
  4082  // #...
  4083  // #endif // !UNICODE
  4084  
  4085  // #if (_WIN32_WINNT >= 0x0500)
  4086  extern(Windows) export BOOL MoveFileWithProgressA(
  4087    LPCSTR lpExistingFileName,
  4088    LPCSTR lpNewFileName,
  4089    LPPROGRESS_ROUTINE lpProgressRoutine ,
  4090    LPVOID lpData ,
  4091    DWORD dwFlags);
  4092  extern(Windows) export BOOL MoveFileWithProgressW(
  4093    LPCWSTR lpExistingFileName,
  4094    LPCWSTR lpNewFileName,
  4095    LPPROGRESS_ROUTINE lpProgressRoutine ,
  4096    LPVOID lpData ,
  4097    DWORD dwFlags);
  4098  // #ifdef UNICODE
  4099  alias MoveFileWithProgressW MoveFileWithProgress;
  4100  // #else
  4101  // #...
  4102  // #endif // !UNICODE
  4103  // #endif // (_WIN32_WINNT >= 0x0500)
  4104  
  4105  enum : uint { MOVEFILE_REPLACE_EXISTING = 0x00000001 }
  4106  enum : uint { MOVEFILE_COPY_ALLOWED = 0x00000002 }
  4107  enum : uint { MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004 }
  4108  enum : uint { MOVEFILE_WRITE_THROUGH = 0x00000008 }
  4109  // #if (_WIN32_WINNT >= 0x0500)
  4110  enum : uint { MOVEFILE_CREATE_HARDLINK = 0x00000010 }
  4111  enum : uint { MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x00000020 }
  4112  // #endif // (_WIN32_WINNT >= 0x0500)
  4113  
  4114  // #if (_WIN32_WINNT >= 0x0500)
  4115  extern(Windows) export BOOL ReplaceFileA(
  4116    LPCSTR lpReplacedFileName,
  4117    LPCSTR lpReplacementFileName,
  4118    LPCSTR lpBackupFileName,
  4119    DWORD dwReplaceFlags,
  4120    LPVOID lpExclude,
  4121    LPVOID lpReserved);
  4122  extern(Windows) export BOOL ReplaceFileW(
  4123    LPCWSTR lpReplacedFileName,
  4124    LPCWSTR lpReplacementFileName,
  4125    LPCWSTR lpBackupFileName,
  4126    DWORD dwReplaceFlags,
  4127    LPVOID lpExclude,
  4128    LPVOID lpReserved);
  4129  // #ifdef UNICODE
  4130  alias ReplaceFileW ReplaceFile;
  4131  // #else
  4132  // #...
  4133  // #endif // !UNICODE
  4134  // #endif // (_WIN32_WINNT >= 0x0500)
  4135  
  4136  // #if (_WIN32_WINNT >= 0x0500)
  4137  
  4138  extern(Windows) export BOOL CreateHardLinkA(
  4139    LPCSTR lpFileName,
  4140    LPCSTR lpExistingFileName,
  4141    LPSECURITY_ATTRIBUTES lpSecurityAttributes);
  4142  extern(Windows) export BOOL CreateHardLinkW(
  4143    LPCWSTR lpFileName,
  4144    LPCWSTR lpExistingFileName,
  4145    LPSECURITY_ATTRIBUTES lpSecurityAttributes);
  4146  // #ifdef UNICODE
  4147  alias CreateHardLinkW CreateHardLink;
  4148  // #else
  4149  // #...
  4150  // #endif // !UNICODE
  4151  
  4152  // #endif // (_WIN32_WINNT >= 0x0500)
  4153  
  4154  extern(Windows) export HANDLE CreateNamedPipeA(
  4155    LPCSTR lpName,
  4156    DWORD dwOpenMode,
  4157    DWORD dwPipeMode,
  4158    DWORD nMaxInstances,
  4159    DWORD nOutBufferSize,
  4160    DWORD nInBufferSize,
  4161    DWORD nDefaultTimeOut,
  4162    LPSECURITY_ATTRIBUTES lpSecurityAttributes);
  4163  extern(Windows) export HANDLE CreateNamedPipeW(
  4164    LPCWSTR lpName,
  4165    DWORD dwOpenMode,
  4166    DWORD dwPipeMode,
  4167    DWORD nMaxInstances,
  4168    DWORD nOutBufferSize,
  4169    DWORD nInBufferSize,
  4170    DWORD nDefaultTimeOut,
  4171    LPSECURITY_ATTRIBUTES lpSecurityAttributes);
  4172  // #ifdef UNICODE
  4173  alias CreateNamedPipeW CreateNamedPipe;
  4174  // #else
  4175  // #...
  4176  // #endif // !UNICODE
  4177  
  4178  extern(Windows) export BOOL GetNamedPipeHandleStateA(
  4179    HANDLE hNamedPipe,
  4180    LPDWORD lpState,
  4181    LPDWORD lpCurInstances,
  4182    LPDWORD lpMaxCollectionCount,
  4183    LPDWORD lpCollectDataTimeout,
  4184    LPSTR lpUserName,
  4185    DWORD nMaxUserNameSize);
  4186  extern(Windows) export BOOL GetNamedPipeHandleStateW(
  4187    HANDLE hNamedPipe,
  4188    LPDWORD lpState,
  4189    LPDWORD lpCurInstances,
  4190    LPDWORD lpMaxCollectionCount,
  4191    LPDWORD lpCollectDataTimeout,
  4192    LPWSTR lpUserName,
  4193    DWORD nMaxUserNameSize);
  4194  // #ifdef UNICODE
  4195  alias GetNamedPipeHandleStateW GetNamedPipeHandleState;
  4196  // #else
  4197  // #...
  4198  // #endif // !UNICODE
  4199  
  4200  extern(Windows) export BOOL CallNamedPipeA(
  4201    LPCSTR lpNamedPipeName,
  4202    LPVOID lpInBuffer,
  4203    DWORD nInBufferSize,
  4204    LPVOID lpOutBuffer,
  4205    DWORD nOutBufferSize,
  4206    LPDWORD lpBytesRead,
  4207    DWORD nTimeOut);
  4208  extern(Windows) export BOOL CallNamedPipeW(
  4209    LPCWSTR lpNamedPipeName,
  4210    LPVOID lpInBuffer,
  4211    DWORD nInBufferSize,
  4212    LPVOID lpOutBuffer,
  4213    DWORD nOutBufferSize,
  4214    LPDWORD lpBytesRead,
  4215    DWORD nTimeOut);
  4216  // #ifdef UNICODE
  4217  alias CallNamedPipeW CallNamedPipe;
  4218  // #else
  4219  // #...
  4220  // #endif // !UNICODE
  4221  
  4222  extern(Windows) export BOOL WaitNamedPipeA(
  4223    LPCSTR lpNamedPipeName,
  4224    DWORD nTimeOut);
  4225  extern(Windows) export BOOL WaitNamedPipeW(
  4226    LPCWSTR lpNamedPipeName,
  4227    DWORD nTimeOut);
  4228  // #ifdef UNICODE
  4229  alias WaitNamedPipeW WaitNamedPipe;
  4230  // #else
  4231  // #...
  4232  // #endif // !UNICODE
  4233  
  4234  extern(Windows) export BOOL SetVolumeLabelA(
  4235    LPCSTR lpRootPathName,
  4236    LPCSTR lpVolumeName);
  4237  extern(Windows) export BOOL SetVolumeLabelW(
  4238    LPCWSTR lpRootPathName,
  4239    LPCWSTR lpVolumeName);
  4240  // #ifdef UNICODE
  4241  alias SetVolumeLabelW SetVolumeLabel;
  4242  // #else
  4243  // #...
  4244  // #endif // !UNICODE
  4245  
  4246  extern(Windows) export VOID SetFileApisToOEM();
  4247  
  4248  extern(Windows) export VOID SetFileApisToANSI();
  4249  
  4250  extern(Windows) export BOOL AreFileApisANSI();
  4251  
  4252  extern(Windows) export BOOL GetVolumeInformationA(
  4253    LPCSTR lpRootPathName,
  4254    LPSTR lpVolumeNameBuffer,
  4255    DWORD nVolumeNameSize,
  4256    LPDWORD lpVolumeSerialNumber,
  4257    LPDWORD lpMaximumComponentLength,
  4258    LPDWORD lpFileSystemFlags,
  4259    LPSTR lpFileSystemNameBuffer,
  4260    DWORD nFileSystemNameSize);
  4261  extern(Windows) export BOOL GetVolumeInformationW(
  4262    LPCWSTR lpRootPathName,
  4263    LPWSTR lpVolumeNameBuffer,
  4264    DWORD nVolumeNameSize,
  4265    LPDWORD lpVolumeSerialNumber,
  4266    LPDWORD lpMaximumComponentLength,
  4267    LPDWORD lpFileSystemFlags,
  4268    LPWSTR lpFileSystemNameBuffer,
  4269    DWORD nFileSystemNameSize);
  4270  // #ifdef UNICODE
  4271  alias GetVolumeInformationW GetVolumeInformation;
  4272  // #else
  4273  // #...
  4274  // #endif // !UNICODE
  4275  
  4276  extern(Windows) export BOOL CancelIo(
  4277    HANDLE hFile);
  4278  
  4279  extern(Windows) export BOOL ClearEventLogA(
  4280    HANDLE hEventLog,
  4281    LPCSTR lpBackupFileName);
  4282  extern(Windows) export BOOL ClearEventLogW(
  4283    HANDLE hEventLog,
  4284    LPCWSTR lpBackupFileName);
  4285  // #ifdef UNICODE
  4286  alias ClearEventLogW ClearEventLog;
  4287  // #else
  4288  // #...
  4289  // #endif // !UNICODE
  4290  
  4291  extern(Windows) export BOOL BackupEventLogA(
  4292    HANDLE hEventLog,
  4293    LPCSTR lpBackupFileName);
  4294  extern(Windows) export BOOL BackupEventLogW(
  4295    HANDLE hEventLog,
  4296    LPCWSTR lpBackupFileName);
  4297  // #ifdef UNICODE
  4298  alias BackupEventLogW BackupEventLog;
  4299  // #else
  4300  // #...
  4301  // #endif // !UNICODE
  4302  
  4303  extern(Windows) export BOOL CloseEventLog(
  4304    HANDLE hEventLog);
  4305  
  4306  extern(Windows) export BOOL DeregisterEventSource(
  4307    HANDLE hEventLog);
  4308  
  4309  extern(Windows) export BOOL NotifyChangeEventLog(
  4310    HANDLE hEventLog,
  4311    HANDLE hEvent);
  4312  
  4313  extern(Windows) export BOOL GetNumberOfEventLogRecords(
  4314    HANDLE hEventLog,
  4315    PDWORD NumberOfRecords);
  4316  
  4317  extern(Windows) export BOOL GetOldestEventLogRecord(
  4318    HANDLE hEventLog,
  4319    PDWORD OldestRecord);
  4320  
  4321  extern(Windows) export HANDLE OpenEventLogA(
  4322    LPCSTR lpUNCServerName,
  4323    LPCSTR lpSourceName);
  4324  extern(Windows) export HANDLE OpenEventLogW(
  4325    LPCWSTR lpUNCServerName,
  4326    LPCWSTR lpSourceName);
  4327  // #ifdef UNICODE
  4328  alias OpenEventLogW OpenEventLog;
  4329  // #else
  4330  // #...
  4331  // #endif // !UNICODE
  4332  
  4333  extern(Windows) export HANDLE RegisterEventSourceA(
  4334    LPCSTR lpUNCServerName,
  4335    LPCSTR lpSourceName);
  4336  extern(Windows) export HANDLE RegisterEventSourceW(
  4337    LPCWSTR lpUNCServerName,
  4338    LPCWSTR lpSourceName);
  4339  // #ifdef UNICODE
  4340  alias RegisterEventSourceW RegisterEventSource;
  4341  // #else
  4342  // #...
  4343  // #endif // !UNICODE
  4344  
  4345  extern(Windows) export HANDLE OpenBackupEventLogA(
  4346    LPCSTR lpUNCServerName,
  4347    LPCSTR lpFileName);
  4348  extern(Windows) export HANDLE OpenBackupEventLogW(
  4349    LPCWSTR lpUNCServerName,
  4350    LPCWSTR lpFileName);
  4351  // #ifdef UNICODE
  4352  alias OpenBackupEventLogW OpenBackupEventLog;
  4353  // #else
  4354  // #...
  4355  // #endif // !UNICODE
  4356  
  4357  extern(Windows) export BOOL ReadEventLogA(
  4358    HANDLE hEventLog,
  4359    DWORD dwReadFlags,
  4360    DWORD dwRecordOffset,
  4361    LPVOID lpBuffer,
  4362    DWORD nNumberOfBytesToRead,
  4363    DWORD *pnBytesRead,
  4364    DWORD *pnMinNumberOfBytesNeeded);
  4365  extern(Windows) export BOOL ReadEventLogW(
  4366    HANDLE hEventLog,
  4367    DWORD dwReadFlags,
  4368    DWORD dwRecordOffset,
  4369    LPVOID lpBuffer,
  4370    DWORD nNumberOfBytesToRead,
  4371    DWORD *pnBytesRead,
  4372    DWORD *pnMinNumberOfBytesNeeded);
  4373  // #ifdef UNICODE
  4374  alias ReadEventLogW ReadEventLog;
  4375  // #else
  4376  // #...
  4377  // #endif // !UNICODE
  4378  
  4379  extern(Windows) export BOOL ReportEventA(
  4380    HANDLE hEventLog,
  4381    WORD wType,
  4382    WORD wCategory,
  4383    DWORD dwEventID,
  4384    PSID lpUserSid,
  4385    WORD wNumStrings,
  4386    DWORD dwDataSize,
  4387    LPCSTR *lpStrings,
  4388    LPVOID lpRawData);
  4389  extern(Windows) export BOOL ReportEventW(
  4390    HANDLE hEventLog,
  4391    WORD wType,
  4392    WORD wCategory,
  4393    DWORD dwEventID,
  4394    PSID lpUserSid,
  4395    WORD wNumStrings,
  4396    DWORD dwDataSize,
  4397    LPCWSTR *lpStrings,
  4398    LPVOID lpRawData);
  4399  // #ifdef UNICODE
  4400  alias ReportEventW ReportEvent;
  4401  // #else
  4402  // #...
  4403  // #endif // !UNICODE
  4404  
  4405  enum : uint { EVENTLOG_FULL_INFO = 0 }
  4406  
  4407  struct _EVENTLOG_FULL_INFORMATION {
  4408    DWORD dwFull;
  4409  }
  4410  alias _EVENTLOG_FULL_INFORMATION EVENTLOG_FULL_INFORMATION;
  4411  alias _EVENTLOG_FULL_INFORMATION* LPEVENTLOG_FULL_INFORMATION;
  4412  
  4413  extern(Windows) export BOOL GetEventLogInformation(
  4414    HANDLE hEventLog,
  4415    DWORD dwInfoLevel,
  4416    LPVOID lpBuffer,
  4417    DWORD cbBufSize,
  4418    LPDWORD pcbBytesNeeded);
  4419  
  4420  extern(Windows) export BOOL DuplicateToken(
  4421    HANDLE ExistingTokenHandle,
  4422    SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
  4423    PHANDLE DuplicateTokenHandle);
  4424  
  4425  extern(Windows) export BOOL GetKernelObjectSecurity(
  4426    HANDLE Handle,
  4427    SECURITY_INFORMATION RequestedInformation,
  4428    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  4429    DWORD nLength,
  4430    LPDWORD lpnLengthNeeded);
  4431  
  4432  extern(Windows) export BOOL ImpersonateNamedPipeClient(
  4433    HANDLE hNamedPipe);
  4434  
  4435  extern(Windows) export BOOL ImpersonateSelf(
  4436    SECURITY_IMPERSONATION_LEVEL ImpersonationLevel);
  4437  
  4438  extern(Windows) export BOOL RevertToSelf();
  4439  
  4440  extern(Windows) export BOOL SetThreadToken(
  4441    PHANDLE Thread,
  4442    HANDLE Token);
  4443  
  4444  extern(Windows) export BOOL AccessCheck(
  4445    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  4446    HANDLE ClientToken,
  4447    DWORD DesiredAccess,
  4448    PGENERIC_MAPPING GenericMapping,
  4449    PPRIVILEGE_SET PrivilegeSet,
  4450    LPDWORD PrivilegeSetLength,
  4451    LPDWORD GrantedAccess,
  4452    LPBOOL AccessStatus);
  4453  
  4454  // #if(_WIN32_WINNT >= 0x0500)
  4455  extern(Windows) export BOOL AccessCheckByType(
  4456    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  4457    PSID PrincipalSelfSid,
  4458    HANDLE ClientToken,
  4459    DWORD DesiredAccess,
  4460    POBJECT_TYPE_LIST ObjectTypeList,
  4461    DWORD ObjectTypeListLength,
  4462    PGENERIC_MAPPING GenericMapping,
  4463    PPRIVILEGE_SET PrivilegeSet,
  4464    LPDWORD PrivilegeSetLength,
  4465    LPDWORD GrantedAccess,
  4466    LPBOOL AccessStatus);
  4467  
  4468  extern(Windows) export BOOL AccessCheckByTypeResultList(
  4469    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  4470    PSID PrincipalSelfSid,
  4471    HANDLE ClientToken,
  4472    DWORD DesiredAccess,
  4473    POBJECT_TYPE_LIST ObjectTypeList,
  4474    DWORD ObjectTypeListLength,
  4475    PGENERIC_MAPPING GenericMapping,
  4476    PPRIVILEGE_SET PrivilegeSet,
  4477    LPDWORD PrivilegeSetLength,
  4478    LPDWORD GrantedAccessList,
  4479    LPDWORD AccessStatusList);
  4480  // #endif /* _WIN32_WINNT >=  0x0500 */
  4481  
  4482  extern(Windows) export BOOL OpenProcessToken(
  4483    HANDLE ProcessHandle,
  4484    DWORD DesiredAccess,
  4485    PHANDLE TokenHandle);
  4486  
  4487  extern(Windows) export BOOL OpenThreadToken(
  4488    HANDLE ThreadHandle,
  4489    DWORD DesiredAccess,
  4490    BOOL OpenAsSelf,
  4491    PHANDLE TokenHandle);
  4492  
  4493  extern(Windows) export BOOL GetTokenInformation(
  4494    HANDLE TokenHandle,
  4495    TOKEN_INFORMATION_CLASS TokenInformationClass,
  4496    LPVOID TokenInformation,
  4497    DWORD TokenInformationLength,
  4498    PDWORD ReturnLength);
  4499  
  4500  extern(Windows) export BOOL SetTokenInformation(
  4501    HANDLE TokenHandle,
  4502    TOKEN_INFORMATION_CLASS TokenInformationClass,
  4503    LPVOID TokenInformation,
  4504    DWORD TokenInformationLength);
  4505  
  4506  extern(Windows) export BOOL AdjustTokenPrivileges(
  4507    HANDLE TokenHandle,
  4508    BOOL DisableAllPrivileges,
  4509    PTOKEN_PRIVILEGES NewState,
  4510    DWORD BufferLength,
  4511    PTOKEN_PRIVILEGES PreviousState,
  4512    PDWORD ReturnLength);
  4513  
  4514  extern(Windows) export BOOL AdjustTokenGroups(
  4515    HANDLE TokenHandle,
  4516    BOOL ResetToDefault,
  4517    PTOKEN_GROUPS NewState,
  4518    DWORD BufferLength,
  4519    PTOKEN_GROUPS PreviousState,
  4520    PDWORD ReturnLength);
  4521  
  4522  extern(Windows) export BOOL PrivilegeCheck(
  4523    HANDLE ClientToken,
  4524    PPRIVILEGE_SET RequiredPrivileges,
  4525    LPBOOL pfResult);
  4526  
  4527  extern(Windows) export BOOL AccessCheckAndAuditAlarmA(
  4528    LPCSTR SubsystemName,
  4529    LPVOID HandleId,
  4530    LPSTR ObjectTypeName,
  4531    LPSTR ObjectName,
  4532    PSECURITY_DESCRIPTOR SecurityDescriptor,
  4533    DWORD DesiredAccess,
  4534    PGENERIC_MAPPING GenericMapping,
  4535    BOOL ObjectCreation,
  4536    LPDWORD GrantedAccess,
  4537    LPBOOL AccessStatus,
  4538    LPBOOL pfGenerateOnClose);
  4539  extern(Windows) export BOOL AccessCheckAndAuditAlarmW(
  4540    LPCWSTR SubsystemName,
  4541    LPVOID HandleId,
  4542    LPWSTR ObjectTypeName,
  4543    LPWSTR ObjectName,
  4544    PSECURITY_DESCRIPTOR SecurityDescriptor,
  4545    DWORD DesiredAccess,
  4546    PGENERIC_MAPPING GenericMapping,
  4547    BOOL ObjectCreation,
  4548    LPDWORD GrantedAccess,
  4549    LPBOOL AccessStatus,
  4550    LPBOOL pfGenerateOnClose);
  4551  // #ifdef UNICODE
  4552  alias AccessCheckAndAuditAlarmW AccessCheckAndAuditAlarm;
  4553  // #else
  4554  // #...
  4555  // #endif // !UNICODE
  4556  
  4557  // #if(_WIN32_WINNT >= 0x0500)
  4558  
  4559  extern(Windows) export BOOL AccessCheckByTypeAndAuditAlarmA(
  4560    LPCSTR SubsystemName,
  4561    LPVOID HandleId,
  4562    LPCSTR ObjectTypeName,
  4563    LPCSTR ObjectName,
  4564    PSECURITY_DESCRIPTOR SecurityDescriptor,
  4565    PSID PrincipalSelfSid,
  4566    DWORD DesiredAccess,
  4567    AUDIT_EVENT_TYPE AuditType,
  4568    DWORD Flags,
  4569    POBJECT_TYPE_LIST ObjectTypeList,
  4570    DWORD ObjectTypeListLength,
  4571    PGENERIC_MAPPING GenericMapping,
  4572    BOOL ObjectCreation,
  4573    LPDWORD GrantedAccess,
  4574    LPBOOL AccessStatus,
  4575    LPBOOL pfGenerateOnClose);
  4576  extern(Windows) export BOOL AccessCheckByTypeAndAuditAlarmW(
  4577    LPCWSTR SubsystemName,
  4578    LPVOID HandleId,
  4579    LPCWSTR ObjectTypeName,
  4580    LPCWSTR ObjectName,
  4581    PSECURITY_DESCRIPTOR SecurityDescriptor,
  4582    PSID PrincipalSelfSid,
  4583    DWORD DesiredAccess,
  4584    AUDIT_EVENT_TYPE AuditType,
  4585    DWORD Flags,
  4586    POBJECT_TYPE_LIST ObjectTypeList,
  4587    DWORD ObjectTypeListLength,
  4588    PGENERIC_MAPPING GenericMapping,
  4589    BOOL ObjectCreation,
  4590    LPDWORD GrantedAccess,
  4591    LPBOOL AccessStatus,
  4592    LPBOOL pfGenerateOnClose);
  4593  // #ifdef UNICODE
  4594  alias AccessCheckByTypeAndAuditAlarmW AccessCheckByTypeAndAuditAlarm;
  4595  // #else
  4596  // #...
  4597  // #endif // !UNICODE
  4598  
  4599  extern(Windows) export BOOL AccessCheckByTypeResultListAndAuditAlarmA(
  4600    LPCSTR SubsystemName,
  4601    LPVOID HandleId,
  4602    LPCSTR ObjectTypeName,
  4603    LPCSTR ObjectName,
  4604    PSECURITY_DESCRIPTOR SecurityDescriptor,
  4605    PSID PrincipalSelfSid,
  4606    DWORD DesiredAccess,
  4607    AUDIT_EVENT_TYPE AuditType,
  4608    DWORD Flags,
  4609    POBJECT_TYPE_LIST ObjectTypeList,
  4610    DWORD ObjectTypeListLength,
  4611    PGENERIC_MAPPING GenericMapping,
  4612    BOOL ObjectCreation,
  4613    LPDWORD GrantedAccess,
  4614    LPDWORD AccessStatusList,
  4615    LPBOOL pfGenerateOnClose);
  4616  extern(Windows) export BOOL AccessCheckByTypeResultListAndAuditAlarmW(
  4617    LPCWSTR SubsystemName,
  4618    LPVOID HandleId,
  4619    LPCWSTR ObjectTypeName,
  4620    LPCWSTR ObjectName,
  4621    PSECURITY_DESCRIPTOR SecurityDescriptor,
  4622    PSID PrincipalSelfSid,
  4623    DWORD DesiredAccess,
  4624    AUDIT_EVENT_TYPE AuditType,
  4625    DWORD Flags,
  4626    POBJECT_TYPE_LIST ObjectTypeList,
  4627    DWORD ObjectTypeListLength,
  4628    PGENERIC_MAPPING GenericMapping,
  4629    BOOL ObjectCreation,
  4630    LPDWORD GrantedAccess,
  4631    LPDWORD AccessStatusList,
  4632    LPBOOL pfGenerateOnClose);
  4633  // #ifdef UNICODE
  4634  alias AccessCheckByTypeResultListAndAuditAlarmW AccessCheckByTypeResultListAndAuditAlarm;
  4635  // #else
  4636  // #...
  4637  // #endif // !UNICODE
  4638  
  4639  extern(Windows) export BOOL AccessCheckByTypeResultListAndAuditAlarmByHandleA(
  4640    LPCSTR SubsystemName,
  4641    LPVOID HandleId,
  4642    HANDLE ClientToken,
  4643    LPCSTR ObjectTypeName,
  4644    LPCSTR ObjectName,
  4645    PSECURITY_DESCRIPTOR SecurityDescriptor,
  4646    PSID PrincipalSelfSid,
  4647    DWORD DesiredAccess,
  4648    AUDIT_EVENT_TYPE AuditType,
  4649    DWORD Flags,
  4650    POBJECT_TYPE_LIST ObjectTypeList,
  4651    DWORD ObjectTypeListLength,
  4652    PGENERIC_MAPPING GenericMapping,
  4653    BOOL ObjectCreation,
  4654    LPDWORD GrantedAccess,
  4655    LPDWORD AccessStatusList,
  4656    LPBOOL pfGenerateOnClose);
  4657  extern(Windows) export BOOL AccessCheckByTypeResultListAndAuditAlarmByHandleW(
  4658    LPCWSTR SubsystemName,
  4659    LPVOID HandleId,
  4660    HANDLE ClientToken,
  4661    LPCWSTR ObjectTypeName,
  4662    LPCWSTR ObjectName,
  4663    PSECURITY_DESCRIPTOR SecurityDescriptor,
  4664    PSID PrincipalSelfSid,
  4665    DWORD DesiredAccess,
  4666    AUDIT_EVENT_TYPE AuditType,
  4667    DWORD Flags,
  4668    POBJECT_TYPE_LIST ObjectTypeList,
  4669    DWORD ObjectTypeListLength,
  4670    PGENERIC_MAPPING GenericMapping,
  4671    BOOL ObjectCreation,
  4672    LPDWORD GrantedAccess,
  4673    LPDWORD AccessStatusList,
  4674    LPBOOL pfGenerateOnClose);
  4675  // #ifdef UNICODE
  4676  alias AccessCheckByTypeResultListAndAuditAlarmByHandleW AccessCheckByTypeResultListAndAuditAlarmByHandle;
  4677  // #else
  4678  // #...
  4679  // #endif // !UNICODE
  4680  
  4681  // #endif //(_WIN32_WINNT >= 0x0500)
  4682  
  4683  extern(Windows) export BOOL ObjectOpenAuditAlarmA(
  4684    LPCSTR SubsystemName,
  4685    LPVOID HandleId,
  4686    LPSTR ObjectTypeName,
  4687    LPSTR ObjectName,
  4688    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  4689    HANDLE ClientToken,
  4690    DWORD DesiredAccess,
  4691    DWORD GrantedAccess,
  4692    PPRIVILEGE_SET Privileges,
  4693    BOOL ObjectCreation,
  4694    BOOL AccessGranted,
  4695    LPBOOL GenerateOnClose);
  4696  extern(Windows) export BOOL ObjectOpenAuditAlarmW(
  4697    LPCWSTR SubsystemName,
  4698    LPVOID HandleId,
  4699    LPWSTR ObjectTypeName,
  4700    LPWSTR ObjectName,
  4701    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  4702    HANDLE ClientToken,
  4703    DWORD DesiredAccess,
  4704    DWORD GrantedAccess,
  4705    PPRIVILEGE_SET Privileges,
  4706    BOOL ObjectCreation,
  4707    BOOL AccessGranted,
  4708    LPBOOL GenerateOnClose);
  4709  // #ifdef UNICODE
  4710  alias ObjectOpenAuditAlarmW ObjectOpenAuditAlarm;
  4711  // #else
  4712  // #...
  4713  // #endif // !UNICODE
  4714  
  4715  extern(Windows) export BOOL ObjectPrivilegeAuditAlarmA(
  4716    LPCSTR SubsystemName,
  4717    LPVOID HandleId,
  4718    HANDLE ClientToken,
  4719    DWORD DesiredAccess,
  4720    PPRIVILEGE_SET Privileges,
  4721    BOOL AccessGranted);
  4722  extern(Windows) export BOOL ObjectPrivilegeAuditAlarmW(
  4723    LPCWSTR SubsystemName,
  4724    LPVOID HandleId,
  4725    HANDLE ClientToken,
  4726    DWORD DesiredAccess,
  4727    PPRIVILEGE_SET Privileges,
  4728    BOOL AccessGranted);
  4729  // #ifdef UNICODE
  4730  alias ObjectPrivilegeAuditAlarmW ObjectPrivilegeAuditAlarm;
  4731  // #else
  4732  // #...
  4733  // #endif // !UNICODE
  4734  
  4735  extern(Windows) export BOOL ObjectCloseAuditAlarmA(
  4736    LPCSTR SubsystemName,
  4737    LPVOID HandleId,
  4738    BOOL GenerateOnClose);
  4739  extern(Windows) export BOOL ObjectCloseAuditAlarmW(
  4740    LPCWSTR SubsystemName,
  4741    LPVOID HandleId,
  4742    BOOL GenerateOnClose);
  4743  // #ifdef UNICODE
  4744  alias ObjectCloseAuditAlarmW ObjectCloseAuditAlarm;
  4745  // #else
  4746  // #...
  4747  // #endif // !UNICODE
  4748  
  4749  extern(Windows) export BOOL ObjectDeleteAuditAlarmA(
  4750    LPCSTR SubsystemName,
  4751    LPVOID HandleId,
  4752    BOOL GenerateOnClose);
  4753  extern(Windows) export BOOL ObjectDeleteAuditAlarmW(
  4754    LPCWSTR SubsystemName,
  4755    LPVOID HandleId,
  4756    BOOL GenerateOnClose);
  4757  // #ifdef UNICODE
  4758  alias ObjectDeleteAuditAlarmW ObjectDeleteAuditAlarm;
  4759  // #else
  4760  // #...
  4761  // #endif // !UNICODE
  4762  
  4763  extern(Windows) export BOOL PrivilegedServiceAuditAlarmA(
  4764    LPCSTR SubsystemName,
  4765    LPCSTR ServiceName,
  4766    HANDLE ClientToken,
  4767    PPRIVILEGE_SET Privileges,
  4768    BOOL AccessGranted);
  4769  extern(Windows) export BOOL PrivilegedServiceAuditAlarmW(
  4770    LPCWSTR SubsystemName,
  4771    LPCWSTR ServiceName,
  4772    HANDLE ClientToken,
  4773    PPRIVILEGE_SET Privileges,
  4774    BOOL AccessGranted);
  4775  // #ifdef UNICODE
  4776  alias PrivilegedServiceAuditAlarmW PrivilegedServiceAuditAlarm;
  4777  // #else
  4778  // #...
  4779  // #endif // !UNICODE
  4780  
  4781  // #if(_WIN32_WINNT >= 0x0501)
  4782  
  4783  enum _0 {
  4784  
  4785    WinNullSid = 0,
  4786    WinWorldSid = 1,
  4787    WinLocalSid = 2,
  4788    WinCreatorOwnerSid = 3,
  4789    WinCreatorGroupSid = 4,
  4790    WinCreatorOwnerServerSid = 5,
  4791    WinCreatorGroupServerSid = 6,
  4792    WinNtAuthoritySid = 7,
  4793    WinDialupSid = 8,
  4794    WinNetworkSid = 9,
  4795    WinBatchSid = 10,
  4796    WinInteractiveSid = 11,
  4797    WinServiceSid = 12,
  4798    WinAnonymousSid = 13,
  4799    WinProxySid = 14,
  4800    WinEnterpriseControllersSid = 15,
  4801    WinSelfSid = 16,
  4802    WinAuthenticatedUserSid = 17,
  4803    WinRestrictedCodeSid = 18,
  4804    WinTerminalServerSid = 19,
  4805    WinRemoteLogonIdSid = 20,
  4806    WinLogonIdsSid = 21,
  4807    WinLocalSystemSid = 22,
  4808    WinLocalServiceSid = 23,
  4809    WinNetworkServiceSid = 24,
  4810    WinBuiltinDomainSid = 25,
  4811    WinBuiltinAdministratorsSid = 26,
  4812    WinBuiltinUsersSid = 27,
  4813    WinBuiltinGuestsSid = 28,
  4814    WinBuiltinPowerUsersSid = 29,
  4815    WinBuiltinAccountOperatorsSid = 30,
  4816    WinBuiltinSystemOperatorsSid = 31,
  4817    WinBuiltinPrintOperatorsSid = 32,
  4818    WinBuiltinBackupOperatorsSid = 33,
  4819    WinBuiltinReplicatorSid = 34,
  4820    WinBuiltinPreWindows2000CompatibleAccessSid = 35,
  4821    WinBuiltinRemoteDesktopUsersSid = 36,
  4822    WinBuiltinNetworkConfigurationOperatorsSid = 37,
  4823    WinAccountAdministratorSid = 38,
  4824    WinAccountGuestSid = 39,
  4825    WinAccountKrbtgtSid = 40,
  4826    WinAccountDomainAdminsSid = 41,
  4827    WinAccountDomainUsersSid = 42,
  4828    WinAccountDomainGuestsSid = 43,
  4829    WinAccountComputersSid = 44,
  4830    WinAccountControllersSid = 45,
  4831    WinAccountCertAdminsSid = 46,
  4832    WinAccountSchemaAdminsSid = 47,
  4833    WinAccountEnterpriseAdminsSid = 48,
  4834    WinAccountPolicyAdminsSid = 49,
  4835    WinAccountRasAndIasServersSid = 50,
  4836  
  4837  }
  4838  alias _0 WELL_KNOWN_SID_TYPE;
  4839  
  4840  extern(Windows) export BOOL IsWellKnownSid(
  4841    PSID pSid,
  4842    WELL_KNOWN_SID_TYPE WellKnownSidType);
  4843  
  4844  extern(Windows) export BOOL CreateWellKnownSid(
  4845    WELL_KNOWN_SID_TYPE WellKnownSidType,
  4846    PSID DomainSid ,
  4847    PSID pSid,
  4848    DWORD *cbSid);
  4849  
  4850  extern(Windows) export BOOL EqualDomainSid(
  4851    PSID pSid1,
  4852    PSID pSid2,
  4853    BOOL *pfEqual);
  4854  
  4855  extern(Windows) export BOOL GetWindowsAccountDomainSid(
  4856    PSID pSid,
  4857    PSID ppDomainSid ,
  4858    DWORD *cbSid);
  4859  
  4860  // #endif //(_WIN32_WINNT >= 0x0501)
  4861  
  4862  extern(Windows) export BOOL IsValidSid(
  4863    PSID pSid);
  4864  
  4865  extern(Windows) export BOOL EqualSid(
  4866    PSID pSid1,
  4867    PSID pSid2);
  4868  
  4869  extern(Windows) export BOOL EqualPrefixSid(
  4870    PSID pSid1,
  4871    PSID pSid2);
  4872  
  4873  extern(Windows) export DWORD GetSidLengthRequired(
  4874    UCHAR nSubAuthorityCount);
  4875  
  4876  extern(Windows) export BOOL AllocateAndInitializeSid(
  4877    PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
  4878    BYTE nSubAuthorityCount,
  4879    DWORD nSubAuthority0,
  4880    DWORD nSubAuthority1,
  4881    DWORD nSubAuthority2,
  4882    DWORD nSubAuthority3,
  4883    DWORD nSubAuthority4,
  4884    DWORD nSubAuthority5,
  4885    DWORD nSubAuthority6,
  4886    DWORD nSubAuthority7,
  4887    PSID *pSid);
  4888  
  4889  extern(Windows) export PVOID FreeSid(
  4890    PSID pSid);
  4891  
  4892  extern(Windows) export BOOL InitializeSid(
  4893    PSID Sid,
  4894    PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
  4895    BYTE nSubAuthorityCount);
  4896  
  4897  extern(Windows) export PSID_IDENTIFIER_AUTHORITY GetSidIdentifierAuthority(
  4898    PSID pSid);
  4899  
  4900  extern(Windows) export PDWORD GetSidSubAuthority(
  4901    PSID pSid,
  4902    DWORD nSubAuthority);
  4903  
  4904  extern(Windows) export PUCHAR GetSidSubAuthorityCount(
  4905    PSID pSid);
  4906  
  4907  extern(Windows) export DWORD GetLengthSid(
  4908    PSID pSid);
  4909  
  4910  extern(Windows) export BOOL CopySid(
  4911    DWORD nDestinationSidLength,
  4912    PSID pDestinationSid,
  4913    PSID pSourceSid);
  4914  
  4915  extern(Windows) export BOOL AreAllAccessesGranted(
  4916    DWORD GrantedAccess,
  4917    DWORD DesiredAccess);
  4918  
  4919  extern(Windows) export BOOL AreAnyAccessesGranted(
  4920    DWORD GrantedAccess,
  4921    DWORD DesiredAccess);
  4922  
  4923  extern(Windows) export VOID MapGenericMask(
  4924    PDWORD AccessMask,
  4925    PGENERIC_MAPPING GenericMapping);
  4926  
  4927  extern(Windows) export BOOL IsValidAcl(
  4928    PACL pAcl);
  4929  
  4930  extern(Windows) export BOOL InitializeAcl(
  4931    PACL pAcl,
  4932    DWORD nAclLength,
  4933    DWORD dwAclRevision);
  4934  
  4935  extern(Windows) export BOOL GetAclInformation(
  4936    PACL pAcl,
  4937    LPVOID pAclInformation,
  4938    DWORD nAclInformationLength,
  4939    ACL_INFORMATION_CLASS dwAclInformationClass);
  4940  
  4941  extern(Windows) export BOOL SetAclInformation(
  4942    PACL pAcl,
  4943    LPVOID pAclInformation,
  4944    DWORD nAclInformationLength,
  4945    ACL_INFORMATION_CLASS dwAclInformationClass);
  4946  
  4947  extern(Windows) export BOOL AddAce(
  4948    PACL pAcl,
  4949    DWORD dwAceRevision,
  4950    DWORD dwStartingAceIndex,
  4951    LPVOID pAceList,
  4952    DWORD nAceListLength);
  4953  
  4954  extern(Windows) export BOOL DeleteAce(
  4955    PACL pAcl,
  4956    DWORD dwAceIndex);
  4957  
  4958  extern(Windows) export BOOL GetAce(
  4959    PACL pAcl,
  4960    DWORD dwAceIndex,
  4961    LPVOID *pAce);
  4962  
  4963  extern(Windows) export BOOL AddAccessAllowedAce(
  4964    PACL pAcl,
  4965    DWORD dwAceRevision,
  4966    DWORD AccessMask,
  4967    PSID pSid);
  4968  
  4969  // #if(_WIN32_WINNT >= 0x0500)
  4970  extern(Windows) export BOOL AddAccessAllowedAceEx(
  4971    PACL pAcl,
  4972    DWORD dwAceRevision,
  4973    DWORD AceFlags,
  4974    DWORD AccessMask,
  4975    PSID pSid);
  4976  // #endif /* _WIN32_WINNT >=  0x0500 */
  4977  
  4978  extern(Windows) export BOOL AddAccessDeniedAce(
  4979    PACL pAcl,
  4980    DWORD dwAceRevision,
  4981    DWORD AccessMask,
  4982    PSID pSid);
  4983  
  4984  // #if(_WIN32_WINNT >= 0x0500)
  4985  extern(Windows) export BOOL AddAccessDeniedAceEx(
  4986    PACL pAcl,
  4987    DWORD dwAceRevision,
  4988    DWORD AceFlags,
  4989    DWORD AccessMask,
  4990    PSID pSid);
  4991  // #endif /* _WIN32_WINNT >=  0x0500 */
  4992  
  4993  extern(Windows) export BOOL AddAuditAccessAce(
  4994    PACL pAcl,
  4995    DWORD dwAceRevision,
  4996    DWORD dwAccessMask,
  4997    PSID pSid,
  4998    BOOL bAuditSuccess,
  4999    BOOL bAuditFailure);
  5000  
  5001  // #if(_WIN32_WINNT >= 0x0500)
  5002  extern(Windows) export BOOL AddAuditAccessAceEx(
  5003    PACL pAcl,
  5004    DWORD dwAceRevision,
  5005    DWORD AceFlags,
  5006    DWORD dwAccessMask,
  5007    PSID pSid,
  5008    BOOL bAuditSuccess,
  5009    BOOL bAuditFailure);
  5010  
  5011  extern(Windows) export BOOL AddAccessAllowedObjectAce(
  5012    PACL pAcl,
  5013    DWORD dwAceRevision,
  5014    DWORD AceFlags,
  5015    DWORD AccessMask,
  5016    GUID *ObjectTypeGuid,
  5017    GUID *InheritedObjectTypeGuid,
  5018    PSID pSid);
  5019  
  5020  extern(Windows) export BOOL AddAccessDeniedObjectAce(
  5021    PACL pAcl,
  5022    DWORD dwAceRevision,
  5023    DWORD AceFlags,
  5024    DWORD AccessMask,
  5025    GUID *ObjectTypeGuid,
  5026    GUID *InheritedObjectTypeGuid,
  5027    PSID pSid);
  5028  
  5029  extern(Windows) export BOOL AddAuditAccessObjectAce(
  5030    PACL pAcl,
  5031    DWORD dwAceRevision,
  5032    DWORD AceFlags,
  5033    DWORD AccessMask,
  5034    GUID *ObjectTypeGuid,
  5035    GUID *InheritedObjectTypeGuid,
  5036    PSID pSid,
  5037    BOOL bAuditSuccess,
  5038    BOOL bAuditFailure);
  5039  // #endif /* _WIN32_WINNT >=  0x0500 */
  5040  
  5041  extern(Windows) export BOOL FindFirstFreeAce(
  5042    PACL pAcl,
  5043    LPVOID *pAce);
  5044  
  5045  extern(Windows) export BOOL InitializeSecurityDescriptor(
  5046    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  5047    DWORD dwRevision);
  5048  
  5049  extern(Windows) export BOOL IsValidSecurityDescriptor(
  5050    PSECURITY_DESCRIPTOR pSecurityDescriptor);
  5051  
  5052  extern(Windows) export DWORD GetSecurityDescriptorLength(
  5053    PSECURITY_DESCRIPTOR pSecurityDescriptor);
  5054  
  5055  extern(Windows) export BOOL GetSecurityDescriptorControl(
  5056    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  5057    PSECURITY_DESCRIPTOR_CONTROL pControl,
  5058    LPDWORD lpdwRevision);
  5059  
  5060  // #if(_WIN32_WINNT >= 0x0500)
  5061  extern(Windows) export BOOL SetSecurityDescriptorControl(
  5062    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  5063    SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
  5064    SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet);
  5065  // #endif /* _WIN32_WINNT >=  0x0500 */
  5066  
  5067  extern(Windows) export BOOL SetSecurityDescriptorDacl(
  5068    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  5069    BOOL bDaclPresent,
  5070    PACL pDacl,
  5071    BOOL bDaclDefaulted);
  5072  
  5073  extern(Windows) export BOOL GetSecurityDescriptorDacl(
  5074    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  5075    LPBOOL lpbDaclPresent,
  5076    PACL *pDacl,
  5077    LPBOOL lpbDaclDefaulted);
  5078  
  5079  extern(Windows) export BOOL SetSecurityDescriptorSacl(
  5080    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  5081    BOOL bSaclPresent,
  5082    PACL pSacl,
  5083    BOOL bSaclDefaulted);
  5084  
  5085  extern(Windows) export BOOL GetSecurityDescriptorSacl(
  5086    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  5087    LPBOOL lpbSaclPresent,
  5088    PACL *pSacl,
  5089    LPBOOL lpbSaclDefaulted);
  5090  
  5091  extern(Windows) export BOOL SetSecurityDescriptorOwner(
  5092    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  5093    PSID pOwner,
  5094    BOOL bOwnerDefaulted);
  5095  
  5096  extern(Windows) export BOOL GetSecurityDescriptorOwner(
  5097    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  5098    PSID *pOwner,
  5099    LPBOOL lpbOwnerDefaulted);
  5100  
  5101  extern(Windows) export BOOL SetSecurityDescriptorGroup(
  5102    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  5103    PSID pGroup,
  5104    BOOL bGroupDefaulted);
  5105  
  5106  extern(Windows) export BOOL GetSecurityDescriptorGroup(
  5107    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  5108    PSID *pGroup,
  5109    LPBOOL lpbGroupDefaulted);
  5110  
  5111  extern(Windows) export DWORD SetSecurityDescriptorRMControl(
  5112    PSECURITY_DESCRIPTOR SecurityDescriptor,
  5113    PUCHAR RMControl );
  5114  
  5115  extern(Windows) export DWORD GetSecurityDescriptorRMControl(
  5116    PSECURITY_DESCRIPTOR SecurityDescriptor,
  5117    PUCHAR RMControl);
  5118  
  5119  extern(Windows) export BOOL CreatePrivateObjectSecurity(
  5120    PSECURITY_DESCRIPTOR ParentDescriptor,
  5121    PSECURITY_DESCRIPTOR CreatorDescriptor,
  5122    PSECURITY_DESCRIPTOR * NewDescriptor,
  5123    BOOL IsDirectoryObject,
  5124    HANDLE Token,
  5125    PGENERIC_MAPPING GenericMapping);
  5126  
  5127  // #if(_WIN32_WINNT >= 0x0500)
  5128  extern(Windows) export BOOL ConvertToAutoInheritPrivateObjectSecurity(
  5129    PSECURITY_DESCRIPTOR ParentDescriptor,
  5130    PSECURITY_DESCRIPTOR CurrentSecurityDescriptor,
  5131    PSECURITY_DESCRIPTOR *NewSecurityDescriptor,
  5132    GUID *ObjectType,
  5133    BOOLEAN IsDirectoryObject,
  5134    PGENERIC_MAPPING GenericMapping);
  5135  
  5136  extern(Windows) export BOOL CreatePrivateObjectSecurityEx(
  5137    PSECURITY_DESCRIPTOR ParentDescriptor,
  5138    PSECURITY_DESCRIPTOR CreatorDescriptor,
  5139    PSECURITY_DESCRIPTOR * NewDescriptor,
  5140    GUID *ObjectType ,
  5141    BOOL IsContainerObject,
  5142    ULONG AutoInheritFlags,
  5143    HANDLE Token,
  5144    PGENERIC_MAPPING GenericMapping);
  5145  
  5146  extern(Windows) export BOOL CreatePrivateObjectSecurityWithMultipleInheritance(
  5147    PSECURITY_DESCRIPTOR ParentDescriptor,
  5148    PSECURITY_DESCRIPTOR CreatorDescriptor,
  5149    PSECURITY_DESCRIPTOR * NewDescriptor,
  5150    GUID **ObjectTypes ,
  5151    ULONG GuidCount,
  5152    BOOL IsContainerObject,
  5153    ULONG AutoInheritFlags,
  5154    HANDLE Token,
  5155    PGENERIC_MAPPING GenericMapping);
  5156  // #endif /* _WIN32_WINNT >=  0x0500 */
  5157  
  5158  extern(Windows) export BOOL SetPrivateObjectSecurity(
  5159    SECURITY_INFORMATION SecurityInformation,
  5160    PSECURITY_DESCRIPTOR ModificationDescriptor,
  5161    PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,
  5162    PGENERIC_MAPPING GenericMapping,
  5163    HANDLE Token);
  5164  
  5165  // #if(_WIN32_WINNT >= 0x0500)
  5166  extern(Windows) export BOOL SetPrivateObjectSecurityEx(
  5167    SECURITY_INFORMATION SecurityInformation,
  5168    PSECURITY_DESCRIPTOR ModificationDescriptor,
  5169    PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,
  5170    ULONG AutoInheritFlags,
  5171    PGENERIC_MAPPING GenericMapping,
  5172    HANDLE Token );
  5173  // #endif /* _WIN32_WINNT >=  0x0500 */
  5174  
  5175  extern(Windows) export BOOL GetPrivateObjectSecurity(
  5176    PSECURITY_DESCRIPTOR ObjectDescriptor,
  5177    SECURITY_INFORMATION SecurityInformation,
  5178    PSECURITY_DESCRIPTOR ResultantDescriptor,
  5179    DWORD DescriptorLength,
  5180    PDWORD ReturnLength);
  5181  
  5182  extern(Windows) export BOOL DestroyPrivateObjectSecurity(
  5183    PSECURITY_DESCRIPTOR * ObjectDescriptor);
  5184  
  5185  extern(Windows) export BOOL MakeSelfRelativeSD(
  5186    PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
  5187    PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
  5188    LPDWORD lpdwBufferLength);
  5189  
  5190  extern(Windows) export BOOL MakeAbsoluteSD(
  5191    PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
  5192    PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
  5193    LPDWORD lpdwAbsoluteSecurityDescriptorSize,
  5194    PACL pDacl,
  5195    LPDWORD lpdwDaclSize,
  5196    PACL pSacl,
  5197    LPDWORD lpdwSaclSize,
  5198    PSID pOwner,
  5199    LPDWORD lpdwOwnerSize,
  5200    PSID pPrimaryGroup,
  5201    LPDWORD lpdwPrimaryGroupSize);
  5202  
  5203  extern(Windows) export BOOL MakeAbsoluteSD2(
  5204    PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
  5205    LPDWORD lpdwBufferSize);
  5206  
  5207  extern(Windows) export BOOL SetFileSecurityA(
  5208    LPCSTR lpFileName,
  5209    SECURITY_INFORMATION SecurityInformation,
  5210    PSECURITY_DESCRIPTOR pSecurityDescriptor);
  5211  extern(Windows) export BOOL SetFileSecurityW(
  5212    LPCWSTR lpFileName,
  5213    SECURITY_INFORMATION SecurityInformation,
  5214    PSECURITY_DESCRIPTOR pSecurityDescriptor);
  5215  // #ifdef UNICODE
  5216  alias SetFileSecurityW SetFileSecurity;
  5217  // #else
  5218  // #...
  5219  // #endif // !UNICODE
  5220  
  5221  extern(Windows) export BOOL GetFileSecurityA(
  5222    LPCSTR lpFileName,
  5223    SECURITY_INFORMATION RequestedInformation,
  5224    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  5225    DWORD nLength,
  5226    LPDWORD lpnLengthNeeded);
  5227  extern(Windows) export BOOL GetFileSecurityW(
  5228    LPCWSTR lpFileName,
  5229    SECURITY_INFORMATION RequestedInformation,
  5230    PSECURITY_DESCRIPTOR pSecurityDescriptor,
  5231    DWORD nLength,
  5232    LPDWORD lpnLengthNeeded);
  5233  // #ifdef UNICODE
  5234  alias GetFileSecurityW GetFileSecurity;
  5235  // #else
  5236  // #...
  5237  // #endif // !UNICODE
  5238  
  5239  extern(Windows) export BOOL SetKernelObjectSecurity(
  5240    HANDLE Handle,
  5241    SECURITY_INFORMATION SecurityInformation,
  5242    PSECURITY_DESCRIPTOR SecurityDescriptor);
  5243  
  5244  extern(Windows) export HANDLE FindFirstChangeNotificationA(
  5245    LPCSTR lpPathName,
  5246    BOOL bWatchSubtree,
  5247    DWORD dwNotifyFilter);
  5248  extern(Windows) export HANDLE FindFirstChangeNotificationW(
  5249    LPCWSTR lpPathName,
  5250    BOOL bWatchSubtree,
  5251    DWORD dwNotifyFilter);
  5252  // #ifdef UNICODE
  5253  alias FindFirstChangeNotificationW FindFirstChangeNotification;
  5254  // #else
  5255  // #...
  5256  // #endif // !UNICODE
  5257  
  5258  extern(Windows) export BOOL FindNextChangeNotification(
  5259    HANDLE hChangeHandle);
  5260  
  5261  extern(Windows) export BOOL FindCloseChangeNotification(
  5262    HANDLE hChangeHandle);
  5263  
  5264  // #if(_WIN32_WINNT >= 0x0400)
  5265  extern(Windows) export BOOL ReadDirectoryChangesW(
  5266    HANDLE hDirectory,
  5267    LPVOID lpBuffer,
  5268    DWORD nBufferLength,
  5269    BOOL bWatchSubtree,
  5270    DWORD dwNotifyFilter,
  5271    LPDWORD lpBytesReturned,
  5272    LPOVERLAPPED lpOverlapped,
  5273    LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
  5274  // #endif /* _WIN32_WINNT >= 0x0400 */
  5275  
  5276  extern(Windows) export BOOL VirtualLock(
  5277    LPVOID lpAddress,
  5278    SIZE_T dwSize);
  5279  
  5280  extern(Windows) export BOOL VirtualUnlock(
  5281    LPVOID lpAddress,
  5282    SIZE_T dwSize);
  5283  
  5284  extern(Windows) export LPVOID MapViewOfFileEx(
  5285    HANDLE hFileMappingObject,
  5286    DWORD dwDesiredAccess,
  5287    DWORD dwFileOffsetHigh,
  5288    DWORD dwFileOffsetLow,
  5289    SIZE_T dwNumberOfBytesToMap,
  5290    LPVOID lpBaseAddress);
  5291  
  5292  extern(Windows) export BOOL SetPriorityClass(
  5293    HANDLE hProcess,
  5294    DWORD dwPriorityClass);
  5295  
  5296  extern(Windows) export DWORD GetPriorityClass(
  5297    HANDLE hProcess);
  5298  
  5299  extern(Windows) export BOOL IsBadReadPtr(
  5300    VOID *lp,
  5301    UINT_PTR ucb);
  5302  
  5303  extern(Windows) export BOOL IsBadWritePtr(
  5304    LPVOID lp,
  5305    UINT_PTR ucb);
  5306  
  5307  extern(Windows) export BOOL IsBadHugeReadPtr(
  5308    VOID *lp,
  5309    UINT_PTR ucb);
  5310  
  5311  extern(Windows) export BOOL IsBadHugeWritePtr(
  5312    LPVOID lp,
  5313    UINT_PTR ucb);
  5314  
  5315  extern(Windows) export BOOL IsBadCodePtr(
  5316    FARPROC lpfn);
  5317  
  5318  extern(Windows) export BOOL IsBadStringPtrA(
  5319    LPCSTR lpsz,
  5320    UINT_PTR ucchMax);
  5321  extern(Windows) export BOOL IsBadStringPtrW(
  5322    LPCWSTR lpsz,
  5323    UINT_PTR ucchMax);
  5324  // #ifdef UNICODE
  5325  alias IsBadStringPtrW IsBadStringPtr;
  5326  // #else
  5327  // #...
  5328  // #endif // !UNICODE
  5329  
  5330  extern(Windows) export BOOL LookupAccountSidA(
  5331    LPCSTR lpSystemName,
  5332    PSID Sid,
  5333    LPSTR Name,
  5334    LPDWORD cbName,
  5335    LPSTR ReferencedDomainName,
  5336    LPDWORD cbReferencedDomainName,
  5337    PSID_NAME_USE peUse);
  5338  extern(Windows) export BOOL LookupAccountSidW(
  5339    LPCWSTR lpSystemName,
  5340    PSID Sid,
  5341    LPWSTR Name,
  5342    LPDWORD cbName,
  5343    LPWSTR ReferencedDomainName,
  5344    LPDWORD cbReferencedDomainName,
  5345    PSID_NAME_USE peUse);
  5346  // #ifdef UNICODE
  5347  alias LookupAccountSidW LookupAccountSid;
  5348  // #else
  5349  // #...
  5350  // #endif // !UNICODE
  5351  
  5352  extern(Windows) export BOOL LookupAccountNameA(
  5353    LPCSTR lpSystemName,
  5354    LPCSTR lpAccountName,
  5355    PSID Sid,
  5356    LPDWORD cbSid,
  5357    LPSTR ReferencedDomainName,
  5358    LPDWORD cbReferencedDomainName,
  5359    PSID_NAME_USE peUse);
  5360  extern(Windows) export BOOL LookupAccountNameW(
  5361    LPCWSTR lpSystemName,
  5362    LPCWSTR lpAccountName,
  5363    PSID Sid,
  5364    LPDWORD cbSid,
  5365    LPWSTR ReferencedDomainName,
  5366    LPDWORD cbReferencedDomainName,
  5367    PSID_NAME_USE peUse);
  5368  // #ifdef UNICODE
  5369  alias LookupAccountNameW LookupAccountName;
  5370  // #else
  5371  // #...
  5372  // #endif // !UNICODE
  5373  
  5374  extern(Windows) export BOOL LookupPrivilegeValueA(
  5375    LPCSTR lpSystemName,
  5376    LPCSTR lpName,
  5377    PLUID lpLuid);
  5378  extern(Windows) export BOOL LookupPrivilegeValueW(
  5379    LPCWSTR lpSystemName,
  5380    LPCWSTR lpName,
  5381    PLUID lpLuid);
  5382  // #ifdef UNICODE
  5383  alias LookupPrivilegeValueW LookupPrivilegeValue;
  5384  // #else
  5385  // #...
  5386  // #endif // !UNICODE
  5387  
  5388  extern(Windows) export BOOL LookupPrivilegeNameA(
  5389    LPCSTR lpSystemName,
  5390    PLUID lpLuid,
  5391    LPSTR lpName,
  5392    LPDWORD cbName);
  5393  extern(Windows) export BOOL LookupPrivilegeNameW(
  5394    LPCWSTR lpSystemName,
  5395    PLUID lpLuid,
  5396    LPWSTR lpName,
  5397    LPDWORD cbName);
  5398  // #ifdef UNICODE
  5399  alias LookupPrivilegeNameW LookupPrivilegeName;
  5400  // #else
  5401  // #...
  5402  // #endif // !UNICODE
  5403  
  5404  extern(Windows) export BOOL LookupPrivilegeDisplayNameA(
  5405    LPCSTR lpSystemName,
  5406    LPCSTR lpName,
  5407    LPSTR lpDisplayName,
  5408    LPDWORD cbDisplayName,
  5409    LPDWORD lpLanguageId);
  5410  extern(Windows) export BOOL LookupPrivilegeDisplayNameW(
  5411    LPCWSTR lpSystemName,
  5412    LPCWSTR lpName,
  5413    LPWSTR lpDisplayName,
  5414    LPDWORD cbDisplayName,
  5415    LPDWORD lpLanguageId);
  5416  // #ifdef UNICODE
  5417  alias LookupPrivilegeDisplayNameW LookupPrivilegeDisplayName;
  5418  // #else
  5419  // #...
  5420  // #endif // !UNICODE
  5421  
  5422  extern(Windows) export BOOL AllocateLocallyUniqueId(
  5423    PLUID Luid);
  5424  
  5425  extern(Windows) export BOOL BuildCommDCBA(
  5426    LPCSTR lpDef,
  5427    LPDCB lpDCB);
  5428  extern(Windows) export BOOL BuildCommDCBW(
  5429    LPCWSTR lpDef,
  5430    LPDCB lpDCB);
  5431  // #ifdef UNICODE
  5432  alias BuildCommDCBW BuildCommDCB;
  5433  // #else
  5434  // #...
  5435  // #endif // !UNICODE
  5436  
  5437  extern(Windows) export BOOL BuildCommDCBAndTimeoutsA(
  5438    LPCSTR lpDef,
  5439    LPDCB lpDCB,
  5440    LPCOMMTIMEOUTS lpCommTimeouts);
  5441  extern(Windows) export BOOL BuildCommDCBAndTimeoutsW(
  5442    LPCWSTR lpDef,
  5443    LPDCB lpDCB,
  5444    LPCOMMTIMEOUTS lpCommTimeouts);
  5445  // #ifdef UNICODE
  5446  alias BuildCommDCBAndTimeoutsW BuildCommDCBAndTimeouts;
  5447  // #else
  5448  // #...
  5449  // #endif // !UNICODE
  5450  
  5451  extern(Windows) export BOOL CommConfigDialogA(
  5452    LPCSTR lpszName,
  5453    HWND hWnd,
  5454    LPCOMMCONFIG lpCC);
  5455  extern(Windows) export BOOL CommConfigDialogW(
  5456    LPCWSTR lpszName,
  5457    HWND hWnd,
  5458    LPCOMMCONFIG lpCC);
  5459  // #ifdef UNICODE
  5460  alias CommConfigDialogW CommConfigDialog;
  5461  // #else
  5462  // #...
  5463  // #endif // !UNICODE
  5464  
  5465  extern(Windows) export BOOL GetDefaultCommConfigA(
  5466    LPCSTR lpszName,
  5467    LPCOMMCONFIG lpCC,
  5468    LPDWORD lpdwSize);
  5469  extern(Windows) export BOOL GetDefaultCommConfigW(
  5470    LPCWSTR lpszName,
  5471    LPCOMMCONFIG lpCC,
  5472    LPDWORD lpdwSize);
  5473  // #ifdef UNICODE
  5474  alias GetDefaultCommConfigW GetDefaultCommConfig;
  5475  // #else
  5476  // #...
  5477  // #endif // !UNICODE
  5478  
  5479  extern(Windows) export BOOL SetDefaultCommConfigA(
  5480    LPCSTR lpszName,
  5481    LPCOMMCONFIG lpCC,
  5482    DWORD dwSize);
  5483  extern(Windows) export BOOL SetDefaultCommConfigW(
  5484    LPCWSTR lpszName,
  5485    LPCOMMCONFIG lpCC,
  5486    DWORD dwSize);
  5487  // #ifdef UNICODE
  5488  alias SetDefaultCommConfigW SetDefaultCommConfig;
  5489  // #else
  5490  // #...
  5491  // #endif // !UNICODE
  5492  
  5493  // #ifndef _MAC
  5494  enum : uint { MAX_COMPUTERNAME_LENGTH = 15 }
  5495  // #else
  5496  // #...
  5497  // #endif
  5498  
  5499  extern(Windows) export BOOL GetComputerNameA(
  5500    LPSTR lpBuffer,
  5501    LPDWORD nSize);
  5502  extern(Windows) export BOOL GetComputerNameW(
  5503    LPWSTR lpBuffer,
  5504    LPDWORD nSize);
  5505  // #ifdef UNICODE
  5506  alias GetComputerNameW GetComputerName;
  5507  // #else
  5508  // #...
  5509  // #endif // !UNICODE
  5510  
  5511  extern(Windows) export BOOL SetComputerNameA(
  5512    LPCSTR lpComputerName);
  5513  extern(Windows) export BOOL SetComputerNameW(
  5514    LPCWSTR lpComputerName);
  5515  // #ifdef UNICODE
  5516  alias SetComputerNameW SetComputerName;
  5517  // #else
  5518  // #...
  5519  // #endif // !UNICODE
  5520  
  5521  // #if (_WIN32_WINNT >= 0x0500)
  5522  
  5523  alias int _COMPUTER_NAME_FORMAT;
  5524  enum {
  5525    ComputerNameNetBIOS,
  5526    ComputerNameDnsHostname,
  5527    ComputerNameDnsDomain,
  5528    ComputerNameDnsFullyQualified,
  5529    ComputerNamePhysicalNetBIOS,
  5530    ComputerNamePhysicalDnsHostname,
  5531    ComputerNamePhysicalDnsDomain,
  5532    ComputerNamePhysicalDnsFullyQualified,
  5533    ComputerNameMax,
  5534  }
  5535  alias _COMPUTER_NAME_FORMAT COMPUTER_NAME_FORMAT;
  5536  
  5537  extern(Windows) export BOOL GetComputerNameExA(
  5538    COMPUTER_NAME_FORMAT NameType,
  5539    LPSTR lpBuffer,
  5540    LPDWORD nSize);
  5541  extern(Windows) export BOOL GetComputerNameExW(
  5542    COMPUTER_NAME_FORMAT NameType,
  5543    LPWSTR lpBuffer,
  5544    LPDWORD nSize);
  5545  // #ifdef UNICODE
  5546  alias GetComputerNameExW GetComputerNameEx;
  5547  // #else
  5548  // #...
  5549  // #endif // !UNICODE
  5550  
  5551  extern(Windows) export BOOL SetComputerNameExA(
  5552    COMPUTER_NAME_FORMAT NameType,
  5553    LPCSTR lpBuffer);
  5554  extern(Windows) export BOOL SetComputerNameExW(
  5555    COMPUTER_NAME_FORMAT NameType,
  5556    LPCWSTR lpBuffer);
  5557  // #ifdef UNICODE
  5558  alias SetComputerNameExW SetComputerNameEx;
  5559  // #else
  5560  // #...
  5561  // #endif // !UNICODE
  5562  
  5563  extern(Windows) export DWORD AddLocalAlternateComputerNameA(
  5564    LPCSTR lpDnsFQHostname,
  5565    ULONG ulFlags);
  5566  extern(Windows) export DWORD AddLocalAlternateComputerNameW(
  5567    LPCWSTR lpDnsFQHostname,
  5568    ULONG ulFlags);
  5569  // #ifdef UNICODE
  5570  alias AddLocalAlternateComputerNameW AddLocalAlternateComputerName;
  5571  // #else
  5572  // #...
  5573  // #endif // !UNICODE
  5574  
  5575  extern(Windows) export DWORD RemoveLocalAlternateComputerNameA(
  5576    LPCSTR lpAltDnsFQHostname,
  5577    ULONG ulFlags);
  5578  extern(Windows) export DWORD RemoveLocalAlternateComputerNameW(
  5579    LPCWSTR lpAltDnsFQHostname,
  5580    ULONG ulFlags);
  5581  // #ifdef UNICODE
  5582  alias RemoveLocalAlternateComputerNameW RemoveLocalAlternateComputerName;
  5583  // #else
  5584  // #...
  5585  // #endif // !UNICODE
  5586  
  5587  extern(Windows) export DWORD SetLocalPrimaryComputerNameA(
  5588    LPCSTR lpAltDnsFQHostname,
  5589    ULONG ulFlags);
  5590  extern(Windows) export DWORD SetLocalPrimaryComputerNameW(
  5591    LPCWSTR lpAltDnsFQHostname,
  5592    ULONG ulFlags);
  5593  // #ifdef UNICODE
  5594  alias SetLocalPrimaryComputerNameW SetLocalPrimaryComputerName;
  5595  // #else
  5596  // #...
  5597  // #endif // !UNICODE
  5598  
  5599  alias int _COMPUTER_NAME_TYPE;
  5600  enum {
  5601    PrimaryComputerName,
  5602    AlternateComputerNames,
  5603    AllComputerNames,
  5604    ComputerNameTypeMax,
  5605  }
  5606  alias _COMPUTER_NAME_TYPE COMPUTER_NAME_TYPE;
  5607  
  5608  extern(Windows) export DWORD EnumerateLocalComputerNamesA(
  5609    COMPUTER_NAME_TYPE NameType,
  5610    ULONG ulFlags,
  5611    LPSTR lpDnsFQHostname,
  5612    LPDWORD nSize);
  5613  extern(Windows) export DWORD EnumerateLocalComputerNamesW(
  5614    COMPUTER_NAME_TYPE NameType,
  5615    ULONG ulFlags,
  5616    LPWSTR lpDnsFQHostname,
  5617    LPDWORD nSize);
  5618  // #ifdef UNICODE
  5619  alias EnumerateLocalComputerNamesW EnumerateLocalComputerNames;
  5620  // #else
  5621  // #...
  5622  // #endif // !UNICODE
  5623  
  5624  extern(Windows) export BOOL DnsHostnameToComputerNameA(
  5625    LPCSTR Hostname,
  5626    LPSTR ComputerName,
  5627    LPDWORD nSize);
  5628  extern(Windows) export BOOL DnsHostnameToComputerNameW(
  5629    LPCWSTR Hostname,
  5630    LPWSTR ComputerName,
  5631    LPDWORD nSize);
  5632  // #ifdef UNICODE
  5633  alias DnsHostnameToComputerNameW DnsHostnameToComputerName;
  5634  // #else
  5635  // #...
  5636  // #endif // !UNICODE
  5637  
  5638  // #endif // _WIN32_WINNT
  5639  
  5640  extern(Windows) export BOOL GetUserNameA(
  5641    LPSTR lpBuffer,
  5642    LPDWORD nSize);
  5643  extern(Windows) export BOOL GetUserNameW(
  5644    LPWSTR lpBuffer,
  5645    LPDWORD nSize);
  5646  // #ifdef UNICODE
  5647  alias GetUserNameW GetUserName;
  5648  // #else
  5649  // #...
  5650  // #endif // !UNICODE
  5651  
  5652  enum : uint { LOGON32_LOGON_INTERACTIVE = 2 }
  5653  enum : uint { LOGON32_LOGON_NETWORK = 3 }
  5654  enum : uint { LOGON32_LOGON_BATCH = 4 }
  5655  enum : uint { LOGON32_LOGON_SERVICE = 5 }
  5656  enum : uint { LOGON32_LOGON_UNLOCK = 7 }
  5657  // #if(_WIN32_WINNT >= 0x0500)
  5658  enum : uint { LOGON32_LOGON_NETWORK_CLEARTEXT = 8 }
  5659  enum : uint { LOGON32_LOGON_NEW_CREDENTIALS = 9 }
  5660  // #endif // (_WIN32_WINNT >= 0x0500)
  5661  
  5662  enum : uint { LOGON32_PROVIDER_DEFAULT = 0 }
  5663  enum : uint { LOGON32_PROVIDER_WINNT35 = 1 }
  5664  // #if(_WIN32_WINNT >= 0x0400)
  5665  enum : uint { LOGON32_PROVIDER_WINNT40 = 2 }
  5666  // #endif /* _WIN32_WINNT >= 0x0400 */
  5667  // #if(_WIN32_WINNT >= 0x0500)
  5668  enum : uint { LOGON32_PROVIDER_WINNT50 = 3 }
  5669  // #endif // (_WIN32_WINNT >= 0x0500)
  5670  
  5671  extern(Windows) export BOOL LogonUserA(
  5672    LPSTR lpszUsername,
  5673    LPSTR lpszDomain,
  5674    LPSTR lpszPassword,
  5675    DWORD dwLogonType,
  5676    DWORD dwLogonProvider,
  5677    PHANDLE phToken);
  5678  extern(Windows) export BOOL LogonUserW(
  5679    LPWSTR lpszUsername,
  5680    LPWSTR lpszDomain,
  5681    LPWSTR lpszPassword,
  5682    DWORD dwLogonType,
  5683    DWORD dwLogonProvider,
  5684    PHANDLE phToken);
  5685  // #ifdef UNICODE
  5686  alias LogonUserW LogonUser;
  5687  // #else
  5688  // #...
  5689  // #endif // !UNICODE
  5690  
  5691  extern(Windows) export BOOL LogonUserExA(
  5692    LPSTR lpszUsername,
  5693    LPSTR lpszDomain,
  5694    LPSTR lpszPassword,
  5695    DWORD dwLogonType,
  5696    DWORD dwLogonProvider,
  5697    PHANDLE phToken ,
  5698    PSID *ppLogonSid ,
  5699    PVOID *ppProfileBuffer ,
  5700    LPDWORD pdwProfileLength ,
  5701    PQUOTA_LIMITS pQuotaLimits );
  5702  extern(Windows) export BOOL LogonUserExW(
  5703    LPWSTR lpszUsername,
  5704    LPWSTR lpszDomain,
  5705    LPWSTR lpszPassword,
  5706    DWORD dwLogonType,
  5707    DWORD dwLogonProvider,
  5708    PHANDLE phToken ,
  5709    PSID *ppLogonSid ,
  5710    PVOID *ppProfileBuffer ,
  5711    LPDWORD pdwProfileLength ,
  5712    PQUOTA_LIMITS pQuotaLimits );
  5713  // #ifdef UNICODE
  5714  alias LogonUserExW LogonUserEx;
  5715  // #else
  5716  // #...
  5717  // #endif // !UNICODE
  5718  
  5719  extern(Windows) export BOOL ImpersonateLoggedOnUser(
  5720    HANDLE hToken);
  5721  
  5722  extern(Windows) export BOOL CreateProcessAsUserA(
  5723    HANDLE hToken,
  5724    LPCSTR lpApplicationName,
  5725    LPSTR lpCommandLine,
  5726    LPSECURITY_ATTRIBUTES lpProcessAttributes,
  5727    LPSECURITY_ATTRIBUTES lpThreadAttributes,
  5728    BOOL bInheritHandles,
  5729    DWORD dwCreationFlags,
  5730    LPVOID lpEnvironment,
  5731    LPCSTR lpCurrentDirectory,
  5732    LPSTARTUPINFOA lpStartupInfo,
  5733    LPPROCESS_INFORMATION lpProcessInformation);
  5734  extern(Windows) export BOOL CreateProcessAsUserW(
  5735    HANDLE hToken,
  5736    LPCWSTR lpApplicationName,
  5737    LPWSTR lpCommandLine,
  5738    LPSECURITY_ATTRIBUTES lpProcessAttributes,
  5739    LPSECURITY_ATTRIBUTES lpThreadAttributes,
  5740    BOOL bInheritHandles,
  5741    DWORD dwCreationFlags,
  5742    LPVOID lpEnvironment,
  5743    LPCWSTR lpCurrentDirectory,
  5744    LPSTARTUPINFOW lpStartupInfo,
  5745    LPPROCESS_INFORMATION lpProcessInformation);
  5746  // #ifdef UNICODE
  5747  alias CreateProcessAsUserW CreateProcessAsUser;
  5748  // #else
  5749  // #...
  5750  // #endif // !UNICODE
  5751  
  5752  // #if(_WIN32_WINNT >= 0x0500)
  5753  
  5754  enum : uint { LOGON_WITH_PROFILE = 0x00000001 }
  5755  enum : uint { LOGON_NETCREDENTIALS_ONLY = 0x00000002 }
  5756  
  5757  extern(Windows) export BOOL CreateProcessWithLogonW(
  5758    LPCWSTR lpUsername,
  5759    LPCWSTR lpDomain,
  5760    LPCWSTR lpPassword,
  5761    DWORD dwLogonFlags,
  5762    LPCWSTR lpApplicationName,
  5763    LPWSTR lpCommandLine,
  5764    DWORD dwCreationFlags,
  5765    LPVOID lpEnvironment,
  5766    LPCWSTR lpCurrentDirectory,
  5767    LPSTARTUPINFOW lpStartupInfo,
  5768    LPPROCESS_INFORMATION lpProcessInformation);
  5769  
  5770  // #endif // (_WIN32_WINNT >= 0x0500)
  5771  
  5772  extern(Windows) export BOOL ImpersonateAnonymousToken(
  5773    HANDLE ThreadHandle);
  5774  
  5775  extern(Windows) export BOOL DuplicateTokenEx(
  5776    HANDLE hExistingToken,
  5777    DWORD dwDesiredAccess,
  5778    LPSECURITY_ATTRIBUTES lpTokenAttributes,
  5779    SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
  5780    TOKEN_TYPE TokenType,
  5781    PHANDLE phNewToken);
  5782  
  5783  extern(Windows) export BOOL CreateRestrictedToken(
  5784    HANDLE ExistingTokenHandle,
  5785    DWORD Flags,
  5786    DWORD DisableSidCount,
  5787    PSID_AND_ATTRIBUTES SidsToDisable ,
  5788    DWORD DeletePrivilegeCount,
  5789    PLUID_AND_ATTRIBUTES PrivilegesToDelete ,
  5790    DWORD RestrictedSidCount,
  5791    PSID_AND_ATTRIBUTES SidsToRestrict ,
  5792    PHANDLE NewTokenHandle);
  5793  
  5794  extern(Windows) export BOOL IsTokenRestricted(
  5795    HANDLE TokenHandle);
  5796  
  5797  extern(Windows) export BOOL IsTokenUntrusted(
  5798    HANDLE TokenHandle);
  5799  
  5800  extern(Windows) export BOOL CheckTokenMembership(
  5801    HANDLE TokenHandle ,
  5802    PSID SidToCheck,
  5803    PBOOL IsMember);
  5804  
  5805  // #if (_WIN32_WINNT >= 0x0500)
  5806  
  5807  alias WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACK;
  5808  
  5809  extern(Windows) export BOOL RegisterWaitForSingleObject(
  5810    PHANDLE phNewWaitObject,
  5811    HANDLE hObject,
  5812    WAITORTIMERCALLBACK Callback,
  5813    PVOID Context,
  5814    ULONG dwMilliseconds,
  5815    ULONG dwFlags);
  5816  
  5817  extern(Windows) export HANDLE RegisterWaitForSingleObjectEx(
  5818    HANDLE hObject,
  5819    WAITORTIMERCALLBACK Callback,
  5820    PVOID Context,
  5821    ULONG dwMilliseconds,
  5822    ULONG dwFlags);
  5823  
  5824  extern(Windows) export BOOL UnregisterWait(
  5825    HANDLE WaitHandle);
  5826  
  5827  extern(Windows) export BOOL UnregisterWaitEx(
  5828    HANDLE WaitHandle,
  5829    HANDLE CompletionEvent);
  5830  
  5831  extern(Windows) export BOOL QueueUserWorkItem(
  5832    LPTHREAD_START_ROUTINE Function,
  5833    PVOID Context,
  5834    ULONG Flags);
  5835  
  5836  extern(Windows) export BOOL BindIoCompletionCallback(
  5837    HANDLE FileHandle,
  5838    LPOVERLAPPED_COMPLETION_ROUTINE Function,
  5839    ULONG Flags);
  5840  
  5841  extern(Windows) export HANDLE CreateTimerQueue();
  5842  
  5843  extern(Windows) export BOOL CreateTimerQueueTimer(
  5844    PHANDLE phNewTimer,
  5845    HANDLE TimerQueue,
  5846    WAITORTIMERCALLBACK Callback,
  5847    PVOID Parameter,
  5848    DWORD DueTime,
  5849    DWORD Period,
  5850    ULONG Flags);
  5851  
  5852  extern(Windows) export BOOL ChangeTimerQueueTimer(
  5853    HANDLE TimerQueue,
  5854    HANDLE Timer,
  5855    ULONG DueTime,
  5856    ULONG Period);
  5857  
  5858  extern(Windows) export BOOL DeleteTimerQueueTimer(
  5859    HANDLE TimerQueue,
  5860    HANDLE Timer,
  5861    HANDLE CompletionEvent);
  5862  
  5863  extern(Windows) export BOOL DeleteTimerQueueEx(
  5864    HANDLE TimerQueue,
  5865    HANDLE CompletionEvent);
  5866  
  5867  extern(Windows) export HANDLE SetTimerQueueTimer(
  5868    HANDLE TimerQueue,
  5869    WAITORTIMERCALLBACK Callback,
  5870    PVOID Parameter,
  5871    DWORD DueTime,
  5872    DWORD Period,
  5873    BOOL PreferIo);
  5874  
  5875  extern(Windows) export BOOL CancelTimerQueueTimer(
  5876    HANDLE TimerQueue,
  5877    HANDLE Timer);
  5878  
  5879  extern(Windows) export BOOL DeleteTimerQueue(
  5880    HANDLE TimerQueue);
  5881  
  5882  // #endif // _WIN32_WINNT
  5883  
  5884  // #if(_WIN32_WINNT >= 0x0400)
  5885  
  5886  enum : uint { HW_PROFILE_GUIDLEN = 39 }
  5887  enum : uint { MAX_PROFILE_LEN = 80 }
  5888  
  5889  enum : uint { DOCKINFO_UNDOCKED = 0x1 }
  5890  enum : uint { DOCKINFO_DOCKED = 0x2 }
  5891  enum : uint { DOCKINFO_USER_SUPPLIED = 0x4 }
  5892  enum : uint { DOCKINFO_USER_UNDOCKED = DOCKINFO_USER_SUPPLIED | DOCKINFO_UNDOCKED }
  5893  enum : uint { DOCKINFO_USER_DOCKED = DOCKINFO_USER_SUPPLIED | DOCKINFO_DOCKED }
  5894  
  5895  struct tagHW_PROFILE_INFOA {
  5896    DWORD dwDockInfo;
  5897    CHAR szHwProfileGuid[HW_PROFILE_GUIDLEN];
  5898    CHAR szHwProfileName[MAX_PROFILE_LEN];
  5899  }
  5900  alias tagHW_PROFILE_INFOA HW_PROFILE_INFOA;
  5901  alias tagHW_PROFILE_INFOA* LPHW_PROFILE_INFOA;
  5902  
  5903  struct tagHW_PROFILE_INFOW {
  5904    DWORD dwDockInfo;
  5905    WCHAR szHwProfileGuid[HW_PROFILE_GUIDLEN];
  5906    WCHAR szHwProfileName[MAX_PROFILE_LEN];
  5907  }
  5908  alias tagHW_PROFILE_INFOW HW_PROFILE_INFOW;
  5909  alias tagHW_PROFILE_INFOW* LPHW_PROFILE_INFOW;
  5910  
  5911  // #ifdef UNICODE
  5912  alias HW_PROFILE_INFOW HW_PROFILE_INFO;
  5913  alias LPHW_PROFILE_INFOW LPHW_PROFILE_INFO;
  5914  // #else
  5915  // ...
  5916  // #endif // UNICODE
  5917  
  5918  extern(Windows) export BOOL GetCurrentHwProfileA(
  5919    LPHW_PROFILE_INFOA lpHwProfileInfo);
  5920  extern(Windows) export BOOL GetCurrentHwProfileW(
  5921    LPHW_PROFILE_INFOW lpHwProfileInfo);
  5922  // #ifdef UNICODE
  5923  alias GetCurrentHwProfileW GetCurrentHwProfile;
  5924  // #else
  5925  // #...
  5926  // #endif // !UNICODE
  5927  // #endif /* _WIN32_WINNT >= 0x0400 */
  5928  
  5929  extern(Windows) export BOOL QueryPerformanceCounter(
  5930    LARGE_INTEGER *lpPerformanceCount);
  5931  
  5932  extern(Windows) export BOOL QueryPerformanceFrequency(
  5933    LARGE_INTEGER *lpFrequency);
  5934  
  5935  extern(Windows) export BOOL GetVersionExA(
  5936    LPOSVERSIONINFOA lpVersionInformation);
  5937  extern(Windows) export BOOL GetVersionExW(
  5938    LPOSVERSIONINFOW lpVersionInformation);
  5939  // #ifdef UNICODE
  5940  alias GetVersionExW GetVersionEx;
  5941  // #else
  5942  // #...
  5943  // #endif // !UNICODE
  5944  
  5945  extern(Windows) export BOOL VerifyVersionInfoA(
  5946    LPOSVERSIONINFOEXA lpVersionInformation,
  5947    DWORD dwTypeMask,
  5948    DWORDLONG dwlConditionMask);
  5949  extern(Windows) export BOOL VerifyVersionInfoW(
  5950    LPOSVERSIONINFOEXW lpVersionInformation,
  5951    DWORD dwTypeMask,
  5952    DWORDLONG dwlConditionMask);
  5953  // #ifdef UNICODE
  5954  alias VerifyVersionInfoW VerifyVersionInfo;
  5955  // #else
  5956  // #...
  5957  // #endif // !UNICODE
  5958  
  5959  import win32.winerror;
  5960  
  5961  enum : uint { TC_NORMAL = 0 }
  5962  enum : uint { TC_HARDERR = 1 }
  5963  enum : uint { TC_GP_TRAP = 2 }
  5964  enum : uint { TC_SIGNAL = 3 }
  5965  
  5966  // #if(WINVER >= 0x0400)
  5967  
  5968  enum : uint { AC_LINE_OFFLINE = 0x00 }
  5969  enum : uint { AC_LINE_ONLINE = 0x01 }
  5970  enum : uint { AC_LINE_BACKUP_POWER = 0x02 }
  5971  enum : uint { AC_LINE_UNKNOWN = 0xFF }
  5972  
  5973  enum : uint { BATTERY_FLAG_HIGH = 0x01 }
  5974  enum : uint { BATTERY_FLAG_LOW = 0x02 }
  5975  enum : uint { BATTERY_FLAG_CRITICAL = 0x04 }
  5976  enum : uint { BATTERY_FLAG_CHARGING = 0x08 }
  5977  enum : uint { BATTERY_FLAG_NO_BATTERY = 0x80 }
  5978  enum : uint { BATTERY_FLAG_UNKNOWN = 0xFF }
  5979  
  5980  enum : uint { BATTERY_PERCENTAGE_UNKNOWN = 0xFF }
  5981  
  5982  enum : uint { BATTERY_LIFE_UNKNOWN = 0xFFFFFFFF }
  5983  
  5984  struct _SYSTEM_POWER_STATUS {
  5985    BYTE ACLineStatus;
  5986    BYTE BatteryFlag;
  5987    BYTE BatteryLifePercent;
  5988    BYTE Reserved1;
  5989    DWORD BatteryLifeTime;
  5990    DWORD BatteryFullLifeTime;
  5991  }
  5992  alias _SYSTEM_POWER_STATUS SYSTEM_POWER_STATUS;
  5993  alias _SYSTEM_POWER_STATUS* LPSYSTEM_POWER_STATUS;
  5994  
  5995  extern(Windows) export BOOL GetSystemPowerStatus(
  5996    LPSYSTEM_POWER_STATUS lpSystemPowerStatus);
  5997  
  5998  extern(Windows) export BOOL SetSystemPowerState(
  5999    BOOL fSuspend,
  6000    BOOL fForce);
  6001  
  6002  // #endif /* WINVER >= 0x0400 */
  6003  
  6004  // #if (_WIN32_WINNT >= 0x0500)
  6005  
  6006  extern(Windows) export BOOL AllocateUserPhysicalPages(
  6007    HANDLE hProcess,
  6008    PULONG_PTR NumberOfPages,
  6009    PULONG_PTR PageArray);
  6010  
  6011  extern(Windows) export BOOL FreeUserPhysicalPages(
  6012    HANDLE hProcess,
  6013    PULONG_PTR NumberOfPages,
  6014    PULONG_PTR PageArray);
  6015  
  6016  extern(Windows) export BOOL MapUserPhysicalPages(
  6017    PVOID VirtualAddress,
  6018    ULONG_PTR NumberOfPages,
  6019    PULONG_PTR PageArray );
  6020  
  6021  extern(Windows) export BOOL MapUserPhysicalPagesScatter(
  6022    PVOID *VirtualAddresses,
  6023    ULONG_PTR NumberOfPages,
  6024    PULONG_PTR PageArray );
  6025  
  6026  extern(Windows) export HANDLE CreateJobObjectA(
  6027    LPSECURITY_ATTRIBUTES lpJobAttributes,
  6028    LPCSTR lpName);
  6029  extern(Windows) export HANDLE CreateJobObjectW(
  6030    LPSECURITY_ATTRIBUTES lpJobAttributes,
  6031    LPCWSTR lpName);
  6032  // #ifdef UNICODE
  6033  alias CreateJobObjectW CreateJobObject;
  6034  // #else
  6035  // #...
  6036  // #endif // !UNICODE
  6037  
  6038  extern(Windows) export HANDLE OpenJobObjectA(
  6039    DWORD dwDesiredAccess,
  6040    BOOL bInheritHandle,
  6041    LPCSTR lpName);
  6042  extern(Windows) export HANDLE OpenJobObjectW(
  6043    DWORD dwDesiredAccess,
  6044    BOOL bInheritHandle,
  6045    LPCWSTR lpName);
  6046  // #ifdef UNICODE
  6047  alias OpenJobObjectW OpenJobObject;
  6048  // #else
  6049  // #...
  6050  // #endif // !UNICODE
  6051  
  6052  extern(Windows) export BOOL AssignProcessToJobObject(
  6053    HANDLE hJob,
  6054    HANDLE hProcess);
  6055  
  6056  extern(Windows) export BOOL TerminateJobObject(
  6057    HANDLE hJob,
  6058    UINT uExitCode);
  6059  
  6060  extern(Windows) export BOOL QueryInformationJobObject(
  6061    HANDLE hJob,
  6062    JOBOBJECTINFOCLASS JobObjectInformationClass,
  6063    LPVOID lpJobObjectInformation,
  6064    DWORD cbJobObjectInformationLength,
  6065    LPDWORD lpReturnLength);
  6066  
  6067  extern(Windows) export BOOL SetInformationJobObject(
  6068    HANDLE hJob,
  6069    JOBOBJECTINFOCLASS JobObjectInformationClass,
  6070    LPVOID lpJobObjectInformation,
  6071    DWORD cbJobObjectInformationLength);
  6072  
  6073  extern(Windows) export BOOL IsProcessInJob(
  6074    HANDLE ProcessHandle,
  6075    HANDLE JobHandle,
  6076    PBOOL Result);
  6077  
  6078  extern(Windows) export BOOL CreateJobSet(
  6079    ULONG NumJob,
  6080    PJOB_SET_ARRAY UserJobSet,
  6081    ULONG Flags);
  6082  
  6083  extern(Windows) export PVOID AddVectoredExceptionHandler(
  6084    ULONG FirstHandler,
  6085    PVECTORED_EXCEPTION_HANDLER VectoredHandler);
  6086  
  6087  extern(Windows) export ULONG RemoveVectoredExceptionHandler(
  6088    PVOID VectoredHandlerHandle);
  6089  
  6090  extern(Windows) export HANDLE FindFirstVolumeA(
  6091    LPSTR lpszVolumeName,
  6092    DWORD cchBufferLength);
  6093  extern(Windows) export HANDLE FindFirstVolumeW(
  6094    LPWSTR lpszVolumeName,
  6095    DWORD cchBufferLength);
  6096  // #ifdef UNICODE
  6097  alias FindFirstVolumeW FindFirstVolume;
  6098  // #else
  6099  // #...
  6100  // #endif // !UNICODE
  6101  
  6102  extern(Windows) export BOOL FindNextVolumeA(
  6103    HANDLE hFindVolume,
  6104    LPSTR lpszVolumeName,
  6105    DWORD cchBufferLength);
  6106  extern(Windows) export BOOL FindNextVolumeW(
  6107    HANDLE hFindVolume,
  6108    LPWSTR lpszVolumeName,
  6109    DWORD cchBufferLength);
  6110  // #ifdef UNICODE
  6111  alias FindNextVolumeW FindNextVolume;
  6112  // #else
  6113  // #...
  6114  // #endif // !UNICODE
  6115  
  6116  extern(Windows) export BOOL FindVolumeClose(
  6117    HANDLE hFindVolume);
  6118  
  6119  extern(Windows) export HANDLE FindFirstVolumeMountPointA(
  6120    LPCSTR lpszRootPathName,
  6121    LPSTR lpszVolumeMountPoint,
  6122    DWORD cchBufferLength);
  6123  extern(Windows) export HANDLE FindFirstVolumeMountPointW(
  6124    LPCWSTR lpszRootPathName,
  6125    LPWSTR lpszVolumeMountPoint,
  6126    DWORD cchBufferLength);
  6127  // #ifdef UNICODE
  6128  alias FindFirstVolumeMountPointW FindFirstVolumeMountPoint;
  6129  // #else
  6130  // #...
  6131  // #endif // !UNICODE
  6132  
  6133  extern(Windows) export BOOL FindNextVolumeMountPointA(
  6134    HANDLE hFindVolumeMountPoint,
  6135    LPSTR lpszVolumeMountPoint,
  6136    DWORD cchBufferLength);
  6137  extern(Windows) export BOOL FindNextVolumeMountPointW(
  6138    HANDLE hFindVolumeMountPoint,
  6139    LPWSTR lpszVolumeMountPoint,
  6140    DWORD cchBufferLength);
  6141  // #ifdef UNICODE
  6142  alias FindNextVolumeMountPointW FindNextVolumeMountPoint;
  6143  // #else
  6144  // #...
  6145  // #endif // !UNICODE
  6146  
  6147  extern(Windows) export BOOL FindVolumeMountPointClose(
  6148    HANDLE hFindVolumeMountPoint);
  6149  
  6150  extern(Windows) export BOOL SetVolumeMountPointA(
  6151    LPCSTR lpszVolumeMountPoint,
  6152    LPCSTR lpszVolumeName);
  6153  extern(Windows) export BOOL SetVolumeMountPointW(
  6154    LPCWSTR lpszVolumeMountPoint,
  6155    LPCWSTR lpszVolumeName);
  6156  // #ifdef UNICODE
  6157  alias SetVolumeMountPointW SetVolumeMountPoint;
  6158  // #else
  6159  // #...
  6160  // #endif // !UNICODE
  6161  
  6162  extern(Windows) export BOOL DeleteVolumeMountPointA(
  6163    LPCSTR lpszVolumeMountPoint);
  6164  extern(Windows) export BOOL DeleteVolumeMountPointW(
  6165    LPCWSTR lpszVolumeMountPoint);
  6166  // #ifdef UNICODE
  6167  alias DeleteVolumeMountPointW DeleteVolumeMountPoint;
  6168  // #else
  6169  // #...
  6170  // #endif // !UNICODE
  6171  
  6172  extern(Windows) export BOOL GetVolumeNameForVolumeMountPointA(
  6173    LPCSTR lpszVolumeMountPoint,
  6174    LPSTR lpszVolumeName,
  6175    DWORD cchBufferLength);
  6176  extern(Windows) export BOOL GetVolumeNameForVolumeMountPointW(
  6177    LPCWSTR lpszVolumeMountPoint,
  6178    LPWSTR lpszVolumeName,
  6179    DWORD cchBufferLength);
  6180  // #ifdef UNICODE
  6181  alias GetVolumeNameForVolumeMountPointW GetVolumeNameForVolumeMountPoint;
  6182  // #else
  6183  // #...
  6184  // #endif // !UNICODE
  6185  
  6186  extern(Windows) export BOOL GetVolumePathNameA(
  6187    LPCSTR lpszFileName,
  6188    LPSTR lpszVolumePathName,
  6189    DWORD cchBufferLength);
  6190  extern(Windows) export BOOL GetVolumePathNameW(
  6191    LPCWSTR lpszFileName,
  6192    LPWSTR lpszVolumePathName,
  6193    DWORD cchBufferLength);
  6194  // #ifdef UNICODE
  6195  alias GetVolumePathNameW GetVolumePathName;
  6196  // #else
  6197  // #...
  6198  // #endif // !UNICODE
  6199  
  6200  extern(Windows) export BOOL GetVolumePathNamesForVolumeNameA(
  6201    LPCSTR lpszVolumeName,
  6202    LPSTR lpszVolumePathNames,
  6203    DWORD cchBufferLength,
  6204    PDWORD lpcchReturnLength);
  6205  extern(Windows) export BOOL GetVolumePathNamesForVolumeNameW(
  6206    LPCWSTR lpszVolumeName,
  6207    LPWSTR lpszVolumePathNames,
  6208    DWORD cchBufferLength,
  6209    PDWORD lpcchReturnLength);
  6210  // #ifdef UNICODE
  6211  alias GetVolumePathNamesForVolumeNameW GetVolumePathNamesForVolumeName;
  6212  // #else
  6213  // #...
  6214  // #endif // !UNICODE
  6215  
  6216  // #endif
  6217  
  6218  // #if (_WIN32_WINNT >= 0x0500) || (_WIN32_FUSION >= 0x0100) || ISOLATION_AWARE_ENABLED
  6219  
  6220  enum : uint { ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID = 0x00000001 }
  6221  enum : uint { ACTCTX_FLAG_LANGID_VALID = 0x00000002 }
  6222  enum : uint { ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID = 0x00000004 }
  6223  enum : uint { ACTCTX_FLAG_RESOURCE_NAME_VALID = 0x00000008 }
  6224  enum : uint { ACTCTX_FLAG_SET_PROCESS_DEFAULT = 0x00000010 }
  6225  enum : uint { ACTCTX_FLAG_APPLICATION_NAME_VALID = 0x00000020 }
  6226  enum : uint { ACTCTX_FLAG_SOURCE_IS_ASSEMBLYREF = 0x00000040 }
  6227  enum : uint { ACTCTX_FLAG_HMODULE_VALID = 0x00000080 }
  6228  
  6229  struct tagACTCTXA {
  6230    ULONG cbSize;
  6231    DWORD dwFlags;
  6232    LPCSTR lpSource;
  6233    USHORT wProcessorArchitecture;
  6234    LANGID wLangId;
  6235    LPCSTR lpAssemblyDirectory;
  6236    LPCSTR lpResourceName;
  6237    LPCSTR lpApplicationName;
  6238    HMODULE hModule;
  6239  }
  6240  alias tagACTCTXA ACTCTXA;
  6241  alias tagACTCTXA* PACTCTXA;
  6242  
  6243  struct tagACTCTXW {
  6244    ULONG cbSize;
  6245    DWORD dwFlags;
  6246    LPCWSTR lpSource;
  6247    USHORT wProcessorArchitecture;
  6248    LANGID wLangId;
  6249    LPCWSTR lpAssemblyDirectory;
  6250    LPCWSTR lpResourceName;
  6251    LPCWSTR lpApplicationName;
  6252    HMODULE hModule;
  6253  }
  6254  alias tagACTCTXW ACTCTXW;
  6255  alias tagACTCTXW* PACTCTXW;
  6256  
  6257  // #ifdef UNICODE
  6258  // skip typedef ACTCTXW ACTCTX;
  6259  alias PACTCTXW PACTCTX;
  6260  // #else
  6261  // ...
  6262  // #endif // UNICODE
  6263  
  6264  alias ACTCTXA* PCACTCTXA;
  6265  alias ACTCTXW* PCACTCTXW;
  6266  // #ifdef UNICODE
  6267  // skip typedef ACTCTXW ACTCTX;
  6268  alias PCACTCTXW PCACTCTX;
  6269  // #else
  6270  // ...
  6271  // #endif // UNICODE
  6272  
  6273  // #endif
  6274  
  6275  // #if (_WIN32_WINNT >= 0x0500) || (_WIN32_FUSION >= 0x0100)
  6276  
  6277  extern(Windows) export HANDLE CreateActCtxA(
  6278    PCACTCTXA pActCtx);
  6279  extern(Windows) export HANDLE CreateActCtxW(
  6280    PCACTCTXW pActCtx);
  6281  // #ifdef UNICODE
  6282  alias CreateActCtxW CreateActCtx;
  6283  // #else
  6284  // #...
  6285  // #endif // !UNICODE
  6286  
  6287  extern(Windows) export VOID AddRefActCtx(
  6288    HANDLE hActCtx);
  6289  
  6290  extern(Windows) export VOID ReleaseActCtx(
  6291    HANDLE hActCtx);
  6292  
  6293  extern(Windows) export BOOL ZombifyActCtx(
  6294    HANDLE hActCtx);
  6295  
  6296  extern(Windows) export BOOL ActivateActCtx(
  6297    HANDLE hActCtx,
  6298    ULONG_PTR *lpCookie);
  6299  
  6300  enum : uint { DEACTIVATE_ACTCTX_FLAG_FORCE_EARLY_DEACTIVATION = 0x00000001 }
  6301  
  6302  extern(Windows) export BOOL DeactivateActCtx(
  6303    DWORD dwFlags,
  6304    ULONG_PTR ulCookie);
  6305  
  6306  extern(Windows) export BOOL GetCurrentActCtx(
  6307    HANDLE *lphActCtx);
  6308  
  6309  // #endif
  6310  
  6311  // #if (_WIN32_WINNT >= 0x0500) || (_WIN32_FUSION >= 0x0100) || ISOLATION_AWARE_ENABLED
  6312  
  6313  struct tagACTCTX_SECTION_KEYED_DATA {
  6314    ULONG cbSize;
  6315    ULONG ulDataFormatVersion;
  6316    PVOID lpData;
  6317    ULONG ulLength;
  6318    PVOID lpSectionGlobalData;
  6319    ULONG ulSectionGlobalDataLength;
  6320    PVOID lpSectionBase;
  6321    ULONG ulSectionTotalLength;
  6322    HANDLE hActCtx;
  6323    ULONG ulAssemblyRosterIndex;
  6324  }
  6325  alias tagACTCTX_SECTION_KEYED_DATA ACTCTX_SECTION_KEYED_DATA;
  6326  alias tagACTCTX_SECTION_KEYED_DATA* PACTCTX_SECTION_KEYED_DATA;
  6327  
  6328  enum : uint { FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX = 0x00000001 }
  6329  
  6330  // #endif
  6331  
  6332  // #if (_WIN32_WINNT >= 0x0500) || (_WIN32_FUSION >= 0x0100)
  6333  
  6334  extern(Windows) export BOOL FindActCtxSectionStringA(
  6335    DWORD dwFlags,
  6336    GUID *lpExtensionGuid,
  6337    ULONG ulSectionId,
  6338    LPCSTR lpStringToFind,
  6339    PACTCTX_SECTION_KEYED_DATA ReturnedData);
  6340  extern(Windows) export BOOL FindActCtxSectionStringW(
  6341    DWORD dwFlags,
  6342    GUID *lpExtensionGuid,
  6343    ULONG ulSectionId,
  6344    LPCWSTR lpStringToFind,
  6345    PACTCTX_SECTION_KEYED_DATA ReturnedData);
  6346  // #ifdef UNICODE
  6347  alias FindActCtxSectionStringW FindActCtxSectionString;
  6348  // #else
  6349  // #...
  6350  // #endif // !UNICODE
  6351  
  6352  extern(Windows) export BOOL FindActCtxSectionGuid(
  6353    DWORD dwFlags,
  6354    GUID *lpExtensionGuid,
  6355    ULONG ulSectionId,
  6356    GUID *lpGuidToFind,
  6357    PACTCTX_SECTION_KEYED_DATA ReturnedData);
  6358  
  6359  // #endif
  6360  
  6361  // #if (_WIN32_WINNT >= 0x0500) || (_WIN32_FUSION >= 0x0100) || ISOLATION_AWARE_ENABLED
  6362  
  6363  // #if !defined(RC_INVOKED) /* RC complains about long symbols in #ifs */
  6364  // #if !defined(ACTIVATION_CONTEXT_BASIC_INFORMATION_DEFINED)
  6365  
  6366  // ...
  6367  
  6368  // ...
  6369  
  6370  // #...
  6371  
  6372  // #endif // !defined(ACTIVATION_CONTEXT_BASIC_INFORMATION_DEFINED)
  6373  // #endif
  6374  
  6375  enum : uint { QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX = 0x00000004 }
  6376  enum : uint { QUERY_ACTCTX_FLAG_ACTCTX_IS_HMODULE = 0x00000008 }
  6377  enum : uint { QUERY_ACTCTX_FLAG_ACTCTX_IS_ADDRESS = 0x00000010 }
  6378  enum : uint { QUERY_ACTCTX_FLAG_NO_ADDREF = 0x80000000 }
  6379  
  6380  // #endif
  6381  
  6382  // #if (_WIN32_WINNT >= 0x0500) || (_WIN32_FUSION >= 0x0100)
  6383  
  6384  extern(Windows) export BOOL QueryActCtxW(
  6385    DWORD dwFlags,
  6386    HANDLE hActCtx,
  6387    PVOID pvSubInstance,
  6388    ULONG ulInfoClass,
  6389    PVOID pvBuffer,
  6390    SIZE_T cbBuffer ,
  6391    SIZE_T *pcbWrittenOrRequired );
  6392  
  6393  extern(Windows) alias BOOL function(  DWORD dwFlags,  HANDLE hActCtx,  PVOID pvSubInstance,  ULONG ulInfoClass,  PVOID pvBuffer,  SIZE_T cbBuffer ,  SIZE_T *pcbWrittenOrRequired  ) PQUERYACTCTXW_FUNC;
  6394  
  6395  // #endif // (_WIN32_WINNT > 0x0500) || (_WIN32_FUSION >= 0x0100)
  6396  
  6397  extern(Windows) export BOOL ProcessIdToSessionId(
  6398    DWORD dwProcessId,
  6399    DWORD *pSessionId);
  6400  
  6401  // #if _WIN32_WINNT >= 0x0501
  6402  
  6403  extern(Windows) export DWORD WTSGetActiveConsoleSessionId();
  6404  
  6405  extern(Windows) export BOOL IsWow64Process(
  6406    HANDLE hProcess,
  6407    PBOOL Wow64Process);
  6408  
  6409  // #endif // (_WIN32_WINNT >= 0x0501)
  6410  
  6411  extern(Windows) export BOOL GetNumaHighestNodeNumber(
  6412    PULONG HighestNodeNumber);
  6413  
  6414  extern(Windows) export BOOL GetNumaProcessorNode(
  6415    UCHAR Processor,
  6416    PUCHAR NodeNumber);
  6417  
  6418  extern(Windows) export BOOL GetNumaNodeProcessorMask(
  6419    UCHAR Node,
  6420    PULONGLONG ProcessorMask);
  6421  
  6422  extern(Windows) export BOOL GetNumaProcessorMap(
  6423    PSYSTEM_NUMA_INFORMATION Map,
  6424    ULONG Length,
  6425    PULONG ReturnedLength);
  6426  
  6427  extern(Windows) export BOOL GetNumaAvailableMemory(
  6428    PSYSTEM_NUMA_INFORMATION Memory,
  6429    ULONG Length,
  6430    PULONG ReturnedLength);
  6431  
  6432  extern(Windows) export BOOL GetNumaAvailableMemoryNode(
  6433    UCHAR Node,
  6434    PULONGLONG AvailableBytes);
  6435  
  6436  extern(Windows) export ULONGLONG NumaVirtualQueryNode(
  6437    ULONG NumberOfRanges,
  6438    PULONG_PTR RangeList,
  6439    PULONG_PTR VirtualPageAndNode,
  6440    SIZE_T MaximumOutputLength);
  6441  
  6442  // #if !defined(RC_INVOKED) /* RC complains about long symbols in #ifs */
  6443  // #if ISOLATION_AWARE_ENABLED
  6444  // #...
  6445  // #endif /* ISOLATION_AWARE_ENABLED */
  6446  // #endif /* RC */
  6447  
  6448  // #ifdef __cplusplus
  6449  // }
  6450  // #endif
  6451  
  6452  // #endif // _WINBASE_
  6453