Home | History | Annotate | Download | only in include
      1 /**
      2  * This file is part of the mingw-w64 runtime package.
      3  * No warranty is given; refer to the file DISCLAIMER within this package.
      4  */
      5 #ifndef _WINBASE_
      6 #define _WINBASE_
      7 
      8 #include <_mingw_unicode.h>
      9 
     10 #include <apisetcconv.h>
     11 #include <winapifamily.h>
     12 
     13 #include <minwinbase.h>
     14 #include <bemapiset.h>
     15 #include <debugapi.h>
     16 #include <errhandlingapi.h>
     17 #include <fibersapi.h>
     18 #include <fileapi.h>
     19 #include <handleapi.h>
     20 #include <heapapi.h>
     21 #include <ioapiset.h>
     22 #include <interlockedapi.h>
     23 #include <jobapi.h>
     24 #include <libloaderapi.h>
     25 #include <memoryapi.h>
     26 #include <namedpipeapi.h>
     27 #include <namespaceapi.h>
     28 #include <processenv.h>
     29 #include <processthreadsapi.h>
     30 #include <processtopologyapi.h>
     31 #include <profileapi.h>
     32 #include <realtimeapiset.h>
     33 #include <securityappcontainer.h>
     34 #include <securitybaseapi.h>
     35 #include <synchapi.h>
     36 #include <sysinfoapi.h>
     37 #include <systemtopologyapi.h>
     38 #include <threadpoolapiset.h>
     39 #include <threadpoollegacyapiset.h>
     40 #include <utilapiset.h>
     41 #include <wow64apiset.h>
     42 
     43 #ifdef __WIDL__
     44 #define NOWINBASEINTERLOCK 1
     45 #endif
     46 
     47 #ifndef NOWINBASEINTERLOCK
     48 #define __INTRINSIC_GROUP_WINBASE /* only define the intrinsics in this file */
     49 #include <psdk_inc/intrin-impl.h>
     50 #endif
     51 
     52 #ifdef __cplusplus
     53 extern "C" {
     54 #endif
     55 
     56 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
     57 #define GetCurrentTime() GetTickCount ()
     58 #endif
     59 
     60 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
     61 #define DefineHandleTable(w) ( { (VOID)(w); TRUE; } )
     62 #define LimitEmsPages(dw)
     63 #define SetSwapAreaSize(w) (w)
     64 #define LockSegment(w) GlobalFix((HANDLE)(w))
     65 #define UnlockSegment(w) GlobalUnfix((HANDLE)(w))
     66 
     67 #define Yield()
     68 
     69 #define FILE_BEGIN 0
     70 #define FILE_CURRENT 1
     71 #define FILE_END 2
     72 
     73 #define WAIT_FAILED ((DWORD)0xffffffff)
     74 #define WAIT_OBJECT_0 ((STATUS_WAIT_0) + 0)
     75 
     76 #define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0) + 0)
     77 #define WAIT_ABANDONED_0 ((STATUS_ABANDONED_WAIT_0) + 0)
     78 
     79 #define WAIT_IO_COMPLETION STATUS_USER_APC
     80 
     81 #define SecureZeroMemory RtlSecureZeroMemory
     82 #define CaptureStackBackTrace RtlCaptureStackBackTrace
     83 
     84 #define FILE_FLAG_WRITE_THROUGH 0x80000000
     85 #define FILE_FLAG_OVERLAPPED 0x40000000
     86 #define FILE_FLAG_NO_BUFFERING 0x20000000
     87 #define FILE_FLAG_RANDOM_ACCESS 0x10000000
     88 #define FILE_FLAG_SEQUENTIAL_SCAN 0x8000000
     89 #define FILE_FLAG_DELETE_ON_CLOSE 0x4000000
     90 #define FILE_FLAG_BACKUP_SEMANTICS 0x2000000
     91 #define FILE_FLAG_POSIX_SEMANTICS 0x1000000
     92 #define FILE_FLAG_SESSION_AWARE 0x800000
     93 #define FILE_FLAG_OPEN_REPARSE_POINT 0x200000
     94 #define FILE_FLAG_OPEN_NO_RECALL 0x100000
     95 #define FILE_FLAG_FIRST_PIPE_INSTANCE 0x80000
     96 #if _WIN32_WINNT >= 0x0602
     97 #define FILE_FLAG_OPEN_REQUIRING_OPLOCK 0x40000
     98 #endif
     99 
    100 #define PROGRESS_CONTINUE 0
    101 #define PROGRESS_CANCEL 1
    102 #define PROGRESS_STOP 2
    103 #define PROGRESS_QUIET 3
    104 
    105 #define CALLBACK_CHUNK_FINISHED 0x0
    106 #define CALLBACK_STREAM_SWITCH 0x1
    107 
    108 #define COPY_FILE_FAIL_IF_EXISTS 0x1
    109 #define COPY_FILE_RESTARTABLE 0x2
    110 #define COPY_FILE_OPEN_SOURCE_FOR_WRITE 0x4
    111 #define COPY_FILE_ALLOW_DECRYPTED_DESTINATION 0x8
    112 #if _WIN32_WINNT >= 0x0600
    113 #define COPY_FILE_COPY_SYMLINK 0x800
    114 #define COPY_FILE_NO_BUFFERING 0x1000
    115 #endif
    116 #if _WIN32_WINNT >= 0x0602
    117 #define COPY_FILE_REQUEST_SECURITY_PRIVILEGES 0x2000
    118 #define COPY_FILE_RESUME_FROM_PAUSE 0x4000
    119 #define COPY_FILE_NO_OFFLOAD 0x40000
    120 #endif
    121 
    122 #define REPLACEFILE_WRITE_THROUGH 0x1
    123 #define REPLACEFILE_IGNORE_MERGE_ERRORS 0x2
    124 #if _WIN32_WINNT >= 0x0600
    125 #define REPLACEFILE_IGNORE_ACL_ERRORS 0x4
    126 #endif
    127 
    128 #define PIPE_ACCESS_INBOUND 0x1
    129 #define PIPE_ACCESS_OUTBOUND 0x2
    130 #define PIPE_ACCESS_DUPLEX 0x3
    131 
    132 #define PIPE_CLIENT_END 0x0
    133 #define PIPE_SERVER_END 0x1
    134 
    135 #define PIPE_WAIT 0x0
    136 #define PIPE_NOWAIT 0x1
    137 #define PIPE_READMODE_BYTE 0x0
    138 #define PIPE_READMODE_MESSAGE 0x2
    139 #define PIPE_TYPE_BYTE 0x0
    140 #define PIPE_TYPE_MESSAGE 0x4
    141 #define PIPE_ACCEPT_REMOTE_CLIENTS 0x0
    142 #define PIPE_REJECT_REMOTE_CLIENTS 0x8
    143 
    144 #define PIPE_UNLIMITED_INSTANCES 255
    145 
    146 #define SECURITY_ANONYMOUS (SecurityAnonymous << 16)
    147 #define SECURITY_IDENTIFICATION (SecurityIdentification << 16)
    148 #define SECURITY_IMPERSONATION (SecurityImpersonation << 16)
    149 #define SECURITY_DELEGATION (SecurityDelegation << 16)
    150 
    151 #define SECURITY_CONTEXT_TRACKING 0x40000
    152 #define SECURITY_EFFECTIVE_ONLY 0x80000
    153 
    154 #define SECURITY_SQOS_PRESENT 0x100000
    155 #define SECURITY_VALID_SQOS_FLAGS 0x1f0000
    156 
    157 #define FAIL_FAST_GENERATE_EXCEPTION_ADDRESS 0x1
    158 #define FAIL_FAST_NO_HARD_ERROR_DLG 0x2
    159 
    160   typedef VOID (WINAPI *PFIBER_START_ROUTINE) (LPVOID lpFiberParameter);
    161   typedef PFIBER_START_ROUTINE LPFIBER_START_ROUTINE;
    162 
    163 #if defined (__i386__)
    164   typedef PLDT_ENTRY LPLDT_ENTRY;
    165 #else
    166   typedef LPVOID LPLDT_ENTRY;
    167 #endif
    168 
    169 #define SP_SERIALCOMM ((DWORD)0x1)
    170 #define PST_UNSPECIFIED ((DWORD)0x0)
    171 #define PST_RS232 ((DWORD)0x1)
    172 #define PST_PARALLELPORT ((DWORD)0x2)
    173 #define PST_RS422 ((DWORD)0x3)
    174 #define PST_RS423 ((DWORD)0x4)
    175 #define PST_RS449 ((DWORD)0x5)
    176 #define PST_MODEM ((DWORD)0x6)
    177 #define PST_FAX ((DWORD)0x21)
    178 #define PST_SCANNER ((DWORD)0x22)
    179 #define PST_NETWORK_BRIDGE ((DWORD)0x100)
    180 #define PST_LAT ((DWORD)0x101)
    181 #define PST_TCPIP_TELNET ((DWORD)0x102)
    182 #define PST_X25 ((DWORD)0x103)
    183 
    184 #define PCF_DTRDSR ((DWORD)0x1)
    185 #define PCF_RTSCTS ((DWORD)0x2)
    186 #define PCF_RLSD ((DWORD)0x4)
    187 #define PCF_PARITY_CHECK ((DWORD)0x8)
    188 #define PCF_XONXOFF ((DWORD)0x10)
    189 #define PCF_SETXCHAR ((DWORD)0x20)
    190 #define PCF_TOTALTIMEOUTS ((DWORD)0x40)
    191 #define PCF_INTTIMEOUTS ((DWORD)0x80)
    192 #define PCF_SPECIALCHARS ((DWORD)0x100)
    193 #define PCF_16BITMODE ((DWORD)0x200)
    194 
    195 #define SP_PARITY ((DWORD)0x1)
    196 #define SP_BAUD ((DWORD)0x2)
    197 #define SP_DATABITS ((DWORD)0x4)
    198 #define SP_STOPBITS ((DWORD)0x8)
    199 #define SP_HANDSHAKING ((DWORD)0x10)
    200 #define SP_PARITY_CHECK ((DWORD)0x20)
    201 #define SP_RLSD ((DWORD)0x40)
    202 
    203 #define BAUD_075 ((DWORD)0x1)
    204 #define BAUD_110 ((DWORD)0x2)
    205 #define BAUD_134_5 ((DWORD)0x4)
    206 #define BAUD_150 ((DWORD)0x8)
    207 #define BAUD_300 ((DWORD)0x10)
    208 #define BAUD_600 ((DWORD)0x20)
    209 #define BAUD_1200 ((DWORD)0x40)
    210 #define BAUD_1800 ((DWORD)0x80)
    211 #define BAUD_2400 ((DWORD)0x100)
    212 #define BAUD_4800 ((DWORD)0x200)
    213 #define BAUD_7200 ((DWORD)0x400)
    214 #define BAUD_9600 ((DWORD)0x800)
    215 #define BAUD_14400 ((DWORD)0x1000)
    216 #define BAUD_19200 ((DWORD)0x2000)
    217 #define BAUD_38400 ((DWORD)0x4000)
    218 #define BAUD_56K ((DWORD)0x8000)
    219 #define BAUD_128K ((DWORD)0x10000)
    220 #define BAUD_115200 ((DWORD)0x20000)
    221 #define BAUD_57600 ((DWORD)0x40000)
    222 #define BAUD_USER ((DWORD)0x10000000)
    223 
    224 #define DATABITS_5 ((WORD)0x1)
    225 #define DATABITS_6 ((WORD)0x2)
    226 #define DATABITS_7 ((WORD)0x4)
    227 #define DATABITS_8 ((WORD)0x8)
    228 #define DATABITS_16 ((WORD)0x10)
    229 #define DATABITS_16X ((WORD)0x20)
    230 
    231 #define STOPBITS_10 ((WORD)0x1)
    232 #define STOPBITS_15 ((WORD)0x2)
    233 #define STOPBITS_20 ((WORD)0x4)
    234 #define PARITY_NONE ((WORD)0x100)
    235 #define PARITY_ODD ((WORD)0x200)
    236 #define PARITY_EVEN ((WORD)0x400)
    237 #define PARITY_MARK ((WORD)0x800)
    238 #define PARITY_SPACE ((WORD)0x1000)
    239 
    240   typedef struct _COMMPROP {
    241     WORD wPacketLength;
    242     WORD wPacketVersion;
    243     DWORD dwServiceMask;
    244     DWORD dwReserved1;
    245     DWORD dwMaxTxQueue;
    246     DWORD dwMaxRxQueue;
    247     DWORD dwMaxBaud;
    248     DWORD dwProvSubType;
    249     DWORD dwProvCapabilities;
    250     DWORD dwSettableParams;
    251     DWORD dwSettableBaud;
    252     WORD wSettableData;
    253     WORD wSettableStopParity;
    254     DWORD dwCurrentTxQueue;
    255     DWORD dwCurrentRxQueue;
    256     DWORD dwProvSpec1;
    257     DWORD dwProvSpec2;
    258     WCHAR wcProvChar[1];
    259   } COMMPROP,*LPCOMMPROP;
    260 
    261 #define COMMPROP_INITIALIZED ((DWORD)0xe73cf52e)
    262 
    263   typedef struct _COMSTAT {
    264     DWORD fCtsHold : 1;
    265     DWORD fDsrHold : 1;
    266     DWORD fRlsdHold : 1;
    267     DWORD fXoffHold : 1;
    268     DWORD fXoffSent : 1;
    269     DWORD fEof : 1;
    270     DWORD fTxim : 1;
    271     DWORD fReserved : 25;
    272     DWORD cbInQue;
    273     DWORD cbOutQue;
    274   } COMSTAT,*LPCOMSTAT;
    275 
    276 #define DTR_CONTROL_DISABLE 0x0
    277 #define DTR_CONTROL_ENABLE 0x1
    278 #define DTR_CONTROL_HANDSHAKE 0x2
    279 
    280 #define RTS_CONTROL_DISABLE 0x0
    281 #define RTS_CONTROL_ENABLE 0x1
    282 #define RTS_CONTROL_HANDSHAKE 0x2
    283 #define RTS_CONTROL_TOGGLE 0x3
    284 
    285   typedef struct _DCB {
    286     DWORD DCBlength;
    287     DWORD BaudRate;
    288     DWORD fBinary: 1;
    289     DWORD fParity: 1;
    290     DWORD fOutxCtsFlow:1;
    291     DWORD fOutxDsrFlow:1;
    292     DWORD fDtrControl:2;
    293     DWORD fDsrSensitivity:1;
    294     DWORD fTXContinueOnXoff: 1;
    295     DWORD fOutX: 1;
    296     DWORD fInX: 1;
    297     DWORD fErrorChar: 1;
    298     DWORD fNull: 1;
    299     DWORD fRtsControl:2;
    300     DWORD fAbortOnError:1;
    301     DWORD fDummy2:17;
    302     WORD wReserved;
    303     WORD XonLim;
    304     WORD XoffLim;
    305     BYTE ByteSize;
    306     BYTE Parity;
    307     BYTE StopBits;
    308     char XonChar;
    309     char XoffChar;
    310     char ErrorChar;
    311     char EofChar;
    312     char EvtChar;
    313     WORD wReserved1;
    314   } DCB,*LPDCB;
    315 
    316   typedef struct _COMMTIMEOUTS {
    317     DWORD ReadIntervalTimeout;
    318     DWORD ReadTotalTimeoutMultiplier;
    319     DWORD ReadTotalTimeoutConstant;
    320     DWORD WriteTotalTimeoutMultiplier;
    321     DWORD WriteTotalTimeoutConstant;
    322   } COMMTIMEOUTS,*LPCOMMTIMEOUTS;
    323 
    324   typedef struct _COMMCONFIG {
    325     DWORD dwSize;
    326     WORD wVersion;
    327     WORD wReserved;
    328     DCB dcb;
    329     DWORD dwProviderSubType;
    330     DWORD dwProviderOffset;
    331     DWORD dwProviderSize;
    332     WCHAR wcProviderData[1];
    333   } COMMCONFIG,*LPCOMMCONFIG;
    334 
    335 #define FreeModule(hLibModule) FreeLibrary((hLibModule))
    336 #define MakeProcInstance(lpProc,hInstance) (lpProc)
    337 #define FreeProcInstance(lpProc) (lpProc)
    338 
    339 #define GMEM_FIXED 0x0
    340 #define GMEM_MOVEABLE 0x2
    341 #define GMEM_NOCOMPACT 0x10
    342 #define GMEM_NODISCARD 0x20
    343 #define GMEM_ZEROINIT 0x40
    344 #define GMEM_MODIFY 0x80
    345 #define GMEM_DISCARDABLE 0x100
    346 #define GMEM_NOT_BANKED 0x1000
    347 #define GMEM_SHARE 0x2000
    348 #define GMEM_DDESHARE 0x2000
    349 #define GMEM_NOTIFY 0x4000
    350 #define GMEM_LOWER GMEM_NOT_BANKED
    351 #define GMEM_VALID_FLAGS 0x7f72
    352 #define GMEM_INVALID_HANDLE 0x8000
    353 
    354 #define GHND (GMEM_MOVEABLE | GMEM_ZEROINIT)
    355 #define GPTR (GMEM_FIXED | GMEM_ZEROINIT)
    356 
    357 #define GlobalLRUNewest(h) ((HANDLE)(h))
    358 #define GlobalLRUOldest(h) ((HANDLE)(h))
    359 #define GlobalDiscard(h) GlobalReAlloc ((h), 0, GMEM_MOVEABLE)
    360 
    361 #define GMEM_DISCARDED 0x4000
    362 #define GMEM_LOCKCOUNT 0x00ff
    363 
    364   typedef struct _MEMORYSTATUS {
    365     DWORD dwLength;
    366     DWORD dwMemoryLoad;
    367     SIZE_T dwTotalPhys;
    368     SIZE_T dwAvailPhys;
    369     SIZE_T dwTotalPageFile;
    370     SIZE_T dwAvailPageFile;
    371     SIZE_T dwTotalVirtual;
    372     SIZE_T dwAvailVirtual;
    373   } MEMORYSTATUS,*LPMEMORYSTATUS;
    374 
    375 #define NUMA_NO_PREFERRED_NODE ((DWORD) -1)
    376 
    377 #define DEBUG_PROCESS 0x1
    378 #define DEBUG_ONLY_THIS_PROCESS 0x2
    379 #define CREATE_SUSPENDED 0x4
    380 #define DETACHED_PROCESS 0x8
    381 #define CREATE_NEW_CONSOLE 0x10
    382 #define NORMAL_PRIORITY_CLASS 0x20
    383 #define IDLE_PRIORITY_CLASS 0x40
    384 #define HIGH_PRIORITY_CLASS 0x80
    385 #define REALTIME_PRIORITY_CLASS 0x100
    386 #define CREATE_NEW_PROCESS_GROUP 0x200
    387 #define CREATE_UNICODE_ENVIRONMENT 0x400
    388 #define CREATE_SEPARATE_WOW_VDM 0x800
    389 #define CREATE_SHARED_WOW_VDM 0x1000
    390 #define CREATE_FORCEDOS 0x2000
    391 #define BELOW_NORMAL_PRIORITY_CLASS 0x4000
    392 #define ABOVE_NORMAL_PRIORITY_CLASS 0x8000
    393 #define INHERIT_PARENT_AFFINITY 0x10000
    394 #define INHERIT_CALLER_PRIORITY 0x20000
    395 #define CREATE_PROTECTED_PROCESS 0x40000
    396 #define EXTENDED_STARTUPINFO_PRESENT 0x80000
    397 #define PROCESS_MODE_BACKGROUND_BEGIN 0x100000
    398 #define PROCESS_MODE_BACKGROUND_END 0x200000
    399 #define CREATE_BREAKAWAY_FROM_JOB 0x1000000
    400 #define CREATE_PRESERVE_CODE_AUTHZ_LEVEL 0x2000000
    401 #define CREATE_DEFAULT_ERROR_MODE 0x4000000
    402 #define CREATE_NO_WINDOW 0x8000000
    403 #define PROFILE_USER 0x10000000
    404 #define PROFILE_KERNEL 0x20000000
    405 #define PROFILE_SERVER 0x40000000
    406 #define CREATE_IGNORE_SYSTEM_DEFAULT 0x80000000
    407 
    408 #define STACK_SIZE_PARAM_IS_A_RESERVATION 0x10000
    409 
    410 #define THREAD_PRIORITY_LOWEST THREAD_BASE_PRIORITY_MIN
    411 #define THREAD_PRIORITY_BELOW_NORMAL (THREAD_PRIORITY_LOWEST+1)
    412 #define THREAD_PRIORITY_NORMAL 0
    413 #define THREAD_PRIORITY_HIGHEST THREAD_BASE_PRIORITY_MAX
    414 #define THREAD_PRIORITY_ABOVE_NORMAL (THREAD_PRIORITY_HIGHEST-1)
    415 #define THREAD_PRIORITY_ERROR_RETURN (MAXLONG)
    416 
    417 #define THREAD_PRIORITY_TIME_CRITICAL THREAD_BASE_PRIORITY_LOWRT
    418 #define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE
    419 
    420 #define THREAD_MODE_BACKGROUND_BEGIN 0x00010000
    421 #define THREAD_MODE_BACKGROUND_END 0x00020000
    422 
    423 #define VOLUME_NAME_DOS 0x0
    424 #define VOLUME_NAME_GUID 0x1
    425 #define VOLUME_NAME_NT 0x2
    426 #define VOLUME_NAME_NONE 0x4
    427 
    428 #define FILE_NAME_NORMALIZED 0x0
    429 #define FILE_NAME_OPENED 0x8
    430 
    431   typedef struct _JIT_DEBUG_INFO {
    432     DWORD dwSize;
    433     DWORD dwProcessorArchitecture;
    434     DWORD dwThreadID;
    435     DWORD dwReserved0;
    436     ULONG64 lpExceptionAddress;
    437     ULONG64 lpExceptionRecord;
    438     ULONG64 lpContextRecord;
    439   } JIT_DEBUG_INFO,*LPJIT_DEBUG_INFO;
    440 
    441   typedef JIT_DEBUG_INFO JIT_DEBUG_INFO32, *LPJIT_DEBUG_INFO32;
    442   typedef JIT_DEBUG_INFO JIT_DEBUG_INFO64, *LPJIT_DEBUG_INFO64;
    443 
    444 #ifndef __WIDL__
    445   typedef PEXCEPTION_RECORD LPEXCEPTION_RECORD;
    446   typedef PEXCEPTION_POINTERS LPEXCEPTION_POINTERS;
    447 #endif
    448 
    449 #define DRIVE_UNKNOWN 0
    450 #define DRIVE_NO_ROOT_DIR 1
    451 #define DRIVE_REMOVABLE 2
    452 #define DRIVE_FIXED 3
    453 #define DRIVE_REMOTE 4
    454 #define DRIVE_CDROM 5
    455 #define DRIVE_RAMDISK 6
    456 
    457 #define GetFreeSpace(w) (__MSABI_LONG(0x100000))
    458 
    459 #define FILE_TYPE_UNKNOWN 0x0
    460 #define FILE_TYPE_DISK 0x1
    461 #define FILE_TYPE_CHAR 0x2
    462 #define FILE_TYPE_PIPE 0x3
    463 #define FILE_TYPE_REMOTE 0x8000
    464 
    465 #define STD_INPUT_HANDLE ((DWORD)-10)
    466 #define STD_OUTPUT_HANDLE ((DWORD)-11)
    467 #define STD_ERROR_HANDLE ((DWORD)-12)
    468 
    469 #define NOPARITY 0
    470 #define ODDPARITY 1
    471 #define EVENPARITY 2
    472 #define MARKPARITY 3
    473 #define SPACEPARITY 4
    474 
    475 #define ONESTOPBIT 0
    476 #define ONE5STOPBITS 1
    477 #define TWOSTOPBITS 2
    478 
    479 #define IGNORE 0
    480 #define INFINITE 0xffffffff
    481 
    482 #define CBR_110 110
    483 #define CBR_300 300
    484 #define CBR_600 600
    485 #define CBR_1200 1200
    486 #define CBR_2400 2400
    487 #define CBR_4800 4800
    488 #define CBR_9600 9600
    489 #define CBR_14400 14400
    490 #define CBR_19200 19200
    491 #define CBR_38400 38400
    492 #define CBR_56000 56000
    493 #define CBR_57600 57600
    494 #define CBR_115200 115200
    495 #define CBR_128000 128000
    496 #define CBR_256000 256000
    497 
    498 #define CE_RXOVER 0x1
    499 #define CE_OVERRUN 0x2
    500 #define CE_RXPARITY 0x4
    501 #define CE_FRAME 0x8
    502 #define CE_BREAK 0x10
    503 #define CE_TXFULL 0x100
    504 #define CE_PTO 0x200
    505 #define CE_IOE 0x400
    506 #define CE_DNS 0x800
    507 #define CE_OOP 0x1000
    508 #define CE_MODE 0x8000
    509 
    510 #define IE_BADID (-1)
    511 #define IE_OPEN (-2)
    512 #define IE_NOPEN (-3)
    513 #define IE_MEMORY (-4)
    514 #define IE_DEFAULT (-5)
    515 #define IE_HARDWARE (-10)
    516 #define IE_BYTESIZE (-11)
    517 #define IE_BAUDRATE (-12)
    518 
    519 #define EV_RXCHAR 0x1
    520 #define EV_RXFLAG 0x2
    521 #define EV_TXEMPTY 0x4
    522 #define EV_CTS 0x8
    523 #define EV_DSR 0x10
    524 #define EV_RLSD 0x20
    525 #define EV_BREAK 0x40
    526 #define EV_ERR 0x80
    527 #define EV_RING 0x100
    528 #define EV_PERR 0x200
    529 #define EV_RX80FULL 0x400
    530 #define EV_EVENT1 0x800
    531 #define EV_EVENT2 0x1000
    532 
    533 #define SETXOFF 1
    534 #define SETXON 2
    535 #define SETRTS 3
    536 #define CLRRTS 4
    537 #define SETDTR 5
    538 #define CLRDTR 6
    539 #define RESETDEV 7
    540 #define SETBREAK 8
    541 #define CLRBREAK 9
    542 
    543 #define PURGE_TXABORT 0x1
    544 #define PURGE_RXABORT 0x2
    545 #define PURGE_TXCLEAR 0x4
    546 #define PURGE_RXCLEAR 0x8
    547 
    548 #define LPTx 0x80
    549 
    550 #define MS_CTS_ON ((DWORD)0x10)
    551 #define MS_DSR_ON ((DWORD)0x20)
    552 #define MS_RING_ON ((DWORD)0x40)
    553 #define MS_RLSD_ON ((DWORD)0x80)
    554 
    555 #define S_QUEUEEMPTY 0
    556 #define S_THRESHOLD 1
    557 #define S_ALLTHRESHOLD 2
    558 
    559 #define S_NORMAL 0
    560 #define S_LEGATO 1
    561 #define S_STACCATO 2
    562 
    563 #define S_PERIOD512 0
    564 #define S_PERIOD1024 1
    565 #define S_PERIOD2048 2
    566 #define S_PERIODVOICE 3
    567 #define S_WHITE512 4
    568 #define S_WHITE1024 5
    569 #define S_WHITE2048 6
    570 #define S_WHITEVOICE 7
    571 
    572 #define S_SERDVNA (-1)
    573 #define S_SEROFM (-2)
    574 #define S_SERMACT (-3)
    575 #define S_SERQFUL (-4)
    576 #define S_SERBDNT (-5)
    577 #define S_SERDLN (-6)
    578 #define S_SERDCC (-7)
    579 #define S_SERDTP (-8)
    580 #define S_SERDVL (-9)
    581 #define S_SERDMD (-10)
    582 #define S_SERDSH (-11)
    583 #define S_SERDPT (-12)
    584 #define S_SERDFQ (-13)
    585 #define S_SERDDR (-14)
    586 #define S_SERDSR (-15)
    587 #define S_SERDST (-16)
    588 
    589 #define NMPWAIT_WAIT_FOREVER 0xffffffff
    590 #define NMPWAIT_NOWAIT 0x1
    591 #define NMPWAIT_USE_DEFAULT_WAIT 0x0
    592 
    593 #define FS_CASE_IS_PRESERVED FILE_CASE_PRESERVED_NAMES
    594 #define FS_CASE_SENSITIVE FILE_CASE_SENSITIVE_SEARCH
    595 #define FS_UNICODE_STORED_ON_DISK FILE_UNICODE_ON_DISK
    596 #define FS_PERSISTENT_ACLS FILE_PERSISTENT_ACLS
    597 #define FS_VOL_IS_COMPRESSED FILE_VOLUME_IS_COMPRESSED
    598 #define FS_FILE_COMPRESSION FILE_FILE_COMPRESSION
    599 #define FS_FILE_ENCRYPTION FILE_SUPPORTS_ENCRYPTION
    600 
    601 #define OF_READ 0x0
    602 #define OF_WRITE 0x1
    603 #define OF_READWRITE 0x2
    604 #define OF_SHARE_COMPAT 0x0
    605 #define OF_SHARE_EXCLUSIVE 0x10
    606 #define OF_SHARE_DENY_WRITE 0x20
    607 #define OF_SHARE_DENY_READ 0x30
    608 #define OF_SHARE_DENY_NONE 0x40
    609 #define OF_PARSE 0x100
    610 #define OF_DELETE 0x200
    611 #define OF_VERIFY 0x400
    612 #define OF_CANCEL 0x800
    613 #define OF_CREATE 0x1000
    614 #define OF_PROMPT 0x2000
    615 #define OF_EXIST 0x4000
    616 #define OF_REOPEN 0x8000
    617 
    618 #define OFS_MAXPATHNAME 128
    619 
    620   typedef struct _OFSTRUCT {
    621     BYTE cBytes;
    622     BYTE fFixedDisk;
    623     WORD nErrCode;
    624     WORD Reserved1;
    625     WORD Reserved2;
    626     CHAR szPathName[OFS_MAXPATHNAME];
    627   } OFSTRUCT, *LPOFSTRUCT,*POFSTRUCT;
    628 
    629 #ifndef NOWINBASEINTERLOCK
    630 #ifndef _NTOS_
    631 #if defined (__ia64__) && !defined (RC_INVOKED)
    632 
    633 #define InterlockedIncrement _InterlockedIncrement
    634 #define InterlockedIncrementAcquire _InterlockedIncrement_acq
    635 #define InterlockedIncrementRelease _InterlockedIncrement_rel
    636 #define InterlockedDecrement _InterlockedDecrement
    637 #define InterlockedDecrementAcquire _InterlockedDecrement_acq
    638 #define InterlockedDecrementRelease _InterlockedDecrement_rel
    639 #define InterlockedExchange _InterlockedExchange
    640 #define InterlockedExchangeAdd _InterlockedExchangeAdd
    641 #define InterlockedCompareExchange _InterlockedCompareExchange
    642 #define InterlockedCompareExchangeAcquire _InterlockedCompareExchange_acq
    643 #define InterlockedCompareExchangeRelease _InterlockedCompareExchange_rel
    644 #define InterlockedExchangePointer _InterlockedExchangePointer
    645 #define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
    646 #define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer_rel
    647 #define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer_acq
    648 
    649 #define InterlockedIncrement64 _InterlockedIncrement64
    650 #define InterlockedDecrement64 _InterlockedDecrement64
    651 #define InterlockedExchange64 _InterlockedExchange64
    652 #define InterlockedExchangeAcquire64 _InterlockedExchange64_acq
    653 #define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
    654 #define InterlockedCompareExchange64 _InterlockedCompareExchange64
    655 #define InterlockedCompareExchangeAcquire64 _InterlockedCompareExchange64_acq
    656 #define InterlockedCompareExchangeRelease64 _InterlockedCompareExchange64_rel
    657 #define InterlockedCompare64Exchange128 _InterlockedCompare64Exchange128
    658 #define InterlockedCompare64ExchangeAcquire128 _InterlockedCompare64Exchange128_acq
    659 #define InterlockedCompare64ExchangeRelease128 _InterlockedCompare64Exchange128_rel
    660 
    661 #define InterlockedOr _InterlockedOr
    662 #define InterlockedOrAcquire _InterlockedOr_acq
    663 #define InterlockedOrRelease _InterlockedOr_rel
    664 #define InterlockedOr8 _InterlockedOr8
    665 #define InterlockedOr8Acquire _InterlockedOr8_acq
    666 #define InterlockedOr8Release _InterlockedOr8_rel
    667 #define InterlockedOr16 _InterlockedOr16
    668 #define InterlockedOr16Acquire _InterlockedOr16_acq
    669 #define InterlockedOr16Release _InterlockedOr16_rel
    670 #define InterlockedOr64 _InterlockedOr64
    671 #define InterlockedOr64Acquire _InterlockedOr64_acq
    672 #define InterlockedOr64Release _InterlockedOr64_rel
    673 #define InterlockedXor _InterlockedXor
    674 #define InterlockedXorAcquire _InterlockedXor_acq
    675 #define InterlockedXorRelease _InterlockedXor_rel
    676 #define InterlockedXor8 _InterlockedXor8
    677 #define InterlockedXor8Acquire _InterlockedXor8_acq
    678 #define InterlockedXor8Release _InterlockedXor8_rel
    679 #define InterlockedXor16 _InterlockedXor16
    680 #define InterlockedXor16Acquire _InterlockedXor16_acq
    681 #define InterlockedXor16Release _InterlockedXor16_rel
    682 #define InterlockedXor64 _InterlockedXor64
    683 #define InterlockedXor64Acquire _InterlockedXor64_acq
    684 #define InterlockedXor64Release _InterlockedXor64_rel
    685 #define InterlockedAnd _InterlockedAnd
    686 #define InterlockedAndAcquire _InterlockedAnd_acq
    687 #define InterlockedAndRelease _InterlockedAnd_rel
    688 #define InterlockedAnd8 _InterlockedAnd8
    689 #define InterlockedAnd8Acquire _InterlockedAnd8_acq
    690 #define InterlockedAnd8Release _InterlockedAnd8_rel
    691 #define InterlockedAnd16 _InterlockedAnd16
    692 #define InterlockedAnd16Acquire _InterlockedAnd16_acq
    693 #define InterlockedAnd16Release _InterlockedAnd16_rel
    694 #define InterlockedAnd64 _InterlockedAnd64
    695 #define InterlockedAnd64Acquire _InterlockedAnd64_acq
    696 #define InterlockedAnd64Release _InterlockedAnd64_rel
    697 
    698   LONG __cdecl InterlockedOr (LONG volatile *Destination, LONG Value);
    699   LONG __cdecl InterlockedOrAcquire (LONG volatile *Destination, LONG Value);
    700   LONG __cdecl InterlockedOrRelease (LONG volatile *Destination, LONG Value);
    701   char __cdecl InterlockedOr8 (char volatile *Destination, char Value);
    702   char __cdecl InterlockedOr8Acquire (char volatile *Destination, char Value);
    703   char __cdecl InterlockedOr8Release (char volatile *Destination, char Value);
    704   SHORT __cdecl InterlockedOr16 (SHORT volatile *Destination, SHORT Value);
    705   SHORT __cdecl InterlockedOr16Acquire (SHORT volatile *Destination, SHORT Value);
    706   SHORT __cdecl InterlockedOr16Release (SHORT volatile *Destination, SHORT Value);
    707   LONGLONG __cdecl InterlockedOr64 (LONGLONG volatile *Destination, LONGLONG Value);
    708   LONGLONG __cdecl InterlockedOr64Acquire (LONGLONG volatile *Destination, LONGLONG Value);
    709   LONGLONG __cdecl InterlockedOr64Release (LONGLONG volatile *Destination, LONGLONG Value);
    710   LONG __cdecl InterlockedXor (LONG volatile *Destination, LONG Value);
    711   LONG __cdecl InterlockedXorAcquire (LONG volatile *Destination, LONG Value);
    712   LONG __cdecl InterlockedXorRelease (LONG volatile *Destination, LONG Value);
    713   char __cdecl InterlockedXor8 (char volatile *Destination, char Value);
    714   char __cdecl InterlockedXor8Acquire (char volatile *Destination, char Value);
    715   char __cdecl InterlockedXor8Release (char volatile *Destination, char Value);
    716   SHORT __cdecl InterlockedXor16 (SHORT volatile *Destination, SHORT Value);
    717   SHORT __cdecl InterlockedXor16Acquire (SHORT volatile *Destination, SHORT Value);
    718   SHORT __cdecl InterlockedXor16Release (SHORT volatile *Destination, SHORT Value);
    719   LONGLONG __cdecl InterlockedXor64 (LONGLONG volatile *Destination, LONGLONG Value);
    720   LONGLONG __cdecl InterlockedXor64Acquire (LONGLONG volatile *Destination, LONGLONG Value);
    721   LONGLONG __cdecl InterlockedXor64Release (LONGLONG volatile *Destination, LONGLONG Value);
    722   LONG __cdecl InterlockedAnd (LONG volatile *Destination, LONG Value);
    723   LONG __cdecl InterlockedAndAcquire (LONG volatile *Destination, LONG Value);
    724   LONG __cdecl InterlockedAndRelease (LONG volatile *Destination, LONG Value);
    725   char __cdecl InterlockedAnd8 (char volatile *Destination, char Value);
    726   char __cdecl InterlockedAnd8Acquire (char volatile *Destination, char Value);
    727   char __cdecl InterlockedAnd8Release (char volatile *Destination, char Value);
    728   SHORT __cdecl InterlockedAnd16 (SHORT volatile *Destination, SHORT Value);
    729   SHORT __cdecl InterlockedAnd16Acquire (SHORT volatile *Destination, SHORT Value);
    730   SHORT __cdecl InterlockedAnd16Release (SHORT volatile *Destination, SHORT Value);
    731   LONGLONG __cdecl InterlockedAnd64 (LONGLONG volatile *Destination, LONGLONG Value);
    732   LONGLONG __cdecl InterlockedAnd64Acquire (LONGLONG volatile *Destination, LONGLONG Value);
    733   LONGLONG __cdecl InterlockedAnd64Release (LONGLONG volatile *Destination, LONGLONG Value);
    734   LONGLONG __cdecl InterlockedIncrement64 (LONGLONG volatile *Addend);
    735   LONGLONG __cdecl InterlockedDecrement64 (LONGLONG volatile *Addend);
    736   LONG __cdecl InterlockedIncrementAcquire (LONG volatile *Addend);
    737   LONG __cdecl InterlockedDecrementAcquire (LONG volatile *Addend);
    738   LONG __cdecl InterlockedIncrementRelease (LONG volatile *Addend);
    739   LONG __cdecl InterlockedDecrementRelease (LONG volatile *Addend);
    740   LONGLONG __cdecl InterlockedExchange64 (LONGLONG volatile *Target, LONGLONG Value);
    741   LONGLONG __cdecl InterlockedExchangeAcquire64 (LONGLONG volatile *Target, LONGLONG Value);
    742   LONGLONG __cdecl InterlockedExchangeAdd64 (LONGLONG volatile *Addend, LONGLONG Value);
    743   LONGLONG __cdecl InterlockedCompareExchange64 (LONGLONG volatile *Destination, LONGLONG ExChange, LONGLONG Comperand);
    744   LONGLONG __cdecl InterlockedCompareExchangeAcquire64 (LONGLONG volatile *Destination, LONGLONG ExChange, LONGLONG Comperand);
    745   LONGLONG __cdecl InterlockedCompareExchangeRelease64 (LONGLONG volatile *Destination, LONGLONG ExChange, LONGLONG Comperand);
    746   LONG64 __cdecl InterlockedCompare64Exchange128 (LONG64 volatile *Destination, LONG64 ExchangeHigh, LONG64 ExchangeLow, LONG64 Comperand);
    747   LONG64 __cdecl InterlockedCompare64ExchangeAcquire128 (LONG64 volatile *Destination, LONG64 ExchangeHigh, LONG64 ExchangeLow, LONG64 Comperand);
    748   LONG64 __cdecl InterlockedCompare64ExchangeRelease128 (LONG64 volatile *Destination, LONG64 ExchangeHigh, LONG64 ExchangeLow, LONG64 Comperand);
    749   LONG __cdecl InterlockedIncrement (LONG volatile *lpAddend);
    750   LONG __cdecl InterlockedDecrement (LONG volatile *lpAddend);
    751   LONG __cdecl InterlockedExchange (LONG volatile *Target, LONG Value);
    752   LONG __cdecl InterlockedExchangeAdd (LONG volatile *Addend, LONG Value);
    753   LONG __cdecl InterlockedCompareExchange (LONG volatile *Destination, LONG ExChange, LONG Comperand);
    754   LONG __cdecl InterlockedCompareExchangeRelease (LONG volatile *Destination, LONG ExChange, LONG Comperand);
    755   LONG __cdecl InterlockedCompareExchangeAcquire (LONG volatile *Destination, LONG ExChange, LONG Comperand);
    756   PVOID __cdecl InterlockedExchangePointer (PVOID volatile *Target, PVOID Value);
    757   PVOID __cdecl InterlockedCompareExchangePointer (PVOID volatile *Destination, PVOID ExChange, PVOID Comperand);
    758   PVOID __cdecl InterlockedCompareExchangePointerAcquire (PVOID volatile *Destination, PVOID Exchange, PVOID Comperand);
    759   PVOID __cdecl InterlockedCompareExchangePointerRelease (PVOID volatile *Destination, PVOID Exchange, PVOID Comperand);
    760 
    761 #if !defined(__WIDL__) && !defined(__CRT__NO_INLINE)
    762 #ifndef InterlockedAnd
    763 #define InterlockedAnd InterlockedAnd_Inline
    764 
    765   FORCEINLINE LONG InterlockedAnd_Inline(LONG volatile *Target, LONG Set) {
    766     LONG i, j = *Target;
    767 
    768     do {
    769       i = j;
    770       j = InterlockedCompareExchange (Target, i &Set, i);
    771     } while (i != j);
    772     return j;
    773   }
    774 #endif
    775 
    776 #ifndef InterlockedOr
    777 #define InterlockedOr InterlockedOr_Inline
    778 
    779   FORCEINLINE LONG InterlockedOr_Inline(LONG volatile *Target, LONG Set) {
    780     LONG i, j = *Target;
    781 
    782     do {
    783       i = j;
    784       j = InterlockedCompareExchange (Target, i | Set, i);
    785     } while (i != j);
    786     return j;
    787   }
    788 #endif
    789 
    790 #ifndef InterlockedXor
    791 #define InterlockedXor InterlockedXor_Inline
    792 
    793   FORCEINLINE LONG InterlockedXor_Inline(LONG volatile *Target, LONG Set) {
    794     LONG i, j = *Target;
    795 
    796     do {
    797       i = j;
    798       j = InterlockedCompareExchange (Target, i ^ Set, i);
    799     } while (i != j);
    800     return j;
    801   }
    802 #endif
    803 
    804 #ifndef InterlockedAnd64
    805 #define InterlockedAnd64 InterlockedAnd64_Inline
    806 
    807   FORCEINLINE LONGLONG InterlockedAnd64_Inline(LONGLONG volatile *Destination, LONGLONG Value) {
    808     LONGLONG Old;
    809 
    810     do {
    811       Old = *Destination;
    812     } while (InterlockedCompareExchange64 (Destination, Old &Value, Old) != Old);
    813     return Old;
    814   }
    815 #endif
    816 
    817 #ifndef InterlockedOr64
    818 #define InterlockedOr64 InterlockedOr64_Inline
    819 
    820   FORCEINLINE LONGLONG InterlockedOr64_Inline(LONGLONG volatile *Destination, LONGLONG Value) {
    821     LONGLONG Old;
    822 
    823     do {
    824       Old = *Destination;
    825     } while (InterlockedCompareExchange64 (Destination, Old | Value, Old) != Old);
    826     return Old;
    827   }
    828 #endif
    829 
    830 #ifndef InterlockedXor64
    831 #define InterlockedXor64 InterlockedXor64_Inline
    832 
    833   FORCEINLINE LONGLONG InterlockedXor64_Inline(LONGLONG volatile *Destination, LONGLONG Value) {
    834     LONGLONG Old;
    835 
    836     do {
    837       Old = *Destination;
    838     } while (InterlockedCompareExchange64 (Destination, Old ^ Value, Old) != Old);
    839     return Old;
    840   }
    841 #endif
    842 
    843 #ifndef InterlockedBitTestAndSet
    844 #define InterlockedBitTestAndSet InterlockedBitTestAndSet_Inline
    845 
    846   FORCEINLINE BOOLEAN InterlockedBitTestAndSet_Inline(LONG volatile *Base, LONG Bit) {
    847     LONG tBit = 1 << (Bit & (sizeof (*Base) * 8 - 1));
    848 
    849     return (BOOLEAN) ((InterlockedOr (&Base[Bit / (sizeof (*Base) * 8)], tBit) & tBit) != 0);
    850   }
    851 #endif
    852 
    853 #ifndef InterlockedBitTestAndReset
    854 #define InterlockedBitTestAndReset InterlockedBitTestAndReset_Inline
    855 
    856   FORCEINLINE BOOLEAN InterlockedBitTestAndReset_Inline(LONG volatile *Base, LONG Bit) {
    857     LONG tBit = 1 << (Bit & (sizeof (*Base) * 8 - 1));
    858 
    859     return (BOOLEAN) ((InterlockedAnd (&Base[Bit / (sizeof (*Base) * 8)], ~tBit) & tBit) != 0);
    860   }
    861 #endif
    862 
    863 #ifndef InterlockedBitTestAndComplement
    864 #define InterlockedBitTestAndComplement InterlockedBitTestAndComplement_Inline
    865 
    866   FORCEINLINE BOOLEAN InterlockedBitTestAndComplement_Inline(LONG volatile *Base, LONG Bit) {
    867     LONG tBit = 1 << (Bit & (sizeof (*Base) * 8 - 1));
    868 
    869     return (BOOLEAN) ((InterlockedXor (&Base[Bit / (sizeof (*Base) * 8)], tBit) & tBit) != 0);
    870   }
    871 #endif
    872 #endif
    873 
    874 #elif defined (__x86_64__) && !defined (RC_INVOKED)
    875 #define InterlockedIncrement _InterlockedIncrement
    876 #define InterlockedIncrementAcquire InterlockedIncrement
    877 #define InterlockedIncrementRelease InterlockedIncrement
    878 #define InterlockedDecrement _InterlockedDecrement
    879 #define InterlockedDecrementAcquire InterlockedDecrement
    880 #define InterlockedDecrementRelease InterlockedDecrement
    881 #define InterlockedExchange _InterlockedExchange
    882 #define InterlockedExchangeAdd _InterlockedExchangeAdd
    883 #define InterlockedCompareExchange _InterlockedCompareExchange
    884 #define InterlockedCompareExchangeAcquire InterlockedCompareExchange
    885 #define InterlockedCompareExchangeRelease InterlockedCompareExchange
    886 #define InterlockedExchangePointer _InterlockedExchangePointer
    887 #define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
    888 #define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer
    889 #define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer
    890 #define InterlockedAnd64 _InterlockedAnd64
    891 #define InterlockedOr64 _InterlockedOr64
    892 #define InterlockedXor64 _InterlockedXor64
    893 #define InterlockedIncrement64 _InterlockedIncrement64
    894 #define InterlockedDecrement64 _InterlockedDecrement64
    895 #define InterlockedExchange64 _InterlockedExchange64
    896 #define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
    897 #define InterlockedCompareExchange64 _InterlockedCompareExchange64
    898 #define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64
    899 #define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64
    900 
    901 #define InterlockedAnd8 _InterlockedAnd8
    902 #define InterlockedOr8 _InterlockedOr8
    903 #define InterlockedXor8 _InterlockedXor8
    904 #define InterlockedAnd16 _InterlockedAnd16
    905 #define InterlockedOr16 _InterlockedOr16
    906 #define InterlockedXor16 _InterlockedXor16
    907 
    908   LONG __cdecl InterlockedAnd(LONG volatile *Destination, LONG Value);
    909   LONG __cdecl InterlockedOr(LONG volatile *Destination, LONG Value);
    910   LONG __cdecl InterlockedXor(LONG volatile *Destination, LONG Value);
    911   /* moved to psdk_inc/intrin-impl.h
    912   LONG __cdecl InterlockedIncrement(LONG volatile *Addend);
    913   LONG __cdecl InterlockedDecrement(LONG volatile *Addend);
    914   LONG __cdecl InterlockedExchange(LONG volatile *Target, LONG Value);
    915   LONG __cdecl InterlockedExchangeAdd(LONG volatile *Addend, LONG Value);
    916   LONG __cdecl InterlockedCompareExchange(LONG volatile *Destination, LONG ExChange, LONG Comperand);
    917   PVOID __cdecl InterlockedCompareExchangePointer(PVOID volatile *Destination, PVOID Exchange, PVOID Comperand);
    918   PVOID __cdecl InterlockedExchangePointer(PVOID volatile *Target, PVOID Value);
    919   LONG64 __cdecl InterlockedAnd64(LONG64 volatile *Destination, LONG64 Value);
    920   LONG64 __cdecl InterlockedOr64(LONG64 volatile *Destination, LONG64 Value);
    921   LONG64 __cdecl InterlockedXor64(LONG64 volatile *Destination, LONG64 Value);
    922   LONG64 __cdecl InterlockedIncrement64(LONG64 volatile *Addend);
    923   LONG64 __cdecl InterlockedDecrement64(LONG64 volatile *Addend);
    924   LONG64 __cdecl InterlockedExchange64(LONG64 volatile *Target, LONG64 Value);
    925   LONG64 __cdecl InterlockedExchangeAdd64(LONG64 volatile *Addend, LONG64 Value);
    926   LONG64 __cdecl InterlockedCompareExchange64(LONG64 volatile *Destination, LONG64 ExChange, LONG64 Comperand); */
    927 
    928   char __cdecl InterlockedAnd8(char volatile *Destination, char Value);
    929   char __cdecl InterlockedOr8(char volatile *Destination, char Value);
    930   char __cdecl InterlockedXor8(char volatile *Destination, char Value);
    931   SHORT __cdecl InterlockedAnd16(SHORT volatile *Destination, SHORT Value);
    932   SHORT __cdecl InterlockedOr16(SHORT volatile *Destination, SHORT Value);
    933   SHORT __cdecl InterlockedXor16(SHORT volatile *Destination, SHORT Value);
    934 
    935 #elif defined (__arm__) && !defined (RC_INVOKED)
    936 #define InterlockedAnd _InterlockedAnd
    937 #define InterlockedOr _InterlockedOr
    938 #define InterlockedXor _InterlockedXor
    939 #define InterlockedIncrement _InterlockedIncrement
    940 #define InterlockedDecrement _InterlockedDecrement
    941 #define InterlockedExchange _InterlockedExchange
    942 #define InterlockedExchangeAdd _InterlockedExchangeAdd
    943 #define InterlockedExchangePointer _InterlockedExchangePointer
    944 #define InterlockedCompareExchange _InterlockedCompareExchange
    945 #define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
    946 #define InterlockedAnd64 _InterlockedAnd64
    947 #define InterlockedOr64 _InterlockedOr64
    948 #define InterlockedXor64 _InterlockedXor64
    949 #define InterlockedIncrement64 _InterlockedIncrement64
    950 #define InterlockedDecrement64 _InterlockedDecrement64
    951 #define InterlockedExchange64 _InterlockedExchange64
    952 #define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
    953 #define InterlockedCompareExchange64 _InterlockedCompareExchange64
    954 
    955   LONG InterlockedIncrement (LONG volatile *Addend);
    956   LONG InterlockedDecrement (LONG volatile *Addend);
    957   LONG InterlockedExchange (LONG volatile *Target, LONG Value);
    958   LONG InterlockedExchangeAdd (LONG volatile *Addend, LONG Value);
    959   LONG InterlockedCompareExchange (LONG volatile *Destination, LONG ExChange, LONG Comperand);
    960   PVOID InterlockedCompareExchangePointer (PVOID volatile *Destination, PVOID Exchange, PVOID Comperand);
    961   PVOID InterlockedExchangePointer (PVOID volatile *Target, PVOID Value);
    962   LONG64 InterlockedAnd64 (LONG64 volatile *Destination, LONG64 Value);
    963   LONG64 InterlockedOr64 (LONG64 volatile *Destination, LONG64 Value);
    964   LONG64 InterlockedXor64 (LONG64 volatile *Destination, LONG64 Value);
    965   LONG64 InterlockedIncrement64 (LONG64 volatile *Addend);
    966   LONG64 InterlockedDecrement64 (LONG64 volatile *Addend);
    967   LONG64 InterlockedExchange64 (LONG64 volatile *Target, LONG64 Value);
    968   LONG64 InterlockedExchangeAdd64 (LONG64 volatile *Addend, LONG64 Value);
    969   LONG64 InterlockedCompareExchange64 (LONG64 volatile *Destination, LONG64 ExChange, LONG64 Comperand);
    970 #else
    971 #if !defined (__WIDL__) && defined (__MINGW_INTRIN_INLINE)
    972   FORCEINLINE LONGLONG InterlockedAnd64 (LONGLONG volatile *Destination, LONGLONG Value) {
    973     LONGLONG Old;
    974 
    975     do {
    976       Old = *Destination;
    977     } while (InterlockedCompareExchange64 (Destination, Old &Value, Old) != Old);
    978     return Old;
    979   }
    980 
    981   FORCEINLINE LONGLONG InterlockedOr64 (LONGLONG volatile *Destination, LONGLONG Value) {
    982     LONGLONG Old;
    983 
    984     do {
    985       Old = *Destination;
    986     } while (InterlockedCompareExchange64 (Destination, Old | Value, Old) != Old);
    987     return Old;
    988   }
    989 
    990   FORCEINLINE LONGLONG InterlockedXor64 (LONGLONG volatile *Destination, LONGLONG Value) {
    991     LONGLONG Old;
    992 
    993     do {
    994       Old = *Destination;
    995     } while (InterlockedCompareExchange64 (Destination, Old ^ Value, Old) != Old);
    996     return Old;
    997   }
    998 
    999   FORCEINLINE LONGLONG InterlockedIncrement64 (LONGLONG volatile *Addend) {
   1000     LONGLONG Old;
   1001 
   1002     do {
   1003       Old = *Addend;
   1004     } while (InterlockedCompareExchange64 (Addend, Old + 1, Old) != Old);
   1005     return Old + 1;
   1006   }
   1007 
   1008   FORCEINLINE LONGLONG InterlockedDecrement64 (LONGLONG volatile *Addend) {
   1009     LONGLONG Old;
   1010 
   1011     do {
   1012       Old = *Addend;
   1013     } while (InterlockedCompareExchange64 (Addend, Old - 1, Old) != Old);
   1014     return Old - 1;
   1015   }
   1016 
   1017   FORCEINLINE LONGLONG InterlockedExchange64 (LONGLONG volatile *Target, LONGLONG Value) {
   1018     LONGLONG Old;
   1019 
   1020     do {
   1021       Old = *Target;
   1022     } while (InterlockedCompareExchange64 (Target, Value, Old) != Old);
   1023     return Old;
   1024   }
   1025 
   1026   FORCEINLINE LONGLONG InterlockedExchangeAdd64 (LONGLONG volatile *Addend, LONGLONG Value) {
   1027     LONGLONG Old;
   1028 
   1029     do {
   1030       Old = *Addend;
   1031     } while (InterlockedCompareExchange64 (Addend, Old + Value, Old) != Old);
   1032     return Old;
   1033   }
   1034 #endif
   1035 
   1036 #ifdef __cplusplus
   1037   FORCEINLINE PVOID __cdecl __InlineInterlockedCompareExchangePointer (PVOID volatile *Destination, PVOID ExChange, PVOID Comperand) {
   1038     return ((PVOID) (LONG_PTR)InterlockedCompareExchange ((LONG volatile *)Destination,(LONG) (LONG_PTR)ExChange,(LONG) (LONG_PTR)Comperand));
   1039   }
   1040 
   1041 #define InterlockedCompareExchangePointer __InlineInterlockedCompareExchangePointer
   1042 #else
   1043 #define InterlockedCompareExchangePointer(Destination, ExChange, Comperand) (PVOID) (LONG_PTR)InterlockedCompareExchange ((LONG volatile *) (Destination),(LONG) (LONG_PTR) (ExChange),(LONG) (LONG_PTR) (Comperand))
   1044 #endif
   1045 
   1046 #define InterlockedIncrementAcquire InterlockedIncrement
   1047 #define InterlockedIncrementRelease InterlockedIncrement
   1048 #define InterlockedDecrementAcquire InterlockedDecrement
   1049 #define InterlockedDecrementRelease InterlockedDecrement
   1050 #define InterlockedIncrementAcquire InterlockedIncrement
   1051 #define InterlockedIncrementRelease InterlockedIncrement
   1052 #define InterlockedCompareExchangeAcquire InterlockedCompareExchange
   1053 #define InterlockedCompareExchangeRelease InterlockedCompareExchange
   1054 #define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64
   1055 #define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64
   1056 #define InterlockedCompareExchangePointerAcquire InterlockedCompareExchangePointer
   1057 #define InterlockedCompareExchangePointerRelease InterlockedCompareExchangePointer
   1058 #endif
   1059 #endif
   1060 #endif
   1061 
   1062 #define UnlockResource(hResData) ( { (VOID)(hResData); 0; } )
   1063 #define MAXINTATOM 0xc000
   1064 #define MAKEINTATOM(i) (LPTSTR) ((ULONG_PTR)((WORD)(i)))
   1065 #define INVALID_ATOM ((ATOM)0)
   1066 #endif
   1067 
   1068 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   1069   int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd);
   1070   int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd);
   1071   WINBASEAPI HGLOBAL WINAPI GlobalAlloc (UINT uFlags, SIZE_T dwBytes);
   1072   WINBASEAPI HGLOBAL WINAPI GlobalReAlloc (HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags);
   1073   WINBASEAPI SIZE_T WINAPI GlobalSize (HGLOBAL hMem);
   1074   WINBASEAPI UINT WINAPI GlobalFlags (HGLOBAL hMem);
   1075   WINBASEAPI LPVOID WINAPI GlobalLock (HGLOBAL hMem);
   1076   WINBASEAPI HGLOBAL WINAPI GlobalHandle (LPCVOID pMem);
   1077   WINBASEAPI WINBOOL WINAPI GlobalUnlock (HGLOBAL hMem);
   1078   WINBASEAPI HGLOBAL WINAPI GlobalFree (HGLOBAL hMem);
   1079   WINBASEAPI SIZE_T WINAPI GlobalCompact (DWORD dwMinFree);
   1080   WINBASEAPI VOID WINAPI GlobalFix (HGLOBAL hMem);
   1081   WINBASEAPI VOID WINAPI GlobalUnfix (HGLOBAL hMem);
   1082   WINBASEAPI LPVOID WINAPI GlobalWire (HGLOBAL hMem);
   1083   WINBASEAPI WINBOOL WINAPI GlobalUnWire (HGLOBAL hMem);
   1084   WINBASEAPI VOID WINAPI GlobalMemoryStatus (LPMEMORYSTATUS lpBuffer);
   1085   WINBASEAPI HLOCAL WINAPI LocalAlloc (UINT uFlags, SIZE_T uBytes);
   1086   WINBASEAPI HLOCAL WINAPI LocalReAlloc (HLOCAL hMem, SIZE_T uBytes, UINT uFlags);
   1087   WINBASEAPI LPVOID WINAPI LocalLock (HLOCAL hMem);
   1088   WINBASEAPI HLOCAL WINAPI LocalHandle (LPCVOID pMem);
   1089   WINBASEAPI WINBOOL WINAPI LocalUnlock (HLOCAL hMem);
   1090   WINBASEAPI SIZE_T WINAPI LocalSize (HLOCAL hMem);
   1091   WINBASEAPI UINT WINAPI LocalFlags (HLOCAL hMem);
   1092   WINBASEAPI HLOCAL WINAPI LocalFree (HLOCAL hMem);
   1093   WINBASEAPI SIZE_T WINAPI LocalShrink (HLOCAL hMem, UINT cbNewSize);
   1094   WINBASEAPI SIZE_T WINAPI LocalCompact (UINT uMinFree);
   1095 #if _WIN32_WINNT >= 0x0600
   1096   WINBASEAPI LPVOID WINAPI VirtualAllocExNuma (HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect, DWORD nndPreferred);
   1097 #endif
   1098 #if _WIN32_WINNT >= 0x0601
   1099   WINBASEAPI WINBOOL WINAPI GetProcessorSystemCycleTime (USHORT Group, PSYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION Buffer, PDWORD ReturnedLength);
   1100   WINBASEAPI WINBOOL WINAPI GetPhysicallyInstalledSystemMemory (PULONGLONG TotalMemoryInKilobytes);
   1101 #endif
   1102 
   1103 #define SCS_32BIT_BINARY 0
   1104 #define SCS_DOS_BINARY 1
   1105 #define SCS_WOW_BINARY 2
   1106 #define SCS_PIF_BINARY 3
   1107 #define SCS_POSIX_BINARY 4
   1108 #define SCS_OS216_BINARY 5
   1109 #define SCS_64BIT_BINARY 6
   1110 
   1111 #ifdef _WIN64
   1112 #define SCS_THIS_PLATFORM_BINARY SCS_64BIT_BINARY
   1113 #else
   1114 #define SCS_THIS_PLATFORM_BINARY SCS_32BIT_BINARY
   1115 #endif
   1116 
   1117   WINBASEAPI WINBOOL WINAPI GetBinaryTypeA (LPCSTR lpApplicationName, LPDWORD lpBinaryType);
   1118   WINBASEAPI WINBOOL WINAPI GetBinaryTypeW (LPCWSTR lpApplicationName, LPDWORD lpBinaryType);
   1119   WINBASEAPI DWORD WINAPI GetShortPathNameA (LPCSTR lpszLongPath, LPSTR lpszShortPath, DWORD cchBuffer);
   1120 #if _WIN32_WINNT >= 0x0600
   1121   WINBASEAPI DWORD WINAPI GetLongPathNameTransactedA (LPCSTR lpszShortPath, LPSTR lpszLongPath, DWORD cchBuffer, HANDLE hTransaction);
   1122   WINBASEAPI DWORD WINAPI GetLongPathNameTransactedW (LPCWSTR lpszShortPath, LPWSTR lpszLongPath, DWORD cchBuffer, HANDLE hTransaction);
   1123 #endif
   1124   WINBASEAPI WINBOOL WINAPI GetProcessAffinityMask (HANDLE hProcess, PDWORD_PTR lpProcessAffinityMask, PDWORD_PTR lpSystemAffinityMask);
   1125   WINBASEAPI WINBOOL WINAPI SetProcessAffinityMask (HANDLE hProcess, DWORD_PTR dwProcessAffinityMask);
   1126   WINBASEAPI WINBOOL WINAPI GetProcessIoCounters (HANDLE hProcess, PIO_COUNTERS lpIoCounters);
   1127   WINBASEAPI WINBOOL WINAPI GetProcessWorkingSetSize (HANDLE hProcess, PSIZE_T lpMinimumWorkingSetSize, PSIZE_T lpMaximumWorkingSetSize);
   1128   WINBASEAPI WINBOOL WINAPI SetProcessWorkingSetSize (HANDLE hProcess, SIZE_T dwMinimumWorkingSetSize, SIZE_T dwMaximumWorkingSetSize);
   1129   WINBASEAPI VOID WINAPI FatalExit (int ExitCode);
   1130   WINBASEAPI WINBOOL WINAPI SetEnvironmentStringsA (LPCH NewEnvironment);
   1131 
   1132 #ifndef UNICODE
   1133 #define SetEnvironmentStrings SetEnvironmentStringsA
   1134 #define GetShortPathName GetShortPathNameA
   1135 #endif
   1136 
   1137 #define GetBinaryType __MINGW_NAME_AW(GetBinaryType)
   1138 #if _WIN32_WINNT >= 0x0600
   1139 #define GetLongPathNameTransacted __MINGW_NAME_AW(GetLongPathNameTransacted)
   1140 #endif
   1141 
   1142 #endif
   1143 
   1144 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
   1145   WINBASEAPI VOID WINAPI RaiseFailFastException (PEXCEPTION_RECORD pExceptionRecord, PCONTEXT pContextRecord, DWORD dwFlags);
   1146   WINBASEAPI DWORD WINAPI SetThreadIdealProcessor (HANDLE hThread, DWORD dwIdealProcessor);
   1147 #endif
   1148 
   1149 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   1150 
   1151 #define FIBER_FLAG_FLOAT_SWITCH 0x1
   1152 
   1153   WINBASEAPI LPVOID WINAPI CreateFiber (SIZE_T dwStackSize, LPFIBER_START_ROUTINE lpStartAddress, LPVOID lpParameter);
   1154   WINBASEAPI LPVOID WINAPI CreateFiberEx (SIZE_T dwStackCommitSize, SIZE_T dwStackReserveSize, DWORD dwFlags, LPFIBER_START_ROUTINE lpStartAddress, LPVOID lpParameter);
   1155   WINBASEAPI VOID WINAPI DeleteFiber (LPVOID lpFiber);
   1156   WINBASEAPI LPVOID WINAPI ConvertThreadToFiber (LPVOID lpParameter);
   1157   WINBASEAPI LPVOID WINAPI ConvertThreadToFiberEx (LPVOID lpParameter, DWORD dwFlags);
   1158   WINBASEAPI WINBOOL WINAPI ConvertFiberToThread (VOID);
   1159   WINBASEAPI VOID WINAPI SwitchToFiber (LPVOID lpFiber);
   1160   WINBASEAPI DWORD_PTR WINAPI SetThreadAffinityMask (HANDLE hThread, DWORD_PTR dwThreadAffinityMask);
   1161 
   1162   /* TODO: Add RTL_UMS... to winnt.h header and add UMS-base API.  */
   1163 
   1164   typedef enum _THREAD_INFORMATION_CLASS {
   1165     ThreadMemoryPriority,
   1166     ThreadAbsoluteCpuPriority,
   1167     ThreadInformationClassMax
   1168   } THREAD_INFORMATION_CLASS;
   1169 
   1170   typedef enum _PROCESS_INFORMATION_CLASS {
   1171     ProcessMemoryPriority,
   1172     ProcessInformationClassMax
   1173   } PROCESS_INFORMATION_CLASS;
   1174 
   1175 #if _WIN32_WINNT >= 0x0602
   1176   WINBASEAPI WINBOOL WINAPI GetThreadInformation (HANDLE hThread, THREAD_INFORMATION_CLASS ThreadInformationClass, LPVOID ThreadInformation, DWORD ThreadInformationSize);
   1177   WINBASEAPI WINBOOL WINAPI SetThreadInformation (HANDLE hThread, THREAD_INFORMATION_CLASS ThreadInformationClass, LPVOID ThreadInformation, DWORD ThreadInformationSize);
   1178   WINBASEAPI WINBOOL WINAPI GetProcessInformation (HANDLE hProcess, PROCESS_INFORMATION_CLASS ProcessInformationClass, LPVOID ProcessInformation, DWORD ProcessInformationSize);
   1179   WINBASEAPI WINBOOL WINAPI SetProcessInformation (HANDLE hProcess, PROCESS_INFORMATION_CLASS ProcessInformationClass, LPVOID ProcessInformation, DWORD ProcessInformationSize);
   1180 
   1181 #define MEMORY_PRIORITY_LOWEST 0
   1182 #define MEMORY_PRIORITY_VERY_LOW 1
   1183 #define MEMORY_PRIORITY_LOW 2
   1184 #define MEMORY_PRIORITY_MEDIUM 3
   1185 #define MEMORY_PRIORITY_BELOW_NORMAL 4
   1186 #define MEMORY_PRIORITY_NORMAL 5
   1187 
   1188   typedef struct _MEMORY_PRIORITY_INFORMATION {
   1189     ULONG MemoryPriority;
   1190   } MEMORY_PRIORITY_INFORMATION,*PMEMORY_PRIORITY_INFORMATION;
   1191 #endif
   1192 
   1193 #if _WIN32_WINNT >= 0x0600
   1194 #define PROCESS_DEP_ENABLE 0x00000001
   1195 #define PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION 0x00000002
   1196 
   1197   WINBASEAPI WINBOOL WINAPI SetProcessDEPPolicy (DWORD dwFlags);
   1198   WINBASEAPI WINBOOL WINAPI GetProcessDEPPolicy (HANDLE hProcess, LPDWORD lpFlags, PBOOL lpPermanent);
   1199 #endif
   1200 
   1201   WINBASEAPI WINBOOL WINAPI SetProcessPriorityBoost (HANDLE hProcess, WINBOOL bDisablePriorityBoost);
   1202   WINBASEAPI WINBOOL WINAPI GetProcessPriorityBoost (HANDLE hProcess, PBOOL pDisablePriorityBoost);
   1203   WINBASEAPI WINBOOL WINAPI RequestWakeupLatency (LATENCY_TIME latency);
   1204   WINBASEAPI WINBOOL WINAPI IsSystemResumeAutomatic (VOID);
   1205   WINBASEAPI WINBOOL WINAPI GetThreadIOPendingFlag (HANDLE hThread, PBOOL lpIOIsPending);
   1206   WINBASEAPI WINBOOL WINAPI GetThreadSelectorEntry (HANDLE hThread, DWORD dwSelector, LPLDT_ENTRY lpSelectorEntry);
   1207   WINBASEAPI EXECUTION_STATE WINAPI SetThreadExecutionState (EXECUTION_STATE esFlags);
   1208 
   1209 #if _WIN32_WINNT >= 0x0601
   1210   typedef REASON_CONTEXT POWER_REQUEST_CONTEXT,*PPOWER_REQUEST_CONTEXT,*LPPOWER_REQUEST_CONTEXT;
   1211 
   1212   WINBASEAPI HANDLE WINAPI PowerCreateRequest (PREASON_CONTEXT Context);
   1213   WINBASEAPI WINBOOL WINAPI PowerSetRequest (HANDLE PowerRequest, POWER_REQUEST_TYPE RequestType);
   1214   WINBASEAPI WINBOOL WINAPI PowerClearRequest (HANDLE PowerRequest, POWER_REQUEST_TYPE RequestType);
   1215 #endif
   1216 #endif
   1217 
   1218 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   1219 #if !defined (RC_INVOKED) && defined (WINBASE_DECLARE_RESTORE_LAST_ERROR)
   1220   WINBASEAPI VOID WINAPI RestoreLastError (DWORD dwErrCode);
   1221 
   1222   typedef VOID (WINAPI *PRESTORE_LAST_ERROR) (DWORD);
   1223 
   1224 #define RESTORE_LAST_ERROR_NAME_A "RestoreLastError"
   1225 #define RESTORE_LAST_ERROR_NAME_W L"RestoreLastError"
   1226 #define RESTORE_LAST_ERROR_NAME TEXT ("RestoreLastError")
   1227 #endif
   1228 
   1229 #define HasOverlappedIoCompleted(lpOverlapped) (((DWORD) (lpOverlapped)->Internal) != STATUS_PENDING)
   1230 
   1231 #if _WIN32_WINNT >= 0x0600
   1232 #define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1
   1233 #define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2
   1234 
   1235   WINBASEAPI WINBOOL WINAPI SetFileCompletionNotificationModes (HANDLE FileHandle, UCHAR Flags);
   1236   WINBASEAPI WINBOOL WINAPI SetFileIoOverlappedRange (HANDLE FileHandle, PUCHAR OverlappedRangeStart, ULONG Length);
   1237 #endif
   1238 
   1239 #define SEM_FAILCRITICALERRORS 0x0001
   1240 #define SEM_NOGPFAULTERRORBOX 0x0002
   1241 #define SEM_NOALIGNMENTFAULTEXCEPT 0x0004
   1242 #define SEM_NOOPENFILEERRORBOX 0x8000
   1243 
   1244   WINBASEAPI DWORD WINAPI GetThreadErrorMode (VOID);
   1245   WINBASEAPI WINBOOL WINAPI SetThreadErrorMode (DWORD dwNewMode, LPDWORD lpOldMode);
   1246 
   1247 #if !defined (__WIDL__) && _WIN32_WINNT >= 0x0600
   1248   WINBASEAPI WINBOOL WINAPI Wow64GetThreadContext (HANDLE hThread, PWOW64_CONTEXT lpContext);
   1249   WINBASEAPI WINBOOL WINAPI Wow64SetThreadContext (HANDLE hThread, CONST WOW64_CONTEXT *lpContext);
   1250 #if _WIN32_WINNT >= 0x0601
   1251   WINBASEAPI WINBOOL WINAPI Wow64GetThreadSelectorEntry (HANDLE hThread, DWORD dwSelector, PWOW64_LDT_ENTRY lpSelectorEntry);
   1252 #endif
   1253 #endif
   1254 
   1255 #if _WIN32_WINNT >= 0x0600
   1256   WINBASEAPI DWORD WINAPI Wow64SuspendThread (HANDLE hThread);
   1257 #endif
   1258   WINBASEAPI WINBOOL WINAPI DebugSetProcessKillOnExit (WINBOOL KillOnExit);
   1259   WINBASEAPI WINBOOL WINAPI DebugBreakProcess (HANDLE Process);
   1260 #endif
   1261 
   1262 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
   1263 #define CRITICAL_SECTION_NO_DEBUG_INFO RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO
   1264 #endif
   1265 
   1266 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   1267   typedef enum _DEP_SYSTEM_POLICY_TYPE {
   1268     DEPPolicyAlwaysOff = 0,
   1269     DEPPolicyAlwaysOn,
   1270     DEPPolicyOptIn,
   1271     DEPPolicyOptOut,
   1272     DEPTotalPolicyCount
   1273   } DEP_SYSTEM_POLICY_TYPE;
   1274 
   1275 #define HANDLE_FLAG_INHERIT 0x1
   1276 #define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x2
   1277 
   1278 #define HINSTANCE_ERROR 32
   1279 
   1280 #define GET_TAPE_MEDIA_INFORMATION 0
   1281 #define GET_TAPE_DRIVE_INFORMATION 1
   1282 
   1283 #define SET_TAPE_MEDIA_INFORMATION 0
   1284 #define SET_TAPE_DRIVE_INFORMATION 1
   1285 
   1286   WINBASEAPI WINBOOL WINAPI PulseEvent (HANDLE hEvent);
   1287   WINBASEAPI DWORD WINAPI WaitForMultipleObjects (DWORD nCount, CONST HANDLE *lpHandles, WINBOOL bWaitAll, DWORD dwMilliseconds);
   1288   WINBASEAPI ATOM WINAPI GlobalDeleteAtom (ATOM nAtom);
   1289   WINBASEAPI WINBOOL WINAPI InitAtomTable (DWORD nSize);
   1290   WINBASEAPI ATOM WINAPI DeleteAtom (ATOM nAtom);
   1291   WINBASEAPI UINT WINAPI SetHandleCount (UINT uNumber);
   1292   WINBASEAPI WINBOOL WINAPI RequestDeviceWakeup (HANDLE hDevice);
   1293   WINBASEAPI WINBOOL WINAPI CancelDeviceWakeupRequest (HANDLE hDevice);
   1294   WINBASEAPI WINBOOL WINAPI GetDevicePowerState (HANDLE hDevice, WINBOOL *pfOn);
   1295   WINBASEAPI WINBOOL WINAPI SetMessageWaitingIndicator (HANDLE hMsgIndicator, ULONG ulMsgCount);
   1296   WINBASEAPI WINBOOL WINAPI SetFileShortNameA (HANDLE hFile, LPCSTR lpShortName);
   1297   WINBASEAPI WINBOOL WINAPI SetFileShortNameW (HANDLE hFile, LPCWSTR lpShortName);
   1298   WINBASEAPI DWORD WINAPI LoadModule (LPCSTR lpModuleName, LPVOID lpParameterBlock);
   1299   WINBASEAPI UINT WINAPI WinExec (LPCSTR lpCmdLine, UINT uCmdShow);
   1300   WINBASEAPI WINBOOL WINAPI ClearCommBreak (HANDLE hFile);
   1301   WINBASEAPI WINBOOL WINAPI ClearCommError (HANDLE hFile, LPDWORD lpErrors, LPCOMSTAT lpStat);
   1302   WINBASEAPI WINBOOL WINAPI SetupComm (HANDLE hFile, DWORD dwInQueue, DWORD dwOutQueue);
   1303   WINBASEAPI WINBOOL WINAPI EscapeCommFunction (HANDLE hFile, DWORD dwFunc);
   1304   WINBASEAPI WINBOOL WINAPI GetCommConfig (HANDLE hCommDev, LPCOMMCONFIG lpCC, LPDWORD lpdwSize);
   1305   WINBASEAPI WINBOOL WINAPI GetCommMask (HANDLE hFile, LPDWORD lpEvtMask);
   1306   WINBASEAPI WINBOOL WINAPI GetCommProperties (HANDLE hFile, LPCOMMPROP lpCommProp);
   1307   WINBASEAPI WINBOOL WINAPI GetCommModemStatus (HANDLE hFile, LPDWORD lpModemStat);
   1308   WINBASEAPI WINBOOL WINAPI GetCommState (HANDLE hFile, LPDCB lpDCB);
   1309   WINBASEAPI WINBOOL WINAPI GetCommTimeouts (HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts);
   1310   WINBASEAPI WINBOOL WINAPI PurgeComm (HANDLE hFile, DWORD dwFlags);
   1311   WINBASEAPI WINBOOL WINAPI SetCommBreak (HANDLE hFile);
   1312   WINBASEAPI WINBOOL WINAPI SetCommConfig (HANDLE hCommDev, LPCOMMCONFIG lpCC, DWORD dwSize);
   1313   WINBASEAPI WINBOOL WINAPI SetCommMask (HANDLE hFile, DWORD dwEvtMask);
   1314   WINBASEAPI WINBOOL WINAPI SetCommState (HANDLE hFile, LPDCB lpDCB);
   1315   WINBASEAPI WINBOOL WINAPI SetCommTimeouts (HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts);
   1316   WINBASEAPI WINBOOL WINAPI TransmitCommChar (HANDLE hFile, char cChar);
   1317   WINBASEAPI WINBOOL WINAPI WaitCommEvent (HANDLE hFile, LPDWORD lpEvtMask, LPOVERLAPPED lpOverlapped);
   1318   WINBASEAPI DWORD WINAPI SetTapePosition (HANDLE hDevice, DWORD dwPositionMethod, DWORD dwPartition, DWORD dwOffsetLow, DWORD dwOffsetHigh, WINBOOL bImmediate);
   1319   WINBASEAPI DWORD WINAPI GetTapePosition (HANDLE hDevice, DWORD dwPositionType, LPDWORD lpdwPartition, LPDWORD lpdwOffsetLow, LPDWORD lpdwOffsetHigh);
   1320   WINBASEAPI DWORD WINAPI PrepareTape (HANDLE hDevice, DWORD dwOperation, WINBOOL bImmediate);
   1321   WINBASEAPI DWORD WINAPI EraseTape (HANDLE hDevice, DWORD dwEraseType, WINBOOL bImmediate);
   1322   WINBASEAPI DWORD WINAPI CreateTapePartition (HANDLE hDevice, DWORD dwPartitionMethod, DWORD dwCount, DWORD dwSize);
   1323   WINBASEAPI DWORD WINAPI WriteTapemark (HANDLE hDevice, DWORD dwTapemarkType, DWORD dwTapemarkCount, WINBOOL bImmediate);
   1324   WINBASEAPI DWORD WINAPI GetTapeStatus (HANDLE hDevice);
   1325   WINBASEAPI DWORD WINAPI GetTapeParameters (HANDLE hDevice, DWORD dwOperation, LPDWORD lpdwSize, LPVOID lpTapeInformation);
   1326   WINBASEAPI DWORD WINAPI SetTapeParameters (HANDLE hDevice, DWORD dwOperation, LPVOID lpTapeInformation);
   1327   WINBASEAPI DEP_SYSTEM_POLICY_TYPE WINAPI GetSystemDEPPolicy (VOID);
   1328   WINBASEAPI WINBOOL WINAPI GetSystemRegistryQuota (PDWORD pdwQuotaAllowed, PDWORD pdwQuotaUsed);
   1329   WINBOOL WINAPI GetSystemTimes (LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime);
   1330   WINBASEAPI WINBOOL WINAPI FileTimeToDosDateTime (CONST FILETIME *lpFileTime, LPWORD lpFatDate, LPWORD lpFatTime);
   1331   WINBASEAPI WINBOOL WINAPI DosDateTimeToFileTime (WORD wFatDate, WORD wFatTime, LPFILETIME lpFileTime);
   1332   WINBASEAPI WINBOOL WINAPI SetSystemTimeAdjustment (DWORD dwTimeAdjustment, WINBOOL bTimeAdjustmentDisabled);
   1333 
   1334 #define SetFileShortName __MINGW_NAME_AW(SetFileShortName)
   1335 
   1336 #endif
   1337 
   1338 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
   1339   WINBASEAPI int WINAPI MulDiv (int nNumber, int nNumerator, int nDenominator);
   1340 
   1341 #ifndef __WIDL__
   1342   WINBASEAPI DWORD WINAPI FormatMessageA (DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, va_list *Arguments);
   1343   WINBASEAPI DWORD WINAPI FormatMessageW (DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, va_list *Arguments);
   1344 
   1345 #define FormatMessage __MINGW_NAME_AW(FormatMessage)
   1346 #endif
   1347 
   1348 #define FORMAT_MESSAGE_IGNORE_INSERTS 0x00000200
   1349 #define FORMAT_MESSAGE_FROM_STRING 0x00000400
   1350 #define FORMAT_MESSAGE_FROM_HMODULE 0x00000800
   1351 #define FORMAT_MESSAGE_FROM_SYSTEM 0x00001000
   1352 #define FORMAT_MESSAGE_ARGUMENT_ARRAY 0x00002000
   1353 #define FORMAT_MESSAGE_MAX_WIDTH_MASK 0x000000ff
   1354 #endif
   1355 
   1356 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   1357   typedef DWORD (WINAPI *PFE_EXPORT_FUNC) (PBYTE pbData, PVOID pvCallbackContext, ULONG ulLength);
   1358   typedef DWORD (WINAPI *PFE_IMPORT_FUNC) (PBYTE pbData, PVOID pvCallbackContext, PULONG ulLength);
   1359 
   1360 #define FILE_ENCRYPTABLE 0
   1361 #define FILE_IS_ENCRYPTED 1
   1362 #define FILE_SYSTEM_ATTR 2
   1363 #define FILE_ROOT_DIR 3
   1364 #define FILE_SYSTEM_DIR 4
   1365 #define FILE_UNKNOWN 5
   1366 #define FILE_SYSTEM_NOT_SUPPORT 6
   1367 #define FILE_USER_DISALLOWED 7
   1368 #define FILE_READ_ONLY 8
   1369 #define FILE_DIR_DISALLOWED 9
   1370 
   1371 #define FORMAT_MESSAGE_ALLOCATE_BUFFER 0x00000100
   1372 
   1373 #define EFS_USE_RECOVERY_KEYS (0x1)
   1374 
   1375 #define CREATE_FOR_IMPORT (1)
   1376 #define CREATE_FOR_DIR (2)
   1377 #define OVERWRITE_HIDDEN (4)
   1378 #define EFSRPC_SECURE_ONLY (8)
   1379 
   1380   WINBASEAPI WINBOOL WINAPI GetNamedPipeInfo (HANDLE hNamedPipe, LPDWORD lpFlags, LPDWORD lpOutBufferSize, LPDWORD lpInBufferSize, LPDWORD lpMaxInstances);
   1381   WINBASEAPI HANDLE WINAPI CreateMailslotA (LPCSTR lpName, DWORD nMaxMessageSize, DWORD lReadTimeout, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
   1382   WINBASEAPI HANDLE WINAPI CreateMailslotW (LPCWSTR lpName, DWORD nMaxMessageSize, DWORD lReadTimeout, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
   1383   WINBASEAPI WINBOOL WINAPI GetMailslotInfo (HANDLE hMailslot, LPDWORD lpMaxMessageSize, LPDWORD lpNextSize, LPDWORD lpMessageCount, LPDWORD lpReadTimeout);
   1384   WINBASEAPI WINBOOL WINAPI SetMailslotInfo (HANDLE hMailslot, DWORD lReadTimeout);
   1385   WINADVAPI WINBOOL WINAPI EncryptFileA (LPCSTR lpFileName);
   1386   WINADVAPI WINBOOL WINAPI EncryptFileW (LPCWSTR lpFileName);
   1387   WINADVAPI WINBOOL WINAPI DecryptFileA (LPCSTR lpFileName, DWORD dwReserved);
   1388   WINADVAPI WINBOOL WINAPI DecryptFileW (LPCWSTR lpFileName, DWORD dwReserved);
   1389   WINADVAPI WINBOOL WINAPI FileEncryptionStatusA (LPCSTR lpFileName, LPDWORD lpStatus);
   1390   WINADVAPI WINBOOL WINAPI FileEncryptionStatusW (LPCWSTR lpFileName, LPDWORD lpStatus);
   1391   WINADVAPI DWORD WINAPI OpenEncryptedFileRawA (LPCSTR lpFileName, ULONG ulFlags, PVOID *pvContext);
   1392   WINADVAPI DWORD WINAPI OpenEncryptedFileRawW (LPCWSTR lpFileName, ULONG ulFlags, PVOID *pvContext);
   1393   WINADVAPI DWORD WINAPI ReadEncryptedFileRaw (PFE_EXPORT_FUNC pfExportCallback, PVOID pvCallbackContext, PVOID pvContext);
   1394   WINADVAPI DWORD WINAPI WriteEncryptedFileRaw (PFE_IMPORT_FUNC pfImportCallback, PVOID pvCallbackContext, PVOID pvContext);
   1395   WINADVAPI VOID WINAPI CloseEncryptedFileRaw (PVOID pvContext);
   1396   WINBASEAPI int WINAPI lstrcmpA (LPCSTR lpString1, LPCSTR lpString2);
   1397   WINBASEAPI int WINAPI lstrcmpW (LPCWSTR lpString1, LPCWSTR lpString2);
   1398   WINBASEAPI int WINAPI lstrcmpiA (LPCSTR lpString1, LPCSTR lpString2);
   1399   WINBASEAPI int WINAPI lstrcmpiW (LPCWSTR lpString1, LPCWSTR lpString2);
   1400   WINBASEAPI LPSTR WINAPI lstrcpynA (LPSTR lpString1, LPCSTR lpString2, int iMaxLength);
   1401   WINBASEAPI LPWSTR WINAPI lstrcpynW (LPWSTR lpString1, LPCWSTR lpString2, int iMaxLength);
   1402   WINBASEAPI LPSTR WINAPI lstrcpyA (LPSTR lpString1, LPCSTR lpString2);
   1403   WINBASEAPI LPWSTR WINAPI lstrcpyW (LPWSTR lpString1, LPCWSTR lpString2);
   1404   WINBASEAPI LPSTR WINAPI lstrcatA (LPSTR lpString1, LPCSTR lpString2);
   1405   WINBASEAPI LPWSTR WINAPI lstrcatW (LPWSTR lpString1, LPCWSTR lpString2);
   1406   WINBASEAPI int WINAPI lstrlenA (LPCSTR lpString);
   1407   WINBASEAPI int WINAPI lstrlenW (LPCWSTR lpString);
   1408   WINBASEAPI HFILE WINAPI OpenFile (LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle);
   1409   WINBASEAPI HFILE WINAPI _lopen (LPCSTR lpPathName, int iReadWrite);
   1410   WINBASEAPI HFILE WINAPI _lcreat (LPCSTR lpPathName, int iAttribute);
   1411   WINBASEAPI UINT WINAPI _lread (HFILE hFile, LPVOID lpBuffer, UINT uBytes);
   1412   WINBASEAPI UINT WINAPI _lwrite (HFILE hFile, LPCCH lpBuffer, UINT uBytes);
   1413   WINBASEAPI __LONG32 WINAPI _hread (HFILE hFile, LPVOID lpBuffer, __LONG32 lBytes);
   1414   WINBASEAPI __LONG32 WINAPI _hwrite (HFILE hFile, LPCCH lpBuffer, __LONG32 lBytes);
   1415   WINBASEAPI HFILE WINAPI _lclose (HFILE hFile);
   1416   WINBASEAPI LONG WINAPI _llseek (HFILE hFile, LONG lOffset, int iOrigin);
   1417   WINADVAPI WINBOOL WINAPI IsTextUnicode (CONST VOID *lpv, int iSize, LPINT lpiResult);
   1418   WINBASEAPI DWORD WINAPI SignalObjectAndWait (HANDLE hObjectToSignal, HANDLE hObjectToWaitOn, DWORD dwMilliseconds, WINBOOL bAlertable);
   1419   WINBASEAPI WINBOOL WINAPI BackupRead (HANDLE hFile, LPBYTE lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, WINBOOL bAbort, WINBOOL bProcessSecurity, LPVOID *lpContext);
   1420   WINBASEAPI WINBOOL WINAPI BackupSeek (HANDLE hFile, DWORD dwLowBytesToSeek, DWORD dwHighBytesToSeek, LPDWORD lpdwLowByteSeeked, LPDWORD lpdwHighByteSeeked, LPVOID *lpContext);
   1421   WINBASEAPI WINBOOL WINAPI BackupWrite (HANDLE hFile, LPBYTE lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, WINBOOL bAbort, WINBOOL bProcessSecurity, LPVOID *lpContext);
   1422 
   1423 #define CreateMailslot __MINGW_NAME_AW(CreateMailslot)
   1424 #define EncryptFile __MINGW_NAME_AW(EncryptFile)
   1425 #define DecryptFile __MINGW_NAME_AW(DecryptFile)
   1426 #define FileEncryptionStatus __MINGW_NAME_AW(FileEncryptionStatus)
   1427 #define OpenEncryptedFileRaw __MINGW_NAME_AW(OpenEncryptedFileRaw)
   1428 #define lstrcmp __MINGW_NAME_AW(lstrcmp)
   1429 #define lstrcmpi __MINGW_NAME_AW(lstrcmpi)
   1430 #define lstrcpyn __MINGW_NAME_AW(lstrcpyn)
   1431 #define lstrcpy __MINGW_NAME_AW(lstrcpy)
   1432 #define lstrcat __MINGW_NAME_AW(lstrcat)
   1433 #define lstrlen __MINGW_NAME_AW(lstrlen)
   1434 
   1435   typedef struct _WIN32_STREAM_ID {
   1436     DWORD dwStreamId;
   1437     DWORD dwStreamAttributes;
   1438     LARGE_INTEGER Size;
   1439     DWORD dwStreamNameSize;
   1440     WCHAR cStreamName[ANYSIZE_ARRAY];
   1441   } WIN32_STREAM_ID,*LPWIN32_STREAM_ID;
   1442 
   1443 #define BACKUP_INVALID 0x00000000
   1444 #define BACKUP_DATA 0x00000001
   1445 #define BACKUP_EA_DATA 0x00000002
   1446 #define BACKUP_SECURITY_DATA 0x00000003
   1447 #define BACKUP_ALTERNATE_DATA 0x00000004
   1448 #define BACKUP_LINK 0x00000005
   1449 #define BACKUP_PROPERTY_DATA 0x00000006
   1450 #define BACKUP_OBJECT_ID 0x00000007
   1451 #define BACKUP_REPARSE_DATA 0x00000008
   1452 #define BACKUP_SPARSE_BLOCK 0x00000009
   1453 #define BACKUP_TXFS_DATA 0x0000000a
   1454 
   1455 #define STREAM_NORMAL_ATTRIBUTE 0x00000000
   1456 #define STREAM_MODIFIED_WHEN_READ 0x00000001
   1457 #define STREAM_CONTAINS_SECURITY 0x00000002
   1458 #define STREAM_CONTAINS_PROPERTIES 0x00000004
   1459 #define STREAM_SPARSE_ATTRIBUTE 0x00000008
   1460 
   1461 #define STARTF_USESHOWWINDOW 0x00000001
   1462 #define STARTF_USESIZE 0x00000002
   1463 #define STARTF_USEPOSITION 0x00000004
   1464 #define STARTF_USECOUNTCHARS 0x00000008
   1465 #define STARTF_USEFILLATTRIBUTE 0x00000010
   1466 #define STARTF_RUNFULLSCREEN 0x00000020
   1467 #define STARTF_FORCEONFEEDBACK 0x00000040
   1468 #define STARTF_FORCEOFFFEEDBACK 0x00000080
   1469 #define STARTF_USESTDHANDLES 0x00000100
   1470 
   1471 #define STARTF_USEHOTKEY 0x00000200
   1472 #define STARTF_TITLEISLINKNAME 0x00000800
   1473 #define STARTF_TITLEISAPPID 0x00001000
   1474 #define STARTF_PREVENTPINNING 0x00002000
   1475 
   1476 #if _WIN32_WINNT >= 0x0600
   1477   typedef struct _STARTUPINFOEXA {
   1478     STARTUPINFOA StartupInfo;
   1479     LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList;
   1480   } STARTUPINFOEXA,*LPSTARTUPINFOEXA;
   1481 
   1482   typedef struct _STARTUPINFOEXW {
   1483     STARTUPINFOW StartupInfo;
   1484     LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList;
   1485   } STARTUPINFOEXW,*LPSTARTUPINFOEXW;
   1486 
   1487   __MINGW_TYPEDEF_AW(STARTUPINFOEX)
   1488   __MINGW_TYPEDEF_AW(LPSTARTUPINFOEX)
   1489 #endif
   1490 
   1491 #define SHUTDOWN_NORETRY 0x1
   1492 #endif
   1493 
   1494 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || defined(WINSTORECOMPAT)
   1495 #define CreateSemaphore __MINGW_NAME_AW(CreateSemaphore)
   1496   WINBASEAPI HANDLE WINAPI CreateSemaphoreW (LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName);
   1497   WINBASEAPI HMODULE WINAPI LoadLibraryW (LPCWSTR lpLibFileName);
   1498 #endif
   1499 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   1500   WINBASEAPI HANDLE WINAPI OpenMutexA (DWORD dwDesiredAccess, WINBOOL bInheritHandle, LPCSTR lpName);
   1501   WINBASEAPI HANDLE WINAPI CreateSemaphoreA (LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCSTR lpName);
   1502   WINBASEAPI HANDLE WINAPI OpenSemaphoreA (DWORD dwDesiredAccess, WINBOOL bInheritHandle, LPCSTR lpName);
   1503   WINBASEAPI HANDLE WINAPI CreateWaitableTimerA (LPSECURITY_ATTRIBUTES lpTimerAttributes, WINBOOL bManualReset, LPCSTR lpTimerName);
   1504   WINBASEAPI HANDLE WINAPI CreateWaitableTimerW (LPSECURITY_ATTRIBUTES lpTimerAttributes, WINBOOL bManualReset, LPCWSTR lpTimerName);
   1505   WINBASEAPI HANDLE WINAPI OpenWaitableTimerA (DWORD dwDesiredAccess, WINBOOL bInheritHandle, LPCSTR lpTimerName);
   1506   WINBASEAPI HANDLE WINAPI CreateFileMappingA (HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName);
   1507 #if _WIN32_WINNT >= 0x0600
   1508   WINBASEAPI HANDLE WINAPI CreateSemaphoreExA (LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess);
   1509   WINBASEAPI HANDLE WINAPI CreateWaitableTimerExA (LPSECURITY_ATTRIBUTES lpTimerAttributes, LPCSTR lpTimerName, DWORD dwFlags, DWORD dwDesiredAccess);
   1510   WINBASEAPI HANDLE WINAPI CreateFileMappingNumaA (HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName, DWORD nndPreferred);
   1511 #endif
   1512   WINBASEAPI HANDLE WINAPI OpenFileMappingA (DWORD dwDesiredAccess, WINBOOL bInheritHandle, LPCSTR lpName);
   1513   WINBASEAPI DWORD WINAPI GetLogicalDriveStringsA (DWORD nBufferLength, LPSTR lpBuffer);
   1514   WINBASEAPI HMODULE WINAPI LoadLibraryA (LPCSTR lpLibFileName);
   1515 
   1516 #ifndef UNICODE
   1517 #define OpenMutex OpenMutexA
   1518 #define OpenSemaphore OpenSemaphoreA
   1519 #define OpenWaitableTimer OpenWaitableTimerA
   1520 #define CreateFileMapping CreateFileMappingA
   1521 #define OpenFileMapping OpenFileMappingA
   1522 #define GetLogicalDriveStrings GetLogicalDriveStringsA
   1523 #endif
   1524 
   1525 #define CreateWaitableTimer __MINGW_NAME_AW(CreateWaitableTimer)
   1526 #define LoadLibrary __MINGW_NAME_AW(LoadLibrary)
   1527 
   1528 #if _WIN32_WINNT >= 0x0600
   1529 #ifndef UNICODE
   1530 #define CreateSemaphoreEx CreateSemaphoreExA
   1531 #define CreateWaitableTimerEx CreateWaitableTimerExA
   1532 #define CreateFileMappingNuma CreateFileMappingNumaA
   1533 #endif
   1534 #endif
   1535 #endif
   1536 
   1537 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP) && _WIN32_WINNT >= 0x0602
   1538   WINBASEAPI HMODULE WINAPI LoadPackagedLibrary (LPCWSTR lpwLibFileName, DWORD Reserved);
   1539 #endif
   1540 
   1541 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   1542 #if _WIN32_WINNT >= 0x0600
   1543 
   1544 #define PROCESS_NAME_NATIVE 0x00000001
   1545 
   1546   WINBASEAPI WINBOOL WINAPI QueryFullProcessImageNameA (HANDLE hProcess, DWORD dwFlags, LPSTR lpExeName, PDWORD lpdwSize);
   1547   WINBASEAPI WINBOOL WINAPI QueryFullProcessImageNameW (HANDLE hProcess, DWORD dwFlags, LPWSTR lpExeName, PDWORD lpdwSize);
   1548 
   1549 #define QueryFullProcessImageName __MINGW_NAME_AW(QueryFullProcessImageName)
   1550 
   1551 #define PROC_THREAD_ATTRIBUTE_NUMBER 0x0000ffff
   1552 #define PROC_THREAD_ATTRIBUTE_THREAD 0x00010000
   1553 #define PROC_THREAD_ATTRIBUTE_INPUT 0x00020000
   1554 #define PROC_THREAD_ATTRIBUTE_ADDITIVE 0x00040000
   1555 
   1556 #ifndef _USE_FULL_PROC_THREAD_ATTRIBUTE
   1557   typedef enum _PROC_THREAD_ATTRIBUTE_NUM {
   1558     ProcThreadAttributeParentProcess = 0,
   1559     ProcThreadAttributeHandleList = 2
   1560 #if _WIN32_WINNT >= 0x0601
   1561     ,ProcThreadAttributeGroupAffinity = 3,
   1562     ProcThreadAttributePreferredNode = 4,
   1563     ProcThreadAttributeIdealProcessor = 5,
   1564     ProcThreadAttributeUmsThread = 6,
   1565     ProcThreadAttributeMitigationPolicy = 7
   1566 #endif
   1567 #if _WIN32_WINNT >= 0x0602
   1568     ,ProcThreadAttributeSecurityCapabilities = 9
   1569 #endif
   1570   } PROC_THREAD_ATTRIBUTE_NUM;
   1571 #endif
   1572 
   1573 #define ProcThreadAttributeValue(Number, Thread, Input, Additive) (((Number) &PROC_THREAD_ATTRIBUTE_NUMBER) | ((Thread != FALSE) ? PROC_THREAD_ATTRIBUTE_THREAD : 0) | ((Input != FALSE) ? PROC_THREAD_ATTRIBUTE_INPUT : 0) | ((Additive != FALSE) ? PROC_THREAD_ATTRIBUTE_ADDITIVE : 0))
   1574 
   1575 #define PROC_THREAD_ATTRIBUTE_PARENT_PROCESS ProcThreadAttributeValue (ProcThreadAttributeParentProcess, FALSE, TRUE, FALSE)
   1576 #define PROC_THREAD_ATTRIBUTE_HANDLE_LIST ProcThreadAttributeValue (ProcThreadAttributeHandleList, FALSE, TRUE, FALSE)
   1577 #endif
   1578 
   1579 #if _WIN32_WINNT >= 0x0601
   1580 #define PROC_THREAD_ATTRIBUTE_GROUP_AFFINITY ProcThreadAttributeValue (ProcThreadAttributeGroupAffinity, TRUE, TRUE, FALSE)
   1581 #define PROC_THREAD_ATTRIBUTE_PREFERRED_NODE ProcThreadAttributeValue (ProcThreadAttributePreferredNode, FALSE, TRUE, FALSE)
   1582 #define PROC_THREAD_ATTRIBUTE_IDEAL_PROCESSOR ProcThreadAttributeValue (ProcThreadAttributeIdealProcessor, TRUE, TRUE, FALSE)
   1583 #define PROC_THREAD_ATTRIBUTE_UMS_THREAD ProcThreadAttributeValue (ProcThreadAttributeUmsThread, TRUE, TRUE, FALSE)
   1584 #define PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY ProcThreadAttributeValue (ProcThreadAttributeMitigationPolicy, FALSE, TRUE, FALSE)
   1585 
   1586 #define PROCESS_CREATION_MITIGATION_POLICY_DEP_ENABLE 0x01
   1587 #define PROCESS_CREATION_MITIGATION_POLICY_DEP_ATL_THUNK_ENABLE 0x02
   1588 #define PROCESS_CREATION_MITIGATION_POLICY_SEHOP_ENABLE 0x04
   1589 #endif
   1590 
   1591 #if _WIN32_WINNT >= 0x0602
   1592 #define PROC_THREAD_ATTRIBUTE_SECURITY_CAPABILITIES ProcThreadAttributeValue (ProcThreadAttributeSecurityCapabilities, FALSE, TRUE, FALSE)
   1593 
   1594 #define PROCESS_CREATION_MITIGATION_POLICY_FORCE_RELOCATE_IMAGES_MASK (0x00000003 << 8)
   1595 #define PROCESS_CREATION_MITIGATION_POLICY_FORCE_RELOCATE_IMAGES_DEFER (0x00000000 << 8)
   1596 #define PROCESS_CREATION_MITIGATION_POLICY_FORCE_RELOCATE_IMAGES_ALWAYS_ON (0x00000001 << 8)
   1597 #define PROCESS_CREATION_MITIGATION_POLICY_FORCE_RELOCATE_IMAGES_ALWAYS_OFF (0x00000002 << 8)
   1598 #define PROCESS_CREATION_MITIGATION_POLICY_FORCE_RELOCATE_IMAGES_ALWAYS_ON_REQ_RELOCS (0x00000003 << 8)
   1599 
   1600 #define PROCESS_CREATION_MITIGATION_POLICY_HEAP_TERMINATE_MASK (0x00000003 << 12)
   1601 #define PROCESS_CREATION_MITIGATION_POLICY_HEAP_TERMINATE_DEFER (0x00000000 << 12)
   1602 #define PROCESS_CREATION_MITIGATION_POLICY_HEAP_TERMINATE_ALWAYS_ON (0x00000001 << 12)
   1603 #define PROCESS_CREATION_MITIGATION_POLICY_HEAP_TERMINATE_ALWAYS_OFF (0x00000002 << 12)
   1604 #define PROCESS_CREATION_MITIGATION_POLICY_HEAP_TERMINATE_RESERVED (0x00000003 << 12)
   1605 
   1606 #define PROCESS_CREATION_MITIGATION_POLICY_BOTTOM_UP_ASLR_MASK (0x00000003 << 16)
   1607 #define PROCESS_CREATION_MITIGATION_POLICY_BOTTOM_UP_ASLR_DEFER (0x00000000 << 16)
   1608 #define PROCESS_CREATION_MITIGATION_POLICY_BOTTOM_UP_ASLR_ALWAYS_ON (0x00000001 << 16)
   1609 #define PROCESS_CREATION_MITIGATION_POLICY_BOTTOM_UP_ASLR_ALWAYS_OFF (0x00000002 << 16)
   1610 #define PROCESS_CREATION_MITIGATION_POLICY_BOTTOM_UP_ASLR_RESERVED (0x00000003 << 16)
   1611 
   1612 #define PROCESS_CREATION_MITIGATION_POLICY_HIGH_ENTROPY_ASLR_MASK (0x00000003 << 20)
   1613 #define PROCESS_CREATION_MITIGATION_POLICY_HIGH_ENTROPY_ASLR_DEFER (0x00000000 << 20)
   1614 #define PROCESS_CREATION_MITIGATION_POLICY_HIGH_ENTROPY_ASLR_ALWAYS_ON (0x00000001 << 20)
   1615 #define PROCESS_CREATION_MITIGATION_POLICY_HIGH_ENTROPY_ASLR_ALWAYS_OFF (0x00000002 << 20)
   1616 #define PROCESS_CREATION_MITIGATION_POLICY_HIGH_ENTROPY_ASLR_RESERVED (0x00000003 << 20)
   1617 
   1618 #define PROCESS_CREATION_MITIGATION_POLICY_STRICT_HANDLE_CHECKS_MASK (0x00000003 << 24)
   1619 #define PROCESS_CREATION_MITIGATION_POLICY_STRICT_HANDLE_CHECKS_DEFER (0x00000000 << 24)
   1620 #define PROCESS_CREATION_MITIGATION_POLICY_STRICT_HANDLE_CHECKS_ALWAYS_ON (0x00000001 << 24)
   1621 #define PROCESS_CREATION_MITIGATION_POLICY_STRICT_HANDLE_CHECKS_ALWAYS_OFF (0x00000002 << 24)
   1622 #define PROCESS_CREATION_MITIGATION_POLICY_STRICT_HANDLE_CHECKS_RESERVED (0x00000003 << 24)
   1623 
   1624 #define PROCESS_CREATION_MITIGATION_POLICY_WIN32K_SYSTEM_CALL_DISABLE_MASK (0x00000003 << 28)
   1625 #define PROCESS_CREATION_MITIGATION_POLICY_WIN32K_SYSTEM_CALL_DISABLE_DEFER (0x00000000 << 28)
   1626 #define PROCESS_CREATION_MITIGATION_POLICY_WIN32K_SYSTEM_CALL_DISABLE_ALWAYS_ON (0x00000001 << 28)
   1627 #define PROCESS_CREATION_MITIGATION_POLICY_WIN32K_SYSTEM_CALL_DISABLE_ALWAYS_OFF (0x00000002 << 28)
   1628 #define PROCESS_CREATION_MITIGATION_POLICY_WIN32K_SYSTEM_CALL_DISABLE_RESERVED (0x00000003 << 28)
   1629 
   1630 #define PROCESS_CREATION_MITIGATION_POLICY_EXTENSION_POINT_DISABLE_MASK (0x00000003ULL << 32)
   1631 #define PROCESS_CREATION_MITIGATION_POLICY_EXTENSION_POINT_DISABLE_DEFER (0x00000000ULL << 32)
   1632 #define PROCESS_CREATION_MITIGATION_POLICY_EXTENSION_POINT_DISABLE_ALWAYS_ON (0x00000001ULL << 32)
   1633 #define PROCESS_CREATION_MITIGATION_POLICY_EXTENSION_POINT_DISABLE_ALWAYS_OFF (0x00000002ULL << 32)
   1634 #define PROCESS_CREATION_MITIGATION_POLICY_EXTENSION_POINT_DISABLE_RESERVED (0x00000003ULL << 32)
   1635 #endif
   1636 
   1637 #define ATOM_FLAG_GLOBAL 0x2
   1638 
   1639   WINBASEAPI WINBOOL WINAPI GetProcessShutdownParameters (LPDWORD lpdwLevel, LPDWORD lpdwFlags);
   1640   WINBASEAPI VOID WINAPI FatalAppExitA (UINT uAction, LPCSTR lpMessageText);
   1641   WINBASEAPI VOID WINAPI FatalAppExitW (UINT uAction, LPCWSTR lpMessageText);
   1642   WINBASEAPI VOID WINAPI GetStartupInfoA (LPSTARTUPINFOA lpStartupInfo);
   1643   WINBASEAPI DWORD WINAPI GetFirmwareEnvironmentVariableA (LPCSTR lpName, LPCSTR lpGuid, PVOID pBuffer, DWORD nSize);
   1644   WINBASEAPI DWORD WINAPI GetFirmwareEnvironmentVariableW (LPCWSTR lpName, LPCWSTR lpGuid, PVOID pBuffer, DWORD nSize);
   1645   WINBASEAPI WINBOOL WINAPI SetFirmwareEnvironmentVariableA (LPCSTR lpName, LPCSTR lpGuid, PVOID pValue, DWORD nSize);
   1646   WINBASEAPI WINBOOL WINAPI SetFirmwareEnvironmentVariableW (LPCWSTR lpName, LPCWSTR lpGuid, PVOID pValue, DWORD nSize);
   1647   WINBASEAPI HRSRC WINAPI FindResourceA (HMODULE hModule, LPCSTR lpName, LPCSTR lpType);
   1648   WINBASEAPI HRSRC WINAPI FindResourceW (HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType);
   1649   WINBASEAPI HRSRC WINAPI FindResourceExA (HMODULE hModule, LPCSTR lpType, LPCSTR lpName, WORD wLanguage);
   1650   WINBASEAPI WINBOOL WINAPI EnumResourceTypesA (HMODULE hModule, ENUMRESTYPEPROCA lpEnumFunc, LONG_PTR lParam);
   1651   WINBASEAPI WINBOOL WINAPI EnumResourceTypesW (HMODULE hModule, ENUMRESTYPEPROCW lpEnumFunc, LONG_PTR lParam);
   1652   WINBASEAPI WINBOOL WINAPI EnumResourceNamesA (HMODULE hModule, LPCSTR lpType, ENUMRESNAMEPROCA lpEnumFunc, LONG_PTR lParam);
   1653   WINBASEAPI WINBOOL WINAPI EnumResourceNamesW (HMODULE hModule, LPCWSTR lpType, ENUMRESNAMEPROCW lpEnumFunc, LONG_PTR lParam);
   1654   WINBASEAPI WINBOOL WINAPI EnumResourceLanguagesA (HMODULE hModule, LPCSTR lpType, LPCSTR lpName, ENUMRESLANGPROCA lpEnumFunc, LONG_PTR lParam);
   1655   WINBASEAPI WINBOOL WINAPI EnumResourceLanguagesW (HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, ENUMRESLANGPROCW lpEnumFunc, LONG_PTR lParam);
   1656   WINBASEAPI HANDLE WINAPI BeginUpdateResourceA (LPCSTR pFileName, WINBOOL bDeleteExistingResources);
   1657   WINBASEAPI HANDLE WINAPI BeginUpdateResourceW (LPCWSTR pFileName, WINBOOL bDeleteExistingResources);
   1658   WINBASEAPI WINBOOL WINAPI UpdateResourceA (HANDLE hUpdate, LPCSTR lpType, LPCSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cb);
   1659   WINBASEAPI WINBOOL WINAPI UpdateResourceW (HANDLE hUpdate, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cb);
   1660   WINBASEAPI WINBOOL WINAPI EndUpdateResourceA (HANDLE hUpdate, WINBOOL fDiscard);
   1661   WINBASEAPI WINBOOL WINAPI EndUpdateResourceW (HANDLE hUpdate, WINBOOL fDiscard);
   1662 #if _WIN32_WINNT >= 0x0602
   1663   WINBASEAPI DWORD WINAPI GetFirmwareEnvironmentVariableExA (LPCSTR lpName, LPCSTR lpGuid, PVOID pBuffer, DWORD nSize, PDWORD pdwAttribubutes);
   1664   WINBASEAPI DWORD WINAPI GetFirmwareEnvironmentVariableExW (LPCWSTR lpName, LPCWSTR lpGuid, PVOID pBuffer, DWORD nSize, PDWORD pdwAttribubutes);
   1665   WINBASEAPI WINBOOL WINAPI SetFirmwareEnvironmentVariableExA (LPCSTR lpName, LPCSTR lpGuid, PVOID pValue, DWORD nSize, DWORD dwAttributes);
   1666   WINBASEAPI WINBOOL WINAPI SetFirmwareEnvironmentVariableExW (LPCWSTR lpName, LPCWSTR lpGuid, PVOID pValue, DWORD nSize, DWORD dwAttributes);
   1667   WINBASEAPI WINBOOL WINAPI GetFirmwareType (PFIRMWARE_TYPE FirmwareType);
   1668   WINBASEAPI WINBOOL WINAPI IsNativeVhdBoot (PBOOL NativeVhdBoot);
   1669 #endif
   1670   WINBASEAPI ATOM WINAPI GlobalAddAtomA (LPCSTR lpString);
   1671   WINBASEAPI ATOM WINAPI GlobalAddAtomW (LPCWSTR lpString);
   1672   WINBASEAPI ATOM WINAPI GlobalAddAtomExA (LPCSTR lpString, DWORD Flags);
   1673   WINBASEAPI ATOM WINAPI GlobalAddAtomExW (LPCWSTR lpString, DWORD Flags);
   1674   WINBASEAPI ATOM WINAPI GlobalFindAtomA (LPCSTR lpString);
   1675   WINBASEAPI ATOM WINAPI GlobalFindAtomW (LPCWSTR lpString);
   1676   WINBASEAPI UINT WINAPI GlobalGetAtomNameA (ATOM nAtom, LPSTR lpBuffer, int nSize);
   1677   WINBASEAPI UINT WINAPI GlobalGetAtomNameW (ATOM nAtom, LPWSTR lpBuffer, int nSize);
   1678   WINBASEAPI ATOM WINAPI AddAtomA (LPCSTR lpString);
   1679   WINBASEAPI ATOM WINAPI AddAtomW (LPCWSTR lpString);
   1680   WINBASEAPI ATOM WINAPI FindAtomA (LPCSTR lpString);
   1681   WINBASEAPI ATOM WINAPI FindAtomW (LPCWSTR lpString);
   1682   WINBASEAPI UINT WINAPI GetAtomNameA (ATOM nAtom, LPSTR lpBuffer, int nSize);
   1683   WINBASEAPI UINT WINAPI GetAtomNameW (ATOM nAtom, LPWSTR lpBuffer, int nSize);
   1684   WINBASEAPI UINT WINAPI GetProfileIntA (LPCSTR lpAppName, LPCSTR lpKeyName, INT nDefault);
   1685   WINBASEAPI UINT WINAPI GetProfileIntW (LPCWSTR lpAppName, LPCWSTR lpKeyName, INT nDefault);
   1686   WINBASEAPI DWORD WINAPI GetProfileStringA (LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, DWORD nSize);
   1687   WINBASEAPI DWORD WINAPI GetProfileStringW (LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize);
   1688   WINBASEAPI WINBOOL WINAPI WriteProfileStringA (LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpString);
   1689   WINBASEAPI WINBOOL WINAPI WriteProfileStringW (LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString);
   1690   WINBASEAPI DWORD WINAPI GetProfileSectionA (LPCSTR lpAppName, LPSTR lpReturnedString, DWORD nSize);
   1691   WINBASEAPI DWORD WINAPI GetProfileSectionW (LPCWSTR lpAppName, LPWSTR lpReturnedString, DWORD nSize);
   1692   WINBASEAPI WINBOOL WINAPI WriteProfileSectionA (LPCSTR lpAppName, LPCSTR lpString);
   1693   WINBASEAPI WINBOOL WINAPI WriteProfileSectionW (LPCWSTR lpAppName, LPCWSTR lpString);
   1694   WINBASEAPI UINT WINAPI GetPrivateProfileIntA (LPCSTR lpAppName, LPCSTR lpKeyName, INT nDefault, LPCSTR lpFileName);
   1695   WINBASEAPI UINT WINAPI GetPrivateProfileIntW (LPCWSTR lpAppName, LPCWSTR lpKeyName, INT nDefault, LPCWSTR lpFileName);
   1696   WINBASEAPI DWORD WINAPI GetPrivateProfileStringA (LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName);
   1697   WINBASEAPI DWORD WINAPI GetPrivateProfileStringW (LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName);
   1698   WINBASEAPI WINBOOL WINAPI WritePrivateProfileStringA (LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpString, LPCSTR lpFileName);
   1699   WINBASEAPI WINBOOL WINAPI WritePrivateProfileStringW (LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString, LPCWSTR lpFileName);
   1700   WINBASEAPI DWORD WINAPI GetPrivateProfileSectionA (LPCSTR lpAppName, LPSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName);
   1701   WINBASEAPI DWORD WINAPI GetPrivateProfileSectionW (LPCWSTR lpAppName, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName);
   1702   WINBASEAPI WINBOOL WINAPI WritePrivateProfileSectionA (LPCSTR lpAppName, LPCSTR lpString, LPCSTR lpFileName);
   1703   WINBASEAPI WINBOOL WINAPI WritePrivateProfileSectionW (LPCWSTR lpAppName, LPCWSTR lpString, LPCWSTR lpFileName);
   1704   WINBASEAPI DWORD WINAPI GetPrivateProfileSectionNamesA (LPSTR lpszReturnBuffer, DWORD nSize, LPCSTR lpFileName);
   1705   WINBASEAPI DWORD WINAPI GetPrivateProfileSectionNamesW (LPWSTR lpszReturnBuffer, DWORD nSize, LPCWSTR lpFileName);
   1706   WINBASEAPI WINBOOL WINAPI GetPrivateProfileStructA (LPCSTR lpszSection, LPCSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCSTR szFile);
   1707   WINBASEAPI WINBOOL WINAPI GetPrivateProfileStructW (LPCWSTR lpszSection, LPCWSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCWSTR szFile);
   1708   WINBASEAPI WINBOOL WINAPI WritePrivateProfileStructA (LPCSTR lpszSection, LPCSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCSTR szFile);
   1709   WINBASEAPI WINBOOL WINAPI WritePrivateProfileStructW (LPCWSTR lpszSection, LPCWSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCWSTR szFile);
   1710   WINBASEAPI DWORD WINAPI GetTempPathA (DWORD nBufferLength, LPSTR lpBuffer);
   1711   WINBASEAPI UINT WINAPI GetTempFileNameA (LPCSTR lpPathName, LPCSTR lpPrefixString, UINT uUnique, LPSTR lpTempFileName);
   1712 
   1713 #ifndef UNICODE
   1714 #define GetStartupInfo GetStartupInfoA
   1715 #define FindResourceEx FindResourceExA
   1716 #define GetTempPath GetTempPathA
   1717 #define GetTempFileName GetTempFileNameA
   1718 #endif
   1719 
   1720 #define FatalAppExit __MINGW_NAME_AW(FatalAppExit)
   1721 #define GetFirmwareEnvironmentVariable __MINGW_NAME_AW(GetFirmwareEnvironmentVariable)
   1722 #define SetFirmwareEnvironmentVariable __MINGW_NAME_AW(SetFirmwareEnvironmentVariable)
   1723 #define FindResource __MINGW_NAME_AW(FindResource)
   1724 #define EnumResourceTypes __MINGW_NAME_AW(EnumResourceTypes)
   1725 #define EnumResourceNames __MINGW_NAME_AW(EnumResourceNames)
   1726 #define EnumResourceLanguages __MINGW_NAME_AW(EnumResourceLanguages)
   1727 #define BeginUpdateResource __MINGW_NAME_AW(BeginUpdateResource)
   1728 #define UpdateResource __MINGW_NAME_AW(UpdateResource)
   1729 #define EndUpdateResource __MINGW_NAME_AW(EndUpdateResource)
   1730 #define GlobalAddAtom __MINGW_NAME_AW(GlobalAddAtom)
   1731 #define GlobalAddAtomEx __MINGW_NAME_AW(GlobalAddAtomEx)
   1732 #define GlobalFindAtom __MINGW_NAME_AW(GlobalFindAtom)
   1733 #define GlobalGetAtomName __MINGW_NAME_AW(GlobalGetAtomName)
   1734 #define AddAtom __MINGW_NAME_AW(AddAtom)
   1735 #define FindAtom __MINGW_NAME_AW(FindAtom)
   1736 #define GetAtomName __MINGW_NAME_AW(GetAtomName)
   1737 #define GetProfileInt __MINGW_NAME_AW(GetProfileInt)
   1738 #define GetProfileString __MINGW_NAME_AW(GetProfileString)
   1739 #define WriteProfileString __MINGW_NAME_AW(WriteProfileString)
   1740 #define GetProfileSection __MINGW_NAME_AW(GetProfileSection)
   1741 #define WriteProfileSection __MINGW_NAME_AW(WriteProfileSection)
   1742 #define GetPrivateProfileInt __MINGW_NAME_AW(GetPrivateProfileInt)
   1743 #define GetPrivateProfileString __MINGW_NAME_AW(GetPrivateProfileString)
   1744 #define WritePrivateProfileString __MINGW_NAME_AW(WritePrivateProfileString)
   1745 #define GetPrivateProfileSection __MINGW_NAME_AW(GetPrivateProfileSection)
   1746 #define WritePrivateProfileSection __MINGW_NAME_AW(WritePrivateProfileSection)
   1747 #define GetPrivateProfileSectionNames __MINGW_NAME_AW(GetPrivateProfileSectionNames)
   1748 #define GetPrivateProfileStruct __MINGW_NAME_AW(GetPrivateProfileStruct)
   1749 #define WritePrivateProfileStruct __MINGW_NAME_AW(WritePrivateProfileStruct)
   1750 
   1751 #if _WIN32_WINNT >= 0x0602
   1752 #define GetFirmwareEnvironmentVariableEx __MINGW_NAME_AW(GetFirmwareEnvironmentVariableEx)
   1753 #define SetFirmwareEnvironmentVariableEx __MINGW_NAME_AW(SetFirmwareEnvironmentVariableEx)
   1754 #endif
   1755 
   1756 #ifndef RC_INVOKED
   1757   WINBASEAPI UINT WINAPI GetSystemWow64DirectoryA (LPSTR lpBuffer, UINT uSize);
   1758   WINBASEAPI UINT WINAPI GetSystemWow64DirectoryW (LPWSTR lpBuffer, UINT uSize);
   1759 
   1760 #define GetSystemWow64Directory __MINGW_NAME_AW(GetSystemWow64Directory)
   1761 
   1762   WINBASEAPI BOOLEAN WINAPI Wow64EnableWow64FsRedirection (BOOLEAN Wow64FsEnableRedirection);
   1763 
   1764   typedef UINT (WINAPI *PGET_SYSTEM_WOW64_DIRECTORY_A) (LPSTR lpBuffer, UINT uSize);
   1765   typedef UINT (WINAPI *PGET_SYSTEM_WOW64_DIRECTORY_W) (LPWSTR lpBuffer, UINT uSize);
   1766 
   1767 #define GET_SYSTEM_WOW64_DIRECTORY_NAME_A_A "GetSystemWow64DirectoryA"
   1768 #define GET_SYSTEM_WOW64_DIRECTORY_NAME_A_W L"GetSystemWow64DirectoryA"
   1769 #define GET_SYSTEM_WOW64_DIRECTORY_NAME_A_T TEXT ("GetSystemWow64DirectoryA")
   1770 #define GET_SYSTEM_WOW64_DIRECTORY_NAME_W_A "GetSystemWow64DirectoryW"
   1771 #define GET_SYSTEM_WOW64_DIRECTORY_NAME_W_W L"GetSystemWow64DirectoryW"
   1772 #define GET_SYSTEM_WOW64_DIRECTORY_NAME_W_T TEXT ("GetSystemWow64DirectoryW")
   1773 
   1774 #define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_A __MINGW_NAME_UAW_EXT(GET_SYSTEM_WOW64_DIRECTORY_NAME,A)
   1775 #define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_W __MINGW_NAME_UAW_EXT(GET_SYSTEM_WOW64_DIRECTORY_NAME,W)
   1776 #define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_T __MINGW_NAME_UAW_EXT(GET_SYSTEM_WOW64_DIRECTORY_NAME,T)
   1777 #endif
   1778 
   1779   WINBASEAPI WINBOOL WINAPI SetDllDirectoryA (LPCSTR lpPathName);
   1780   WINBASEAPI WINBOOL WINAPI SetDllDirectoryW (LPCWSTR lpPathName);
   1781   WINBASEAPI DWORD WINAPI GetDllDirectoryA (DWORD nBufferLength, LPSTR lpBuffer);
   1782   WINBASEAPI DWORD WINAPI GetDllDirectoryW (DWORD nBufferLength, LPWSTR lpBuffer);
   1783 
   1784 #define SetDllDirectory __MINGW_NAME_AW(SetDllDirectory)
   1785 #define GetDllDirectory __MINGW_NAME_AW(GetDllDirectory)
   1786 
   1787 #define BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE 0x1
   1788 #define BASE_SEARCH_PATH_DISABLE_SAFE_SEARCHMODE 0x10000
   1789 #define BASE_SEARCH_PATH_PERMANENT 0x8000
   1790 #define BASE_SEARCH_PATH_INVALID_FLAGS ~0x18001
   1791 
   1792   WINBASEAPI WINBOOL WINAPI SetSearchPathMode (DWORD Flags);
   1793 #endif
   1794 
   1795 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   1796   WINBASEAPI WINBOOL WINAPI CreateDirectoryExA (LPCSTR lpTemplateDirectory, LPCSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
   1797   WINBASEAPI WINBOOL WINAPI CreateDirectoryExW (LPCWSTR lpTemplateDirectory, LPCWSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
   1798 
   1799 #define CreateDirectoryEx __MINGW_NAME_AW(CreateDirectoryEx)
   1800 
   1801 #if _WIN32_WINNT >= 0x0600
   1802   WINBASEAPI WINBOOL WINAPI CreateDirectoryTransactedA (LPCSTR lpTemplateDirectory, LPCSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes, HANDLE hTransaction);
   1803   WINBASEAPI WINBOOL WINAPI CreateDirectoryTransactedW (LPCWSTR lpTemplateDirectory, LPCWSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes, HANDLE hTransaction);
   1804   WINBASEAPI WINBOOL WINAPI RemoveDirectoryTransactedA (LPCSTR lpPathName, HANDLE hTransaction);
   1805   WINBASEAPI WINBOOL WINAPI RemoveDirectoryTransactedW (LPCWSTR lpPathName, HANDLE hTransaction);
   1806   WINBASEAPI DWORD WINAPI GetFullPathNameTransactedA (LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer, LPSTR *lpFilePart, HANDLE hTransaction);
   1807   WINBASEAPI DWORD WINAPI GetFullPathNameTransactedW (LPCWSTR lpFileName, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR *lpFilePart, HANDLE hTransaction);
   1808 
   1809 #define CreateDirectoryTransacted __MINGW_NAME_AW(CreateDirectoryTransacted)
   1810 #define RemoveDirectoryTransacted __MINGW_NAME_AW(RemoveDirectoryTransacted)
   1811 #define GetFullPathNameTransacted __MINGW_NAME_AW(GetFullPathNameTransacted)
   1812 
   1813 #endif
   1814 
   1815 #define DDD_RAW_TARGET_PATH 0x00000001
   1816 #define DDD_REMOVE_DEFINITION 0x00000002
   1817 #define DDD_EXACT_MATCH_ON_REMOVE 0x00000004
   1818 #define DDD_NO_BROADCAST_SYSTEM 0x00000008
   1819 #define DDD_LUID_BROADCAST_DRIVE 0x00000010
   1820 
   1821   WINBASEAPI WINBOOL WINAPI DefineDosDeviceA (DWORD dwFlags, LPCSTR lpDeviceName, LPCSTR lpTargetPath);
   1822   WINBASEAPI DWORD WINAPI QueryDosDeviceA (LPCSTR lpDeviceName, LPSTR lpTargetPath, DWORD ucchMax);
   1823 
   1824 #ifndef UNICODE
   1825 #define DefineDosDevice DefineDosDeviceA
   1826 #define QueryDosDevice QueryDosDeviceA
   1827 #endif
   1828 
   1829 #define EXPAND_LOCAL_DRIVES
   1830 
   1831 #if _WIN32_WINNT >= 0x0600
   1832   WINBASEAPI HANDLE WINAPI CreateFileTransactedA (LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile, HANDLE hTransaction, PUSHORT pusMiniVersion, PVOID lpExtendedParameter);
   1833   WINBASEAPI HANDLE WINAPI CreateFileTransactedW (LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile, HANDLE hTransaction, PUSHORT pusMiniVersion, PVOID lpExtendedParameter);
   1834 
   1835 #define CreateFileTransacted __MINGW_NAME_AW(CreateFileTransacted)
   1836 #endif
   1837 
   1838   WINBASEAPI HANDLE WINAPI ReOpenFile (HANDLE hOriginalFile, DWORD dwDesiredAccess, DWORD dwShareMode, DWORD dwFlagsAndAttributes);
   1839 #if _WIN32_WINNT >= 0x0600
   1840   WINBASEAPI WINBOOL WINAPI SetFileAttributesTransactedA (LPCSTR lpFileName, DWORD dwFileAttributes, HANDLE hTransaction);
   1841   WINBASEAPI WINBOOL WINAPI SetFileAttributesTransactedW (LPCWSTR lpFileName, DWORD dwFileAttributes, HANDLE hTransaction);
   1842   WINBASEAPI WINBOOL WINAPI GetFileAttributesTransactedA (LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation, HANDLE hTransaction);
   1843   WINBASEAPI WINBOOL WINAPI GetFileAttributesTransactedW (LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation, HANDLE hTransaction);
   1844 
   1845 #define SetFileAttributesTransacted __MINGW_NAME_AW(SetFileAttributesTransacted)
   1846 #define GetFileAttributesTransacted __MINGW_NAME_AW(GetFileAttributesTransacted)
   1847 
   1848 #endif
   1849 
   1850   WINBASEAPI DWORD WINAPI GetCompressedFileSizeA (LPCSTR lpFileName, LPDWORD lpFileSizeHigh);
   1851   WINBASEAPI DWORD WINAPI GetCompressedFileSizeW (LPCWSTR lpFileName, LPDWORD lpFileSizeHigh);
   1852 
   1853 #define GetCompressedFileSize __MINGW_NAME_AW(GetCompressedFileSize)
   1854 
   1855 #if _WIN32_WINNT >= 0x0600
   1856   WINBASEAPI DWORD WINAPI GetCompressedFileSizeTransactedA (LPCSTR lpFileName, LPDWORD lpFileSizeHigh, HANDLE hTransaction);
   1857   WINBASEAPI DWORD WINAPI GetCompressedFileSizeTransactedW (LPCWSTR lpFileName, LPDWORD lpFileSizeHigh, HANDLE hTransaction);
   1858   WINBASEAPI WINBOOL WINAPI DeleteFileTransactedA (LPCSTR lpFileName, HANDLE hTransaction);
   1859   WINBASEAPI WINBOOL WINAPI DeleteFileTransactedW (LPCWSTR lpFileName, HANDLE hTransaction);
   1860 
   1861 #define DeleteFileTransacted __MINGW_NAME_AW(DeleteFileTransacted)
   1862 #define GetCompressedFileSizeTransacted __MINGW_NAME_AW(GetCompressedFileSizeTransacted)
   1863 
   1864 #endif
   1865 #endif
   1866 
   1867 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   1868   typedef DWORD (WINAPI *LPPROGRESS_ROUTINE) (LARGE_INTEGER TotalFileSize, LARGE_INTEGER TotalBytesTransferred, LARGE_INTEGER StreamSize, LARGE_INTEGER StreamBytesTransferred, DWORD dwStreamNumber, DWORD dwCallbackReason, HANDLE hSourceFile, HANDLE hDestinationFile, LPVOID lpData);
   1869 
   1870   WINBASEAPI WINBOOL WINAPI CheckNameLegalDOS8Dot3A (LPCSTR lpName, LPSTR lpOemName, DWORD OemNameSize, PBOOL pbNameContainsSpaces, PBOOL pbNameLegal);
   1871   WINBASEAPI WINBOOL WINAPI CheckNameLegalDOS8Dot3W (LPCWSTR lpName, LPSTR lpOemName, DWORD OemNameSize, PBOOL pbNameContainsSpaces, PBOOL pbNameLegal);
   1872   WINBASEAPI WINBOOL WINAPI CopyFileA (LPCSTR lpExistingFileName, LPCSTR lpNewFileName, WINBOOL bFailIfExists);
   1873   WINBASEAPI WINBOOL WINAPI CopyFileW (LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, WINBOOL bFailIfExists);
   1874   WINBASEAPI WINBOOL WINAPI CopyFileExA (LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags);
   1875   WINBASEAPI WINBOOL WINAPI CopyFileExW (LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags);
   1876 
   1877 #if _WIN32_WINNT >= 0x0600
   1878   WINBASEAPI HANDLE WINAPI FindFirstFileTransactedA (LPCSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags, HANDLE hTransaction);
   1879   WINBASEAPI HANDLE WINAPI FindFirstFileTransactedW (LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags, HANDLE hTransaction);
   1880   WINBASEAPI WINBOOL WINAPI CopyFileTransactedA (LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags, HANDLE hTransaction);
   1881   WINBASEAPI WINBOOL WINAPI CopyFileTransactedW (LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags, HANDLE hTransaction);
   1882 
   1883 #define FindFirstFileTransacted __MINGW_NAME_AW(FindFirstFileTransacted)
   1884 #define CopyFileTransacted __MINGW_NAME_AW(CopyFileTransacted)
   1885 #endif
   1886 
   1887 #define CheckNameLegalDOS8Dot3 __MINGW_NAME_AW(CheckNameLegalDOS8Dot3)
   1888 #define CopyFile __MINGW_NAME_AW(CopyFile)
   1889 #define CopyFileEx __MINGW_NAME_AW(CopyFileEx)
   1890 
   1891 #endif
   1892 
   1893 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
   1894 #if _WIN32_WINNT >= 0x0601
   1895   typedef enum _COPYFILE2_MESSAGE_TYPE {
   1896     COPYFILE2_CALLBACK_NONE = 0,
   1897     COPYFILE2_CALLBACK_CHUNK_STARTED,
   1898     COPYFILE2_CALLBACK_CHUNK_FINISHED,
   1899     COPYFILE2_CALLBACK_STREAM_STARTED,
   1900     COPYFILE2_CALLBACK_STREAM_FINISHED,
   1901     COPYFILE2_CALLBACK_POLL_CONTINUE,
   1902     COPYFILE2_CALLBACK_ERROR,
   1903     COPYFILE2_CALLBACK_MAX,
   1904   } COPYFILE2_MESSAGE_TYPE;
   1905 
   1906   typedef enum _COPYFILE2_MESSAGE_ACTION {
   1907     COPYFILE2_PROGRESS_CONTINUE = 0,
   1908     COPYFILE2_PROGRESS_CANCEL,
   1909     COPYFILE2_PROGRESS_STOP,
   1910     COPYFILE2_PROGRESS_QUIET,
   1911     COPYFILE2_PROGRESS_PAUSE,
   1912   } COPYFILE2_MESSAGE_ACTION;
   1913 
   1914   typedef enum _COPYFILE2_COPY_PHASE {
   1915     COPYFILE2_PHASE_NONE = 0,
   1916     COPYFILE2_PHASE_PREPARE_SOURCE,
   1917     COPYFILE2_PHASE_PREPARE_DEST,
   1918     COPYFILE2_PHASE_READ_SOURCE,
   1919     COPYFILE2_PHASE_WRITE_DESTINATION,
   1920     COPYFILE2_PHASE_SERVER_COPY,
   1921     COPYFILE2_PHASE_NAMEGRAFT_COPY,
   1922     COPYFILE2_PHASE_MAX,
   1923   } COPYFILE2_COPY_PHASE;
   1924 
   1925 #define COPYFILE2_MESSAGE_COPY_OFFLOAD (__MSABI_LONG (0x00000001))
   1926 
   1927   typedef struct COPYFILE2_MESSAGE {
   1928     COPYFILE2_MESSAGE_TYPE Type;
   1929     DWORD dwPadding;
   1930     union {
   1931       struct {
   1932 	DWORD dwStreamNumber;
   1933 	DWORD dwReserved;
   1934 	HANDLE hSourceFile;
   1935 	HANDLE hDestinationFile;
   1936 	ULARGE_INTEGER uliChunkNumber;
   1937 	ULARGE_INTEGER uliChunkSize;
   1938 	ULARGE_INTEGER uliStreamSize;
   1939 	ULARGE_INTEGER uliTotalFileSize;
   1940       } ChunkStarted;
   1941       struct {
   1942 	DWORD dwStreamNumber;
   1943 	DWORD dwFlags;
   1944 	HANDLE hSourceFile;
   1945 	HANDLE hDestinationFile;
   1946 	ULARGE_INTEGER uliChunkNumber;
   1947 	ULARGE_INTEGER uliChunkSize;
   1948 	ULARGE_INTEGER uliStreamSize;
   1949 	ULARGE_INTEGER uliStreamBytesTransferred;
   1950 	ULARGE_INTEGER uliTotalFileSize;
   1951 	ULARGE_INTEGER uliTotalBytesTransferred;
   1952       } ChunkFinished;
   1953       struct {
   1954 	DWORD dwStreamNumber;
   1955 	DWORD dwReserved;
   1956 	HANDLE hSourceFile;
   1957 	HANDLE hDestinationFile;
   1958 	ULARGE_INTEGER uliStreamSize;
   1959 	ULARGE_INTEGER uliTotalFileSize;
   1960       } StreamStarted;
   1961       struct {
   1962 	DWORD dwStreamNumber;
   1963 	DWORD dwReserved;
   1964 	HANDLE hSourceFile;
   1965 	HANDLE hDestinationFile;
   1966 	ULARGE_INTEGER uliStreamSize;
   1967 	ULARGE_INTEGER uliStreamBytesTransferred;
   1968 	ULARGE_INTEGER uliTotalFileSize;
   1969 	ULARGE_INTEGER uliTotalBytesTransferred;
   1970       } StreamFinished;
   1971       struct {
   1972 	DWORD dwReserved;
   1973       } PollContinue;
   1974       struct {
   1975 	COPYFILE2_COPY_PHASE CopyPhase;
   1976 	DWORD dwStreamNumber;
   1977 	HRESULT hrFailure;
   1978 	DWORD dwReserved;
   1979 	ULARGE_INTEGER uliChunkNumber;
   1980 	ULARGE_INTEGER uliStreamSize;
   1981 	ULARGE_INTEGER uliStreamBytesTransferred;
   1982 	ULARGE_INTEGER uliTotalFileSize;
   1983 	ULARGE_INTEGER uliTotalBytesTransferred;
   1984       } Error;
   1985     } Info;
   1986   } COPYFILE2_MESSAGE;
   1987 
   1988   typedef COPYFILE2_MESSAGE_ACTION (CALLBACK *PCOPYFILE2_PROGRESS_ROUTINE) (const COPYFILE2_MESSAGE *pMessage, PVOID pvCallbackContext);
   1989 
   1990   typedef struct COPYFILE2_EXTENDED_PARAMETERS {
   1991     DWORD dwSize;
   1992     DWORD dwCopyFlags;
   1993     WINBOOL *pfCancel;
   1994     PCOPYFILE2_PROGRESS_ROUTINE pProgressRoutine;
   1995     PVOID pvCallbackContext;
   1996   } COPYFILE2_EXTENDED_PARAMETERS;
   1997 
   1998   WINBASEAPI HRESULT WINAPI CopyFile2 (PCWSTR pwszExistingFileName, PCWSTR pwszNewFileName, COPYFILE2_EXTENDED_PARAMETERS *pExtendedParameters);
   1999 #endif
   2000 #endif
   2001 
   2002 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   2003   WINBASEAPI WINBOOL WINAPI MoveFileA (LPCSTR lpExistingFileName, LPCSTR lpNewFileName);
   2004   WINBASEAPI WINBOOL WINAPI MoveFileW (LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName);
   2005 
   2006 #define MoveFile __MINGW_NAME_AW(MoveFile)
   2007 #endif
   2008 
   2009 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
   2010   WINBASEAPI WINBOOL WINAPI MoveFileExA (LPCSTR lpExistingFileName, LPCSTR lpNewFileName, DWORD dwFlags);
   2011   WINBASEAPI WINBOOL WINAPI MoveFileExW (LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, DWORD dwFlags);
   2012 
   2013 #define MoveFileEx __MINGW_NAME_AW(MoveFileEx)
   2014 #endif
   2015 
   2016 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   2017   WINBASEAPI WINBOOL WINAPI MoveFileWithProgressA (LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags);
   2018   WINBASEAPI WINBOOL WINAPI MoveFileWithProgressW (LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags);
   2019 
   2020 #define MoveFileWithProgress __MINGW_NAME_AW(MoveFileWithProgress)
   2021 
   2022 #if _WIN32_WINNT >= 0x0600
   2023   WINBASEAPI WINBOOL WINAPI MoveFileTransactedA (LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags, HANDLE hTransaction);
   2024   WINBASEAPI WINBOOL WINAPI MoveFileTransactedW (LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags, HANDLE hTransaction);
   2025 
   2026 #define MoveFileTransacted __MINGW_NAME_AW(MoveFileTransacted)
   2027 #endif
   2028 #endif
   2029 
   2030 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
   2031 #define MOVEFILE_REPLACE_EXISTING 0x00000001
   2032 #define MOVEFILE_COPY_ALLOWED 0x00000002
   2033 #define MOVEFILE_DELAY_UNTIL_REBOOT 0x00000004
   2034 #define MOVEFILE_WRITE_THROUGH 0x00000008
   2035 #define MOVEFILE_CREATE_HARDLINK 0x00000010
   2036 #define MOVEFILE_FAIL_IF_NOT_TRACKABLE 0x00000020
   2037 #endif
   2038 
   2039 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   2040   WINBASEAPI WINBOOL WINAPI ReplaceFileA (LPCSTR lpReplacedFileName, LPCSTR lpReplacementFileName, LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved);
   2041   WINBASEAPI WINBOOL WINAPI ReplaceFileW (LPCWSTR lpReplacedFileName, LPCWSTR lpReplacementFileName, LPCWSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved);
   2042   WINBASEAPI WINBOOL WINAPI CreateHardLinkA (LPCSTR lpFileName, LPCSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
   2043   WINBASEAPI WINBOOL WINAPI CreateHardLinkW (LPCWSTR lpFileName, LPCWSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
   2044 
   2045 #define ReplaceFile __MINGW_NAME_AW(ReplaceFile)
   2046 #define CreateHardLink __MINGW_NAME_AW(CreateHardLink)
   2047 
   2048 #if _WIN32_WINNT >= 0x0600
   2049   WINBASEAPI WINBOOL WINAPI CreateHardLinkTransactedA (LPCSTR lpFileName, LPCSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes, HANDLE hTransaction);
   2050   WINBASEAPI WINBOOL WINAPI CreateHardLinkTransactedW (LPCWSTR lpFileName, LPCWSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes, HANDLE hTransaction);
   2051 
   2052 #define CreateHardLinkTransacted __MINGW_NAME_AW(CreateHardLinkTransacted)
   2053 #endif
   2054 
   2055   typedef enum _STREAM_INFO_LEVELS {
   2056     FindStreamInfoStandard,
   2057     FindStreamInfoMaxInfoLevel
   2058   } STREAM_INFO_LEVELS;
   2059 
   2060   typedef struct _WIN32_FIND_STREAM_DATA {
   2061     LARGE_INTEGER StreamSize;
   2062     WCHAR cStreamName[MAX_PATH + 36];
   2063   } WIN32_FIND_STREAM_DATA,*PWIN32_FIND_STREAM_DATA;
   2064 
   2065   WINBASEAPI HANDLE WINAPI FindFirstStreamW (LPCWSTR lpFileName, STREAM_INFO_LEVELS InfoLevel, LPVOID lpFindStreamData, DWORD dwFlags);
   2066   WINBASEAPI WINBOOL APIENTRY FindNextStreamW (HANDLE hFindStream, LPVOID lpFindStreamData);
   2067 #if _WIN32_WINNT >= 0x0600
   2068   WINBASEAPI HANDLE WINAPI FindFirstStreamTransactedW (LPCWSTR lpFileName, STREAM_INFO_LEVELS InfoLevel, LPVOID lpFindStreamData, DWORD dwFlags, HANDLE hTransaction);
   2069   WINBASEAPI HANDLE WINAPI FindFirstFileNameW (LPCWSTR lpFileName, DWORD dwFlags, LPDWORD StringLength, PWSTR LinkName);
   2070   WINBASEAPI WINBOOL APIENTRY FindNextFileNameW (HANDLE hFindStream, LPDWORD StringLength, PWSTR LinkName);
   2071   WINBASEAPI HANDLE WINAPI FindFirstFileNameTransactedW (LPCWSTR lpFileName, DWORD dwFlags, LPDWORD StringLength, PWSTR LinkName, HANDLE hTransaction);
   2072   WINBASEAPI WINBOOL WINAPI GetNamedPipeClientComputerNameA (HANDLE Pipe, LPSTR ClientComputerName, ULONG ClientComputerNameLength);
   2073   WINBASEAPI WINBOOL WINAPI GetNamedPipeClientProcessId (HANDLE Pipe, PULONG ClientProcessId);
   2074   WINBASEAPI WINBOOL WINAPI GetNamedPipeClientSessionId (HANDLE Pipe, PULONG ClientSessionId);
   2075   WINBASEAPI WINBOOL WINAPI GetNamedPipeServerProcessId (HANDLE Pipe, PULONG ServerProcessId);
   2076   WINBASEAPI WINBOOL WINAPI GetNamedPipeServerSessionId (HANDLE Pipe, PULONG ServerSessionId);
   2077   WINBASEAPI WINBOOL WINAPI SetFileBandwidthReservation (HANDLE hFile, DWORD nPeriodMilliseconds, DWORD nBytesPerPeriod, WINBOOL bDiscardable, LPDWORD lpTransferSize, LPDWORD lpNumOutstandingRequests);
   2078   WINBASEAPI WINBOOL WINAPI GetFileBandwidthReservation (HANDLE hFile, LPDWORD lpPeriodMilliseconds, LPDWORD lpBytesPerPeriod, LPBOOL pDiscardable, LPDWORD lpTransferSize, LPDWORD lpNumOutstandingRequests);
   2079 #endif
   2080   WINBASEAPI HANDLE WINAPI CreateNamedPipeA (LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
   2081   WINBASEAPI WINBOOL WINAPI GetNamedPipeHandleStateA (HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPSTR lpUserName, DWORD nMaxUserNameSize);
   2082   WINBASEAPI WINBOOL WINAPI GetNamedPipeHandleStateW (HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPWSTR lpUserName, DWORD nMaxUserNameSize);
   2083   WINBASEAPI WINBOOL WINAPI CallNamedPipeA (LPCSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut);
   2084   WINBASEAPI WINBOOL WINAPI CallNamedPipeW (LPCWSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut);
   2085   WINBASEAPI WINBOOL WINAPI WaitNamedPipeA (LPCSTR lpNamedPipeName, DWORD nTimeOut);
   2086   WINBASEAPI WINBOOL WINAPI SetVolumeLabelA (LPCSTR lpRootPathName, LPCSTR lpVolumeName);
   2087   WINBASEAPI WINBOOL WINAPI SetVolumeLabelW (LPCWSTR lpRootPathName, LPCWSTR lpVolumeName);
   2088   WINBASEAPI VOID WINAPI SetFileApisToOEM (VOID);
   2089   WINBASEAPI VOID WINAPI SetFileApisToANSI (VOID);
   2090   WINBASEAPI WINBOOL WINAPI AreFileApisANSI (VOID);
   2091   WINBASEAPI WINBOOL WINAPI GetVolumeInformationA (LPCSTR lpRootPathName, LPSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize);
   2092   WINADVAPI WINBOOL WINAPI ClearEventLogA (HANDLE hEventLog, LPCSTR lpBackupFileName);
   2093   WINADVAPI WINBOOL WINAPI ClearEventLogW (HANDLE hEventLog, LPCWSTR lpBackupFileName);
   2094   WINADVAPI WINBOOL WINAPI BackupEventLogA (HANDLE hEventLog, LPCSTR lpBackupFileName);
   2095   WINADVAPI WINBOOL WINAPI BackupEventLogW (HANDLE hEventLog, LPCWSTR lpBackupFileName);
   2096   WINADVAPI WINBOOL WINAPI CloseEventLog (HANDLE hEventLog);
   2097   WINADVAPI WINBOOL WINAPI DeregisterEventSource (HANDLE hEventLog);
   2098   WINADVAPI WINBOOL WINAPI NotifyChangeEventLog (HANDLE hEventLog, HANDLE hEvent);
   2099   WINADVAPI WINBOOL WINAPI GetNumberOfEventLogRecords (HANDLE hEventLog, PDWORD NumberOfRecords);
   2100   WINADVAPI WINBOOL WINAPI GetOldestEventLogRecord (HANDLE hEventLog, PDWORD OldestRecord);
   2101   WINADVAPI HANDLE WINAPI OpenEventLogA (LPCSTR lpUNCServerName, LPCSTR lpSourceName);
   2102   WINADVAPI HANDLE WINAPI OpenEventLogW (LPCWSTR lpUNCServerName, LPCWSTR lpSourceName);
   2103   WINADVAPI HANDLE WINAPI RegisterEventSourceA (LPCSTR lpUNCServerName, LPCSTR lpSourceName);
   2104   WINADVAPI HANDLE WINAPI RegisterEventSourceW (LPCWSTR lpUNCServerName, LPCWSTR lpSourceName);
   2105   WINADVAPI HANDLE WINAPI OpenBackupEventLogA (LPCSTR lpUNCServerName, LPCSTR lpFileName);
   2106   WINADVAPI HANDLE WINAPI OpenBackupEventLogW (LPCWSTR lpUNCServerName, LPCWSTR lpFileName);
   2107   WINADVAPI WINBOOL WINAPI ReadEventLogA (HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded);
   2108   WINADVAPI WINBOOL WINAPI ReadEventLogW (HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded);
   2109   WINADVAPI WINBOOL WINAPI ReportEventA (HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCSTR *lpStrings, LPVOID lpRawData);
   2110   WINADVAPI WINBOOL WINAPI ReportEventW (HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCWSTR *lpStrings, LPVOID lpRawData);
   2111 
   2112 #ifndef UNICODE
   2113 #define CreateNamedPipe CreateNamedPipeA
   2114 #define WaitNamedPipe WaitNamedPipeA
   2115 #define GetVolumeInformation GetVolumeInformationA
   2116 #endif
   2117 
   2118 #define GetNamedPipeHandleState __MINGW_NAME_AW(GetNamedPipeHandleState)
   2119 #define CallNamedPipe __MINGW_NAME_AW(CallNamedPipe)
   2120 #define SetVolumeLabel __MINGW_NAME_AW(SetVolumeLabel)
   2121 #define ClearEventLog __MINGW_NAME_AW(ClearEventLog)
   2122 #define BackupEventLog __MINGW_NAME_AW(BackupEventLog)
   2123 #define OpenEventLog __MINGW_NAME_AW(OpenEventLog)
   2124 #define RegisterEventSource __MINGW_NAME_AW(RegisterEventSource)
   2125 #define OpenBackupEventLog __MINGW_NAME_AW(OpenBackupEventLog)
   2126 #define ReadEventLog __MINGW_NAME_AW(ReadEventLog)
   2127 #define ReportEvent __MINGW_NAME_AW(ReportEvent)
   2128 
   2129 #if _WIN32_WINNT >= 0x0600 && !defined (UNICODE)
   2130 #define GetNamedPipeClientComputerName GetNamedPipeClientComputerNameA
   2131 #endif
   2132 
   2133 #define EVENTLOG_FULL_INFO 0
   2134 
   2135   typedef struct _EVENTLOG_FULL_INFORMATION {
   2136     DWORD dwFull;
   2137   } EVENTLOG_FULL_INFORMATION,*LPEVENTLOG_FULL_INFORMATION;
   2138 
   2139   WINADVAPI WINBOOL WINAPI GetEventLogInformation (HANDLE hEventLog, DWORD dwInfoLevel, LPVOID lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded);
   2140 
   2141 #if _WIN32_WINNT >= 0x0602
   2142 
   2143 #define OPERATION_API_VERSION 1
   2144 
   2145   typedef ULONG OPERATION_ID;
   2146 
   2147   typedef struct _OPERATION_START_PARAMETERS {
   2148     ULONG Version;
   2149     OPERATION_ID OperationId;
   2150     ULONG Flags;
   2151   } OPERATION_START_PARAMETERS,*POPERATION_START_PARAMETERS;
   2152 
   2153 #define OPERATION_START_TRACE_CURRENT_THREAD 0x1
   2154 
   2155   typedef struct _OPERATION_END_PARAMETERS {
   2156     ULONG Version;
   2157     OPERATION_ID OperationId;
   2158     ULONG Flags;
   2159   } OPERATION_END_PARAMETERS,*POPERATION_END_PARAMETERS;
   2160 
   2161 #define OPERATION_END_DISCARD 0x1
   2162 
   2163   WINADVAPI WINBOOL WINAPI OperationStart (OPERATION_START_PARAMETERS *OperationStartParams);
   2164   WINADVAPI WINBOOL WINAPI OperationEnd (OPERATION_END_PARAMETERS *OperationEndParams);
   2165 #endif
   2166 
   2167   WINADVAPI WINBOOL WINAPI AccessCheckAndAuditAlarmA (LPCSTR SubsystemName, LPVOID HandleId, LPSTR ObjectTypeName, LPSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, WINBOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose);
   2168   WINADVAPI WINBOOL WINAPI AccessCheckByTypeAndAuditAlarmA (LPCSTR SubsystemName, LPVOID HandleId, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, WINBOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose);
   2169   WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmA (LPCSTR SubsystemName, LPVOID HandleId, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, WINBOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose);
   2170   WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmByHandleA (LPCSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, WINBOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose);
   2171   WINADVAPI WINBOOL WINAPI ObjectOpenAuditAlarmA (LPCSTR SubsystemName, LPVOID HandleId, LPSTR ObjectTypeName, LPSTR ObjectName, PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, DWORD GrantedAccess, PPRIVILEGE_SET Privileges, WINBOOL ObjectCreation, WINBOOL AccessGranted, LPBOOL GenerateOnClose);
   2172   WINADVAPI WINBOOL WINAPI ObjectPrivilegeAuditAlarmA (LPCSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, DWORD DesiredAccess, PPRIVILEGE_SET Privileges, WINBOOL AccessGranted);
   2173   WINADVAPI WINBOOL WINAPI ObjectCloseAuditAlarmA (LPCSTR SubsystemName, LPVOID HandleId, WINBOOL GenerateOnClose);
   2174   WINADVAPI WINBOOL WINAPI ObjectDeleteAuditAlarmA (LPCSTR SubsystemName, LPVOID HandleId, WINBOOL GenerateOnClose);
   2175   WINADVAPI WINBOOL WINAPI PrivilegedServiceAuditAlarmA (LPCSTR SubsystemName, LPCSTR ServiceName, HANDLE ClientToken, PPRIVILEGE_SET Privileges, WINBOOL AccessGranted);
   2176   WINADVAPI WINBOOL WINAPI SetFileSecurityA (LPCSTR lpFileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor);
   2177   WINADVAPI WINBOOL WINAPI GetFileSecurityA (LPCSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded);
   2178   WINBASEAPI WINBOOL WINAPI ReadDirectoryChangesW (HANDLE hDirectory, LPVOID lpBuffer, DWORD nBufferLength, WINBOOL bWatchSubtree, DWORD dwNotifyFilter, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
   2179   WINBASEAPI WINBOOL WINAPI IsBadReadPtr (CONST VOID *lp, UINT_PTR ucb);
   2180   WINBASEAPI WINBOOL WINAPI IsBadWritePtr (LPVOID lp, UINT_PTR ucb);
   2181   WINBASEAPI WINBOOL WINAPI IsBadHugeReadPtr (CONST VOID *lp, UINT_PTR ucb);
   2182   WINBASEAPI WINBOOL WINAPI IsBadHugeWritePtr (LPVOID lp, UINT_PTR ucb);
   2183   WINBASEAPI WINBOOL WINAPI IsBadCodePtr (FARPROC lpfn);
   2184   WINBASEAPI WINBOOL WINAPI IsBadStringPtrA (LPCSTR lpsz, UINT_PTR ucchMax);
   2185   WINBASEAPI WINBOOL WINAPI IsBadStringPtrW (LPCWSTR lpsz, UINT_PTR ucchMax);
   2186 #if _WIN32_WINNT >= 0x0600
   2187   WINBASEAPI LPVOID WINAPI MapViewOfFileExNuma (HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress, DWORD nndPreferred);
   2188 #endif
   2189 #if _WIN32_WINNT >= 0x0601
   2190   WINADVAPI WINBOOL WINAPI AddConditionalAce (PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, UCHAR AceType, DWORD AccessMask, PSID pSid, PWCHAR ConditionStr, DWORD *ReturnLength);
   2191 #endif
   2192   WINADVAPI WINBOOL WINAPI LookupAccountSidA (LPCSTR lpSystemName, PSID Sid, LPSTR Name, LPDWORD cchName, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse);
   2193   WINADVAPI WINBOOL WINAPI LookupAccountSidW (LPCWSTR lpSystemName, PSID Sid, LPWSTR Name, LPDWORD cchName, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse);
   2194   WINADVAPI WINBOOL WINAPI LookupAccountNameA (LPCSTR lpSystemName, LPCSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse);
   2195   WINADVAPI WINBOOL WINAPI LookupAccountNameW (LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse);
   2196 
   2197 #ifndef UNICODE
   2198 #define AccessCheckAndAuditAlarm AccessCheckAndAuditAlarmA
   2199 #define AccessCheckByTypeAndAuditAlarm AccessCheckByTypeAndAuditAlarmA
   2200 #define AccessCheckByTypeResultListAndAuditAlarm AccessCheckByTypeResultListAndAuditAlarmA
   2201 #define AccessCheckByTypeResultListAndAuditAlarmByHandle AccessCheckByTypeResultListAndAuditAlarmByHandleA
   2202 #define ObjectOpenAuditAlarm ObjectOpenAuditAlarmA
   2203 #define ObjectPrivilegeAuditAlarm ObjectPrivilegeAuditAlarmA
   2204 #define ObjectCloseAuditAlarm ObjectCloseAuditAlarmA
   2205 #define ObjectDeleteAuditAlarm ObjectDeleteAuditAlarmA
   2206 #define PrivilegedServiceAuditAlarm PrivilegedServiceAuditAlarmA
   2207 #define SetFileSecurity SetFileSecurityA
   2208 #define GetFileSecurity GetFileSecurityA
   2209 #endif
   2210 
   2211 #define IsBadStringPtr __MINGW_NAME_AW(IsBadStringPtr)
   2212 #define LookupAccountSid __MINGW_NAME_AW(LookupAccountSid)
   2213 #define LookupAccountName __MINGW_NAME_AW(LookupAccountName)
   2214 
   2215 #if _WIN32_WINNT >= 0x0601
   2216   WINADVAPI WINBOOL WINAPI LookupAccountNameLocalA (LPCSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse);
   2217   WINADVAPI WINBOOL WINAPI LookupAccountNameLocalW (LPCWSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse);
   2218   WINADVAPI WINBOOL WINAPI LookupAccountSidLocalA (PSID Sid, LPSTR Name, LPDWORD cchName, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse);
   2219   WINADVAPI WINBOOL WINAPI LookupAccountSidLocalW (PSID Sid, LPWSTR Name, LPDWORD cchName, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse);
   2220 
   2221 #define LookupAccountNameLocal __MINGW_NAME_AW(LookupAccountNameLocal)
   2222 #define LookupAccountSidLocal __MINGW_NAME_AW(LookupAccountSidLocal)
   2223 #else
   2224 
   2225 #define LookupAccountNameLocalA(n, s, cs, d, cd, u) LookupAccountNameA (NULL, n, s, cs, d, cd, u)
   2226 #define LookupAccountNameLocalW(n, s, cs, d, cd, u) LookupAccountNameW (NULL, n, s, cs, d, cd, u)
   2227 #define LookupAccountNameLocal(n, s, cs, d, cd, u) __MINGW_NAME_AW(LookupAccountName) (NULL, n, s, cs, d, cd, u)
   2228 
   2229 #define LookupAccountSidLocalA(s, n, cn, d, cd, u) LookupAccountSidA (NULL, s, n, cn, d, cd, u)
   2230 #define LookupAccountSidLocalW(s, n, cn, d, cd, u) LookupAccountSidW (NULL, s, n, cn, d, cd, u)
   2231 #define LookupAccountSidLocal(s, n, cn, d, cd, u) __MINGW_NAME_AW(LookupAccountSid) (NULL, s, n, cn, d, cd, u)
   2232 
   2233 #endif
   2234 
   2235   WINADVAPI WINBOOL WINAPI LookupPrivilegeValueA (LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid);
   2236   WINADVAPI WINBOOL WINAPI LookupPrivilegeValueW (LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid);
   2237   WINADVAPI WINBOOL WINAPI LookupPrivilegeNameA (LPCSTR lpSystemName, PLUID lpLuid, LPSTR lpName, LPDWORD cchName);
   2238   WINADVAPI WINBOOL WINAPI LookupPrivilegeNameW (LPCWSTR lpSystemName, PLUID lpLuid, LPWSTR lpName, LPDWORD cchName);
   2239   WINADVAPI WINBOOL WINAPI LookupPrivilegeDisplayNameA (LPCSTR lpSystemName, LPCSTR lpName, LPSTR lpDisplayName, LPDWORD cchDisplayName, LPDWORD lpLanguageId);
   2240   WINADVAPI WINBOOL WINAPI LookupPrivilegeDisplayNameW (LPCWSTR lpSystemName, LPCWSTR lpName, LPWSTR lpDisplayName, LPDWORD cchDisplayName, LPDWORD lpLanguageId);
   2241   WINBASEAPI WINBOOL WINAPI BuildCommDCBA (LPCSTR lpDef, LPDCB lpDCB);
   2242   WINBASEAPI WINBOOL WINAPI BuildCommDCBW (LPCWSTR lpDef, LPDCB lpDCB);
   2243   WINBASEAPI WINBOOL WINAPI BuildCommDCBAndTimeoutsA (LPCSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts);
   2244   WINBASEAPI WINBOOL WINAPI BuildCommDCBAndTimeoutsW (LPCWSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts);
   2245   WINBASEAPI WINBOOL WINAPI CommConfigDialogA (LPCSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC);
   2246   WINBASEAPI WINBOOL WINAPI CommConfigDialogW (LPCWSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC);
   2247   WINBASEAPI WINBOOL WINAPI GetDefaultCommConfigA (LPCSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize);
   2248   WINBASEAPI WINBOOL WINAPI GetDefaultCommConfigW (LPCWSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize);
   2249   WINBASEAPI WINBOOL WINAPI SetDefaultCommConfigA (LPCSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize);
   2250   WINBASEAPI WINBOOL WINAPI SetDefaultCommConfigW (LPCWSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize);
   2251 
   2252 #define LookupPrivilegeValue __MINGW_NAME_AW(LookupPrivilegeValue)
   2253 #define LookupPrivilegeName __MINGW_NAME_AW(LookupPrivilegeName)
   2254 #define LookupPrivilegeDisplayName __MINGW_NAME_AW(LookupPrivilegeDisplayName)
   2255 #define BuildCommDCB __MINGW_NAME_AW(BuildCommDCB)
   2256 #define BuildCommDCBAndTimeouts __MINGW_NAME_AW(BuildCommDCBAndTimeouts)
   2257 #define CommConfigDialog __MINGW_NAME_AW(CommConfigDialog)
   2258 #define GetDefaultCommConfig __MINGW_NAME_AW(GetDefaultCommConfig)
   2259 #define SetDefaultCommConfig __MINGW_NAME_AW(SetDefaultCommConfig)
   2260 
   2261 #define MAX_COMPUTERNAME_LENGTH 15
   2262 
   2263   WINBASEAPI WINBOOL WINAPI GetComputerNameA (LPSTR lpBuffer, LPDWORD nSize);
   2264   WINBASEAPI WINBOOL WINAPI GetComputerNameW (LPWSTR lpBuffer, LPDWORD nSize);
   2265   WINBASEAPI WINBOOL WINAPI SetComputerNameA (LPCSTR lpComputerName);
   2266   WINBASEAPI WINBOOL WINAPI SetComputerNameW (LPCWSTR lpComputerName);
   2267   WINBASEAPI WINBOOL WINAPI SetComputerNameExA (COMPUTER_NAME_FORMAT NameType, LPCTSTR lpBuffer);
   2268   WINBASEAPI WINBOOL WINAPI DnsHostnameToComputerNameA (LPCSTR Hostname, LPSTR ComputerName, LPDWORD nSize);
   2269   WINBASEAPI WINBOOL WINAPI DnsHostnameToComputerNameW (LPCWSTR Hostname, LPWSTR ComputerName, LPDWORD nSize);
   2270   WINADVAPI WINBOOL WINAPI GetUserNameA (LPSTR lpBuffer, LPDWORD pcbBuffer);
   2271   WINADVAPI WINBOOL WINAPI GetUserNameW (LPWSTR lpBuffer, LPDWORD pcbBuffer);
   2272 
   2273 #ifndef UNICODE
   2274 #define SetComputerNameEx SetComputerNameExA
   2275 #endif
   2276 
   2277 #define GetComputerName __MINGW_NAME_AW(GetComputerName)
   2278 #define SetComputerName __MINGW_NAME_AW(SetComputerName)
   2279 #define DnsHostnameToComputerName __MINGW_NAME_AW(DnsHostnameToComputerName)
   2280 #define GetUserName __MINGW_NAME_AW(GetUserName)
   2281 
   2282 #define LOGON32_LOGON_INTERACTIVE 2
   2283 #define LOGON32_LOGON_NETWORK 3
   2284 #define LOGON32_LOGON_BATCH 4
   2285 #define LOGON32_LOGON_SERVICE 5
   2286 #define LOGON32_LOGON_UNLOCK 7
   2287 #define LOGON32_LOGON_NETWORK_CLEARTEXT 8
   2288 #define LOGON32_LOGON_NEW_CREDENTIALS 9
   2289 
   2290 #define LOGON32_PROVIDER_DEFAULT 0
   2291 #define LOGON32_PROVIDER_WINNT35 1
   2292 #define LOGON32_PROVIDER_WINNT40 2
   2293 #define LOGON32_PROVIDER_WINNT50 3
   2294 #if _WIN32_WINNT >= 0x0600
   2295 #define LOGON32_PROVIDER_VIRTUAL 4
   2296 #endif
   2297 
   2298   WINADVAPI WINBOOL WINAPI LogonUserA (LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken);
   2299   WINADVAPI WINBOOL WINAPI LogonUserW (LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken);
   2300   WINADVAPI WINBOOL WINAPI LogonUserExA (LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken, PSID *ppLogonSid, PVOID *ppProfileBuffer, LPDWORD pdwProfileLength, PQUOTA_LIMITS pQuotaLimits);
   2301   WINADVAPI WINBOOL WINAPI LogonUserExW (LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken, PSID *ppLogonSid, PVOID *ppProfileBuffer, LPDWORD pdwProfileLength, PQUOTA_LIMITS pQuotaLimits);
   2302   WINADVAPI WINBOOL WINAPI CreateProcessAsUserA (HANDLE hToken, LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, WINBOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation);
   2303 
   2304 #ifndef UNICODE
   2305 #define CreateProcessAsUser CreateProcessAsUserA
   2306 #endif
   2307 
   2308 #define LogonUser __MINGW_NAME_AW(LogonUser)
   2309 #define LogonUserEx __MINGW_NAME_AW(LogonUserEx)
   2310 
   2311 #define LOGON_WITH_PROFILE 0x00000001
   2312 #define LOGON_NETCREDENTIALS_ONLY 0x00000002
   2313 #define LOGON_ZERO_PASSWORD_BUFFER 0x80000000
   2314 
   2315   WINADVAPI WINBOOL WINAPI CreateProcessWithLogonW (LPCWSTR lpUsername, LPCWSTR lpDomain, LPCWSTR lpPassword, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation);
   2316   WINADVAPI WINBOOL WINAPI CreateProcessWithTokenW (HANDLE hToken, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation);
   2317   WINADVAPI WINBOOL WINAPI IsTokenUntrusted (HANDLE TokenHandle);
   2318   WINBASEAPI WINBOOL WINAPI RegisterWaitForSingleObject (PHANDLE phNewWaitObject, HANDLE hObject, WAITORTIMERCALLBACK Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags);
   2319   WINBASEAPI WINBOOL WINAPI UnregisterWait (HANDLE WaitHandle);
   2320   WINBASEAPI WINBOOL WINAPI BindIoCompletionCallback (HANDLE FileHandle, LPOVERLAPPED_COMPLETION_ROUTINE Function, ULONG Flags);
   2321   WINBASEAPI HANDLE WINAPI SetTimerQueueTimer (HANDLE TimerQueue, WAITORTIMERCALLBACK Callback, PVOID Parameter, DWORD DueTime, DWORD Period, WINBOOL PreferIo);
   2322   WINBASEAPI WINBOOL WINAPI CancelTimerQueueTimer (HANDLE TimerQueue, HANDLE Timer);
   2323   WINBASEAPI WINBOOL WINAPI DeleteTimerQueue (HANDLE TimerQueue);
   2324 
   2325 #ifndef __WIDL__
   2326   /* Add Tp... API to winnt.h header and Threadpool-base-API. */
   2327 
   2328   WINBASEAPI HANDLE WINAPI CreatePrivateNamespaceA (LPSECURITY_ATTRIBUTES lpPrivateNamespaceAttributes, LPVOID lpBoundaryDescriptor, LPCSTR lpAliasPrefix);
   2329   WINBASEAPI HANDLE WINAPI OpenPrivateNamespaceA (LPVOID lpBoundaryDescriptor, LPCSTR lpAliasPrefix);
   2330   WINBASEAPI HANDLE APIENTRY CreateBoundaryDescriptorA (LPCSTR Name, ULONG Flags);
   2331   WINBASEAPI WINBOOL WINAPI AddIntegrityLabelToBoundaryDescriptor (HANDLE *BoundaryDescriptor, PSID IntegrityLabel);
   2332 
   2333 #ifndef UNICODE
   2334 #define CreatePrivateNamespace __MINGW_NAME_AW(CreatePrivateNamespace)
   2335 #endif
   2336 #define OpenPrivateNamespace __MINGW_NAME_AW(OpenPrivateNamespace)
   2337 #ifndef UNICODE
   2338 #define CreateBoundaryDescriptor __MINGW_NAME_AW(CreateBoundaryDescriptor)
   2339 #endif
   2340 
   2341 #endif
   2342 
   2343 #define HW_PROFILE_GUIDLEN 39
   2344 #define MAX_PROFILE_LEN 80
   2345 
   2346 #define DOCKINFO_UNDOCKED (0x1)
   2347 #define DOCKINFO_DOCKED (0x2)
   2348 #define DOCKINFO_USER_SUPPLIED (0x4)
   2349 #define DOCKINFO_USER_UNDOCKED (DOCKINFO_USER_SUPPLIED | DOCKINFO_UNDOCKED)
   2350 #define DOCKINFO_USER_DOCKED (DOCKINFO_USER_SUPPLIED | DOCKINFO_DOCKED)
   2351 
   2352   typedef struct tagHW_PROFILE_INFOA {
   2353     DWORD dwDockInfo;
   2354     CHAR szHwProfileGuid[HW_PROFILE_GUIDLEN];
   2355     CHAR szHwProfileName[MAX_PROFILE_LEN];
   2356   } HW_PROFILE_INFOA,*LPHW_PROFILE_INFOA;
   2357 
   2358   typedef struct tagHW_PROFILE_INFOW {
   2359     DWORD dwDockInfo;
   2360     WCHAR szHwProfileGuid[HW_PROFILE_GUIDLEN];
   2361     WCHAR szHwProfileName[MAX_PROFILE_LEN];
   2362   } HW_PROFILE_INFOW,*LPHW_PROFILE_INFOW;
   2363 
   2364   __MINGW_TYPEDEF_AW(HW_PROFILE_INFO)
   2365   __MINGW_TYPEDEF_AW(LPHW_PROFILE_INFO)
   2366 
   2367   WINADVAPI WINBOOL WINAPI GetCurrentHwProfileA (LPHW_PROFILE_INFOA lpHwProfileInfo);
   2368   WINADVAPI WINBOOL WINAPI GetCurrentHwProfileW (LPHW_PROFILE_INFOW lpHwProfileInfo);
   2369   WINBASEAPI WINBOOL WINAPI VerifyVersionInfoA (LPOSVERSIONINFOEXA lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
   2370   WINBASEAPI WINBOOL WINAPI VerifyVersionInfoW (LPOSVERSIONINFOEXW lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
   2371 
   2372 #define GetCurrentHwProfile __MINGW_NAME_AW(GetCurrentHwProfile)
   2373 
   2374 #define VerifyVersionInfo __MINGW_NAME_AW(VerifyVersionInfo)
   2375 #endif
   2376 
   2377 #include <winerror.h>
   2378 #include <timezoneapi.h>
   2379 
   2380 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   2381 
   2382 #define TC_NORMAL 0
   2383 #define TC_HARDERR 1
   2384 #define TC_GP_TRAP 2
   2385 #define TC_SIGNAL 3
   2386 
   2387 #define AC_LINE_OFFLINE 0x00
   2388 #define AC_LINE_ONLINE 0x01
   2389 #define AC_LINE_BACKUP_POWER 0x02
   2390 #define AC_LINE_UNKNOWN 0xff
   2391 
   2392 #define BATTERY_FLAG_HIGH 0x01
   2393 #define BATTERY_FLAG_LOW 0x02
   2394 #define BATTERY_FLAG_CRITICAL 0x04
   2395 #define BATTERY_FLAG_CHARGING 0x08
   2396 #define BATTERY_FLAG_NO_BATTERY 0x80
   2397 #define BATTERY_FLAG_UNKNOWN 0xff
   2398 
   2399 #define BATTERY_PERCENTAGE_UNKNOWN 0xff
   2400 
   2401 #define BATTERY_LIFE_UNKNOWN 0xffffffff
   2402 
   2403   typedef struct _SYSTEM_POWER_STATUS {
   2404     BYTE ACLineStatus;
   2405     BYTE BatteryFlag;
   2406     BYTE BatteryLifePercent;
   2407     BYTE Reserved1;
   2408     DWORD BatteryLifeTime;
   2409     DWORD BatteryFullLifeTime;
   2410   } SYSTEM_POWER_STATUS,*LPSYSTEM_POWER_STATUS;
   2411 
   2412   WINBASEAPI WINBOOL WINAPI GetSystemPowerStatus (LPSYSTEM_POWER_STATUS lpSystemPowerStatus);
   2413   WINBASEAPI WINBOOL WINAPI SetSystemPowerState (WINBOOL fSuspend, WINBOOL fForce);
   2414 
   2415 #if _WIN32_WINNT >= 0x0602
   2416   typedef VOID WINAPI BAD_MEMORY_CALLBACK_ROUTINE (VOID);
   2417   typedef BAD_MEMORY_CALLBACK_ROUTINE *PBAD_MEMORY_CALLBACK_ROUTINE;
   2418 
   2419   WINBASEAPI PVOID WINAPI RegisterBadMemoryNotification (PBAD_MEMORY_CALLBACK_ROUTINE Callback);
   2420   WINBASEAPI WINBOOL WINAPI UnregisterBadMemoryNotification (PVOID RegistrationHandle);
   2421   WINBASEAPI WINBOOL WINAPI GetMemoryErrorHandlingCapabilities (PULONG Capabilities);
   2422 
   2423 #define MEHC_PATROL_SCRUBBER_PRESENT 0x1
   2424 
   2425 #endif
   2426 
   2427   WINBASEAPI WINBOOL WINAPI AllocateUserPhysicalPages (HANDLE hProcess, PULONG_PTR NumberOfPages, PULONG_PTR PageArray);
   2428   WINBASEAPI WINBOOL WINAPI FreeUserPhysicalPages (HANDLE hProcess, PULONG_PTR NumberOfPages, PULONG_PTR PageArray);
   2429   WINBASEAPI WINBOOL WINAPI MapUserPhysicalPages (PVOID VirtualAddress, ULONG_PTR NumberOfPages, PULONG_PTR PageArray);
   2430   WINBASEAPI WINBOOL WINAPI MapUserPhysicalPagesScatter (PVOID *VirtualAddresses, ULONG_PTR NumberOfPages, PULONG_PTR PageArray);
   2431   WINBASEAPI HANDLE WINAPI CreateJobObjectA (LPSECURITY_ATTRIBUTES lpJobAttributes, LPCSTR lpName);
   2432   WINBASEAPI HANDLE WINAPI CreateJobObjectW (LPSECURITY_ATTRIBUTES lpJobAttributes, LPCWSTR lpName);
   2433   WINBASEAPI HANDLE WINAPI OpenJobObjectA (DWORD dwDesiredAccess, WINBOOL bInheritHandle, LPCSTR lpName);
   2434   WINBASEAPI HANDLE WINAPI OpenJobObjectW (DWORD dwDesiredAccess, WINBOOL bInheritHandle, LPCWSTR lpName);
   2435   WINBASEAPI WINBOOL WINAPI AssignProcessToJobObject (HANDLE hJob, HANDLE hProcess);
   2436   WINBASEAPI WINBOOL WINAPI TerminateJobObject (HANDLE hJob, UINT uExitCode);
   2437   WINBASEAPI WINBOOL WINAPI QueryInformationJobObject (HANDLE hJob, JOBOBJECTINFOCLASS JobObjectInformationClass, LPVOID lpJobObjectInformation, DWORD cbJobObjectInformationLength, LPDWORD lpReturnLength);
   2438   WINBASEAPI WINBOOL WINAPI SetInformationJobObject (HANDLE hJob, JOBOBJECTINFOCLASS JobObjectInformationClass, LPVOID lpJobObjectInformation, DWORD cbJobObjectInformationLength);
   2439   WINBASEAPI WINBOOL WINAPI CreateJobSet (ULONG NumJob, PJOB_SET_ARRAY UserJobSet, ULONG Flags);
   2440   WINBASEAPI HANDLE WINAPI FindFirstVolumeA (LPSTR lpszVolumeName, DWORD cchBufferLength);
   2441   WINBASEAPI WINBOOL WINAPI FindNextVolumeA (HANDLE hFindVolume, LPSTR lpszVolumeName, DWORD cchBufferLength);
   2442   WINBASEAPI HANDLE WINAPI FindFirstVolumeMountPointA (LPCSTR lpszRootPathName, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength);
   2443   WINBASEAPI HANDLE WINAPI FindFirstVolumeMountPointW (LPCWSTR lpszRootPathName, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength);
   2444   WINBASEAPI WINBOOL WINAPI FindNextVolumeMountPointA (HANDLE hFindVolumeMountPoint, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength);
   2445   WINBASEAPI WINBOOL WINAPI FindNextVolumeMountPointW (HANDLE hFindVolumeMountPoint, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength);
   2446   WINBASEAPI WINBOOL WINAPI FindVolumeMountPointClose (HANDLE hFindVolumeMountPoint);
   2447   WINBASEAPI WINBOOL WINAPI SetVolumeMountPointA (LPCSTR lpszVolumeMountPoint, LPCSTR lpszVolumeName);
   2448   WINBASEAPI WINBOOL WINAPI SetVolumeMountPointW (LPCWSTR lpszVolumeMountPoint, LPCWSTR lpszVolumeName);
   2449   WINBASEAPI WINBOOL WINAPI DeleteVolumeMountPointA (LPCSTR lpszVolumeMountPoint);
   2450   WINBASEAPI WINBOOL WINAPI GetVolumeNameForVolumeMountPointA (LPCSTR lpszVolumeMountPoint, LPSTR lpszVolumeName, DWORD cchBufferLength);
   2451   WINBASEAPI WINBOOL WINAPI GetVolumePathNameA (LPCSTR lpszFileName, LPSTR lpszVolumePathName, DWORD cchBufferLength);
   2452   WINBASEAPI WINBOOL WINAPI GetVolumePathNamesForVolumeNameA (LPCSTR lpszVolumeName, LPCH lpszVolumePathNames, DWORD cchBufferLength, PDWORD lpcchReturnLength);
   2453 #if _WIN32_WINNT >= 0x0600
   2454   WINBASEAPI WINBOOL WINAPI AllocateUserPhysicalPagesNuma (HANDLE hProcess, PULONG_PTR NumberOfPages, PULONG_PTR PageArray, DWORD nndPreferred);
   2455 #endif
   2456 
   2457 #ifndef UNICODE
   2458 #define FindFirstVolume FindFirstVolumeA
   2459 #define FindNextVolume FindNextVolumeA
   2460 #define DeleteVolumeMountPoint DeleteVolumeMountPointA
   2461 #define GetVolumeNameForVolumeMountPoint GetVolumeNameForVolumeMountPointA
   2462 #define GetVolumePathName GetVolumePathNameA
   2463 #define GetVolumePathNamesForVolumeName GetVolumePathNamesForVolumeNameA
   2464 #endif
   2465 
   2466 #define CreateJobObject __MINGW_NAME_AW(CreateJobObject)
   2467 #define OpenJobObject __MINGW_NAME_AW(OpenJobObject)
   2468 #define FindFirstVolumeMountPoint __MINGW_NAME_AW(FindFirstVolumeMountPoint)
   2469 #define FindNextVolumeMountPoint __MINGW_NAME_AW(FindNextVolumeMountPoint)
   2470 #define SetVolumeMountPoint __MINGW_NAME_AW(SetVolumeMountPoint)
   2471 
   2472 #define ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID (0x00000001)
   2473 #define ACTCTX_FLAG_LANGID_VALID (0x00000002)
   2474 #define ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID (0x00000004)
   2475 #define ACTCTX_FLAG_RESOURCE_NAME_VALID (0x00000008)
   2476 #define ACTCTX_FLAG_SET_PROCESS_DEFAULT (0x00000010)
   2477 #define ACTCTX_FLAG_APPLICATION_NAME_VALID (0x00000020)
   2478 #define ACTCTX_FLAG_SOURCE_IS_ASSEMBLYREF (0x00000040)
   2479 #define ACTCTX_FLAG_HMODULE_VALID (0x00000080)
   2480 
   2481   typedef struct tagACTCTXA {
   2482     ULONG cbSize;
   2483     DWORD dwFlags;
   2484     LPCSTR lpSource;
   2485     USHORT wProcessorArchitecture;
   2486     LANGID wLangId;
   2487     LPCSTR lpAssemblyDirectory;
   2488     LPCSTR lpResourceName;
   2489     LPCSTR lpApplicationName;
   2490     HMODULE hModule;
   2491   } ACTCTXA,*PACTCTXA;
   2492 
   2493   typedef struct tagACTCTXW {
   2494     ULONG cbSize;
   2495     DWORD dwFlags;
   2496     LPCWSTR lpSource;
   2497     USHORT wProcessorArchitecture;
   2498     LANGID wLangId;
   2499     LPCWSTR lpAssemblyDirectory;
   2500     LPCWSTR lpResourceName;
   2501     LPCWSTR lpApplicationName;
   2502     HMODULE hModule;
   2503   } ACTCTXW,*PACTCTXW;
   2504 
   2505   __MINGW_TYPEDEF_AW(ACTCTX)
   2506   __MINGW_TYPEDEF_AW(PACTCTX)
   2507 
   2508   typedef const ACTCTXA *PCACTCTXA;
   2509   typedef const ACTCTXW *PCACTCTXW;
   2510 
   2511   __MINGW_TYPEDEF_AW(PCACTCTX)
   2512 
   2513   WINBASEAPI HANDLE WINAPI CreateActCtxA (PCACTCTXA pActCtx);
   2514   WINBASEAPI HANDLE WINAPI CreateActCtxW (PCACTCTXW pActCtx);
   2515   WINBASEAPI VOID WINAPI AddRefActCtx (HANDLE hActCtx);
   2516   WINBASEAPI VOID WINAPI ReleaseActCtx (HANDLE hActCtx);
   2517   WINBASEAPI WINBOOL WINAPI ZombifyActCtx (HANDLE hActCtx);
   2518   WINBASEAPI WINBOOL WINAPI ActivateActCtx (HANDLE hActCtx, ULONG_PTR *lpCookie);
   2519   WINBASEAPI WINBOOL WINAPI DeactivateActCtx (DWORD dwFlags, ULONG_PTR ulCookie);
   2520   WINBASEAPI WINBOOL WINAPI GetCurrentActCtx (HANDLE *lphActCtx);
   2521 
   2522 #define CreateActCtx __MINGW_NAME_AW(CreateActCtx)
   2523 #define DEACTIVATE_ACTCTX_FLAG_FORCE_EARLY_DEACTIVATION (0x00000001)
   2524 
   2525   typedef struct tagACTCTX_SECTION_KEYED_DATA_2600 {
   2526     ULONG cbSize;
   2527     ULONG ulDataFormatVersion;
   2528     PVOID lpData;
   2529     ULONG ulLength;
   2530     PVOID lpSectionGlobalData;
   2531     ULONG ulSectionGlobalDataLength;
   2532     PVOID lpSectionBase;
   2533     ULONG ulSectionTotalLength;
   2534     HANDLE hActCtx;
   2535     ULONG ulAssemblyRosterIndex;
   2536   } ACTCTX_SECTION_KEYED_DATA_2600,*PACTCTX_SECTION_KEYED_DATA_2600;
   2537 
   2538   typedef const ACTCTX_SECTION_KEYED_DATA_2600 *PCACTCTX_SECTION_KEYED_DATA_2600;
   2539 
   2540   typedef struct tagACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA {
   2541     PVOID lpInformation;
   2542     PVOID lpSectionBase;
   2543     ULONG ulSectionLength;
   2544     PVOID lpSectionGlobalDataBase;
   2545     ULONG ulSectionGlobalDataLength;
   2546   } ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA,*PACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA;
   2547 
   2548   typedef const ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA *PCACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA;
   2549 
   2550   typedef struct tagACTCTX_SECTION_KEYED_DATA {
   2551     ULONG cbSize;
   2552     ULONG ulDataFormatVersion;
   2553     PVOID lpData;
   2554     ULONG ulLength;
   2555     PVOID lpSectionGlobalData;
   2556     ULONG ulSectionGlobalDataLength;
   2557     PVOID lpSectionBase;
   2558     ULONG ulSectionTotalLength;
   2559     HANDLE hActCtx;
   2560     ULONG ulAssemblyRosterIndex;
   2561     ULONG ulFlags;
   2562     ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA AssemblyMetadata;
   2563   } ACTCTX_SECTION_KEYED_DATA,*PACTCTX_SECTION_KEYED_DATA;
   2564 
   2565   typedef const ACTCTX_SECTION_KEYED_DATA *PCACTCTX_SECTION_KEYED_DATA;
   2566 
   2567 #define FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX (0x00000001)
   2568 #define FIND_ACTCTX_SECTION_KEY_RETURN_FLAGS (0x00000002)
   2569 #define FIND_ACTCTX_SECTION_KEY_RETURN_ASSEMBLY_METADATA (0x00000004)
   2570 
   2571   WINBASEAPI WINBOOL WINAPI FindActCtxSectionStringA (DWORD dwFlags, const GUID *lpExtensionGuid, ULONG ulSectionId, LPCSTR lpStringToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData);
   2572   WINBASEAPI WINBOOL WINAPI FindActCtxSectionStringW (DWORD dwFlags, const GUID *lpExtensionGuid, ULONG ulSectionId, LPCWSTR lpStringToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData);
   2573   WINBASEAPI WINBOOL WINAPI FindActCtxSectionGuid (DWORD dwFlags, const GUID *lpExtensionGuid, ULONG ulSectionId, const GUID *lpGuidToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData);
   2574 
   2575 #define FindActCtxSectionString __MINGW_NAME_AW(FindActCtxSectionString)
   2576 
   2577 #if !defined (RC_INVOKED) && !defined (ACTIVATION_CONTEXT_BASIC_INFORMATION_DEFINED)
   2578   typedef struct _ACTIVATION_CONTEXT_BASIC_INFORMATION {
   2579     HANDLE hActCtx;
   2580     DWORD dwFlags;
   2581   } ACTIVATION_CONTEXT_BASIC_INFORMATION,*PACTIVATION_CONTEXT_BASIC_INFORMATION;
   2582 
   2583   typedef const struct _ACTIVATION_CONTEXT_BASIC_INFORMATION *PCACTIVATION_CONTEXT_BASIC_INFORMATION;
   2584 
   2585 #define ACTIVATION_CONTEXT_BASIC_INFORMATION_DEFINED 1
   2586 #endif
   2587 
   2588 #define QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX (0x00000004)
   2589 #define QUERY_ACTCTX_FLAG_ACTCTX_IS_HMODULE (0x00000008)
   2590 #define QUERY_ACTCTX_FLAG_ACTCTX_IS_ADDRESS (0x00000010)
   2591 #define QUERY_ACTCTX_FLAG_NO_ADDREF (0x80000000)
   2592 
   2593   WINBASEAPI WINBOOL WINAPI QueryActCtxW (DWORD dwFlags, HANDLE hActCtx, PVOID pvSubInstance, ULONG ulInfoClass, PVOID pvBuffer, SIZE_T cbBuffer, SIZE_T *pcbWrittenOrRequired);
   2594 
   2595   typedef WINBOOL (WINAPI *PQUERYACTCTXW_FUNC) (DWORD dwFlags, HANDLE hActCtx, PVOID pvSubInstance, ULONG ulInfoClass, PVOID pvBuffer, SIZE_T cbBuffer, SIZE_T *pcbWrittenOrRequired);
   2596 
   2597   WINBASEAPI DWORD WINAPI WTSGetActiveConsoleSessionId (VOID);
   2598   WINBASEAPI WINBOOL WINAPI GetNumaProcessorNode (UCHAR Processor, PUCHAR NodeNumber);
   2599   WINBASEAPI WINBOOL WINAPI GetNumaNodeProcessorMask (UCHAR Node, PULONGLONG ProcessorMask);
   2600   WINBASEAPI WINBOOL WINAPI GetNumaAvailableMemoryNode (UCHAR Node, PULONGLONG AvailableBytes);
   2601 #if _WIN32_WINNT >= 0x0600
   2602   WINBASEAPI WINBOOL WINAPI GetNumaProximityNode (ULONG ProximityId, PUCHAR NodeNumber);
   2603 #endif
   2604 #if _WIN32_WINNT >= 0x0601
   2605   WINBASEAPI WORD WINAPI GetActiveProcessorGroupCount (VOID);
   2606   WINBASEAPI WORD WINAPI GetMaximumProcessorGroupCount (VOID);
   2607   WINBASEAPI DWORD WINAPI GetActiveProcessorCount (WORD GroupNumber);
   2608   WINBASEAPI DWORD WINAPI GetMaximumProcessorCount (WORD GroupNumber);
   2609   WINBASEAPI WINBOOL WINAPI GetNumaNodeNumberFromHandle (HANDLE hFile, PUSHORT NodeNumber);
   2610   WINBASEAPI WINBOOL WINAPI GetNumaProcessorNodeEx (PPROCESSOR_NUMBER Processor, PUSHORT NodeNumber);
   2611   WINBASEAPI WINBOOL WINAPI GetNumaAvailableMemoryNodeEx (USHORT Node, PULONGLONG AvailableBytes);
   2612   WINBASEAPI WINBOOL WINAPI GetNumaProximityNodeEx (ULONG ProximityId, PUSHORT NodeNumber);
   2613 #endif
   2614 
   2615   typedef DWORD (WINAPI *APPLICATION_RECOVERY_CALLBACK) (PVOID pvParameter);
   2616 
   2617 #define RESTART_MAX_CMD_LINE 1024
   2618 
   2619 #define RESTART_NO_CRASH 1
   2620 #define RESTART_NO_HANG 2
   2621 #define RESTART_NO_PATCH 4
   2622 #define RESTART_NO_REBOOT 8
   2623 
   2624 #define RECOVERY_DEFAULT_PING_INTERVAL 5000
   2625 #define RECOVERY_MAX_PING_INTERVAL (5 *60 *1000)
   2626 
   2627 #if _WIN32_WINNT >= 0x0600
   2628   WINBASEAPI HRESULT WINAPI RegisterApplicationRecoveryCallback (APPLICATION_RECOVERY_CALLBACK pRecoveyCallback, PVOID pvParameter, DWORD dwPingInterval, DWORD dwFlags);
   2629   WINBASEAPI HRESULT WINAPI UnregisterApplicationRecoveryCallback (void);
   2630   WINBASEAPI HRESULT WINAPI RegisterApplicationRestart (PCWSTR pwzCommandline, DWORD dwFlags);
   2631   WINBASEAPI HRESULT WINAPI UnregisterApplicationRestart (void);
   2632   WINBASEAPI HRESULT WINAPI GetApplicationRecoveryCallback (HANDLE hProcess, APPLICATION_RECOVERY_CALLBACK *pRecoveryCallback, PVOID *ppvParameter, PDWORD pdwPingInterval, PDWORD pdwFlags);
   2633   WINBASEAPI HRESULT WINAPI GetApplicationRestartSettings (HANDLE hProcess, PWSTR pwzCommandline, PDWORD pcchSize, PDWORD pdwFlags);
   2634   WINBASEAPI HRESULT WINAPI ApplicationRecoveryInProgress (PBOOL pbCancelled);
   2635   WINBASEAPI VOID WINAPI ApplicationRecoveryFinished (WINBOOL bSuccess);
   2636 #endif
   2637 #endif
   2638 
   2639 #if _WIN32_WINNT >= 0x0600
   2640 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
   2641   typedef struct _FILE_BASIC_INFO {
   2642     LARGE_INTEGER CreationTime;
   2643     LARGE_INTEGER LastAccessTime;
   2644     LARGE_INTEGER LastWriteTime;
   2645     LARGE_INTEGER ChangeTime;
   2646     DWORD FileAttributes;
   2647   } FILE_BASIC_INFO,*PFILE_BASIC_INFO;
   2648 
   2649   typedef struct _FILE_STANDARD_INFO {
   2650     LARGE_INTEGER AllocationSize;
   2651     LARGE_INTEGER EndOfFile;
   2652     DWORD NumberOfLinks;
   2653     BOOLEAN DeletePending;
   2654     BOOLEAN Directory;
   2655   } FILE_STANDARD_INFO,*PFILE_STANDARD_INFO;
   2656 
   2657   typedef struct _FILE_NAME_INFO {
   2658     DWORD FileNameLength;
   2659     WCHAR FileName[1];
   2660   } FILE_NAME_INFO,*PFILE_NAME_INFO;
   2661 
   2662   typedef struct _FILE_RENAME_INFO {
   2663     BOOLEAN ReplaceIfExists;
   2664     HANDLE RootDirectory;
   2665     DWORD FileNameLength;
   2666     WCHAR FileName[1];
   2667   } FILE_RENAME_INFO,*PFILE_RENAME_INFO;
   2668 
   2669   typedef struct _FILE_ALLOCATION_INFO {
   2670     LARGE_INTEGER AllocationSize;
   2671   } FILE_ALLOCATION_INFO,*PFILE_ALLOCATION_INFO;
   2672 
   2673   typedef struct _FILE_END_OF_FILE_INFO {
   2674     LARGE_INTEGER EndOfFile;
   2675   } FILE_END_OF_FILE_INFO,*PFILE_END_OF_FILE_INFO;
   2676 
   2677   typedef struct _FILE_STREAM_INFO {
   2678     DWORD NextEntryOffset;
   2679     DWORD StreamNameLength;
   2680     LARGE_INTEGER StreamSize;
   2681     LARGE_INTEGER StreamAllocationSize;
   2682     WCHAR StreamName[1];
   2683   } FILE_STREAM_INFO,*PFILE_STREAM_INFO;
   2684 
   2685   typedef struct _FILE_COMPRESSION_INFO {
   2686     LARGE_INTEGER CompressedFileSize;
   2687     WORD CompressionFormat;
   2688     UCHAR CompressionUnitShift;
   2689     UCHAR ChunkShift;
   2690     UCHAR ClusterShift;
   2691     UCHAR Reserved[3];
   2692   } FILE_COMPRESSION_INFO,*PFILE_COMPRESSION_INFO;
   2693 
   2694   typedef struct _FILE_ATTRIBUTE_TAG_INFO {
   2695     DWORD FileAttributes;
   2696     DWORD ReparseTag;
   2697   } FILE_ATTRIBUTE_TAG_INFO,*PFILE_ATTRIBUTE_TAG_INFO;
   2698 
   2699   typedef struct _FILE_DISPOSITION_INFO {
   2700     BOOLEAN DeleteFile;
   2701   } FILE_DISPOSITION_INFO,*PFILE_DISPOSITION_INFO;
   2702 
   2703   typedef struct _FILE_ID_BOTH_DIR_INFO {
   2704     DWORD NextEntryOffset;
   2705     DWORD FileIndex;
   2706     LARGE_INTEGER CreationTime;
   2707     LARGE_INTEGER LastAccessTime;
   2708     LARGE_INTEGER LastWriteTime;
   2709     LARGE_INTEGER ChangeTime;
   2710     LARGE_INTEGER EndOfFile;
   2711     LARGE_INTEGER AllocationSize;
   2712     DWORD FileAttributes;
   2713     DWORD FileNameLength;
   2714     DWORD EaSize;
   2715     CCHAR ShortNameLength;
   2716     WCHAR ShortName[12];
   2717     LARGE_INTEGER FileId;
   2718     WCHAR FileName[1];
   2719   } FILE_ID_BOTH_DIR_INFO,*PFILE_ID_BOTH_DIR_INFO;
   2720 
   2721   typedef struct _FILE_FULL_DIR_INFO {
   2722     ULONG NextEntryOffset;
   2723     ULONG FileIndex;
   2724     LARGE_INTEGER CreationTime;
   2725     LARGE_INTEGER LastAccessTime;
   2726     LARGE_INTEGER LastWriteTime;
   2727     LARGE_INTEGER ChangeTime;
   2728     LARGE_INTEGER EndOfFile;
   2729     LARGE_INTEGER AllocationSize;
   2730     ULONG FileAttributes;
   2731     ULONG FileNameLength;
   2732     ULONG EaSize;
   2733     WCHAR FileName[1];
   2734   } FILE_FULL_DIR_INFO,*PFILE_FULL_DIR_INFO;
   2735 
   2736   typedef enum _PRIORITY_HINT {
   2737     IoPriorityHintVeryLow = 0,
   2738     IoPriorityHintLow,
   2739     IoPriorityHintNormal,
   2740     MaximumIoPriorityHintType
   2741   } PRIORITY_HINT;
   2742 
   2743   typedef struct _FILE_IO_PRIORITY_HINT_INFO {
   2744     PRIORITY_HINT PriorityHint;
   2745   } FILE_IO_PRIORITY_HINT_INFO,*PFILE_IO_PRIORITY_HINT_INFO;
   2746 #if _WIN32_WINNT >= 0x0602
   2747   typedef struct _FILE_ALIGNMENT_INFO {
   2748     ULONG AlignmentRequirement;
   2749   } FILE_ALIGNMENT_INFO,*PFILE_ALIGNMENT_INFO;
   2750 
   2751 #define STORAGE_INFO_FLAGS_ALIGNED_DEVICE 0x00000001
   2752 #define STORAGE_INFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE 0x00000002
   2753 
   2754 #define STORAGE_INFO_OFFSET_UNKNOWN (0xffffffff)
   2755 
   2756   typedef struct _FILE_STORAGE_INFO {
   2757     ULONG LogicalBytesPerSector;
   2758     ULONG PhysicalBytesPerSectorForAtomicity;
   2759     ULONG PhysicalBytesPerSectorForPerformance;
   2760     ULONG FileSystemEffectivePhysicalBytesPerSectorForAtomicity;
   2761     ULONG Flags;
   2762     ULONG ByteOffsetForSectorAlignment;
   2763     ULONG ByteOffsetForPartitionAlignment;
   2764   } FILE_STORAGE_INFO,*PFILE_STORAGE_INFO;
   2765 
   2766   typedef struct _FILE_ID_INFO {
   2767     ULONGLONG VolumeSerialNumber;
   2768     FILE_ID_128 FileId;
   2769   } FILE_ID_INFO,*PFILE_ID_INFO;
   2770 
   2771   typedef struct _FILE_ID_EXTD_DIR_INFO {
   2772     ULONG NextEntryOffset;
   2773     ULONG FileIndex;
   2774     LARGE_INTEGER CreationTime;
   2775     LARGE_INTEGER LastAccessTime;
   2776     LARGE_INTEGER LastWriteTime;
   2777     LARGE_INTEGER ChangeTime;
   2778     LARGE_INTEGER EndOfFile;
   2779     LARGE_INTEGER AllocationSize;
   2780     ULONG FileAttributes;
   2781     ULONG FileNameLength;
   2782     ULONG EaSize;
   2783     ULONG ReparsePointTag;
   2784     FILE_ID_128 FileId;
   2785     WCHAR FileName[1];
   2786   } FILE_ID_EXTD_DIR_INFO,*PFILE_ID_EXTD_DIR_INFO;
   2787 #endif
   2788 
   2789 #define REMOTE_PROTOCOL_INFO_FLAG_LOOPBACK 0x00000001
   2790 #define REMOTE_PROTOCOL_INFO_FLAG_OFFLINE 0x00000002
   2791 
   2792 #if _WIN32_WINNT >= 0x0602
   2793 #define REMOTE_PROTOCOL_INFO_FLAG_PERSISTENT_HANDLE 0x00000004
   2794 
   2795 #define RPI_FLAG_SMB2_SHARECAP_TIMEWARP 0x00000002
   2796 #define RPI_FLAG_SMB2_SHARECAP_DFS 0x00000008
   2797 #define RPI_FLAG_SMB2_SHARECAP_CONTINUOUS_AVAILABILITY 0x00000010
   2798 #define RPI_FLAG_SMB2_SHARECAP_SCALEOUT 0x00000020
   2799 #define RPI_FLAG_SMB2_SHARECAP_CLUSTER 0x00000040
   2800 
   2801 #define RPI_SMB2_FLAG_SERVERCAP_DFS 0x00000001
   2802 #define RPI_SMB2_FLAG_SERVERCAP_LEASING 0x00000002
   2803 #define RPI_SMB2_FLAG_SERVERCAP_LARGEMTU 0x00000004
   2804 #define RPI_SMB2_FLAG_SERVERCAP_MULTICHANNEL 0x00000008
   2805 #define RPI_SMB2_FLAG_SERVERCAP_PERSISTENT_HANDLES 0x00000010
   2806 #define RPI_SMB2_FLAG_SERVERCAP_DIRECTORY_LEASING 0x00000020
   2807 #endif
   2808 
   2809   typedef struct _FILE_REMOTE_PROTOCOL_INFO {
   2810     USHORT StructureVersion;
   2811     USHORT StructureSize;
   2812     ULONG Protocol;
   2813     USHORT ProtocolMajorVersion;
   2814     USHORT ProtocolMinorVersion;
   2815     USHORT ProtocolRevision;
   2816     USHORT Reserved;
   2817     ULONG Flags;
   2818     struct {
   2819       ULONG Reserved[8];
   2820     } GenericReserved;
   2821 #if _WIN32_WINNT < 0x0602
   2822     struct {
   2823       ULONG Reserved[16];
   2824     } ProtocolSpecificReserved;
   2825 #else
   2826     union {
   2827       struct {
   2828 	struct {
   2829 	  ULONG Capabilities;
   2830 	} Server;
   2831 	struct {
   2832 	  ULONG Capabilities;
   2833 	  ULONG CachingFlags;
   2834 	} Share;
   2835       } Smb2;
   2836       ULONG Reserved[16];
   2837     } ProtocolSpecific;
   2838 #endif
   2839   } FILE_REMOTE_PROTOCOL_INFO,*PFILE_REMOTE_PROTOCOL_INFO;
   2840 
   2841   WINBASEAPI WINBOOL WINAPI GetFileInformationByHandleEx (HANDLE hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, LPVOID lpFileInformation, DWORD dwBufferSize);
   2842 #endif
   2843 
   2844 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   2845   typedef enum _FILE_ID_TYPE {
   2846     FileIdType,
   2847     ObjectIdType,
   2848     ExtendedFileIdType,
   2849     MaximumFileIdType
   2850   } FILE_ID_TYPE,*PFILE_ID_TYPE;
   2851 
   2852   typedef struct FILE_ID_DESCRIPTOR {
   2853     DWORD dwSize;
   2854     FILE_ID_TYPE Type;
   2855     __C89_NAMELESS union {
   2856       LARGE_INTEGER FileId;
   2857       GUID ObjectId;
   2858 #if _WIN32_WINNT >= 0x0602
   2859       FILE_ID_128 ExtendedFileId;
   2860 #endif
   2861     } DUMMYUNIONNAME;
   2862   } FILE_ID_DESCRIPTOR,*LPFILE_ID_DESCRIPTOR;
   2863 
   2864   WINBASEAPI HANDLE WINAPI OpenFileById (HANDLE hVolumeHint, LPFILE_ID_DESCRIPTOR lpFileId, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwFlagsAndAttributes);
   2865 #endif
   2866 #endif
   2867 
   2868 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   2869 #if _WIN32_WINNT >= 0x0600
   2870 
   2871 #define SYMBOLIC_LINK_FLAG_DIRECTORY (0x1)
   2872 
   2873 #define VALID_SYMBOLIC_LINK_FLAGS SYMBOLIC_LINK_FLAG_DIRECTORY
   2874 
   2875   WINBASEAPI BOOLEAN APIENTRY CreateSymbolicLinkA (LPCSTR lpSymlinkFileName, LPCSTR lpTargetFileName, DWORD dwFlags);
   2876   WINBASEAPI BOOLEAN APIENTRY CreateSymbolicLinkW (LPCWSTR lpSymlinkFileName, LPCWSTR lpTargetFileName, DWORD dwFlags);
   2877   WINBASEAPI BOOLEAN APIENTRY CreateSymbolicLinkTransactedA (LPCSTR lpSymlinkFileName, LPCSTR lpTargetFileName, DWORD dwFlags, HANDLE hTransaction);
   2878   WINBASEAPI BOOLEAN APIENTRY CreateSymbolicLinkTransactedW (LPCWSTR lpSymlinkFileName, LPCWSTR lpTargetFileName, DWORD dwFlags, HANDLE hTransaction);
   2879   WINBASEAPI WINBOOL WINAPI QueryActCtxSettingsW (DWORD dwFlags, HANDLE hActCtx, PCWSTR settingsNameSpace, PCWSTR settingName, PWSTR pvBuffer, SIZE_T dwBuffer, SIZE_T *pdwWrittenOrRequired);
   2880   WINBASEAPI WINBOOL WINAPI ReplacePartitionUnit (PWSTR TargetPartition, PWSTR SparePartition, ULONG Flags);
   2881   WINBASEAPI WINBOOL WINAPI AddSecureMemoryCacheCallback (PSECURE_MEMORY_CACHE_CALLBACK pfnCallBack);
   2882   WINBASEAPI WINBOOL WINAPI RemoveSecureMemoryCacheCallback (PSECURE_MEMORY_CACHE_CALLBACK pfnCallBack);
   2883 
   2884 #define CreateSymbolicLink __MINGW_NAME_AW(CreateSymbolicLink)
   2885 #define CreateSymbolicLinkTransacted __MINGW_NAME_AW(CreateSymbolicLinkTransacted)
   2886 
   2887 #endif
   2888 #endif
   2889 
   2890 #if NTDDI_VERSION >= NTDDI_WIN7SP1
   2891 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   2892   WINBASEAPI WINBOOL WINAPI CopyContext (PCONTEXT Destination, DWORD ContextFlags, PCONTEXT Source);
   2893 #endif
   2894 
   2895 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
   2896   WINBASEAPI WINBOOL WINAPI InitializeContext (PVOID Buffer, DWORD ContextFlags, PCONTEXT *Context, PDWORD ContextLength);
   2897 #if defined (__x86_64__) || defined (__i386__)
   2898   WINBASEAPI DWORD64 WINAPI GetEnabledXStateFeatures (VOID);
   2899   WINBASEAPI WINBOOL WINAPI GetXStateFeaturesMask (PCONTEXT Context, PDWORD64 FeatureMask);
   2900   WINBASEAPI PVOID WINAPI LocateXStateFeature (PCONTEXT Context, DWORD FeatureId, PDWORD Length);
   2901 #endif
   2902 #endif
   2903 
   2904 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   2905 #if defined (__x86_64__) || defined (__i386__)
   2906   WINBASEAPI WINBOOL WINAPI SetXStateFeaturesMask (PCONTEXT Context, DWORD64 FeatureMask);
   2907 #endif
   2908 #if _WIN32_WINNT >= 0x0601
   2909   WINBASEAPI DWORD APIENTRY EnableThreadProfiling (HANDLE ThreadHandle, DWORD Flags, DWORD64 HardwareCounters, HANDLE *PerformanceDataHandle);
   2910   WINBASEAPI DWORD APIENTRY DisableThreadProfiling (HANDLE PerformanceDataHandle);
   2911   WINBASEAPI DWORD APIENTRY QueryThreadProfiling (HANDLE ThreadHandle, PBOOLEAN Enabled);
   2912   WINBASEAPI DWORD APIENTRY ReadThreadProfilingData (HANDLE PerformanceDataHandle, DWORD Flags, PPERFORMANCE_DATA PerformanceData);
   2913 #endif
   2914 #endif
   2915 #endif
   2916 
   2917 #ifdef __cplusplus
   2918 }
   2919 #endif
   2920 #endif
   2921 
   2922 #if !defined (RC_INVOKED) && !defined (NOWINBASEINTERLOCK) && !defined (_NTOS_) && !defined (MICROSOFT_WINDOWS_WINBASE_INTERLOCKED_CPLUSPLUS_H_INCLUDED)
   2923 #define MICROSOFT_WINDOWS_WINBASE_INTERLOCKED_CPLUSPLUS_H_INCLUDED
   2924 #if !defined (__WIDL__)
   2925 #if !defined (MICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS)
   2926 #define MICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS (_WIN32_WINNT >= 0x0502 || !defined (_WINBASE_))
   2927 #endif
   2928 #if MICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS && defined (__cplusplus)
   2929 extern "C++" {
   2930 #if defined(__x86_64__) && defined(__CYGWIN__)
   2931 #define __MINGW_USE_INT64_INTERLOCKED_LONG
   2932 #endif
   2933   FORCEINLINE unsigned InterlockedIncrement (unsigned volatile *Addend) {
   2934     return (unsigned) InterlockedIncrement ((volatile __LONG32 *) Addend);
   2935   }
   2936 
   2937   FORCEINLINE unsigned long InterlockedIncrement (unsigned long volatile *Addend) {
   2938 #ifndef __MINGW_USE_INT64_INTERLOCKED_LONG
   2939     return (unsigned __LONG32) InterlockedIncrement ((volatile __LONG32 *) Addend);
   2940 #else
   2941     return (unsigned long) InterlockedIncrement64 ((volatile __int64 *) Addend);
   2942 #endif
   2943   }
   2944 
   2945 #if defined (_WIN64) || ((_WIN32_WINNT >= 0x0502) && defined (_WINBASE_))
   2946   FORCEINLINE unsigned __int64 InterlockedIncrement (unsigned __int64 volatile *Addend) {
   2947     return (unsigned __int64) InterlockedIncrement64 ((volatile __int64 *) Addend);
   2948   }
   2949 #endif
   2950 
   2951   FORCEINLINE unsigned InterlockedDecrement (unsigned volatile *Addend) {
   2952     return (unsigned) InterlockedDecrement ((volatile __LONG32 *) Addend);
   2953   }
   2954 
   2955   FORCEINLINE unsigned long InterlockedDecrement (unsigned long volatile *Addend) {
   2956 #ifndef __MINGW_USE_INT64_INTERLOCKED_LONG
   2957     return (unsigned __LONG32) InterlockedDecrement ((volatile __LONG32 *) Addend);
   2958 #else
   2959     return (unsigned long) InterlockedDecrement64 ((volatile __int64 *) Addend);
   2960 #endif
   2961   }
   2962 
   2963 #if defined (_WIN64) || ((_WIN32_WINNT >= 0x0502) && defined (_WINBASE_))
   2964   FORCEINLINE unsigned __int64 InterlockedDecrement (unsigned __int64 volatile *Addend) {
   2965     return (unsigned __int64) InterlockedDecrement64 ((volatile __int64 *) Addend);
   2966   }
   2967 #endif
   2968 
   2969   FORCEINLINE unsigned InterlockedExchange (unsigned volatile *Target, unsigned Value) {
   2970     return (unsigned) InterlockedExchange ((volatile __LONG32 *) Target,(__LONG32) Value);
   2971   }
   2972 
   2973   FORCEINLINE unsigned long InterlockedExchange (unsigned long volatile *Target, unsigned long Value) {
   2974 #ifndef __MINGW_USE_INT64_INTERLOCKED_LONG
   2975     return (unsigned __LONG32) InterlockedExchange ((volatile __LONG32 *) Target,(__LONG32) Value);
   2976 #else
   2977     return (unsigned long) InterlockedExchange64 ((volatile __int64 *) Target,(__int64) Value);
   2978 #endif
   2979   }
   2980 
   2981 #if defined (_WIN64) || ((_WIN32_WINNT >= 0x0502) && defined (_WINBASE_))
   2982   FORCEINLINE unsigned __int64 InterlockedExchange (unsigned __int64 volatile *Target, unsigned __int64 Value) {
   2983     return (unsigned __int64) InterlockedExchange64 ((volatile __int64 *) Target,(__int64) Value);
   2984   }
   2985 #endif
   2986 
   2987   FORCEINLINE unsigned InterlockedExchangeAdd (unsigned volatile *Addend, unsigned Value) {
   2988     return (unsigned) InterlockedExchangeAdd ((volatile __LONG32 *) Addend,(__LONG32) Value);
   2989   }
   2990 
   2991   FORCEINLINE unsigned InterlockedExchangeSubtract (unsigned volatile *Addend, unsigned Value) {
   2992     return (unsigned) InterlockedExchangeAdd ((volatile __LONG32 *) Addend,- (__LONG32) Value);
   2993   }
   2994 
   2995   FORCEINLINE unsigned long InterlockedExchangeAdd (unsigned long volatile *Addend, unsigned long Value) {
   2996 #ifndef __MINGW_USE_INT64_INTERLOCKED_LONG
   2997     return (unsigned __LONG32) InterlockedExchangeAdd ((volatile __LONG32 *) Addend,(__LONG32) Value);
   2998 #else
   2999     return (unsigned __int64) InterlockedExchangeAdd64 ((volatile __int64 *) Addend,(__int64) Value);
   3000 #endif
   3001   }
   3002 
   3003   FORCEINLINE unsigned long InterlockedExchangeSubtract (unsigned long volatile *Addend, unsigned long Value) {
   3004 #ifndef __MINGW_USE_INT64_INTERLOCKED_LONG
   3005     return (unsigned __LONG32) InterlockedExchangeAdd ((volatile __LONG32 *) Addend,- (__LONG32) Value);
   3006 #else
   3007     return (unsigned long) InterlockedExchangeAdd64 ((volatile __int64 *) Addend,- (__int64) Value);
   3008 #endif
   3009   }
   3010 
   3011 #if defined (_WIN64) || ((_WIN32_WINNT >= 0x0502) && defined (_WINBASE_))
   3012   FORCEINLINE unsigned __int64 InterlockedExchangeAdd (unsigned __int64 volatile *Addend, unsigned __int64 Value) {
   3013     return (unsigned __int64) InterlockedExchangeAdd64 ((volatile __int64 *) Addend,(__int64) Value);
   3014   }
   3015 
   3016   FORCEINLINE unsigned __int64 InterlockedExchangeSubtract (unsigned __int64 volatile *Addend, unsigned __int64 Value) {
   3017     return (unsigned __int64) InterlockedExchangeAdd64 ((volatile __int64 *) Addend,- (__int64) Value);
   3018   }
   3019 #endif
   3020 
   3021   FORCEINLINE unsigned InterlockedCompareExchange (unsigned volatile *Destination, unsigned Exchange, unsigned Comperand) {
   3022     return (unsigned) InterlockedCompareExchange ((volatile __LONG32 *) Destination,(__LONG32) Exchange,(__LONG32) Comperand);
   3023   }
   3024 
   3025   FORCEINLINE unsigned long InterlockedCompareExchange (unsigned long volatile *Destination, unsigned long Exchange, unsigned long Comperand) {
   3026 #ifndef __MINGW_USE_INT64_INTERLOCKED_LONG
   3027     return (unsigned __LONG32) InterlockedCompareExchange ((volatile __LONG32 *) Destination,(__LONG32) Exchange,(__LONG32) Comperand);
   3028 #else
   3029     return (unsigned long) InterlockedCompareExchange64 ((volatile __int64 *) Destination,(__int64) Exchange,(__int64) Comperand);
   3030 #endif
   3031   }
   3032 
   3033 #if defined (_WIN64) || ((_WIN32_WINNT >= 0x0502) && defined (_WINBASE_))
   3034   FORCEINLINE unsigned __int64 InterlockedCompareExchange (unsigned __int64 volatile *Destination, unsigned __int64 Exchange, unsigned __int64 Comperand) {
   3035     return (unsigned __int64) InterlockedCompareExchange64 ((volatile __int64 *) Destination,(__int64) Exchange,(__int64) Comperand);
   3036   }
   3037 
   3038   FORCEINLINE unsigned __int64 InterlockedAnd (unsigned __int64 volatile *Destination, unsigned __int64 Value) {
   3039     return (unsigned __int64) InterlockedAnd64 ((volatile __int64 *) Destination,(__int64) Value);
   3040   }
   3041 
   3042   FORCEINLINE unsigned __int64 InterlockedOr (unsigned __int64 volatile *Destination, unsigned __int64 Value) {
   3043     return (unsigned __int64) InterlockedOr64 ((volatile __int64 *) Destination,(__int64) Value);
   3044   }
   3045 
   3046   FORCEINLINE unsigned __int64 InterlockedXor (unsigned __int64 volatile *Destination, unsigned __int64 Value) {
   3047     return (unsigned __int64) InterlockedXor64 ((volatile __int64 *) Destination,(__int64) Value);
   3048   }
   3049 #endif
   3050 }
   3051 #endif
   3052 
   3053 #undef MICROSOFT_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS
   3054 #define MICROSOFT_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS 0
   3055 #endif
   3056 #endif
   3057