Module:    Win32-Kernel
Copyright:    Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
              All rights reserved.
License:      See License.txt in this distribution for details.
Warranty:     Distributed WITHOUT WARRANTY OF ANY KIND

// This file is automatically generated from "winbase.h"; do not edit.


// Adapted from:
/************************************************************************
*                                                                       *
*   winbase.h -- This module defines the 32-Bit Windows Base APIs       *
*                                                                       *
*   
*                                                                       *
************************************************************************/
define inline-only constant $INVALID-HANDLE-VALUE       =
	make(<HANDLE>, address: -1);
define inline-only constant $INVALID-FILE-SIZE          = $FFFFFFFF;
define inline-only constant $FILE-BEGIN                 =    0;
define inline-only constant $FILE-CURRENT               =    1;
define inline-only constant $FILE-END                   =    2;
define inline-only constant $TIME-ZONE-ID-INVALID       = $FFFFFFFF;
define inline-only constant $WAIT-FAILED                = $FFFFFFFF;
define inline-only constant $FILE-FLAG-WRITE-THROUGH    =
	as(<machine-word>, #x80000000);
define inline-only constant $FILE-FLAG-OVERLAPPED       =
	as(<machine-word>, #x40000000);
define inline-only constant $FILE-FLAG-NO-BUFFERING     =
	as(<machine-word>, #x20000000);
define inline-only constant $FILE-FLAG-RANDOM-ACCESS    =
	as(<machine-word>, #x10000000);
define inline-only constant $FILE-FLAG-SEQUENTIAL-SCAN  = #x08000000;
define inline-only constant $FILE-FLAG-DELETE-ON-CLOSE  = #x04000000;
define inline-only constant $FILE-FLAG-BACKUP-SEMANTICS = #x02000000;
define inline-only constant $FILE-FLAG-POSIX-SEMANTICS  = #x01000000;
define inline-only constant $FILE-FLAG-OPEN-REPARSE-POINT =
	#x00200000;
define inline-only constant $FILE-FLAG-OPEN-NO-RECALL   = #x00100000;
define inline-only constant $CREATE-NEW                 =    1;
define inline-only constant $CREATE-ALWAYS              =    2;
define inline-only constant $OPEN-EXISTING              =    3;
define inline-only constant $OPEN-ALWAYS                =    4;
define inline-only constant $TRUNCATE-EXISTING          =    5;
define inline-only constant $PIPE-ACCESS-INBOUND        = #x00000001;
define inline-only constant $PIPE-ACCESS-OUTBOUND       = #x00000002;
define inline-only constant $PIPE-ACCESS-DUPLEX         = #x00000003;
define inline-only constant $PIPE-CLIENT-END            = #x00000000;
define inline-only constant $PIPE-SERVER-END            = #x00000001;
define inline-only constant $PIPE-WAIT                  = #x00000000;
define inline-only constant $PIPE-NOWAIT                = #x00000001;
define inline-only constant $PIPE-READMODE-BYTE         = #x00000000;
define inline-only constant $PIPE-READMODE-MESSAGE      = #x00000002;
define inline-only constant $PIPE-TYPE-BYTE             = #x00000000;
define inline-only constant $PIPE-TYPE-MESSAGE          = #x00000004;
define inline-only constant $PIPE-UNLIMITED-INSTANCES   =  255;
define inline-only constant $SECURITY-CONTEXT-TRACKING  = #x00040000;
define inline-only constant $SECURITY-EFFECTIVE-ONLY    = #x00080000;
define inline-only constant $SECURITY-SQOS-PRESENT      = #x00100000;
define inline-only constant $SECURITY-VALID-SQOS-FLAGS  = #x001F0000;

define C-struct <OVERLAPPED>
  sealed inline-only slot Internal-value :: <DWORD>;
  sealed inline-only slot InternalHigh-value :: <DWORD>;
  sealed inline-only slot offset-value   :: <DWORD>;
  sealed inline-only slot OffsetHigh-value :: <DWORD>;
  sealed inline-only slot hEvent-value   :: <HANDLE>;
  pointer-type-name: <LPOVERLAPPED>;
  c-name: "struct _OVERLAPPED";
end C-struct <OVERLAPPED>;

define C-struct <SECURITY-ATTRIBUTES>
  sealed inline-only slot nLength-value  :: <DWORD>;
  sealed inline-only slot lpSecurityDescriptor-value :: <LPVOID>;
  sealed inline-only slot bInheritHandle-value :: <BOOL>;
  pointer-type-name: <LPSECURITY-ATTRIBUTES>;
  c-name: "struct _SECURITY_ATTRIBUTES";
end C-struct <SECURITY-ATTRIBUTES>;
define inline constant <PSECURITY-ATTRIBUTES> = <LPSECURITY-ATTRIBUTES>;

define C-struct <PROCESS-INFORMATION>
  sealed inline-only slot hProcess-value :: <HANDLE>;
  sealed inline-only slot hThread-value  :: <HANDLE>;
  sealed inline-only slot dwProcessId-value :: <DWORD>;
  sealed inline-only slot dwThreadId-value :: <DWORD>;
  pointer-type-name: <LPPROCESS-INFORMATION>;
  c-name: "struct _PROCESS_INFORMATION";
end C-struct <PROCESS-INFORMATION>;
define inline constant <PPROCESS-INFORMATION> = <LPPROCESS-INFORMATION>;

define C-struct <FILETIME>
  sealed inline-only slot dwLowDateTime-value :: <C-both-unsigned-long>;
  sealed inline-only slot dwHighDateTime-value :: <C-both-unsigned-long>;
  pointer-type-name: <LPFILETIME>;
  c-name: "struct _FILETIME";
end C-struct <FILETIME>;
define inline constant <PFILETIME> = <LPFILETIME>;

define C-struct <SYSTEMTIME>
  sealed inline-only slot wYear-value    :: <WORD>;
  sealed inline-only slot wMonth-value   :: <WORD>;
  sealed inline-only slot wDayOfWeek-value :: <WORD>;
  sealed inline-only slot wDay-value     :: <WORD>;
  sealed inline-only slot wHour-value    :: <WORD>;
  sealed inline-only slot wMinute-value  :: <WORD>;
  sealed inline-only slot wSecond-value  :: <WORD>;
  sealed inline-only slot wMilliseconds-value :: <WORD>;
  pointer-type-name: <LPSYSTEMTIME>;
  c-name: "struct _SYSTEMTIME";
end C-struct <SYSTEMTIME>;
define inline constant <PSYSTEMTIME> = <LPSYSTEMTIME>;
define inline-only constant $SP-SERIALCOMM              = #x00000001;
define inline-only constant $PST-UNSPECIFIED            = #x00000000;
define inline-only constant $PST-RS232                  = #x00000001;
define inline-only constant $PST-PARALLELPORT           = #x00000002;
define inline-only constant $PST-RS422                  = #x00000003;
define inline-only constant $PST-RS423                  = #x00000004;
define inline-only constant $PST-RS449                  = #x00000005;
define inline-only constant $PST-MODEM                  = #x00000006;
define inline-only constant $PST-FAX                    = #x00000021;
define inline-only constant $PST-SCANNER                = #x00000022;
define inline-only constant $PST-NETWORK-BRIDGE         = #x00000100;
define inline-only constant $PST-LAT                    = #x00000101;
define inline-only constant $PST-TCPIP-TELNET           = #x00000102;
define inline-only constant $PST-X25                    = #x00000103;
define inline-only constant $PCF-DTRDSR                 = #x0001;
define inline-only constant $PCF-RTSCTS                 = #x0002;
define inline-only constant $PCF-RLSD                   = #x0004;
define inline-only constant $PCF-PARITY-CHECK           = #x0008;
define inline-only constant $PCF-XONXOFF                = #x0010;
define inline-only constant $PCF-SETXCHAR               = #x0020;
define inline-only constant $PCF-TOTALTIMEOUTS          = #x0040;
define inline-only constant $PCF-INTTIMEOUTS            = #x0080;
define inline-only constant $PCF-SPECIALCHARS           = #x0100;
define inline-only constant $PCF-16BITMODE              = #x0200;
define inline-only constant $SP-PARITY                  = #x0001;
define inline-only constant $SP-BAUD                    = #x0002;
define inline-only constant $SP-DATABITS                = #x0004;
define inline-only constant $SP-STOPBITS                = #x0008;
define inline-only constant $SP-HANDSHAKING             = #x0010;
define inline-only constant $SP-PARITY-CHECK            = #x0020;
define inline-only constant $SP-RLSD                    = #x0040;
define inline-only constant $BAUD-075                   = #x00000001;
define inline-only constant $BAUD-110                   = #x00000002;
define inline-only constant $BAUD-134-5                 = #x00000004;
define inline-only constant $BAUD-150                   = #x00000008;
define inline-only constant $BAUD-300                   = #x00000010;
define inline-only constant $BAUD-600                   = #x00000020;
define inline-only constant $BAUD-1200                  = #x00000040;
define inline-only constant $BAUD-1800                  = #x00000080;
define inline-only constant $BAUD-2400                  = #x00000100;
define inline-only constant $BAUD-4800                  = #x00000200;
define inline-only constant $BAUD-7200                  = #x00000400;
define inline-only constant $BAUD-9600                  = #x00000800;
define inline-only constant $BAUD-14400                 = #x00001000;
define inline-only constant $BAUD-19200                 = #x00002000;
define inline-only constant $BAUD-38400                 = #x00004000;
define inline-only constant $BAUD-56K                   = #x00008000;
define inline-only constant $BAUD-128K                  = #x00010000;
define inline-only constant $BAUD-115200                = #x00020000;
define inline-only constant $BAUD-57600                 = #x00040000;
define inline-only constant $BAUD-USER                  =
	as(<machine-word>, #x10000000);
define inline-only constant $DATABITS-5                 = #x0001;
define inline-only constant $DATABITS-6                 = #x0002;
define inline-only constant $DATABITS-7                 = #x0004;
define inline-only constant $DATABITS-8                 = #x0008;
define inline-only constant $DATABITS-16                = #x0010;
define inline-only constant $DATABITS-16X               = #x0020;
define inline-only constant $STOPBITS-10                = #x0001;
define inline-only constant $STOPBITS-15                = #x0002;
define inline-only constant $STOPBITS-20                = #x0004;
define inline-only constant $PARITY-NONE                = #x0100;
define inline-only constant $PARITY-ODD                 = #x0200;
define inline-only constant $PARITY-EVEN                = #x0400;
define inline-only constant $PARITY-MARK                = #x0800;
define inline-only constant $PARITY-SPACE               = #x1000;

define C-struct <COMMPROP>
  sealed inline-only slot wPacketLength-value :: <WORD>;
  sealed inline-only slot wPacketVersion-value :: <WORD>;
  sealed inline-only slot dwServiceMask-value :: <DWORD>;
  sealed inline-only slot dwReserved1    :: <DWORD>;
  sealed inline-only slot dwMaxTxQueue-value :: <DWORD>;
  sealed inline-only slot dwMaxRxQueue-value :: <DWORD>;
  sealed inline-only slot dwMaxBaud-value :: <DWORD>;
  sealed inline-only slot dwProvSubType-value :: <DWORD>;
  sealed inline-only slot dwProvCapabilities-value :: <DWORD>;
  sealed inline-only slot dwSettableParams-value :: <DWORD>;
  sealed inline-only slot dwSettableBaud-value :: <DWORD>;
  sealed inline-only slot wSettableData-value :: <WORD>;
  sealed inline-only slot wSettableStopParity-value :: <WORD>;
  sealed inline-only slot dwCurrentTxQueue-value :: <DWORD>;
  sealed inline-only slot dwCurrentRxQueue-value :: <DWORD>;
  sealed inline-only slot dwProvSpec1-value :: <DWORD>;
  sealed inline-only slot dwProvSpec2-value :: <DWORD>;
  sealed inline-only array slot wcProvChar-array :: <WCHAR>,
	length: 1, address-getter: wcProvChar-value;
  pointer-type-name: <LPCOMMPROP>;
  c-name: "struct _COMMPROP";
end C-struct <COMMPROP>;
define inline-only constant $COMMPROP-INITIALIZED       =
	as(<machine-word>, #xE73CF52E);

define C-struct <COMSTAT>
  sealed bitfield slot fCtsHold-value  :: <C-unsigned-int>, width: 1;
  sealed bitfield slot fDsrHold-value  :: <C-unsigned-int>, width: 1;
  sealed bitfield slot fRlsdHold-value :: <C-unsigned-int>, width: 1;
  sealed bitfield slot fXoffHold-value :: <C-unsigned-int>, width: 1;
  sealed bitfield slot fXoffSent-value :: <C-unsigned-int>, width: 1;
  sealed bitfield slot fEof-value      :: <C-unsigned-int>, width: 1;
  sealed bitfield slot fTxim-value     :: <C-unsigned-int>, width: 1;
  sealed bitfield slot fReserved         :: <DWORD>, width: 25;
  sealed inline-only slot cbInQue-value  :: <DWORD>;
  sealed inline-only slot cbOutQue-value :: <DWORD>;
  pointer-type-name: <LPCOMSTAT>;
  c-name: "struct _COMSTAT";
end C-struct <COMSTAT>;
define inline-only constant $DTR-CONTROL-DISABLE        = #x00;
define inline-only constant $DTR-CONTROL-ENABLE         = #x01;
define inline-only constant $DTR-CONTROL-HANDSHAKE      = #x02;
define inline-only constant $RTS-CONTROL-DISABLE        = #x00;
define inline-only constant $RTS-CONTROL-ENABLE         = #x01;
define inline-only constant $RTS-CONTROL-HANDSHAKE      = #x02;
define inline-only constant $RTS-CONTROL-TOGGLE         = #x03;

define C-struct <DCB>
  sealed inline-only slot DCBlength-value :: <DWORD>;
  sealed inline-only slot BaudRate-value :: <DWORD>;
  sealed bitfield slot fBinary-value   :: <C-unsigned-int>, width: 1;
  sealed bitfield slot fParity-value   :: <C-unsigned-int>, width: 1;
  sealed bitfield slot fOutxCtsFlow-value ::
	<C-unsigned-int>, width: 1;
  sealed bitfield slot fOutxDsrFlow-value ::
	<C-unsigned-int>, width: 1;
  sealed bitfield slot fDtrControl-value ::
	<C-unsigned-int>, width: 2;
  sealed bitfield slot fDsrSensitivity-value ::
	<C-unsigned-int>, width: 1;
  sealed bitfield slot fTXContinueOnXoff-value ::
	<C-unsigned-int>, width: 1;
  sealed bitfield slot fOutX-value     :: <C-unsigned-int>, width: 1;
  sealed bitfield slot fInX-value      :: <C-unsigned-int>, width: 1;
  sealed bitfield slot fErrorChar-value ::
	<C-unsigned-int>, width: 1;
  sealed bitfield slot fNull-value     :: <C-unsigned-int>, width: 1;
  sealed bitfield slot fRtsControl-value ::
	<C-unsigned-int>, width: 2;
  sealed bitfield slot fAbortOnError-value ::
	<C-unsigned-int>, width: 1;
  sealed bitfield slot fDummy2-value     :: <DWORD>, width: 17;
  sealed inline-only slot wReserved      :: <WORD>;
  sealed inline-only slot XonLim-value   :: <WORD>;
  sealed inline-only slot XoffLim-value  :: <WORD>;
  sealed inline-only slot ByteSize-value :: <C-BYTE>;
  sealed inline-only slot Parity-value   :: <C-BYTE>;
  sealed inline-only slot StopBits-value :: <C-BYTE>;
  sealed inline-only slot XonChar-value  :: <C-char>;
  sealed inline-only slot XoffChar-value :: <C-char>;
  sealed inline-only slot ErrorChar-value :: <C-char>;
  sealed inline-only slot EofChar-value  :: <C-char>;
  sealed inline-only slot EvtChar-value  :: <C-char>;
  sealed inline-only slot wReserved1     :: <WORD>;
  pointer-type-name: <LPDCB>;
  c-name: "struct _DCB";
end C-struct <DCB>;

define C-struct <COMMTIMEOUTS>
  sealed inline-only slot ReadIntervalTimeout-value :: <DWORD>;
  sealed inline-only slot ReadTotalTimeoutMultiplier-value :: <DWORD>;
  sealed inline-only slot ReadTotalTimeoutConstant-value :: <DWORD>;
  sealed inline-only slot WriteTotalTimeoutMultiplier-value :: <DWORD>;
  sealed inline-only slot WriteTotalTimeoutConstant-value :: <DWORD>;
  pointer-type-name: <LPCOMMTIMEOUTS>;
  c-name: "struct _COMMTIMEOUTS";
end C-struct <COMMTIMEOUTS>;

define C-struct <COMMCONFIG>
  sealed inline-only slot dwSize-value   :: <DWORD>;
  sealed inline-only slot wVersion-value :: <WORD>;
  sealed inline-only slot wReserved      :: <WORD>;
  sealed inline-only slot dcb-value      :: <DCB>;
  sealed inline-only slot dwProviderSubType-value :: <DWORD>;
  sealed inline-only slot dwProviderOffset-value :: <DWORD>;
  sealed inline-only slot dwProviderSize-value :: <DWORD>;
  sealed inline-only array slot wcProviderData-array :: <WCHAR>,
	length: 1, address-getter: wcProviderData-value;
  pointer-type-name: <LPCOMMCONFIG>;
  c-name: "struct _COMMCONFIG";
end C-struct <COMMCONFIG>;

define C-struct <SYSTEM-INFO>
  sealed inline-only slot wProcessorArchitecture-value :: <WORD>;
  sealed inline-only slot wReserved      :: <WORD>;
  sealed inline-only slot dwPageSize-value :: <DWORD>;
  sealed inline-only slot lpMinimumApplicationAddress-value :: <LPVOID>;
  sealed inline-only slot lpMaximumApplicationAddress-value :: <LPVOID>;
  sealed inline-only slot dwActiveProcessorMask-value :: <DWORD>;
  sealed inline-only slot dwNumberOfProcessors-value :: <DWORD>;
  sealed inline-only slot dwProcessorType-value :: <DWORD>;
  sealed inline-only slot dwAllocationGranularity-value :: <DWORD>;
  sealed inline-only slot wProcessorLevel-value :: <WORD>;
  sealed inline-only slot wProcessorRevision-value :: <WORD>;
  pointer-type-name: <LPSYSTEM-INFO>;
  c-name: "struct _SYSTEM_INFO";
end C-struct <SYSTEM-INFO>;
define inline-only constant $GMEM-FIXED                 = #x0000;
define inline-only constant $GMEM-MOVEABLE              = #x0002;
define inline-only constant $GMEM-NOCOMPACT             = #x0010;
define inline-only constant $GMEM-NODISCARD             = #x0020;
define inline-only constant $GMEM-ZEROINIT              = #x0040;
define inline-only constant $GMEM-MODIFY                = #x0080;
define inline-only constant $GMEM-DISCARDABLE           = #x0100;
define inline-only constant $GMEM-NOT-BANKED            = #x1000;
define inline-only constant $GMEM-SHARE                 = #x2000;
define inline-only constant $GMEM-DDESHARE              = #x2000;
define inline-only constant $GMEM-NOTIFY                = #x4000;
define inline-only constant $GMEM-VALID-FLAGS           = #x7F72;
define inline-only constant $GMEM-INVALID-HANDLE        = #x8000;
define inline-only constant $GHND                       =
	logior($GMEM-MOVEABLE, $GMEM-ZEROINIT);
define inline-only constant $GPTR                       =
	logior($GMEM-FIXED, $GMEM-ZEROINIT);
define inline-only constant $GMEM-DISCARDED             = #x4000;
define inline-only constant $GMEM-LOCKCOUNT             = #x00FF;

define C-struct <MEMORYSTATUS>
  sealed inline-only slot dwLength-value :: <DWORD>;
  sealed inline-only slot dwMemoryLoad-value :: <DWORD>;
  sealed inline-only slot dwTotalPhys-value :: <DWORD>;
  sealed inline-only slot dwAvailPhys-value :: <DWORD>;
  sealed inline-only slot dwTotalPageFile-value :: <DWORD>;
  sealed inline-only slot dwAvailPageFile-value :: <DWORD>;
  sealed inline-only slot dwTotalVirtual-value :: <DWORD>;
  sealed inline-only slot dwAvailVirtual-value :: <DWORD>;
  pointer-type-name: <LPMEMORYSTATUS>;
  c-name: "struct _MEMORYSTATUS";
end C-struct <MEMORYSTATUS>;
define inline-only constant $LMEM-FIXED                 = #x0000;
define inline-only constant $LMEM-MOVEABLE              = #x0002;
define inline-only constant $LMEM-NOCOMPACT             = #x0010;
define inline-only constant $LMEM-NODISCARD             = #x0020;
define inline-only constant $LMEM-ZEROINIT              = #x0040;
define inline-only constant $LMEM-MODIFY                = #x0080;
define inline-only constant $LMEM-DISCARDABLE           = #x0F00;
define inline-only constant $LMEM-VALID-FLAGS           = #x0F72;
define inline-only constant $LMEM-INVALID-HANDLE        = #x8000;
define inline-only constant $LHND                       =
	logior($LMEM-MOVEABLE, $LMEM-ZEROINIT);
define inline-only constant $LPTR                       =
	logior($LMEM-FIXED, $LMEM-ZEROINIT);
define inline-only constant $NONZEROLHND                =
	$LMEM-MOVEABLE;
define inline-only constant $NONZEROLPTR                =
	$LMEM-FIXED;
define inline-only constant $LMEM-DISCARDED             = #x4000;
define inline-only constant $LMEM-LOCKCOUNT             = #x00FF;
define inline-only constant $CREATE-SUSPENDED           = #x00000004;
define inline-only constant $DETACHED-PROCESS           = #x00000008;
define inline-only constant $CREATE-NEW-CONSOLE         = #x00000010;
define inline-only constant $NORMAL-PRIORITY-CLASS      = #x00000020;
define inline-only constant $IDLE-PRIORITY-CLASS        = #x00000040;
define inline-only constant $HIGH-PRIORITY-CLASS        = #x00000080;
define inline-only constant $REALTIME-PRIORITY-CLASS    = #x00000100;
define inline-only constant $CREATE-NEW-PROCESS-GROUP   = #x00000200;
define inline-only constant $CREATE-UNICODE-ENVIRONMENT = #x00000400;
define inline-only constant $CREATE-SEPARATE-WOW-VDM    = #x00000800;
define inline-only constant $CREATE-SHARED-WOW-VDM      = #x00001000;
define inline-only constant $CREATE-FORCEDOS            = #x00002000;
define inline-only constant $CREATE-DEFAULT-ERROR-MODE  = #x04000000;
define inline-only constant $CREATE-NO-WINDOW           = #x08000000;
define inline-only constant $DRIVE-UNKNOWN              =    0;
define inline-only constant $DRIVE-NO-ROOT-DIR          =    1;
define inline-only constant $DRIVE-REMOVABLE            =    2;
define inline-only constant $DRIVE-FIXED                =    3;
define inline-only constant $DRIVE-REMOTE               =    4;
define inline-only constant $DRIVE-CDROM                =    5;
define inline-only constant $DRIVE-RAMDISK              =    6;
define inline-only constant $FILE-TYPE-UNKNOWN          = #x0000;
define inline-only constant $FILE-TYPE-DISK             = #x0001;
define inline-only constant $FILE-TYPE-CHAR             = #x0002;
define inline-only constant $FILE-TYPE-PIPE             = #x0003;
define inline-only constant $FILE-TYPE-REMOTE           = #x8000;
define inline-only constant $STD-INPUT-HANDLE           =  -10;
define inline-only constant $STD-OUTPUT-HANDLE          =  -11;
define inline-only constant $STD-ERROR-HANDLE           =  -12;
define inline-only constant $NOPARITY                   =    0;
define inline-only constant $ODDPARITY                  =    1;
define inline-only constant $EVENPARITY                 =    2;
define inline-only constant $MARKPARITY                 =    3;
define inline-only constant $SPACEPARITY                =    4;
define inline-only constant $ONESTOPBIT                 =    0;
define inline-only constant $ONE5STOPBITS               =    1;
define inline-only constant $TWOSTOPBITS                =    2;
define inline-only constant $IGNORE                     =    0;
define inline-only constant $INFINITE                   = $FFFFFFFF;
define inline-only constant $CBR-110                    =  110;
define inline-only constant $CBR-300                    =  300;
define inline-only constant $CBR-600                    =  600;
define inline-only constant $CBR-1200                   = 1200;
define inline-only constant $CBR-2400                   = 2400;
define inline-only constant $CBR-4800                   = 4800;
define inline-only constant $CBR-9600                   = 9600;
define inline-only constant $CBR-14400                  = 14400;
define inline-only constant $CBR-19200                  = 19200;
define inline-only constant $CBR-38400                  = 38400;
define inline-only constant $CBR-56000                  = 56000;
define inline-only constant $CBR-57600                  = 57600;
define inline-only constant $CBR-115200                 = 115200;
define inline-only constant $CBR-128000                 = 128000;
define inline-only constant $CBR-256000                 = 256000;
define inline-only constant $CE-RXOVER                  = #x0001;
define inline-only constant $CE-OVERRUN                 = #x0002;
define inline-only constant $CE-RXPARITY                = #x0004;
define inline-only constant $CE-FRAME                   = #x0008;
define inline-only constant $CE-BREAK                   = #x0010;
define inline-only constant $CE-TXFULL                  = #x0100;
define inline-only constant $CE-PTO                     = #x0200;
define inline-only constant $CE-IOE                     = #x0400;
define inline-only constant $CE-DNS                     = #x0800;
define inline-only constant $CE-OOP                     = #x1000;
define inline-only constant $CE-MODE                    = #x8000;
define inline-only constant $IE-BADID                   =   -1;
define inline-only constant $IE-OPEN                    =   -2;
define inline-only constant $IE-NOPEN                   =   -3;
define inline-only constant $IE-MEMORY                  =   -4;
define inline-only constant $IE-DEFAULT                 =   -5;
define inline-only constant $IE-HARDWARE                =  -10;
define inline-only constant $IE-BYTESIZE                =  -11;
define inline-only constant $IE-BAUDRATE                =  -12;
define inline-only constant $EV-RXCHAR                  = #x0001;
define inline-only constant $EV-RXFLAG                  = #x0002;
define inline-only constant $EV-TXEMPTY                 = #x0004;
define inline-only constant $EV-CTS                     = #x0008;
define inline-only constant $EV-DSR                     = #x0010;
define inline-only constant $EV-RLSD                    = #x0020;
define inline-only constant $EV-BREAK                   = #x0040;
define inline-only constant $EV-ERR                     = #x0080;
define inline-only constant $EV-RING                    = #x0100;
define inline-only constant $EV-PERR                    = #x0200;
define inline-only constant $EV-RX80FULL                = #x0400;
define inline-only constant $EV-EVENT1                  = #x0800;
define inline-only constant $EV-EVENT2                  = #x1000;
define inline-only constant $SETXOFF                    =    1;
define inline-only constant $SETXON                     =    2;
define inline-only constant $SETRTS                     =    3;
define inline-only constant $CLRRTS                     =    4;
define inline-only constant $SETDTR                     =    5;
define inline-only constant $CLRDTR                     =    6;
define inline-only constant $RESETDEV                   =    7;
define inline-only constant $SETBREAK                   =    8;
define inline-only constant $CLRBREAK                   =    9;
define inline-only constant $PURGE-TXABORT              = #x0001;
define inline-only constant $PURGE-RXABORT              = #x0002;
define inline-only constant $PURGE-TXCLEAR              = #x0004;
define inline-only constant $PURGE-RXCLEAR              = #x0008;
define inline-only constant $LPTx                       = #x80;
define inline-only constant $MS-CTS-ON                  = #x0010;
define inline-only constant $MS-DSR-ON                  = #x0020;
define inline-only constant $MS-RING-ON                 = #x0040;
define inline-only constant $MS-RLSD-ON                 = #x0080;
define inline-only constant $S-QUEUEEMPTY               =    0;
define inline-only constant $S-THRESHOLD                =    1;
define inline-only constant $S-ALLTHRESHOLD             =    2;
define inline-only constant $S-NORMAL                   =    0;
define inline-only constant $S-LEGATO                   =    1;
define inline-only constant $S-STACCATO                 =    2;
define inline-only constant $S-PERIOD512                =    0;
define inline-only constant $S-PERIOD1024               =    1;
define inline-only constant $S-PERIOD2048               =    2;
define inline-only constant $S-PERIODVOICE              =    3;
define inline-only constant $S-WHITE512                 =    4;
define inline-only constant $S-WHITE1024                =    5;
define inline-only constant $S-WHITE2048                =    6;
define inline-only constant $S-WHITEVOICE               =    7;
define inline-only constant $S-SERDVNA                  =   -1;
define inline-only constant $S-SEROFM                   =   -2;
define inline-only constant $S-SERMACT                  =   -3;
define inline-only constant $S-SERQFUL                  =   -4;
define inline-only constant $S-SERBDNT                  =   -5;
define inline-only constant $S-SERDLN                   =   -6;
define inline-only constant $S-SERDCC                   =   -7;
define inline-only constant $S-SERDTP                   =   -8;
define inline-only constant $S-SERDVL                   =   -9;
define inline-only constant $S-SERDMD                   =  -10;
define inline-only constant $S-SERDSH                   =  -11;
define inline-only constant $S-SERDPT                   =  -12;
define inline-only constant $S-SERDFQ                   =  -13;
define inline-only constant $S-SERDDR                   =  -14;
define inline-only constant $S-SERDSR                   =  -15;
define inline-only constant $S-SERDST                   =  -16;
define inline-only constant $NMPWAIT-WAIT-FOREVER       = $FFFFFFFF;
define inline-only constant $NMPWAIT-NOWAIT             = #x00000001;
define inline-only constant $NMPWAIT-USE-DEFAULT-WAIT   = #x00000000;
define inline-only constant $OF-READ                    = #x00000000;
define inline-only constant $OF-WRITE                   = #x00000001;
define inline-only constant $OF-READWRITE               = #x00000002;
define inline-only constant $OF-SHARE-COMPAT            = #x00000000;
define inline-only constant $OF-SHARE-EXCLUSIVE         = #x00000010;
define inline-only constant $OF-SHARE-DENY-WRITE        = #x00000020;
define inline-only constant $OF-SHARE-DENY-READ         = #x00000030;
define inline-only constant $OF-SHARE-DENY-NONE         = #x00000040;
define inline-only constant $OF-PARSE                   = #x00000100;
define inline-only constant $OF-DELETE                  = #x00000200;
define inline-only constant $OF-VERIFY                  = #x00000400;
define inline-only constant $OF-CANCEL                  = #x00000800;
define inline-only constant $OF-CREATE                  = #x00001000;
define inline-only constant $OF-PROMPT                  = #x00002000;
define inline-only constant $OF-EXIST                   = #x00004000;
define inline-only constant $OF-REOPEN                  = #x00008000;
define inline-only constant $OFS-MAXPATHNAME            =  128;

define C-struct <OFSTRUCT>
  sealed inline-only slot cBytes-value   :: <C-BYTE>;
  sealed inline-only slot fFixedDisk-value :: <C-BYTE>;
  sealed inline-only slot nErrCode-value :: <WORD>;
  sealed inline-only slot Reserved1      :: <WORD>;
  sealed inline-only slot Reserved2      :: <WORD>;
  sealed inline-only array slot szPathName-array :: <CHAR>,
	length: $OFS-MAXPATHNAME, address-getter: szPathName-value;
  pointer-type-name: <LPOFSTRUCT>;
  c-name: "struct _OFSTRUCT";
end C-struct <OFSTRUCT>;
define inline constant <POFSTRUCT> = <LPOFSTRUCT>;

define inline-only C-function FreeResource
  parameter hResData   :: <HGLOBAL>;
  result value :: <BOOL>;
  c-name: "FreeResource", c-modifiers: "__stdcall";
end;

define inline-only C-function LockResource
  parameter hResData   :: <HGLOBAL>;
  result value :: <LPVOID>;
  c-name: "LockResource", c-modifiers: "__stdcall";
end;
define inline-only constant $MAXINTATOM                 = #xC000;
define inline-only constant $INVALID-ATOM               =    0;

define inline-only C-function FreeLibrary
  parameter hLibModule :: <HMODULE>;
  result value :: <BOOL>;
  c-name: "FreeLibrary", c-modifiers: "__stdcall";
end;

define inline-only C-function GetProcAddress
  parameter hModule    :: <HMODULE>;
  parameter lpProcName :: <LPCSTR>;
  result value :: <FARPROC>;
  c-name: "GetProcAddress", c-modifiers: "__stdcall";
end;

define inline-only C-function GetVersion
  result value :: <DWORD>;
  c-name: "GetVersion", c-modifiers: "__stdcall";
end;

define inline-only C-function GlobalAlloc
  parameter uFlags     :: <UINT>;
  parameter dwBytes    :: <DWORD>;
  result value :: <HGLOBAL>;
  c-name: "GlobalAlloc", c-modifiers: "__stdcall";
end;

define inline-only C-function GlobalReAlloc
  parameter hMem       :: <HGLOBAL>;
  parameter dwBytes    :: <DWORD>;
  parameter uFlags     :: <UINT>;
  result value :: <HGLOBAL>;
  c-name: "GlobalReAlloc", c-modifiers: "__stdcall";
end;

define inline-only C-function GlobalSize
  parameter hMem       :: <HGLOBAL>;
  result value :: <DWORD>;
  c-name: "GlobalSize", c-modifiers: "__stdcall";
end;

define inline-only C-function GlobalFlags
  parameter hMem       :: <HGLOBAL>;
  result value :: <UINT>;
  c-name: "GlobalFlags", c-modifiers: "__stdcall";
end;

define inline-only C-function GlobalLock
  parameter hMem       :: <HGLOBAL>;
  result value :: <LPVOID>;
  c-name: "GlobalLock", c-modifiers: "__stdcall";
end;

define inline-only C-function GlobalHandle
  parameter pMem       :: <LPCVOID>;
  result value :: <HGLOBAL>;
  c-name: "GlobalHandle", c-modifiers: "__stdcall";
end;

define inline-only C-function GlobalUnlock
  parameter hMem       :: <HGLOBAL>;
  result value :: <BOOL>;
  c-name: "GlobalUnlock", c-modifiers: "__stdcall";
end;

define inline-only C-function GlobalFree
  parameter hMem       :: <HGLOBAL>;
  result value :: <HGLOBAL>;
  c-name: "GlobalFree", c-modifiers: "__stdcall";
end;

define inline-only C-function GlobalMemoryStatus
  parameter lpBuffer   :: <LPMEMORYSTATUS>;
  c-name: "GlobalMemoryStatus", c-modifiers: "__stdcall";
end;

define inline-only C-function LocalAlloc
  parameter uFlags     :: <UINT>;
  parameter uBytes     :: <UINT>;
  result value :: <HLOCAL>;
  c-name: "LocalAlloc", c-modifiers: "__stdcall";
end;

define inline-only C-function LocalReAlloc
  parameter hMem       :: <HLOCAL>;
  parameter uBytes     :: <UINT>;
  parameter uFlags     :: <UINT>;
  result value :: <HLOCAL>;
  c-name: "LocalReAlloc", c-modifiers: "__stdcall";
end;

define inline-only C-function LocalLock
  parameter hMem       :: <HLOCAL>;
  result value :: <LPVOID>;
  c-name: "LocalLock", c-modifiers: "__stdcall";
end;

define inline-only C-function LocalHandle
  parameter pMem       :: <LPCVOID>;
  result value :: <HLOCAL>;
  c-name: "LocalHandle", c-modifiers: "__stdcall";
end;

define inline-only C-function LocalUnlock
  parameter hMem       :: <HLOCAL>;
  result value :: <BOOL>;
  c-name: "LocalUnlock", c-modifiers: "__stdcall";
end;

define inline-only C-function LocalSize
  parameter hMem       :: <HLOCAL>;
  result value :: <UINT>;
  c-name: "LocalSize", c-modifiers: "__stdcall";
end;

define inline-only C-function LocalFlags
  parameter hMem       :: <HLOCAL>;
  result value :: <UINT>;
  c-name: "LocalFlags", c-modifiers: "__stdcall";
end;

define inline-only C-function LocalFree
  parameter hMem       :: <HLOCAL>;
  result value :: <HLOCAL>;
  c-name: "LocalFree", c-modifiers: "__stdcall";
end;

define inline-only C-function FlushInstructionCache
  parameter hProcess   :: <HANDLE>;
  parameter lpBaseAddress :: <LPCVOID>;
  parameter dwSize     :: <DWORD>;
  result value :: <BOOL>;
  c-name: "FlushInstructionCache", c-modifiers: "__stdcall";
end;

define inline-only C-function VirtualAlloc
  parameter lpAddress  :: <LPVOID>;
  parameter dwSize     :: <DWORD>;
  parameter flAllocationType :: <DWORD>;
  parameter flProtect  :: <DWORD>;
  result value :: <LPVOID>;
  c-name: "VirtualAlloc", c-modifiers: "__stdcall";
end;

define inline-only C-function VirtualFree
  parameter lpAddress  :: <LPVOID>;
  parameter dwSize     :: <DWORD>;
  parameter dwFreeType :: <DWORD>;
  result value :: <BOOL>;
  c-name: "VirtualFree", c-modifiers: "__stdcall";
end;

define inline-only C-function VirtualProtect
  parameter lpAddress  :: <LPVOID>;
  parameter dwSize     :: <DWORD>;
  parameter flNewProtect :: <DWORD>;
  output parameter lpflOldProtect :: <PDWORD>;
  result value :: <BOOL>;
  c-name: "VirtualProtect", c-modifiers: "__stdcall";
end;

define inline-only C-function VirtualProtectEx
  parameter hProcess   :: <HANDLE>;
  parameter lpAddress  :: <LPVOID>;
  parameter dwSize     :: <DWORD>;
  parameter flNewProtect :: <DWORD>;
  output parameter lpflOldProtect :: <PDWORD>;
  result value :: <BOOL>;
  c-name: "VirtualProtectEx", c-modifiers: "__stdcall";
end;

define inline-only C-function HeapCreate
  parameter flOptions  :: <DWORD>;
  parameter dwInitialSize :: <DWORD>;
  parameter dwMaximumSize :: <DWORD>;
  result value :: <HANDLE>;
  c-name: "HeapCreate", c-modifiers: "__stdcall";
end;

define inline-only C-function HeapDestroy
  parameter hHeap      :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "HeapDestroy", c-modifiers: "__stdcall";
end;

define inline-only C-function HeapAlloc
  parameter hHeap      :: <HANDLE>;
  parameter dwFlags    :: <DWORD>;
  parameter dwBytes    :: <DWORD>;
  result value :: <LPVOID>;
  c-name: "HeapAlloc", c-modifiers: "__stdcall";
end;

define inline-only C-function HeapReAlloc
  parameter hHeap      :: <HANDLE>;
  parameter dwFlags    :: <DWORD>;
  parameter lpMem      :: <LPVOID>;
  parameter dwBytes    :: <DWORD>;
  result value :: <LPVOID>;
  c-name: "HeapReAlloc", c-modifiers: "__stdcall";
end;

define inline-only C-function HeapFree
  parameter hHeap      :: <HANDLE>;
  parameter dwFlags    :: <DWORD>;
  parameter lpMem      :: <LPVOID>;
  result value :: <BOOL>;
  c-name: "HeapFree", c-modifiers: "__stdcall";
end;

define inline-only C-function HeapSize
  parameter hHeap      :: <HANDLE>;
  parameter dwFlags    :: <DWORD>;
  parameter lpMem      :: <LPCVOID>;
  result value :: <DWORD>;
  c-name: "HeapSize", c-modifiers: "__stdcall";
end;

define inline-only C-function GetProcessHeap
  result value :: <HANDLE>;
  c-name: "GetProcessHeap", c-modifiers: "__stdcall";
end;

define inline-only C-function GetProcessHeaps
  parameter NumberOfHeaps :: <DWORD>;
  parameter ProcessHeaps :: <PHANDLE>;
  result value :: <DWORD>;
  c-name: "GetProcessHeaps", c-modifiers: "__stdcall";
end;
define inline-only constant $SCS-32BIT-BINARY           =    0;
define inline-only constant $SCS-DOS-BINARY             =    1;
define inline-only constant $SCS-WOW-BINARY             =    2;
define inline-only constant $SCS-PIF-BINARY             =    3;
define inline-only constant $SCS-POSIX-BINARY           =    4;
define inline-only constant $SCS-OS216-BINARY           =    5;

define inline-only C-function GetBinaryType
  parameter lpApplicationName :: <LPCSTR>;
  output parameter lpBinaryType :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "GetBinaryTypeA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetShortPathName
  parameter lpszLongPath :: <LPCSTR>;
  parameter lpszShortPath :: <LPSTR>;
  parameter cchBuffer  :: <DWORD>;
  result value :: <DWORD>;
  c-name: "GetShortPathNameA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetProcessAffinityMask
  parameter hProcess   :: <HANDLE>;
  output parameter lpProcessAffinityMask :: <LPDWORD>;
  output parameter lpSystemAffinityMask :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "GetProcessAffinityMask", c-modifiers: "__stdcall";
end;

define inline-only C-function GetProcessTimes
  parameter hProcess   :: <HANDLE>;
  parameter lpCreationTime :: <LPFILETIME>;
  parameter lpExitTime :: <LPFILETIME>;
  parameter lpKernelTime :: <LPFILETIME>;
  parameter lpUserTime :: <LPFILETIME>;
  result value :: <BOOL>;
  c-name: "GetProcessTimes", c-modifiers: "__stdcall";
end;

define inline-only C-function GetProcessWorkingSetSize
  parameter hProcess   :: <HANDLE>;
  output parameter lpMinimumWorkingSetSize :: <LPDWORD>;
  output parameter lpMaximumWorkingSetSize :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "GetProcessWorkingSetSize", c-modifiers: "__stdcall";
end;

define inline-only C-function SetProcessWorkingSetSize
  parameter hProcess   :: <HANDLE>;
  parameter dwMinimumWorkingSetSize :: <DWORD>;
  parameter dwMaximumWorkingSetSize :: <DWORD>;
  result value :: <BOOL>;
  c-name: "SetProcessWorkingSetSize", c-modifiers: "__stdcall";
end;

define inline-only C-function OpenProcess
  parameter dwDesiredAccess :: <C-both-unsigned-long>;
  parameter bInheritHandle :: <BOOL>;
  parameter dwProcessId :: <DWORD>;
  result value :: <HANDLE>;
  c-name: "OpenProcess", c-modifiers: "__stdcall";
end;

define inline-only C-function GetCurrentProcess
  result value :: <HANDLE>;
  c-name: "GetCurrentProcess", c-modifiers: "__stdcall";
end;

define inline-only C-function GetCurrentProcessId
  result value :: <DWORD>;
  c-name: "GetCurrentProcessId", c-modifiers: "__stdcall";
end;

define inline-only C-function ExitProcess
  parameter uExitCode  :: <UINT>;
  c-name: "ExitProcess", c-modifiers: "__stdcall";
end;

define inline-only C-function TerminateProcess
  parameter hProcess   :: <HANDLE>;
  parameter uExitCode  :: <UINT>;
  result value :: <BOOL>;
  c-name: "TerminateProcess", c-modifiers: "__stdcall";
end;

define inline-only C-function GetExitCodeProcess
  parameter hProcess   :: <HANDLE>;
  output parameter lpExitCode :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "GetExitCodeProcess", c-modifiers: "__stdcall";
end;

define inline-only C-function FatalExit
  parameter ExitCode   :: <C-int>;
  c-name: "FatalExit", c-modifiers: "__stdcall";
end;

define inline-only C-function GetEnvironmentStrings
  result value :: <LPSTR>;
  c-name: "GetEnvironmentStrings", c-modifiers: "__stdcall";
end;

define inline-only C-function FreeEnvironmentStrings
  parameter lpstr1     :: <LPSTR>;
  result value :: <BOOL>;
  c-name: "FreeEnvironmentStringsA", c-modifiers: "__stdcall";
end;

define inline-only C-function RaiseException
  parameter dwExceptionCode :: <DWORD>;
  parameter dwExceptionFlags :: <DWORD>;
  parameter nNumberOfArguments :: <DWORD>;
  parameter lpArguments ::  /* const */ <LPDWORD>;
  c-name: "RaiseException", c-modifiers: "__stdcall";
end;
define constant <PTOP-LEVEL-EXCEPTION-FILTER> = <C-function-pointer>;
define inline constant <LPTOP-LEVEL-EXCEPTION-FILTER> = <PTOP-LEVEL-EXCEPTION-FILTER>;

define inline-only C-function SetUnhandledExceptionFilter
  parameter lpTopLevelExceptionFilter :: <LPTOP-LEVEL-EXCEPTION-FILTER>;
  result value :: <LPTOP-LEVEL-EXCEPTION-FILTER>;
  c-name: "SetUnhandledExceptionFilter", c-modifiers: "__stdcall";
end;

define inline-only C-function GetLastError
  result value :: <DWORD>;
  c-name: "GetLastError", c-modifiers: "__stdcall";
end;

define inline-only C-function SetLastError
  parameter dwErrCode  :: <DWORD>;
  c-name: "SetLastError", c-modifiers: "__stdcall";
end;

define inline-only C-function GetOverlappedResult
  parameter hFile      :: <HANDLE>;
  parameter lpOverlapped :: <LPOVERLAPPED>;
  output parameter lpNumberOfBytesTransferred :: <LPDWORD>;
  parameter bWait      :: <BOOL>;
  result value :: <BOOL>;
  c-name: "GetOverlappedResult", c-modifiers: "__stdcall";
end;

define inline-only C-function CreateIoCompletionPort
  parameter FileHandle :: <HANDLE>;
  parameter ExistingCompletionPort :: <HANDLE>;
  parameter CompletionKey :: <DWORD>;
  parameter NumberOfConcurrentThreads :: <DWORD>;
  result value :: <HANDLE>;
  c-name: "CreateIoCompletionPort", c-modifiers: "__stdcall";
end;

define inline-only C-function GetQueuedCompletionStatus
  parameter CompletionPort :: <HANDLE>;
  output parameter lpNumberOfBytesTransferred :: <LPDWORD>;
  output parameter lpCompletionKey :: <LPDWORD>;
  parameter lpOverlapped :: <LPLPOVERLAPPED>;
  parameter dwMilliseconds :: <DWORD>;
  result value :: <BOOL>;
  c-name: "GetQueuedCompletionStatus", c-modifiers: "__stdcall";
end;

define inline-only C-function PostQueuedCompletionStatus
  parameter CompletionPort :: <HANDLE>;
  parameter dwNumberOfBytesTransferred :: <DWORD>;
  parameter dwCompletionKey :: <DWORD>;
  parameter lpOverlapped :: <LPOVERLAPPED>;
  result value :: <BOOL>;
  c-name: "PostQueuedCompletionStatus", c-modifiers: "__stdcall";
end;
define inline-only constant $SEM-FAILCRITICALERRORS     = #x0001;
define inline-only constant $SEM-NOGPFAULTERRORBOX      = #x0002;
define inline-only constant $SEM-NOALIGNMENTFAULTEXCEPT = #x0004;
define inline-only constant $SEM-NOOPENFILEERRORBOX     = #x8000;

define inline-only C-function SetErrorMode
  parameter uMode      :: <UINT>;
  result value :: <UINT>;
  c-name: "SetErrorMode", c-modifiers: "__stdcall";
end;

define inline-only C-function ReadProcessMemory
  parameter hProcess   :: <HANDLE>;
  parameter lpBaseAddress :: <LPCVOID>;
  parameter lpBuffer   :: <LPVOID>;
  parameter nSize      :: <DWORD>;
  output parameter lpNumberOfBytesRead :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "ReadProcessMemory", c-modifiers: "__stdcall";
end;

define inline-only C-function WriteProcessMemory
  parameter hProcess   :: <HANDLE>;
  parameter lpBaseAddress :: <LPVOID>;
  parameter lpBuffer   :: <LPVOID>;
  parameter nSize      :: <DWORD>;
  output parameter lpNumberOfBytesWritten :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "WriteProcessMemory", c-modifiers: "__stdcall";
end;

define inline-only C-function DebugBreak
  c-name: "DebugBreak", c-modifiers: "__stdcall";
end;

define inline-only C-function SetEvent
  parameter hEvent     :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "SetEvent", c-modifiers: "__stdcall";
end;

define inline-only C-function ResetEvent
  parameter hEvent     :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "ResetEvent", c-modifiers: "__stdcall";
end;

define inline-only C-function PulseEvent
  parameter hEvent     :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "PulseEvent", c-modifiers: "__stdcall";
end;

define inline-only C-function ReleaseSemaphore
  parameter hSemaphore :: <HANDLE>;
  parameter lReleaseCount :: <LONG>;
  output parameter lpPreviousCount :: <LPLONG>;
  result value :: <BOOL>;
  c-name: "ReleaseSemaphore", c-modifiers: "__stdcall";
end;

define inline-only C-function ReleaseMutex
  parameter hMutex     :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "ReleaseMutex", c-modifiers: "__stdcall";
end;

define inline-only C-function WaitForSingleObject
  parameter hHandle    :: <HANDLE>;
  parameter dwMilliseconds :: <DWORD>;
  result value :: <DWORD>;
  c-name: "WaitForSingleObject", c-modifiers: "__stdcall";
end;

define inline-only C-function WaitForMultipleObjects
  parameter nCount     :: <DWORD>;
  parameter lpHandles  ::  /* const */ <LPHANDLE>;
  parameter bWaitAll   :: <BOOL>;
  parameter dwMilliseconds :: <DWORD>;
  result value :: <DWORD>;
  c-name: "WaitForMultipleObjects", c-modifiers: "__stdcall";
end;

define inline-only C-function Sleep
  parameter dwMilliseconds :: <DWORD>;
  c-name: "Sleep", c-modifiers: "__stdcall";
end;

define inline-only C-function LoadResource
  parameter hModule    :: <HMODULE>;
  parameter hResInfo   :: <HRSRC>;
  result value :: <HGLOBAL>;
  c-name: "LoadResource", c-modifiers: "__stdcall";
end;

define inline-only C-function SizeofResource
  parameter hModule    :: <HMODULE>;
  parameter hResInfo   :: <HRSRC>;
  result value :: <DWORD>;
  c-name: "SizeofResource", c-modifiers: "__stdcall";
end;

define inline-only C-function GlobalDeleteAtom
  parameter nAtom      :: <ATOM>;
  result value :: <ATOM>;
  c-name: "GlobalDeleteAtom", c-modifiers: "__stdcall";
end;

define inline-only C-function InitAtomTable
  parameter nSize      :: <DWORD>;
  result value :: <BOOL>;
  c-name: "InitAtomTable", c-modifiers: "__stdcall";
end;

define inline-only C-function DeleteAtom
  parameter nAtom      :: <ATOM>;
  result value :: <ATOM>;
  c-name: "DeleteAtom", c-modifiers: "__stdcall";
end;

define inline-only C-function SetHandleCount
  parameter uNumber    :: <UINT>;
  result value :: <UINT>;
  c-name: "SetHandleCount", c-modifiers: "__stdcall";
end;

define inline-only C-function GetLogicalDrives
  result value :: <DWORD>;
  c-name: "GetLogicalDrives", c-modifiers: "__stdcall";
end;

define inline-only C-function LockFile
  parameter hFile      :: <HANDLE>;
  parameter dwFileOffsetLow :: <DWORD>;
  parameter dwFileOffsetHigh :: <DWORD>;
  parameter nNumberOfBytesToLockLow :: <DWORD>;
  parameter nNumberOfBytesToLockHigh :: <DWORD>;
  result value :: <BOOL>;
  c-name: "LockFile", c-modifiers: "__stdcall";
end;

define inline-only C-function UnlockFile
  parameter hFile      :: <HANDLE>;
  parameter dwFileOffsetLow :: <DWORD>;
  parameter dwFileOffsetHigh :: <DWORD>;
  parameter nNumberOfBytesToUnlockLow :: <DWORD>;
  parameter nNumberOfBytesToUnlockHigh :: <DWORD>;
  result value :: <BOOL>;
  c-name: "UnlockFile", c-modifiers: "__stdcall";
end;

define inline-only C-function LockFileEx
  parameter hFile      :: <HANDLE>;
  parameter dwFlags    :: <DWORD>;
  parameter dwReserved :: <DWORD>;
  parameter nNumberOfBytesToLockLow :: <DWORD>;
  parameter nNumberOfBytesToLockHigh :: <DWORD>;
  parameter lpOverlapped :: <LPOVERLAPPED>;
  result value :: <BOOL>;
  c-name: "LockFileEx", c-modifiers: "__stdcall";
end;
define inline-only constant $LOCKFILE-FAIL-IMMEDIATELY  = #x00000001;
define inline-only constant $LOCKFILE-EXCLUSIVE-LOCK    = #x00000002;

define inline-only C-function UnlockFileEx
  parameter hFile      :: <HANDLE>;
  parameter dwReserved :: <DWORD>;
  parameter nNumberOfBytesToUnlockLow :: <DWORD>;
  parameter nNumberOfBytesToUnlockHigh :: <DWORD>;
  parameter lpOverlapped :: <LPOVERLAPPED>;
  result value :: <BOOL>;
  c-name: "UnlockFileEx", c-modifiers: "__stdcall";
end;

define C-struct <BY-HANDLE-FILE-INFORMATION>
  sealed inline-only slot dwFileAttributes-value :: <DWORD>;
  sealed inline-only slot ftCreationTime-value :: <FILETIME>;
  sealed inline-only slot ftLastAccessTime-value :: <FILETIME>;
  sealed inline-only slot ftLastWriteTime-value :: <FILETIME>;
  sealed inline-only slot dwVolumeSerialNumber-value :: <DWORD>;
  sealed inline-only slot nFileSizeHigh-value :: <DWORD>;
  sealed inline-only slot nFileSizeLow-value :: <DWORD>;
  sealed inline-only slot nNumberOfLinks-value :: <DWORD>;
  sealed inline-only slot nFileIndexHigh-value :: <DWORD>;
  sealed inline-only slot nFileIndexLow-value :: <DWORD>;
  pointer-type-name: <LPBY-HANDLE-FILE-INFORMATION>;
  c-name: "struct _BY_HANDLE_FILE_INFORMATION";
end C-struct <BY-HANDLE-FILE-INFORMATION>;
define inline constant <PBY-HANDLE-FILE-INFORMATION> = <LPBY-HANDLE-FILE-INFORMATION>;

define inline-only C-function GetFileInformationByHandle
  parameter hFile      :: <HANDLE>;
  parameter lpFileInformation :: <LPBY-HANDLE-FILE-INFORMATION>;
  result value :: <BOOL>;
  c-name: "GetFileInformationByHandle", c-modifiers: "__stdcall";
end;

define inline-only C-function GetFileType
  parameter hFile      :: <HANDLE>;
  result value :: <DWORD>;
  c-name: "GetFileType", c-modifiers: "__stdcall";
end;

define inline-only C-function GetFileSize
  parameter hFile      :: <HANDLE>;
  output parameter lpFileSizeHigh :: <LPDWORD>;
  result value :: <DWORD>;
  c-name: "GetFileSize", c-modifiers: "__stdcall";
end;

define inline-only C-function GetStdHandle
  parameter nStdHandle :: <DWORD>;
  result value :: <HANDLE>;
  c-name: "GetStdHandle", c-modifiers: "__stdcall";
end;

define inline-only C-function SetStdHandle
  parameter nStdHandle :: <DWORD>;
  parameter hHandle    :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "SetStdHandle", c-modifiers: "__stdcall";
end;

define inline-only C-function WriteFile
  parameter hFile      :: <HANDLE>;
  parameter lpBuffer   :: <LPCVOID>;
  parameter nNumberOfBytesToWrite :: <DWORD>;
  output parameter lpNumberOfBytesWritten :: <LPDWORD>;
  parameter lpOverlapped :: <LPOVERLAPPED>;
  result value :: <BOOL>;
  c-name: "WriteFile", c-modifiers: "__stdcall";
end;

define inline-only C-function ReadFile
  parameter hFile      :: <HANDLE>;
  parameter lpBuffer   :: <LPVOID>;
  parameter nNumberOfBytesToRead :: <DWORD>;
  output parameter lpNumberOfBytesRead :: <LPDWORD>;
  parameter lpOverlapped :: <LPOVERLAPPED>;
  result value :: <BOOL>;
  c-name: "ReadFile", c-modifiers: "__stdcall";
end;

define inline-only C-function FlushFileBuffers
  parameter hFile      :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "FlushFileBuffers", c-modifiers: "__stdcall";
end;

define inline-only C-function DeviceIoControl
  parameter hDevice    :: <HANDLE>;
  parameter dwIoControlCode :: <DWORD>;
  parameter lpInBuffer :: <LPVOID>;
  parameter nInBufferSize :: <DWORD>;
  parameter lpOutBuffer :: <LPVOID>;
  parameter nOutBufferSize :: <DWORD>;
  output parameter lpBytesReturned :: <LPDWORD>;
  parameter lpOverlapped :: <LPOVERLAPPED>;
  result value :: <BOOL>;
  c-name: "DeviceIoControl", c-modifiers: "__stdcall";
end;

define inline-only C-function SetEndOfFile
  parameter hFile      :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "SetEndOfFile", c-modifiers: "__stdcall";
end;

define inline-only C-function SetFilePointer
  parameter hFile      :: <HANDLE>;
  parameter lDistanceToMove :: <LONG>;
  parameter lpDistanceToMoveHigh :: <PLONG>;
  parameter dwMoveMethod :: <DWORD>;
  result value :: <DWORD>;
  c-name: "SetFilePointer", c-modifiers: "__stdcall";
end;

define inline-only C-function FindClose
  parameter hFindFile  :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "FindClose", c-modifiers: "__stdcall";
end;

define inline-only C-function GetFileTime
  parameter hFile      :: <HANDLE>;
  parameter lpCreationTime :: <LPFILETIME>;
  parameter lpLastAccessTime :: <LPFILETIME>;
  parameter lpLastWriteTime :: <LPFILETIME>;
  result value :: <BOOL>;
  c-name: "GetFileTime", c-modifiers: "__stdcall";
end;

define inline-only C-function SetFileTime
  parameter hFile      :: <HANDLE>;
  parameter lpCreationTime ::  /* const */ <LPFILETIME>;
  parameter lpLastAccessTime ::  /* const */ <LPFILETIME>;
  parameter lpLastWriteTime ::  /* const */ <LPFILETIME>;
  result value :: <BOOL>;
  c-name: "SetFileTime", c-modifiers: "__stdcall";
end;

define inline-only C-function CloseHandle
  parameter hObject    :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "CloseHandle", c-modifiers: "__stdcall";
end;

define inline-only C-function DuplicateHandle
  parameter hSourceProcessHandle :: <HANDLE>;
  parameter hSourceHandle :: <HANDLE>;
  parameter hTargetProcessHandle :: <HANDLE>;
  output parameter lpTargetHandle :: <LPHANDLE>;
  parameter dwDesiredAccess :: <C-both-unsigned-long>;
  parameter bInheritHandle :: <BOOL>;
  parameter dwOptions  :: <DWORD>;
  result value :: <BOOL>;
  c-name: "DuplicateHandle", c-modifiers: "__stdcall";
end;

define inline-only C-function GetHandleInformation
  parameter hObject    :: <HANDLE>;
  output parameter lpdwFlags :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "GetHandleInformation", c-modifiers: "__stdcall";
end;

define inline-only C-function SetHandleInformation
  parameter hObject    :: <HANDLE>;
  parameter dwMask     :: <DWORD>;
  parameter dwFlags    :: <DWORD>;
  result value :: <BOOL>;
  c-name: "SetHandleInformation", c-modifiers: "__stdcall";
end;
define inline-only constant $HANDLE-FLAG-INHERIT        = #x00000001;
define inline-only constant $HANDLE-FLAG-PROTECT-FROM-CLOSE =
	#x00000002;
define inline-only constant $HINSTANCE-ERROR            =   32;

define inline-only C-function LoadModule
  parameter lpModuleName :: <LPCSTR>;
  parameter lpParameterBlock :: <LPVOID>;
  result value :: <DWORD>;
  c-name: "LoadModule", c-modifiers: "__stdcall";
end;

define inline-only C-function WinExec
  parameter lpCmdLine  :: <LPCSTR>;
  parameter uCmdShow   :: <UINT>;
  result value :: <UINT>;
  c-name: "WinExec", c-modifiers: "__stdcall";
end;

define inline-only C-function ClearCommBreak
  parameter hFile      :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "ClearCommBreak", c-modifiers: "__stdcall";
end;

define inline-only C-function ClearCommError
  parameter hFile      :: <HANDLE>;
  output parameter lpErrors :: <LPDWORD>;
  parameter lpStat     :: <LPCOMSTAT>;
  result value :: <BOOL>;
  c-name: "ClearCommError", c-modifiers: "__stdcall";
end;

define inline-only C-function SetupComm
  parameter hFile      :: <HANDLE>;
  parameter dwInQueue  :: <DWORD>;
  parameter dwOutQueue :: <DWORD>;
  result value :: <BOOL>;
  c-name: "SetupComm", c-modifiers: "__stdcall";
end;

define inline-only C-function EscapeCommFunction
  parameter hFile      :: <HANDLE>;
  parameter dwFunc     :: <DWORD>;
  result value :: <BOOL>;
  c-name: "EscapeCommFunction", c-modifiers: "__stdcall";
end;

define inline-only C-function GetCommConfig
  parameter hCommDev   :: <HANDLE>;
  parameter lpCC       :: <LPCOMMCONFIG>;
  output parameter lpdwSize :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "GetCommConfig", c-modifiers: "__stdcall";
end;

define inline-only C-function GetCommMask
  parameter hFile      :: <HANDLE>;
  output parameter lpEvtMask :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "GetCommMask", c-modifiers: "__stdcall";
end;

define inline-only C-function GetCommProperties
  parameter hFile      :: <HANDLE>;
  parameter lpCommProp :: <LPCOMMPROP>;
  result value :: <BOOL>;
  c-name: "GetCommProperties", c-modifiers: "__stdcall";
end;

define inline-only C-function GetCommModemStatus
  parameter hFile      :: <HANDLE>;
  output parameter lpModemStat :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "GetCommModemStatus", c-modifiers: "__stdcall";
end;

define inline-only C-function GetCommState
  parameter hFile      :: <HANDLE>;
  parameter lpDCB      :: <LPDCB>;
  result value :: <BOOL>;
  c-name: "GetCommState", c-modifiers: "__stdcall";
end;

define inline-only C-function GetCommTimeouts
  parameter hFile      :: <HANDLE>;
  parameter lpCommTimeouts :: <LPCOMMTIMEOUTS>;
  result value :: <BOOL>;
  c-name: "GetCommTimeouts", c-modifiers: "__stdcall";
end;

define inline-only C-function PurgeComm
  parameter hFile      :: <HANDLE>;
  parameter dwFlags    :: <DWORD>;
  result value :: <BOOL>;
  c-name: "PurgeComm", c-modifiers: "__stdcall";
end;

define inline-only C-function SetCommBreak
  parameter hFile      :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "SetCommBreak", c-modifiers: "__stdcall";
end;

define inline-only C-function SetCommConfig
  parameter hCommDev   :: <HANDLE>;
  parameter lpCC       :: <LPCOMMCONFIG>;
  parameter dwSize     :: <DWORD>;
  result value :: <BOOL>;
  c-name: "SetCommConfig", c-modifiers: "__stdcall";
end;

define inline-only C-function SetCommMask
  parameter hFile      :: <HANDLE>;
  parameter dwEvtMask  :: <DWORD>;
  result value :: <BOOL>;
  c-name: "SetCommMask", c-modifiers: "__stdcall";
end;

define inline-only C-function SetCommState
  parameter hFile      :: <HANDLE>;
  parameter lpDCB      :: <LPDCB>;
  result value :: <BOOL>;
  c-name: "SetCommState", c-modifiers: "__stdcall";
end;

define inline-only C-function SetCommTimeouts
  parameter hFile      :: <HANDLE>;
  parameter lpCommTimeouts :: <LPCOMMTIMEOUTS>;
  result value :: <BOOL>;
  c-name: "SetCommTimeouts", c-modifiers: "__stdcall";
end;

define inline-only C-function TransmitCommChar
  parameter hFile      :: <HANDLE>;
  parameter cChar      :: <C-char>;
  result value :: <BOOL>;
  c-name: "TransmitCommChar", c-modifiers: "__stdcall";
end;

define inline-only C-function WaitCommEvent
  parameter hFile      :: <HANDLE>;
  output parameter lpEvtMask :: <LPDWORD>;
  parameter lpOverlapped :: <LPOVERLAPPED>;
  result value :: <BOOL>;
  c-name: "WaitCommEvent", c-modifiers: "__stdcall";
end;

define inline-only C-function Beep
  parameter dwFreq     :: <DWORD>;
  parameter dwDuration :: <DWORD>;
  result value :: <BOOL>;
  c-name: "Beep", c-modifiers: "__stdcall";
end;

define inline-only C-function MulDiv
  parameter Number     :: <C-both-int>;
  parameter Numerator  :: <C-both-int>;
  parameter Denominator :: <C-both-int>;
  result value :: <C-int>;
  c-name: "MulDiv", c-modifiers: "__stdcall";
end;

define inline-only C-function GetSystemTime
  parameter lpSystemTime :: <LPSYSTEMTIME>;
  c-name: "GetSystemTime", c-modifiers: "__stdcall";
end;

define inline-only C-function GetSystemTimeAsFileTime
  parameter lpSystemTimeAsFileTime :: <LPFILETIME>;
  c-name: "GetSystemTimeAsFileTime", c-modifiers: "__stdcall";
end;

define inline-only C-function SetSystemTime
  parameter lpSystemTime ::  /* const */ <LPSYSTEMTIME>;
  result value :: <BOOL>;
  c-name: "SetSystemTime", c-modifiers: "__stdcall";
end;

define inline-only C-function GetLocalTime
  parameter lpSystemTime :: <LPSYSTEMTIME>;
  c-name: "GetLocalTime", c-modifiers: "__stdcall";
end;

define inline-only C-function SetLocalTime
  parameter lpSystemTime ::  /* const */ <LPSYSTEMTIME>;
  result value :: <BOOL>;
  c-name: "SetLocalTime", c-modifiers: "__stdcall";
end;

define inline-only C-function GetSystemInfo
  parameter lpSystemInfo :: <LPSYSTEM-INFO>;
  c-name: "GetSystemInfo", c-modifiers: "__stdcall";
end;

define C-struct <TIME-ZONE-INFORMATION>
  sealed inline-only slot Bias-value     :: <LONG>;
  sealed inline-only array slot StandardName-array :: <WCHAR>,
	length: 32, address-getter: StandardName-value;
  sealed inline-only slot StandardDate-value :: <SYSTEMTIME>;
  sealed inline-only slot StandardBias-value :: <LONG>;
  sealed inline-only array slot DaylightName-array :: <WCHAR>,
	length: 32, address-getter: DaylightName-value;
  sealed inline-only slot DaylightDate-value :: <SYSTEMTIME>;
  sealed inline-only slot DaylightBias-value :: <LONG>;
  pointer-type-name: <LPTIME-ZONE-INFORMATION>;
  c-name: "struct _TIME_ZONE_INFORMATION";
end C-struct <TIME-ZONE-INFORMATION>;
define inline constant <PTIME-ZONE-INFORMATION> = <LPTIME-ZONE-INFORMATION>;

define inline-only C-function SystemTimeToTzSpecificLocalTime
  parameter lpTimeZoneInformation :: <LPTIME-ZONE-INFORMATION>;
  parameter lpUniversalTime :: <LPSYSTEMTIME>;
  parameter lpLocalTime :: <LPSYSTEMTIME>;
  result value :: <BOOL>;
  c-name: "SystemTimeToTzSpecificLocalTime", c-modifiers: "__stdcall";
end;

define inline-only C-function GetTimeZoneInformation
  parameter lpTimeZoneInformation :: <LPTIME-ZONE-INFORMATION>;
  result value :: <DWORD>;
  c-name: "GetTimeZoneInformation", c-modifiers: "__stdcall";
end;

define inline-only C-function SetTimeZoneInformation
  parameter lpTimeZoneInformation ::  /* const */ <LPTIME-ZONE-INFORMATION>;
  result value :: <BOOL>;
  c-name: "SetTimeZoneInformation", c-modifiers: "__stdcall";
end;

define inline-only C-function SystemTimeToFileTime
  parameter lpSystemTime ::  /* const */ <LPSYSTEMTIME>;
  parameter lpFileTime :: <LPFILETIME>;
  result value :: <BOOL>;
  c-name: "SystemTimeToFileTime", c-modifiers: "__stdcall";
end;

define inline-only C-function FileTimeToLocalFileTime
  parameter lpFileTime ::  /* const */ <LPFILETIME>;
  parameter lpLocalFileTime :: <LPFILETIME>;
  result value :: <BOOL>;
  c-name: "FileTimeToLocalFileTime", c-modifiers: "__stdcall";
end;

define inline-only C-function LocalFileTimeToFileTime
  parameter lpLocalFileTime ::  /* const */ <LPFILETIME>;
  parameter lpFileTime :: <LPFILETIME>;
  result value :: <BOOL>;
  c-name: "LocalFileTimeToFileTime", c-modifiers: "__stdcall";
end;

define inline-only C-function FileTimeToSystemTime
  parameter lpFileTime ::  /* const */ <LPFILETIME>;
  parameter lpSystemTime :: <LPSYSTEMTIME>;
  result value :: <BOOL>;
  c-name: "FileTimeToSystemTime", c-modifiers: "__stdcall";
end;

define inline-only C-function CompareFileTime
  parameter lpFileTime1 ::  /* const */ <LPFILETIME>;
  parameter lpFileTime2 ::  /* const */ <LPFILETIME>;
  result value :: <LONG>;
  c-name: "CompareFileTime", c-modifiers: "__stdcall";
end;

define inline-only C-function FileTimeToDosDateTime
  parameter lpFileTime ::  /* const */ <LPFILETIME>;
  output parameter lpFatDate :: <LPWORD>;
  output parameter lpFatTime :: <LPWORD>;
  result value :: <BOOL>;
  c-name: "FileTimeToDosDateTime", c-modifiers: "__stdcall";
end;

define inline-only C-function DosDateTimeToFileTime
  parameter wFatDate   :: <WORD>;
  parameter wFatTime   :: <WORD>;
  parameter lpFileTime :: <LPFILETIME>;
  result value :: <BOOL>;
  c-name: "DosDateTimeToFileTime", c-modifiers: "__stdcall";
end;

define inline-only C-function GetTickCount
  result value :: <DWORD>;
  c-name: "GetTickCount", c-modifiers: "__stdcall";
end;

define inline-only C-function SetSystemTimeAdjustment
  parameter dwTimeAdjustment :: <DWORD>;
  parameter bTimeAdjustmentDisabled :: <BOOL>;
  result value :: <BOOL>;
  c-name: "SetSystemTimeAdjustment", c-modifiers: "__stdcall";
end;

define inline-only C-function GetSystemTimeAdjustment
  output parameter lpTimeAdjustment :: <PDWORD>;
  output parameter lpTimeIncrement :: <PDWORD>;
  output parameter lpTimeAdjustmentDisabled :: <PBOOL>;
  result value :: <BOOL>;
  c-name: "GetSystemTimeAdjustment", c-modifiers: "__stdcall";
end;
define inline-only constant $FORMAT-MESSAGE-ALLOCATE-BUFFER =
	#x00000100;
define inline-only constant $FORMAT-MESSAGE-IGNORE-INSERTS =
	#x00000200;
define inline-only constant $FORMAT-MESSAGE-FROM-STRING = #x00000400;
define inline-only constant $FORMAT-MESSAGE-FROM-HMODULE =
	#x00000800;
define inline-only constant $FORMAT-MESSAGE-FROM-SYSTEM = #x00001000;
define inline-only constant $FORMAT-MESSAGE-ARGUMENT-ARRAY =
	#x00002000;
define inline-only constant $FORMAT-MESSAGE-MAX-WIDTH-MASK =
	#x000000FF;

define inline-only C-function CreatePipe
  output parameter hReadPipe :: <PHANDLE>;
  output parameter hWritePipe :: <PHANDLE>;
  parameter lpPipeAttributes :: <LPSECURITY-ATTRIBUTES>;
  parameter nSize      :: <DWORD>;
  result value :: <BOOL>;
  c-name: "CreatePipe", c-modifiers: "__stdcall";
end;

define inline-only C-function ConnectNamedPipe
  parameter hNamedPipe :: <HANDLE>;
  parameter lpOverlapped :: <LPOVERLAPPED>;
  result value :: <BOOL>;
  c-name: "ConnectNamedPipe", c-modifiers: "__stdcall";
end;

define inline-only C-function DisconnectNamedPipe
  parameter hNamedPipe :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "DisconnectNamedPipe", c-modifiers: "__stdcall";
end;

define C-function SetNamedPipeHandleState
  parameter hNamedPipe	:: <HANDLE>;
  parameter lpMode	:: <LPDWORD>;
  parameter lpMaxCollectionCount	:: <LPDWORD>;
  parameter lpCollectDataTimeout	:: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "SetNamedPipeHandleState", c-modifiers: "__stdcall";
end;

define inline-only C-function GetNamedPipeInfo
  parameter hNamedPipe :: <HANDLE>;
  output parameter lpFlags :: <LPDWORD>;
  output parameter lpOutBufferSize :: <LPDWORD>;
  output parameter lpInBufferSize :: <LPDWORD>;
  output parameter lpMaxInstances :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "GetNamedPipeInfo", c-modifiers: "__stdcall";
end;

define inline-only C-function PeekNamedPipe
  parameter hNamedPipe :: <HANDLE>;
  parameter lpBuffer   :: <LPVOID>;
  parameter nBufferSize :: <DWORD>;
  output parameter lpBytesRead :: <LPDWORD>;
  output parameter lpTotalBytesAvail :: <LPDWORD>;
  output parameter lpBytesLeftThisMessage :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "PeekNamedPipe", c-modifiers: "__stdcall";
end;

define inline-only C-function TransactNamedPipe
  parameter hNamedPipe :: <HANDLE>;
  parameter lpInBuffer :: <LPVOID>;
  parameter nInBufferSize :: <DWORD>;
  parameter lpOutBuffer :: <LPVOID>;
  parameter nOutBufferSize :: <DWORD>;
  output parameter lpBytesRead :: <LPDWORD>;
  parameter lpOverlapped :: <LPOVERLAPPED>;
  result value :: <BOOL>;
  c-name: "TransactNamedPipe", c-modifiers: "__stdcall";
end;

define inline-only C-function CreateMailslot
  parameter lpName     :: <LPCSTR>;
  parameter nMaxMessageSize :: <DWORD>;
  parameter lReadTimeout :: <DWORD>;
  parameter lpSecurityAttributes :: <LPSECURITY-ATTRIBUTES>;
  result value :: <HANDLE>;
  c-name: "CreateMailslotA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetMailslotInfo
  parameter hMailslot  :: <HANDLE>;
  output parameter lpMaxMessageSize :: <LPDWORD>;
  output parameter lpNextSize :: <LPDWORD>;
  output parameter lpMessageCount :: <LPDWORD>;
  output parameter lpReadTimeout :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "GetMailslotInfo", c-modifiers: "__stdcall";
end;

define inline-only C-function SetMailslotInfo
  parameter hMailslot  :: <HANDLE>;
  parameter lReadTimeout :: <DWORD>;
  result value :: <BOOL>;
  c-name: "SetMailslotInfo", c-modifiers: "__stdcall";
end;

define inline-only C-function MapViewOfFile
  parameter hFileMappingObject :: <HANDLE>;
  parameter dwDesiredAccess :: <C-both-unsigned-long>;
  parameter dwFileOffsetHigh :: <DWORD>;
  parameter dwFileOffsetLow :: <DWORD>;
  parameter dwNumberOfBytesToMap :: <DWORD>;
  result value :: <LPVOID>;
  c-name: "MapViewOfFile", c-modifiers: "__stdcall";
end;

define inline-only C-function FlushViewOfFile
  parameter lpBaseAddress :: <LPCVOID>;
  parameter dwNumberOfBytesToFlush :: <DWORD>;
  result value :: <BOOL>;
  c-name: "FlushViewOfFile", c-modifiers: "__stdcall";
end;

define inline-only C-function UnmapViewOfFile
  parameter lpBaseAddress :: <LPCVOID>;
  result value :: <BOOL>;
  c-name: "UnmapViewOfFile", c-modifiers: "__stdcall";
end;
define inline-only constant $EFS-USE-RECOVERY-KEYS      =  #x1;
define constant <PFE-EXPORT-FUNC> = <C-function-pointer>;
define constant <PFE-IMPORT-FUNC> = <C-function-pointer>;

define inline-only C-function lstrcmp
  parameter lpString1  :: <LPCSTR>;
  parameter lpString2  :: <LPCSTR>;
  result value :: <C-int>;
  c-name: "lstrcmpA", c-modifiers: "__stdcall";
end;

define inline-only C-function lstrcmpi
  parameter lpString1  :: <LPCSTR>;
  parameter lpString2  :: <LPCSTR>;
  result value :: <C-int>;
  c-name: "lstrcmpiA", c-modifiers: "__stdcall";
end;

define inline-only C-function lstrcpyn
  parameter lpString1  :: <LPSTR>;
  parameter lpString2  :: <LPCSTR>;
  parameter iMaxLength :: <C-int>;
  result value :: <LPSTR>;
  c-name: "lstrcpynA", c-modifiers: "__stdcall";
end;

define inline-only C-function lstrcpy
  parameter lpString1  :: <LPSTR>;
  parameter lpString2  :: <LPCSTR>;
  result value :: <LPSTR>;
  c-name: "lstrcpyA", c-modifiers: "__stdcall";
end;

define inline-only C-function lstrcat
  parameter lpString1  :: <LPSTR>;
  parameter lpString2  :: <LPCSTR>;
  result value :: <LPSTR>;
  c-name: "lstrcatA", c-modifiers: "__stdcall";
end;

define inline-only C-function lstrlen
  parameter lpString   :: <LPCSTR>;
  result value :: <C-int>;
  c-name: "lstrlenA", c-modifiers: "__stdcall";
end;

define inline-only C-function IsTextUnicode
  parameter lpBuffer   ::  /* const */ <LPVOID>;
  parameter cb         :: <C-int>;
  parameter lpi        :: <LPINT>;
  result value :: <BOOL>;
  c-name: "IsTextUnicode", c-modifiers: "__stdcall";
end;

define inline-only C-function TlsAlloc
  result value :: <DWORD>;
  c-name: "TlsAlloc", c-modifiers: "__stdcall";
end;
define inline-only constant $TLS-OUT-OF-INDEXES         = $FFFFFFFF;

define inline-only C-function TlsGetValue
  parameter dwTlsIndex :: <DWORD>;
  result value :: <LPVOID>;
  c-name: "TlsGetValue", c-modifiers: "__stdcall";
end;

define inline-only C-function TlsSetValue
  parameter dwTlsIndex :: <DWORD>;
  parameter lpTlsValue :: <LPVOID>;
  result value :: <BOOL>;
  c-name: "TlsSetValue", c-modifiers: "__stdcall";
end;

define inline-only C-function TlsFree
  parameter dwTlsIndex :: <DWORD>;
  result value :: <BOOL>;
  c-name: "TlsFree", c-modifiers: "__stdcall";
end;
define constant <LPOVERLAPPED-COMPLETION-ROUTINE> = <C-function-pointer>;

define inline-only C-function SleepEx
  parameter dwMilliseconds :: <DWORD>;
  parameter bAlertable :: <BOOL>;
  result value :: <DWORD>;
  c-name: "SleepEx", c-modifiers: "__stdcall";
end;

define inline-only C-function WaitForSingleObjectEx
  parameter hHandle    :: <HANDLE>;
  parameter dwMilliseconds :: <DWORD>;
  parameter bAlertable :: <BOOL>;
  result value :: <DWORD>;
  c-name: "WaitForSingleObjectEx", c-modifiers: "__stdcall";
end;

define inline-only C-function WaitForMultipleObjectsEx
  parameter nCount     :: <DWORD>;
  parameter lpHandles  ::  /* const */ <LPHANDLE>;
  parameter bWaitAll   :: <BOOL>;
  parameter dwMilliseconds :: <DWORD>;
  parameter bAlertable :: <BOOL>;
  result value :: <DWORD>;
  c-name: "WaitForMultipleObjectsEx", c-modifiers: "__stdcall";
end;

define inline-only C-function ReadFileEx
  parameter hFile      :: <HANDLE>;
  parameter lpBuffer   :: <LPVOID>;
  parameter nNumberOfBytesToRead :: <DWORD>;
  parameter lpOverlapped :: <LPOVERLAPPED>;
  parameter lpCompletionRoutine :: <LPOVERLAPPED-COMPLETION-ROUTINE>;
  result value :: <BOOL>;
  c-name: "ReadFileEx", c-modifiers: "__stdcall";
end;

define inline-only C-function WriteFileEx
  parameter hFile      :: <HANDLE>;
  parameter lpBuffer   :: <LPCVOID>;
  parameter nNumberOfBytesToWrite :: <DWORD>;
  parameter lpOverlapped :: <LPOVERLAPPED>;
  parameter lpCompletionRoutine :: <LPOVERLAPPED-COMPLETION-ROUTINE>;
  result value :: <BOOL>;
  c-name: "WriteFileEx", c-modifiers: "__stdcall";
end;
define inline-only constant $BACKUP-DATA                = #x00000001;
define inline-only constant $STARTF-USESHOWWINDOW       = #x00000001;
define inline-only constant $STARTF-USESIZE             = #x00000002;
define inline-only constant $STARTF-USEPOSITION         = #x00000004;
define inline-only constant $STARTF-USECOUNTCHARS       = #x00000008;
define inline-only constant $STARTF-USEFILLATTRIBUTE    = #x00000010;
define inline-only constant $STARTF-RUNFULLSCREEN       = #x00000020;
define inline-only constant $STARTF-FORCEONFEEDBACK     = #x00000040;
define inline-only constant $STARTF-FORCEOFFFEEDBACK    = #x00000080;
define inline-only constant $STARTF-USESTDHANDLES       = #x00000100;
define inline-only constant $STARTF-USEHOTKEY           = #x00000200;

define C-struct <STARTUPINFOA>
  sealed inline-only slot cb-value       :: <DWORD>;
  sealed inline-only slot lpReserved     :: <LPSTR>;
  sealed inline-only slot lpDesktop-value :: <LPSTR>;
  sealed inline-only slot lpTitle-value  :: <LPSTR>;
  sealed inline-only slot dwX-value      :: <DWORD>;
  sealed inline-only slot dwY-value      :: <DWORD>;
  sealed inline-only slot dwXSize-value  :: <DWORD>;
  sealed inline-only slot dwYSize-value  :: <DWORD>;
  sealed inline-only slot dwXCountChars-value :: <DWORD>;
  sealed inline-only slot dwYCountChars-value :: <DWORD>;
  sealed inline-only slot dwFillAttribute-value :: <DWORD>;
  sealed inline-only slot dwFlags-value  :: <DWORD>;
  sealed inline-only slot wShowWindow-value :: <WORD>;
  sealed inline-only slot cbReserved2    :: <WORD>;
  sealed inline-only slot lpReserved2    :: <LPBYTE>;
  sealed inline-only slot hStdInput-value :: <HANDLE>;
  sealed inline-only slot hStdOutput-value :: <HANDLE>;
  sealed inline-only slot hStdError-value :: <HANDLE>;
  pointer-type-name: <LPSTARTUPINFOA>;
  c-name: "struct _STARTUPINFOA";
end C-struct <STARTUPINFOA>;
define inline constant <STARTUPINFO> = <STARTUPINFOA>;
define inline constant <LPSTARTUPINFO> = <LPSTARTUPINFOA>;
define inline-only constant $SHUTDOWN-NORETRY           = #x00000001;

define C-struct <WIN32-FIND-DATAA>
  sealed inline-only slot dwFileAttributes-value :: <DWORD>;
  sealed inline-only slot ftCreationTime-value :: <FILETIME>;
  sealed inline-only slot ftLastAccessTime-value :: <FILETIME>;
  sealed inline-only slot ftLastWriteTime-value :: <FILETIME>;
  sealed inline-only slot nFileSizeHigh-value :: <DWORD>;
  sealed inline-only slot nFileSizeLow-value :: <DWORD>;
  sealed inline-only slot dwReserved0    :: <DWORD>;
  sealed inline-only slot dwReserved1    :: <DWORD>;
  sealed inline-only array slot cFileName-array :: <CHAR>,
	length: $MAX-PATH, address-getter: cFileName-value;
  sealed inline-only array slot cAlternateFileName-array :: <CHAR>,
	length: 14, address-getter: cAlternateFileName-value;
  pointer-type-name: <LPWIN32-FIND-DATAA>;
  c-name: "struct _WIN32_FIND_DATAA";
end C-struct <WIN32-FIND-DATAA>;
define inline constant <PWIN32-FIND-DATAA> = <LPWIN32-FIND-DATAA>;
define inline constant <WIN32-FIND-DATA> = <WIN32-FIND-DATAA>;
define inline constant <PWIN32-FIND-DATA> = <PWIN32-FIND-DATAA>;
define inline constant <LPWIN32-FIND-DATA> = <LPWIN32-FIND-DATAA>;

define C-struct <WIN32-FILE-ATTRIBUTE-DATA>
  sealed inline-only slot dwFileAttributes-value :: <DWORD>;
  sealed inline-only slot ftCreationTime-value :: <FILETIME>;
  sealed inline-only slot ftLastAccessTime-value :: <FILETIME>;
  sealed inline-only slot ftLastWriteTime-value :: <FILETIME>;
  sealed inline-only slot nFileSizeHigh-value :: <DWORD>;
  sealed inline-only slot nFileSizeLow-value :: <DWORD>;
  pointer-type-name: <LPWIN32-FILE-ATTRIBUTE-DATA>;
  c-name: "struct _WIN32_FILE_ATTRIBUTE_DATA";
end C-struct <WIN32-FILE-ATTRIBUTE-DATA>;

define inline-only C-function CreateMutex
  parameter lpMutexAttributes :: <LPSECURITY-ATTRIBUTES>;
  parameter bInitialOwner :: <BOOL>;
  parameter lpName     :: <LPCSTR>;
  result value :: <HANDLE>;
  c-name: "CreateMutexA", c-modifiers: "__stdcall";
end;

define inline-only C-function OpenMutex
  parameter dwDesiredAccess :: <C-both-unsigned-long>;
  parameter bInheritHandle :: <BOOL>;
  parameter lpName     :: <LPCSTR>;
  result value :: <HANDLE>;
  c-name: "OpenMutexA", c-modifiers: "__stdcall";
end;

define inline-only C-function CreateEvent
  parameter lpEventAttributes :: <LPSECURITY-ATTRIBUTES>;
  parameter bManualReset :: <BOOL>;
  parameter bInitialState :: <BOOL>;
  parameter lpName     :: <LPCSTR>;
  result value :: <HANDLE>;
  c-name: "CreateEventA", c-modifiers: "__stdcall";
end;

define inline-only C-function OpenEvent
  parameter dwDesiredAccess :: <C-both-unsigned-long>;
  parameter bInheritHandle :: <BOOL>;
  parameter lpName     :: <LPCSTR>;
  result value :: <HANDLE>;
  c-name: "OpenEventA", c-modifiers: "__stdcall";
end;

define inline-only C-function CreateSemaphore
  parameter lpSemaphoreAttributes :: <LPSECURITY-ATTRIBUTES>;
  parameter lInitialCount :: <LONG>;
  parameter lMaximumCount :: <LONG>;
  parameter lpName     :: <LPCSTR>;
  result value :: <HANDLE>;
  c-name: "CreateSemaphoreA", c-modifiers: "__stdcall";
end;

define inline-only C-function OpenSemaphore
  parameter dwDesiredAccess :: <C-both-unsigned-long>;
  parameter bInheritHandle :: <BOOL>;
  parameter lpName     :: <LPCSTR>;
  result value :: <HANDLE>;
  c-name: "OpenSemaphoreA", c-modifiers: "__stdcall";
end;

define inline-only C-function CreateFileMapping
  parameter hFile      :: <HANDLE>;
  parameter lpFileMappingAttributes :: <LPSECURITY-ATTRIBUTES>;
  parameter flProtect  :: <DWORD>;
  parameter dwMaximumSizeHigh :: <DWORD>;
  parameter dwMaximumSizeLow :: <DWORD>;
  parameter lpName     :: <LPCSTR>;
  result value :: <HANDLE>;
  c-name: "CreateFileMappingA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetLogicalDriveStrings
  parameter nBufferLength :: <DWORD>;
  parameter lpBuffer   :: <LPSTR>;
  result value :: <DWORD>;
  c-name: "GetLogicalDriveStringsA", c-modifiers: "__stdcall";
end;

define inline-only C-function LoadLibrary
  parameter lpLibFileName :: <LPCSTR>;
  result value :: <HMODULE>;
  c-name: "LoadLibraryA", c-modifiers: "__stdcall";
end;

define inline-only C-function LoadLibraryEx
  parameter lpLibFileName :: <LPCSTR>;
  parameter hFile      :: <HANDLE>;
  parameter dwFlags    :: <DWORD>;
  result value :: <HMODULE>;
  c-name: "LoadLibraryExA", c-modifiers: "__stdcall";
end;
define inline-only constant $DONT-RESOLVE-DLL-REFERENCES =
	#x00000001;
define inline-only constant $LOAD-LIBRARY-AS-DATAFILE   = #x00000002;
define inline-only constant $LOAD-WITH-ALTERED-SEARCH-PATH =
	#x00000008;

define inline-only C-function GetModuleFileName
  parameter hModule    :: <HMODULE>;
  parameter lpFilename :: <LPSTR>;
  parameter nSize      :: <DWORD>;
  result value :: <DWORD>;
  c-name: "GetModuleFileNameA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetModuleHandle
  parameter lpModuleName :: <LPCSTR>;
  result value :: <HMODULE>;
  c-name: "GetModuleHandleA", c-modifiers: "__stdcall";
end;

define inline-only C-function CreateProcess
  parameter lpApplicationName :: <LPCSTR>;
  parameter lpCommandLine :: <LPSTR>;
  parameter lpProcessAttributes :: <LPSECURITY-ATTRIBUTES>;
  parameter lpThreadAttributes :: <LPSECURITY-ATTRIBUTES>;
  parameter bInheritHandles :: <BOOL>;
  parameter dwCreationFlags :: <DWORD>;
  parameter lpEnvironment :: <LPVOID>;
  parameter lpCurrentDirectory :: <LPCSTR>;
  parameter lpStartupInfo :: <LPSTARTUPINFOA>;
  parameter lpProcessInformation :: <LPPROCESS-INFORMATION>;
  result value :: <BOOL>;
  c-name: "CreateProcessA", c-modifiers: "__stdcall";
end;

define inline-only C-function SetProcessShutdownParameters
  parameter dwLevel    :: <DWORD>;
  parameter dwFlags    :: <DWORD>;
  result value :: <BOOL>;
  c-name: "SetProcessShutdownParameters", c-modifiers: "__stdcall";
end;

define inline-only C-function GetProcessShutdownParameters
  output parameter lpdwLevel :: <LPDWORD>;
  output parameter lpdwFlags :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "GetProcessShutdownParameters", c-modifiers: "__stdcall";
end;

define inline-only C-function GetProcessVersion
  parameter ProcessId  :: <DWORD>;
  result value :: <DWORD>;
  c-name: "GetProcessVersion", c-modifiers: "__stdcall";
end;

define inline-only C-function FatalAppExit
  parameter uAction    :: <UINT>;
  parameter lpMessageText :: <LPCSTR>;
  c-name: "FatalAppExitA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetStartupInfo
  parameter lpStartupInfo :: <LPSTARTUPINFOA>;
  c-name: "GetStartupInfoA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetCommandLine
  result value :: <LPSTR>;
  c-name: "GetCommandLineA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetEnvironmentVariable
  parameter lpName     :: <LPCSTR>;
  parameter lpBuffer   :: <LPSTR>;
  parameter nSize      :: <DWORD>;
  result value :: <DWORD>;
  c-name: "GetEnvironmentVariableA", c-modifiers: "__stdcall";
end;

define inline-only C-function SetEnvironmentVariable
  parameter lpName     :: <LPCSTR>;
  parameter lpValue    :: <LPCSTR>;
  result value :: <BOOL>;
  c-name: "SetEnvironmentVariableA", c-modifiers: "__stdcall";
end;

define inline-only C-function ExpandEnvironmentStrings
  parameter lpSrc      :: <LPCSTR>;
  parameter lpDst      :: <LPSTR>;
  parameter nSize      :: <DWORD>;
  result value :: <DWORD>;
  c-name: "ExpandEnvironmentStringsA", c-modifiers: "__stdcall";
end;

define inline-only C-function OutputDebugString
  parameter lpOutputString :: <LPCSTR>;
  c-name: "OutputDebugStringA", c-modifiers: "__stdcall";
end;

define inline-only C-function FindResource
  parameter hModule    :: <HMODULE>;
  parameter lpName     :: <LPCSTR>;
  parameter lpType     :: <LPCSTR>;
  result value :: <HRSRC>;
  c-name: "FindResourceA", c-modifiers: "__stdcall";
end;

define inline-only C-function FindResourceEx
  parameter hModule    :: <HMODULE>;
  parameter lpType     :: <LPCSTR>;
  parameter lpName     :: <LPCSTR>;
  parameter wLanguage  :: <WORD>;
  result value :: <HRSRC>;
  c-name: "FindResourceExA", c-modifiers: "__stdcall";
end;

define C-subtype <ENUMRESTYPEPROC> ( <C-function-pointer> ) end;
define macro <ENUMRESTYPEPROC>-callback-wrapper
 { <ENUMRESTYPEPROC>-callback-wrapper(?new:name,?old:name) } =>
 { define C-callable-wrapper ?new of ?old
  parameter hModule    :: <HMODULE>;
  parameter lpType     :: <LPTSTR>;
  parameter lParam     :: <LONG>;
  result value :: <BOOL>;
  c-modifiers: "__stdcall";
 end C-callable-wrapper }
end;

define C-subtype <ENUMRESNAMEPROC> ( <C-function-pointer> ) end;
define macro <ENUMRESNAMEPROC>-callback-wrapper
 { <ENUMRESNAMEPROC>-callback-wrapper(?new:name,?old:name) } =>
 { define C-callable-wrapper ?new of ?old
  parameter hModule    :: <HMODULE>;
  parameter lpType     :: <LPCTSTR>;
  parameter lpName     :: <LPTSTR>;
  parameter lParam     :: <LONG>;
  result value :: <BOOL>;
  c-modifiers: "__stdcall";
 end C-callable-wrapper }
end;

define C-subtype <ENUMRESLANGPROC> ( <C-function-pointer> ) end;
define macro <ENUMRESLANGPROC>-callback-wrapper
 { <ENUMRESLANGPROC>-callback-wrapper(?new:name,?old:name) } =>
 { define C-callable-wrapper ?new of ?old
  parameter hModule    :: <HMODULE>;
  parameter lpType     :: <LPCTSTR>;
  parameter lpName     :: <LPCTSTR>;
  parameter wLanguage  :: <WORD>;
  parameter lParam     :: <LONG>;
  result value :: <BOOL>;
  c-modifiers: "__stdcall";
 end C-callable-wrapper }
end;

define inline-only C-function EnumResourceTypes
  parameter hModule    :: <HMODULE>;
  parameter lpEnumFunc :: <ENUMRESTYPEPROC>;
  parameter lParam     :: <LONG>;
  result value :: <BOOL>;
  c-name: "EnumResourceTypesA", c-modifiers: "__stdcall";
end;

define inline-only C-function EnumResourceNames
  parameter hModule    :: <HMODULE>;
  parameter lpType     :: <LPCSTR>;
  parameter lpEnumFunc :: <ENUMRESNAMEPROC>;
  parameter lParam     :: <LONG>;
  result value :: <BOOL>;
  c-name: "EnumResourceNamesA", c-modifiers: "__stdcall";
end;

define inline-only C-function EnumResourceLanguages
  parameter hModule    :: <HMODULE>;
  parameter lpType     :: <LPCSTR>;
  parameter lpName     :: <LPCSTR>;
  parameter lpEnumFunc :: <ENUMRESLANGPROC>;
  parameter lParam     :: <LONG>;
  result value :: <BOOL>;
  c-name: "EnumResourceLanguagesA", c-modifiers: "__stdcall";
end;

define inline-only C-function UpdateResource
  parameter hUpdate    :: <HANDLE>;
  parameter lpType     :: <LPCSTR>;
  parameter lpName     :: <LPCSTR>;
  parameter wLanguage  :: <WORD>;
  parameter lpData     :: <LPVOID>;
  parameter cbData     :: <DWORD>;
  result value :: <BOOL>;
  c-name: "UpdateResourceA", c-modifiers: "__stdcall";
end;

define inline-only C-function EndUpdateResource
  parameter hUpdate    :: <HANDLE>;
  parameter fDiscard   :: <BOOL>;
  result value :: <BOOL>;
  c-name: "EndUpdateResourceA", c-modifiers: "__stdcall";
end;

define inline-only C-function GlobalAddAtom
  parameter lpString   :: <LPCSTR>;
  result value :: <ATOM>;
  c-name: "GlobalAddAtomA", c-modifiers: "__stdcall";
end;

define inline-only C-function GlobalFindAtom
  parameter lpString   :: <LPCSTR>;
  result value :: <ATOM>;
  c-name: "GlobalFindAtomA", c-modifiers: "__stdcall";
end;

define inline-only C-function GlobalGetAtomName
  parameter nAtom      :: <ATOM>;
  parameter lpBuffer   :: <LPSTR>;
  parameter Size       :: <C-both-int>;
  result value :: <UINT>;
  c-name: "GlobalGetAtomNameA", c-modifiers: "__stdcall";
end;

define inline-only C-function AddAtom
  parameter lpString   :: <LPCSTR>;
  result value :: <ATOM>;
  c-name: "AddAtomA", c-modifiers: "__stdcall";
end;

define inline-only C-function FindAtom
  parameter lpString   :: <LPCSTR>;
  result value :: <ATOM>;
  c-name: "FindAtomA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetAtomName
  parameter nAtom      :: <ATOM>;
  parameter lpBuffer   :: <LPSTR>;
  parameter Size       :: <C-both-int>;
  result value :: <UINT>;
  c-name: "GetAtomNameA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetDriveType
  parameter lpRootPathName :: <LPCSTR>;
  result value :: <UINT>;
  c-name: "GetDriveTypeA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetSystemDirectory
  parameter lpBuffer   :: <LPSTR>;
  parameter uSize      :: <UINT>;
  result value :: <UINT>;
  c-name: "GetSystemDirectoryA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetTempPath
  parameter nBufferLength :: <DWORD>;
  parameter lpBuffer   :: <LPSTR>;
  result value :: <DWORD>;
  c-name: "GetTempPathA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetTempFileName
  parameter lpPathName :: <LPCSTR>;
  parameter lpPrefixString :: <LPCSTR>;
  parameter uUnique    :: <UINT>;
  parameter lpTempFileName :: <LPSTR>;
  result value :: <UINT>;
  c-name: "GetTempFileNameA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetWindowsDirectory
  parameter lpBuffer   :: <LPSTR>;
  parameter uSize      :: <UINT>;
  result value :: <UINT>;
  c-name: "GetWindowsDirectoryA", c-modifiers: "__stdcall";
end;

define inline-only C-function SetCurrentDirectory
  parameter lpPathName :: <LPCSTR>;
  result value :: <BOOL>;
  c-name: "SetCurrentDirectoryA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetCurrentDirectory
  parameter nBufferLength :: <DWORD>;
  parameter lpBuffer   :: <LPSTR>;
  result value :: <DWORD>;
  c-name: "GetCurrentDirectoryA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetDiskFreeSpace
  parameter lpRootPathName :: <LPCSTR>;
  output parameter lpSectorsPerCluster :: <LPDWORD>;
  output parameter lpBytesPerSector :: <LPDWORD>;
  output parameter lpNumberOfFreeClusters :: <LPDWORD>;
  output parameter lpTotalNumberOfClusters :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "GetDiskFreeSpaceA", c-modifiers: "__stdcall";
end;

define inline-only C-function CreateDirectory
  parameter lpPathName :: <LPCSTR>;
  parameter lpSecurityAttributes :: <LPSECURITY-ATTRIBUTES>;
  result value :: <BOOL>;
  c-name: "CreateDirectoryA", c-modifiers: "__stdcall";
end;

define inline-only C-function CreateDirectoryEx
  parameter lpTemplateDirectory :: <LPCSTR>;
  parameter lpNewDirectory :: <LPCSTR>;
  parameter lpSecurityAttributes :: <LPSECURITY-ATTRIBUTES>;
  result value :: <BOOL>;
  c-name: "CreateDirectoryExA", c-modifiers: "__stdcall";
end;

define inline-only C-function RemoveDirectory
  parameter lpPathName :: <LPCSTR>;
  result value :: <BOOL>;
  c-name: "RemoveDirectoryA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetFullPathName
  parameter lpFileName :: <LPCSTR>;
  parameter nBufferLength :: <DWORD>;
  parameter lpBuffer   :: <LPSTR>;
  parameter lpFilePart :: <LPLPSTR>;
  result value :: <DWORD>;
  c-name: "GetFullPathNameA", c-modifiers: "__stdcall";
end;
define inline-only constant $DDD-RAW-TARGET-PATH        = #x00000001;
define inline-only constant $DDD-REMOVE-DEFINITION      = #x00000002;
define inline-only constant $DDD-EXACT-MATCH-ON-REMOVE  = #x00000004;
define inline-only constant $DDD-NO-BROADCAST-SYSTEM    = #x00000008;

define inline-only C-function DefineDosDevice
  parameter dwFlags    :: <DWORD>;
  parameter lpDeviceName :: <LPCSTR>;
  parameter lpTargetPath :: <LPCSTR>;
  result value :: <BOOL>;
  c-name: "DefineDosDeviceA", c-modifiers: "__stdcall";
end;

define inline-only C-function QueryDosDevice
  parameter lpDeviceName :: <LPCSTR>;
  parameter lpTargetPath :: <LPSTR>;
  parameter ucchMax    :: <DWORD>;
  result value :: <DWORD>;
  c-name: "QueryDosDeviceA", c-modifiers: "__stdcall";
end;

define inline-only C-function CreateFile
  parameter lpFileName :: <LPCSTR>;
  parameter dwDesiredAccess :: <C-both-unsigned-long>;
  parameter dwShareMode :: <DWORD>;
  parameter lpSecurityAttributes :: <LPSECURITY-ATTRIBUTES>;
  parameter dwCreationDisposition :: <DWORD>;
  parameter dwFlagsAndAttributes :: <C-both-unsigned-long>;
  parameter hTemplateFile :: <HANDLE>;
  result value :: <HANDLE>;
  c-name: "CreateFileA", c-modifiers: "__stdcall";
end;

define inline-only C-function SetFileAttributes
  parameter lpFileName :: <LPCSTR>;
  parameter dwFileAttributes :: <DWORD>;
  result value :: <BOOL>;
  c-name: "SetFileAttributesA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetFileAttributes
  parameter lpFileName :: <LPCSTR>;
  result value :: <DWORD>;
  c-name: "GetFileAttributesA", c-modifiers: "__stdcall";
end;
// enum GET_FILEEX_INFO_LEVELS:
define inline-only constant $GetFileExInfoStandard = -1 + 1;
define inline-only constant $GetFileExMaxInfoLevel = $GetFileExInfoStandard + 1;


define inline-only C-function GetCompressedFileSize
  parameter lpFileName :: <LPCSTR>;
  output parameter lpFileSizeHigh :: <LPDWORD>;
  result value :: <DWORD>;
  c-name: "GetCompressedFileSizeA", c-modifiers: "__stdcall";
end;

define inline-only C-function DeleteFile
  parameter lpFileName :: <LPCSTR>;
  result value :: <BOOL>;
  c-name: "DeleteFileA", c-modifiers: "__stdcall";
end;

define inline-only C-function FindFirstFile
  parameter lpFileName :: <LPCSTR>;
  parameter lpFindFileData :: <LPWIN32-FIND-DATAA>;
  result value :: <HANDLE>;
  c-name: "FindFirstFileA", c-modifiers: "__stdcall";
end;

define inline-only C-function FindNextFile
  parameter hFindFile  :: <HANDLE>;
  parameter lpFindFileData :: <LPWIN32-FIND-DATAA>;
  result value :: <BOOL>;
  c-name: "FindNextFileA", c-modifiers: "__stdcall";
end;

define inline-only C-function SearchPath
  parameter lpPath     :: <LPCSTR>;
  parameter lpFileName :: <LPCSTR>;
  parameter lpExtension :: <LPCSTR>;
  parameter nBufferLength :: <DWORD>;
  parameter lpBuffer   :: <LPSTR>;
  parameter lpFilePart :: <LPLPSTR>;
  result value :: <DWORD>;
  c-name: "SearchPathA", c-modifiers: "__stdcall";
end;

define inline-only C-function CopyFile
  parameter lpExistingFileName :: <LPCSTR>;
  parameter lpNewFileName :: <LPCSTR>;
  parameter bFailIfExists :: <BOOL>;
  result value :: <BOOL>;
  c-name: "CopyFileA", c-modifiers: "__stdcall";
end;

define inline-only C-function MoveFile
  parameter lpExistingFileName :: <LPCSTR>;
  parameter lpNewFileName :: <LPCSTR>;
  result value :: <BOOL>;
  c-name: "MoveFileA", c-modifiers: "__stdcall";
end;

define inline-only C-function MoveFileEx
  parameter lpExistingFileName :: <LPCSTR>;
  parameter lpNewFileName :: <LPCSTR>;
  parameter dwFlags    :: <DWORD>;
  result value :: <BOOL>;
  c-name: "MoveFileExA", c-modifiers: "__stdcall";
end;
define inline-only constant $MOVEFILE-REPLACE-EXISTING  = #x00000001;
define inline-only constant $MOVEFILE-COPY-ALLOWED      = #x00000002;
define inline-only constant $MOVEFILE-DELAY-UNTIL-REBOOT =
	#x00000004;
define inline-only constant $MOVEFILE-WRITE-THROUGH     = #x00000008;

define inline-only C-function CreateNamedPipe
  parameter lpName     :: <LPCSTR>;
  parameter dwOpenMode :: <C-both-unsigned-long>;
  parameter dwPipeMode :: <DWORD>;
  parameter nMaxInstances :: <DWORD>;
  parameter nOutBufferSize :: <DWORD>;
  parameter nInBufferSize :: <DWORD>;
  parameter nDefaultTimeOut :: <DWORD>;
  parameter lpSecurityAttributes :: <LPSECURITY-ATTRIBUTES>;
  result value :: <HANDLE>;
  c-name: "CreateNamedPipeA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetNamedPipeHandleState
  parameter hNamedPipe :: <HANDLE>;
  output parameter lpState :: <LPDWORD>;
  output parameter lpCurInstances :: <LPDWORD>;
  output parameter lpMaxCollectionCount :: <LPDWORD>;
  output parameter lpCollectDataTimeout :: <LPDWORD>;
  parameter lpUserName :: <LPSTR>;
  parameter nMaxUserNameSize :: <DWORD>;
  result value :: <BOOL>;
  c-name: "GetNamedPipeHandleStateA", c-modifiers: "__stdcall";
end;

define inline-only C-function CallNamedPipe
  parameter lpNamedPipeName :: <LPCSTR>;
  parameter lpInBuffer :: <LPVOID>;
  parameter nInBufferSize :: <DWORD>;
  parameter lpOutBuffer :: <LPVOID>;
  parameter nOutBufferSize :: <DWORD>;
  output parameter lpBytesRead :: <LPDWORD>;
  parameter nTimeOut   :: <DWORD>;
  result value :: <BOOL>;
  c-name: "CallNamedPipeA", c-modifiers: "__stdcall";
end;

define inline-only C-function WaitNamedPipe
  parameter lpNamedPipeName :: <LPCSTR>;
  parameter nTimeOut   :: <DWORD>;
  result value :: <BOOL>;
  c-name: "WaitNamedPipeA", c-modifiers: "__stdcall";
end;

define inline-only C-function SetVolumeLabel
  parameter lpRootPathName :: <LPCSTR>;
  parameter lpVolumeName :: <LPCSTR>;
  result value :: <BOOL>;
  c-name: "SetVolumeLabelA", c-modifiers: "__stdcall";
end;

define inline-only C-function SetFileApisToOEM
  c-name: "SetFileApisToOEM", c-modifiers: "__stdcall";
end;

define inline-only C-function SetFileApisToANSI
  c-name: "SetFileApisToANSI", c-modifiers: "__stdcall";
end;

define inline-only C-function AreFileApisANSI
  result value :: <BOOL>;
  c-name: "AreFileApisANSI", c-modifiers: "__stdcall";
end;

define inline-only C-function GetVolumeInformation
  parameter lpRootPathName :: <LPCSTR>;
  parameter lpVolumeNameBuffer :: <LPSTR>;
  parameter nVolumeNameSize :: <DWORD>;
  output parameter lpVolumeSerialNumber :: <LPDWORD>;
  output parameter lpMaximumComponentLength :: <LPDWORD>;
  output parameter lpFileSystemFlags :: <LPDWORD>;
  parameter lpFileSystemNameBuffer :: <LPSTR>;
  parameter nFileSystemNameSize :: <DWORD>;
  result value :: <BOOL>;
  c-name: "GetVolumeInformationA", c-modifiers: "__stdcall";
end;

define inline-only C-function ClearEventLog
  parameter hEventLog  :: <HANDLE>;
  parameter lpBackupFileName :: <LPCSTR>;
  result value :: <BOOL>;
  c-name: "ClearEventLogA", c-modifiers: "__stdcall";
end;

define inline-only C-function BackupEventLog
  parameter hEventLog  :: <HANDLE>;
  parameter lpBackupFileName :: <LPCSTR>;
  result value :: <BOOL>;
  c-name: "BackupEventLogA", c-modifiers: "__stdcall";
end;

define inline-only C-function CloseEventLog
  parameter hEventLog  :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "CloseEventLog", c-modifiers: "__stdcall";
end;

define inline-only C-function DeregisterEventSource
  parameter hEventLog  :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "DeregisterEventSource", c-modifiers: "__stdcall";
end;

define inline-only C-function NotifyChangeEventLog
  parameter hEventLog  :: <HANDLE>;
  parameter hEvent     :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "NotifyChangeEventLog", c-modifiers: "__stdcall";
end;

define inline-only C-function GetNumberOfEventLogRecords
  parameter hEventLog  :: <HANDLE>;
  output parameter NumberOfRecords :: <PDWORD>;
  result value :: <BOOL>;
  c-name: "GetNumberOfEventLogRecords", c-modifiers: "__stdcall";
end;

define inline-only C-function GetOldestEventLogRecord
  parameter hEventLog  :: <HANDLE>;
  output parameter OldestRecord :: <PDWORD>;
  result value :: <BOOL>;
  c-name: "GetOldestEventLogRecord", c-modifiers: "__stdcall";
end;

define inline-only C-function OpenEventLog
  parameter lpUNCServerName :: <LPCSTR>;
  parameter lpSourceName :: <LPCSTR>;
  result value :: <HANDLE>;
  c-name: "OpenEventLogA", c-modifiers: "__stdcall";
end;

define inline-only C-function RegisterEventSource
  parameter lpUNCServerName :: <LPCSTR>;
  parameter lpSourceName :: <LPCSTR>;
  result value :: <HANDLE>;
  c-name: "RegisterEventSourceA", c-modifiers: "__stdcall";
end;

define inline-only C-function OpenBackupEventLog
  parameter lpUNCServerName :: <LPCSTR>;
  parameter lpFileName :: <LPCSTR>;
  result value :: <HANDLE>;
  c-name: "OpenBackupEventLogA", c-modifiers: "__stdcall";
end;

define inline-only C-function ReadEventLog
  parameter hEventLog  :: <HANDLE>;
  parameter dwReadFlags :: <DWORD>;
  parameter dwRecordOffset :: <DWORD>;
  parameter lpBuffer   :: <LPVOID>;
  parameter nNumberOfBytesToRead :: <DWORD>;
  output parameter pnBytesRead :: <LPDWORD>;
  output parameter pnMinNumberOfBytesNeeded :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "ReadEventLogA", c-modifiers: "__stdcall";
end;

define inline-only C-function FindFirstChangeNotification
  parameter lpPathName :: <LPCSTR>;
  parameter bWatchSubtree :: <BOOL>;
  parameter dwNotifyFilter :: <DWORD>;
  result value :: <HANDLE>;
  c-name: "FindFirstChangeNotificationA", c-modifiers: "__stdcall";
end;

define inline-only C-function FindNextChangeNotification
  parameter hChangeHandle :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "FindNextChangeNotification", c-modifiers: "__stdcall";
end;

define inline-only C-function FindCloseChangeNotification
  parameter hChangeHandle :: <HANDLE>;
  result value :: <BOOL>;
  c-name: "FindCloseChangeNotification", c-modifiers: "__stdcall";
end;

define inline-only C-function VirtualLock
  parameter lpAddress  :: <LPVOID>;
  parameter dwSize     :: <DWORD>;
  result value :: <BOOL>;
  c-name: "VirtualLock", c-modifiers: "__stdcall";
end;

define inline-only C-function VirtualUnlock
  parameter lpAddress  :: <LPVOID>;
  parameter dwSize     :: <DWORD>;
  result value :: <BOOL>;
  c-name: "VirtualUnlock", c-modifiers: "__stdcall";
end;

define inline-only C-function MapViewOfFileEx
  parameter hFileMappingObject :: <HANDLE>;
  parameter dwDesiredAccess :: <C-both-unsigned-long>;
  parameter dwFileOffsetHigh :: <DWORD>;
  parameter dwFileOffsetLow :: <DWORD>;
  parameter dwNumberOfBytesToMap :: <DWORD>;
  parameter lpBaseAddress :: <LPVOID>;
  result value :: <LPVOID>;
  c-name: "MapViewOfFileEx", c-modifiers: "__stdcall";
end;

define inline-only C-function SetPriorityClass
  parameter hProcess   :: <HANDLE>;
  parameter dwPriorityClass :: <DWORD>;
  result value :: <BOOL>;
  c-name: "SetPriorityClass", c-modifiers: "__stdcall";
end;

define inline-only C-function GetPriorityClass
  parameter hProcess   :: <HANDLE>;
  result value :: <DWORD>;
  c-name: "GetPriorityClass", c-modifiers: "__stdcall";
end;

define inline-only C-function IsBadReadPtr
  parameter lp         ::  /* const */ <C-void*>;
  parameter ucb        :: <UINT>;
  result value :: <BOOL>;
  c-name: "IsBadReadPtr", c-modifiers: "__stdcall";
end;

define inline-only C-function IsBadWritePtr
  parameter lp         :: <LPVOID>;
  parameter ucb        :: <UINT>;
  result value :: <BOOL>;
  c-name: "IsBadWritePtr", c-modifiers: "__stdcall";
end;

define inline-only C-function IsBadHugeReadPtr
  parameter lp         ::  /* const */ <C-void*>;
  parameter ucb        :: <UINT>;
  result value :: <BOOL>;
  c-name: "IsBadHugeReadPtr", c-modifiers: "__stdcall";
end;

define inline-only C-function IsBadHugeWritePtr
  parameter lp         :: <LPVOID>;
  parameter ucb        :: <UINT>;
  result value :: <BOOL>;
  c-name: "IsBadHugeWritePtr", c-modifiers: "__stdcall";
end;

define inline-only C-function IsBadCodePtr
  parameter lpfn       :: <FARPROC>;
  result value :: <BOOL>;
  c-name: "IsBadCodePtr", c-modifiers: "__stdcall";
end;

define inline-only C-function IsBadStringPtr
  parameter lpsz       :: <LPCSTR>;
  parameter ucchMax    :: <UINT>;
  result value :: <BOOL>;
  c-name: "IsBadStringPtrA", c-modifiers: "__stdcall";
end;

define inline-only C-function BuildCommDCB
  parameter lpDef      :: <LPCSTR>;
  parameter lpDCB      :: <LPDCB>;
  result value :: <BOOL>;
  c-name: "BuildCommDCBA", c-modifiers: "__stdcall";
end;

define inline-only C-function BuildCommDCBAndTimeouts
  parameter lpDef      :: <LPCSTR>;
  parameter lpDCB      :: <LPDCB>;
  parameter lpCommTimeouts :: <LPCOMMTIMEOUTS>;
  result value :: <BOOL>;
  c-name: "BuildCommDCBAndTimeoutsA", c-modifiers: "__stdcall";
end;

define inline-only C-function CommConfigDialog
  parameter lpszName   :: <LPCSTR>;
  parameter hWnd       :: <HWND>;
  parameter lpCC       :: <LPCOMMCONFIG>;
  result value :: <BOOL>;
  c-name: "CommConfigDialogA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetDefaultCommConfig
  parameter lpszName   :: <LPCSTR>;
  parameter lpCC       :: <LPCOMMCONFIG>;
  output parameter lpdwSize :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "GetDefaultCommConfigA", c-modifiers: "__stdcall";
end;

define inline-only C-function SetDefaultCommConfig
  parameter lpszName   :: <LPCSTR>;
  parameter lpCC       :: <LPCOMMCONFIG>;
  parameter dwSize     :: <DWORD>;
  result value :: <BOOL>;
  c-name: "SetDefaultCommConfigA", c-modifiers: "__stdcall";
end;
define inline-only constant $MAX-COMPUTERNAME-LENGTH    =   15;

define inline-only C-function GetComputerName
  parameter lpBuffer   :: <LPSTR>;
  parameter nSize      :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "GetComputerNameA", c-modifiers: "__stdcall";
end;

define inline-only C-function SetComputerName
  parameter lpComputerName :: <LPCSTR>;
  result value :: <BOOL>;
  c-name: "SetComputerNameA", c-modifiers: "__stdcall";
end;

define inline-only C-function GetUserName
  parameter lpBuffer   :: <LPSTR>;
  parameter nSize      :: <LPDWORD>;
  result value :: <BOOL>;
  c-name: "GetUserNameA", c-modifiers: "__stdcall";
end;
define inline-only constant $LOGON32-LOGON-INTERACTIVE  =    2;
define inline-only constant $LOGON32-LOGON-NETWORK      =    3;
define inline-only constant $LOGON32-LOGON-BATCH        =    4;
define inline-only constant $LOGON32-LOGON-SERVICE      =    5;
define inline-only constant $LOGON32-PROVIDER-DEFAULT   =    0;
define inline-only constant $LOGON32-PROVIDER-WINNT35   =    1;

define inline-only C-function QueryPerformanceCounter
  parameter lpPerformanceCount :: <LPLARGE-INTEGER>;
  result value :: <BOOL>;
  c-name: "QueryPerformanceCounter", c-modifiers: "__stdcall";
end;

define inline-only C-function QueryPerformanceFrequency
  parameter lpFrequency :: <LPLARGE-INTEGER>;
  result value :: <BOOL>;
  c-name: "QueryPerformanceFrequency", c-modifiers: "__stdcall";
end;

define C-struct <OSVERSIONINFOA>
  sealed inline-only slot dwOSVersionInfoSize-value :: <DWORD>;
  sealed inline-only slot dwMajorVersion-value :: <DWORD>;
  sealed inline-only slot dwMinorVersion-value :: <DWORD>;
  sealed inline-only slot dwBuildNumber-value :: <DWORD>;
  sealed inline-only slot dwPlatformId-value :: <DWORD>;
  sealed inline-only array slot szCSDVersion-array :: <CHAR>,
	length: 128, address-getter: szCSDVersion-value;
  pointer-type-name: <LPOSVERSIONINFOA>;
  c-name: "struct _OSVERSIONINFOA";
end C-struct <OSVERSIONINFOA>;
define inline constant <POSVERSIONINFOA> = <LPOSVERSIONINFOA>;
define inline constant <OSVERSIONINFO> = <OSVERSIONINFOA>;
define inline constant <POSVERSIONINFO> = <POSVERSIONINFOA>;
define inline constant <LPOSVERSIONINFO> = <LPOSVERSIONINFOA>;

define C-struct <OSVERSIONINFOEXA>
  sealed inline-only slot dwOSVersionInfoSize-value :: <DWORD>;
  sealed inline-only slot dwMajorVersion-value :: <DWORD>;
  sealed inline-only slot dwMinorVersion-value :: <DWORD>;
  sealed inline-only slot dwBuildNumber-value :: <DWORD>;
  sealed inline-only slot dwPlatformId-value :: <DWORD>;
  sealed inline-only array slot szCSDVersion-array :: <CHAR>,
	length: 128, address-getter: szCSDVersion-value;
  sealed inline-only slot wServicePackMajor-value :: <WORD>;
  sealed inline-only slot wServicePackMinor-value :: <WORD>;
  sealed inline-only array slot wReserved-array :: <WORD>, length: 2,
	address-getter: wReserved-value;
  pointer-type-name: <LPOSVERSIONINFOEXA>;
  c-name: "struct _OSVERSIONINFOEXA";
end C-struct <OSVERSIONINFOEXA>;
define inline constant <POSVERSIONINFOEXA> = <LPOSVERSIONINFOEXA>;
define inline constant <OSVERSIONINFOEX> = <OSVERSIONINFOEXA>;
define inline constant <POSVERSIONINFOEX> = <POSVERSIONINFOEXA>;
define inline constant <LPOSVERSIONINFOEX> = <LPOSVERSIONINFOEXA>;
define inline-only constant $VER-PLATFORM-WIN32s        =    0;
define inline-only constant $VER-PLATFORM-WIN32-WINDOWS =    1;
define inline-only constant $VER-PLATFORM-WIN32-NT      =    2;

define inline-only C-function GetVersionEx
  parameter lpVersionInformation :: <LPOSVERSIONINFOA>;
  result value :: <BOOL>;
  c-name: "GetVersionExA", c-modifiers: "__stdcall";
end;
define inline-only constant $TC-NORMAL                  =    0;
define inline-only constant $TC-HARDERR                 =    1;
define inline-only constant $TC-GP-TRAP                 =    2;
define inline-only constant $TC-SIGNAL                  =    3;

define inline-only constant $WAIT-TIMEOUT = $STATUS-TIMEOUT;
define inline-only constant $WAIT-IO-COMPLETION = $STATUS-USER-APC;
define inline-only constant $STILL-ACTIVE = $STATUS-PENDING;
define inline-only constant $EXCEPTION-ACCESS-VIOLATION =
	$STATUS-ACCESS-VIOLATION;
define inline-only constant $EXCEPTION-DATATYPE-MISALIGNMENT =
	$STATUS-DATATYPE-MISALIGNMENT;
define inline-only constant $EXCEPTION-BREAKPOINT =
	$STATUS-BREAKPOINT;
define inline-only constant $EXCEPTION-SINGLE-STEP =
	$STATUS-SINGLE-STEP;
define inline-only constant $EXCEPTION-ARRAY-BOUNDS-EXCEEDED =
	$STATUS-ARRAY-BOUNDS-EXCEEDED;
define inline-only constant $EXCEPTION-FLT-DENORMAL-OPERAND =
	$STATUS-FLOAT-DENORMAL-OPERAND;
define inline-only constant $EXCEPTION-FLT-DIVIDE-BY-ZERO =
	$STATUS-FLOAT-DIVIDE-BY-ZERO;
define inline-only constant $EXCEPTION-FLT-INEXACT-RESULT =
	$STATUS-FLOAT-INEXACT-RESULT;
define inline-only constant $EXCEPTION-FLT-INVALID-OPERATION =
	$STATUS-FLOAT-INVALID-OPERATION;
define inline-only constant $EXCEPTION-FLT-OVERFLOW =
	$STATUS-FLOAT-OVERFLOW;
define inline-only constant $EXCEPTION-FLT-STACK-CHECK =
	$STATUS-FLOAT-STACK-CHECK;
define inline-only constant $EXCEPTION-FLT-UNDERFLOW =
	$STATUS-FLOAT-UNDERFLOW;
define inline-only constant $EXCEPTION-INT-DIVIDE-BY-ZERO =
	$STATUS-INTEGER-DIVIDE-BY-ZERO;
define inline-only constant $EXCEPTION-INT-OVERFLOW =
	$STATUS-INTEGER-OVERFLOW;
define inline-only constant $EXCEPTION-PRIV-INSTRUCTION =
	$STATUS-PRIVILEGED-INSTRUCTION;
define inline-only constant $EXCEPTION-IN-PAGE-ERROR =
	$STATUS-IN-PAGE-ERROR;
define inline-only constant $EXCEPTION-ILLEGAL-INSTRUCTION =
	$STATUS-ILLEGAL-INSTRUCTION;
define inline-only constant $EXCEPTION-NONCONTINUABLE-EXCEPTION =
	$STATUS-NONCONTINUABLE-EXCEPTION;
define inline-only constant $EXCEPTION-STACK-OVERFLOW =
	$STATUS-STACK-OVERFLOW;
define inline-only constant $EXCEPTION-INVALID-DISPOSITION =
	$STATUS-INVALID-DISPOSITION;
define inline-only constant $EXCEPTION-GUARD-PAGE =
	$STATUS-GUARD-PAGE-VIOLATION;
define inline-only constant $EXCEPTION-INVALID-HANDLE =
	$STATUS-INVALID-HANDLE;
define inline-only constant $CONTROL-C-EXIT = $STATUS-CONTROL-C-EXIT;
define sealed domain make (singleton(<LPOVERLAPPED>));
define sealed domain initialize (<LPOVERLAPPED>);
define sealed domain make (singleton(<LPSECURITY-ATTRIBUTES>));
define sealed domain initialize (<LPSECURITY-ATTRIBUTES>);
define sealed domain make (singleton(<LPPROCESS-INFORMATION>));
define sealed domain initialize (<LPPROCESS-INFORMATION>);
define sealed domain make (singleton(<LPFILETIME>));
define sealed domain initialize (<LPFILETIME>);
define sealed domain make (singleton(<LPSYSTEMTIME>));
define sealed domain initialize (<LPSYSTEMTIME>);
define inline-only constant $MUTEX-MODIFY-STATE =
	$MUTANT-QUERY-STATE;
define inline-only constant $MUTEX-ALL-ACCESS = $MUTANT-ALL-ACCESS;
define sealed domain make (singleton(<LPCOMMPROP>));
define sealed domain initialize (<LPCOMMPROP>);
define sealed domain make (singleton(<LPCOMSTAT>));
define sealed domain initialize (<LPCOMSTAT>);
define sealed domain make (singleton(<LPDCB>));
define sealed domain initialize (<LPDCB>);
define sealed domain make (singleton(<LPCOMMTIMEOUTS>));
define sealed domain initialize (<LPCOMMTIMEOUTS>);
define sealed domain make (singleton(<LPCOMMCONFIG>));
define sealed domain initialize (<LPCOMMCONFIG>);
define sealed domain make (singleton(<LPSYSTEM-INFO>));
define sealed domain initialize (<LPSYSTEM-INFO>);
define inline-only constant $GMEM-LOWER  = $GMEM-NOT-BANKED;
define sealed domain make (singleton(<LPMEMORYSTATUS>));
define sealed domain initialize (<LPMEMORYSTATUS>);
define inline-only constant $FS-CASE-IS-PRESERVED =
	$FILE-CASE-PRESERVED-NAMES;
define inline-only constant $FS-CASE-SENSITIVE =
	$FILE-CASE-SENSITIVE-SEARCH;
define inline-only constant $FS-UNICODE-STORED-ON-DISK =
	$FILE-UNICODE-ON-DISK;
define inline-only constant $FS-PERSISTENT-ACLS =
	$FILE-PERSISTENT-ACLS;
define inline-only constant $FS-VOL-IS-COMPRESSED =
	$FILE-VOLUME-IS-COMPRESSED;
define inline-only constant $FS-FILE-COMPRESSION =
	$FILE-FILE-COMPRESSION;
define inline-only constant $FILE-MAP-COPY = $SECTION-QUERY;
define inline-only constant $FILE-MAP-WRITE = $SECTION-MAP-WRITE;
define inline-only constant $FILE-MAP-READ = $SECTION-MAP-READ;
define inline-only constant $FILE-MAP-ALL-ACCESS =
	$SECTION-ALL-ACCESS;
define sealed domain make (singleton(<LPOFSTRUCT>));
define sealed domain initialize (<LPOFSTRUCT>);
define sealed domain make (singleton(<LPBY-HANDLE-FILE-INFORMATION>));
define sealed domain initialize (<LPBY-HANDLE-FILE-INFORMATION>);
define sealed domain make (singleton(<LPTIME-ZONE-INFORMATION>));
define sealed domain initialize (<LPTIME-ZONE-INFORMATION>);
define sealed domain make (singleton(<LPSTARTUPINFOA>));
define sealed domain initialize (<LPSTARTUPINFOA>);
define sealed domain make (singleton(<LPWIN32-FIND-DATAA>));
define sealed domain initialize (<LPWIN32-FIND-DATAA>);
define sealed domain make (singleton(<LPWIN32-FILE-ATTRIBUTE-DATA>));
define sealed domain initialize (<LPWIN32-FILE-ATTRIBUTE-DATA>);
define sealed domain make (singleton(<LPOSVERSIONINFOA>));
define sealed domain initialize (<LPOSVERSIONINFOA>);
define sealed domain make (singleton(<LPOSVERSIONINFOEXA>));
define sealed domain initialize (<LPOSVERSIONINFOEXA>);
