Browse Source

+ New wince api units and some fixes to existing api units by Vasil Maximov.

git-svn-id: trunk@11904 -
yury 17 years ago
parent
commit
14b5b6b9f2

+ 7 - 0
.gitattributes

@@ -4606,12 +4606,18 @@ packages/winceunits/src/buildwinceunits.pp svneol=native#text/plain
 packages/winceunits/src/cesync.pp svneol=native#text/plain
 packages/winceunits/src/cesync.pp svneol=native#text/plain
 packages/winceunits/src/commctrl.pp svneol=native#text/plain
 packages/winceunits/src/commctrl.pp svneol=native#text/plain
 packages/winceunits/src/commdlg.pp svneol=native#text/plain
 packages/winceunits/src/commdlg.pp svneol=native#text/plain
+packages/winceunits/src/connmgr.pp svneol=native#text/plain
 packages/winceunits/src/cpl.pp svneol=native#text/plain
 packages/winceunits/src/cpl.pp svneol=native#text/plain
+packages/winceunits/src/devload.pp svneol=native#text/plain
+packages/winceunits/src/devmgmt.pp svneol=native#text/plain
 packages/winceunits/src/gpsapi.pp svneol=native#text/plain
 packages/winceunits/src/gpsapi.pp svneol=native#text/plain
 packages/winceunits/src/gx.pp svneol=native#text/plain
 packages/winceunits/src/gx.pp svneol=native#text/plain
 packages/winceunits/src/htmlctrl.pp svneol=native#text/plain
 packages/winceunits/src/htmlctrl.pp svneol=native#text/plain
 packages/winceunits/src/iphlpapi.pp svneol=native#text/plain
 packages/winceunits/src/iphlpapi.pp svneol=native#text/plain
 packages/winceunits/src/keybd.pp svneol=native#text/plain
 packages/winceunits/src/keybd.pp svneol=native#text/plain
+packages/winceunits/src/mmreg.pp svneol=native#text/plain
+packages/winceunits/src/mmsystem.pp svneol=native#text/plain
+packages/winceunits/src/msacm.pp svneol=native#text/plain
 packages/winceunits/src/msgqueue.pp svneol=native#text/plain
 packages/winceunits/src/msgqueue.pp svneol=native#text/plain
 packages/winceunits/src/nled.pp svneol=native#text/plain
 packages/winceunits/src/nled.pp svneol=native#text/plain
 packages/winceunits/src/notify.pp svneol=native#text/plain
 packages/winceunits/src/notify.pp svneol=native#text/plain
@@ -4631,6 +4637,7 @@ packages/winceunits/src/tapi.pp svneol=native#text/plain
 packages/winceunits/src/todaycmn.pp svneol=native#text/plain
 packages/winceunits/src/todaycmn.pp svneol=native#text/plain
 packages/winceunits/src/windbase.pp svneol=native#text/plain
 packages/winceunits/src/windbase.pp svneol=native#text/plain
 packages/winceunits/src/windbase_edb.inc svneol=native#text/plain
 packages/winceunits/src/windbase_edb.inc svneol=native#text/plain
+packages/winceunits/src/wininet.pp svneol=native#text/plain
 packages/winceunits/src/winioctl.pp svneol=native#text/plain
 packages/winceunits/src/winioctl.pp svneol=native#text/plain
 packages/winceunits/src/ws2bth.pp svneol=native#text/plain
 packages/winceunits/src/ws2bth.pp svneol=native#text/plain
 packages/winunits-base/Makefile svneol=native#text/plain
 packages/winunits-base/Makefile svneol=native#text/plain

+ 7 - 3
packages/winceunits/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/06/15]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/10/16]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
@@ -115,6 +115,10 @@ FPC:=$(shell $(FPCPROG) -PB)
 endif
 endif
 ifneq ($(findstring Error,$(FPC)),)
 ifneq ($(findstring Error,$(FPC)),)
 override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
 override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+else
+ifeq ($(strip $(wildcard $(FPC))),)
+FPC:=$(firstword $(FPCPROG))
+endif
 endif
 endif
 else
 else
 override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
 override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
@@ -271,10 +275,10 @@ ifeq ($(FULL_TARGET),arm-wince)
 override TARGET_UNITS+=comobj buildwinceunits
 override TARGET_UNITS+=comobj buildwinceunits
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth keybd nled phone activex ole2 comconst
+override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth keybd nled phone onnmgr devload devmgmt mmreg mmsystem msacm wininet activex ole2 comconst
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth keybd nled phone activex ole2 comconst
+override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth keybd nled phone onnmgr devload devmgmt mmreg mmsystem msacm wininet activex ole2 comconst
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_RSTS+=comconst
 override TARGET_RSTS+=comconst

+ 1 - 1
packages/winceunits/Makefile.fpc

@@ -11,7 +11,7 @@ units_wince=comobj buildwinceunits
 implicitunits_wince=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi \
 implicitunits_wince=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi \
                     gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl \
                     gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl \
                     sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth keybd nled \
                     sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth keybd nled \
-                    phone \
+                    phone onnmgr devload devmgmt mmreg mmsystem msacm wininet \
                     activex ole2 comconst
                     activex ole2 comconst
 
 
 units_win32=rapi cesync
 units_win32=rapi cesync

+ 0 - 1
packages/winceunits/src/aygshell.pp

@@ -43,7 +43,6 @@
             29    ComboEditAutoComplete
             29    ComboEditAutoComplete
             45    ComboSubProc
             45    ComboSubProc
            190    CreateImageCache
            190    CreateImageCache
-          2021    DMProcessConfigXML
            330    DPI_ExtractIconEx
            330    DPI_ExtractIconEx
            311    DPI_LoadImageFile
            311    DPI_LoadImageFile
            310    DPI_LoadLibraryRes
            310    DPI_LoadLibraryRes

+ 2 - 1
packages/winceunits/src/buildwinceunits.pp

@@ -24,7 +24,8 @@ uses
   aygshell,commctrl,commdlg,iphlpapi,notify,oleauto,power,shellapi,simmgr,tapi,
   aygshell,commctrl,commdlg,iphlpapi,notify,oleauto,power,shellapi,simmgr,tapi,
   gpsapi,todaycmn,windbase,cesync,gx,winioctl,msgqueue,pm,service,htmlctrl,
   gpsapi,todaycmn,windbase,cesync,gx,winioctl,msgqueue,pm,service,htmlctrl,
   sipapi, cpl, bt_api, bt_sdp, bthapi, bthutil, pimstore, ril, sms, ws2bth,
   sipapi, cpl, bt_api, bt_sdp, bthapi, bthutil, pimstore, ril, sms, ws2bth,
-  keybd, nled, phone;
+  keybd, nled, phone, connmgr, devload, devmgmt, mmreg, mmsystem, msacm,
+  wininet;
 
 
 implementation
 implementation
 
 

+ 713 - 0
packages/winceunits/src/connmgr.pp

@@ -0,0 +1,713 @@
+//
+// Module Name:
+//
+//     connmgr.h
+//
+// DESCRIPTION from MSDN:
+// The Connection Manager API is used to centralize and automate the establishment
+// and management of the network connections on a Windows Mobile-based device.
+// Mobile device applications use Connection Manager to establish or schedule a
+// network connection, and Connection Manager handles the details of the connection.
+// The application simply informs Connection Manager of the network type to use
+// for the connection (the Internet, for example).
+// When an application requests a network connection, Connection Manager first
+// retrieves all of the possible connections from a set of Connection Service
+// Providers (CSPs). Connection Manager then associates a set of costs with these
+// routes and ultimately determines the optimal connection based on cost, latency,
+// bandwidth, and other factors. Finally, Connection Manager queues the requested
+// connection and uses the CSPs to establish the connection at the appropriate
+// time.
+//
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit connmgr;
+
+{$CALLING cdecl}
+
+interface
+
+uses Windows, WinSock2;
+
+const
+      CellcoreDLL = 'cellcore.dll';
+
+// - connmgr_conntypes.h
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Connection types | Describes possible connection types and subtypes
+//
+// @comm none
+//
+// -----------------------------------------------------------------------------
+const
+      CM_CONNTYPE_UNKNOWN     = 0;
+      CM_CONNTYPE_CELLULAR    = 1;
+      CM_CONNTYPE_NIC         = 2;
+      CM_CONNTYPE_BLUETOOTH   = 3;
+      CM_CONNTYPE_UNIMODEM    = 4;
+      CM_CONNTYPE_VPN         = 5;
+      CM_CONNTYPE_PROXY       = 6;
+      CM_CONNTYPE_PC          = 7;
+      CM_CONNTYPE_MAX         = 8;
+
+      CM_CONNSUBTYPE_UNKNOWN  = 0;
+
+      CM_CONNSUBTYPE_CELLULAR_UNKNOWN = 0;
+      CM_CONNSUBTYPE_CELLULAR_CSD     = 1;
+      CM_CONNSUBTYPE_CELLULAR_GPRS    = 2;
+      CM_CONNSUBTYPE_CELLULAR_1XRTT   = 3;   // @constdefine Not distinct from CSD.
+      CM_CONNSUBTYPE_CELLULAR_1XEVDO  = 4;   // @constdefine Not distinct from CSD.
+      CM_CONNSUBTYPE_CELLULAR_1XEVDV  = 5;   // @constdefine Not distinct from CSD.
+      CM_CONNSUBTYPE_CELLULAR_EDGE    = 6;   // @constdefine Not distinct from GPRS.
+      CM_CONNSUBTYPE_CELLULAR_UMTS    = 7;   // @constdefine Not distinct from GPRS.
+      CM_CONNSUBTYPE_CELLULAR_VOICE   = 8;
+      CM_CONNSUBTYPE_CELLULAR_PTT     = 9;   // @constdefine Push-to-Talk, not supported.
+      CM_CONNSUBTYPE_CELLULAR_HSDPA   = 10;  // @constdefine High-Speed Downlink Packet Access (3.5G).
+      CM_CONNSUBTYPE_CELLULAR_MAX     = 11;
+
+      CM_CONNSUBTYPE_NIC_UNKNOWN  = 0;
+      CM_CONNSUBTYPE_NIC_ETHERNET = 1;
+      CM_CONNSUBTYPE_NIC_WIFI     = 2;
+      CM_CONNSUBTYPE_NIC_MAX      = 3;
+
+      CM_CONNSUBTYPE_BLUETOOTH_UNKNOWN    = 0;
+      CM_CONNSUBTYPE_BLUETOOTH_RAS        = 1;
+      CM_CONNSUBTYPE_BLUETOOTH_PAN        = 2;
+      CM_CONNSUBTYPE_BLUETOOTH_MAX        = 3;
+
+      CM_CONNSUBTYPE_UNIMODEM_UNKNOWN         = 0;
+      CM_CONNSUBTYPE_UNIMODEM_CSD             = 1;
+      CM_CONNSUBTYPE_UNIMODEM_OOB_CSD         = 2;
+//
+// Derived from unimodem device types
+//
+const
+      CM_CONNSUBTYPE_UNIMODEM_NULL_MODEM      = 3;   // Direct Cable Connect (DCC)
+      CM_CONNSUBTYPE_UNIMODEM_EXTERNAL_MODEM  = 4;   // Serial port attached modem
+      CM_CONNSUBTYPE_UNIMODEM_INTERNAL_MODEM  = 5;
+      CM_CONNSUBTYPE_UNIMODEM_PCMCIA_MODEM    = 6;
+      CM_CONNSUBTYPE_UNIMODEM_IRCOMM_MODEM    = 7;   // DCC over Irda
+      CM_CONNSUBTYPE_UNIMODEM_DYNAMIC_MODEM   = 8;   // Bluetooth modem
+      CM_CONNSUBTYPE_UNIMODEM_DYNAMIC_PORT    = 9;   // DCC over Bluetooth
+      CM_CONNSUBTYPE_UNIMODEM_MAX             = 10;
+
+
+      CM_CONNSUBTYPE_VPN_UNKNOWN  = 0;
+      CM_CONNSUBTYPE_VPN_L2TP     = 1;
+      CM_CONNSUBTYPE_VPN_PPTP     = 2;
+      CM_CONNSUBTYPE_VPN_MAX      = 3;
+
+      CM_CONNSUBTYPE_PROXY_UNKNOWN    = 0;
+      CM_CONNSUBTYPE_PROXY_NULL       = 1;
+      CM_CONNSUBTYPE_PROXY_HTTP       = 2;
+      CM_CONNSUBTYPE_PROXY_WAP        = 3;
+      CM_CONNSUBTYPE_PROXY_SOCKS4     = 4;
+      CM_CONNSUBTYPE_PROXY_SOCKS5     = 5;
+      CM_CONNSUBTYPE_PROXY_MAX        = 6;
+
+      CM_CONNSUBTYPE_PC_UNKNOWN            = 0;
+      CM_CONNSUBTYPE_PC_DESKTOPPASSTHROUGH = 1;
+      CM_CONNSUBTYPE_PC_IR                 = 2;
+      CM_CONNSUBTYPE_PC_MODEM_LINK         = 3;
+      CM_CONNSUBTYPE_PC_MAX                = 4;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Connection options | Describes possible connection options
+//
+// @comm none
+//
+// -----------------------------------------------------------------------------
+const
+      CM_DSF_BILLBYTIME       = $00000001;  // @constdefine Connection is billed by time.
+      CM_DSF_ALWAYSON         = $00000002;  // @constdefine Connection is always on.
+      CM_DSF_SUSPENDRESUME    = $00000004;  // @constdefine Connection is suspend/resume capable.
+
+// - end of connmgr_conntypes.h
+
+
+// - connmgr_status.h
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct CONNMGR_CONNECTION_IPADDR | Address information for an active connection
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     _CONNMGR_CONNECTION_IPADDR = record
+       cIPAddr:DWORD;                  // @field Count of addresses in array.
+       IPAddr:array[0..0] of SOCKADDR_STORAGE;     // @field Array of IPv4 and/or IPv6 addresses.
+     end;
+     CONNMGR_CONNECTION_IPADDR = _CONNMGR_CONNECTION_IPADDR;
+     LPCONNMGR_CONNECTION_IPADDR = ^_CONNMGR_CONNECTION_IPADDR;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct CONNMGR_CONNECTION_DETAILED_STATUS | Information about available connections
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      CONNMGRDETAILEDSTATUS_VERSION               = 1;
+
+      CONNMGRDETAILEDSTATUS_PARAM_TYPE            = $00000001;
+      CONNMGRDETAILEDSTATUS_PARAM_SUBTYPE         = $00000002;
+      CONNMGRDETAILEDSTATUS_PARAM_DESTNET         = $00000004;
+      CONNMGRDETAILEDSTATUS_PARAM_SOURCENET       = $00000008;
+      CONNMGRDETAILEDSTATUS_PARAM_FLAGS           = $00000010;
+      CONNMGRDETAILEDSTATUS_PARAM_SECURE          = $00000020;
+      CONNMGRDETAILEDSTATUS_PARAM_DESCRIPTION     = $00000040;
+      CONNMGRDETAILEDSTATUS_PARAM_ADAPTERNAME     = $00000080;
+      CONNMGRDETAILEDSTATUS_PARAM_CONNSTATUS      = $00000100;
+      CONNMGRDETAILEDSTATUS_PARAM_LASTCONNECT     = $00000200;
+      CONNMGRDETAILEDSTATUS_PARAM_SIGNALQUALITY   = $00000400;
+      CONNMGRDETAILEDSTATUS_PARAM_IPADDR          = $00000800;
+
+type
+     LPCONNMGR_CONNECTION_DETAILED_STATUS = ^_CONNMGR_CONNECTION_DETAILED_STATUS;
+     _CONNMGR_CONNECTION_DETAILED_STATUS = record
+       pNext:LPCONNMGR_CONNECTION_DETAILED_STATUS;
+
+       dwVer:DWORD;                // @field Structure version; current is CONNMGRDETAILEDSTATUS_VERSION.
+       dwParams:DWORD;             // @field Combination of CONNMGRDETAILEDSTATUS_PARAM_* values.
+
+       dwType:DWORD;               // @field One of CM_CONNTYPE_* values.
+       dwSubtype:DWORD;            // @field One of CM_CONNSUBTYPE_* values.
+
+       dwFlags:DWORD;              // @field Combination of CM_DSF_* flags.
+       dwSecure:DWORD;             // @field Secure level (0 == not-secure) of connection.
+
+       guidDestNet:GUID;           // @field GUID of destination network.
+       guidSourceNet:GUID;         // @field GUID of source network.
+
+       szDescription:PTCHAR;       // @field Name of connection, 0-terminated string or NULL if N/A.
+       szAdapterName:GUID;       // @field Name of adapter, 0-terminated or NULL if N/A.
+
+       dwConnectionStatus:DWORD;   // @field One of CONNMGR_STATUS_*.
+       LastConnectTime:SYSTEMTIME; // @field Time connection was last established.
+       dwSignalQuality:DWORD;      // @field Signal quality normalized in the range 0-255.
+
+       pIPAddr:LPCONNMGR_CONNECTION_IPADDR; // @field Available IP addrs, or NULL if N/A.
+     end;
+     CONNMGR_CONNECTION_DETAILED_STATUS = _CONNMGR_CONNECTION_DETAILED_STATUS;
+// End of version 1 fields.
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func ConnMgrQueryDetailedStatus | Returns detailed information about all existing connections.
+//
+// @comm Standard semantics here, call once to find out buffer size, then call
+// again to get array of CONNMGR_CONNECTION_DETAILED_STATUS structures.
+// Note: since connections can change often, make sure to allow for possibility
+// that between first and second call, the necessary amount of space needed for
+// the return structure changes.
+//
+// -----------------------------------------------------------------------------
+
+function ConnMgrQueryDetailedStatus(pStatusBuffer:LPCONNMGR_CONNECTION_DETAILED_STATUS; // @parm Pointer to buffer to be filled status info.
+                                    pcbBufferSize:LPDWORD                               // @parm IN: Size of buffer.  OUT: size of buffer needed.
+                                   ):HRESULT; external CellcoreDLL name 'ConnMgrQueryDetailedStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func ConnMgrRegisterForStatusNotification | Registers a window handle for connection status notifications.
+//
+// @comm Will post a notification when,
+// 1) an inactive connection is created or deleted, ex. via user input.
+// 2) any of of the active connections changes connection state, i.e.
+//    active to inactive, or inactive to active.
+// Note: Notifications will not be generated for other changes, ex. change in
+// signal quality.
+//
+// -----------------------------------------------------------------------------
+
+const
+      CONNMGR_STATUS_CHANGE_NOTIFICATION_MSG = 'CONNMGR_STATUS_CHANGE_NOTIFICATION_MSG';
+
+function ConnMgrRegisterForStatusChangeNotification(fEnable:BOOL;   // @parm Turn on or turn off notifications
+                                                    _hWnd:HWND      // @parm Window to post status change notifications to
+                                                   ):HRESULT; external CellcoreDLL name 'ConnMgrRegisterForStatusChangeNotification';
+
+// - end of connmgr_status.h
+
+
+// - connmgr_proxy.h
+
+// Proxy CSP config/settings
+const
+      IID_ConnPrv_IProxyExtension:TIID = '{AF96B0BD-A481-482C-A094-A8448767A0C0}';
+
+const
+      CMPROXY_PROXYSERVER_MAXSIZE   = 256;
+      CMPROXY_USERNAME_MAXSIZE      = 32;
+      CMPROXY_PASSWORD_MAXSIZE      = 32;
+      CMPROXY_EXTRAINFO_MAXSIZE     = 256;
+      CMPROXY_PROXYOVERRIDE_MAXSIZE = 64;
+
+type
+     _PROXY_CONFIG = record
+       dwType:DWORD;
+       dwEnable:DWORD;
+       szProxyServer:array[0..CMPROXY_PROXYSERVER_MAXSIZE-1] of TCHAR;
+       szUsername:array[0..CMPROXY_USERNAME_MAXSIZE-1] of TCHAR;
+       szPassword:array[0..CMPROXY_PASSWORD_MAXSIZE-1] of TCHAR;
+       szProxyOverride:array[0..CMPROXY_PROXYOVERRIDE_MAXSIZE-1] of TCHAR;
+       szExtraInfo:array[0..CMPROXY_EXTRAINFO_MAXSIZE-1] of TCHAR;
+     end;
+     PROXY_CONFIG = _PROXY_CONFIG;
+     LPPROXY_CONFIG = ^_PROXY_CONFIG;
+
+// - end of connmgr_proxy.h
+
+// - connmgr.h
+
+const
+      IID_DestNetInternet:TIID = '{436EF144-B4FB-4863-A041-8F905A62C572}';
+
+      IID_DestNetCorp:TIID = '{A1182988-0D73-439e-87AD-2A5B369F808B}';
+
+      IID_DestNetWAP = '{7022E968-5A97-4051-BC1C-C578E2FBA5D9}';
+
+      IID_DestNetSecureWAP:TIID = '{F28D1F74-72BE-4394-A4A7-4E296219390C}';
+
+//
+// Connection Manager
+//
+
+//
+// Client API
+//
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Valid Params | Defines valid parameters in CONNMGR_CONNECTIONINFO
+//
+// @comm The following flags in the dwParams field of the CONNMGR_CONNECTIONINFO structure
+// define which optional parameters are valid.
+//
+// -----------------------------------------------------------------------------
+const
+      CONNMGR_PARAM_GUIDDESTNET       = $01; // @constdefine guidDestNet field is valid
+      CONNMGR_PARAM_MAXCOST           = $02; // @constdefine MaxCost field is valid
+      CONNMGR_PARAM_MINRCVBW          = $04; // @constdefine MinRcvBw field is valid
+      CONNMGR_PARAM_MAXCONNLATENCY    = $08; // @constdefine MaxConnLatency field is valid
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Proxy flags | Defines which proxies the application supports
+//
+// @comm The following flags in the dwFlags field of the CONNMGR_CONNECTIONINFO structure
+// define special connection properties supported by client apps, typically which proxies are
+// supported by each app. For example, each CONNMGR_FLAG_PROXY_* specifies that this connection
+// can be specified by configuring an appropriate proxy server.  e.g. HTTP this is appropriate
+// for Internet Explorer and other HTTP based protocols, including HTTP-DAV synchronization.
+// If none of these flags are specified, then only a direct IP connection (or tunnel) will be attempted.
+//
+// -----------------------------------------------------------------------------
+const
+      CONNMGR_FLAG_PROXY_HTTP   = $01; // @constdefine HTTP Proxy supported
+      CONNMGR_FLAG_PROXY_WAP    = $02; // @constdefine WAP Proxy (gateway) supported
+      CONNMGR_FLAG_PROXY_SOCKS4 = $04; // @constdefine SOCKS4 Proxy supported
+      CONNMGR_FLAG_PROXY_SOCKS5 = $08; // @constdefine SOCKS5 Proxy supported
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Control flags | Defines connection properties
+//
+// @comm The following flags in the dwFlags field of the CONNMGR_CONNECTIONINFO structure
+// define special connection properties supported by client apps,
+//
+// -----------------------------------------------------------------------------
+const
+      CONNMGR_FLAG_SUSPEND_AWARE    = $10; // @constdefine suspended connections supported
+      CONNMGR_FLAG_REGISTERED_HOME  = $20; // @constdefine only dial out if we're registered on the home network
+      CONNMGR_FLAG_NO_ERROR_MSGS    = $40; // @constdefine don't show any error messages for failed connections
+      CONNMGR_FLAG_WAKE_ON_INCOMING = $80; // @constdefine to satisfy request use only those interfaces that can wake the system on incoming traffic
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Priority | Defines which priority of the applications connections
+//
+// @comm The following flags in the dwPriority field of the CONNMGR_CONNECTIONINFO structure
+// define the priority of the connection. Connection manager arbitrates among multiple connections,
+// satisfying as many as possible at a time but giving preference to higher priorities
+//
+// -----------------------------------------------------------------------------
+const
+      CONNMGR_PRIORITY_VOICE                = $00020000;
+// @constdefine Voice, highest priority, reserved for internal use only.
+
+      CONNMGR_PRIORITY_USERINTERACTIVE      = $00008000;
+// @constdefine User initiated action caused this request, and UI is
+// currently pending on the creation of this connection.
+// This is appropriate for an interactive browsing session,
+// or if the user selects "MORE" at the bottom of a truncated
+// mail message, etc.
+
+
+      CONNMGR_PRIORITY_USERBACKGROUND       = $00002000;
+// @constdefine User initiated connection which has recently become idle.
+// A connection should be marked as idle when it is no
+// longer the user's current task.
+
+      CONNMGR_PRIORITY_USERIDLE             = $00000800;
+// @constdefine Interactive user task which has been idle for an application
+// specified time.  The application should toggle the state
+// between CONNMGR_PRIORITY_USERIDLE and CONNMGR_PRIORITY_USERINTERACTIVE as the user
+// uses the application.  This helps ConnectionManager
+// optimize responsiveness to the interactive application,
+// while sharing the connection with background applications.
+
+      CONNMGR_PRIORITY_HIPRIBKGND         = $00000200;
+// @constdefine High priority background connection
+
+      CONNMGR_PRIORITY_IDLEBKGND          = $00000080;
+// @constdefine Idle priority background connection
+
+      CONNMGR_PRIORITY_EXTERNALINTERACTIVE = $00000020;
+// @constdefine Connection is requested on behalf of an external entity, but
+// is an interactive session (e.g. AT Command Iterpreter)
+
+      CONNMGR_PRIORITY_LOWBKGND            = $00000008;
+// @constdefine Lowest priority. Only connects if another higher priority client is already using the same path.
+
+      CONNMGR_PRIORITY_CACHED              = $00000002;
+// @constdefine Cached connection, reserved for internal use only.
+
+      CONNMGR_PRIORITY_ALWAYS_ON           = $00000001;
+// @constdefine Always on  connection, reserved for internal use only.
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct CONNMGR_CONNECTIONINFO | Information about connection request
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     _CONNMGR_CONNECTIONINFO = record
+       cbSize:DWORD;       // @field Size of this structure
+       dwParams:DWORD;     // @field Valid parms, set of CONNMGR_PARAM_*
+       dwFlags:DWORD;      // @field Connection flags, set of CONNMGR_FLAG_*
+       dwPriority:DWORD;   // @field Priority, one of CONNMGR_PRIORITY_*
+       bExclusive:BOOL;    // @field Connection is exclusive, see comments
+       bDisabled:BOOL;     // @field Don't actually connect
+       guidDestNet:GUID;   // @field GUID of network to connect to
+       _hWnd:HWND;          // @field hWnd to post status change messages to
+       uMsg:UINT;          // @field Msg to use when posting status changes
+       lParam:LPARAM;      // @field lParam to use when posting status changes
+       ulMaxCost:ULONG;    // @field Max acceptable cost of connection
+       ulMinRcvBw:ULONG;   // @field Min acceptable receive bandwidth of connection
+       ulMaxConnLatency:ULONG; // @field Max acceptable connect latency
+     end;
+     CONNMGR_CONNECTIONINFO = _CONNMGR_CONNECTIONINFO;
+     LPCONNMGR_CONNECTIONINFO = ^_CONNMGR_CONNECTIONINFO;
+
+// @comm bExclusive: If false, the connection is shared among all applications, and other
+// applications with an interest in a connection to this network will be notified that
+// the connection is available.  If true, then this connection can not be shared with other
+// applications, and no other applications will be notified, and any application requesting
+// a connection to the same network will be treated as a contender for
+// the same resource, and not permitted to share the existing connection.  A decision will be made
+// between this connection and the others based on connection priority.
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Creates a connection request.
+//
+// @comm Return Value:  S_OK if success, error code otherwise
+//
+// -----------------------------------------------------------------------------
+function ConnMgrEstablishConnection(pConnInfo:LPCONNMGR_CONNECTIONINFO;  // @parm Params describing requested connection
+                                    phConnection:LPHANDLE                // @parm Returned connection handle
+                                   ):HRESULT; external CellcoreDLL name 'ConnMgrEstablishConnection';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Creates a connection request.
+//
+// @comm Return Value:  Same as ConnMgrEstablishConnection, but doesn't return
+// until connection has either been established or failed.
+//
+// -----------------------------------------------------------------------------
+function ConnMgrEstablishConnectionSync(pConnInfo:LPCONNMGR_CONNECTIONINFO;  // @parm Params describing requested connection
+                                        phConnection:LPHANDLE;               // @parm Returned connection handle
+                                        dwTimeout:DWORD;                    // @parm Timeout
+                                        pdwStatus:LPDWORD                    // @parm Final status value, one of CONNMGR_STATUS_*
+                                       ):HRESULT; external CellcoreDLL name 'ConnMgrEstablishConnectionSync';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Status values | Describes the current status of the connection
+//
+// @comm none
+//
+// -----------------------------------------------------------------------------
+const
+      CONNMGR_STATUS_UNKNOWN                    = $00;  // @constdefine Unknown status
+
+      CONNMGR_STATUS_CONNECTED                  = $10;  // @constdefine Connection is up
+      CONNMGR_STATUS_SUSPENDED                  = $11;  // @constdefine Connection is up but suspended
+
+      CONNMGR_STATUS_DISCONNECTED               = $20;  // @constdefine Connection is disconnected
+      CONNMGR_STATUS_CONNECTIONFAILED           = $21;  // @constdefine Connection failed and cannot not be reestablished
+      CONNMGR_STATUS_CONNECTIONCANCELED         = $22;  // @constdefine User aborted connection
+      CONNMGR_STATUS_CONNECTIONDISABLED         = $23;  // @constdefine Connection is ready to connect but disabled
+      CONNMGR_STATUS_NOPATHTODESTINATION        = $24;  // @constdefine No path could be found to destination
+      CONNMGR_STATUS_WAITINGFORPATH             = $25;  // @constdefine Waiting for a path to the destination
+      CONNMGR_STATUS_WAITINGFORPHONE            = $26;  // @constdefine Voice call is in progress
+      CONNMGR_STATUS_PHONEOFF                   = $27;  // @constdefine Phone resource needed and phone is off
+      CONNMGR_STATUS_EXCLUSIVECONFLICT          = $28;  // @constdefine the connection could not be established because it would multi-home an exclusive connection
+      CONNMGR_STATUS_NORESOURCES                = $29;  // @constdefine Failed to allocate resources to make the connection.
+      CONNMGR_STATUS_CONNECTIONLINKFAILED       = $2A;  // @constdefine Connection link disconnected prematurely.
+      CONNMGR_STATUS_AUTHENTICATIONFAILED       = $2B;  // @constdefine Failed to authenticate user.
+      CONNMGR_STATUS_NOPATHWITHPROPERTY         = $2C;  // @constdefine Path with connection having requested property, ex. WAKE_ON_INCOMING, is not available.
+
+      CONNMGR_STATUS_WAITINGCONNECTION          = $40;  // @constdefine Attempting to connect
+      CONNMGR_STATUS_WAITINGFORRESOURCE         = $41;  // @constdefine Resource is in use by another connection
+      CONNMGR_STATUS_WAITINGFORNETWORK          = $42;  // @constdefine Network is used by higher priority thread or device is roaming.
+
+      CONNMGR_STATUS_WAITINGDISCONNECTION       = $80;  // @constdefine Connection is being brought down
+      CONNMGR_STATUS_WAITINGCONNECTIONABORT     = $81;  // @constdefine Aborting connection attempt
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Returns status about the current connection.
+//
+// @comm none
+//
+// -----------------------------------------------------------------------------
+function ConnMgrConnectionStatus(hConnection:HANDLE;    // @parm Handle to connection, returned from ConnMgrEstablishConnection
+                                 pdwStatus:LPDWORD       // @parm Returns current connection status, one of CONNMGR_STATUS_*
+                                ):HRESULT; external CellcoreDLL name 'ConnMgrConnectionStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Deletes specified connection request, potentially dropping the physical connection.
+//
+// @comm none
+//
+// -----------------------------------------------------------------------------
+function ConnMgrReleaseConnection(hConnection:HANDLE;    // @parm Handle to connection, returned from ConnMgrEstablishConnection
+                                  bCache:BOOL            // @parm ConnMgr can cache connection
+                                 ):HRESULT; external CellcoreDLL name 'ConnMgrReleaseConnection';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Changes a connection's priority.
+//
+// @comm none
+//
+// -----------------------------------------------------------------------------
+function ConnMgrSetConnectionPriority(hConnection:HANDLE;    // @parm Handle to connection, returned from ConnMgrEstablishConnection
+                                      dwPriority:DWORD       // @parm New priority
+                                     ):HRESULT; external CellcoreDLL name 'ConnMgrSetConnectionPriority';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func General purpose (backdoor) API for exchanging information with planner or providers.
+//
+// @comm none
+//
+// -----------------------------------------------------------------------------
+function ConnMgrProviderMessage(hConnection:HANDLE;         // @parm Optional, Handle to connection
+                                pguidProvider:LPGUID;  // @parm Provider GUID
+                                pdwIndex:LPDWORD;            // @parm Optional index, used to address multiple providers associated with connection
+                                dwMsg1:DWORD;               // @parm General param 1
+                                dwMsg2:DWORD;               // @parm General param 2
+                                pParams:PBYTE;              // @param Pointer to params structure
+                                cbParamSize:ULONG           // @param size of params structure
+                               ):HRESULT; external CellcoreDLL name 'ConnMgrProviderMessage';
+
+const
+      CONNMGR_MAX_DESC = 128;    // @constdefine Max size of a network description
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct CONNMGR_DESTINATION_INFO | Information about a specific network
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     _CONNMGR_DESTINATION_INFO = record
+       _guid:GUID;  // @field GUID associated with network
+       szDescription:array[0..CONNMGR_MAX_DESC-1] of TCHAR;  // @field Description of network
+       fSecure:BOOL; // @field Is it OK to allow multi-homing on the network
+     end;
+     CONNMGR_DESTINATION_INFO = _CONNMGR_DESTINATION_INFO;
+     LPCONNMGR_DESTINATION_INFO = ^_CONNMGR_DESTINATION_INFO;
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Enumerates available networks.
+//
+// @comm none
+//
+// -----------------------------------------------------------------------------
+function ConnMgrEnumDestinations(nIndex:longint;                            // @param Index of network
+                                 pDestInfo:LPCONNMGR_DESTINATION_INFO    // @param ptr to structure to fill in with info about network
+                                ):HRESULT; external CellcoreDLL name 'ConnMgrEnumDestinations';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct SCHEDULEDCONNECTIONINFO | Information about a scheduled connection
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     _SCHEDULEDCONNECTIONINFO = record
+       guidDest:GUID;                  // @field Guid of network
+       uiStartTime:UINT64;             // @field Starting time, same ref as filetime
+       uiEndTime:UINT64;               // @field Ending time, same ref as filetime
+       uiPeriod:UINT64;                // @field Period between schedule attempts
+       szAppName:array[0..MAX_PATH-1] of TCHAR;    // @field App name to execute when scheduled
+       szCmdLine:array[0..MAX_PATH-1] of TCHAR;    // @field Cmd line to execute when scheduled
+       szToken:array[0..31] of TCHAR;            // @field Unique token identifying this scheduled connection
+       bPiggyback:BOOL;                // @field If true, execute app whenever network is available
+     end;
+     SCHEDULEDCONNECTIONINFO = _SCHEDULEDCONNECTIONINFO;
+     LPSCHEDULEDCONNECTIONINFO = ^_SCHEDULEDCONNECTIONINFO;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Registers a scheduled connection
+//
+// @comm none
+//
+// -----------------------------------------------------------------------------
+function ConnMgrRegisterScheduledConnection(pSCI:SCHEDULEDCONNECTIONINFO  // @param Ptr to struct describing scheduled connection
+                                           ):HRESULT; external CellcoreDLL name 'ConnMgrRegisterScheduledConnection';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Unregisters a scheduled connection
+//
+// @comm none
+//
+// -----------------------------------------------------------------------------
+function ConnMgrUnregisterScheduledConnection(pwszToken:LPCTSTR  // @param Token of scheduled connection to unregister
+                                              ):HRESULT; external CellcoreDLL name 'ConnMgrUnregisterScheduledConnection';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Maps a URL to a destination network GUID
+//
+// @comm none
+//
+// -----------------------------------------------------------------------------
+function ConnMgrMapURL(pwszURL:LPCTSTR; // @parm URL to map
+                       pguid:LPGUID;     // @parm Returned network GUID
+                       pdwIndex:LPDWORD  // @parm Index in table for next search
+                      ):HRESULT; external CellcoreDLL name 'ConnMgrMapURL';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Returns a handle to an event which becomes signaled when the ConnMgr API
+// is ready to be used. Caller is responsible for calling CloseHandle on the returned event.
+//
+// @comm none
+//
+// -----------------------------------------------------------------------------
+function ConnMgrApiReadyEvent:HANDLE; external CellcoreDLL name 'ConnMgrApiReadyEvent';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Defines the type of a connection reference
+//
+// @comm none
+//
+// -----------------------------------------------------------------------------
+
+{$PACKENUM 4}
+type
+     _ConnMgrConRefTypeEnum = (ConRefType_NAP := 0,     // @constdefine NAP connection reference
+                               ConRefType_PROXY        // @constdefine PROXY connection reference
+                              );
+     ConnMgrConRefTypeEnum = _ConnMgrConRefTypeEnum;
+{$PACKENUM DEFAULT}
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Maps a connection reference to its corresponding GUID
+//
+// @comm none
+//
+// -----------------------------------------------------------------------------
+
+function ConnMgrMapConRef(e:ConnMgrConRefTypeEnum;        // @parm Specify type of connection reference
+                          szConRef:LPCTSTR;               // @parm Connection reference to map
+                          pGUID:LPGUID                     // @parm Returned connection reference GUID
+                         ):HRESULT; external CellcoreDLL name 'ConnMgrMapConRef';
+
+
+// - end of connmgr.h
+
+implementation
+
+end.

+ 227 - 0
packages/winceunits/src/devload.pp

@@ -0,0 +1,227 @@
+//
+// Module Name:
+//
+//     devload.h
+//
+// Abstract:
+//
+//     Device loader structures and defines
+//
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit devload;
+
+{$CALLING cdecl}
+
+interface
+
+uses Windows;
+
+// @doc DRIVERS
+
+//
+// These keys are under HKEY_LOCAL_MACHINE
+//
+const
+      DEVLOAD_DRIVERS_KEY  = 'Drivers';
+      DEVLOAD_BUILT_IN_KEY = 'Drivers\BuiltIn';
+      DEVLOAD_PCMCIA_KEY   = 'Drivers\PCMCIA';
+      DEVLOAD_ACTIVE_KEY   = 'Drivers\Active';
+      DEVLOAD_DETECT_KEY   = DEVLOAD_PCMCIA_KEY + '\Detect';
+      
+//
+// These are the required and optional values under a device key.
+//
+const
+      DEVLOAD_DLLNAME_VALNAME     = 'Dll';     // DLL name (required)
+      DEVLOAD_DLLNAME_VALTYPE     = REG_SZ;
+      DEVLOAD_ICLASS_VALNAME      = 'IClass';  // Class(es) of device interface (semi-required)
+      DEVLOAD_ICLASS_VALTYPE      = REG_MULTI_SZ;
+      DEVLOAD_LOADORDER_VALNAME   = 'Order';   // LoadOrder (optional)
+      DEVLOAD_LOADORDER_VALTYPE   = REG_DWORD;
+      DEVLOAD_ENTRYPOINT_VALNAME  = 'Entry';   // Entrypoint name (deprecated)
+      DEVLOAD_ENTRYPOINT_VALTYPE  = REG_SZ;
+      DEVLOAD_PREFIX_VALNAME      = 'Prefix';  // Device prefix (optional)
+      DEVLOAD_PREFIX_VALTYPE      = REG_SZ;
+      DEVLOAD_INDEX_VALNAME       = 'Index';   // Device index (optional)
+      DEVLOAD_INDEX_VALTYPE       = REG_DWORD;
+      DEVLOAD_CONTEXT_VALNAME     = 'Context'; // Device context (optional)
+      DEVLOAD_CONTEXT_VALTYPE     = REG_DWORD;
+      DEVLOAD_INITCODE_VALNAME    = 'Ioctl';   // Device IO control code to indicate context (deprecated)
+      DEVLOAD_INITCODE_VALTYPE    = REG_DWORD;
+      DEVLOAD_BUSINITCODE_VALNAME = 'BusIoctl';   // Bus IO control code to indicate context
+      DEVLOAD_BUSINITCODE_VALTYPE = REG_DWORD;
+      DEVLOAD_FLAGS_VALNAME       = 'Flags';   // Flag to control loading/unloading (optional)
+      DEVLOAD_FLAGS_VALTYPE       = REG_DWORD;
+      DEVLOAD_INTRPEND_VALNAME    = 'NoIntrPend'; // Is the interrupt pending flag invalid (optional)
+      DEVLOAD_INTRPEND_VALTYPE    = REG_DWORD;
+      DEVLOAD_REPARMS_VALNAME     = 'RegenumParms'; // Regenum parms passed into Active\xx
+      DEVLOAD_REPARMS_VALTYPE     = REG_MULTI_SZ;
+
+      DEVLOAD_MEMBASE_VALNAME     = 'MemBase'; // Memory base (optional)
+      DEVLOAD_MEMLEN_VALNAME      = 'MemLen';  // Memory length (optional)
+      DEVLOAD_IOBASE_VALNAME      = 'IoBase';  // IO base (optional)
+      DEVLOAD_IOLEN_VALNAME       = 'IoLen';   // IO length (optional)
+      DEVLOAD_SYSINTR_VALNAME     = 'SysIntr'; // System interrupt number (optional)
+      DEVLOAD_IRQ_VALNAME         = 'Irq';     // Irq number (optional)
+      DEVLOAD_IFCTYPE_VALNAME     = 'InterfaceType';   // Bus interface type (i.e. PCIbus, ISA, etc) (optional)
+      DEVLOAD_BUSNUMBER_VALNAME   = 'BusNumber';       // Bus number (relevant for PCIbus) (optional)
+      DEVLOAD_ISRDLL_VALNAME      = 'IsrDll';  // DLL name of ISR (optional)
+      DEVLOAD_ISRHANDLER_VALNAME  = 'IsrHandler';      // ISR handler function name (optional)
+
+//
+// The presence of the value "Keep" will cause device.exe to skip the call to
+// FreeLibrary after calling the specified entrypoint.  This only affects
+// builtin drivers that specify an entrypoint. (This usage is deprecated -
+// make appropriate use of the UNLOAD flag instead).
+//
+const
+      DEVLOAD_KEEPLIB_VALNAME     = 'Keep';   // (deprecated - see above)
+      DEVLOAD_KEEPLIB_VALTYPE     = REG_DWORD;
+
+//
+// Flag values.
+//
+const
+      DEVFLAGS_NONE              = $00000000;  // No flags defined
+      DEVFLAGS_UNLOAD            = $00000001;  // Unload driver after call to entry point returns
+      DEVFLAGS_LOADLIBRARY       = $00000002;  // Use LoadLibrary instead of LoadDriver
+      DEVFLAGS_NOLOAD            = $00000004;  // Don't load Dll
+      DEVFLAGS_NAKEDENTRIES      = $00000008;  // Entry points don't have Prefix prepended
+      DEVFLAGS_BOOTPHASE_1       = $00001000;  // This driver only load at system phase 1
+      DEVFLAGS_IRQ_EXCLUSIVE	   = $00000100;  // This driver only can be load when it has exclusive access for IRQ.
+      DEVFLAGS_TRUSTEDCALLERONLY = $00010000;  // This driver only can be opened by trusted application.
+
+//
+// Structure passed in the input buffer of DeviceIoControl() for the 
+// post initialization ioctl
+//
+type
+     _POST_INIT_BUF = record
+       p_hDevice:HANDLE;        // device handle from RegisterDevice
+       p_hDeviceKey:HKEY;     // open registry handle to the driver's device key
+     end;
+     POST_INIT_BUF = _POST_INIT_BUF;
+     PPOST_INIT_BUF = ^POST_INIT_BUF;
+
+
+//
+// For passing additional registry settings to ActivateDeviceEx()
+//
+type
+     _REGINI = record
+       lpszVal:LPCWSTR;
+       pData:LPBYTE;
+       dwLen:DWORD;
+       dwType:DWORD;
+     end;
+     REGINI = _REGINI;
+     LPCREGINI = ^_REGINI;
+
+//
+// These values reside under a device's active key
+//
+const
+      DEVLOAD_CLIENTINFO_VALNAME    = 'ClientInfo'; // ClientInfo DWORD from ActivateDriver
+      DEVLOAD_CLIENTINFO_VALTYPE    = REG_DWORD;
+      DEVLOAD_HANDLE_VALNAME        = 'Hnd';     // Device handle (from RegisterDevice)
+      DEVLOAD_HANDLE_VALTYPE        = REG_DWORD;
+      DEVLOAD_DEVNAME_VALNAME       = 'Name';    // Device name (i.e "COM1:")
+      DEVLOAD_DEVNAME_VALTYPE       = REG_SZ;
+      DEVLOAD_DEVKEY_VALNAME        = 'Key';     // Device key in \Drivers\(Built-In or PCMCIA)
+      DEVLOAD_DEVKEY_VALTYPE        = REG_SZ;
+      DEVLOAD_PNPID_VALNAME         = 'PnpId';   // Plug and Play Id (PCMCIA, optional)
+      DEVLOAD_PNPID_VALTYPE         = REG_SZ;
+      DEVLOAD_SOCKET_VALNAME        = 'Sckt';    // PCMCIA socket (optional)
+      DEVLOAD_SOCKET_VALTYPE        = REG_DWORD;       // Actually a CARD_SOCKET_HANDLE
+      DEVLOAD_INTERFACETYPE_VALNAME = 'InterfaceType';  // Bus Type
+      DEVLOAD_INTERFACETYPE_VALTYPE = REG_DWORD;
+
+
+//
+// These values reside under a device's active key.  They are provided by the device's bus
+// driver.  All values are optional.  The BusParent tells the Device Manager which device
+// driver loaded the new driver.  The BusPrefix is used to specify DLL entry point decoration
+// for devices that do not expose a stream interface to applications (via the legacy or $device
+// namespaces).  If a Prefix value is specified in the device's device key and a BusPrefix value
+// is specified, they must match.  The BusName provides the Device Manager with the name that the
+// device driver will expose in the $bus namespace.  This name must be unique and is completely
+// specified by the bus driver; it is not decorated with an instance index; if a duplicate name 
+// is found, the driver will not load.
+//
+const
+      DEVLOAD_BUSPARENT_VALNAME   = 'BusParent';   // parent bus driver handle
+      DEVLOAD_BUSPARENT_VALTYPE   = REG_DWORD;
+      DEVLOAD_BUSPREFIX_VALNAME   = 'BusPrefix';   // DLL entry point decoration -- must match "Prefix" if present in device key
+      DEVLOAD_BUSPREFIX_VALTYPE   = REG_SZ;
+      DEVLOAD_BUSNAME_VALNAME     = 'BusName';     // device's name on the parent bus
+      DEVLOAD_BUSNAME_VALTYPE     = REG_SZ;
+
+//
+// TAPI Pnp support
+//
+const
+      DEVLOAD_TSPDLL_VALNAME      = 'Tsp';     // TAPI Service Provider DLL
+      DEVLOAD_TSPDLL_VALTYPE      = REG_SZ;
+      DEVLOAD_TSPDEV_VALNAME      = 'THnd';    // TAPI device index
+      DEVLOAD_TSPDEV_VALTYPE      = REG_DWORD;
+
+//
+// Prototype for the optional device driver entrypoint
+//
+type
+     PFN_DEV_ENTRY = function(param1:LPTSTR):DWORD; cdecl; // Parameter is registry path of device's key
+
+const
+      DEVKEY_LEN      = 256;  // Max length of registry key path name
+      DEVNAME_LEN     =  16;  // Max length of device name
+      DEVDLL_LEN      =  64;  // Max length of device driver DLL name
+      DEVENTRY_LEN    =  64;  // Max length of device driver entrypoint name
+      DEVPREFIX_LEN   =   8;  // Max length of device prefix
+
+
+//
+// Device APIs: EnumPnpIds, EnumDevices, GetDeviceKeys and OpenDeviceKey
+// (in coredll.dll)
+//
+function EnumPnpIds(PnpList:LPTSTR; lpBuflen:LPDWORD):DWORD; external KernelDLL name 'EnumPnpIds'; // index BE
+function EnumDevices(DevList:LPTSTR; lpBuflen:LPDWORD):DWORD; external KernelDLL name 'EnumDevices'; // index BF
+function GetDeviceKeys(DevName:LPCTSTR; ActiveKey:LPTSTR; lpActiveLen:LPDWORD;
+                       DriverKey:LPTSTR; lpDriverLen:LPDWORD):DWORD; external KernelDLL name 'GetDeviceKeys'; // index C0
+function OpenDeviceKey(ActiveKey:LPCTSTR):HKEY; external KernelDLL name 'OpenDeviceKey'; // index C1
+function GetDeviceHandleFromContext(pContext:LPCTSTR):HANDLE; external KernelDLL name 'GetDeviceHandleFromContext';
+
+
+const
+      DevMgrDLL = 'devmgr.dll';
+//
+// Device Manager APIs located in devmgr.dll.  These APIs are only available to drivers
+// loaded in the Device Manager's process context.
+//
+function DmAdvertiseInterface(hDevice:HANDLE; const devclass:LPGUID; name:LPCWSTR; fAdd:BOOL):DWORD; external DevMgrDLL name 'DmAdvertiseInterface';
+
+//
+// This interface GUID indicates that the device supports differentiating the $bus and $device
+// (and legacy) namespaces.  Devices must advertise this GUID via IClass or calls to
+// DmAdvertiseInterface() before CreateFile() requests on their $bus names will succeed.  The GUID
+// must be associated with their bus name, not their $device or legacy name.
+//
+const
+      DMCLASS_PROTECTEDBUSNAMESPACE   = '{6F40791D-300E-44E4-BC38-E0E63CA8375C}';
+
+//
+// Drivers that advertise DMCLASS_PROTECTEDBUSNAMESPACE will have this bit set in the dwAccess
+// parameter to their XXX_Open() entry point when a handle is opened using the $bus namespace.
+// This allows them to know which handles are allowed to carry out privileged operations.  If they
+// advertise DMCLASS_PROTECTEDBUSNAMESPACE, they are required to block privileged operations on
+// handles opened in the $device or legacy namespaces.
+//
+const
+      DEVACCESS_BUSNAMESPACE          = FILE_WRITE_ATTRIBUTES;
+
+implementation
+
+end.

+ 60 - 0
packages/winceunits/src/devmgmt.pp

@@ -0,0 +1,60 @@
+//
+// Module Name:
+//
+//     devmgmt.h
+//
+// DESCRIPTION:
+// Device Management APIs
+//
+
+//
+// Included Module Name:
+//
+//     cfgmgrapi.h
+//
+// DESCRIPTION:
+// Configmanager API to process XML configuration files
+//
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit devmgmt;
+
+{$CALLING cdecl}
+
+interface
+
+uses Windows, aygshell;
+
+// - cfgmgrapi.h
+
+// Possible error codes returned by Configmanager
+const
+      CONFIG_E_OBJECTBUSY                 = HRESULT($80042001);
+      CONFIG_E_CANCELTIMEOUT              = HRESULT($80042002);
+      CONFIG_E_ENTRYNOTFOUND              = HRESULT($80042004);
+      CONFIG_S_PROCESSINGCANCELED         = HRESULT($00042005);
+      CONFIG_E_CSPEXCEPTION               = HRESULT($80042007);
+      CONFIG_E_TRANSACTIONINGFAILURE      = HRESULT($80042008);
+      CONFIG_E_BAD_XML                    = HRESULT($80042009);
+
+// Configmanager flags
+const
+      CFGFLAG_PROCESS                     = $0001;
+      CFGFLAG_METADATA                    = $0002;
+
+function DMProcessConfigXML(pszWXMLin:LPCWSTR; dwFlags:DWORD; ppszwXMLout:PLPWSTR):HRESULT; external UserDLLAyg name 'DMProcessConfigXML'; // index 7E5
+
+// - end of cfgmgrapi.h
+
+// - devmgmt.h
+
+function QueryPolicy(dwPolicyId:DWORD; pdwPolicyValue:PDWORD):HRESULT; external UserDLLAyg name 'QueryPolicy';  
+
+// - end of devmgmt.h
+
+implementation
+
+end.

+ 3122 - 0
packages/winceunits/src/mmreg.pp

@@ -0,0 +1,3122 @@
+//
+// Module Name:
+//
+//     mmreg.h
+//
+// Abstract:
+//
+//     Multimedia Registration
+//
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit mmreg;
+
+interface
+
+uses Windows;
+
+{
+  Automatically converted by H2Pas 1.0.0 from mmreg.h
+  The following command line parameters were used:
+    -d
+    -w
+    -D
+    -l
+    mmreg.h
+}
+
+{ Define the following to skip definitions }
+{ }
+{ NOMMIDS      Multimedia IDs are not defined }
+{ NONEWWAVE    No new waveform types are defined except WAVEFORMATEX }
+{ NONEWRIFF    No new RIFF forms are defined }
+{ NOJPEGDIB    No JPEG DIB definitions }
+{ NONEWIC      No new Image Compressor types are defined }
+{ NOBITMAP     No extended bitmap info header definition }
+
+{$PACKRECORDS 1} //  {#include "pshpack1.h"   /* Assume byte packing throughout */ }
+
+
+type
+     FOURCC = DWORD;         //* a four character code */
+
+{$IFNDEF NOMMIDS}
+// manufacturer IDs  
+const
+     MM_MICROSOFT = 1; //  Microsoft Corporation
+
+     MM_CREATIVE = 2; // Creative Labs, Inc
+  {  Media Vision, Inc.  }
+     MM_MEDIAVISION = 3;     
+  {  Fujitsu Corp.  }
+     MM_FUJITSU = 4;     
+  {  Artisoft, Inc.  }
+     MM_ARTISOFT = 20;     
+  {  Turtle Beach, Inc.  }
+     MM_TURTLE_BEACH = 21;     
+  {  IBM Corporation  }
+     MM_IBM = 22;     
+  {  Vocaltec LTD.  }
+     MM_VOCALTEC = 23;     
+  {  Roland  }
+     MM_ROLAND = 24;     
+  {  DSP Solutions, Inc.  }
+     MM_DSP_SOLUTIONS = 25;     
+  {  NEC  }
+     MM_NEC = 26;     
+  {  ATI  }
+     MM_ATI = 27;     
+  {  Wang Laboratories, Inc  }
+     MM_WANGLABS = 28;     
+  {  Tandy Corporation  }
+     MM_TANDY = 29;     
+  {  Voyetra  }
+     MM_VOYETRA = 30;     
+  {  Antex Electronics Corporation  }
+     MM_ANTEX = 31;     
+  {  ICL Personal Systems  }
+     MM_ICL_PS = 32;     
+  {  Intel Corporation  }
+     MM_INTEL = 33;     
+  {  Advanced Gravis  }
+     MM_GRAVIS = 34;     
+  {  Video Associates Labs, Inc.  }
+     MM_VAL = 35;     
+  {  InterActive Inc  }
+     MM_INTERACTIVE = 36;     
+  {  Yamaha Corporation of America  }
+     MM_YAMAHA = 37;     
+  {  Everex Systems, Inc  }
+     MM_EVEREX = 38;     
+  {  Echo Speech Corporation  }
+     MM_ECHO = 39;     
+  {  Sierra Semiconductor Corp  }
+     MM_SIERRA = 40;     
+  {  Computer Aided Technologies  }
+     MM_CAT = 41;     
+  {  APPS Software International  }
+     MM_APPS = 42;     
+  {  DSP Group, Inc  }
+     MM_DSP_GROUP = 43;     
+  {  microEngineering Labs  }
+     MM_MELABS = 44;     
+  {  Computer Friends, Inc.  }
+     MM_COMPUTER_FRIENDS = 45;     
+  {  ESS Technology  }
+     MM_ESS = 46;     
+  {  Audio, Inc.  }
+     MM_AUDIOFILE = 47;     
+  {  Motorola, Inc.  }
+     MM_MOTOROLA = 48;     
+  {  Canopus, co., Ltd.  }
+     MM_CANOPUS = 49;     
+  {  Seiko Epson Corporation  }
+     MM_EPSON = 50;     
+  {  Truevision  }
+     MM_TRUEVISION = 51;     
+  {  Aztech Labs, Inc.  }
+     MM_AZTECH = 52;     
+  {  Videologic  }
+     MM_VIDEOLOGIC = 53;     
+  {  SCALACS  }
+     MM_SCALACS = 54;     
+  {  Korg Inc.  }
+     MM_KORG = 55;     
+  {  Audio Processing Technology  }
+     MM_APT = 56;     
+  {  Integrated Circuit Systems, Inc.  }
+     MM_ICS = 57;     
+  {  Iterated Systems, Inc.  }
+     MM_ITERATEDSYS = 58;     
+  {  Metheus  }
+     MM_METHEUS = 59;     
+  {  Logitech, Inc.  }
+     MM_LOGITECH = 60;     
+  {  Winnov, Inc.  }
+     MM_WINNOV = 61;     
+  {  NCR Corporation  }
+     MM_NCR = 62;     
+  {  EXAN  }
+     MM_EXAN = 63;     
+  {  AST Research Inc.  }
+     MM_AST = 64;     
+  {  Willow Pond Corporation  }
+     MM_WILLOWPOND = 65;     
+  {  Sonic Foundry  }
+     MM_SONICFOUNDRY = 66;     
+  {  Vitec Multimedia  }
+     MM_VITEC = 67;     
+  {  MOSCOM Corporation  }
+     MM_MOSCOM = 68;     
+  {  Silicon Soft, Inc.  }
+     MM_SILICONSOFT = 69;     
+  {  Supermac  }
+     MM_SUPERMAC = 73;     
+  {  Audio Processing Technology  }
+     MM_AUDIOPT = 74;     
+  {  Speech Compression  }
+     MM_SPEECHCOMP = 76;     
+  {  Ahead, Inc.  }
+     MM_AHEAD = 77;     
+  {  Dolby Laboratories  }
+     MM_DOLBY = 78;     
+  {  OKI  }
+     MM_OKI = 79;     
+  {  AuraVision Corporation  }
+     MM_AURAVISION = 80;     
+  {  Ing C. Olivetti & C., S.p.A.  }
+     MM_OLIVETTI = 81;     
+  {  I/O Magic Corporation  }
+     MM_IOMAGIC = 82;     
+  {  Matsushita Electric Industrial Co., LTD.  }
+     MM_MATSUSHITA = 83;     
+  {  Control Resources Limited  }
+     MM_CONTROLRES = 84;     
+  {  Xebec Multimedia Solutions Limited  }
+     MM_XEBEC = 85;     
+  {  New Media Corporation  }
+     MM_NEWMEDIA = 86;     
+  {  Natural MicroSystems  }
+     MM_NMS = 87;     
+  {  Lyrrus Inc.  }
+     MM_LYRRUS = 88;     
+  {  Compusic  }
+     MM_COMPUSIC = 89;     
+  {  OPTi Computers Inc.  }
+     MM_OPTI = 90;     
+  {  Adlib Accessories Inc.  }
+     MM_ADLACC = 91;     
+  {  Compaq Computer Corp.  }
+     MM_COMPAQ = 92;     
+  {  Dialogic Corporation  }
+     MM_DIALOGIC = 93;     
+  {  InSoft, Inc.  }
+     MM_INSOFT = 94;     
+  {  M.P. Technologies, Inc.  }
+     MM_MPTUS = 95;     
+  {  Weitek  }
+     MM_WEITEK = 96;     
+  {  Lernout & Hauspie  }
+     MM_LERNOUT_AND_HAUSPIE = 97;     
+  {  Quanta Computer Inc.  }
+     MM_QCIAR = 98;     
+  {  Apple Computer, Inc.  }
+     MM_APPLE = 99;     
+  {  Digital Equipment Corporation  }
+     MM_DIGITAL = 100;     
+  {  Mark of the Unicorn  }
+     MM_MOTU = 101;     
+  {  Workbit Corporation  }
+     MM_WORKBIT = 102;     
+  {  Ositech Communications Inc.  }
+     MM_OSITECH = 103;     
+  {  miro Computer Products AG  }
+     MM_MIRO = 104;     
+  {  Cirrus Logic  }
+     MM_CIRRUSLOGIC = 105;     
+  {  ISOLUTION  B.V.  }
+     MM_ISOLUTION = 106;     
+  {  Horizons Technology, Inc  }
+     MM_HORIZONS = 107;     
+  {  Computer Concepts Ltd  }
+     MM_CONCEPTS = 108;     
+  {  Voice Technologies Group, Inc.  }
+     MM_VTG = 109;     
+  {  Radius  }
+     MM_RADIUS = 110;     
+  {  Rockwell International  }
+     MM_ROCKWELL = 111;     
+  {  Co. XYZ for testing  }
+     MM_XYz = 112;     
+  {  Opcode Systems  }
+     MM_OPCODE = 113;     
+  {  Voxware Inc  }
+     MM_VOXWARE = 114;     
+  {  Northern Telecom Limited  }
+     MM_NORTHERN_TELECOM = 115;     
+  {  APICOM  }
+     MM_APICOM = 116;     
+  {  Grande Software  }
+     MM_GRANDE = 117;     
+  {  ADDX  }
+     MM_ADDX = 118;     
+  {  Wildcat Canyon Software  }
+     MM_WILDCAT = 119;     
+  {  Rhetorex Inc  }
+     MM_RHETOREX = 120;     
+  {  Brooktree Corporation  }
+     MM_BROOKTREE = 121;     
+  {  ENSONIQ Corporation  }
+     MM_ENSONIQ = 125;     
+  {  ///FAST Multimedia AG  }
+     MM_FAST = 126;     
+  {  NVidia Corporation  }
+     MM_NVIDIA = 127;     
+  {  OKSORI Co., Ltd.  }
+     MM_OKSORI = 128;     
+  {  DiAcoustics, Inc.  }
+     MM_DIACOUSTICS = 129;     
+  {  Gulbransen, Inc.  }
+     MM_GULBRANSEN = 130;     
+  {  Kay Elemetrics, Inc.  }
+     MM_KAY_ELEMETRICS = 131;     
+  {  Crystal Semiconductor Corporation  }
+     MM_CRYSTAL = 132;     
+  {  Splash Studios  }
+     MM_SPLASH_STUDIOS = 133;     
+  {  Quarterdeck Corporation  }
+     MM_QUARTERDECK = 134;     
+  {  TDK Corporation  }
+     MM_TDK = 135;     
+  {  Digital Audio Labs, Inc.  }
+     MM_DIGITAL_AUDIO_LABS = 136;     
+  {  Seer Systems, Inc.  }
+     MM_SEERSYS = 137;     
+  {  PictureTel Corporation  }
+     MM_PICTURETEL = 138;     
+  {  AT&T Microelectronics  }
+     MM_ATT_MICROELECTRONICS = 139;     
+  {  Osprey Technologies, Inc.  }
+     MM_OSPREY = 140;     
+  {  Mediatrix Peripherals  }
+     MM_MEDIATRIX = 141;     
+  {  SounDesignS M.C.S. Ltd.  }
+     MM_SOUNDESIGNS = 142;     
+  {  A.L. Digital Ltd.  }
+     MM_ALDIGITAL = 143;     
+  {  Spectrum Signal Processing, Inc.  }
+     MM_SPECTRUM_SIGNAL_PROCESSING = 144;     
+  {  Electronic Courseware Systems, Inc.  }
+     MM_ECS = 145;     
+  {  AMD  }
+     MM_AMD = 146;     
+  {  Core Dynamics  }
+     MM_COREDYNAMICS = 147;     
+  {  CANAM Computers  }
+     MM_CANAM = 148;     
+  {  Softsound, Ltd.  }
+     MM_SOFTSOUND = 149;     
+  {  Norris Communications, Inc.  }
+     MM_NORRIS = 150;     
+  {  Danka Data Devices  }
+     MM_DDD = 151;     
+  {  EuPhonics  }
+     MM_EUPHONICS = 152;     
+  {  Precept Software, Inc.  }
+     MM_PRECEPT = 153;     
+  {  Crystal Net Corporation  }
+     MM_CRYSTAL_NET = 154;     
+  {  Chromatic Research, Inc  }
+     MM_CHROMATIC = 155;     
+  {  Voice Information Systems, Inc  }
+     MM_VOICEINFO = 156;     
+  {  Vienna Systems  }
+     MM_VIENNASYS = 157;     
+  {  Connectix Corporation  }
+     MM_CONNECTIX = 158;     
+  {  Gadget Labs LLC  }
+     MM_GADGETLABS = 159;     
+  {  Frontier Design Group LLC  }
+     MM_FRONTIER = 160;     
+  {  Viona Development GmbH  }
+     MM_VIONA = 161;     
+  {  Casio Computer Co., LTD  }
+     MM_CASIO = 162;     
+  {  Diamond Multimedia  }
+     MM_DIAMONDMM = 163;     
+  {  S3  }
+     MM_S3 = 164;     
+  {  Fraunhofer  }
+     MM_FRAUNHOFER_IIS = 172;     
+
+
+{ MM_MICROSOFT product IDs  }
+{$IFNDEF MM_MIDI_MAPPER}
+  const
+     MM_MIDI_MAPPER = 1; // Midi Mapper
+  {  Wave Mapper   }
+     MM_WAVE_MAPPER = 2;
+  {  Sound Blaster MIDI output port   }
+     MM_SNDBLST_MIDIOUT = 3;
+  {  Sound Blaster MIDI input port   }
+     MM_SNDBLST_MIDIIN = 4;
+  {  Sound Blaster internal synth   }
+     MM_SNDBLST_SYNTH = 5;
+  {  Sound Blaster waveform output   }
+     MM_SNDBLST_WAVEOUT = 6;
+  {  Sound Blaster waveform input   }
+     MM_SNDBLST_WAVEIN = 7;
+  {  Ad Lib Compatible synth   }
+     MM_ADLIB = 9;
+  {  MPU 401 compatible MIDI output port   }
+     MM_MPU401_MIDIOUT = 10;
+  {  MPU 401 compatible MIDI input port   }
+     MM_MPU401_MIDIIN = 11;
+  {  Joystick adapter   }
+     MM_PC_JOYSTICK = 12;
+{$ENDIF MM_MIDI_MAPPER}
+
+  const
+     MM_PCSPEAKER_WAVEOUT = 13;  {  PC speaker waveform output   }     
+  {  MS Audio Board waveform input   }
+     MM_MSFT_WSS_WAVEIN = 14;     
+  {  MS Audio Board waveform output   }
+     MM_MSFT_WSS_WAVEOUT = 15;     
+  {  MS Audio Board  Stereo FM synth   }
+     MM_MSFT_WSS_FMSYNTH_STEREO = 16;     
+  {  MS Audio Board Mixer Driver   }
+     MM_MSFT_WSS_MIXER = 17;     
+  {  MS OEM Audio Board waveform input   }
+     MM_MSFT_WSS_OEM_WAVEIN = 18;     
+  {  MS OEM Audio Board waveform output   }
+     MM_MSFT_WSS_OEM_WAVEOUT = 19;     
+  {  MS OEM Audio Board Stereo FM Synth   }
+     MM_MSFT_WSS_OEM_FMSYNTH_STEREO = 20;     
+  {  MS Audio Board Aux. Port   }
+     MM_MSFT_WSS_AUX = 21;     
+  {  MS OEM Audio Aux Port   }
+     MM_MSFT_WSS_OEM_AUX = 22;     
+  {  MS Vanilla driver waveform input   }
+     MM_MSFT_GENERIC_WAVEIN = 23;     
+  {  MS Vanilla driver wavefrom output   }
+     MM_MSFT_GENERIC_WAVEOUT = 24;     
+  {  MS Vanilla driver MIDI in   }
+     MM_MSFT_GENERIC_MIDIIN = 25;     
+  {  MS Vanilla driver MIDI  external out   }
+     MM_MSFT_GENERIC_MIDIOUT = 26;     
+  {  MS Vanilla driver MIDI synthesizer   }
+     MM_MSFT_GENERIC_MIDISYNTH = 27;     
+  {  MS Vanilla driver aux (line in)   }
+     MM_MSFT_GENERIC_AUX_LINE = 28;     
+  {  MS Vanilla driver aux (mic)   }
+     MM_MSFT_GENERIC_AUX_MIC = 29;     
+  {  MS Vanilla driver aux (CD)   }
+     MM_MSFT_GENERIC_AUX_CD = 30;     
+  {  MS OEM Audio Board Mixer Driver   }
+     MM_MSFT_WSS_OEM_MIXER = 31;     
+  {  MS Audio Compression Manager   }
+     MM_MSFT_MSACM = 32;     
+  {  MS ADPCM Codec   }
+     MM_MSFT_ACM_MSADPCM = 33;     
+  {  IMA ADPCM Codec   }
+     MM_MSFT_ACM_IMAADPCM = 34;     
+  {  MS Filter   }
+     MM_MSFT_ACM_MSFILTER = 35;     
+  {  GSM 610 codec   }
+     MM_MSFT_ACM_GSM610 = 36;     
+  {  G.711 codec   }
+     MM_MSFT_ACM_G711 = 37;     
+  {  PCM converter   }
+     MM_MSFT_ACM_PCM = 38;
+
+     
+  { Microsoft Windows Sound System drivers }
+  {  Sound Blaster 16 waveform input   }
+     MM_WSS_SB16_WAVEIN = 39;     
+  {  Sound Blaster 16  waveform output   }
+     MM_WSS_SB16_WAVEOUT = 40;     
+  {  Sound Blaster 16 midi-in   }
+     MM_WSS_SB16_MIDIIN = 41;     
+  {  Sound Blaster 16 midi out   }
+     MM_WSS_SB16_MIDIOUT = 42;     
+  {  Sound Blaster 16 FM Synthesis   }
+     MM_WSS_SB16_SYNTH = 43;     
+  {  Sound Blaster 16 aux (line in)   }
+     MM_WSS_SB16_AUX_LINE = 44;     
+  {  Sound Blaster 16 aux (CD)   }
+     MM_WSS_SB16_AUX_CD = 45;     
+  {  Sound Blaster 16 mixer device   }
+     MM_WSS_SB16_MIXER = 46;     
+  {  Sound Blaster Pro waveform input   }
+     MM_WSS_SBPRO_WAVEIN = 47;     
+  {  Sound Blaster Pro waveform output   }
+     MM_WSS_SBPRO_WAVEOUT = 48;     
+  {  Sound Blaster Pro midi in   }
+     MM_WSS_SBPRO_MIDIIN = 49;     
+  {  Sound Blaster Pro midi out   }
+     MM_WSS_SBPRO_MIDIOUT = 50;     
+  {  Sound Blaster Pro FM synthesis   }
+     MM_WSS_SBPRO_SYNTH = 51;     
+  {  Sound Blaster Pro aux (line in )   }
+     MM_WSS_SBPRO_AUX_LINE = 52;     
+  {  Sound Blaster Pro aux (CD)   }
+     MM_WSS_SBPRO_AUX_CD = 53;     
+  {  Sound Blaster Pro mixer   }
+     MM_WSS_SBPRO_MIXER = 54;     
+  {  WSS NT wave in   }
+     MM_MSFT_WSS_NT_WAVEIN = 55;     
+  {  WSS NT wave out   }
+     MM_MSFT_WSS_NT_WAVEOUT = 56;     
+  {  WSS NT FM synth   }
+     MM_MSFT_WSS_NT_FMSYNTH_STEREO = 57;     
+  {  WSS NT mixer   }
+     MM_MSFT_WSS_NT_MIXER = 58;     
+  {  WSS NT aux   }
+     MM_MSFT_WSS_NT_AUX = 59;     
+  {  Sound Blaster 16 waveform input   }
+     MM_MSFT_SB16_WAVEIN = 60;     
+  {  Sound Blaster 16  waveform output   }
+     MM_MSFT_SB16_WAVEOUT = 61;     
+  {  Sound Blaster 16 midi-in   }
+     MM_MSFT_SB16_MIDIIN = 62;     
+  {  Sound Blaster 16 midi out   }
+     MM_MSFT_SB16_MIDIOUT = 63;     
+  {  Sound Blaster 16 FM Synthesis   }
+     MM_MSFT_SB16_SYNTH = 64;     
+  {  Sound Blaster 16 aux (line in)   }
+     MM_MSFT_SB16_AUX_LINE = 65;     
+  {  Sound Blaster 16 aux (CD)   }
+     MM_MSFT_SB16_AUX_CD = 66;     
+  {  Sound Blaster 16 mixer device   }
+     MM_MSFT_SB16_MIXER = 67;     
+  {  Sound Blaster Pro waveform input   }
+     MM_MSFT_SBPRO_WAVEIN = 68;     
+  {  Sound Blaster Pro waveform output   }
+     MM_MSFT_SBPRO_WAVEOUT = 69;     
+  {  Sound Blaster Pro midi in   }
+     MM_MSFT_SBPRO_MIDIIN = 70;     
+  {  Sound Blaster Pro midi out   }
+     MM_MSFT_SBPRO_MIDIOUT = 71;     
+  {  Sound Blaster Pro FM synthesis   }
+     MM_MSFT_SBPRO_SYNTH = 72;     
+  {  Sound Blaster Pro aux (line in )   }
+     MM_MSFT_SBPRO_AUX_LINE = 73;     
+  {  Sound Blaster Pro aux (CD)   }
+     MM_MSFT_SBPRO_AUX_CD = 74;     
+  {  Sound Blaster Pro mixer   }
+     MM_MSFT_SBPRO_MIXER = 75;     
+  { Yamaha OPL2/OPL3 compatible FM synthesis  }
+     MM_MSFT_MSOPL_SYNTH = 76;     
+  { Voice Modem Serial Line Wave Input  }
+     MM_MSFT_VMDMS_LINE_WAVEIN = 80;     
+  { Voice Modem Serial Line Wave Output  }
+     MM_MSFT_VMDMS_LINE_WAVEOUT = 81;     
+  { Voice Modem Serial Handset Wave Input  }
+     MM_MSFT_VMDMS_HANDSET_WAVEIN = 82;     
+  { Voice Modem Serial Handset Wave Output  }
+     MM_MSFT_VMDMS_HANDSET_WAVEOUT = 83;     
+  { Voice Modem Wrapper Line Wave Input  }
+     MM_MSFT_VMDMW_LINE_WAVEIN = 84;     
+  { Voice Modem Wrapper Line Wave Output  }
+     MM_MSFT_VMDMW_LINE_WAVEOUT = 85;     
+  { Voice Modem Wrapper Handset Wave Input  }
+     MM_MSFT_VMDMW_HANDSET_WAVEIN = 86;     
+  { Voice Modem Wrapper Handset Wave Output  }
+     MM_MSFT_VMDMW_HANDSET_WAVEOUT = 87;     
+  { Voice Modem Wrapper Mixer  }
+     MM_MSFT_VMDMW_MIXER = 88;     
+  { Voice Modem Game Compatible Wave Device  }
+     MM_MSFT_VMDM_GAME_WAVEOUT = 89;     
+  { Voice Modem Game Compatible Wave Device  }
+     MM_MSFT_VMDM_GAME_WAVEIN = 90;     
+  {  }
+     MM_MSFT_ACM_MSNAUDIO = 91;     
+  {  }
+     MM_MSFT_ACM_MSG723 = 92;     
+  { Generic id for WDM Audio drivers  }
+     MM_MSFT_WDMAUDIO_WAVEOUT = 100;     
+  { Generic id for WDM Audio drivers  }
+     MM_MSFT_WDMAUDIO_WAVEIN = 101;     
+  { Generic id for WDM Audio drivers  }
+     MM_MSFT_WDMAUDIO_MIDIOUT = 102;     
+  { Generic id for WDM Audio drivers  }
+     MM_MSFT_WDMAUDIO_MIDIIN = 103;     
+  { Generic id for WDM Audio drivers  }
+     MM_MSFT_WDMAUDIO_MIXER = 104;
+
+  { MM_CREATIVE product IDs  }
+     MM_CREATIVE_SB15_WAVEIN = 1;  {  SB (r) 1.5 waveform input   }
+     MM_CREATIVE_SB20_WAVEIN = 2;
+     MM_CREATIVE_SBPRO_WAVEIN = 3;     
+     MM_CREATIVE_SBP16_WAVEIN = 4;     
+     MM_CREATIVE_PHNBLST_WAVEIN = 5;     
+     MM_CREATIVE_SB15_WAVEOUT = 101;     
+     MM_CREATIVE_SB20_WAVEOUT = 102;     
+     MM_CREATIVE_SBPRO_WAVEOUT = 103;     
+     MM_CREATIVE_SBP16_WAVEOUT = 104;     
+     MM_CREATIVE_PHNBLST_WAVEOUT = 105;     
+  {  SB (r)   }
+     MM_CREATIVE_MIDIOUT = 201;     
+  {  SB (r)   }
+     MM_CREATIVE_MIDIIN = 202;     
+  {  SB (r)   }
+     MM_CREATIVE_FMSYNTH_MONO = 301;     
+  {  SB Pro (r) stereo synthesizer   }
+     MM_CREATIVE_FMSYNTH_STEREO = 302;     
+     MM_CREATIVE_MIDI_AWE32 = 303;     
+  {  SB Pro (r) aux (CD)   }
+     MM_CREATIVE_AUX_CD = 401;     
+  {  SB Pro (r) aux (Line in )   }
+     MM_CREATIVE_AUX_LINE = 402;     
+  {  SB Pro (r) aux (mic)   }
+     MM_CREATIVE_AUX_MIC = 403;     
+     MM_CREATIVE_AUX_MASTER = 404;     
+     MM_CREATIVE_AUX_PCSPK = 405;     
+     MM_CREATIVE_AUX_WAVE = 406;     
+     MM_CREATIVE_AUX_MIDI = 407;     
+     MM_CREATIVE_SBPRO_MIXER = 408;     
+     MM_CREATIVE_SB16_MIXER = 409;
+
+  { MM_MEDIAVISION product IDs  }
+  { Pro Audio Spectrum }
+     MM_MEDIAVISION_PROAUDIO = $10;
+     MM_PROAUD_MIDIOUT = MM_MEDIAVISION_PROAUDIO+1;
+     MM_PROAUD_MIDIIN = MM_MEDIAVISION_PROAUDIO+2;
+     MM_PROAUD_SYNTH = MM_MEDIAVISION_PROAUDIO+3;
+     MM_PROAUD_WAVEOUT = MM_MEDIAVISION_PROAUDIO+4;
+     MM_PROAUD_WAVEIN = MM_MEDIAVISION_PROAUDIO+5;
+     MM_PROAUD_MIXER = MM_MEDIAVISION_PROAUDIO+6;
+     MM_PROAUD_AUX = MM_MEDIAVISION_PROAUDIO+7;
+
+  { Thunder Board }
+     MM_MEDIAVISION_THUNDER = $20;
+     MM_THUNDER_SYNTH = MM_MEDIAVISION_THUNDER+3;
+     MM_THUNDER_WAVEOUT = MM_MEDIAVISION_THUNDER+4;
+     MM_THUNDER_WAVEIN = MM_MEDIAVISION_THUNDER+5;
+     MM_THUNDER_AUX = MM_MEDIAVISION_THUNDER+7;
+
+  { Audio Port }
+     MM_MEDIAVISION_TPORT = $40;
+     MM_TPORT_WAVEOUT = MM_MEDIAVISION_TPORT+1;
+     MM_TPORT_WAVEIN = MM_MEDIAVISION_TPORT+2;
+     MM_TPORT_SYNTH = MM_MEDIAVISION_TPORT+3;
+
+  { Pro Audio Spectrum Plus }
+     MM_MEDIAVISION_PROAUDIO_PLUS = $50;
+     MM_PROAUD_PLUS_MIDIOUT = MM_MEDIAVISION_PROAUDIO_PLUS+1;
+     MM_PROAUD_PLUS_MIDIIN = MM_MEDIAVISION_PROAUDIO_PLUS+2;
+     MM_PROAUD_PLUS_SYNTH = MM_MEDIAVISION_PROAUDIO_PLUS+3;
+     MM_PROAUD_PLUS_WAVEOUT = MM_MEDIAVISION_PROAUDIO_PLUS+4;
+     MM_PROAUD_PLUS_WAVEIN = MM_MEDIAVISION_PROAUDIO_PLUS+5;
+     MM_PROAUD_PLUS_MIXER = MM_MEDIAVISION_PROAUDIO_PLUS+6;
+     MM_PROAUD_PLUS_AUX = MM_MEDIAVISION_PROAUDIO_PLUS+7;
+          
+  { Pro Audio Spectrum 16 }
+     MM_MEDIAVISION_PROAUDIO_16 = $60;     
+     MM_PROAUD_16_MIDIOUT = MM_MEDIAVISION_PROAUDIO_16+1;     
+     MM_PROAUD_16_MIDIIN = MM_MEDIAVISION_PROAUDIO_16+2;     
+     MM_PROAUD_16_SYNTH = MM_MEDIAVISION_PROAUDIO_16+3;     
+     MM_PROAUD_16_WAVEOUT = MM_MEDIAVISION_PROAUDIO_16+4;     
+     MM_PROAUD_16_WAVEIN = MM_MEDIAVISION_PROAUDIO_16+5;     
+     MM_PROAUD_16_MIXER = MM_MEDIAVISION_PROAUDIO_16+6;     
+     MM_PROAUD_16_AUX = MM_MEDIAVISION_PROAUDIO_16+7;
+
+  { Pro Audio Studio 16 }
+     MM_MEDIAVISION_PROSTUDIO_16 = $60;
+     MM_STUDIO_16_MIDIOUT = MM_MEDIAVISION_PROSTUDIO_16+1;
+     MM_STUDIO_16_MIDIIN = MM_MEDIAVISION_PROSTUDIO_16+2;
+     MM_STUDIO_16_SYNTH = MM_MEDIAVISION_PROSTUDIO_16+3;
+     MM_STUDIO_16_WAVEOUT = MM_MEDIAVISION_PROSTUDIO_16+4;
+     MM_STUDIO_16_WAVEIN = MM_MEDIAVISION_PROSTUDIO_16+5;
+     MM_STUDIO_16_MIXER = MM_MEDIAVISION_PROSTUDIO_16+6;
+     MM_STUDIO_16_AUX = MM_MEDIAVISION_PROSTUDIO_16+7;
+
+  { CDPC }
+     MM_MEDIAVISION_CDPC = $70;
+     MM_CDPC_MIDIOUT = MM_MEDIAVISION_CDPC+1;
+     MM_CDPC_MIDIIN = MM_MEDIAVISION_CDPC+2;
+     MM_CDPC_SYNTH = MM_MEDIAVISION_CDPC+3;
+     MM_CDPC_WAVEOUT = MM_MEDIAVISION_CDPC+4;
+     MM_CDPC_WAVEIN = MM_MEDIAVISION_CDPC+5;
+     MM_CDPC_MIXER = MM_MEDIAVISION_CDPC+6;
+     MM_CDPC_AUX = MM_MEDIAVISION_CDPC+7;
+     
+  { Opus MV 1208 Chipsent }
+     MM_MEDIAVISION_OPUS1208 = $80;     
+     MM_OPUS401_MIDIOUT = MM_MEDIAVISION_OPUS1208+1;     
+     MM_OPUS401_MIDIIN = MM_MEDIAVISION_OPUS1208+2;     
+     MM_OPUS1208_SYNTH = MM_MEDIAVISION_OPUS1208+3;     
+     MM_OPUS1208_WAVEOUT = MM_MEDIAVISION_OPUS1208+4;     
+     MM_OPUS1208_WAVEIN = MM_MEDIAVISION_OPUS1208+5;     
+     MM_OPUS1208_MIXER = MM_MEDIAVISION_OPUS1208+6;     
+     MM_OPUS1208_AUX = MM_MEDIAVISION_OPUS1208+7;
+
+  { Opus MV 1216 chipset }
+     MM_MEDIAVISION_OPUS1216 = $90;
+     MM_OPUS1216_MIDIOUT = MM_MEDIAVISION_OPUS1216+1;
+     MM_OPUS1216_MIDIIN = MM_MEDIAVISION_OPUS1216+2;
+     MM_OPUS1216_SYNTH = MM_MEDIAVISION_OPUS1216+3;
+     MM_OPUS1216_WAVEOUT = MM_MEDIAVISION_OPUS1216+4;
+     MM_OPUS1216_WAVEIN = MM_MEDIAVISION_OPUS1216+5;
+     MM_OPUS1216_MIXER = MM_MEDIAVISION_OPUS1216+6;
+     MM_OPUS1216_AUX = MM_MEDIAVISION_OPUS1216+7;
+
+  { MM_ARTISOFT product IDs  }
+  {  Artisoft sounding Board waveform input   }
+     MM_ARTISOFT_SBWAVEIN = 1;
+  {  Artisoft sounding Board waveform output   }
+     MM_ARTISOFT_SBWAVEOUT = 2;
+
+  { MM_IBM product IDs  }
+  {  IBM M-Motion Auxiliary Device   }
+     MM_MMOTION_WAVEAUX = 1;
+  {  IBM M-Motion Waveform output   }
+     MM_MMOTION_WAVEOUT = 2;
+  {  IBM M-Motion  Waveform Input   }
+     MM_MMOTION_WAVEIN = 3;
+  {  IBM waveform input   }
+     MM_IBM_PCMCIA_WAVEIN = 11;
+  {  IBM Waveform output   }
+     MM_IBM_PCMCIA_WAVEOUT = 12;
+  {  IBM Midi Synthesis   }
+     MM_IBM_PCMCIA_SYNTH = 13;     
+  {  IBM external MIDI in   }
+     MM_IBM_PCMCIA_MIDIIN = 14;     
+  {  IBM external MIDI out   }
+     MM_IBM_PCMCIA_MIDIOUT = 15;     
+  {  IBM auxiliary control   }
+     MM_IBM_PCMCIA_AUX = 16;     
+     MM_IBM_THINKPAD200 = 17;     
+     MM_IBM_MWAVE_WAVEIN = 18;     
+     MM_IBM_MWAVE_WAVEOUT = 19;     
+     MM_IBM_MWAVE_MIXER = 20;     
+     MM_IBM_MWAVE_MIDIIN = 21;     
+     MM_IBM_MWAVE_MIDIOUT = 22;     
+     MM_IBM_MWAVE_AUX = 23;     
+     MM_IBM_WC_MIDIOUT = 30;     
+     MM_IBM_WC_WAVEOUT = 31;     
+     MM_IBM_WC_MIXEROUT = 33;
+
+  { MM_VOCALTEC product IDs  }
+     MM_VOCALTEC_WAVEOUT = 1;
+     MM_VOCALTEC_WAVEIN = 2;
+
+  { MM_ROLAND product IDs  }
+  { MM_ROLAND_RAP10  }
+     MM_ROLAND_RAP10_MIDIOUT = 10;
+  { MM_ROLAND_RAP10  }
+     MM_ROLAND_RAP10_MIDIIN = 11;
+  { MM_ROLAND_RAP10  }
+     MM_ROLAND_RAP10_SYNTH = 12;
+  { MM_ROLAND_RAP10  }
+     MM_ROLAND_RAP10_WAVEOUT = 13;     
+  { MM_ROLAND_RAP10  }
+     MM_ROLAND_RAP10_WAVEIN = 14;     
+     MM_ROLAND_MPU401_MIDIOUT = 15;     
+     MM_ROLAND_MPU401_MIDIIN = 16;     
+     MM_ROLAND_SMPU_MIDIOUTA = 17;     
+     MM_ROLAND_SMPU_MIDIOUTB = 18;     
+     MM_ROLAND_SMPU_MIDIINA = 19;     
+     MM_ROLAND_SMPU_MIDIINB = 20;     
+     MM_ROLAND_SC7_MIDIOUT = 21;     
+     MM_ROLAND_SC7_MIDIIN = 22;     
+     MM_ROLAND_SERIAL_MIDIOUT = 23;     
+     MM_ROLAND_SERIAL_MIDIIN = 24;     
+     MM_ROLAND_SCP_MIDIOUT = 38;     
+     MM_ROLAND_SCP_MIDIIN = 39;     
+     MM_ROLAND_SCP_WAVEOUT = 40;     
+     MM_ROLAND_SCP_WAVEIN = 41;     
+     MM_ROLAND_SCP_MIXER = 42;
+     MM_ROLAND_SCP_AUX = 48;
+
+  { MM_DSP_SOLUTIONS product IDs  }
+     MM_DSP_SOLUTIONS_WAVEOUT = 1;
+     MM_DSP_SOLUTIONS_WAVEIN = 2;
+     MM_DSP_SOLUTIONS_SYNTH = 3;
+     MM_DSP_SOLUTIONS_AUX = 4;
+
+  { MM_WANGLABS product IDs  }
+  {  Input audio wave on CPU board models: Exec 4010, 4030, 3450; PC 251/25c, pc 461/25s , pc 461/33c   }
+     MM_WANGLABS_WAVEIN1 = 1;
+     MM_WANGLABS_WAVEOUT1 = 2;
+          
+  { MM_TANDY product IDs  }
+     MM_TANDY_VISWAVEIN = 1;     
+     MM_TANDY_VISWAVEOUT = 2;     
+     MM_TANDY_VISBIOSSYNTH = 3;     
+     MM_TANDY_SENS_MMAWAVEIN = 4;     
+     MM_TANDY_SENS_MMAWAVEOUT = 5;     
+     MM_TANDY_SENS_MMAMIDIIN = 6;     
+     MM_TANDY_SENS_MMAMIDIOUT = 7;     
+     MM_TANDY_SENS_VISWAVEOUT = 8;     
+     MM_TANDY_PSSJWAVEIN = 9;     
+     MM_TANDY_PSSJWAVEOUT = 10;
+         
+  { product IDs  }
+  {  HID2 WaveAudio Driver   }
+     MM_INTELOPD_WAVEIN = 1;     
+  {  HID2   }
+     MM_INTELOPD_WAVEOUT = 101;     
+  {  HID2 for mixing   }
+     MM_INTELOPD_AUX = 401;     
+     MM_INTEL_NSPMODEMLINE = 501;
+
+  { MM_INTERACTIVE product IDs  }
+     MM_INTERACTIVE_WAVEIN = $45;
+     MM_INTERACTIVE_WAVEOUT = $45;
+
+  { MM_YAMAHA product IDs  }
+     MM_YAMAHA_GSS_SYNTH = $01;     
+     MM_YAMAHA_GSS_WAVEOUT = $02;     
+     MM_YAMAHA_GSS_WAVEIN = $03;     
+     MM_YAMAHA_GSS_MIDIOUT = $04;     
+     MM_YAMAHA_GSS_MIDIIN = $05;     
+     MM_YAMAHA_GSS_AUX = $06;     
+     MM_YAMAHA_SERIAL_MIDIOUT = $07;     
+     MM_YAMAHA_SERIAL_MIDIIN = $08;     
+     MM_YAMAHA_OPL3SA_WAVEOUT = $10;     
+     MM_YAMAHA_OPL3SA_WAVEIN = $11;     
+     MM_YAMAHA_OPL3SA_FMSYNTH = $12;     
+     MM_YAMAHA_OPL3SA_YSYNTH = $13;     
+     MM_YAMAHA_OPL3SA_MIDIOUT = $14;     
+     MM_YAMAHA_OPL3SA_MIDIIN = $15;     
+     MM_YAMAHA_OPL3SA_MIXER = $17;
+     MM_YAMAHA_OPL3SA_JOYSTICK = $18;
+
+  { MM_EVEREX product IDs  }
+     MM_EVEREX_CARRIER = $01;
+
+  { MM_ECHO product IDs  }
+     MM_ECHO_SYNTH = $01;
+     MM_ECHO_WAVEOUT = $02;
+     MM_ECHO_WAVEIN = $03;
+     MM_ECHO_MIDIOUT = $04;
+     MM_ECHO_MIDIIN = $05;
+     MM_ECHO_AUX = $06;
+
+  { MM_SIERRA product IDs  }
+     MM_SIERRA_ARIA_MIDIOUT = $14;
+     MM_SIERRA_ARIA_MIDIIN = $15;
+     MM_SIERRA_ARIA_SYNTH = $16;
+     MM_SIERRA_ARIA_WAVEOUT = $17;
+     MM_SIERRA_ARIA_WAVEIN = $18;
+     MM_SIERRA_ARIA_AUX = $19;
+     MM_SIERRA_ARIA_AUX2 = $20;
+     MM_SIERRA_QUARTET_WAVEIN = $50;
+     MM_SIERRA_QUARTET_WAVEOUT = $51;
+     MM_SIERRA_QUARTET_MIDIIN = $52;
+     MM_SIERRA_QUARTET_MIDIOUT = $53;
+     MM_SIERRA_QUARTET_SYNTH = $54;
+     MM_SIERRA_QUARTET_AUX_CD = $55;
+     MM_SIERRA_QUARTET_AUX_LINE = $56;
+     MM_SIERRA_QUARTET_AUX_MODEM = $57;
+     MM_SIERRA_QUARTET_MIXER = $58;
+
+  { MM_CAT product IDs  }
+     MM_CAT_WAVEOUT = 1;
+
+  { MM_DSP_GROUP product IDs  }
+     MM_DSP_GROUP_TRUESPEECH = $01;
+
+  { MM_MELABS product IDs  }
+     MM_MELABS_MIDI2GO = $01;
+
+  { MM_ESS product IDs  }
+     MM_ESS_AMWAVEOUT = $01;
+     MM_ESS_AMWAVEIN = $02;
+     MM_ESS_AMAUX = $03;
+     MM_ESS_AMSYNTH = $04;
+     MM_ESS_AMMIDIOUT = $05;
+     MM_ESS_AMMIDIIN = $06;
+     MM_ESS_MIXER = $07;     
+     MM_ESS_AUX_CD = $08;     
+     MM_ESS_MPU401_MIDIOUT = $09;     
+     MM_ESS_MPU401_MIDIIN = $0A;     
+     MM_ESS_ES488_WAVEOUT = $10;     
+     MM_ESS_ES488_WAVEIN = $11;     
+     MM_ESS_ES488_MIXER = $12;     
+     MM_ESS_ES688_WAVEOUT = $13;     
+     MM_ESS_ES688_WAVEIN = $14;     
+     MM_ESS_ES688_MIXER = $15;     
+     MM_ESS_ES1488_WAVEOUT = $16;     
+     MM_ESS_ES1488_WAVEIN = $17;     
+     MM_ESS_ES1488_MIXER = $18;     
+     MM_ESS_ES1688_WAVEOUT = $19;     
+     MM_ESS_ES1688_WAVEIN = $1A;     
+     MM_ESS_ES1688_MIXER = $1B;     
+     MM_ESS_ES1788_WAVEOUT = $1C;     
+     MM_ESS_ES1788_WAVEIN = $1D;     
+     MM_ESS_ES1788_MIXER = $1E;     
+     MM_ESS_ES1888_WAVEOUT = $1F;     
+     MM_ESS_ES1888_WAVEIN = $20;     
+     MM_ESS_ES1888_MIXER = $21;     
+     MM_ESS_ES1868_WAVEOUT = $22;     
+     MM_ESS_ES1868_WAVEIN = $23;     
+     MM_ESS_ES1868_MIXER = $24;     
+     MM_ESS_ES1878_WAVEOUT = $25;     
+     MM_ESS_ES1878_WAVEIN = $26;     
+     MM_ESS_ES1878_MIXER = $27;
+
+  { product IDs  }
+     MM_EPS_FMSND = 1;
+
+  { MM_TRUEVISION product IDs  }
+     MM_TRUEVISION_WAVEIN1 = 1;
+     MM_TRUEVISION_WAVEOUT1 = 2;
+          
+  { MM_AZTECH product IDs  }
+     MM_AZTECH_MIDIOUT = 3;     
+     MM_AZTECH_MIDIIN = 4;     
+     MM_AZTECH_WAVEIN = 17;     
+     MM_AZTECH_WAVEOUT = 18;     
+     MM_AZTECH_FMSYNTH = 20;     
+     MM_AZTECH_MIXER = 21;     
+     MM_AZTECH_PRO16_WAVEIN = 33;     
+     MM_AZTECH_PRO16_WAVEOUT = 34;     
+     MM_AZTECH_PRO16_FMSYNTH = 38;     
+     MM_AZTECH_DSP16_WAVEIN = 65;     
+     MM_AZTECH_DSP16_WAVEOUT = 66;     
+     MM_AZTECH_DSP16_FMSYNTH = 68;     
+     MM_AZTECH_DSP16_WAVESYNTH = 70;     
+     MM_AZTECH_NOVA16_WAVEIN = 71;     
+     MM_AZTECH_NOVA16_WAVEOUT = 72;     
+     MM_AZTECH_NOVA16_MIXER = 73;     
+     MM_AZTECH_WASH16_WAVEIN = 74;     
+     MM_AZTECH_WASH16_WAVEOUT = 75;     
+     MM_AZTECH_WASH16_MIXER = 76;     
+     MM_AZTECH_AUX_CD = 401;     
+     MM_AZTECH_AUX_LINE = 402;     
+     MM_AZTECH_AUX_MIC = 403;     
+     MM_AZTECH_AUX = 404;
+
+  { MM_VIDEOLOGIC product IDs  }
+     MM_VIDEOLOGIC_MSWAVEIN = 1;
+     MM_VIDEOLOGIC_MSWAVEOUT = 2;
+
+  { MM_KORG product IDs  }
+     MM_KORG_PCIF_MIDIOUT = 1;
+     MM_KORG_PCIF_MIDIIN = 2;
+
+  { MM_APT product IDs  }
+     MM_APT_ACE100CD = 1;
+
+  { MM_ICS product IDs  }
+  {  MS WSS compatible card and driver   }
+     MM_ICS_WAVEDECK_WAVEOUT = 1;     
+     MM_ICS_WAVEDECK_WAVEIN = 2;     
+     MM_ICS_WAVEDECK_MIXER = 3;     
+     MM_ICS_WAVEDECK_AUX = 4;     
+     MM_ICS_WAVEDECK_SYNTH = 5;     
+     MM_ICS_WAVEDEC_SB_WAVEOUT = 6;     
+     MM_ICS_WAVEDEC_SB_WAVEIN = 7;     
+     MM_ICS_WAVEDEC_SB_FM_MIDIOUT = 8;     
+     MM_ICS_WAVEDEC_SB_MPU401_MIDIOUT = 9;     
+     MM_ICS_WAVEDEC_SB_MPU401_MIDIIN = 10;     
+     MM_ICS_WAVEDEC_SB_MIXER = 11;     
+     MM_ICS_WAVEDEC_SB_AUX = 12;     
+     MM_ICS_2115_LITE_MIDIOUT = 13;     
+     MM_ICS_2120_LITE_MIDIOUT = 14;
+
+  { MM_ITERATEDSYS product IDs  }
+     MM_ITERATEDSYS_FUFCODEC = 1;
+
+  { MM_METHEUS product IDs  }
+     MM_METHEUS_ZIPPER = 1;
+
+  { MM_WINNOV product IDs  }
+     MM_WINNOV_CAVIAR_WAVEIN = 1;
+     MM_WINNOV_CAVIAR_WAVEOUT = 2;
+     MM_WINNOV_CAVIAR_VIDC = 3;
+  {  Fourcc is CHAM   }
+     MM_WINNOV_CAVIAR_CHAMPAGNE = 4;     
+  {  Fourcc is YUV8   }
+     MM_WINNOV_CAVIAR_YUV8 = 5;
+
+  { MM_NCR product IDs  }
+     MM_NCR_BA_WAVEIN = 1;
+     MM_NCR_BA_WAVEOUT = 2;
+     MM_NCR_BA_SYNTH = 3;
+     MM_NCR_BA_AUX = 4;
+     MM_NCR_BA_MIXER = 5;
+
+  { MM_VITEC product IDs  }
+     MM_VITEC_VMAKER = 1;
+     MM_VITEC_VMPRO = 2;
+
+  { MM_MOSCOM product IDs  }
+  {  Four Port Voice Processing / Voice Recognition Board   }
+     MM_MOSCOM_VPC2400_IN = 1;     
+  {  VPC2400  }
+     MM_MOSCOM_VPC2400_OUT = 2;
+
+  { MM_SILICONSOFT product IDs  }
+  {  Waveform in , high sample rate   }
+     MM_SILICONSOFT_SC1_WAVEIN = 1;
+  {  Waveform out , high sample rate   }
+     MM_SILICONSOFT_SC1_WAVEOUT = 2;
+  {  Waveform in 2 channels, high sample rate   }
+     MM_SILICONSOFT_SC2_WAVEIN = 3;
+  {  Waveform out 2 channels, high sample rate   }
+     MM_SILICONSOFT_SC2_WAVEOUT = 4;
+  {  Waveform out, self powered, efficient   }
+     MM_SILICONSOFT_SOUNDJR2_WAVEOUT = 5;
+  {  Waveform in, self powered, efficient   }
+     MM_SILICONSOFT_SOUNDJR2PR_WAVEIN = 6;
+  {  Waveform out 2 channels, self powered, efficient   }
+     MM_SILICONSOFT_SOUNDJR2PR_WAVEOUT = 7;
+  {  Waveform in 2 channels, self powered, efficient   }
+     MM_SILICONSOFT_SOUNDJR3_WAVEOUT = 8;
+
+  { MM_OLIVETTI product IDs  }
+     MM_OLIVETTI_WAVEIN = 1;     
+     MM_OLIVETTI_WAVEOUT = 2;     
+     MM_OLIVETTI_MIXER = 3;     
+     MM_OLIVETTI_AUX = 4;     
+     MM_OLIVETTI_MIDIIN = 5;     
+     MM_OLIVETTI_MIDIOUT = 6;     
+     MM_OLIVETTI_SYNTH = 7;     
+     MM_OLIVETTI_JOYSTICK = 8;     
+     MM_OLIVETTI_ACM_GSM = 9;     
+     MM_OLIVETTI_ACM_ADPCM = 10;     
+     MM_OLIVETTI_ACM_CELP = 11;     
+     MM_OLIVETTI_ACM_SBC = 12;     
+     MM_OLIVETTI_ACM_OPR = 13;
+
+  { MM_IOMAGIC product IDs  }
+  {  The I/O Magic Tempo is a PCMCIA Type 2 audio card featuring wave audio
+      record and playback, FM synthesizer, and MIDI output.  The I/O Magic
+      Tempo WaveOut device supports mono and stereo PCM playback at rates
+      of 7350, 11025, 22050, and  44100 samples  }
+     MM_IOMAGIC_TEMPO_WAVEOUT = 1;
+     MM_IOMAGIC_TEMPO_WAVEIN = 2;
+     MM_IOMAGIC_TEMPO_SYNTH = 3;
+     MM_IOMAGIC_TEMPO_MIDIOUT = 4;
+     MM_IOMAGIC_TEMPO_MXDOUT = 5;
+     MM_IOMAGIC_TEMPO_AUXOUT = 6;
+
+  { MM_MATSUSHITA product IDs  }
+     MM_MATSUSHITA_WAVEIN = 1;
+     MM_MATSUSHITA_WAVEOUT = 2;
+     MM_MATSUSHITA_FMSYNTH_STEREO = 3;
+     MM_MATSUSHITA_MIXER = 4;
+     MM_MATSUSHITA_AUX = 5;
+
+  { MM_NEWMEDIA product IDs  }
+  {  WSS Compatible sound card.   }
+     MM_NEWMEDIA_WAVJAMMER = 1;
+
+  { MM_LYRRUS product IDs  }
+  {  Bridge is a MIDI driver that allows the the Lyrrus G-VOX hardware to
+      communicate with Windows base transcription and sequencer applications.
+      The driver also provides a mechanism for the user to configure the system
+      to their personal playing style.  }
+     MM_LYRRUS_BRIDGE_GUITAR = 1;
+
+  { MM_OPTI product IDs  }
+     MM_OPTI_M16_FMSYNTH_STEREO = $0001;
+     MM_OPTI_M16_MIDIIN = $0002;
+     MM_OPTI_M16_MIDIOUT = $0003;
+     MM_OPTI_M16_WAVEIN = $0004;
+     MM_OPTI_M16_WAVEOUT = $0005;
+     MM_OPTI_M16_MIXER = $0006;
+     MM_OPTI_M16_AUX = $0007;
+     MM_OPTI_P16_FMSYNTH_STEREO = $0010;
+     MM_OPTI_P16_MIDIIN = $0011;
+     MM_OPTI_P16_MIDIOUT = $0012;
+     MM_OPTI_P16_WAVEIN = $0013;
+     MM_OPTI_P16_WAVEOUT = $0014;
+     MM_OPTI_P16_MIXER = $0015;
+     MM_OPTI_P16_AUX = $0016;
+     MM_OPTI_M32_WAVEIN = $0020;
+     MM_OPTI_M32_WAVEOUT = $0021;
+     MM_OPTI_M32_MIDIIN = $0022;
+     MM_OPTI_M32_MIDIOUT = $0023;
+     MM_OPTI_M32_SYNTH_STEREO = $0024;
+     MM_OPTI_M32_MIXER = $0025;
+     MM_OPTI_M32_AUX = $0026;
+
+  {  Product IDs for     MM_ADDX    -  ADDX     }
+  { MM_ADDX_PCTV_DIGITALMIX  }
+     MM_ADDX_PCTV_DIGITALMIX = 1;
+  { MM_ADDX_PCTV_WAVEIN  }
+     MM_ADDX_PCTV_WAVEIN = 2;
+  { MM_ADDX_PCTV_WAVEOUT  }
+     MM_ADDX_PCTV_WAVEOUT = 3;
+  { MM_ADDX_PCTV_MIXER  }
+     MM_ADDX_PCTV_MIXER = 4;
+  { MM_ADDX_PCTV_AUX_CD  }
+     MM_ADDX_PCTV_AUX_CD = 5;
+  { MM_ADDX_PCTV_AUX_LINE  }
+     MM_ADDX_PCTV_AUX_LINE = 6;
+
+  {  Product IDs for     MM_AHEAD    -  Ahead, Inc.     }
+     MM_AHEAD_MULTISOUND = 1;
+     MM_AHEAD_SOUNDBLASTER = 2;
+     MM_AHEAD_PROAUDIO = 3;
+     MM_AHEAD_GENERIC = 4;
+
+  {  Product IDs for     MM_AMD    -  AMD     }
+     MM_AMD_INTERWAVE_WAVEIN = 1;     
+     MM_AMD_INTERWAVE_WAVEOUT = 2;     
+     MM_AMD_INTERWAVE_SYNTH = 3;     
+     MM_AMD_INTERWAVE_MIXER1 = 4;     
+     MM_AMD_INTERWAVE_MIXER2 = 5;     
+     MM_AMD_INTERWAVE_JOYSTICK = 6;     
+     MM_AMD_INTERWAVE_EX_CD = 7;     
+     MM_AMD_INTERWAVE_MIDIIN = 8;     
+     MM_AMD_INTERWAVE_MIDIOUT = 9;     
+     MM_AMD_INTERWAVE_AUX1 = 10;     
+     MM_AMD_INTERWAVE_AUX2 = 11;     
+     MM_AMD_INTERWAVE_AUX_MIC = 12;     
+     MM_AMD_INTERWAVE_AUX_CD = 13;     
+     MM_AMD_INTERWAVE_MONO_IN = 14;     
+     MM_AMD_INTERWAVE_MONO_OUT = 15;     
+     MM_AMD_INTERWAVE_EX_TELEPHONY = 16;     
+     MM_AMD_INTERWAVE_WAVEOUT_BASE = 17;     
+     MM_AMD_INTERWAVE_WAVEOUT_TREBLE = 18;     
+     MM_AMD_INTERWAVE_STEREO_ENHANCED = 19;
+     
+  {  Product IDs for     MM_AST    -  AST Research Inc.     }
+     MM_AST_MODEMWAVE_WAVEIN = 13;     
+     MM_AST_MODEMWAVE_WAVEOUT = 14;
+
+  {  Product IDs for     MM_BROOKTREE    -  Brooktree Corporation     }
+  { Brooktree PCM Wave Audio In  }
+     MM_BTV_WAVEIN = 1;
+  { Brooktree PCM Wave Audio Out  }
+     MM_BTV_WAVEOUT = 2;
+  { Brooktree MIDI In  }
+     MM_BTV_MIDIIN = 3;
+  { Brooktree MIDI out  }
+     MM_BTV_MIDIOUT = 4;
+  { Brooktree MIDI FM synth  }
+     MM_BTV_MIDISYNTH = 5;
+  { Brooktree Line Input  }
+     MM_BTV_AUX_LINE = 6;
+  { Brooktree Microphone Input  }
+     MM_BTV_AUX_MIC = 7;
+  { Brooktree CD Input  }
+     MM_BTV_AUX_CD = 8;
+  { Brooktree PCM Wave in with subcode information  }
+     MM_BTV_DIGITALIN = 9;
+  { Brooktree PCM Wave out with subcode information  }
+     MM_BTV_DIGITALOUT = 10;
+  { Brooktree WaveStream  }
+     MM_BTV_MIDIWAVESTREAM = 11;
+  { Brooktree WSS Mixer driver  }
+     MM_BTV_MIXER = 12;
+
+  {  Product IDs for     MM_CANAM    -  CANAM Computers     }
+     MM_CANAM_CBXWAVEOUT = 1;
+     MM_CANAM_CBXWAVEIN = 2;
+
+  {  Product IDs for     MM_CASIO    -  Casio Computer Co., LTD     }
+  { wp150  }
+     MM_CASIO_WP150_MIDIOUT = 1;
+     MM_CASIO_WP150_MIDIIN = 2;
+
+  {  Product IDs for     MM_COMPAQ    -  Compaq Computer Corp.     }
+     MM_COMPAQ_BB_WAVEIN = 1;
+     MM_COMPAQ_BB_WAVEOUT = 2;
+     MM_COMPAQ_BB_WAVEAUX = 3;
+
+  {  Product IDs for     MM_COREDYNAMICS    -  Core Dynamics     }
+  { DynaMax Hi-Rez  }
+     MM_COREDYNAMICS_DYNAMIXHR = 1;
+  { DynaSonix  }
+     MM_COREDYNAMICS_DYNASONIX_SYNTH = 2;
+     MM_COREDYNAMICS_DYNASONIX_MIDI_IN = 3;
+     MM_COREDYNAMICS_DYNASONIX_MIDI_OUT = 4;
+     MM_COREDYNAMICS_DYNASONIX_WAVE_IN = 5;
+     MM_COREDYNAMICS_DYNASONIX_WAVE_OUT = 6;
+     MM_COREDYNAMICS_DYNASONIX_AUDIO_IN = 7;
+     MM_COREDYNAMICS_DYNASONIX_AUDIO_OUT = 8;
+  { DynaGrfx  }
+     MM_COREDYNAMICS_DYNAGRAFX_VGA = 9;     
+     MM_COREDYNAMICS_DYNAGRAFX_WAVE_IN = 10;     
+     MM_COREDYNAMICS_DYNAGRAFX_WAVE_OUT = 11;
+
+  {  Product IDs for     MM_CRYSTAL    -  Crystal Semiconductor Corporation     }
+     MM_CRYSTAL_CS4232_WAVEIN = 1;
+     MM_CRYSTAL_CS4232_WAVEOUT = 2;
+     MM_CRYSTAL_CS4232_WAVEMIXER = 3;
+     MM_CRYSTAL_CS4232_WAVEAUX_AUX1 = 4;
+     MM_CRYSTAL_CS4232_WAVEAUX_AUX2 = 5;
+     MM_CRYSTAL_CS4232_WAVEAUX_LINE = 6;
+     MM_CRYSTAL_CS4232_WAVEAUX_MONO = 7;
+     MM_CRYSTAL_CS4232_WAVEAUX_MASTER = 8;
+     MM_CRYSTAL_CS4232_MIDIIN = 9;
+     MM_CRYSTAL_CS4232_MIDIOUT = 10;
+     MM_CRYSTAL_CS4232_INPUTGAIN_AUX1 = 13;
+     MM_CRYSTAL_CS4232_INPUTGAIN_LOOP = 14;
+
+  {  Product IDs for     MM_DDD    -  Danka Data Devices     }
+     MM_DDD_MIDILINK_MIDIIN = 1;
+     MM_DDD_MIDILINK_MIDIOUT = 2;
+
+  {  Product IDs for     MM_DIACOUSTICS    -  DiAcoustics, Inc.     }
+  { Drum Action  }
+     MM_DIACOUSTICS_DRUM_ACTION = 1;
+          
+  {  Product IDs for     MM_DIAMONDMM    -  Diamond Multimedia     }
+  { Freedom Audio  }
+     MM_DIMD_PLATFORM = 0;     
+     MM_DIMD_DIRSOUND = 1;     
+     MM_DIMD_VIRTMPU = 2;     
+     MM_DIMD_VIRTSB = 3;     
+     MM_DIMD_VIRTJOY = 4;     
+     MM_DIMD_WAVEIN = 5;     
+     MM_DIMD_WAVEOUT = 6;     
+     MM_DIMD_MIDIIN = 7;     
+     MM_DIMD_MIDIOUT = 8;     
+     MM_DIMD_AUX_LINE = 9;     
+     MM_DIMD_MIXER = 10;
+
+  {  Product IDs for     MM_DIGITAL_AUDIO_LABS    -  Digital Audio Labs, Inc.     }
+     MM_DIGITAL_AUDIO_LABS_V8 = $10;
+     MM_DIGITAL_AUDIO_LABS_CPRO = $11;
+
+  {  Product IDs for     MM_DIGITAL    -  Digital Equipment Corporation     }
+  { Digital Audio Video Compression Board  }
+     MM_DIGITAL_AV320_WAVEIN = 1;
+  { Digital Audio Video Compression Board  }
+     MM_DIGITAL_AV320_WAVEOUT = 2;
+          
+  {  Product IDs for     MM_ECS    -  Electronic Courseware Systems, Inc.     }
+     MM_ECS_AADF_MIDI_IN = 10;     
+     MM_ECS_AADF_MIDI_OUT = 11;     
+     MM_ECS_AADF_WAVE2MIDI_IN = 12;
+
+  {  Product IDs for     MM_ENSONIQ    -  ENSONIQ Corporation     }
+  { ENSONIQ Soundscape  }
+     MM_ENSONIQ_SOUNDSCAPE = $10;
+     MM_SOUNDSCAPE_WAVEOUT              = MM_ENSONIQ_SOUNDSCAPE+1;
+     MM_SOUNDSCAPE_WAVEOUT_AUX          = MM_ENSONIQ_SOUNDSCAPE+2;
+     MM_SOUNDSCAPE_WAVEIN               = MM_ENSONIQ_SOUNDSCAPE+3;
+     MM_SOUNDSCAPE_MIDIOUT              = MM_ENSONIQ_SOUNDSCAPE+4;
+     MM_SOUNDSCAPE_MIDIIN               = MM_ENSONIQ_SOUNDSCAPE+5;
+     MM_SOUNDSCAPE_SYNTH                = MM_ENSONIQ_SOUNDSCAPE+6;
+     MM_SOUNDSCAPE_MIXER                = MM_ENSONIQ_SOUNDSCAPE+7;
+     MM_SOUNDSCAPE_AUX                  = MM_ENSONIQ_SOUNDSCAPE+8;
+
+    {  Product IDs for     MM_FRONTIER    -  Frontier Design Group LLC     }
+    { WaveCenter  }
+       MM_FRONTIER_WAVECENTER_MIDIIN = 1;       
+       MM_FRONTIER_WAVECENTER_MIDIOUT = 2;       
+       MM_FRONTIER_WAVECENTER_WAVEIN = 3;       
+       MM_FRONTIER_WAVECENTER_WAVEOUT = 4;
+
+    {  Product IDs for     MM_GADGETLABS    -  Gadget Labs LLC     }
+       MM_GADGETLABS_WAVE44_WAVEIN = 1;
+       MM_GADGETLABS_WAVE44_WAVEOUT = 2;
+       MM_GADGETLABS_WAVE42_WAVEIN = 3;
+       MM_GADGETLABS_WAVE42_WAVEOUT = 4;
+       MM_GADGETLABS_WAVE4_MIDIIN = 5;
+       MM_GADGETLABS_WAVE4_MIDIOUT = 6;
+
+    {  Product IDs for     MM_KAY_ELEMETRICS    -  Kay Elemetrics, Inc.     }
+       MM_KAY_ELEMETRICS_CSL = $4300;
+       MM_KAY_ELEMETRICS_CSL_DAT = $4308;
+       MM_KAY_ELEMETRICS_CSL_4CHANNEL = $4309;
+
+    {  Product IDs for     MM_LERNOUT_AND_HAUSPIE    -  Lernout & Hauspie     }
+       MM_LERNOUT_ANDHAUSPIE_LHCODECACM = 1;
+
+    {  Product IDs for     MM_MPTUS    -  M.P. Technologies, Inc.     }
+    { Sound Pallette  }
+       MM_MPTUS_SPWAVEOUT = 1;
+
+    {  Product IDs for     MM_MOTU    -  Mark of the Unicorn     }
+       MM_MOTU_MTP_MIDIOUT_ALL = 100;
+       MM_MOTU_MTP_MIDIIN_1 = 101;
+       MM_MOTU_MTP_MIDIOUT_1 = 101;
+       MM_MOTU_MTP_MIDIIN_2 = 102;
+       MM_MOTU_MTP_MIDIOUT_2 = 102;
+       MM_MOTU_MTP_MIDIIN_3 = 103;
+       MM_MOTU_MTP_MIDIOUT_3 = 103;
+       MM_MOTU_MTP_MIDIIN_4 = 104;       
+       MM_MOTU_MTP_MIDIOUT_4 = 104;       
+       MM_MOTU_MTP_MIDIIN_5 = 105;       
+       MM_MOTU_MTP_MIDIOUT_5 = 105;       
+       MM_MOTU_MTP_MIDIIN_6 = 106;       
+       MM_MOTU_MTP_MIDIOUT_6 = 106;       
+       MM_MOTU_MTP_MIDIIN_7 = 107;       
+       MM_MOTU_MTP_MIDIOUT_7 = 107;       
+       MM_MOTU_MTP_MIDIIN_8 = 108;       
+       MM_MOTU_MTP_MIDIOUT_8 = 108;       
+       MM_MOTU_MTPII_MIDIOUT_ALL = 200;       
+       MM_MOTU_MTPII_MIDIIN_SYNC = 200;       
+       MM_MOTU_MTPII_MIDIIN_1 = 201;       
+       MM_MOTU_MTPII_MIDIOUT_1 = 201;       
+       MM_MOTU_MTPII_MIDIIN_2 = 202;       
+       MM_MOTU_MTPII_MIDIOUT_2 = 202;       
+       MM_MOTU_MTPII_MIDIIN_3 = 203;       
+       MM_MOTU_MTPII_MIDIOUT_3 = 203;       
+       MM_MOTU_MTPII_MIDIIN_4 = 204;       
+       MM_MOTU_MTPII_MIDIOUT_4 = 204;       
+       MM_MOTU_MTPII_MIDIIN_5 = 205;       
+       MM_MOTU_MTPII_MIDIOUT_5 = 205;       
+       MM_MOTU_MTPII_MIDIIN_6 = 206;       
+       MM_MOTU_MTPII_MIDIOUT_6 = 206;       
+       MM_MOTU_MTPII_MIDIIN_7 = 207;       
+       MM_MOTU_MTPII_MIDIOUT_7 = 207;       
+       MM_MOTU_MTPII_MIDIIN_8 = 208;       
+       MM_MOTU_MTPII_MIDIOUT_8 = 208;       
+       MM_MOTU_MTPII_NET_MIDIIN_1 = 209;       
+       MM_MOTU_MTPII_NET_MIDIOUT_1 = 209;       
+       MM_MOTU_MTPII_NET_MIDIIN_2 = 210;       
+       MM_MOTU_MTPII_NET_MIDIOUT_2 = 210;       
+       MM_MOTU_MTPII_NET_MIDIIN_3 = 211;       
+       MM_MOTU_MTPII_NET_MIDIOUT_3 = 211;       
+       MM_MOTU_MTPII_NET_MIDIIN_4 = 212;       
+       MM_MOTU_MTPII_NET_MIDIOUT_4 = 212;       
+       MM_MOTU_MTPII_NET_MIDIIN_5 = 213;       
+       MM_MOTU_MTPII_NET_MIDIOUT_5 = 213;       
+       MM_MOTU_MTPII_NET_MIDIIN_6 = 214;       
+       MM_MOTU_MTPII_NET_MIDIOUT_6 = 214;       
+       MM_MOTU_MTPII_NET_MIDIIN_7 = 215;       
+       MM_MOTU_MTPII_NET_MIDIOUT_7 = 215;       
+       MM_MOTU_MTPII_NET_MIDIIN_8 = 216;       
+       MM_MOTU_MTPII_NET_MIDIOUT_8 = 216;       
+       MM_MOTU_MXP_MIDIIN_MIDIOUT_ALL = 300;       
+       MM_MOTU_MXP_MIDIIN_SYNC = 300;       
+       MM_MOTU_MXP_MIDIIN_MIDIIN_1 = 301;       
+       MM_MOTU_MXP_MIDIIN_MIDIOUT_1 = 301;       
+       MM_MOTU_MXP_MIDIIN_MIDIIN_2 = 302;       
+       MM_MOTU_MXP_MIDIIN_MIDIOUT_2 = 302;       
+       MM_MOTU_MXP_MIDIIN_MIDIIN_3 = 303;       
+       MM_MOTU_MXP_MIDIIN_MIDIOUT_3 = 303;       
+       MM_MOTU_MXP_MIDIIN_MIDIIN_4 = 304;       
+       MM_MOTU_MXP_MIDIIN_MIDIOUT_4 = 304;       
+       MM_MOTU_MXP_MIDIIN_MIDIIN_5 = 305;       
+       MM_MOTU_MXP_MIDIIN_MIDIOUT_5 = 305;       
+       MM_MOTU_MXP_MIDIIN_MIDIIN_6 = 306;       
+       MM_MOTU_MXP_MIDIIN_MIDIOUT_6 = 306;       
+       MM_MOTU_MXPMPU_MIDIOUT_ALL = 400;       
+       MM_MOTU_MXPMPU_MIDIIN_SYNC = 400;       
+       MM_MOTU_MXPMPU_MIDIIN_1 = 401;       
+       MM_MOTU_MXPMPU_MIDIOUT_1 = 401;       
+       MM_MOTU_MXPMPU_MIDIIN_2 = 402;       
+       MM_MOTU_MXPMPU_MIDIOUT_2 = 402;       
+       MM_MOTU_MXPMPU_MIDIIN_3 = 403;       
+       MM_MOTU_MXPMPU_MIDIOUT_3 = 403;       
+       MM_MOTU_MXPMPU_MIDIIN_4 = 404;       
+       MM_MOTU_MXPMPU_MIDIOUT_4 = 404;       
+       MM_MOTU_MXPMPU_MIDIIN_5 = 405;       
+       MM_MOTU_MXPMPU_MIDIOUT_5 = 405;       
+       MM_MOTU_MXPMPU_MIDIIN_6 = 406;       
+       MM_MOTU_MXPMPU_MIDIOUT_6 = 406;       
+       MM_MOTU_MXN_MIDIOUT_ALL = 500;       
+       MM_MOTU_MXN_MIDIIN_SYNC = 500;       
+       MM_MOTU_MXN_MIDIIN_1 = 501;       
+       MM_MOTU_MXN_MIDIOUT_1 = 501;       
+       MM_MOTU_MXN_MIDIIN_2 = 502;       
+       MM_MOTU_MXN_MIDIOUT_2 = 502;       
+       MM_MOTU_MXN_MIDIIN_3 = 503;       
+       MM_MOTU_MXN_MIDIOUT_3 = 503;       
+       MM_MOTU_MXN_MIDIIN_4 = 504;       
+       MM_MOTU_MXN_MIDIOUT_4 = 504;       
+       MM_MOTU_FLYER_MIDI_IN_SYNC = 600;       
+       MM_MOTU_FLYER_MIDI_IN_A = 601;       
+       MM_MOTU_FLYER_MIDI_OUT_A = 601;       
+       MM_MOTU_FLYER_MIDI_IN_B = 602;       
+       MM_MOTU_FLYER_MIDI_OUT_B = 602;       
+       MM_MOTU_PKX_MIDI_IN_SYNC = 700;       
+       MM_MOTU_PKX_MIDI_IN_A = 701;       
+       MM_MOTU_PKX_MIDI_OUT_A = 701;       
+       MM_MOTU_PKX_MIDI_IN_B = 702;       
+       MM_MOTU_PKX_MIDI_OUT_B = 702;       
+       MM_MOTU_DTX_MIDI_IN_SYNC = 800;       
+       MM_MOTU_DTX_MIDI_IN_A = 801;       
+       MM_MOTU_DTX_MIDI_OUT_A = 801;       
+       MM_MOTU_DTX_MIDI_IN_B = 802;       
+       MM_MOTU_DTX_MIDI_OUT_B = 802;       
+       MM_MOTU_MTPAV_MIDIOUT_ALL = 900;       
+       MM_MOTU_MTPAV_MIDIIN_SYNC = 900;       
+       MM_MOTU_MTPAV_MIDIIN_1 = 901;       
+       MM_MOTU_MTPAV_MIDIOUT_1 = 901;       
+       MM_MOTU_MTPAV_MIDIIN_2 = 902;       
+       MM_MOTU_MTPAV_MIDIOUT_2 = 902;       
+       MM_MOTU_MTPAV_MIDIIN_3 = 903;       
+       MM_MOTU_MTPAV_MIDIOUT_3 = 903;       
+       MM_MOTU_MTPAV_MIDIIN_4 = 904;       
+       MM_MOTU_MTPAV_MIDIOUT_4 = 904;       
+       MM_MOTU_MTPAV_MIDIIN_5 = 905;       
+       MM_MOTU_MTPAV_MIDIOUT_5 = 905;       
+       MM_MOTU_MTPAV_MIDIIN_6 = 906;       
+       MM_MOTU_MTPAV_MIDIOUT_6 = 906;       
+       MM_MOTU_MTPAV_MIDIIN_7 = 907;       
+       MM_MOTU_MTPAV_MIDIOUT_7 = 907;       
+       MM_MOTU_MTPAV_MIDIIN_8 = 908;       
+       MM_MOTU_MTPAV_MIDIOUT_8 = 908;       
+       MM_MOTU_MTPAV_NET_MIDIIN_1 = 909;       
+       MM_MOTU_MTPAV_NET_MIDIOUT_1 = 909;       
+       MM_MOTU_MTPAV_NET_MIDIIN_2 = 910;       
+       MM_MOTU_MTPAV_NET_MIDIOUT_2 = 910;       
+       MM_MOTU_MTPAV_NET_MIDIIN_3 = 911;       
+       MM_MOTU_MTPAV_NET_MIDIOUT_3 = 911;       
+       MM_MOTU_MTPAV_NET_MIDIIN_4 = 912;       
+       MM_MOTU_MTPAV_NET_MIDIOUT_4 = 912;       
+       MM_MOTU_MTPAV_NET_MIDIIN_5 = 913;       
+       MM_MOTU_MTPAV_NET_MIDIOUT_5 = 913;       
+       MM_MOTU_MTPAV_NET_MIDIIN_6 = 914;       
+       MM_MOTU_MTPAV_NET_MIDIOUT_6 = 914;       
+       MM_MOTU_MTPAV_NET_MIDIIN_7 = 915;       
+       MM_MOTU_MTPAV_NET_MIDIOUT_7 = 915;       
+       MM_MOTU_MTPAV_NET_MIDIIN_8 = 916;       
+       MM_MOTU_MTPAV_NET_MIDIOUT_8 = 916;       
+       MM_MOTU_MTPAV_MIDIIN_ADAT = 917;       
+       MM_MOTU_MTPAV_MIDIOUT_ADAT = 917;
+
+    {  Product IDs for     MM_MIRO    -  miro Computer Products AG     }
+    { miroMOVIE pro  }
+       MM_MIRO_MOVIEPRO = 1;
+    { miroVIDEO D1  }
+       MM_MIRO_VIDEOD1 = 2;
+    { miroVIDEO DC1 tv  }
+       MM_MIRO_VIDEODC1TV = 3;
+    { miroVIDEO 10/20 TD  }
+       MM_MIRO_VIDEOTD = 4;
+       MM_MIRO_DC30_WAVEOUT = 5;
+       MM_MIRO_DC30_WAVEIN = 6;
+       MM_MIRO_DC30_MIX = 7;
+
+    {  Product IDs for     MM_NEC    -  NEC     }
+       MM_NEC_73_86_SYNTH = 5;
+       MM_NEC_73_86_WAVEOUT = 6;
+       MM_NEC_73_86_WAVEIN = 7;
+       MM_NEC_26_SYNTH = 9;
+       MM_NEC_MPU401_MIDIOUT = 10;
+       MM_NEC_MPU401_MIDIIN = 11;
+       MM_NEC_JOYSTICK = 12;
+
+    {  Product IDs for     MM_NORRIS    -  Norris Communications, Inc.     }
+       MM_NORRIS_VOICELINK = 1;
+
+    {  Product IDs for     MM_NORTHERN_TELECOM    -  Northern Telecom Limited     }
+    {  MPX Audio Card Wave Input Device  }
+       MM_NORTEL_MPXAC_WAVEIN = 1;
+
+    { MPX Audio Card Wave Output Device  }
+       MM_NORTEL_MPXAC_WAVEOUT = 2;
+
+    {  Product IDs for     MM_NVIDIA    -  NVidia Corporation     }
+       MM_NVIDIA_WAVEOUT = 1;
+       MM_NVIDIA_WAVEIN = 2;
+       MM_NVIDIA_MIDIOUT = 3;
+       MM_NVIDIA_MIDIIN = 4;
+       MM_NVIDIA_GAMEPORT = 5;
+       MM_NVIDIA_MIXER = 6;
+       MM_NVIDIA_AUX = 7;
+
+    {  Product IDs for     MM_OKSORI    -  OKSORI Co., Ltd.     }
+    { Oksori Base  }
+       MM_OKSORI_BASE = 0;
+       MM_OKSORI_OSR8_WAVEOUT             = MM_OKSORI_BASE+1;       { Oksori 8bit Wave out  }
+       MM_OKSORI_OSR8_WAVEIN              = MM_OKSORI_BASE+2;       { Oksori 8bit Wave in  }
+       MM_OKSORI_OSR16_WAVEOUT            = MM_OKSORI_BASE+3;       { Oksori 16 bit Wave out  }
+       MM_OKSORI_OSR16_WAVEIN             = MM_OKSORI_BASE+4;       { Oksori 16 bit Wave in  }
+       MM_OKSORI_FM_OPL4                  = MM_OKSORI_BASE+5;       { Oksori FM Synth Yamaha OPL4  }
+       MM_OKSORI_MIX_MASTER               = MM_OKSORI_BASE+6;       { Oksori DSP Mixer - Master Volume  }
+       MM_OKSORI_MIX_WAVE                 = MM_OKSORI_BASE+7;       { Oksori DSP Mixer - Wave Volume  }
+       MM_OKSORI_MIX_FM                   = MM_OKSORI_BASE+8;       { Oksori DSP Mixer - FM Volume  }
+       MM_OKSORI_MIX_LINE                 = MM_OKSORI_BASE+9;       { Oksori DSP Mixer - Line Volume  }
+       MM_OKSORI_MIX_CD                   = MM_OKSORI_BASE+10;      { Oksori DSP Mixer - CD Volume  }
+       MM_OKSORI_MIX_MIC                  = MM_OKSORI_BASE+11;      { Oksori DSP Mixer - MIC Volume  }
+       MM_OKSORI_MIX_ECHO                 = MM_OKSORI_BASE+12;      { Oksori DSP Mixer - Echo Volume  }
+       MM_OKSORI_MIX_AUX1                 = MM_OKSORI_BASE+13;      { Oksori AD1848 - AUX1 Volume  }
+       MM_OKSORI_MIX_LINE1                = MM_OKSORI_BASE+14;      { Oksori AD1848 - LINE1 Volume  }
+       MM_OKSORI_EXT_MIC1                 = MM_OKSORI_BASE+15;      { Oksori External - One Mic Connect  }
+       MM_OKSORI_EXT_MIC2                 = MM_OKSORI_BASE+16;      { Oksori External - Two Mic Connect  }
+       MM_OKSORI_MIDIOUT                  = MM_OKSORI_BASE+17;      { Oksori MIDI Out Device  }
+       MM_OKSORI_MIDIIN                   = MM_OKSORI_BASE+18;      { Oksori MIDI In Device  }
+       MM_OKSORI_MPEG_CDVISION            = MM_OKSORI_BASE+19;      { Oksori CD-Vision MPEG Decoder  }
+
+    {  Product IDs for     MM_OSITECH    -  Ositech Communications Inc.     }
+    { Trumpcard  }
+       MM_OSITECH_TRUMPCARD = 1;
+
+    {  Product IDs for     MM_OSPREY    -  Osprey Technologies, Inc.     }
+       MM_OSPREY_1000WAVEIN = 1;
+       MM_OSPREY_1000WAVEOUT = 2;
+
+    {  Product IDs for     MM_QUARTERDECK    -  Quarterdeck Corporation     }
+    { Quarterdeck L&H Codec Wave In  }
+       MM_QUARTERDECK_LHWAVEIN = 0;
+    { Quarterdeck L&H Codec Wave Out  }
+       MM_QUARTERDECK_LHWAVEOUT = 1;
+
+    {  Product IDs for     MM_RHETOREX    -  Rhetorex Inc     }
+       MM_RHETOREX_WAVEIN = 1;
+       MM_RHETOREX_WAVEOUT = 2;
+
+    {  Product IDs for     MM_ROCKWELL    -  Rockwell International     }
+       MM_VOICEMIXER = 1;
+       ROCKWELL_WA1_WAVEIN = 100;
+       ROCKWELL_WA1_WAVEOUT = 101;
+       ROCKWELL_WA1_SYNTH = 102;
+       ROCKWELL_WA1_MIXER = 103;
+       ROCKWELL_WA1_MPU401_IN = 104;
+       ROCKWELL_WA1_MPU401_OUT = 105;
+       ROCKWELL_WA2_WAVEIN = 200;
+       ROCKWELL_WA2_WAVEOUT = 201;
+       ROCKWELL_WA2_SYNTH = 202;
+       ROCKWELL_WA2_MIXER = 203;
+       ROCKWELL_WA2_MPU401_IN = 204;
+       ROCKWELL_WA2_MPU401_OUT = 205;
+              
+    {  Product IDs for     MM_S3    -  S3     }
+       MM_S3_WAVEOUT = $1;       
+       MM_S3_WAVEIN = $2;       
+       MM_S3_MIDIOUT = $3;       
+       MM_S3_MIDIIN = $4;       
+       MM_S3_FMSYNTH = $5;       
+       MM_S3_MIXER = $6;       
+       MM_S3_AUX = $7;
+
+    {  Product IDs for     MM_SEERSYS    -  Seer Systems, Inc.     }
+       MM_SEERSYS_SEERSYNTH = 1;
+       MM_SEERSYS_SEERWAVE = 2;
+       MM_SEERSYS_SEERMIX = 3;
+
+    {  Product IDs for     MM_SOFTSOUND    -  Softsound, Ltd.     }
+       MM_SOFTSOUND_CODEC = 1;
+
+    {  Product IDs for     MM_SOUNDESIGNS    -  SounDesignS M.C.S. Ltd.     }
+       MM_SOUNDESIGNS_WAVEIN = 1;
+       MM_SOUNDESIGNS_WAVEOUT = 2;
+
+    {  Product IDs for     MM_SPECTRUM_SIGNAL_PROCESSING    -  Spectrum Signal Processing, Inc.     }
+    { Sound Festa Wave In Device  }
+       MM_SSP_SNDFESWAVEIN = 1;
+    { Sound Festa Wave Out Device  }
+       MM_SSP_SNDFESWAVEOUT = 2;
+    { Sound Festa MIDI In Device  }
+       MM_SSP_SNDFESMIDIIN = 3;
+    { Sound Festa MIDI Out Device  }
+       MM_SSP_SNDFESMIDIOUT = 4;
+    { Sound Festa MIDI Synth Device  }
+       MM_SSP_SNDFESSYNTH = 5;
+    { Sound Festa Mixer Device  }
+       MM_SSP_SNDFESMIX = 6;
+    { Sound Festa Auxilliary Device  }
+       MM_SSP_SNDFESAUX = 7;
+
+    {  Product IDs for     MM_TDK    -  TDK Corporation     }
+       MM_TDK_MW_MIDI_SYNTH = 1;       
+       MM_TDK_MW_MIDI_IN = 2;       
+       MM_TDK_MW_MIDI_OUT = 3;       
+       MM_TDK_MW_WAVE_IN = 4;       
+       MM_TDK_MW_WAVE_OUT = 5;       
+       MM_TDK_MW_AUX = 6;       
+       MM_TDK_MW_MIXER = 10;       
+       MM_TDK_MW_AUX_MASTER = 100;       
+       MM_TDK_MW_AUX_BASS = 101;       
+       MM_TDK_MW_AUX_TREBLE = 102;       
+       MM_TDK_MW_AUX_MIDI_VOL = 103;       
+       MM_TDK_MW_AUX_WAVE_VOL = 104;       
+       MM_TDK_MW_AUX_WAVE_RVB = 105;       
+       MM_TDK_MW_AUX_WAVE_CHR = 106;       
+       MM_TDK_MW_AUX_VOL = 107;       
+       MM_TDK_MW_AUX_RVB = 108;       
+       MM_TDK_MW_AUX_CHR = 109;
+
+    {  Product IDs for     MM_TURTLE_BEACH    -  Turtle Beach, Inc.     }
+       MM_TBS_TROPEZ_WAVEIN = 37;
+       MM_TBS_TROPEZ_WAVEOUT = 38;
+       MM_TBS_TROPEZ_AUX1 = 39;
+       MM_TBS_TROPEZ_AUX2 = 40;
+       MM_TBS_TROPEZ_LINE = 41;
+              
+    {  Product IDs for     MM_VIENNASYS    -  Vienna Systems     }
+       MM_VIENNASYS_TSP_WAVE_DRIVER = 1;
+              
+    {  Product IDs for     MM_VIONA    -  Viona Development GmbH     }
+    { Q-Motion PCI II/Bravado 2000  }
+       MM_VIONA_QVINPCI_MIXER = 1;       
+       MM_VIONA_QVINPCI_WAVEIN = 2;       
+       MM_VIONAQVINPCI_WAVEOUT = 3;
+    { Buster  }
+       MM_VIONA_BUSTER_MIXER = 4;
+    { Cinemaster  }
+       MM_VIONA_CINEMASTER_MIXER = 5;
+    { Concerto  }
+       MM_VIONA_CONCERTO_MIXER = 6;
+
+    {  Product IDs for     MM_WILDCAT    -  Wildcat Canyon Software     }
+    { Autoscore  }
+       MM_WILDCAT_AUTOSCOREMIDIIN = 1;
+
+    {  Product IDs for     MM_WILLOWPOND    -  Willow Pond Corporation     }
+       MM_WILLOWPOND_FMSYNTH_STEREO = 20;
+       MM_WILLOWPOND_SNDPORT_WAVEIN = 100;
+       MM_WILLOWPOND_SNDPORT_WAVEOUT = 101;
+       MM_WILLOWPOND_SNDPORT_MIXER = 102;
+       MM_WILLOWPOND_SNDPORT_AUX = 103;
+       MM_WILLOWPOND_PH_WAVEIN = 104;
+       MM_WILLOWPOND_PH_WAVEOUT = 105;
+       MM_WILLOWPOND_PH_MIXER = 106;
+       MM_WILLOWPOND_PH_AUX = 107;
+
+    {  Product IDs for     MM_WORKBIT    -  Workbit Corporation     }
+    { Harmony Mixer  }
+       MM_WORKBIT_MIXER = 1;
+    { Harmony Mixer  }
+       MM_WORKBIT_WAVEOUT = 2;
+    { Harmony Mixer  }
+       MM_WORKBIT_WAVEIN = 3;
+    { Harmony Mixer  }
+       MM_WORKBIT_MIDIIN = 4;
+    { Harmony Mixer  }
+       MM_WORKBIT_MIDIOUT = 5;
+    { Harmony Mixer  }
+       MM_WORKBIT_FMSYNTH = 6;
+    { Harmony Mixer  }
+       MM_WORKBIT_AUX = 7;
+       MM_WORKBIT_JOYSTICK = 8;
+    {  Product IDs for     MM_FRAUNHOFER_IIS -  Fraunhofer  }
+       MM_FHGIIS_MPEGLAYER3 = 10;
+{$ENDIF NOMMIDS}
+
+
+{*////////////////////////////////////////////////////////////////////////// */
+
+/*              INFO LIST CHUNKS (from the Multimedia Programmer's Reference
+                                        plus new ones)
+*}
+
+const
+      RIFFINFO_IARL = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('A')) shl 8) or
+                             (byte(AnsiChar('R')) shl 16) or
+                             (byte(AnsiChar('L')) shl 24)
+                            ); //*Archival location  */
+
+      RIFFINFO_IART = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('A')) shl 8) or
+                             (byte(AnsiChar('R')) shl 16) or
+                             (byte(AnsiChar('T')) shl 24)
+                            ); //*Artist  */
+
+      RIFFINFO_ICMS = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('C')) shl 8) or
+                             (byte(AnsiChar('M')) shl 16) or
+                             (byte(AnsiChar('S'))shl 24)
+                            ); //*Commissioned  */
+
+      RIFFINFO_ICMT = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('C')) shl 8) or
+                             (byte(AnsiChar('M')) shl 16) or
+                             (byte(AnsiChar('T')) shl 24)
+                            ); //*Comments  */
+
+      RIFFINFO_ICOP = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('C')) shl 8) or
+                             (byte(AnsiChar('O')) shl 16) or
+                             (byte(AnsiChar('P')) shl 24)
+                            ); //*Copyright  */
+
+      RIFFINFO_ICRD = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('C')) shl 8) or
+                             (byte(AnsiChar('R')) shl 16) or
+                             (byte(AnsiChar('D')) shl 24)
+                            ); //*Creation date of subject  */
+
+      RIFFINFO_ICRP = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('C')) shl 8) or
+                             (byte(AnsiChar('R')) shl 16) or
+                             (byte(AnsiChar('P')) shl 24)
+                            ); //*Cropped  */
+
+      RIFFINFO_IDIM = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('D')) shl 8) or
+                             (byte(AnsiChar('I')) shl 16) or
+                             (byte(AnsiChar('M')) shl 24)
+                            ); //*Dimensions  */
+
+      RIFFINFO_IDPI = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('D')) shl 8) or
+                             (byte(AnsiChar('P')) shl 16) or
+                             (byte(AnsiChar('I')) shl 24)
+                            ); //*Dots per inch  */
+
+      RIFFINFO_IENG = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('E')) shl 8) or
+                             (byte(AnsiChar('N')) shl 16) or
+                             (byte(AnsiChar('G')) shl 24)
+                            ); //*Engineer  */
+
+      RIFFINFO_IGNR = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('G')) shl 8) or
+                             (byte(AnsiChar('N')) shl 16) or
+                             (byte(AnsiChar('R')) shl 24)
+                            ); //*Genre  */
+
+      RIFFINFO_IKEY = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('K')) shl 8) or
+                             (byte(AnsiChar('E')) shl 16) or
+                             (byte(AnsiChar('Y')) shl 24)
+                            ); //*Keywords  */
+
+      RIFFINFO_ILGT = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('L')) shl 8) or
+                             (byte(AnsiChar('G')) shl 16) or
+                             (byte(AnsiChar('T')) shl 24)
+                            ); //*Lightness settings  */
+
+      RIFFINFO_IMED = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('M')) shl 8) or
+                             (byte(AnsiChar('E')) shl 16) or
+                             (byte(AnsiChar('D')) shl 24)
+                            ); //*Medium  */
+
+      RIFFINFO_INAM = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('N')) shl 8) or
+                             (byte(AnsiChar('A')) shl 16) or
+                             (byte(AnsiChar('M')) shl 24)
+                            ); //*Name of subject  */
+
+      RIFFINFO_IPLT = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('P')) shl 8) or
+                             (byte(AnsiChar('L')) shl 16) or
+                             (byte(AnsiChar('T')) shl 24)
+                            ); //*Palette Settings. No. of colors requested.   */
+
+      RIFFINFO_IPRD = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('P')) shl 8) or
+                             (byte(AnsiChar('R')) shl 16) or
+                             (byte(AnsiChar('D')) shl 24)
+                            ); //*Product  */
+
+      RIFFINFO_ISBJ = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('S')) shl 8) or
+                             (byte(AnsiChar('B')) shl 16) or
+                             (byte(AnsiChar('J')) shl 24)
+                            ); //*Subject description  */
+
+      RIFFINFO_ISFT = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('S')) shl 8) or
+                             (byte(AnsiChar('F')) shl 16) or
+                             (byte(AnsiChar('T')) shl 24)
+                            ); //*Software. Name of package used to create file.  */
+
+      RIFFINFO_ISHP = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('S')) shl 8) or
+                             (byte(AnsiChar('H')) shl 16) or
+                             (byte(AnsiChar('P')) shl 24)
+                            ); //*Sharpness.  */
+
+      RIFFINFO_ISRC = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('S')) shl 8) or
+                             (byte(AnsiChar('R')) shl 16) or
+                             (byte(AnsiChar('C')) shl 24)
+                            ); //*Source.   */
+
+      RIFFINFO_ISRF = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('S')) shl 8) or
+                             (byte(AnsiChar('R')) shl 16) or
+                             (byte(AnsiChar('F')) shl 24)
+                            ); //*Source Form. ie slide, paper  */
+
+      RIFFINFO_ITCH = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('T')) shl 8) or
+                             (byte(AnsiChar('C')) shl 16) or
+                             (byte(AnsiChar('H')) shl 24)
+                            ); //*Technician who digitized the subject.  */
+
+//* New INFO Chunks as of August 30, 1993: */
+      RIFFINFO_ISMP = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('S')) shl 8) or
+                             (byte(AnsiChar('M')) shl 16) or
+                             (byte(AnsiChar('P')) shl 24)
+                            ); //*SMPTE time code  */
+{* ISMP: SMPTE time code of digitization start point expressed as a NULL terminated
+                text string "HH:MM:SS:FF". If performing MCI capture in AVICAP, this
+                chunk will be automatically set based on the MCI start time.
+*}
+
+      RIFFINFO_IDIT = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('D')) shl 8) or
+                             (byte(AnsiChar('I')) shl 16) or
+                             (byte(AnsiChar('T')) shl 24)
+                            ); //*Digitization Time  */
+{* IDIT: "Digitization Time" Specifies the time and date that the digitization commenced.
+                The digitization time is contained in an ASCII string which
+                contains exactly 26 characters and is in the format
+                "Wed Jan 02 02:03:55 1990\n\0".
+                The ctime(), asctime(), functions can be used to create strings
+                in this format. This chunk is automatically added to the capture
+                file based on the current system time at the moment capture is initiated.
+*}
+
+{*Template line for new additions
+      RIFFINFO_I = FOURCC(byte(AnsiChar('I')) or
+                             (byte(AnsiChar('')) shl 8) or
+                             (byte(AnsiChar('')) shl 16) or
+                             (byte(AnsiChar('')) shl 24)
+                            ); // Comment
+}
+//*/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
+
+{$IFNDEF NONEWWAVE}
+{ WAVE form wFormatTag IDs  }
+const
+       WAVE_FORMAT_UNKNOWN = $0000;{  Microsoft Corporation   }
+    {  Microsoft Corporation   }
+       WAVE_FORMAT_ADPCM = $0002;
+    {  Microsoft Corporation   }
+       WAVE_FORMAT_IEEE_FLOAT = $0003;       
+    {  IEEE754: range (+1, -1]   }
+    {  32-bit/64-bit format as defined by  }
+    {  MSVC++ float/double type  }
+    {  IBM Corporation   }
+       WAVE_FORMAT_IBM_CVSD = $0005;       
+    {  Microsoft Corporation   }
+       WAVE_FORMAT_ALAW = $0006;       
+    {  Microsoft Corporation   }
+       WAVE_FORMAT_MULAW = $0007;       
+    {  Microsoft Corporation   }
+       WAVE_FORMAT_WMAVOICE9 = $000a;       
+    {  OKI   }
+       WAVE_FORMAT_OKI_ADPCM = $0010;       
+    {  Intel Corporation   }
+       WAVE_FORMAT_DVI_ADPCM = $0011;       
+    {  Intel Corporation   }
+       WAVE_FORMAT_IMA_ADPCM = WAVE_FORMAT_DVI_ADPCM;       
+    {  Videologic   }
+       WAVE_FORMAT_MEDIASPACE_ADPCM = $0012;       
+    {  Sierra Semiconductor Corp   }
+       WAVE_FORMAT_SIERRA_ADPCM = $0013;       
+    {  Antex Electronics Corporation   }
+       WAVE_FORMAT_G723_ADPCM = $0014;       
+    {  DSP Solutions, Inc.   }
+       WAVE_FORMAT_DIGISTD = $0015;       
+    {  DSP Solutions, Inc.   }
+       WAVE_FORMAT_DIGIFIX = $0016;       
+    {  Dialogic Corporation   }
+       WAVE_FORMAT_DIALOGIC_OKI_ADPCM = $0017;       
+    {  Media Vision, Inc.  }
+       WAVE_FORMAT_MEDIAVISION_ADPCM = $0018;       
+    {  Yamaha Corporation of America   }
+       WAVE_FORMAT_YAMAHA_ADPCM = $0020;       
+    {  Speech Compression   }
+       WAVE_FORMAT_SONARC = $0021;       
+    {  DSP Group, Inc   }
+       WAVE_FORMAT_DSPGROUP_TRUESPEECH = $0022;       
+    {  Echo Speech Corporation   }
+       WAVE_FORMAT_ECHOSC1 = $0023;       
+    {     }
+       WAVE_FORMAT_AUDIOFILE_AF36 = $0024;       
+    {  Audio Processing Technology   }
+       WAVE_FORMAT_APTX = $0025;       
+    {     }
+       WAVE_FORMAT_AUDIOFILE_AF10 = $0026;       
+    {  Dolby Laboratories   }
+       WAVE_FORMAT_DOLBY_AC2 = $0030;       
+    {  Microsoft Corporation   }
+       WAVE_FORMAT_GSM610 = $0031;       
+    {  Microsoft Corporation   }
+       WAVE_FORMAT_MSNAUDIO = $0032;       
+    {  Antex Electronics Corporation   }
+       WAVE_FORMAT_ANTEX_ADPCME = $0033;       
+    {  Control Resources Limited   }
+       WAVE_FORMAT_CONTROL_RES_VQLPC = $0034;       
+    {  DSP Solutions, Inc.   }
+       WAVE_FORMAT_DIGIREAL = $0035;       
+    {  DSP Solutions, Inc.   }
+       WAVE_FORMAT_DIGIADPCM = $0036;       
+    {  Control Resources Limited   }
+       WAVE_FORMAT_CONTROL_RES_CR10 = $0037;       
+    {  Natural MicroSystems   }
+       WAVE_FORMAT_NMS_VBXADPCM = $0038;       
+    { Crystal Semiconductor IMA ADPCM  }
+       WAVE_FORMAT_CS_IMAADPCM = $0039;       
+    { Echo Speech Corporation  }
+       WAVE_FORMAT_ECHOSC3 = $003A;       
+    { Rockwell International  }
+       WAVE_FORMAT_ROCKWELL_ADPCM = $003B;       
+    { Rockwell International  }
+       WAVE_FORMAT_ROCKWELL_DIGITALK = $003C;       
+    { Xebec Multimedia Solutions Limited  }
+       WAVE_FORMAT_XEBEC = $003D;       
+    {  Antex Electronics Corporation   }
+       WAVE_FORMAT_G721_ADPCM = $0040;       
+    {  Antex Electronics Corporation   }
+       WAVE_FORMAT_G728_CELP = $0041;       
+    {  Microsoft Corporation   }
+       WAVE_FORMAT_MPEG = $0050;       
+    {  ISO/MPEG Layer3 Format Tag  }
+       WAVE_FORMAT_MPEGLAYER3 = $0055;       
+    {  Cirrus Logic   }
+       WAVE_FORMAT_CIRRUS = $0060;       
+    {  ESS Technology   }
+       WAVE_FORMAT_ESPCM = $0061;       
+    {  Voxware Inc   }
+       WAVE_FORMAT_VOXWARE = $0062;       
+    {  Canopus, co., Ltd.   }
+       WAVEFORMAT_CANOPUS_ATRAC = $0063;       
+    {  APICOM   }
+       WAVE_FORMAT_G726_ADPCM = $0064;       
+    {  APICOM       }
+       WAVE_FORMAT_G722_ADPCM = $0065;       
+    {  Microsoft Corporation   }
+       WAVE_FORMAT_DSAT = $0066;       
+    {  Microsoft Corporation   }
+       WAVE_FORMAT_DSAT_DISPLAY = $0067;       
+    {  Softsound, Ltd.       }
+       WAVE_FORMAT_SOFTSOUND = $0080;       
+    {  Rhetorex Inc   }
+       WAVE_FORMAT_RHETOREX_ADPCM = $0100;       
+    {  Microsoft Corporation   }
+       WAVE_FORMAT_MSAUDIO1 = $0160;       
+    {  Microsoft Corporation   }
+       WAVE_FORMAT_WMAUDIO2 = $0161;       
+    {  Microsoft Corporation   }
+       WAVE_FORMAT_WMAUDIO3 = $0162;       
+    {  Microsoft Corporation   }
+       WAVE_FORMAT_WMAUDIO_LOSSLESS = $0163;       
+    {  Creative Labs, Inc   }
+       WAVE_FORMAT_CREATIVE_ADPCM = $0200;       
+    {  Creative Labs, Inc   }
+       WAVE_FORMAT_CREATIVE_FASTSPEECH8 = $0202;       
+    {  Creative Labs, Inc   }
+       WAVE_FORMAT_CREATIVE_FASTSPEECH10 = $0203;       
+    {  Quarterdeck Corporation   }
+       WAVE_FORMAT_QUARTERDECK = $0220;       
+    {  Fujitsu Corp.   }
+       WAVE_FORMAT_FM_TOWNS_SND = $0300;       
+    {  Brooktree Corporation   }
+       WAVE_FORMAT_BTV_DIGITAL = $0400;       
+    {  Ing C. Olivetti & C., S.p.A.   }
+       WAVE_FORMAT_OLIGSM = $1000;       
+    {  Ing C. Olivetti & C., S.p.A.   }
+       WAVE_FORMAT_OLIADPCM = $1001;       
+    {  Ing C. Olivetti & C., S.p.A.   }
+       WAVE_FORMAT_OLICELP = $1002;       
+    {  Ing C. Olivetti & C., S.p.A.   }
+       WAVE_FORMAT_OLISBC = $1003;       
+    {  Ing C. Olivetti & C., S.p.A.   }
+       WAVE_FORMAT_OLIOPR = $1004;       
+    {  Lernout & Hauspie   }
+       WAVE_FORMAT_LH_CODEC = $1100;       
+    {  Norris Communications, Inc.   }
+       WAVE_FORMAT_NORRIS = $1400;
+
+const
+      WAVE_FORMAT_EXTENSIBLE = $FFFE;     { Microsoft  }
+
+    { }
+    {  the WAVE_FORMAT_DEVELOPMENT format tag can be used during the }
+    {  development phase of a new wave format.  Before shipping, you MUST }
+    {  acquire an official format tag from Microsoft. }
+    { }
+
+const
+       WAVE_FORMAT_DEVELOPMENT = $FFFF;
+
+{$ENDIF NONEWWAVE}
+
+type
+{ general waveform format structure (information common to all formats)  }
+     waveformat_tag = record
+       wFormatTag:word; { format type  }
+       nChannels:word; { number of channels (i.e. mono, stereo...)  }
+       nSamplesPerSec:DWORD; { sample rate  }
+       nAvgBytesPerSec:DWORD; { for buffer estimation  }
+       nBlockAlign:word; { block size of data  }
+     end;
+     WAVEFORMAT = waveformat_tag;
+     PWAVEFORMAT = ^WAVEFORMAT;
+     NPWAVEFORMAT = ^WAVEFORMAT;
+     LPWAVEFORMAT = ^WAVEFORMAT;
+     LPCWAVEFORMAT = ^WAVEFORMAT;
+
+    { flags for wFormatTag field of WAVEFORMAT  }
+const
+      WAVE_FORMAT_PCM = 1;
+
+{ specific waveform format structure for PCM data  }
+type
+     pcmwaveformat_tag = record
+       wf:WAVEFORMAT;
+       wBitsPerSample:word;  // corresponds to MCI_WAVE_SET_.... structure
+     end;
+     PCMWAVEFORMAT = pcmwaveformat_tag;
+     PPCMWAVEFORMAT = ^PCMWAVEFORMAT;
+     NPPCMWAVEFORMAT = ^PCMWAVEFORMAT;
+     LPPCMWAVEFORMAT = ^PCMWAVEFORMAT;
+
+{ general extended waveform format structure
+  Use this for all NON PCM formats (information common to all formats)
+}
+
+{*
+ *  extended waveform format structure used for all non-PCM formats. this
+ *  structure is common to all non-PCM formats.
+ *}
+type
+     tWAVEFORMATEX = record
+       wFormatTag:word;       //* format type */
+       nChannels:word;        //* number of channels (i.e. mono, stereo...) */
+       nSamplesPerSec:DWORD;  //* sample rate */
+       nAvgBytesPerSec:DWORD; //* for buffer estimation */
+       nBlockAlign:word;      //* block size of data */
+       wBitsPerSample:word;   //* Number of bits per sample of mono data */
+       cbSize:word;           //* The count in bytes of the size of
+                              //  extra information (after cbSize) */
+     end;
+     WAVEFORMATEX = tWAVEFORMATEX;
+     PWAVEFORMATEX = ^WAVEFORMATEX;
+     NPWAVEFORMATEX = ^WAVEFORMATEX;
+     LPWAVEFORMATEX = ^tWAVEFORMATEX;
+     LPCWAVEFORMATEX = ^WAVEFORMATEX;
+
+type
+     WAVEFORMATEXTENSIBLE = record
+       Format:WAVEFORMATEX;
+       Samples:record
+         case longint of
+           0: (wValidBitsPerSample:word);
+           1: (wSamplesPerBlock:word);
+           2: (wReserved:word);
+       end;
+       dwChannelMask:DWORD;
+       SubFormat:TGUID;
+     end;
+     PWAVEFORMATEXTENSIBLE = ^WAVEFORMATEXTENSIBLE;
+
+{  Extended PCM waveform format structure based on WAVEFORMATEXTENSIBLE. }
+{  Use this for multiple channel and hi-resolution PCM data }
+type
+     WAVEFORMATPCMEX = WAVEFORMATEXTENSIBLE; { Format.cbSize = 22  }
+     PWAVEFORMATPCMEX = ^WAVEFORMATPCMEX;
+     NPWAVEFORMATPCMEX = ^WAVEFORMATPCMEX;
+     LPWAVEFORMATPCMEX = ^WAVEFORMATPCMEX;
+
+    {  Extended format structure using IEEE Float data and based }
+    {  on WAVEFORMATEXTENSIBLE.  Use this for multiple channel }
+    {  and hi-resolution PCM data in IEEE floating point format. }
+
+     WAVEFORMATIEEEFLOATEX = WAVEFORMATEXTENSIBLE; { Format.cbSize = 22  }
+     PWAVEFORMATIEEEFLOATEX = ^WAVEFORMATIEEEFLOATEX;
+     NPWAVEFORMATIEEEFLOATEX = ^WAVEFORMATIEEEFLOATEX;
+     LPWAVEFORMATIEEEFLOATEX = ^WAVEFORMATIEEEFLOATEX;
+
+{ Speaker Positions for dwChannelMask in WAVEFORMATEXTENSIBLE: }
+const
+       SPEAKER_FRONT_LEFT = $1;       
+       SPEAKER_FRONT_RIGHT = $2;       
+       SPEAKER_FRONT_CENTER = $4;       
+       SPEAKER_LOW_FREQUENCY = $8;       
+       SPEAKER_BACK_LEFT = $10;       
+       SPEAKER_BACK_RIGHT = $20;       
+       SPEAKER_FRONT_LEFT_OF_CENTER = $40;       
+       SPEAKER_FRONT_RIGHT_OF_CENTER = $80;       
+       SPEAKER_BACK_CENTER = $100;       
+       SPEAKER_SIDE_LEFT = $200;       
+       SPEAKER_SIDE_RIGHT = $400;       
+       SPEAKER_TOP_CENTER = $800;       
+       SPEAKER_TOP_FRONT_LEFT = $1000;       
+       SPEAKER_TOP_FRONT_CENTER = $2000;       
+       SPEAKER_TOP_FRONT_RIGHT = $4000;       
+       SPEAKER_TOP_BACK_LEFT = $8000;       
+       SPEAKER_TOP_BACK_CENTER = $10000;       
+       SPEAKER_TOP_BACK_RIGHT = $20000;       
+    { Bit mask locations reserved for future use }
+       SPEAKER_RESERVED = $7FFC0000;       
+    { Used to specify that any possible permutation of speaker configurations }
+       SPEAKER_ALL = $80000000;
+
+{$IFNDEF NONEWWAVE}
+{ Define data for MS ADPCM  }
+
+type
+     adpcmcoef_tag = record
+       iCoef1:SmallInt;
+       iCoef2:SmallInt;
+     end;
+     ADPCMCOEFSET = adpcmcoef_tag;
+     PADPCMCOEFSET = ^ADPCMCOEFSET;
+     NPADPCMCOEFSET = ^ADPCMCOEFSET;
+     LPADPCMCOEFSET = ^ADPCMCOEFSET;
+
+type
+     adpcmwaveformat_tag = record
+       wfx:WAVEFORMATEX;
+       wSamplesPerBlock:word;
+       wNumCoef:word;
+       aCoef:array[0..0] of ADPCMCOEFSET;
+     end;
+     ADPCMWAVEFORMAT = adpcmwaveformat_tag;
+     PADPCMWAVEFORMAT = ^ADPCMWAVEFORMAT;
+     NPADPCMWAVEFORMAT = ^ADPCMWAVEFORMAT;
+     LPADPCMWAVEFORMAT = ^ADPCMWAVEFORMAT;
+     
+{  Intel's DVI ADPCM structure definitions }
+{ }
+{      for WAVE_FORMAT_DVI_ADPCM   (0x0011) }
+
+type
+     dvi_adpcmwaveformat_tag = record
+       wfx:WAVEFORMATEX;
+       wSamplesPerBlock:word;
+     end;
+     DVIADPCMWAVEFORMAT = dvi_adpcmwaveformat_tag;
+     PDVIADPCMWAVEFORMAT = ^DVIADPCMWAVEFORMAT;
+     NPDVIADPCMWAVEFORMAT = ^DVIADPCMWAVEFORMAT;
+     LPDVIADPCMWAVEFORMAT = ^DVIADPCMWAVEFORMAT;
+
+    { }
+    {  IMA endorsed ADPCM structure definitions--note that this is exactly }
+    {  the same format as Intel's DVI ADPCM. }
+    { }
+    {      for WAVE_FORMAT_IMA_ADPCM   (0x0011) }
+    { }
+    { }
+
+     ima_adpcmwaveformat_tag = record
+       wfx:WAVEFORMATEX;
+       wSamplesPerBlock:word;
+     end;
+     IMAADPCMWAVEFORMAT = ima_adpcmwaveformat_tag;
+     PIMAADPCMWAVEFORMAT = ^IMAADPCMWAVEFORMAT;
+     NPIMAADPCMWAVEFORMAT = ^IMAADPCMWAVEFORMAT;
+     LPIMAADPCMWAVEFORMAT = ^IMAADPCMWAVEFORMAT;
+
+    {
+    //VideoLogic's Media Space ADPCM Structure definitions
+    // for  WAVE_FORMAT_MEDIASPACE_ADPCM    (0x0012)
+    //
+    //
+     }
+
+     mediaspace_adpcmwaveformat_tag = record
+       wfx:WAVEFORMATEX;
+       wRevision:word;
+     end;
+     MEDIASPACEADPCMWAVEFORMAT = mediaspace_adpcmwaveformat_tag;
+     PMEDIASPACEADPCMWAVEFORMAT = ^MEDIASPACEADPCMWAVEFORMAT;
+     NPMEDIASPACEADPCMWAVEFORMAT = ^MEDIASPACEADPCMWAVEFORMAT;
+     LPMEDIASPACEADPCMWAVEFORMAT = ^MEDIASPACEADPCMWAVEFORMAT;
+
+    {  Sierra Semiconductor }
+    { }
+    {      for WAVE_FORMAT_SIERRA_ADPCM   (0x0013) }
+
+     sierra_adpcmwaveformat_tag = record
+       wfx:WAVEFORMATEX;
+       wRevision:word;
+     end;
+     SIERRAADPCMWAVEFORMAT = sierra_adpcmwaveformat_tag;
+     PSIERRAADPCMWAVEFORMAT = ^SIERRAADPCMWAVEFORMAT;
+     NPSIERRAADPCMWAVEFORMAT = ^SIERRAADPCMWAVEFORMAT;
+     LPSIERRAADPCMWAVEFORMAT = ^SIERRAADPCMWAVEFORMAT;
+     
+    {  Antex Electronics  structure definitions }
+    { }
+    {      for WAVE_FORMAT_G723_ADPCM   (0x0014) }
+
+     g723_adpcmwaveformat_tag = record
+       wfx:WAVEFORMATEX;
+       cbExtraSize:word;
+       nAuxBlockSize:word;
+     end;
+     G723_ADPCMWAVEFORMAT = g723_adpcmwaveformat_tag;
+     PG723_ADPCMWAVEFORMAT = ^G723_ADPCMWAVEFORMAT;
+     NPG723_ADPCMWAVEFORMAT = ^G723_ADPCMWAVEFORMAT;
+     LPG723_ADPCMWAVEFORMAT = ^G723_ADPCMWAVEFORMAT;
+
+    { }
+    {  DSP Solutions (formerly DIGISPEECH) structure definitions }
+    { }
+    {      for WAVE_FORMAT_DIGISTD   (0x0015) }
+
+     digistdwaveformat_tag = record
+       wfx : WAVEFORMATEX;
+     end;
+     DIGISTDWAVEFORMAT = digistdwaveformat_tag;
+     PDIGISTDWAVEFORMAT = ^DIGISTDWAVEFORMAT;
+     NPDIGISTDWAVEFORMAT = ^DIGISTDWAVEFORMAT;
+     LPDIGISTDWAVEFORMAT = ^DIGISTDWAVEFORMAT;
+
+    { }
+    {  DSP Solutions (formerly DIGISPEECH) structure definitions }
+    { }
+    {      for WAVE_FORMAT_DIGIFIX   (0x0016) }
+    { }
+    { }
+
+     digifixwaveformat_tag = record
+       wfx : WAVEFORMATEX;
+     end;
+     DIGIFIXWAVEFORMAT = digifixwaveformat_tag;
+     PDIGIFIXWAVEFORMAT = ^DIGIFIXWAVEFORMAT;
+     NPDIGIFIXWAVEFORMAT = ^DIGIFIXWAVEFORMAT;
+     LPDIGIFIXWAVEFORMAT = ^DIGIFIXWAVEFORMAT;
+
+    { }
+    {   Dialogic Corporation }
+    { WAVEFORMAT_DIALOGIC_OKI_ADPCM   (0x0017) }
+    { }
+
+     creative_fastspeechformat_tag = record
+       ewf:WAVEFORMATEX;
+     end;
+     DIALOGICOKIADPCMWAVEFORMAT = creative_fastspeechformat_tag;
+     PDIALOGICOKIADPCMWAVEFORMAT = ^DIALOGICOKIADPCMWAVEFORMAT;
+     NPDIALOGICOKIADPCMWAVEFORMAT = ^DIALOGICOKIADPCMWAVEFORMAT;
+     LPDIALOGICOKIADPCMWAVEFORMAT = ^DIALOGICOKIADPCMWAVEFORMAT;
+
+    { }
+    {  Yamaha Compression's ADPCM structure definitions }
+    { }
+    {      for WAVE_FORMAT_YAMAHA_ADPCM   (0x0020) }
+    { }
+    { }
+
+     yamaha_adpmcwaveformat_tag = record
+       wfx : WAVEFORMATEX;
+     end;
+     YAMAHA_ADPCMWAVEFORMAT = yamaha_adpmcwaveformat_tag;
+     PYAMAHA_ADPCMWAVEFORMAT = ^YAMAHA_ADPCMWAVEFORMAT;
+    (* near ignored *)
+     NPYAMAHA_ADPCMWAVEFORMAT = ^YAMAHA_ADPCMWAVEFORMAT;
+    (* far ignored *)
+     LPYAMAHA_ADPCMWAVEFORMAT = ^YAMAHA_ADPCMWAVEFORMAT;
+
+    { }
+    {  Speech Compression's Sonarc structure definitions }
+    { }
+    {      for WAVE_FORMAT_SONARC   (0x0021) }
+    { }
+    { }
+     sonarcwaveformat_tag = record
+       wfx : WAVEFORMATEX;
+       wCompType : word;
+     end;
+     SONARCWAVEFORMAT = sonarcwaveformat_tag;
+     PSONARCWAVEFORMAT = ^SONARCWAVEFORMAT;
+     NPSONARCWAVEFORMAT = ^SONARCWAVEFORMAT;
+     LPSONARCWAVEFORMAT = SONARCWAVEFORMAT;
+
+
+    { }
+    {  DSP Groups's TRUESPEECH structure definitions }
+    { }
+    {      for WAVE_FORMAT_DSPGROUP_TRUESPEECH   (0x0022) }
+    { }
+    { }
+
+     truespeechwaveformat_tag = record
+       wfx : WAVEFORMATEX;
+       wRevision :word;
+       nSamplesPerBlock:word;
+       abReserved :array[0..27] of byte;
+     end;
+     TRUESPEECHWAVEFORMAT = truespeechwaveformat_tag;
+     PTRUESPEECHWAVEFORMAT = ^TRUESPEECHWAVEFORMAT;
+     NPTRUESPEECHWAVEFORMAT = ^TRUESPEECHWAVEFORMAT;
+     LPTRUESPEECHWAVEFORMAT = ^TRUESPEECHWAVEFORMAT;
+
+    { }
+    {  Echo Speech Corp structure definitions }
+    { }
+    {      for WAVE_FORMAT_ECHOSC1   (0x0023) }
+
+     echosc1waveformat_tag = record
+       wfx:WAVEFORMATEX;
+     end;
+     ECHOSC1WAVEFORMAT = echosc1waveformat_tag;
+     PECHOSC1WAVEFORMAT = ^ECHOSC1WAVEFORMAT;
+     NPECHOSC1WAVEFORMAT = ^ECHOSC1WAVEFORMAT;
+     LPECHOSC1WAVEFORMAT = ^ECHOSC1WAVEFORMAT;
+
+    { }
+    {  Audiofile Inc.structure definitions }
+    { }
+    {      for WAVE_FORMAT_AUDIOFILE_AF36   (0x0024) }
+    { }
+    { }
+
+     audiofile_af36waveformat_tag = record
+       wfx : WAVEFORMATEX;
+     end;
+     AUDIOFILE_AF36WAVEFORMAT = audiofile_af36waveformat_tag;
+     PAUDIOFILE_AF36WAVEFORMAT = ^AUDIOFILE_AF36WAVEFORMAT;
+     NPAUDIOFILE_AF36WAVEFORMAT = ^AUDIOFILE_AF36WAVEFORMAT;
+     LPAUDIOFILE_AF36WAVEFORMAT = ^AUDIOFILE_AF36WAVEFORMAT;
+     
+    { }
+    {  Audio Processing Technology structure definitions }
+    { }
+    {      for WAVE_FORMAT_APTX   (0x0025) }
+    { }
+    { }
+     aptxwaveformat_tag = record
+       wfx : WAVEFORMATEX;
+     end;
+     APTXWAVEFORMAT = aptxwaveformat_tag;
+     PAPTXWAVEFORMAT = ^APTXWAVEFORMAT;
+     NPAPTXWAVEFORMAT = ^APTXWAVEFORMAT;
+     LPAPTXWAVEFORMAT = ^APTXWAVEFORMAT;
+
+    { }
+    {  Audiofile Inc.structure definitions }
+    { }
+    {      for WAVE_FORMAT_AUDIOFILE_AF10   (0x0026) }
+    { }
+    { }
+     audiofile_af10waveformat_tag = record
+       wfx : WAVEFORMATEX;
+     end;
+     AUDIOFILE_AF10WAVEFORMAT = audiofile_af10waveformat_tag;
+     PAUDIOFILE_AF10WAVEFORMAT = ^AUDIOFILE_AF10WAVEFORMAT;
+     NPAUDIOFILE_AF10WAVEFORMAT = ^AUDIOFILE_AF10WAVEFORMAT;
+     LPAUDIOFILE_AF10WAVEFORMAT = ^AUDIOFILE_AF10WAVEFORMAT;
+
+
+    { }
+    { Dolby's AC-2 wave format structure definition
+               WAVE_FORMAT_DOLBY_AC2    (0x0030) }
+    { }
+     dolbyac2waveformat_tag = record
+       wfx:WAVEFORMATEX;
+       nAuxBitsCode:word;
+     end;
+     DOLBYAC2WAVEFORMAT = dolbyac2waveformat_tag;
+
+    {Microsoft's  }
+    { WAVE_FORMAT_GSM 610           0x0031 }
+    { }
+     gsm610waveformat_tag = record
+       wfx : WAVEFORMATEX;
+       wSamplesPerBlock : word;
+     end;
+     GSM610WAVEFORMAT = gsm610waveformat_tag;
+     PGSM610WAVEFORMAT = ^GSM610WAVEFORMAT;
+     NPGSM610WAVEFORMAT = ^GSM610WAVEFORMAT;
+     LPGSM610WAVEFORMAT = ^GSM610WAVEFORMAT;
+
+
+    { }
+    {      Antex Electronics Corp }
+    { }
+    {      for WAVE_FORMAT_ADPCME                  (0x0033) }
+    { }
+    { }
+     adpcmewaveformat_tag = record
+       wfx : WAVEFORMATEX;
+       wSamplesPerBlock:word;
+     end;
+     ADPCMEWAVEFORMAT = adpcmewaveformat_tag;
+     PADPCMEWAVEFORMAT = ^ADPCMEWAVEFORMAT;
+     NPADPCMEWAVEFORMAT = ^ADPCMEWAVEFORMAT;
+     LPADPCMEWAVEFORMAT = ^ADPCMEWAVEFORMAT;
+
+
+    {       Control Resources Limited  }
+    { WAVE_FORMAT_CONTROL_RES_VQLPC                 0x0034 }
+    { }
+
+       contres_vqlpcwaveformat_tag = record
+            wfx : WAVEFORMATEX;
+            wSamplesPerBlock :word;
+         end;
+       CONTRESVQLPCWAVEFORMAT = contres_vqlpcwaveformat_tag;
+
+       PCONTRESVQLPCWAVEFORMAT = ^CONTRESVQLPCWAVEFORMAT;
+    (* near ignored *)
+
+       NPCONTRESVQLPCWAVEFORMAT = ^CONTRESVQLPCWAVEFORMAT;
+    (* far ignored *)
+
+       LPCONTRESVQLPCWAVEFORMAT = ^CONTRESVQLPCWAVEFORMAT;
+
+    {      for WAVE_FORMAT_DIGIREAL                   (0x0035) }
+    { }
+    { }
+
+       digirealwaveformat_tag = record
+            wfx : WAVEFORMATEX;
+            wSamplesPerBlock : word;
+         end;
+       DIGIREALWAVEFORMAT = digirealwaveformat_tag;
+
+       PDIGIREALWAVEFORMAT = ^DIGIREALWAVEFORMAT;
+       NPDIGIREALWAVEFORMAT = ^DIGIREALWAVEFORMAT;
+       LPDIGIREALWAVEFORMAT = ^DIGIREALWAVEFORMAT;
+
+    {  DSP Solutions }
+    { }
+    {      for WAVE_FORMAT_DIGIADPCM   (0x0036) }
+       digiadpcmmwaveformat_tag = record
+            wfx : WAVEFORMATEX;
+            wSamplesPerBlock:word;
+         end;
+       DIGIADPCMWAVEFORMAT = digiadpcmmwaveformat_tag;
+
+       PDIGIADPCMWAVEFORMAT = ^DIGIADPCMWAVEFORMAT;
+    (* near ignored *)
+
+       NPDIGIADPCMWAVEFORMAT = ^DIGIADPCMWAVEFORMAT;
+    (* far ignored *)
+
+       LPDIGIADPCMWAVEFORMAT = ^DIGIADPCMWAVEFORMAT;
+
+
+    {       Control Resources Limited  }
+    { WAVE_FORMAT_CONTROL_RES_CR10          0x0037 }
+       contres_cr10waveformat_tag = record
+            wfx : WAVEFORMATEX;
+            wSamplesPerBlock :word;
+         end;
+       CONTRESCR10WAVEFORMAT = contres_cr10waveformat_tag;
+       PCONTRESCR10WAVEFORMAT = ^CONTRESCR10WAVEFORMAT;
+       NPCONTRESCR10WAVEFORMAT = ^CONTRESCR10WAVEFORMAT;
+       LPCONTRESCR10WAVEFORMAT = ^CONTRESCR10WAVEFORMAT;
+
+    { }
+    {  Natural Microsystems }
+    { }
+    {      for WAVE_FORMAT_NMS_VBXADPCM   (0x0038) }
+       nms_vbxadpcmmwaveformat_tag = record
+            wfx : WAVEFORMATEX;
+            wSamplesPerBlock :word;
+         end;
+       NMS_VBXADPCMWAVEFORMAT = nms_vbxadpcmmwaveformat_tag;
+
+       PNMS_VBXADPCMWAVEFORMAT = ^NMS_VBXADPCMWAVEFORMAT;
+    (* near ignored *)
+
+       NPNMS_VBXADPCMWAVEFORMAT = ^NMS_VBXADPCMWAVEFORMAT;
+    (* far ignored *)
+
+       LPNMS_VBXADPCMWAVEFORMAT = ^NMS_VBXADPCMWAVEFORMAT;
+
+
+    { }
+    {  Antex Electronics  structure definitions }
+    { }
+    {      for WAVE_FORMAT_G721_ADPCM   (0x0040) }
+    { }
+    { }
+
+       g721_adpcmwaveformat_tag = record
+            wfx : WAVEFORMATEX;
+            nAuxBlockSize :word;
+         end;
+       G721_ADPCMWAVEFORMAT = g721_adpcmwaveformat_tag;
+
+       PG721_ADPCMWAVEFORMAT = ^G721_ADPCMWAVEFORMAT;
+    (* near ignored *)
+
+       NPG721_ADPCMWAVEFORMAT = ^G721_ADPCMWAVEFORMAT;
+    (* far ignored *)
+
+       LPG721_ADPCMWAVEFORMAT = ^G721_ADPCMWAVEFORMAT;
+
+    { Microsoft MPEG audio WAV definition }
+    { }
+    {  MPEG-1 audio wave format (audio layer only).   (0x0050)    }
+     mpeg1waveformat_tag = record
+       wfx:WAVEFORMATEX;
+       fwHeadLayer:word;
+       dwHeadBitrate:DWORD;
+       fwHeadMode:word;
+       fwHeadModeExt:word;
+       wHeadEmphasis:word;
+       fwHeadFlags:word;
+       dwPTSLow:DWORD;
+       dwPTSHigh:DWORD;
+     end;
+     MPEG1WAVEFORMAT = mpeg1waveformat_tag;
+     PMPEG1WAVEFORMAT = ^MPEG1WAVEFORMAT;
+     NPMPEG1WAVEFORMAT = ^MPEG1WAVEFORMAT;
+     LPMPEG1WAVEFORMAT = ^MPEG1WAVEFORMAT;
+
+const
+       ACM_MPEG_LAYER1 = $0001;       
+       ACM_MPEG_LAYER2 = $0002;       
+       ACM_MPEG_LAYER3 = $0004;       
+       ACM_MPEG_STEREO = $0001;       
+       ACM_MPEG_JOINTSTEREO = $0002;       
+       ACM_MPEG_DUALCHANNEL = $0004;       
+       ACM_MPEG_SINGLECHANNEL = $0008;
+       ACM_MPEG_PRIVATEBIT = $0001;       
+       ACM_MPEG_COPYRIGHT = $0002;       
+       ACM_MPEG_ORIGINALHOME = $0004;       
+       ACM_MPEG_PROTECTIONBIT = $0008;       
+       ACM_MPEG_ID_MPEG1 = $0010;       
+
+    { MPEG Layer3 WAVEFORMATEX structure }
+    { for WAVE_FORMAT_MPEGLAYER3 (0x0055) }
+       MPEGLAYER3_WFX_EXTRA_BYTES = 12;
+    { WAVE_FORMAT_MPEGLAYER3 format sructure }
+
+type
+     mpeglayer3waveformat_tag = record
+       wfx:WAVEFORMATEX;
+       wID:word;
+       fdwFlags:DWORD;
+       nBlockSize:WORD;
+       nFramesPerBlock:word;
+       nCodecDelay:word;
+     end;
+     MPEGLAYER3WAVEFORMAT = mpeglayer3waveformat_tag;
+     PMPEGLAYER3WAVEFORMAT = ^MPEGLAYER3WAVEFORMAT;
+     NPMPEGLAYER3WAVEFORMAT = ^MPEGLAYER3WAVEFORMAT;
+     LPMPEGLAYER3WAVEFORMAT = ^MPEGLAYER3WAVEFORMAT;
+
+    {==========================================================================; }
+
+const
+       MPEGLAYER3_ID_UNKNOWN = 0;
+       MPEGLAYER3_ID_MPEG = 1;
+       MPEGLAYER3_ID_CONSTANTFRAMESIZE = 2;
+       
+       MPEGLAYER3_FLAG_PADDING_ISO = $00000000;
+       MPEGLAYER3_FLAG_PADDING_ON = $00000001;
+       MPEGLAYER3_FLAG_PADDING_OFF = $00000002;
+
+    {  Creative's ADPCM structure definitions }
+    { }
+    {      for WAVE_FORMAT_CREATIVE_ADPCM   (0x0200) }
+
+type
+     creative_adpcmwaveformat_tag = record
+       wfx:WAVEFORMATEX;
+       wRevision:word;
+     end;
+     CREATIVEADPCMWAVEFORMAT = creative_adpcmwaveformat_tag;
+     PCREATIVEADPCMWAVEFORMAT = ^CREATIVEADPCMWAVEFORMAT;
+     NPCREATIVEADPCMWAVEFORMAT = ^CREATIVEADPCMWAVEFORMAT;
+     LPCREATIVEADPCMWAVEFORMAT = ^CREATIVEADPCMWAVEFORMAT;
+     
+    { }
+    {    Creative FASTSPEECH }
+    { WAVEFORMAT_CREATIVE_FASTSPEECH8   (0x0202) }
+    { }
+
+       creative_fastspeech8format_tag = record
+            wfx : WAVEFORMATEX;
+            wRevision : word;
+         end;
+       CREATIVEFASTSPEECH8WAVEFORMAT = creative_fastspeech8format_tag;
+
+       PCREATIVEFASTSPEECH8WAVEFORMAT = ^CREATIVEFASTSPEECH8WAVEFORMAT;
+    (* near ignored *)
+
+       NPCREATIVEFASTSPEECH8WAVEFORMAT = ^CREATIVEFASTSPEECH8WAVEFORMAT;
+    (* far ignored *)
+
+       LPCREATIVEFASTSPEECH8WAVEFORMAT = ^CREATIVEFASTSPEECH8WAVEFORMAT;
+
+    { }
+    {    Creative FASTSPEECH }
+    { WAVEFORMAT_CREATIVE_FASTSPEECH10   (0x0203) }
+    { }
+       creative_fastspeech10format_tag = record
+            wfx : WAVEFORMATEX;
+            wRevision : word;
+         end;
+       CREATIVEFASTSPEECH10WAVEFORMAT = creative_fastspeech10format_tag;
+
+       PCREATIVEFASTSPEECH10WAVEFORMAT = ^CREATIVEFASTSPEECH10WAVEFORMAT;
+    (* near ignored *)
+
+       NPCREATIVEFASTSPEECH10WAVEFORMAT = ^CREATIVEFASTSPEECH10WAVEFORMAT;
+    (* far ignored *)
+
+       LPCREATIVEFASTSPEECH10WAVEFORMAT = ^CREATIVEFASTSPEECH10WAVEFORMAT;
+
+    { }
+    {  Fujitsu FM Towns 'SND' structure }
+    { }
+    {      for WAVE_FORMAT_FMMTOWNS_SND   (0x0300) }
+    { }
+    { }
+
+       fmtowns_snd_waveformat_tag = record
+            wfx : WAVEFORMATEX;
+            wRevision : word;
+         end;
+       FMTOWNS_SND_WAVEFORMAT = fmtowns_snd_waveformat_tag;
+
+       PFMTOWNS_SND_WAVEFORMAT = ^FMTOWNS_SND_WAVEFORMAT;
+    (* near ignored *)
+
+       NPFMTOWNS_SND_WAVEFORMAT = ^FMTOWNS_SND_WAVEFORMAT;
+    (* far ignored *)
+
+       LPFMTOWNS_SND_WAVEFORMAT = ^FMTOWNS_SND_WAVEFORMAT;
+
+    {  Olivetti structure }
+    { }
+    {      for WAVE_FORMAT_OLIGSM   (0x1000) }
+
+       oligsmwaveformat_tag = record
+            wfx : WAVEFORMATEX;
+         end;
+       OLIGSMWAVEFORMAT = oligsmwaveformat_tag;
+
+       POLIGSMWAVEFORMAT = ^OLIGSMWAVEFORMAT;
+    (* near ignored *)
+
+       NPOLIGSMWAVEFORMAT = ^OLIGSMWAVEFORMAT;
+    (* far ignored *)
+
+       LPOLIGSMWAVEFORMAT = ^OLIGSMWAVEFORMAT;
+       
+    { }
+    {  Olivetti structure }
+    { }
+    {      for WAVE_FORMAT_OLIADPCM   (0x1001) }
+    { }
+    { }
+       oliadpcmwaveformat_tag = record
+            wfx : WAVEFORMATEX;
+         end;
+       OLIADPCMWAVEFORMAT = oliadpcmwaveformat_tag;
+
+       POLIADPCMWAVEFORMAT = ^OLIADPCMWAVEFORMAT;
+    (* near ignored *)
+
+       NPOLIADPCMWAVEFORMAT = ^OLIADPCMWAVEFORMAT;
+    (* far ignored *)
+
+       LPOLIADPCMWAVEFORMAT = ^OLIADPCMWAVEFORMAT;
+
+    { }
+    {  Olivetti structure }
+    { }
+    {      for WAVE_FORMAT_OLICELP   (0x1002) }
+       olicelpwaveformat_tag = record
+            wfx : WAVEFORMATEX;
+         end;
+       OLICELPWAVEFORMAT = olicelpwaveformat_tag;
+       POLICELPWAVEFORMAT = ^OLICELPWAVEFORMAT;
+       NPOLICELPWAVEFORMAT = ^OLICELPWAVEFORMAT;
+       LPOLICELPWAVEFORMAT = ^OLICELPWAVEFORMAT;
+
+    { }
+    {  Olivetti structure }
+    { }
+    {      for WAVE_FORMAT_OLISBC   (0x1003) }
+    { }
+    { }
+
+       olisbcwaveformat_tag = record
+            wfx : WAVEFORMATEX;
+         end;
+       OLISBCWAVEFORMAT = olisbcwaveformat_tag;
+
+       POLISBCWAVEFORMAT = ^OLISBCWAVEFORMAT;
+    (* near ignored *)
+
+       NPOLISBCWAVEFORMAT = ^OLISBCWAVEFORMAT;
+    (* far ignored *)
+
+       LPOLISBCWAVEFORMAT = ^OLISBCWAVEFORMAT;
+
+    { }
+    {  Olivetti structure }
+    { }
+    {      for WAVE_FORMAT_OLIOPR   (0x1004) }
+    { }
+    { }
+       olioprwaveformat_tag = record
+            wfx : WAVEFORMATEX;
+         end;
+       OLIOPRWAVEFORMAT = olioprwaveformat_tag;
+
+       POLIOPRWAVEFORMAT = ^OLIOPRWAVEFORMAT;
+    (* near ignored *)
+
+       NPOLIOPRWAVEFORMAT = ^OLIOPRWAVEFORMAT;
+    (* far ignored *)
+
+       LPOLIOPRWAVEFORMAT = ^OLIOPRWAVEFORMAT;
+
+    { }
+    {  Crystal Semiconductor IMA ADPCM format }
+    { }
+    {      for WAVE_FORMAT_CS_IMAADPCM   (0x0039) }
+    { }
+    { }
+
+       csimaadpcmwaveformat_tag = record
+            wfx : WAVEFORMATEX;
+         end;
+       CSIMAADPCMWAVEFORMAT = csimaadpcmwaveformat_tag;
+
+       PCSIMAADPCMWAVEFORMAT = ^CSIMAADPCMWAVEFORMAT;
+    (* near ignored *)
+
+       NPCSIMAADPCMWAVEFORMAT = ^CSIMAADPCMWAVEFORMAT;
+    (* far ignored *)
+
+       LPCSIMAADPCMWAVEFORMAT = ^CSIMAADPCMWAVEFORMAT;
+
+{==========================================================================; }
+{ }
+{  ACM Wave Filters }
+{ }
+{ }
+{==========================================================================; }
+const
+       WAVE_FILTER_UNKNOWN = $0000;
+       WAVE_FILTER_DEVELOPMENT = $FFFF;
+
+type
+     wavefilter_tag = record
+       cbStruct:DWORD;                   //* Size of the filter in bytes */
+       dwFilterTag:DWORD;                //* filter type */
+       fdwFilter:DWORD;                  //* Flags for the filter (Universal Dfns) */
+       dwReserved:array[0..4] of DWORD;  //* Reserved for system use */
+     end;
+     WAVEFILTER = wavefilter_tag;
+     PWAVEFILTER = ^WAVEFILTER;
+     NPWAVEFILTER = ^WAVEFILTER;
+     LPWAVEFILTER = ^WAVEFILTER;
+
+const
+       WAVE_FILTER_VOLUME = $0001;
+
+type
+     wavefilter_volume_tag = record
+       wfltr:WAVEFILTER;
+       dwVolume:DWORD;
+     end;
+     VOLUMEWAVEFILTER = wavefilter_volume_tag;
+     PVOLUMEWAVEFILTER = ^VOLUMEWAVEFILTER;
+     NPVOLUMEWAVEFILTER = ^VOLUMEWAVEFILTER;
+     LPVOLUMEWAVEFILTER = ^VOLUMEWAVEFILTER;
+     
+const
+       WAVE_FILTER_ECHO = $0002;
+
+type
+     wavefilter_echo_tag = record
+       wfltr:WAVEFILTER;
+       dwVolume:DWORD;
+       dwDelay:DWORD;
+     end;
+     ECHOWAVEFILTER = wavefilter_echo_tag;
+     PECHOWAVEFILTER = ^ECHOWAVEFILTER;
+     NPECHOWAVEFILTER = ^ECHOWAVEFILTER;
+     LPECHOWAVEFILTER = ^ECHOWAVEFILTER;
+
+//////////////////////////////////////////////////////////////////////////
+//
+// New RIFF WAVE Chunks
+//
+const
+      RIFFWAVE_inst = FOURCC(byte(AnsiChar('i')) or
+                             (byte(AnsiChar('n')) shl 8) or
+                             (byte(AnsiChar('s')) shl 16) or
+                             (byte(AnsiChar('t')) shl 24)
+                            );
+
+type
+     tag_s_RIFFWAVE_inst = record
+       bUnshiftedNote:byte;
+       chFineTune:ShortInt;
+       chGain:ShortInt;
+       bLowNote:byte;
+       bHighNote:byte;
+       bLowVelocity:byte;
+       bHighVelocity:byte;
+     end;
+     s_RIFFWAVE_inst = tag_s_RIFFWAVE_INST;
+
+{$ENDIF} // NONEWWAVE
+
+//////////////////////////////////////////////////////////////////////////
+//
+// New RIFF Forms
+//
+
+{$IFNDEF NONEWRIFF}
+
+// RIFF AVI
+//
+// AVI file format is specified in a seperate file (AVIFMT.H),
+// which is available in the VfW and Win 32 SDK
+//
+
+// RIFF CPPO
+const
+      RIFFCPPO = FOURCC(byte(AnsiChar('C')) or
+                        (byte(AnsiChar('P')) shl 8) or
+                        (byte(AnsiChar('P')) shl 16) or
+                        (byte(AnsiChar('O')) shl 24)
+                       );
+
+      RIFFCPPO_objr = FOURCC(byte(AnsiChar('o')) or
+                             (byte(AnsiChar('b')) shl 8) or
+                             (byte(AnsiChar('j')) shl 16) or
+                             (byte(AnsiChar('r')) shl 24)
+                            );
+
+      RIFFCPPO_obji = FOURCC(byte(AnsiChar('o')) or
+                             (byte(AnsiChar('b')) shl 8) or
+                             (byte(AnsiChar('j')) shl 16) or
+                             (byte(AnsiChar('i')) shl 24)
+                            );
+
+      RIFFCPPO_clsr = FOURCC(byte(AnsiChar('c')) or
+                             (byte(AnsiChar('l')) shl 8) or
+                             (byte(AnsiChar('s')) shl 16) or
+                             (byte(AnsiChar('r')) shl 24)
+                            );
+
+      RIFFCPPO_clsi = FOURCC(byte(AnsiChar('c')) or
+                             (byte(AnsiChar('l')) shl 8) or
+                             (byte(AnsiChar('s')) shl 16) or
+                             (byte(AnsiChar('i')) shl 24)
+                            );
+
+      RIFFCPPO_mbr  = FOURCC(byte(AnsiChar('m')) or
+                             (byte(AnsiChar('b')) shl 8) or
+                             (byte(AnsiChar('r')) shl 16) or
+                             (byte(AnsiChar(' ')) shl 24)
+                            );
+
+      RIFFCPPO_char = FOURCC(byte(AnsiChar('c')) or
+                             (byte(AnsiChar('h')) shl 8) or
+                             (byte(AnsiChar('a')) shl 16) or
+                             (byte(AnsiChar('r')) shl 24)
+                            );
+
+      RIFFCPPO_byte = FOURCC(byte(AnsiChar('b')) or
+                             (byte(AnsiChar('y')) shl 8) or
+                             (byte(AnsiChar('t')) shl 16) or
+                             (byte(AnsiChar('e')) shl 24)
+                            );
+      RIFFCPPO_int  = FOURCC(byte(AnsiChar('i')) or
+                             (byte(AnsiChar('n')) shl 8) or
+                             (byte(AnsiChar('t')) shl 16) or
+                             (byte(AnsiChar(' ')) shl 24)
+                            );
+
+      RIFFCPPO_word = FOURCC(byte(AnsiChar('w')) or
+                             (byte(AnsiChar('o')) shl 8) or
+                             (byte(AnsiChar('r')) shl 16) or
+                             (byte(AnsiChar('d')) shl 24)
+                            );
+      RIFFCPPO_long = FOURCC(byte(AnsiChar('l')) or
+                             (byte(AnsiChar('o')) shl 8) or
+                             (byte(AnsiChar('n')) shl 16) or
+                             (byte(AnsiChar('g')) shl 24)
+                            );
+      RIFFCPPO_dwrd  = FOURCC(byte(AnsiChar('d')) or
+                             (byte(AnsiChar('w')) shl 8) or
+                             (byte(AnsiChar('r')) shl 16) or
+                             (byte(AnsiChar('d')) shl 24)
+                            );
+      RIFFCPPO_flt   = FOURCC(byte(AnsiChar('f')) or
+                             (byte(AnsiChar('l')) shl 8) or
+                             (byte(AnsiChar('t')) shl 16) or
+                             (byte(AnsiChar(' ')) shl 24)
+                            );
+      RIFFCPPO_dbl   = FOURCC(byte(AnsiChar('d')) or
+                             (byte(AnsiChar('b')) shl 8) or
+                             (byte(AnsiChar('l')) shl 16) or
+                             (byte(AnsiChar(' ')) shl 24)
+                            );
+      RIFFCPPO_str   = FOURCC(byte(AnsiChar('s')) or
+                             (byte(AnsiChar('t')) shl 8) or
+                             (byte(AnsiChar('r')) shl 16) or
+                             (byte(AnsiChar(' ')) shl 24)
+                            );
+
+{$ENDIF} // NONEWRIFF
+
+
+//////////////////////////////////////////////////////////////////////////
+//
+// DIB Compression Defines
+//
+
+const
+       BI_BITFIELDS = 3;
+
+const
+       QUERYDIBSUPPORT = 3073;
+       QDI_SETDIBITS = $0001;
+       QDI_GETDIBITS = $0002;
+       QDI_DIBTOSCREEN = $0004;
+       QDI_STRETCHDIB = $0008;
+
+{ @CESYSGEN IF GWES_PGDI || GWES_MGBASE }
+
+{$IFNDEF NOBITMAP}
+type
+     tagEXBMINFOHEADER = record
+       bmi:BITMAPINFOHEADER;
+      // extended BITMAPINFOHEADER fields
+       biExtDataOffset:DWORD;
+      // Other elements will go here
+
+      // ...
+      // Format-specific information
+      // biExtDataOffset points here
+     end;
+     EXBMINFOHEADER = tagEXBMINFOHEADER;
+{$ENDIF} // NOBITMAP
+
+{ @CESYSGEN ENDIF }
+
+// New DIB Compression Defines
+const
+      BICOMP_IBMULTIMOTION  = FOURCC(byte(AnsiChar('U')) or
+                                     (byte(AnsiChar('L')) shl 8) or
+                                     (byte(AnsiChar('T')) shl 16) or
+                                     (byte(AnsiChar('I')) shl 24)
+                                    );
+
+      BICOMP_IBMPHOTOMOTION = FOURCC(byte(AnsiChar('P')) or
+                                     (byte(AnsiChar('H')) shl 8) or
+                                     (byte(AnsiChar('M')) shl 16) or
+                                     (byte(AnsiChar('O')) shl 24)
+                                    );
+
+      BICOMP_CREATIVEYUV    = FOURCC(byte(AnsiChar('c')) or
+                                     (byte(AnsiChar('y')) shl 8) or
+                                     (byte(AnsiChar('u')) shl 16) or
+                                     (byte(AnsiChar('v')) shl 24)
+                                    );
+
+
+{$IFNDEF NOJPEGDIB}
+// New DIB Compression Defines
+const
+      JPEG_DIB              = FOURCC(byte(AnsiChar('J')) or
+                                     (byte(AnsiChar('P')) shl 8) or
+                                     (byte(AnsiChar('E')) shl 16) or
+                                     (byte(AnsiChar('G')) shl 24)
+                                    ); // Still image JPEG DIB biCompression
+
+      MJPG_DIB              = FOURCC(byte(AnsiChar('M')) or
+                                     (byte(AnsiChar('J')) shl 8) or
+                                     (byte(AnsiChar('P')) shl 16) or
+                                     (byte(AnsiChar('G')) shl 24)
+                                    ); // Motion JPEG DIB biCompression
+
+{ JPEGProcess Definitions  }
+const
+       JPEG_PROCESS_BASELINE = 0;    { Baseline DCT  }
+    { AVI File format extensions  }
+       AVIIF_CONTROLFRAME = $00000200;     { This is a control frame  }
+             
+    { JIF Marker byte pairs in JPEG Interchange Format sequence  }
+    { SOF Huff  - Baseline DCT }
+       JIFMK_SOF0 = $FFC0;       
+    { SOF Huff  - Extended sequential DCT }
+       JIFMK_SOF1 = $FFC1;       
+    { SOF Huff  - Progressive DCT }
+       JIFMK_SOF2 = $FFC2;       
+    { SOF Huff  - Spatial (sequential) lossless }
+       JIFMK_SOF3 = $FFC3;       
+    { SOF Huff  - Differential sequential DCT }
+       JIFMK_SOF5 = $FFC5;       
+    { SOF Huff  - Differential progressive DCT }
+       JIFMK_SOF6 = $FFC6;       
+    { SOF Huff  - Differential spatial }
+       JIFMK_SOF7 = $FFC7;       
+    { SOF Arith - Reserved for JPEG extensions }
+       JIFMK_JPG = $FFC8;       
+    { SOF Arith - Extended sequential DCT }
+       JIFMK_SOF9 = $FFC9;       
+    { SOF Arith - Progressive DCT }
+       JIFMK_SOF10 = $FFCA;       
+    { SOF Arith - Spatial (sequential) lossless }
+       JIFMK_SOF11 = $FFCB;       
+    { SOF Arith - Differential sequential DCT }
+       JIFMK_SOF13 = $FFCD;       
+    { SOF Arith - Differential progressive DCT }
+       JIFMK_SOF14 = $FFCE;       
+    { SOF Arith - Differential spatial }
+       JIFMK_SOF15 = $FFCF;       
+    { Define Huffman Table(s)  }
+       JIFMK_DHT = $FFC4;       
+    { Define Arithmetic coding conditioning(s)  }
+       JIFMK_DAC = $FFCC;       
+    { Restart with modulo 8 count 0  }
+       JIFMK_RST0 = $FFD0;       
+    { Restart with modulo 8 count 1  }
+       JIFMK_RST1 = $FFD1;       
+    { Restart with modulo 8 count 2  }
+       JIFMK_RST2 = $FFD2;       
+    { Restart with modulo 8 count 3  }
+       JIFMK_RST3 = $FFD3;
+    { Restart with modulo 8 count 4  }
+       JIFMK_RST4 = $FFD4;       
+    { Restart with modulo 8 count 5  }
+       JIFMK_RST5 = $FFD5;       
+    { Restart with modulo 8 count 6  }
+       JIFMK_RST6 = $FFD6;       
+    { Restart with modulo 8 count 7  }
+       JIFMK_RST7 = $FFD7;       
+    { Start of Image  }
+       JIFMK_SOI = $FFD8;       
+    { End of Image  }
+       JIFMK_EOI = $FFD9;       
+    { Start of Scan  }
+       JIFMK_SOS = $FFDA;       
+    { Define quantization Table(s)  }
+       JIFMK_DQT = $FFDB;       
+    { Define Number of Lines  }
+       JIFMK_DNL = $FFDC;       
+    { Define Restart Interval  }
+       JIFMK_DRI = $FFDD;       
+    { Define Hierarchical progression  }
+       JIFMK_DHP = $FFDE;       
+    { Expand Reference Component(s)  }
+       JIFMK_EXP = $FFDF;       
+    { Application Field 0 }
+       JIFMK_APP0 = $FFE0;       
+    { Application Field 1 }
+       JIFMK_APP1 = $FFE1;       
+    { Application Field 2 }
+       JIFMK_APP2 = $FFE2;       
+    { Application Field 3 }
+       JIFMK_APP3 = $FFE3;       
+    { Application Field 4 }
+       JIFMK_APP4 = $FFE4;       
+    { Application Field 5 }
+       JIFMK_APP5 = $FFE5;       
+    { Application Field 6 }
+       JIFMK_APP6 = $FFE6;       
+    { Application Field 7 }
+       JIFMK_APP7 = $FFE7;       
+    { Reserved for JPEG extensions  }
+       JIFMK_JPG0 = $FFF0;       
+    { Reserved for JPEG extensions  }
+       JIFMK_JPG1 = $FFF1;       
+    { Reserved for JPEG extensions  }
+       JIFMK_JPG2 = $FFF2;       
+    { Reserved for JPEG extensions  }
+       JIFMK_JPG3 = $FFF3;       
+    { Reserved for JPEG extensions  }
+       JIFMK_JPG4 = $FFF4;       
+    { Reserved for JPEG extensions  }
+       JIFMK_JPG5 = $FFF5;       
+    { Reserved for JPEG extensions  }
+       JIFMK_JPG6 = $FFF6;
+    { Reserved for JPEG extensions  }
+       JIFMK_JPG7 = $FFF7;       
+    { Reserved for JPEG extensions  }
+       JIFMK_JPG8 = $FFF8;       
+    { Reserved for JPEG extensions  }
+       JIFMK_JPG9 = $FFF9;       
+    { Reserved for JPEG extensions  }
+       JIFMK_JPG10 = $FFFA;       
+    { Reserved for JPEG extensions  }
+       JIFMK_JPG11 = $FFFB;       
+    { Reserved for JPEG extensions  }
+       JIFMK_JPG12 = $FFFC;       
+    { Reserved for JPEG extensions  }
+       JIFMK_JPG13 = $FFFD;       
+    { Comment  }
+       JIFMK_COM = $FFFE;       
+    { for temp private use arith code  }
+       JIFMK_TEM = $FF01;       
+    { Reserved  }
+       JIFMK_RES = $FF02;
+    { Zero stuffed byte - entropy data  }
+       JIFMK_00 = $FF00;       
+    { Fill byte  }
+       JIFMK_FF = $FFFF;
+       
+    { JPEGColorSpaceID Definitions  }
+    { Y only component of YCbCr  }
+       JPEG_Y = 1;       
+    { YCbCr as define by CCIR 601  }
+       JPEG_YCbCr = 2;       
+    { 3 component RGB  }
+       JPEG_RGB = 3;       
+    { Structure definitions  }
+    { compression-specific fields  }
+    { these fields are defined for 'JPEG' and 'MJPG'  }
+    { Process specific fields  }
+
+type
+     tagJPEGINFOHEADER = record
+      // compression-specific fields
+      // these fields are defined for 'JPEG' and 'MJPG'
+       JPEGSize:DWORD;
+       JPEGProcess:DWORD;
+
+      // Process specific fields  
+       JPEGColorSpaceID:DWORD;
+       JPEGBitsPerSample:DWORD;
+       JPEGHSubSampling:DWORD;
+       JPEGVSubSampling:DWORD;
+     end;
+     JPEGINFOHEADER = tagJPEGINFOHEADER;
+
+{$IFDEF MJPGDHTSEG_STORAGE}
+// Default DHT Segment
+const
+     // JPEG DHT Segment for YCrCb omitted from MJPG data
+      MJPGDHTSeg:array[0..$01A4-1] of byte =
+        ($FF,$C4,$01,$A2,$00,$00,$01,$05,$01,$01,$01,$01,$01,$01,
+         $00,$00,$00,$00,$00,$00,$00,$00,$01,$02,$03,$04,$05,$06,
+         $07,$08,$09,$0A,$0B,$01,$00,$03,$01,$01,$01,$01,$01,$01,
+         $01,$01,$01,$00,$00,$00,$00,$00,$00,$01,$02,$03,$04,$05,
+         $06,$07,$08,$09,$0A,$0B,$10,$00,$02,$01,$03,$03,$02,$04,
+         $03,$05,$05,$04,$04,$00,$00,$01,$7D,$01,$02,$03,$00,$04,
+         $11,$05,$12,$21,$31,$41,$06,$13,$51,$61,$07,$22,$71,$14,
+         $32,$81,$91,$A1,$08,$23,$42,$B1,$C1,$15,$52,$D1,$F0,$24,
+         $33,$62,$72,$82,$09,$0A,$16,$17,$18,$19,$1A,$25,$26,$27,
+         $28,$29,$2A,$34,$35,$36,$37,$38,$39,$3A,$43,$44,$45,$46,
+         $47,$48,$49,$4A,$53,$54,$55,$56,$57,$58,$59,$5A,$63,$64,
+         $65,$66,$67,$68,$69,$6A,$73,$74,$75,$76,$77,$78,$79,$7A,
+         $83,$84,$85,$86,$87,$88,$89,$8A,$92,$93,$94,$95,$96,$97,
+         $98,$99,$9A,$A2,$A3,$A4,$A5,$A6,$A7,$A8,$A9,$AA,$B2,$B3,
+         $B4,$B5,$B6,$B7,$B8,$B9,$BA,$C2,$C3,$C4,$C5,$C6,$C7,$C8,
+         $C9,$CA,$D2,$D3,$D4,$D5,$D6,$D7,$D8,$D9,$DA,$E1,$E2,$E3,
+         $E4,$E5,$E6,$E7,$E8,$E9,$EA,$F1,$F2,$F3,$F4,$F5,$F6,$F7,
+         $F8,$F9,$FA,$11,$00,$02,$01,$02,$04,$04,$03,$04,$07,$05,
+         $04,$04,$00,$01,$02,$77,$00,$01,$02,$03,$11,$04,$05,$21,
+         $31,$06,$12,$41,$51,$07,$61,$71,$13,$22,$32,$81,$08,$14,
+         $42,$91,$A1,$B1,$C1,$09,$23,$33,$52,$F0,$15,$62,$72,$D1,
+         $0A,$16,$24,$34,$E1,$25,$F1,$17,$18,$19,$1A,$26,$27,$28,
+         $29,$2A,$35,$36,$37,$38,$39,$3A,$43,$44,$45,$46,$47,$48,
+         $49,$4A,$53,$54,$55,$56,$57,$58,$59,$5A,$63,$64,$65,$66,
+         $67,$68,$69,$6A,$73,$74,$75,$76,$77,$78,$79,$7A,$82,$83,
+         $84,$85,$86,$87,$88,$89,$8A,$92,$93,$94,$95,$96,$97,$98,
+         $99,$9A,$A2,$A3,$A4,$A5,$A6,$A7,$A8,$A9,$AA,$B2,$B3,$B4,
+         $B5,$B6,$B7,$B8,$B9,$BA,$C2,$C3,$C4,$C5,$C6,$C7,$C8,$C9,
+         $CA,$D2,$D3,$D4,$D5,$D6,$D7,$D8,$D9,$DA,$E2,$E3,$E4,$E5,
+         $E6,$E7,$E8,$E9,$EA,$F2,$F3,$F4,$F5,$F6,$F7,$F8,$F9,$FA
+        );
+
+// End DHT default
+{$ENDIF} // MJPGDHTSEG_STORAGE
+
+{$ENDIF} // NOJPEGDIB
+
+
+//////////////////////////////////////////////////////////////////////////
+//
+// Defined IC types
+
+{$IFNDEF NONEWIC}
+const
+      ICTYPE_VIDEO    = FOURCC(byte(AnsiChar('v')) or
+                               (byte(AnsiChar('i')) shl 8) or
+                               (byte(AnsiChar('d')) shl 16) or
+                               (byte(AnsiChar('c')) shl 24)
+                              );
+
+      ICTYPE_AUDIO    = FOURCC(byte(AnsiChar('a')) or
+                               (byte(AnsiChar('u')) shl 8) or
+                               (byte(AnsiChar('d')) shl 16) or
+                               (byte(AnsiChar('c')) shl 24)
+                              );
+{$ENDIF} // NONEWIC
+
+
+//   Misc. FOURCC registration
+
+{* Sierra Semiconductor: RDSP- Confidential RIFF file format
+//       for the storage and downloading of DSP
+//       code for Audio and communications devices.
+*}
+const
+      FOURCC_RDSP     = FOURCC(byte(AnsiChar('R')) or
+                               (byte(AnsiChar('D')) shl 8) or
+                               (byte(AnsiChar('S')) shl 16) or
+                               (byte(AnsiChar('P')) shl 24)
+                              );
+
+{$PACKRECORDS DEFAULT} //   {#include "poppack.h"    /* Revert to default packing */ }
+
+implementation
+
+end.

+ 1868 - 0
packages/winceunits/src/mmsystem.pp

@@ -0,0 +1,1868 @@
+//
+// Module Name:mmsystem.h -- Include file for Multimedia API's
+//
+// *    If defined, the following flags inhibit inclusion
+// *    of the indicated items:
+// *
+// *      MMNOSOUND       Sound support
+// *      MMNOWAVE        Waveform support
+// *      MMNOMCI         MCI API
+// *      MMNOMMIO        file I/O
+// *
+// *
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit mmsystem;
+
+{$CALLING cdecl}
+
+interface
+
+uses Windows, mmreg;
+
+{$PACKRECORDS 1} // #include "pshpack1.h"   // Assume byte packing throughout
+
+{$DEFINE MMNOMIDI} // No midi audio support.
+
+{$IFDEF WIN32}
+{$DEFINE _WIN32}
+{$ENDIF WIN32}
+
+{****************************************************************************
+
+                    General constants and data types
+
+****************************************************************************}
+//* general constants */
+const
+      MAXPNAMELEN      = 32;     // max product name length (including NULL)
+      MAXERRORLENGTH   = 128;    // max error text length (including final NULL)
+
+{*
+ *  Microsoft Manufacturer and Product ID's
+ *
+    Used with wMid and wPid fields in WAVEOUTCAPS, WAVEINCAPS,
+    MIDIOUTCAPS, MIDIINCAPS, AUXCAPS, JOYCAPS structures.
+ *}
+{*
+ *  (these have been moved to
+ *  MMREG.H for Windows 4.00 and above).
+ *}
+//* manufacturer IDs *
+const
+      MM_MICROSOFT            = 1;        // Microsoft Corporation
+
+
+//* general data types */
+type
+     MMVERSION = UINT;      // major (high byte), minor (low byte)
+
+     MMRESULT = UINT;       // error return code, 0 means no error
+                                // call as if(err=xxxx(...)) Error(err); else
+
+     LPUINT = ^UINT;
+
+
+//* MMTIME data structure */
+type
+     mmtime_tag = record
+       wType:UINT;      //* indicates the contents of the union */
+       case UINT of
+         0: (ms:DWORD);         //* milliseconds */
+         1: (sample:DWORD);     //* samples */
+         2: (cb:DWORD);         //* byte count */
+         3: (ticks:DWORD);      //* ticks in MIDI stream */
+         4: (smpte:record
+                     hour:byte;       //* hours */
+                     min:byte;        //* minutes */
+                     sec:byte;        //* seconds */
+                     frame:byte;      //* frames  */
+                     fps:byte;        //* frames per second */
+                     dummy:byte;      //* pad */
+{$IFDEF _WIN32}
+                     pad:array[0..1] of byte;
+{$ENDIF _WIN32}
+                   end);
+         5: (midi:record
+                    songptrpos:DWORD;   //* song pointer position */
+                  end);
+     end;
+     MMTIME = mmtime_tag;
+     PMMTIME = ^mmtime_tag;
+     NPMMTIME = ^mmtime_tag;
+     LPMMTIME = ^mmtime_tag;
+
+//* types for wType field in MMTIME struct */
+const
+      TIME_MS         = $0001; //* time in milliseconds */
+      TIME_SAMPLES    = $0002; //* number of wave samples */
+      TIME_BYTES      = $0004; //* current byte offset */
+      TIME_SMPTE      = $0008; //* SMPTE time */
+      TIME_MIDI       = $0010; //* MIDI time */
+      TIME_TICKS      = $0020; //* Ticks within MIDI stream */
+
+{ Was declared as
+      MAKEFOURCC(ch0, ch1, ch2, ch3)                              \
+      ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) |   \
+      ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
+
+      mmioFOURCC(ch0, ch1, ch2, ch3)  MAKEFOURCC(ch0, ch1, ch2, ch3)
+}
+function MAKEFOURCC(ch0:AnsiChar; ch1:AnsiChar; ch2:AnsiChar; ch3:AnsiChar):FOURCC;
+function mmioFOURCC(ch0:AnsiChar; ch1:AnsiChar; ch2:AnsiChar; ch3:AnsiChar):FOURCC;
+
+
+{****************************************************************************
+
+            Multimedia Extensions Window Messages
+
+****************************************************************************}
+const
+      MM_MCINOTIFY        = $3B9;           //* MCI */
+
+      MM_WOM_OPEN         = $3BB;           //* waveform output */
+      MM_WOM_CLOSE        = $3BC;
+      MM_WOM_DONE         = $3BD;
+      MM_WOM_ATTENUATED   = $3D8;           //* gain class support - stream attenuated */
+
+      MM_WIM_OPEN         = $3BE;           //* waveform input */
+      MM_WIM_CLOSE        = $3BF;
+      MM_WIM_DATA         = $3C0;
+
+      MM_MIM_OPEN         = $3C1;           //* MIDI input */
+      MM_MIM_CLOSE        = $3C2;
+      MM_MIM_DATA         = $3C3;
+      MM_MIM_LONGDATA     = $3C4;
+      MM_MIM_ERROR        = $3C5;
+      MM_MIM_LONGERROR    = $3C6;
+
+      MM_MOM_OPEN         = $3C7;           //* MIDI output */
+      MM_MOM_CLOSE        = $3C8;
+      MM_MOM_DONE         = $3C9;
+
+//* these are also in msvideo.h */
+      MM_DRVM_OPEN       = $3D0;           //* installable drivers */
+      MM_DRVM_CLOSE      = $3D1;
+      MM_DRVM_DATA       = $3D2;
+      MM_DRVM_ERROR      = $3D3;
+
+      MM_MCISYSTEM_STRING = $3CA;       //* internal */
+
+//* these are used by msacm.h */
+      MM_STREAM_OPEN      = $3D4;
+      MM_STREAM_CLOSE     = $3D5;
+      MM_STREAM_DONE      = $3D6;
+      MM_STREAM_ERROR     = $3D7;
+
+      MM_MOM_POSITIONCB   = $3CA;           //* Callback for MEVT_POSITIONCB */
+
+      MM_MCISIGNAL        = $3CB;
+
+      MM_MIM_MOREDATA      = $3CC;          //* MIM_DONE w/ pending events */
+
+      MM_MIXM_LINE_CHANGE     = $3D0;       //* mixer line change notify */
+      MM_MIXM_CONTROL_CHANGE  = $3D1;       //* mixer control change notify */
+
+{****************************************************************************
+
+        String resource number bases (internal use)
+
+****************************************************************************}
+const
+      MMSYSERR_BASE          = 0;
+      WAVERR_BASE            = 32;
+      MIDIERR_BASE           = 64;
+      TIMERR_BASE            = 96;
+      MCIERR_BASE            = 256;
+      MIXERR_BASE            = 1024;
+
+      MCI_STRING_OFFSET      = 512;
+      MCI_VD_OFFSET          = 1024;
+      MCI_CD_OFFSET          = 1088;
+      MCI_WAVE_OFFSET        = 1152;
+      MCI_SEQ_OFFSET         = 1216;
+
+{****************************************************************************
+
+            General error return values
+
+****************************************************************************}
+const
+//* general error return values */
+      MMSYSERR_NOERROR      = 0;                  //* no error */
+      MMSYSERR_ERROR        = MMSYSERR_BASE + 1;  //* unspecified error */
+      MMSYSERR_BADDEVICEID  = MMSYSERR_BASE + 2;  //* device ID out of range */
+      MMSYSERR_NOTENABLED   = MMSYSERR_BASE + 3;  //* driver failed enable */
+      MMSYSERR_ALLOCATED    = MMSYSERR_BASE + 4;  //* device already allocated */
+      MMSYSERR_INVALHANDLE  = MMSYSERR_BASE + 5;  //* device handle is invalid */
+      MMSYSERR_NODRIVER     = MMSYSERR_BASE + 6;  //* no device driver present */
+      MMSYSERR_NOMEM        = MMSYSERR_BASE + 7;  //* memory allocation error */
+      MMSYSERR_NOTSUPPORTED = MMSYSERR_BASE + 8;  //* function isn't supported */
+      MMSYSERR_BADERRNUM    = MMSYSERR_BASE + 9;  //* error value out of range */
+      MMSYSERR_INVALFLAG    = MMSYSERR_BASE + 10; //* invalid flag passed */
+      MMSYSERR_INVALPARAM   = MMSYSERR_BASE + 11; //* invalid parameter passed */
+      MMSYSERR_HANDLEBUSY   = MMSYSERR_BASE + 12; //* handle being used */
+                                                  //* simultaneously on another */
+                                                  //* thread (eg callback) */
+      MMSYSERR_INVALIDALIAS = MMSYSERR_BASE + 13; //* specified alias not found */
+      MMSYSERR_BADDB        = MMSYSERR_BASE + 14; //* bad registry database */
+      MMSYSERR_KEYNOTFOUND  = MMSYSERR_BASE + 15; //* registry key not found */
+      MMSYSERR_READERROR    = MMSYSERR_BASE + 16; //* registry read error */
+      MMSYSERR_WRITEERROR   = MMSYSERR_BASE + 17; //* registry write error */
+      MMSYSERR_DELETEERROR  = MMSYSERR_BASE + 18; //* registry delete error */
+      MMSYSERR_VALNOTFOUND  = MMSYSERR_BASE + 19; //* registry value not found */
+      MMSYSERR_NODRIVERCB   = MMSYSERR_BASE + 20; //* driver does not call DriverCallback */
+      MMSYSERR_LASTERROR    = MMSYSERR_BASE + 20; //* last error in range */
+
+type
+     HDRVR = HANDLE;
+
+{$IFNDEF MMNODRV}
+//
+// Installable driver support was left out.
+//
+{$ENDIF MMNODRV}
+
+
+{****************************************************************************
+
+              Driver callback support
+
+****************************************************************************}
+
+//* flags used with waveOutOpen(), waveInOpen(), midiInOpen(), and */
+//* midiOutOpen() to specify the type of the dwCallback parameter. */
+const
+      CALLBACK_TYPEMASK   = $00070000;    //* callback type mask */
+      CALLBACK_NULL       = $00000000;    //* no callback */
+      CALLBACK_WINDOW     = $00010000;    //* dwCallback is a HWND */
+      CALLBACK_TASK       = $00020000;    //* dwCallback is a HTASK */
+      CALLBACK_FUNCTION   = $00030000;    //* dwCallback is a FARPROC */
+      CALLBACK_THREAD     = CALLBACK_TASK;//* thread ID replaces 16 bit task */
+      CALLBACK_EVENT      = $00050000;    //* dwCallback is an EVENT Handle */
+      CALLBACK_MSGQUEUE   = $00060000;    //* dwCallback is HANDLE returned by CreateMsgQueue or OpenMsgQueue (new in Windows CE 5.0) */
+
+
+type
+     DRVCALLBACK = procedure(_hdrvr:HANDLE; uMsg:UINT; dwUser:DWORD; dw1:DWORD; dw2:DWORD); cdecl;
+     LPDRVCALLBACK = DRVCALLBACK;
+     PDRVCALLBACK = DRVCALLBACK;
+
+{* CALLBACK_MSGQUEUE - client process sets up a MsgQueuue that receives WAVEMSG structures.
+*  Note that structure fields are identical to arguments to a callback function
+*  but we put the message field first to allow for multi-functional message queues.
+*}
+type
+     _tag_WAVEMSG = record
+       uMsg:UINT;       // WOM_OPEN, WIM_OPEN, WOM_DONE, WIM_DATA, etc.
+       hWav:HANDLE;       // stream handle returned by waveInOpen or waveOutOpen
+       dwInstance:DWORD; // value of dwInstance argument passed into waveInOpen or waveOutOpen
+       dwParam1:DWORD;   // completed WAVEHDR for WIM_DATA, WOM_DONE, reserved elsewhere
+       dwParam2:DWORD;   // reserved
+     end;
+     WAVEMSG = _tag_WAVEMSG;
+     PWAVEMSG = ^_tag_WAVEMSG;
+
+{$IFNDEF MMNOSOUND}
+
+function sndPlaySoundW(lpszSoundName:LPCWSTR; fuSound:UINT):BOOL; external KernelDLL name 'sndPlaySoundW'; // index 266
+{$IFDEF UNICODE}
+function sndPlaySound(lpszSoundName:LPCWSTR; fuSound:UINT):BOOL; external KernelDLL name 'sndPlaySoundW'; // index 266
+{$ELSE} // UNICODE
+//#define sndPlaySound  sndPlaySoundA
+{$ENDIF} // UNICODE
+
+function PlaySoundW(pszSound:LPCWSTR; hmod:HMODULE; fdwSound:DWORD):BOOL; external KernelDLL name 'PlaySoundW'; // index 267
+{$IFDEF UNICODE}
+function PlaySound(pszSound:LPCWSTR; hmod:HMODULE; fdwSound:DWORD):BOOL; external KernelDLL name 'PlaySoundW'; // index 267
+{$ELSE} // UNICODE
+//#define PlaySound  PlaySoundA
+{$ENDIF} // UNICODE
+
+{*
+ *  flag values for fuSound arguments on [snd]PlaySound
+ *  or dwFlags for PlaySound
+ *}
+
+//* sndAlias creates the alias identifier */
+const
+      SND_ALIAS_START  = 0;      // ??? must be > 4096 to keep strings in same section of resource file
+
+function sndAlias(ch0:AnsiChar; ch1:AnsiChar):DWORD;
+
+const
+      SND_ALIAS_SYSTEMASTERISK        = SND_ALIAS_START+
+                                        (DWORD(AnsiChar('S')) or
+                                         DWORD(AnsiChar('*')));
+
+      SND_ALIAS_SYSTEMQUESTION        = SND_ALIAS_START+
+                                        (DWORD(AnsiChar('S')) or
+                                         DWORD(AnsiChar('?')));
+
+      SND_ALIAS_SYSTEMHAND            = SND_ALIAS_START+
+                                        (DWORD(AnsiChar('S')) or
+                                         DWORD(AnsiChar('H')));
+
+      SND_ALIAS_SYSTEMEXIT            = SND_ALIAS_START+
+                                        (DWORD(AnsiChar('S')) or
+                                         DWORD(AnsiChar('E')));
+
+      SND_ALIAS_SYSTEMSTART           = SND_ALIAS_START+
+                                        (DWORD(AnsiChar('S')) or
+                                         DWORD(AnsiChar('S')));
+
+      SND_ALIAS_SYSTEMWELCOME         = SND_ALIAS_START+
+                                        (DWORD(AnsiChar('S')) or
+                                         DWORD(AnsiChar('W')));
+
+      SND_ALIAS_SYSTEMEXCLAMATION     = SND_ALIAS_START+
+                                        (DWORD(AnsiChar('S')) or
+                                         DWORD(AnsiChar('!')));
+
+      SND_ALIAS_SYSTEMDEFAULT         = SND_ALIAS_START+
+                                        (DWORD(AnsiChar('S')) or
+                                         DWORD(AnsiChar('D')));
+
+      SND_ALIAS      = $00010000;   // name is a WIN.INI [sounds] entry
+      SND_FILENAME   = $00020000;   // name is a file name
+      SND_RESOURCE   = $00040004;   // name is a resource name or atom
+
+      SND_SYNC       = $00000000;   // play synchronously (default)
+      SND_ASYNC      = $00000001;   // play asynchronously
+      SND_NODEFAULT  = $00000002;   // silence not default, if sound not found
+      SND_MEMORY     = $00000004;   // lpszSoundName points to a memory file
+      SND_LOOP       = $00000008;   // loop the sound until next sndPlaySound
+      SND_NOSTOP     = $00000010;   // don't stop any currently playing sound
+
+      SND_NOWAIT     = $00002000;   // don't wait if the driver is busy
+      SND_VALIDFLAGS = $0017201F;   // Set of valid flag bits.  Anything outside
+                                    // this range will raise an error
+      SND_RESERVED   = $FF000000;   // In particular these flags are reserved
+      SND_TYPE_MASK  = $00170007;
+      SND_ALIAS_ID   = $00110000;   // name is a WIN.INI [sounds] entry identifier
+
+{$ENDIF} // MMNOSOUND
+
+
+{$IFNDEF MMNOWAVE}
+{****************************************************************************
+
+                        Waveform audio support
+
+****************************************************************************}
+const
+//* waveform audio error return values */
+      WAVERR_BADFORMAT      = WAVERR_BASE + 0;    // unsupported wave format
+      WAVERR_STILLPLAYING   = WAVERR_BASE + 1;    // still something playing
+      WAVERR_UNPREPARED     = WAVERR_BASE + 2;    // header not prepared
+      WAVERR_SYNC           = WAVERR_BASE + 3;    // device is synchronous
+      WAVERR_LASTERROR      = WAVERR_BASE + 3;    // last error in range
+
+//* waveform audio data types */
+type
+     HWAVE = HANDLE;
+     HWAVEIN = HANDLE;
+     LPHWAVEIN = ^HWAVEIN;
+     HWAVEOUT = HANDLE;
+     LPHWAVEOUT = ^HWAVEOUT;
+
+     WAVECALLBACK = DRVCALLBACK;
+     LPWAVECALLBACK = WAVECALLBACK;
+
+const
+//* wave callback messages */
+      WOM_OPEN        = MM_WOM_OPEN;
+      WOM_CLOSE       = MM_WOM_CLOSE;
+      WOM_DONE        = MM_WOM_DONE;
+      WIM_OPEN        = MM_WIM_OPEN;
+      WIM_CLOSE       = MM_WIM_CLOSE;
+      WIM_DATA        = MM_WIM_DATA;
+
+//* device ID for wave device mapper */
+const
+      WAVE_MAPPER     = DWORD(-1);
+
+//* flags for dwFlags parameter in waveOutOpen() and waveInOpen() */
+const
+       WAVE_FORMAT_QUERY     = $00000001;
+       WAVE_ALLOWSYNC        = $00000002;
+       WAVE_MAPPED           = $00000004;
+       WAVE_FORMAT_DIRECT    = $00000008;
+       WAVE_FORMAT_DIRECT_QUERY = WAVE_FORMAT_QUERY or WAVE_FORMAT_DIRECT;
+       WAVE_NOMIXER          = $00000080;           //* Windows CE only - bypass software mixer */
+
+
+// Switch to DWORD packing for WAVEHDR
+// Warning: This assumes that the start of headers is DWORD aligned, which is a change from previous implementations.
+{$PACKRECORDS 4}// #include "pshpack4.h"
+//* wave data block header */
+type
+     LPWAVEHDR = ^wavehdr_tag;
+     wavehdr_tag = record
+       lpData:LPSTR;                 //* pointer to locked data buffer */
+       dwBufferLength:DWORD;         //* length of data buffer */
+       dwBytesRecorded:DWORD;        //* used for input only */
+       dwUser:DWORD;                 //* for client's use */
+       dwFlags:DWORD;                //* assorted flags (see defines) */
+       dwLoops:DWORD;                //* loop control counter */
+       lpNext:LPWAVEHDR;     //* reserved for driver */
+       reserved:DWORD;               //* reserved for driver */
+     end;
+     WAVEHDR = wavehdr_tag;
+     PWAVEHDR = ^wavehdr_tag;
+     NPWAVEHDR = ^wavehdr_tag;
+
+// Switch back to previous packing
+{$PACKRECORDS 1}// #include "poppack.h"
+
+
+//* flags for dwFlags field of WAVEHDR */
+const
+      WHDR_DONE       = $00000001;  //* done bit */
+      WHDR_PREPARED   = $00000002;  //* set if this header has been prepared */
+      WHDR_BEGINLOOP  = $00000004;  //* loop start block */
+      WHDR_ENDLOOP    = $00000008;  //* loop end block */
+      WHDR_INQUEUE    = $00000010;  //* reserved for driver */
+
+//* waveform output device capabilities structure */
+type
+     tagWAVEOUTCAPS = record
+       wMid:word;                  //* manufacturer ID */
+       wPid:word;                  //* product ID */
+       vDriverVersion:MMVERSION;      //* version of the driver */
+       szPname:array[0..MAXPNAMELEN-1] of TCHAR;  //* product name (NULL terminated string) */
+       dwFormats:DWORD;             //* formats supported */
+       wChannels:word;             //* number of sources supported */
+       wReserved1:word;            //* packing */
+       dwSupport:DWORD;             //* functionality supported by driver */
+     end;
+     WAVEOUTCAPS = tagWAVEOUTCAPS;
+     PWAVEOUTCAPS = ^tagWAVEOUTCAPS;
+     NPWAVEOUTCAPS = ^tagWAVEOUTCAPS;
+     LPWAVEOUTCAPS = ^tagWAVEOUTCAPS;
+
+//* flags for dwSupport field of WAVEOUTCAPS */
+const
+      WAVECAPS_PITCH          = $0001;   //* supports pitch control */
+      WAVECAPS_PLAYBACKRATE   = $0002;   //* supports playback rate control */
+      WAVECAPS_VOLUME         = $0004;   //* supports volume control */
+      WAVECAPS_LRVOLUME       = $0008;   //* separate left-right volume control */
+//      WAVECAPS_SYNC           = $0010; //* Windows CE only supports asynchronous audio devices */
+      WAVECAPS_SAMPLEACCURATE = $0020;
+      WAVECAPS_DIRECTSOUND    = $0040;
+
+//* waveform input device capabilities structure */
+type
+     tagWAVEINCAPS = record
+       wMid:word;                    //* manufacturer ID */
+       wPid:word;                    //* product ID */
+       vDriverVersion:MMVERSION;     //* version of the driver */
+       szPname:array[0..MAXPNAMELEN-1] of TCHAR;    //* product name (NULL terminated string) */
+       dwFormats:DWORD;              //* formats supported */
+       wChannels:word;               //* number of channels supported */
+       wReserved1:word;              //* structure packing */
+     end;
+     WAVEINCAPS = tagWAVEINCAPS;
+     PWAVEINCAPS = ^tagWAVEINCAPS;
+     NPWAVEINCAPS = ^tagWAVEINCAPS;
+     LPWAVEINCAPS = ^tagWAVEINCAPS;
+
+//* defines for dwFormat field of WAVEINCAPS and WAVEOUTCAPS */
+const
+      WAVE_INVALIDFORMAT     = $00000000;       //* invalid format */
+      WAVE_FORMAT_1M08       = $00000001;       //* 11.025 kHz, Mono,   8-bit  */
+      WAVE_FORMAT_1S08       = $00000002;       //* 11.025 kHz, Stereo, 8-bit  */
+      WAVE_FORMAT_1M16       = $00000004;       //* 11.025 kHz, Mono,   16-bit */
+      WAVE_FORMAT_1S16       = $00000008;       //* 11.025 kHz, Stereo, 16-bit */
+      WAVE_FORMAT_2M08       = $00000010;       //* 22.05  kHz, Mono,   8-bit  */
+      WAVE_FORMAT_2S08       = $00000020;       //* 22.05  kHz, Stereo, 8-bit  */
+      WAVE_FORMAT_2M16       = $00000040;       //* 22.05  kHz, Mono,   16-bit */
+      WAVE_FORMAT_2S16       = $00000080;       //* 22.05  kHz, Stereo, 16-bit */
+      WAVE_FORMAT_4M08       = $00000100;       //* 44.1   kHz, Mono,   8-bit  */
+      WAVE_FORMAT_4S08       = $00000200;       //* 44.1   kHz, Stereo, 8-bit  */
+      WAVE_FORMAT_4M16       = $00000400;       //* 44.1   kHz, Mono,   16-bit */
+      WAVE_FORMAT_4S16       = $00000800;       //* 44.1   kHz, Stereo, 16-bit */
+
+//* property information for audio gain classes */
+
+//* audio gain class property sets */
+const
+      MM_PROPSET_GAINCLASS_CLASS:GUID = '{E7E569A5-8498-43FE-8075-33D1FDAB15EF}';
+      MM_PROPSET_GAINCLASS_STREAM:GUID = '{40E953AE-EE3E-493A-93EE-DA3E30764390}';
+(*
+#define MM_PROPSET_GAINCLASS_CLASS \
+    { 0xe7e569a5, 0x8498, 0x43fe, { 0x80, 0x75, 0x33, 0xd1, 0xfd, 0xab, 0x15, 0xef } }
+#define MM_PROPSET_GAINCLASS_STREAM \
+    { 0x40e953ae, 0xee3e, 0x493a, { 0x93, 0xee, 0xda, 0x3e, 0x30, 0x76, 0x43, 0x90 } }
+*)
+
+const
+//* MM_PROPSET_GAINCLASS_CLASS property IDs */
+      MM_PROP_GAINCLASS_CLASS     = 1;
+
+//* MM_PROPSET_GAINCLASS_STREAM property IDs */
+      MM_PROP_GAINCLASS_STREAM    = 1;
+
+//* structure to describe audio gain classes */
+type
+     tagAUDIOGAINCLASS = record
+       dwPriority:DWORD;
+       dwRelativeGain:DWORD;
+     end;
+     AUDIOGAINCLASS = tagAUDIOGAINCLASS;
+     PAUDIOGAINCLASS = ^tagAUDIOGAINCLASS;
+     CPAUDIOGAINCLASS = ^AUDIOGAINCLASS;
+
+//* values for AUDIOGAINCLASS.dwPriority */
+const
+      WAGC_PRIORITY_CRITICAL  = 6;
+      WAGC_PRIORITY_HIGH      = 4;
+      WAGC_PRIORITY_NORMAL    = 2;
+
+//* wave stream properties structure */
+type
+     tagSTREAMPROPS = record
+       dwClassID:DWORD;
+       dwFlags:DWORD;
+     end;
+     STREAMPROPS = tagSTREAMPROPS;
+     PSTREAMPROPS = ^tagSTREAMPROPS;
+     CPSTREAMPROPS = ^STREAMPROPS;
+
+//* flag definitions for STREAMPROPS.dwFlags */
+const
+      SPSFL_NOTIFY_GAIN_CHANGE   = $00000001;      //* callback gets MM_WOM_ATTENUATED messages */
+      SPSFL_EXCLUDE              = $00000002;      //* stream does not participate in gain-class operations */
+
+//* values for STREAMPROPS.dwClassid */
+const
+      WAGC_CLASS_DEFAULT              = 0;
+      WAGC_CLASS_NORMAL               = 1;
+      WAGC_CLASS_AUDIO_ALERT          = 2;
+      WAGC_CLASS_SPEECH_ALERT         = 3;
+      WAGC_CLASS_SPEECH_NOTIFICATION  = 4;
+      WAGC_CLASS_AUDIO_NOTIFICATION   = 5;
+      WAGC_CLASS_FORCE_MUTE           = 6;
+//* classes 7-15 are reserved for future use */
+      WAGC_CLASS_MAX                  = 15; //* class ID's larger than this are illegal */
+
+//* Discontinuity detection property set */
+     MM_PROPSET_DISCONTINUITY:GUID = '{B4389733-868E-4D06-B008-9A6FC8CE852E}';
+{
+#define MM_PROPSET_DISCONTINUITY \
+    { 0xb4389733, 0x868e, 0x4d06, { 0xb0, 0x8, 0x9a, 0x6f, 0xc8, 0xce, 0x85, 0x2e } }
+}
+
+//* MM_PROPSET_DISCONTINUITY property IDs */
+     MM_PROP_DISCONTINUITY   = 1;
+
+//* bit values for MM_PROP_DISCONTINUITY parameter */
+      WDSC_APP        = 1;
+      WDSC_SWMIXER    = 2;
+      WDSC_DRIVER     = 4;
+
+//* structure to receive discontinuity information */
+type
+     tagAUDIODISCONTINUITY = record
+       dwMask:DWORD;       // bitmask shows which values were set (see WDSC_* values above)
+       dwApp:DWORD;        // # discontinuities detected at the application level
+       dwSwMixer:DWORD;    // # discontinuities detected at the software mixer level
+       dwDriver:DWORD;     // # discontinuities detected at the driver level
+     end;
+     AUDIODISCONTINUITY = tagAUDIODISCONTINUITY;
+     PAUDIODISCONTINUITY = ^tagAUDIODISCONTINUITY;
+
+//* waveform audio function prototypes */
+function waveOutGetNumDevs:UINT; external KernelDLL name 'waveOutGetNumDevs'; // index 268
+function waveOutGetDevCaps(uDeviceID:UINT; pwoc:LPWAVEOUTCAPS; cbwoc:UINT):MMRESULT; external KernelDLL name 'waveOutGetDevCaps'; // index 269
+function waveOutGetVolume(hwo:HWAVEOUT; pdwVolume:LPDWORD):MMRESULT; external KernelDLL name 'waveOutGetVolume'; // index 26A
+function waveOutSetVolume(hwo:HWAVEOUT; dwVolume:DWORD):MMRESULT; external KernelDLL name 'waveOutSetVolume'; // index 26B
+function waveOutGetErrorText(mmrError:MMRESULT; pszText:PTSTR; cchText:UINT):MMRESULT; external KernelDLL name 'waveOutGetErrorText'; // index 26C
+function waveOutClose(hwo:HWAVEOUT):MMRESULT; external KernelDLL name 'waveOutClose'; // index 26D
+function waveOutPrepareHeader(hwo:HWAVEOUT; pwh:LPWAVEHDR; cbwh:UINT):MMRESULT; external KernelDLL name 'waveOutPrepareHeader'; // index 26E
+function waveOutUnprepareHeader(hwo:HWAVEOUT; pwh:LPWAVEHDR; cbwh:UINT):MMRESULT; external KernelDLL name 'waveOutUnprepareHeader'; // index 26F
+function waveOutWrite(hwo:HWAVEOUT; pwh:LPWAVEHDR; cbwh:UINT):MMRESULT; external KernelDLL name 'waveOutWrite'; // index 270
+function waveOutPause(hwo:HWAVEOUT):MMRESULT; external KernelDLL name 'waveOutPause'; // index 271
+function waveOutRestart(hwo:HWAVEOUT):MMRESULT; external KernelDLL name 'waveOutRestart'; // index 272
+function waveOutReset(hwo:HWAVEOUT):MMRESULT; external KernelDLL name 'waveOutReset'; // index 273
+function waveOutBreakLoop(hwo:HWAVEOUT):MMRESULT; external KernelDLL name 'waveOutBreakLoop'; // index 274
+function waveOutGetPosition(hwo:HWAVEOUT; pmmt:LPMMTIME; cbmmt:UINT):MMRESULT; external KernelDLL name 'waveOutGetPosition'; // index 275
+function waveOutGetPitch(hwo:HWAVEOUT; pdwPitch:LPDWORD):MMRESULT; external KernelDLL name 'waveOutGetPitch'; // index 276
+function waveOutSetPitch(hwo:HWAVEOUT; dwPitch:DWORD):MMRESULT; external KernelDLL name 'waveOutSetPitch'; // index 277
+function waveOutGetPlaybackRate(hwo:HWAVEOUT; pdwRate:LPDWORD):MMRESULT; external KernelDLL name 'waveOutGetPlaybackRate'; // index 278
+function waveOutSetPlaybackRate(hwo:HWAVEOUT; dwRate:DWORD):MMRESULT; external KernelDLL name 'waveOutSetPlaybackRate'; // index 279
+function waveOutGetID(hwo:HWAVEOUT; puDeviceID:LPUINT):MMRESULT; external KernelDLL name 'waveOutGetID'; // index 27A
+function waveOutMessage(hwo:HWAVEOUT; uMsg:UINT; dw1:DWORD; dw2:DWORD):MMRESULT; external KernelDLL name 'waveOutMessage'; // index 27B
+function waveOutOpen(Phwo:LPHWAVEOUT;
+                     uDeviceID:UINT;
+                     pwfx:LPCWAVEFORMATEX;
+                     dwCallback:DWORD;
+                     dwInstance:DWORD;
+                     fdwOpen:DWORD):MMRESULT; external KernelDLL name 'waveOutOpen'; // index 27C
+function waveOutGetProperty(uDeviceID:UINT;
+                            pPropSetId:PGUID;
+                            ulPropId:ULONG;
+                            pvPropParams:LPVOID;
+                            cbPropParams:ULONG;
+                            pvPropData:LPVOID;
+                            cbPropData:ULONG;
+                            pcbReturn:PULONG):MMRESULT; external KernelDLL name 'waveOutGetProperty'; // index ?
+function waveOutSetProperty(uDeviceID:UINT;
+                            pPropSetId:PGUID;
+                            ulPropId:ULONG;
+                            pvPropParams:LPVOID;
+                            cbPropParams:ULONG;
+                            pvPropData:LPVOID;
+                            cbPropData:ULONG):MMRESULT; external KernelDLL name 'waveOutSetProperty'; // index ?
+
+
+function waveInGetNumDevs:UINT; external KernelDLL name 'waveInGetNumDevs'; // index 27D
+function waveInGetDevCaps(uDeviceID:UINT; pwic:LPWAVEINCAPS; cbwic:UINT):MMRESULT; external KernelDLL name 'waveInGetDevCaps'; // index 27E
+function waveInGetErrorText(mmrError:MMRESULT; pszText:LPTSTR; cchText:UINT):MMRESULT; external KernelDLL name 'waveInGetErrorText'; // index 27F
+function waveInClose(hwi:HWAVEIN):MMRESULT; external KernelDLL name 'waveInClose'; // index 280
+function waveInPrepareHeader(hwi:HWAVEIN; pwh:LPWAVEHDR; cbwh:UINT):MMRESULT; external KernelDLL name 'waveInPrepareHeader'; // index 281
+function waveInUnprepareHeader(hwi:HWAVEIN; pwh:LPWAVEHDR; cbwh:UINT):MMRESULT; external KernelDLL name 'waveInUnprepareHeader'; // index 282
+function waveInAddBuffer(hwi:HWAVEIN; pwh:LPWAVEHDR; cbwh:UINT):MMRESULT; external KernelDLL name 'waveInAddBuffer'; // index 283
+function waveInStart(hwi:HWAVEIN):MMRESULT; external KernelDLL name 'waveInStart'; // index 284
+function waveInStop(hwi:HWAVEIN):MMRESULT; external KernelDLL name 'waveInStop'; // index 285
+function waveInReset(hwi:HWAVEIN):MMRESULT; external KernelDLL name 'waveInReset'; // index 286
+function waveInGetPosition(hwi:HWAVEIN; pmmt:LPMMTIME; cbmmt:UINT):MMRESULT; external KernelDLL name 'waveInGetPosition'; // index 287
+function waveInGetID(hwi:HWAVEIN; puDeviceID:LPUINT):MMRESULT; external KernelDLL name 'waveInGetID'; // index 288
+function waveInMessage(hwi:HWAVEIN; uMsg:UINT; dw1:DWORD; dw2:DWORD):MMRESULT; external KernelDLL name 'waveInMessage'; // index 289
+function waveInOpen(phwi:LPHWAVEIN;
+                    uDeviceID:UINT;
+                    pwfx:LPCWAVEFORMATEX;
+                    dwCallback:DWORD;
+                    dwInstance:DWORD;
+                    fdwOpen:DWORD):MMRESULT; external KernelDLL name 'waveInOpen'; // index 28A
+function waveInGetProperty(uDeviceID:UINT;
+                           pPropSetId:PGUID;
+                           ulPropId:ULONG;
+                           pvPropParams:LPVOID;
+                           cbPropParams:ULONG;
+                           pvPropData:LPVOID;
+                           cbPropData:ULONG;
+                           pcbReturn:PULONG):MMRESULT; external KernelDLL name 'waveInGetProperty'; // index ?
+function waveInSetProperty(uDeviceID:UINT;
+                           pPropSetId:PGUID;
+                           ulPropId:ULONG;
+                           pvPropParams:LPVOID;
+                           cbPropParams:ULONG;
+                           pvPropData:LPVOID;
+                           cbPropData:ULONG):MMRESULT; external KernelDLL name 'waveInSetProperty'; // index ?
+
+{$ENDIF} // MMNOWAVE
+
+
+{$IFNDEF MMNOMIDI}
+{****************************************************************************
+
+                            MIDI audio support
+
+****************************************************************************}
+const
+//* MIDI error return values */
+      MIDIERR_UNPREPARED    = MIDIERR_BASE + 0;   //* header not prepared */
+      MIDIERR_STILLPLAYING  = MIDIERR_BASE + 1;   //* still something playing */
+      MIDIERR_NOMAP         = MIDIERR_BASE + 2;   //* no configured instruments */
+      MIDIERR_NOTREADY      = MIDIERR_BASE + 3;   //* hardware is still busy */
+      MIDIERR_NODEVICE      = MIDIERR_BASE + 4;   //* port no longer connected */
+      MIDIERR_INVALIDSETUP  = MIDIERR_BASE + 5;   //* invalid MIF */
+      MIDIERR_BADOPENMODE   = MIDIERR_BASE + 6;   //* operation unsupported w/ open mode */
+      MIDIERR_DONT_CONTINUE = MIDIERR_BASE + 7;   //* thru device 'eating' a message */
+      MIDIERR_LASTERROR     = MIDIERR_BASE + 7;   //* last error in range */
+
+//* MIDI audio data types */
+type
+     HMIDI = HANDLE;
+     HMIDIIN = HANDLE;
+     HMIDIOUT = HANDLE;
+     HMIDISTRM = HANDLE;
+
+     LPHMIDI = ^HMIDI;
+     LPHMIDIIN = ^HMIDIIN;
+     LPHMIDIOUT = ^HMIDIOUT;
+     LPHMIDISTRM = ^HMIDISTRM;
+
+     MIDICALLBACK = DRVCALLBACK;
+     LPMIDICALLBACK = MIDICALLBACK;
+
+const
+      MIDIPATCHSIZE   = 128;
+      
+type
+     PATCHARRAY = array[0..MIDIPATCHSIZE-1] of word;
+     LPPATCHARRAY = ^PATCHARRAY;
+     KEYARRAY = array[0..MIDIPATCHSIZE-1] of word;
+     LPKEYARRAY = ^KEYARRAY;
+
+//* MIDI callback messages */
+const
+      MIM_OPEN        = MM_MIM_OPEN;
+      MIM_CLOSE       = MM_MIM_CLOSE;
+      MIM_DATA        = MM_MIM_DATA;
+      MIM_LONGDATA    = MM_MIM_LONGDATA;
+      MIM_ERROR       = MM_MIM_ERROR;
+      MIM_LONGERROR   = MM_MIM_LONGERROR;
+      MOM_OPEN        = MM_MOM_OPEN;
+      MOM_CLOSE       = MM_MOM_CLOSE;
+      MOM_DONE        = MM_MOM_DONE;
+
+      MIM_MOREDATA      = MM_MIM_MOREDATA;
+      MOM_POSITIONCB    = MM_MOM_POSITIONCB;
+
+//* device ID for MIDI mapper */
+const
+      MIDIMAPPER     = UINT(-1);
+      MIDI_MAPPER    = UINT(-1);
+
+//* flags for dwFlags parm of midiInOpen() */
+const
+      MIDI_IO_STATUS      = $00000020;
+      MIDI_IO_CONTROL     = $00000008;                         //* Internal */
+      MIDI_IO_INPUT       = $00000010;  //*future*/             /* Internal */
+      MIDI_IO_OWNED       = $00004000;                         //* Internal */
+      MIDI_IO_SHARED      = $00008000;                         //* Internal */
+      MIDI_I_VALID        = $C027;                              //* Internal */
+      MIDI_O_VALID        = $C00E;                              //* Internal */
+
+
+//* flags for wFlags parm of midiOutCachePatches(), midiOutCacheDrumPatches() */
+      MIDI_CACHE_ALL      = 1;
+      MIDI_CACHE_BESTFIT  = 2;
+      MIDI_CACHE_QUERY    = 3;
+      MIDI_UNCACHE        = 4;
+      MIDI_CACHE_VALID    = MIDI_CACHE_ALL or MIDI_CACHE_BESTFIT or MIDI_CACHE_QUERY or MIDI_UNCACHE;     //* Internal */
+
+
+//* MIDI output device capabilities structure */
+{$IFDEF _WIN32}
+type
+     tagMIDIOUTCAPSA = record
+       wMid:word;                  //* manufacturer ID */
+       wPid:word;                  //* product ID */
+       vDriverVersion:MMVERSION;      //* version of the driver */
+       szPname:array[0..MAXPNAMELEN-1] of AnsiChar;  //* product name (NULL terminated string) */
+       wTechnology:word;           //* type of device */
+       wVoices:word;               //* # of voices (internal synth only) */
+       wNotes:word;                //* max # of notes (internal synth only) */
+       wChannelMask:word;          //* channels used (internal synth only) */
+       dwSupport:DWORD;             //* functionality supported by driver */
+     end;
+     MIDIOUTCAPSA = tagMIDIOUTCAPSA;
+     PMIDIOUTCAPSA = ^tagMIDIOUTCAPSA;
+     NPMIDIOUTCAPSA = ^tagMIDIOUTCAPSA;
+     LPMIDIOUTCAPSA = ^tagMIDIOUTCAPSA;
+
+type
+     tagMIDIOUTCAPSW = record
+       wMid:word;                  //* manufacturer ID */
+       wPid:word;                  //* product ID */
+       vDriverVersion:MMVERSION;      //* version of the driver */
+       szPname:array[0..MAXPNAMELEN-1] of WCHAR;  //* product name (NULL terminated string) */
+       wTechnology:word;           //* type of device */
+       wVoices:word;               //* # of voices (internal synth only) */
+       wNotes:word;                //* max # of notes (internal synth only) */
+       wChannelMask:word;          //* channels used (internal synth only) */
+       dwSupport:DWORD;             //* functionality supported by driver */
+     end;
+     MIDIOUTCAPSW = tagMIDIOUTCAPSW;
+     PMIDIOUTCAPSW = ^tagMIDIOUTCAPSW;
+     NPMIDIOUTCAPSW = ^tagMIDIOUTCAPSW;
+     LPMIDIOUTCAPSW = ^tagMIDIOUTCAPSW;
+
+{$IFDEF UNICODE}
+     MIDIOUTCAPS = MIDIOUTCAPSW;
+     PMIDIOUTCAPS = PMIDIOUTCAPSW;
+     NPMIDIOUTCAPS = NPMIDIOUTCAPSW;
+     LPMIDIOUTCAPS = LPMIDIOUTCAPSW;
+{$ELSE} // UNICODE
+     MIDIOUTCAPS = MIDIOUTCAPSA;
+     PMIDIOUTCAPS = PMIDIOUTCAPSA;
+     NPMIDIOUTCAPS = NPMIDIOUTCAPSA;
+     LPMIDIOUTCAPS = LPMIDIOUTCAPSA;
+{$ENDIF} // UNICODE
+
+{$ELSE} // _WIN32
+type
+     midioutcaps_tag = record
+       wMid:word;                  //* manufacturer ID */
+       wPid:word;                  //* product ID */
+       vDriverVersion:MMVERSION;        //* version of the driver */
+       szPname:array[0..MAXPNAMELEN-1] of char;  //* product name (NULL terminated string) */
+       wTechnology:word;           //* type of device */
+       wVoices:word;               //* # of voices (internal synth only) */
+       wNotes:word;                //* max # of notes (internal synth only) */
+       wChannelMask:word;          //* channels used (internal synth only) */
+       dwSupport:DWORD;             //* functionality supported by driver */
+     end;
+     MIDIOUTCAPS = midioutcaps_tag;
+     PMIDIOUTCAPS = ^midioutcaps_tag;
+     NPMIDIOUTCAPS = ^midioutcaps_tag;
+     LPMIDIOUTCAPS = ^midioutcaps_tag;
+{$ENDIF} // _WIN32
+
+const
+//* flags for wTechnology field of MIDIOUTCAPS structure */
+      MOD_MIDIPORT    = 1;  //* output port */
+      MOD_SYNTH       = 2;  //* generic internal synth */
+      MOD_SQSYNTH     = 3;  //* square wave internal synth */
+      MOD_FMSYNTH     = 4;  //* FM internal synth */
+      MOD_MAPPER      = 5;  //* MIDI mapper */
+
+//* flags for dwSupport field of MIDIOUTCAPS structure */
+      MIDICAPS_VOLUME          = $0001;  //* supports volume control */
+      MIDICAPS_LRVOLUME        = $0002;  //* separate left-right volume control */
+      MIDICAPS_CACHE           = $0004;
+
+      MIDICAPS_STREAM          = $0008;  //* driver supports midiStreamOut directly */
+
+
+
+//* MIDI input device capabilities structure */
+{$IFDEF _WIN32}
+type
+     tagMIDIINCAPSA = record
+       wMid:word;                   //* manufacturer ID */
+       wPid:word;                   //* product ID */
+       vDriverVersion:MMVERSION;         //* version of the driver */
+       szPname:array[0..MAXPNAMELEN-1] of AnsiChar;   //* product name (NULL terminated string) */
+//#if (WINVER >= 0x0400)
+       dwSupport:DWORD;             //* functionality supported by driver */
+//#endif
+     end;
+     MIDIINCAPSA = tagMIDIINCAPSA;
+     PMIDIINCAPSA = ^tagMIDIINCAPSA;
+     NPMIDIINCAPSA = ^tagMIDIINCAPSA;
+     LPMIDIINCAPSA = ^tagMIDIINCAPSA;
+
+type
+     tagMIDIINCAPSW = record
+       wMid:word;                   //* manufacturer ID */
+       wPid:word;                   //* product ID */
+       vDriverVersion:MMVERSION;         //* version of the driver */
+       szPname:array[0..MAXPNAMELEN-1] of WCHAR;   //* product name (NULL terminated string) */
+//#if (WINVER >= 0x0400)
+       dwSupport:DWORD;             //* functionality supported by driver */
+//#endif
+     end;
+     MIDIINCAPSW = tagMIDIINCAPSW;
+     PMIDIINCAPSW = ^tagMIDIINCAPSW;
+     NPMIDIINCAPSW = ^tagMIDIINCAPSW;
+     LPMIDIINCAPSW = ^tagMIDIINCAPSW;
+
+{$IFDEF UNICODE}
+     MIDIINCAPS = MIDIINCAPSW;
+     PMIDIINCAPS = PMIDIINCAPSW;
+     NPMIDIINCAPS = NPMIDIINCAPSW;
+     LPMIDIINCAPS = LPMIDIINCAPSW;
+{$ELSE} // UNICODE
+     MIDIINCAPS = MIDIINCAPSA;
+     PMIDIINCAPS = PMIDIINCAPSA;
+     NPMIDIINCAPS = NPMIDIINCAPSA;
+     LPMIDIINCAPS = LPMIDIINCAPSA;
+{$ENDIF} // UNICODE
+
+{$ELSE} // _WIN32
+type
+     midiincaps_tag = record
+       wMid:word;                  //* manufacturer ID */
+       wPid:word;                  //* product ID */
+       vDriverVersion:MMVERSION;        //* version of the driver */
+       szPname:array[0..MAXPNAMELEN-1] of char;  //* product name (NULL terminated string) */
+//#if (WINVER >= 0x0400)
+       dwSupport:DWORD;             //* functionality supported by driver */
+//#endif
+     end;
+     MIDIINCAPS = midiincaps_tag;
+     PMIDIINCAPS = ^midiincaps_tag;
+     NPMIDIINCAPS = ^midiincaps_tag;
+     LPMIDIINCAPS = ^midiincaps_tag;
+{$ENDIF} // _WIN32
+
+
+//* MIDI data block header */
+type
+     LPMIDIHDR = ^midihdr_tag;
+     midihdr_tag = record
+       lpData:LPSTR;               //* pointer to locked data block */
+       dwBufferLength:DWORD;       //* length of data in data block */
+       dwBytesRecorded:DWORD;      //* used for input only */
+       dwUser:DWORD;               //* for client's use */
+       dwFlags:DWORD;              //* assorted flags (see defines) */
+       lpNext:LPMIDIHDR;           //* reserved for driver */
+       reserved:DWORD;             //* reserved for driver */
+//#if (WINVER >= 0x0400)
+       dwOffset:DWORD;             //* Callback offset into buffer */
+       dwReserved:array[0..7] of DWORD;        //* Reserved for MMSYSTEM */
+//#endif
+     end;
+     MIDIHDR = midihdr_tag;
+     PMIDIHDR = ^midihdr_tag;
+     NPMIDIHDR = ^midihdr_tag;
+
+type
+     midievent_tag = record
+       dwDeltaTime:DWORD;          //* Ticks since last event */
+       dwStreamID:DWORD;           //* Reserved; must be zero */
+       dwEvent:DWORD;              //* Event type and parameters */
+       dwParms:array[0..0] of DWORD;  //* Parameters if this is a long event */
+     end;
+     MIDIEVENT = midievent_tag;
+
+type
+     midistrmbuffver_tag = record
+       dwVersion:DWORD;                  //* Stream buffer format version */
+       dwMid:DWORD;                      //* Manufacturer ID as defined in MMREG.H */
+       dwOEMVersion:DWORD;               //* Manufacturer version for custom ext */
+     end;
+     MIDISTRMBUFFVER = midistrmbuffver_tag;
+
+const
+//* flags for dwFlags field of MIDIHDR structure */
+      MHDR_DONE       = $00000001;       //* done bit */
+      MHDR_PREPARED   = $00000002;       //* set if header prepared */
+      MHDR_INQUEUE    = $00000004;       //* reserved for driver */
+      MHDR_ISSTRM     = $00000008;       //* Buffer is stream buffer */
+      MHDR_SENDING    = $00000020;       //* Internal */
+      MHDR_MAPPED     = $00001000;       //* thunked header */   /* Internal */
+      MHDR_SHADOWHDR  = $00002000;       //* MIDIHDR is 16-bit shadow */ /* Internal */
+      MHDR_VALID      = $e000302F;       //* valid flags */      /* Internal */
+
+      MHDR_SAVE       = $e0003000;       //* Save these flags */  /* Internal */
+                                         //* past driver calls */ /* Internal */
+
+//* Dreamcast-only flags for tonebank support */
+      MHDR_WRITEABLE    = $e0000000;
+      MHDR_GENERALMIDI  = $80000000;     //* Indicates a tonebank that is to be used */
+                                         //* by General MIDI stream ports */
+      MHDR_GMDRUM       = $40000000;     //* In combination with GENERALMIDI, indicates */
+                                         //* a GM drum tonebank.  By itself, indicates an */
+                                         //* "alternate" GM drum tonebank */
+      MHDR_MAPPINGTABLE = $20000000;     //* Indicates that this MIDIHDR is for a */
+                                         //* program mapping table rather than an actual */
+                                         //* tonebank */
+
+//* */
+//* Type codes which go in the high byte of the event DWORD of a stream buffer */
+//* */
+//* Type codes 00-7F contain parameters within the low 24 bits */
+//* Type codes 80-FF contain a length of their parameter in the low 24 */
+//* bits, followed by their parameter data in the buffer. The event */
+//* DWORD contains the exact byte length; the parm data itself must be */
+//* padded to be an even multiple of 4 bytes long. */
+//* */
+const
+      MEVT_F_SHORT        = $00000000;
+      MEVT_F_LONG         = $80000000;
+      MEVT_F_CALLBACK     = $40000000;
+
+      MEVT_SHORTMSG       = byte($00);    //* parm = shortmsg for midiOutShortMsg */
+      MEVT_TEMPO          = byte($01);    //* parm = new tempo in microsec/qn     */
+      MEVT_NOP            = byte($02);    //* parm = unused; does nothing         */
+
+function MEVT_EVENTTYPE(x:DWORD):byte;
+function MEVT_EVENTPARM(x:DWORD):DWORD;
+
+//* 0x04-0x7F reserved */
+const
+      MEVT_LONGMSG        = byte($80);    //* parm = bytes to send verbatim       */
+      MEVT_COMMENT        = byte($82);    //* parm = comment data                 */
+      MEVT_VERSION        = byte($84);    //* parm = MIDISTRMBUFFVER struct       */
+
+//* 0x81-0xFF reserved */
+
+      MIDISTRM_ERROR      = -2;
+
+//* */
+//* Structures and defines for midiStreamProperty */
+//* */
+      MIDIPROP_SET        = $80000000;
+      MIDIPROP_GET        = $40000000;
+
+//* These are intentionally both non-zero so the app cannot accidentally */
+//* leave the operation off and happen to appear to work due to default */
+//* action. */
+
+function MIDIPROP_PROPERTY(mp:DWORD):DWORD;
+
+const
+      MIDIPROP_TIMEDIV     = 00000001;
+      MIDIPROP_TEMPO       = 00000002;
+      MIDIPROP_SMF         = 00000003;
+      MIDIPROP_BUFFERED    = 00000004;
+      MIDIPROP_LOOPING     = 00000005;
+      MIDIPROP_GENERALMIDI = 00000006;
+
+//* Some useful defines to help with Standard MIDI File Format stuff */
+      SMF_TIMEDIV_QUARTERNOTE = 0;
+      SMF_TIMEDIV_SECONDS     = 1;
+
+
+function SMF_TIMEDIV(format:DWORD; division:DWORD):DWORD;
+function SMF_TIMEDIV_SMPTE(smpte:DWORD; division:DWORD):DWORD;
+function SMF_TIMEDIV_ISSMPTE(dw:DWORD):DWORD;
+function SMF_TIMEDIV_GETSMPTE(dw:DWORD):byte;
+function SMF_TIMEDIV_GETTPF(dw:DWORD):DWORD;
+function SMF_TIMEDIV_GETTPQN(dw:DWORD):DWORD;
+
+type
+     midiproptimediv_tag = record
+       cbStruct:DWORD;
+       dwTimeDiv:DWORD;
+     end;
+     MIDIPROPTIMEDIV = midiproptimediv_tag;
+     LPMIDIPROPTIMEDIV = ^midiproptimediv_tag;
+
+type
+     midiproptempo_tag = record
+       cbStruct:DWORD;
+       dwTempo:DWORD;
+     end;
+     MIDIPROPTEMPO = midiproptempo_tag;
+     LPMIDIPROPTEMPO = ^midiproptempo_tag;
+
+const
+      MIDIPROP_PROPVAL    = $3FFFFFFF; //* Internal */
+
+// The library exports midi-functions.
+{$IFDEF _WIN32}
+const
+      MIDIDLL = 'winmm.dll';
+{$ELSE _WIN32}
+const
+      MIDIDLL = KernelDLL;
+{$ENDIF _WIN32}
+
+//* MIDI function prototypes */
+function midiOutGetNumDevs:UINT; external MIDIDLL name 'midiOutGetNumDevs';
+function midiStreamOpen(phms:LPHMIDISTRM; puDeviceID:LPUINT; cMidi:DWORD; dwCallback:DWORD; dwInstance:DWORD; fdwOpen:DWORD):MMRESULT; external MIDIDLL name 'midiStreamOpen'; // index
+function midiStreamClose(hms:HMIDISTRM):MMRESULT; external MIDIDLL name 'midiStreamClose'; // index
+
+function midiStreamProperty(hms:HMIDISTRM; lppropdata:LPBYTE; dwProperty:DWORD):MMRESULT; external MIDIDLL name 'midiStreamProperty'; // index
+function midiStreamPosition(hms:HMIDISTRM; lpmmt:LPMMTIME; cbmmt:UINT):MMRESULT; external MIDIDLL name 'midiStreamPosition'; // index
+
+function midiStreamOut(hms:HMIDISTRM; pmh:LPMIDIHDR; cbmh:UINT):MMRESULT; external MIDIDLL name 'midiStreamOut'; // index
+function midiStreamPause(hms:HMIDISTRM):MMRESULT; external MIDIDLL name 'midiStreamPause'; // index
+function midiStreamRestart(hms:HMIDISTRM):MMRESULT; external MIDIDLL name 'midiStreamRestart'; // index
+function midiStreamStop(hms:HMIDISTRM):MMRESULT; external MIDIDLL name 'midiStreamStop'; // index
+
+{$IFDEF _WIN32}
+function midiConnect(hmi:HMIDI; hmo:HMIDIOUT; pReserved:LPVOID):MMRESULT; external MIDIDLL name 'midiConnect'; // index
+function midiDisconnect(hmi:HMIDI; hmo:HMIDIOUT; pReserved:LPVOID):MMRESULT; external MIDIDLL name 'midiDisconnect'; // index
+{$ENDIF} // _WIN32
+
+
+{$IFDEF _WIN32}
+function midiOutGetDevCapsA(uDeviceID:UINT; pmoc:LPMIDIOUTCAPSA; cbmoc:UINT):MMRESULT; external MIDIDLL name 'midiOutGetDevCapsA'; // index
+function midiOutGetDevCapsW(uDeviceID:UINT; pmoc:LPMIDIOUTCAPSW; cbmoc:UINT):MMRESULT; external MIDIDLL name 'midiOutGetDevCapsW'; // index
+{$IFDEF UNICODE}
+function midiOutGetDevCaps(uDeviceID:UINT; pmoc:LPMIDIOUTCAPSW; cbmoc:UINT):MMRESULT; external MIDIDLL name 'midiOutGetDevCapsW'; // index
+{$ELSE} // UNICODE
+function midiOutGetDevCaps(uDeviceID:UINT; pmoc:LPMIDIOUTCAPSA; cbmoc:UINT):MMRESULT; external MIDIDLL name 'midiOutGetDevCapsA'; // index
+{$ENDIF} // UNICODE
+
+{$ELSE} // _WIN32
+function midiOutGetDevCaps(uDeviceID:UINT; pmoc:LPMIDIOUTCAPS; cbmoc:UINT):MMRESULT; external MIDIDLL name 'midiOutGetDevCaps'; // index
+{$ENDIF} // _WIN32
+
+function midiOutGetVolume(hmo:HMIDIOUT; pdwVolume:LPDWORD):MMRESULT; external MIDIDLL name 'midiOutGetVolume'; // index
+function midiOutSetVolume(hmo:HMIDIOUT; dwVolume:DWORD):MMRESULT; external MIDIDLL name 'midiOutSetVolume'; // index
+
+{$IFDEF _WIN32}
+function midiOutGetErrorTextA(mmrError:MMRESULT; pszText:LPSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiOutGetErrorTextA'; // index
+function midiOutGetErrorTextW(mmrError:MMRESULT; pszText:LPWSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiOutGetErrorTextW'; // index
+{$IFDEF UNICODE}
+function midiOutGetErrorText(mmrError:MMRESULT; pszText:LPWSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiOutGetErrorTextW'; // index
+{$ELSE} // UNICODE
+function midiOutGetErrorText(mmrError:MMRESULT; pszText:LPSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiOutGetErrorTextA'; // index
+{$ENDIF} // UNICODE
+{$ELSE} // _WIN32
+function midiOutGetErrorText(mmrError:MMRESULT; pszText:LPSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiOutGetErrorText'; // index
+{$ENDIF} // _WIN32
+
+function midiOutOpen(phmo:LPHMIDIOUT; uDeviceID:UINT;
+    dwCallback:DWORD; dwInstance:DWORD; fdwOpen:DWORD):MMRESULT; external MIDIDLL name 'midiOutOpen'; // index
+function midiOutClose(hmo:HMIDIOUT):MMRESULT; external MIDIDLL name 'midiOutClose'; // index
+function midiOutPrepareHeader(hmo:HMIDIOUT; pmh:LPMIDIHDR; cbmh:UINT):MMRESULT; external MIDIDLL name 'midiOutPrepareHeader'; // index
+function midiOutUnprepareHeader(hmo:HMIDIOUT; pmh:LPMIDIHDR; cbmh:UINT):MMRESULT; external MIDIDLL name 'midiOutUnprepareHeader'; // index
+function midiOutShortMsg(hmo:HMIDIOUT; dwMsg:DWORD):MMRESULT; external MIDIDLL name 'midiOutShortMsg'; // index
+function midiOutLongMsg(hmo:HMIDIOUT; pmh:LPMIDIHDR; cbmh:UINT):MMRESULT; external MIDIDLL name 'midiOutLongMsg'; // index
+function midiOutReset(hmo:HMIDIOUT):MMRESULT; external MIDIDLL name 'midiOutReset'; // index
+function midiOutCachePatches(hmo:HMIDIOUT; uBank:UINT; pwpa:LPWORD; fuCache:UINT):MMRESULT; external MIDIDLL name 'midiOutCachePatches'; // index
+function midiOutCacheDrumPatches(hmo:HMIDIOUT; uPatch:UINT; pwkya:LPWORD; fuCache:UINT):MMRESULT; external MIDIDLL name 'midiOutCacheDrumPatches'; // index
+function midiOutGetID(hmo:HMIDIOUT; puDeviceID:LPUINT):MMRESULT; external MIDIDLL name 'midiOutGetID'; // index
+
+{$IFDEF _WIN32}
+function midiOutMessage(hmo:HMIDIOUT; uMsg:UINT; dw1:DWORD; dw2:DWORD):MMRESULT; external MIDIDLL name 'midiOutMessage'; // index
+{$ELSE} // _WIN32
+function midiOutMessage(hmo:HMIDIOUT; uMsg:UINT; dw1:DWORD; dw2:DWORD):DWORD; external MIDIDLL name 'midiOutMessage'; // index
+{$ENDIF} // _WIN32
+
+function midiInGetNumDevs:UINT; external MIDIDLL name 'midiInGetNumDevs'; // index
+
+{$IFDEF _WIN32}
+function midiInGetDevCapsA(uDeviceID:UINT; pmic:LPMIDIINCAPSA; cbmic:UINT):MMRESULT; external MIDIDLL name 'midiInGetDevCapsA'; // index
+function midiInGetDevCapsW(uDeviceID:UINT; pmic:LPMIDIINCAPSW; cbmic:UINT):MMRESULT; external MIDIDLL name 'midiInGetDevCapsW'; // index
+{$IFDEF UNICODE}
+function midiInGetDevCaps(uDeviceID:UINT; pmic:LPMIDIINCAPSW; cbmic:UINT):MMRESULT; external MIDIDLL name 'midiInGetDevCapsW'; // index
+{$ELSE} // UNICODE
+function midiInGetDevCaps(uDeviceID:UINT; pmic:LPMIDIINCAPSA; cbmic:UINT):MMRESULT; external MIDIDLL name 'midiInGetDevCapsA'; // index
+{$ENDIF} // UNICODE
+
+function midiInGetErrorTextA(mmrError:MMRESULT; pszText:LPSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiInGetErrorTextA'; // index
+function midiInGetErrorTextW(mmrError:MMRESULT; pszText:LPWSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiInGetErrorTextW'; // index
+{$IFDEF UNICODE}
+function midiInGetErrorText(mmrError:MMRESULT; pszText:LPWSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiInGetErrorTextW'; // index
+{$ELSE} // UNICODE
+function midiInGetErrorText(mmrError:MMRESULT; pszText:LPSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiInGetErrorTextA'; // index
+{$ENDIF} // UNICODE
+
+{$ELSE} // _WIN32
+function midiInGetDevCaps(uDeviceID:UINT; pmic:LPMIDIINCAPS; cbmic:UINT):MMRESULT; external MIDIDLL name 'midiInGetDevCaps'; // index
+function midiInGetErrorText(mmrError:MMRESULT; pszText:LPSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiInGetErrorText'; // index
+{$ENDIF} // _WIN32
+
+function midiInOpen(phmi:LPHMIDIIN; uDeviceID:UINT;
+        dwCallback:DWORD; dwInstance:DWORD; fdwOpen:DWORD):MMRESULT; external MIDIDLL name 'midiInOpen'; // index
+function midiInClose(hmi:HMIDIIN):MMRESULT; external MIDIDLL name 'midiInClose'; // index
+function midiInPrepareHeader(hmi:HMIDIIN; pmh:LPMIDIHDR; cbmh:UINT):MMRESULT; external MIDIDLL name 'midiInPrepareHeader'; // index
+function midiInUnprepareHeader(hmi:HMIDIIN; pmh:LPMIDIHDR; cbmh:UINT):MMRESULT; external MIDIDLL name 'midiInUnprepareHeader'; // index
+function midiInAddBuffer(hmi:HMIDIIN; pmh:LPMIDIHDR; cbmh:UINT):MMRESULT; external MIDIDLL name 'midiInAddBuffer'; // index
+function midiInStart(hmi:HMIDIIN):MMRESULT; external MIDIDLL name 'midiInStart'; // index
+function midiInStop(hmi:HMIDIIN):MMRESULT; external MIDIDLL name 'midiInStop'; // index
+function midiInReset(hmi:HMIDIIN):MMRESULT; external MIDIDLL name 'midiInReset'; // index
+function midiInGetID(hmi:HMIDIIN; puDeviceID:LPUINT):MMRESULT; external MIDIDLL name 'midiInGetID'; // index
+
+{$IFDEF _WIN32}
+function midiInMessage(hmi:HMIDIIN; uMsg:UINT; dw1:DWORD; dw2:DWORD):MMRESULT; external MIDIDLL name 'midiInMessage'; // index
+{$ELSE} // _WIN32
+function midiInMessage(hmi:HMIDIIN; uMsg:UINT; dw1:DWORD; dw2:DWORD):DWORD; external MIDIDLL name 'midiInMessage'; // index
+{$ENDIF} // _WIN32
+
+{$ENDIF} // MMNOMIDI 
+
+
+
+{$IFNDEF MMNOMIXER}
+{****************************************************************************
+
+                            Mixer Support
+
+****************************************************************************}
+
+type
+     HMIXEROBJ = HANDLE;
+     LPHMIXEROBJ = ^HMIXEROBJ;
+
+     HMIXER = HANDLE;
+     LPHMIXER = ^HMIXER;
+
+const
+      MIXER_SHORT_NAME_CHARS   = 16;
+      MIXER_LONG_NAME_CHARS    = 64;
+
+//* */
+//*  MMRESULT error return values specific to the mixer API */
+//* */
+//* */
+const
+      MIXERR_INVALLINE            = MIXERR_BASE + 0;
+      MIXERR_INVALCONTROL         = MIXERR_BASE + 1;
+      MIXERR_INVALVALUE           = MIXERR_BASE + 2;
+      MIXERR_LASTERROR            = MIXERR_BASE + 2;
+
+      MIXER_OBJECTF_HANDLE    = $80000000;
+      MIXER_OBJECTF_MIXER     = $00000000;
+      MIXER_OBJECTF_HMIXER    = MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_MIXER;
+      MIXER_OBJECTF_WAVEOUT   = $10000000;
+      MIXER_OBJECTF_HWAVEOUT  = MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_WAVEOUT;
+      MIXER_OBJECTF_WAVEIN    = $20000000;
+      MIXER_OBJECTF_HWAVEIN   = MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_WAVEIN;
+      MIXER_OBJECTF_MIDIOUT   = $30000000;
+      MIXER_OBJECTF_HMIDIOUT  = MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_MIDIOUT;
+      MIXER_OBJECTF_MIDIIN    = $40000000;
+      MIXER_OBJECTF_HMIDIIN   = MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_MIDIIN;
+      MIXER_OBJECTF_AUX       = $50000000;
+
+function mixerGetNumDevs:UINT; external KernelDLL name 'mixerGetNumDevs'; // index 2AE
+
+type
+     tagMIXERCAPS = record
+       wMid:word;                   //* manufacturer id */
+       wPid:word;                   //* product id */
+       vDriverVersion:MMVERSION;    //* version of the driver */
+       szPname:array[0..MAXPNAMELEN-1] of TCHAR;  //* product name */
+       fdwSupport:DWORD;             //* misc. support bits */
+       cDestinations:DWORD;          //* count of destinations */
+     end;
+     MIXERCAPS = tagMIXERCAPS;
+     PMIXERCAPS = ^tagMIXERCAPS;
+     LPMIXERCAPS = ^tagMIXERCAPS;
+
+function mixerGetDevCaps(uMxId:UINT; pmxcaps:LPMIXERCAPS; cbmxcaps:UINT):MMRESULT; external KernelDLL name 'mixerGetDevCaps'; // index 2AA
+
+function mixerOpen(phmx:LPHMIXER; uMxId:UINT; dwCallback:DWORD; dwInstance:DWORD; fdwOpen:DWORD):MMRESULT; external KernelDLL name 'mixerOpen'; // index 2B0
+
+function mixerClose(hmx:HMIXER):MMRESULT; external KernelDLL name 'mixerClose'; // index 2B2
+
+function mixerMessage(hmx:HMIXER; uMsg:UINT; dwParam1:DWORD; dwParam2:DWORD):DWORD; external KernelDLL name 'mixerMessage'; // index 2AF
+
+type
+     tMIXERLINE = record
+       cbStruct:DWORD;               //* size of MIXERLINE structure */
+       dwDestination:DWORD;          //* zero based destination index */
+       dwSource:DWORD;               //* zero based source index (if source) */
+       dwLineID:DWORD;               //* unique line id for mixer device */
+       fdwLine:DWORD;                //* state/information about line */
+       dwUser:DWORD;                 //* driver specific information */
+       dwComponentType:DWORD;        //* component type line connects to */
+       cChannels:DWORD;              //* number of channels line supports */
+       cConnections:DWORD;           //* number of connections [possible] */
+       cControls:DWORD;              //* number of controls at this line */
+       szShortName:array[0..MIXER_SHORT_NAME_CHARS-1] of TCHAR;
+       szName:array[0..MIXER_LONG_NAME_CHARS-1] of TCHAR;
+       Target:record
+         dwType:DWORD;                 //* MIXERLINE_TARGETTYPE_xxxx */
+         dwDeviceID:DWORD;             //* target device ID of device type */
+         wMid:word;                   //* of target device */
+         wPid:word;                   //*      " */
+         vDriverVersion:MMVERSION;         //*      " */
+         szPname:array[0..MAXPNAMELEN-1] of TCHAR;   //*      " */
+       end;
+     end;
+     MIXERLINE = tMIXERLINE;
+     PMIXERLINE = ^tMIXERLINE;
+     LPMIXERLINE = ^tMIXERLINE;
+
+//* */
+//*  MIXERLINE.fdwLine */
+//* */
+//* */
+const
+      MIXERLINE_LINEF_ACTIVE              = $00000001;
+      MIXERLINE_LINEF_DISCONNECTED        = $00008000;
+      MIXERLINE_LINEF_SOURCE              = $80000000;
+
+//* */
+//*  MIXERLINE.dwComponentType */
+//* */
+//*  component types for destinations and sources */
+//* */
+//* */
+      MIXERLINE_COMPONENTTYPE_DST_FIRST       = $00000000;
+      MIXERLINE_COMPONENTTYPE_DST_UNDEFINED   = MIXERLINE_COMPONENTTYPE_DST_FIRST + 0;
+      MIXERLINE_COMPONENTTYPE_DST_DIGITAL     = MIXERLINE_COMPONENTTYPE_DST_FIRST + 1;
+      MIXERLINE_COMPONENTTYPE_DST_LINE        = MIXERLINE_COMPONENTTYPE_DST_FIRST + 2;
+      MIXERLINE_COMPONENTTYPE_DST_MONITOR     = MIXERLINE_COMPONENTTYPE_DST_FIRST + 3;
+      MIXERLINE_COMPONENTTYPE_DST_SPEAKERS    = MIXERLINE_COMPONENTTYPE_DST_FIRST + 4;
+      MIXERLINE_COMPONENTTYPE_DST_HEADPHONES  = MIXERLINE_COMPONENTTYPE_DST_FIRST + 5;
+      MIXERLINE_COMPONENTTYPE_DST_TELEPHONE   = MIXERLINE_COMPONENTTYPE_DST_FIRST + 6;
+      MIXERLINE_COMPONENTTYPE_DST_WAVEIN      = MIXERLINE_COMPONENTTYPE_DST_FIRST + 7;
+      MIXERLINE_COMPONENTTYPE_DST_VOICEIN     = MIXERLINE_COMPONENTTYPE_DST_FIRST + 8;
+      MIXERLINE_COMPONENTTYPE_DST_LAST        = MIXERLINE_COMPONENTTYPE_DST_FIRST + 8;
+
+      MIXERLINE_COMPONENTTYPE_SRC_FIRST       = $00001000;
+      MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED   = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 0;
+      MIXERLINE_COMPONENTTYPE_SRC_DIGITAL     = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 1;
+      MIXERLINE_COMPONENTTYPE_SRC_LINE        = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2;
+      MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE  = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3;
+      MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 4;
+      MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 5;
+      MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE   = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 6;
+      MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER   = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 7;
+      MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT     = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8;
+      MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY   = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 9;
+      MIXERLINE_COMPONENTTYPE_SRC_ANALOG      = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10;
+      MIXERLINE_COMPONENTTYPE_SRC_LAST        = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10;
+
+//* */
+//*  MIXERLINE.Target.dwType */
+//* */
+//* */
+      MIXERLINE_TARGETTYPE_UNDEFINED      = 0;
+      MIXERLINE_TARGETTYPE_WAVEOUT        = 1;
+      MIXERLINE_TARGETTYPE_WAVEIN         = 2;
+      MIXERLINE_TARGETTYPE_MIDIOUT        = 3;
+      MIXERLINE_TARGETTYPE_MIDIIN         = 4;
+      MIXERLINE_TARGETTYPE_AUX            = 5;
+
+
+function mixerGetLineInfo(hmxobj:HMIXEROBJ; pmxl:LPMIXERLINE; fdwInfo:DWORD):MMRESULT; external KernelDLL name 'mixerGetLineInfo'; // index 2AD
+
+const
+      MIXER_GETLINEINFOF_DESTINATION      = $00000000;
+      MIXER_GETLINEINFOF_SOURCE           = $00000001;
+      MIXER_GETLINEINFOF_LINEID           = $00000002;
+      MIXER_GETLINEINFOF_COMPONENTTYPE    = $00000003;
+      MIXER_GETLINEINFOF_TARGETTYPE       = $00000004;
+
+      MIXER_GETLINEINFOF_QUERYMASK        = $0000000F;
+
+function mixerGetID(hmxobj:HMIXEROBJ; puMxId:LPUINT; fdwId:DWORD):MMRESULT; external KernelDLL name 'mixerGetID'; // index 2AB
+
+//* */
+//*  MIXERCONTROL */
+//* */
+//* */
+type
+     tMIXERCONTROL = record
+       cbStruct:DWORD;           //* size in bytes of MIXERCONTROL */
+       dwControlID:DWORD;        //* unique control id for mixer device */
+       dwControlType:DWORD;      //* MIXERCONTROL_CONTROLTYPE_xxx */
+       fdwControl:DWORD;         //* MIXERCONTROL_CONTROLF_xxx */
+       cMultipleItems:DWORD;     //* if MIXERCONTROL_CONTROLF_MULTIPLE set */
+       szShortName:array[0..MIXER_SHORT_NAME_CHARS-1] of TCHAR;
+       szName:array[0..MIXER_LONG_NAME_CHARS-1] of TCHAR;
+       Bounds:record
+         case DWORD of
+           0: (lMinimum:LONG;           //* signed minimum for this control */
+               lMaximum:LONG);           //* signed maximum for this control */
+           1: (dwMinimum:DWORD;          //* unsigned minimum for this control */
+               dwMaximum:DWORD);          //* unsigned maximum for this control */
+           2: (dwReserved:array[0..5] of DWORD);
+       end;
+       Metrics:record
+         case DWORD of
+           0: (cSteps:DWORD);             //* # of steps between min & max */
+           1: (cbCustomData:DWORD);       //* size in bytes of custom data */
+           2: (dwReserved:array[0..5] of DWORD);
+       end;
+    end;
+    MIXERCONTROL = tMIXERCONTROL;
+    PMIXERCONTROL = ^tMIXERCONTROL;
+    LPMIXERCONTROL = ^tMIXERCONTROL;
+
+const    
+//* */
+//*  MIXERCONTROL.fdwControl */
+//* */
+//* */
+      MIXERCONTROL_CONTROLF_UNIFORM   = $00000001;
+      MIXERCONTROL_CONTROLF_MULTIPLE  = $00000002;
+      MIXERCONTROL_CONTROLF_DISABLED  = $80000000;
+
+//* */
+//*  MIXERCONTROL_CONTROLTYPE_xxx building block defines */
+//* */
+//* */
+      MIXERCONTROL_CT_CLASS_MASK          = $F0000000;
+      MIXERCONTROL_CT_CLASS_CUSTOM        = $00000000;
+      MIXERCONTROL_CT_CLASS_METER         = $10000000;
+      MIXERCONTROL_CT_CLASS_SWITCH        = $20000000;
+      MIXERCONTROL_CT_CLASS_NUMBER        = $30000000;
+      MIXERCONTROL_CT_CLASS_SLIDER        = $40000000;
+      MIXERCONTROL_CT_CLASS_FADER         = $50000000;
+      MIXERCONTROL_CT_CLASS_TIME          = $60000000;
+      MIXERCONTROL_CT_CLASS_LIST          = $70000000;
+
+      MIXERCONTROL_CT_SUBCLASS_MASK       = $0F000000;
+
+      MIXERCONTROL_CT_SC_SWITCH_BOOLEAN   = $00000000;
+      MIXERCONTROL_CT_SC_SWITCH_BUTTON    = $01000000;
+
+      MIXERCONTROL_CT_SC_METER_POLLED     = $00000000;
+
+      MIXERCONTROL_CT_SC_TIME_MICROSECS   = $00000000;
+      MIXERCONTROL_CT_SC_TIME_MILLISECS   = $01000000;
+
+      MIXERCONTROL_CT_SC_LIST_SINGLE      = $00000000;
+      MIXERCONTROL_CT_SC_LIST_MULTIPLE    = $01000000;
+
+      MIXERCONTROL_CT_UNITS_MASK          = $00FF0000;
+      MIXERCONTROL_CT_UNITS_CUSTOM        = $00000000;
+      MIXERCONTROL_CT_UNITS_BOOLEAN       = $00010000;
+      MIXERCONTROL_CT_UNITS_SIGNED        = $00020000;
+      MIXERCONTROL_CT_UNITS_UNSIGNED      = $00030000;
+      MIXERCONTROL_CT_UNITS_DECIBELS      = $00040000; //* in 10ths */
+      MIXERCONTROL_CT_UNITS_PERCENT       = $00050000; //* in 10ths */
+
+//* */
+//*  Commonly used control types for specifying MIXERCONTROL.dwControlType */
+//* */
+
+      MIXERCONTROL_CONTROLTYPE_CUSTOM         = MIXERCONTROL_CT_CLASS_CUSTOM or MIXERCONTROL_CT_UNITS_CUSTOM;
+      MIXERCONTROL_CONTROLTYPE_BOOLEANMETER   = MIXERCONTROL_CT_CLASS_METER or MIXERCONTROL_CT_SC_METER_POLLED or MIXERCONTROL_CT_UNITS_BOOLEAN;
+      MIXERCONTROL_CONTROLTYPE_SIGNEDMETER    = MIXERCONTROL_CT_CLASS_METER or MIXERCONTROL_CT_SC_METER_POLLED or MIXERCONTROL_CT_UNITS_SIGNED;
+      MIXERCONTROL_CONTROLTYPE_PEAKMETER      = MIXERCONTROL_CONTROLTYPE_SIGNEDMETER + 1;
+      MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER  = MIXERCONTROL_CT_CLASS_METER or MIXERCONTROL_CT_SC_METER_POLLED or MIXERCONTROL_CT_UNITS_UNSIGNED;
+      MIXERCONTROL_CONTROLTYPE_BOOLEAN        = MIXERCONTROL_CT_CLASS_SWITCH or MIXERCONTROL_CT_SC_SWITCH_BOOLEAN or MIXERCONTROL_CT_UNITS_BOOLEAN;
+      MIXERCONTROL_CONTROLTYPE_ONOFF          = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 1;
+      MIXERCONTROL_CONTROLTYPE_MUTE           = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 2;
+      MIXERCONTROL_CONTROLTYPE_MONO           = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 3;
+      MIXERCONTROL_CONTROLTYPE_LOUDNESS       = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 4;
+      MIXERCONTROL_CONTROLTYPE_STEREOENH      = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 5;
+
+// - mmreg.h
+      MIXERCONTROL_CONTROLTYPE_SRS_MTS                = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 6;
+      MIXERCONTROL_CONTROLTYPE_SRS_ONOFF              = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 7;
+      MIXERCONTROL_CONTROLTYPE_SRS_SYNTHSELECT        = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 8;
+// - end of mmreg.h
+
+      MIXERCONTROL_CONTROLTYPE_BUTTON         = MIXERCONTROL_CT_CLASS_SWITCH or MIXERCONTROL_CT_SC_SWITCH_BUTTON or MIXERCONTROL_CT_UNITS_BOOLEAN;
+      MIXERCONTROL_CONTROLTYPE_DECIBELS       = MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_DECIBELS;
+      MIXERCONTROL_CONTROLTYPE_SIGNED         = MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_SIGNED;
+      MIXERCONTROL_CONTROLTYPE_UNSIGNED       = MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_UNSIGNED;
+      MIXERCONTROL_CONTROLTYPE_PERCENT        = MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_PERCENT;
+      MIXERCONTROL_CONTROLTYPE_SLIDER         = MIXERCONTROL_CT_CLASS_SLIDER or MIXERCONTROL_CT_UNITS_SIGNED;
+      MIXERCONTROL_CONTROLTYPE_PAN            = MIXERCONTROL_CONTROLTYPE_SLIDER + 1;
+      MIXERCONTROL_CONTROLTYPE_QSOUNDPAN      = MIXERCONTROL_CONTROLTYPE_SLIDER + 2;
+      MIXERCONTROL_CONTROLTYPE_FADER          = MIXERCONTROL_CT_CLASS_FADER or MIXERCONTROL_CT_UNITS_UNSIGNED;
+      MIXERCONTROL_CONTROLTYPE_VOLUME         = MIXERCONTROL_CONTROLTYPE_FADER + 1;
+      MIXERCONTROL_CONTROLTYPE_BASS           = MIXERCONTROL_CONTROLTYPE_FADER + 2;
+      MIXERCONTROL_CONTROLTYPE_TREBLE         = MIXERCONTROL_CONTROLTYPE_FADER + 3;
+      MIXERCONTROL_CONTROLTYPE_EQUALIZER      = MIXERCONTROL_CONTROLTYPE_FADER + 4;
+      MIXERCONTROL_CONTROLTYPE_SINGLESELECT   = MIXERCONTROL_CT_CLASS_LIST or MIXERCONTROL_CT_SC_LIST_SINGLE or MIXERCONTROL_CT_UNITS_BOOLEAN;
+      MIXERCONTROL_CONTROLTYPE_MUX            = MIXERCONTROL_CONTROLTYPE_SINGLESELECT + 1;
+      MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT = MIXERCONTROL_CT_CLASS_LIST or MIXERCONTROL_CT_SC_LIST_MULTIPLE or MIXERCONTROL_CT_UNITS_BOOLEAN;
+      MIXERCONTROL_CONTROLTYPE_MIXER          = MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT + 1;
+      MIXERCONTROL_CONTROLTYPE_MICROTIME      = MIXERCONTROL_CT_CLASS_TIME or MIXERCONTROL_CT_SC_TIME_MICROSECS or MIXERCONTROL_CT_UNITS_UNSIGNED;
+      MIXERCONTROL_CONTROLTYPE_MILLITIME      = MIXERCONTROL_CT_CLASS_TIME or MIXERCONTROL_CT_SC_TIME_MILLISECS or MIXERCONTROL_CT_UNITS_UNSIGNED;
+
+//* */
+//*  MIXERLINECONTROLS */
+//* */
+type
+     tMIXERLINECONTROLS = record
+       cbStruct:DWORD;       //* size in bytes of MIXERLINECONTROLS */
+       dwLineID:DWORD;       //* line id (from MIXERLINE.dwLineID) */
+       case DWORD of
+         0: (dwControlID:DWORD); //* MIXER_GETLINECONTROLSF_ONEBYID */
+         1: (dwControlType:DWORD;  //* MIXER_GETLINECONTROLSF_ONEBYTYPE */
+             cControls:DWORD;      //* count of controls pmxctrl points to */
+             cbmxctrl:DWORD;       //* size in bytes of _one_ MIXERCONTROL */
+             pamxctrl:LPMIXERCONTROL);  //* pointer to first MIXERCONTROL array */
+       end;
+       MIXERLINECONTROLS = tMIXERLINECONTROLS;
+       PMIXERLINECONTROLS = ^tMIXERLINECONTROLS;
+       LPMIXERLINECONTROLS = ^tMIXERLINECONTROLS;
+
+function mixerGetLineControls(hmxobj:HMIXEROBJ; pmxlc:LPMIXERLINECONTROLS; fdwControls:DWORD):MMRESULT; external KernelDLL name 'mixerGetLineControls'; // index 2AC
+
+const
+      MIXER_GETLINECONTROLSF_ALL          = $00000000;
+      MIXER_GETLINECONTROLSF_ONEBYID      = $00000001;
+      MIXER_GETLINECONTROLSF_ONEBYTYPE    = $00000002;
+
+      MIXER_GETLINECONTROLSF_QUERYMASK    = $0000000F;
+
+type
+     tMIXERCONTROLDETAILS = record
+       cbStruct:DWORD;       //* size in bytes of MIXERCONTROLDETAILS */
+       dwControlID:DWORD;    //* control id to get/set details on */
+       cChannels:DWORD;      //* number of channels in paDetails array */
+       case DWORD of
+         0: (hwndOwner:HWND);      //* for MIXER_SETCONTROLDETAILSF_CUSTOM */
+         1: (cMultipleItems:DWORD; //* if _MULTIPLE, the number of items per channel */
+             cbDetails:DWORD;      //* size of _one_ details_XX struct */
+             paDetails:LPVOID);      //* pointer to array of details_XX structs */
+     end;
+     MIXERCONTROLDETAILS = tMIXERCONTROLDETAILS;
+     PMIXERCONTROLDETAILS = ^tMIXERCONTROLDETAILS;
+     LPMIXERCONTROLDETAILS = ^tMIXERCONTROLDETAILS;
+
+//* */
+//*  MIXER_GETCONTROLDETAILSF_LISTTEXT */
+//* */
+//* */
+type
+     tMIXERCONTROLDETAILS_LISTTEXT = record
+       dwParam1:DWORD;
+       dwParam2:DWORD;
+       szName:array[0..MIXER_LONG_NAME_CHARS-1] of TCHAR;
+     end;
+     MIXERCONTROLDETAILS_LISTTEXT = tMIXERCONTROLDETAILS_LISTTEXT;
+     PMIXERCONTROLDETAILS_LISTTEXT = ^tMIXERCONTROLDETAILS_LISTTEXT;
+     LPMIXERCONTROLDETAILS_LISTTEXT = ^tMIXERCONTROLDETAILS_LISTTEXT;
+
+//* */
+//*  MIXER_GETCONTROLDETAILSF_VALUE */
+//* */
+//* */
+type
+     tMIXERCONTROLDETAILS_BOOLEAN = record
+       fValue:LONG;
+     end;
+     MIXERCONTROLDETAILS_BOOLEAN = tMIXERCONTROLDETAILS_BOOLEAN;
+     PMIXERCONTROLDETAILS_BOOLEAN = ^tMIXERCONTROLDETAILS_BOOLEAN;
+     LPMIXERCONTROLDETAILS_BOOLEAN = ^tMIXERCONTROLDETAILS_BOOLEAN;
+
+type
+     tMIXERCONTROLDETAILS_SIGNED = record
+       lValue:LONG;
+     end;
+     MIXERCONTROLDETAILS_SIGNED = tMIXERCONTROLDETAILS_SIGNED;
+     PMIXERCONTROLDETAILS_SIGNED = ^tMIXERCONTROLDETAILS_SIGNED;
+     LPMIXERCONTROLDETAILS_SIGNED = ^tMIXERCONTROLDETAILS_SIGNED;
+
+type
+     tMIXERCONTROLDETAILS_UNSIGNED = record
+       dwValue:DWORD;
+     end;
+     MIXERCONTROLDETAILS_UNSIGNED = tMIXERCONTROLDETAILS_UNSIGNED;
+     PMIXERCONTROLDETAILS_UNSIGNED = ^tMIXERCONTROLDETAILS_UNSIGNED;
+     LPMIXERCONTROLDETAILS_UNSIGNED = ^tMIXERCONTROLDETAILS_UNSIGNED;
+
+function mixerGetControlDetails(hmxobj:HMIXEROBJ; pmxcd:LPMIXERCONTROLDETAILS; fdwDetails:DWORD):MMRESULT; external KernelDLL name 'mixerGetControlDetails'; // index 2A9
+
+const
+      MIXER_GETCONTROLDETAILSF_VALUE      = $00000000;
+      MIXER_GETCONTROLDETAILSF_LISTTEXT   = $00000001;
+
+      MIXER_GETCONTROLDETAILSF_QUERYMASK  = $0000000F;
+
+function mixerSetControlDetails(hmxobj:HMIXEROBJ; pmxcd:LPMIXERCONTROLDETAILS; fdwDetails:DWORD):MMRESULT; external KernelDLL name 'mixerSetControlDetails'; // index 2B1
+
+const
+      MIXER_SETCONTROLDETAILSF_VALUE      = $00000000;
+      MIXER_SETCONTROLDETAILSF_CUSTOM     = $00000001;
+
+      MIXER_SETCONTROLDETAILSF_QUERYMASK  = $0000000F;
+
+{$ENDIF} // MMNOMIXER 
+
+
+{$IFNDEF MMNOTIMER}
+{****************************************************************************
+
+                            Timer support
+
+****************************************************************************}
+
+//* timer error return values */
+const
+      TIMERR_NOERROR        = 0;                  //* no error */
+      TIMERR_NOCANDO        = TIMERR_BASE+1;      //* request not completed */
+      TIMERR_STRUCT         = TIMERR_BASE+33;     //* time struct size */
+
+//* timer data types */
+type
+     TIMECALLBACK = procedure(uTimerID:UINT; uMsg:UINT; dwUser:DWORD; dw1:DWORD; dw2:DWORD); cdecl;
+     LPTIMECALLBACK = TIMECALLBACK;
+
+//* flags for fuEvent parameter of timeSetEvent() function */
+const
+      TIME_ONESHOT    = $0000;   //* program timer for single event */
+      TIME_PERIODIC   = $0001;   //* program for continuous periodic event */
+
+{.$IFDEF _WIN32}
+      TIME_CALLBACK_FUNCTION      = $0000;  //* callback is function */
+      TIME_CALLBACK_EVENT_SET     = $0010;  //* callback is event - use SetEvent */
+      TIME_CALLBACK_EVENT_PULSE   = $0020;  //* callback is event - use PulseEvent */
+      TIME_CALLBACK_TYPEMASK      = $00F0;  //* Internal */
+{.$ENDIF} // _WIN32
+
+
+//* timer device capabilities data structure */
+type
+     timecaps_tag = record
+       wPeriodMin:UINT;     //* minimum period supported  */
+       wPeriodMax:UINT;     //* maximum period supported  */
+     end;
+     TIMECAPS = timecaps_tag;
+     PTIMECAPS = ^timecaps_tag;
+     NPTIMECAPS = ^timecaps_tag;
+     LPTIMECAPS = ^timecaps_tag;
+
+{$IFDEF _WIN32}
+const
+      MMTimerDLL = 'winmm.dll';
+{$ELSE _WIN32}
+const
+      MMTimerDLL = 'mmtimer.dll';
+{$ENDIF _WIN32}
+
+//* timer function prototypes */
+function timeGetSystemTime(pmmt:LPMMTIME; cbmmt:UINT):MMRESULT; external MMTimerDLL name 'timeGetSystemTime'; // index
+function timeGetTime:DWORD; external MMTimerDLL name 'timeGetTime'; // index
+function timeSetEvent(uDelay:UINT;
+                      uResolution:UINT;
+                      fptc:LPTIMECALLBACK;
+                      dwUser:DWORD;
+                      fuEvent:UINT):MMRESULT; external MMTimerDLL name 'timeSetEvent'; // index
+function timeKillEvent(uTimerID:UINT):MMRESULT; external MMTimerDLL name 'timeKillEvent'; // index
+function timeGetDevCaps(ptc:LPTIMECAPS; cbtc:UINT):MMRESULT; external MMTimerDLL name 'timeGetDevCaps'; // index
+function timeBeginPeriod(uPeriod:UINT):MMRESULT; external MMTimerDLL name 'timeBeginPeriod'; // index
+function timeEndPeriod(uPeriod:UINT):MMRESULT; external MMTimerDLL name 'timeEndPeriod'; // index
+function timeGetTimeSinceInterrupt:DWORD; external MMTimerDLL name 'timeGetTimeSinceInterrupt'; // index
+function timeGetHardwareFrequency:DWORD; external MMTimerDLL name 'timeGetHardwareFrequency'; // index
+
+{$ENDIF} // MMNOTIMER
+
+
+{$IFNDEF MMNOMMIO}
+{****************************************************************************
+
+                        Multimedia File I/O support
+
+****************************************************************************}
+
+const
+//* MMIO error return values */
+      MMIOERR_BASE                = 256;
+      MMIOERR_FILENOTFOUND        = MMIOERR_BASE + 1;  //* file not found */
+      MMIOERR_OUTOFMEMORY         = MMIOERR_BASE + 2;  //* out of memory */
+      MMIOERR_CANNOTOPEN          = MMIOERR_BASE + 3;  //* cannot open */
+      MMIOERR_CANNOTCLOSE         = MMIOERR_BASE + 4;  //* cannot close */
+      MMIOERR_CANNOTREAD          = MMIOERR_BASE + 5;  //* cannot read */
+      MMIOERR_CANNOTWRITE         = MMIOERR_BASE + 6;  //* cannot write */
+      MMIOERR_CANNOTSEEK          = MMIOERR_BASE + 7;  //* cannot seek */
+      MMIOERR_CANNOTEXPAND        = MMIOERR_BASE + 8;  //* cannot expand file */
+      MMIOERR_CHUNKNOTFOUND       = MMIOERR_BASE + 9;  //* chunk not found */
+      MMIOERR_UNBUFFERED          = MMIOERR_BASE + 10; //*  */
+      MMIOERR_PATHNOTFOUND        = MMIOERR_BASE + 11; //* path incorrect */
+      MMIOERR_ACCESSDENIED        = MMIOERR_BASE + 12; //* file was protected */
+      MMIOERR_SHARINGVIOLATION    = MMIOERR_BASE + 13; //* file in use */
+      MMIOERR_NETWORKERROR        = MMIOERR_BASE + 14; //* network not responding */
+      MMIOERR_TOOMANYOPENFILES    = MMIOERR_BASE + 15; //* no more file handles  */
+      MMIOERR_INVALIDFILE         = MMIOERR_BASE + 16; //* default error file error */
+
+//* MMIO constants */
+      CFSEPCHAR       = '+';             //* compound file name separator char. */
+
+//* MMIO data types */
+type
+      HPSTR = ^char;          //* a huge version of LPSTR */
+
+      HMMIO = HANDLE;                  //* a handle to an open file */
+
+type
+     MMIOPROC = function(lpmmioinfo:LPSTR; uMsg:UINT; lParam1:LPARAM; lParam2:LPARAM):LRESULT; cdecl;
+     LPMMIOPROC = MMIOPROC;
+
+//* general MMIO information data structure */
+type
+     _MMIOINFO = record
+      //* general fields */
+       dwFlags:DWORD;        //* general status flags */
+       fccIOProc:FOURCC;      //* pointer to I/O procedure */
+       pIOProc:LPMMIOPROC;    //* pointer to I/O procedure */
+       wErrorRet:UINT;      //* place for error to be returned */
+       htask:HTASK;          //* alternate local task */
+
+      //* fields maintained by MMIO functions during buffered I/O */
+       cchBuffer:LONG;      //* size of I/O buffer (or 0L) */
+       pchBuffer:HPSTR;      //* start of I/O buffer (or NULL) */
+       pchNext:HPSTR;        //* pointer to next byte to read/write */
+       pchEndRead:HPSTR;     //* pointer to last valid byte to read */
+       pchEndWrite:HPSTR;    //* pointer to last byte to write */
+       lBufOffset:LONG;     //* disk offset of start of buffer */
+
+      //* fields maintained by I/O procedure */
+       lDiskOffset:LONG;    //* disk offset of next read or write */
+       adwInfo:array[0..2] of DWORD;     //* data specific to type of MMIOPROC */
+
+      //* other fields maintained by MMIO */
+       dwReserved1:DWORD;    //* reserved for MMIO use */
+       dwReserved2:DWORD;    //* reserved for MMIO use */
+       hmmio:HMMIO;          //* handle to open file */
+     end;
+     MMIOINFO = _MMIOINFO;
+     PMMIOINFO = ^_MMIOINFO;
+     NPMMIOINFO = ^_MMIOINFO;
+     LPMMIOINFO = ^_MMIOINFO;
+     LPCMMIOINFO = ^MMIOINFO;
+
+//* RIFF chunk information data structure */
+type
+     _MMCKINFO = record
+       ckid:FOURCC;           //* chunk ID */
+       cksize:DWORD;         //* chunk size */
+       fccType:FOURCC;        //* form type or list type */
+       dwDataOffset:DWORD;   //* offset of data portion of chunk */
+       dwFlags:DWORD;        //* flags used by MMIO functions */
+     end;
+     MMCKINFO = _MMCKINFO;
+     PMMCKINFO = ^_MMCKINFO;
+     NPMMCKINFO = ^_MMCKINFO;
+     LPMMCKINFO = ^_MMCKINFO;
+     LPCMMCKINFO = ^MMCKINFO;
+
+const
+//* bit field masks */
+      MMIO_RWMODE     = $00000003;      //* open file for reading/writing/both */
+      MMIO_SHAREMODE  = $00000070;      //* file sharing mode number */
+
+//* read/write mode numbers (bit field MMIO_RWMODE) */
+      MMIO_READ       = $00000000;      //* open file for reading only */
+      MMIO_WRITE      = $00000001;      //* open file for writing only */
+      MMIO_READWRITE  = $00000002;      //* open file for reading and writing */
+      
+//* various MMIO flags */
+      MMIO_FHOPEN             = $0010;  //* mmioClose: keep file handle open */
+      MMIO_EMPTYBUF           = $0010;  //* mmioFlush: empty the I/O buffer */
+      MMIO_TOUPPER            = $0010;  //* mmioStringToFOURCC: to u-case */
+      MMIO_INSTALLPROC    = $00010000;  //* mmioInstallIOProc: install MMIOProc */
+      MMIO_GLOBALPROC     = $10000000;  //* mmioInstallIOProc: install globally */
+      MMIO_REMOVEPROC     = $00020000;  //* mmioInstallIOProc: remove MMIOProc */
+      MMIO_UNICODEPROC    = $01000000;  //* mmioInstallIOProc: Unicode MMIOProc */
+      MMIO_FINDPROC       = $00040000;  //* mmioInstallIOProc: find an MMIOProc */
+      MMIO_FINDCHUNK          = $0010;  //* mmioDescend: find a chunk by ID */
+      MMIO_FINDRIFF           = $0020;  //* mmioDescend: find a LIST chunk */
+      MMIO_FINDLIST           = $0040;  //* mmioDescend: find a RIFF chunk */
+      MMIO_CREATERIFF         = $0020;  //* mmioCreateChunk: make a LIST chunk */
+      MMIO_CREATELIST         = $0040;  //* mmioCreateChunk: make a RIFF chunk */
+
+      MMIO_VALIDPROC      = $10070000;  //* valid for mmioInstallIOProc */ /* Internal */
+
+//* constants for dwFlags field of MMIOINFO */
+      MMIO_CREATE     = $00001000;      //* create new file (or truncate file) */
+      MMIO_PARSE      = $00000100;      //* parse new file returning path */
+      MMIO_DELETE     = $00000200;      //* create new file (or truncate file) */
+      MMIO_EXIST      = $00004000;      //* checks for existence of file */
+      MMIO_ALLOCBUF   = $00010000;      //* mmioOpen() should allocate a buffer */
+      MMIO_GETTEMP    = $00020000;      //* mmioOpen() should retrieve temp name */
+
+      MMIO_DIRTY      = $10000000;      //* I/O buffer is dirty */
+
+      MMIO_OPEN_VALID = $0003FFFF;      //* valid flags for mmioOpen */ /* Internal */
+      MMIO_FLUSH_VALID = MMIO_EMPTYBUF;  //* valid flags for mmioFlush */ /* Internal */
+      MMIO_ADVANCE_VALID = MMIO_WRITE or MMIO_READ;     //* valid flags for mmioAdvance */ /* Internal */
+      MMIO_FOURCC_VALID = MMIO_TOUPPER;  //* valid flags for mmioStringToFOURCC */ /* Internal */
+      MMIO_DESCEND_VALID = MMIO_FINDCHUNK or MMIO_FINDRIFF or MMIO_FINDLIST; //* Internal */
+      MMIO_CREATE_VALID = MMIO_CREATERIFF or MMIO_CREATELIST;   //* Internal */
+
+//* share mode numbers (bit field MMIO_SHAREMODE) */
+      MMIO_COMPAT     = $00000000;      //* compatibility mode */
+      MMIO_EXCLUSIVE  = $00000010;      //* exclusive-access mode */
+      MMIO_DENYWRITE  = $00000020;      //* deny writing to other processes */
+      MMIO_DENYREAD   = $00000030;      //* deny reading to other processes */
+      MMIO_DENYNONE   = $00000040;      //* deny nothing to other processes */
+
+//* message numbers for MMIOPROC I/O procedure functions */
+      MMIOM_READ      = MMIO_READ;       //* read */
+      MMIOM_WRITE    = MMIO_WRITE;       //* write */
+      MMIOM_SEEK              = 2;       //* seek to a new position in file */
+      MMIOM_OPEN              = 3;       //* open file */
+      MMIOM_CLOSE             = 4;       //* close file */
+      MMIOM_WRITEFLUSH        = 5;       //* write and flush */
+
+      MMIOM_RENAME            = 6;       //* rename specified file */
+
+      MMIOM_USER         = $8000;        //* beginning of user-defined messages */
+
+//* standard four character codes */
+const
+      FOURCC_RIFF     = FOURCC(byte(AnsiChar('R')) or
+                               (byte(AnsiChar('I')) shl 8) or
+                               (byte(AnsiChar('F')) shl 16) or
+                               (byte(AnsiChar('F')) shl 24)
+                              );
+
+
+      FOURCC_LIST     = FOURCC(byte(AnsiChar('L')) or
+                               (byte(AnsiChar('I')) shl 8) or
+                               (byte(AnsiChar('S')) shl 16) or
+                               (byte(AnsiChar('T')) shl 24)
+                              );
+
+//* four character codes used to identify standard built-in I/O procedures */
+      FOURCC_DOS      = FOURCC(byte(AnsiChar('D')) or
+                               (byte(AnsiChar('O')) shl 8) or
+                               (byte(AnsiChar('S')) shl 16) or
+                               (byte(AnsiChar(' ')) shl 24)
+                              );
+
+      FOURCC_MEM      = FOURCC(byte(AnsiChar('M')) or
+                               (byte(AnsiChar('E')) shl 8) or
+                               (byte(AnsiChar('M')) shl 16) or
+                               (byte(AnsiChar(' ')) shl 24)
+                              );
+
+//* flags for mmioSeek() */
+const
+      SEEK_SET        = 0;               //* seek to an absolute position */
+      SEEK_CUR        = 1;               //* seek relative to current position */
+      SEEK_END        = 2;               //* seek relative to end of file */
+
+//* other constants */
+const
+      MMIO_DEFAULTBUFFER      = 8192;    //* default buffer size */
+
+{$ENDIF} // MMNOMMIO
+
+{$PACKRECORDS DEFAULT} // #include "poppack.h"        /* Revert to default packing */
+
+implementation
+
+{ Was declared as
+      MAKEFOURCC(ch0, ch1, ch2, ch3)                              \
+      ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) |   \
+      ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
+
+      mmioFOURCC(ch0, ch1, ch2, ch3)  MAKEFOURCC(ch0, ch1, ch2, ch3)
+}
+function MAKEFOURCC(ch0:AnsiChar; ch1:AnsiChar; ch2:AnsiChar; ch3:AnsiChar):FOURCC; inline;
+begin
+  MAKEFOURCC:=DWORD(ch0) or
+              (DWORD(ch1) shl 8) or
+              (DWORD(ch2) shl 16) or
+              (DWORD(ch3) shl 24);
+end;
+
+function mmioFOURCC(ch0:AnsiChar; ch1:AnsiChar; ch2:AnsiChar; ch3:AnsiChar):FOURCC;
+begin
+  mmioFOURCC:=MAKEFOURCC(ch0,ch1,ch2,ch3);
+end;
+
+{ Was declared as
+#define sndAlias( ch0, ch1 ) \
+                ( SND_ALIAS_START + (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ))
+}
+function sndAlias(ch0:AnsiChar; ch1:AnsiChar):DWORD; inline;
+begin
+  sndAlias:=SND_ALIAS_START+(DWORD(ch0) or (DWORD(ch1) shl 8));
+end;
+
+function MEVT_EVENTTYPE(x:DWORD):byte; inline;
+begin
+  MEVT_EVENTTYPE:=byte(((x shr 24) and $FF));
+end;
+
+function MEVT_EVENTPARM(x:DWORD):DWORD; inline;
+begin
+  MEVT_EVENTPARM:=DWORD(x and $00FFFFFF);
+end;
+
+{$IFNDEF MMNOMIDI}
+function MIDIPROP_PROPERTY(mp:DWORD):DWORD; inline;
+begin
+  MIDIPROP_PROPERTY:=mp and (not (MIDIPROP_SET or MIDIPROP_GET));
+end;
+
+function SMF_TIMEDIV(format:DWORD; division:DWORD):DWORD; inline;
+begin
+  SMF_TIMEDIV:=(format shr 15) or division;
+end;
+
+function SMF_TIMEDIV_SMPTE(smpte:DWORD; division:DWORD):DWORD; inline;
+begin
+  SMF_TIMEDIV_SMPTE:=(smpte shl 8) or division;
+end;
+
+function SMF_TIMEDIV_ISSMPTE(dw:DWORD):DWORD; inline;
+begin
+  SMF_TIMEDIV_ISSMPTE:=dw shr 15;
+end;
+
+function SMF_TIMEDIV_GETSMPTE(dw:DWORD):byte; inline;
+begin
+  SMF_TIMEDIV_GETSMPTE:=byte((dw shr 8) and $ff);
+end;
+
+function SMF_TIMEDIV_GETTPF(dw:DWORD):DWORD; inline;
+begin
+  SMF_TIMEDIV_GETTPF:=dw and $ff;
+end;
+
+function SMF_TIMEDIV_GETTPQN(dw:DWORD):DWORD; inline;
+begin
+  SMF_TIMEDIV_GETTPQN:=dw and $7fff;
+end;
+
+{$ENDIF MMNOMIDI}
+
+end.

+ 1169 - 0
packages/winceunits/src/msacm.pp

@@ -0,0 +1,1169 @@
+// -----------------------------------------------------------------------------
+//
+//  msacm.h     Audio Compression Manager Public Header File
+//
+// -----------------------------------------------------------------------------
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit msacm;
+
+{$CALLING cdecl}
+{$PACKRECORDS 1} // #pragma pack(1)         /* Assume byte packing throughout */
+
+interface
+
+uses Windows, mmreg;
+
+//
+//  there are four types of 'handles' used by the ACM. the first three
+//  are unique types that define specific objects:
+//
+//  HACMDRIVERID: used to _identify_ an ACM driver. this identifier can be
+//  used to _open_ the driver for querying details, etc about the driver.
+//
+//  HACMDRIVER: used to manage a driver (codec, filter, etc). this handle
+//  is much like a handle to other media drivers--you use it to send
+//  messages to the converter, query for capabilities, etc.
+//
+//  HACMSTREAM: used to manage a 'stream' (conversion channel) with the
+//  ACM. you use a stream handle to convert data from one format/type
+//  to another--much like dealing with a file handle.
+//
+//
+//  the fourth handle type is a generic type used on ACM functions that
+//  can accept two or more of the above handle types (for example the
+//  acmMetrics and acmDriverID functions).
+//
+//  HACMOBJ: used to identify ACM objects. this handle is used on functions
+//  that can accept two or more ACM handle types.
+//
+type
+     HACMDRIVERID = HANDLE;
+     PHACMDRIVERID = ^HACMDRIVERID;
+     LPHACMDRIVERID = ^HACMDRIVERID;
+
+     HACMDRIVER = HANDLE;
+     PHACMDRIVER = ^HACMDRIVER;
+     LPHACMDRIVER = ^HACMDRIVER;
+
+     HACMSTREAM = HANDLE;
+     PHACMSTREAM = ^HACMSTREAM;
+     LPHACMSTREAM = ^HACMSTREAM;
+
+     HACMOBJ = HANDLE;
+     PHACMOBJ = ^HACMOBJ;
+     LPHACMOBJ = ^HACMOBJ;
+
+     
+// - Module: msacmdrv.h
+// -----------------------------------------------------------------------------
+//
+//  Audio Compression Manager Public Header File for Drivers
+//
+// -----------------------------------------------------------------------------
+
+const
+// Driver messages
+      DRV_LOAD                = $0001;
+      DRV_ENABLE              = $0002;
+      DRV_OPEN                = $0003;
+      DRV_CLOSE               = $0004;
+      DRV_DISABLE             = $0005;
+      DRV_FREE                = $0006;
+      DRV_CONFIGURE           = $0007;
+      DRV_QUERYCONFIGURE      = $0008;
+      DRV_INSTALL             = $0009;
+      DRV_REMOVE              = $000A;
+      DRV_EXITSESSION         = $000B;
+      DRV_POWER               = $000F;
+      DRV_RESERVED            = $0800;
+      DRV_USER                = $4000;
+
+type
+     DRVCONFIGINFOEX = record
+       dwDCISize:DWORD;
+       lpszDCISectionName:LPCWSTR;
+       lpszDCIAliasName:LPCWSTR;
+       dnDevNode:DWORD;
+     end;
+     PDRVCONFIGINFOEX = ^DRVCONFIGINFOEX;
+     NPDRVCONFIGINFOEX = ^DRVCONFIGINFOEX;
+     LPDRVCONFIGINFOEX = ^DRVCONFIGINFOEX;
+
+// LPARAM of DRV_CONFIGURE message
+type
+     tagDRVCONFIGINFO  = record
+       dwDCISize:DWORD;
+       lpszDCISectionName:LPCWSTR;
+       lpszDCIAliasName:LPCWSTR;
+     end;
+     DRVCONFIGINFO = tagDRVCONFIGINFO;
+     PDRVCONFIGINFO = ^tagDRVCONFIGINFO;
+     NPDRVCONFIGINFO = ^tagDRVCONFIGINFO;
+     LPDRVCONFIGINFO = ^tagDRVCONFIGINFO;
+
+// Supported return values for DRV_CONFIGURE message
+const
+      DRVCNF_CANCEL           = $0000;
+      DRVCNF_OK               = $0001;
+      DRVCNF_RESTART          = $0002;
+
+// return values from DriverProc() function
+const
+      DRV_CANCEL             = DRVCNF_CANCEL;
+      DRV_OK                 = DRVCNF_OK;
+      DRV_RESTART            = DRVCNF_RESTART;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  ACM Driver Version:
+//
+//  the version is a 32 bit number that is broken into three parts as
+//  follows:
+//
+//      bits 24 - 31:   8 bit _major_ version number
+//      bits 16 - 23:   8 bit _minor_ version number
+//      bits  0 - 15:   16 bit build number
+//
+//  this is then displayed as follows:
+//
+//      bMajor = (BYTE)(dwVersion >> 24)
+//      bMinor = (BYTE)(dwVersion >> 16) &
+//      wBuild = LOWORD(dwVersion)
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function MAKE_ACM_VERSION(mjr:byte; mnr:byte; bld:word):DWORD;
+
+{$DEFINE ACMDRVOPENDESC_SECTIONNAME_CHARS}
+
+type
+     tACMDRVOPENDESC = record
+       cbStruct:DWORD;      // sizeof(ACMDRVOPENDESC)
+       fccType:FOURCC;      // 'audc'
+       fccComp:FOURCC;        // sub-type (not used--must be 0)
+       dwVersion:DWORD;      // current version of ACM opening you
+       dwFlags:DWORD;        //
+       dwError:DWORD;        // result from DRV_OPEN request
+       pszSectionName:LPCTSTR; // see DRVCONFIGINFO.lpszDCISectionName
+       pszAliasName:LPCTSTR;   // see DRVCONFIGINFO.lpszDCIAliasName
+       dnDevNode:DWORD;      // devnode id for pnp drivers.
+     end;
+     ACMDRVOPENDESC = tACMDRVOPENDESC;
+     PACMDRVOPENDESC = ^tACMDRVOPENDESC;
+     LPACMDRVOPENDESC = ^tACMDRVOPENDESC;
+
+type
+     tACMDRVSTREAMINSTANCE = record
+       cbStruct:DWORD;
+       pwfxSrc:LPWAVEFORMATEX;
+       pwfxDst:LPWAVEFORMATEX;
+       pwfltr:LPWAVEFILTER;
+       dwCallback:DWORD;
+       dwInstance:DWORD;
+       fdwOpen:DWORD;
+       fdwDriver:DWORD;
+       dwDriver:DWORD;
+       has:HACMSTREAM;
+     end;
+     ACMDRVSTREAMINSTANCE = tACMDRVSTREAMINSTANCE;
+     PACMDRVSTREAMINSTANCE = ^tACMDRVSTREAMINSTANCE;
+     LPACMDRVSTREAMINSTANCE = ^tACMDRVSTREAMINSTANCE;
+
+//
+//  NOTE! this structure must match the ACMSTREAMHEADER in msacm.h but
+//  defines more information for the driver writing convenience
+//
+type
+     LPACMDRVSTREAMHEADER = ^tACMDRVSTREAMHEADER;
+     tACMDRVSTREAMHEADER = record
+       cbStruct:DWORD;
+       fdwStatus:DWORD;
+       dwUser:DWORD;
+       pbSrc:LPBYTE;
+       cbSrcLength:DWORD;
+       cbSrcLengthUsed:DWORD;
+       dwSrcUser:DWORD;
+       pbDst:LPBYTE;
+       cbDstLength:DWORD;
+       cbDstLengthUsed:DWORD;
+       dwDstUser:DWORD;
+       fdwConvert:DWORD;     // flags passed from convert func
+       padshNext:LPACMDRVSTREAMHEADER;      // for async driver queueing
+       fdwDriver:DWORD;      // driver instance flags
+       dwDriver:DWORD;       // driver instance data
+
+      //
+      //  all remaining fields are used by the ACM for bookkeeping purposes.
+      //  an ACM driver should never use these fields (though than can be
+      //  helpful for debugging)--note that the meaning of these fields
+      //  may change, so do NOT rely on them in shipping code.
+      //
+       fdwPrepared:DWORD;
+       dwPrepared:DWORD;
+       pbPreparedSrc:LPBYTE;
+       cbPreparedSrcLength:DWORD;
+       pbPreparedDst:LPBYTE;
+       cbPreparedDstLength:DWORD;
+     end;
+     ACMDRVSTREAMHEADER = tACMDRVSTREAMHEADER;
+     PACMDRVSTREAMHEADER = ^tACMDRVSTREAMHEADER;
+
+//
+//  structure for ACMDM_STREAM_SIZE message
+//
+type
+     tACMDRVSTREAMSIZE = record
+       cbStruct:DWORD;
+       fdwSize:DWORD;
+       cbSrcLength:DWORD;
+       cbDstLength:DWORD;
+     end;
+     ACMDRVSTREAMSIZE = tACMDRVSTREAMSIZE;
+     PACMDRVSTREAMSIZE = ^tACMDRVSTREAMSIZE;
+     LPACMDRVSTREAMSIZE = ^tACMDRVSTREAMSIZE;
+
+//
+//  structure containing the information for the ACMDM_FORMAT_SUGGEST message
+//
+type
+     tACMDRVFORMATSUGGEST = record
+       cbStruct:DWORD; // sizeof(ACMDRVFORMATSUGGEST)
+       fdwSuggest:DWORD;         // Suggest flags
+       pwfxSrc:LPWAVEFORMATEX;            // Source Format
+       cbwfxSrc:DWORD;           // Source Size
+       pwfxDst:LPWAVEFORMATEX;            // Dest format
+       cbwfxDst:DWORD;           // Dest Size
+     end;
+     ACMDRVFORMATSUGGEST = tACMDRVFORMATSUGGEST;
+     PACMDRVFORMATSUGGEST = ^tACMDRVFORMATSUGGEST;
+     LPACMDRVFORMATSUGGEST = ^tACMDRVFORMATSUGGEST;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  ACM Driver Messages
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+const
+      ACMDM_USER                  = DRV_USER + $0000;
+      ACMDM_RESERVED_LOW          = DRV_USER + $2000;
+      ACMDM_RESERVED_HIGH         = DRV_USER + $2FFF;
+
+      ACMDM_BASE                  = ACMDM_RESERVED_LOW;
+
+      ACMDM_DRIVER_ABOUT          = ACMDM_BASE + 11;
+
+const
+      ACMDM_DRIVER_NOTIFY             = ACMDM_BASE + 1;
+      ACMDM_DRIVER_DETAILS            = ACMDM_BASE + 10;
+
+      ACMDM_HARDWARE_WAVE_CAPS_INPUT  = ACMDM_BASE + 20;
+      ACMDM_HARDWARE_WAVE_CAPS_OUTPUT = ACMDM_BASE + 21;
+
+      ACMDM_FORMATTAG_DETAILS         = ACMDM_BASE + 25;
+      ACMDM_FORMAT_DETAILS            = ACMDM_BASE + 26;
+      ACMDM_FORMAT_SUGGEST            = ACMDM_BASE + 27;
+
+      ACMDM_FILTERTAG_DETAILS         = ACMDM_BASE + 50;
+      ACMDM_FILTER_DETAILS            = ACMDM_BASE + 51;
+
+      ACMDM_STREAM_OPEN               = ACMDM_BASE + 76;
+      ACMDM_STREAM_CLOSE              = ACMDM_BASE + 77;
+      ACMDM_STREAM_SIZE               = ACMDM_BASE + 78;
+      ACMDM_STREAM_CONVERT            = ACMDM_BASE + 79;
+      ACMDM_STREAM_RESET              = ACMDM_BASE + 80;
+      ACMDM_STREAM_PREPARE            = ACMDM_BASE + 81;
+      ACMDM_STREAM_UNPREPARE          = ACMDM_BASE + 82;
+      ACMDM_STREAM_UPDATE             = ACMDM_BASE + 83;
+
+// - End of module: msacmdrv.h
+
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//
+//
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+const
+      DRV_MAPPER_PREFERRED_INPUT_GET  = DRV_USER + 0;
+      DRV_MAPPER_PREFERRED_OUTPUT_GET = DRV_USER + 2;
+      DRVM_MAPPER_STATUS              = $2000;
+
+      WIDM_MAPPER_STATUS              = DRVM_MAPPER_STATUS + 0;
+      WAVEIN_MAPPER_STATUS_DEVICE     = 0;
+      WAVEIN_MAPPER_STATUS_MAPPED     = 1;
+      WAVEIN_MAPPER_STATUS_FORMAT     = 2;
+
+      WODM_MAPPER_STATUS              = DRVM_MAPPER_STATUS + 0;
+      WAVEOUT_MAPPER_STATUS_DEVICE    = 0;
+      WAVEOUT_MAPPER_STATUS_MAPPED    = 1;
+      WAVEOUT_MAPPER_STATUS_FORMAT    = 2;
+
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  ACM Error Codes
+//
+//  Note that these error codes are specific errors that apply to the ACM
+//  directly--general errors are defined as MMSYSERR_*.
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+type
+     MMRESULT = UINT;
+
+const
+      ACMERR_BASE         = 512;
+      ACMERR_NOTPOSSIBLE  = ACMERR_BASE + 0;
+      ACMERR_BUSY         = ACMERR_BASE + 1;
+      ACMERR_UNPREPARED   = ACMERR_BASE + 2;
+      ACMERR_CANCELED     = ACMERR_BASE + 3;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  ACM Window Messages
+//
+//  These window messages are sent by the ACM or ACM drivers to notify
+//  applications of events.
+//
+//  Note that these window message numbers will also be defined in
+//  mmsystem.
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+const
+      MM_ACM_OPEN         = $03D4; // MM_STREAM_OPEN  // conversion callback messages
+      MM_ACM_CLOSE        = $03D5; // MM_STREAM_CLOSE
+      MM_ACM_DONE         = $03D6; // MM_STREAM_DONE
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmGetVersion()
+//
+//  the ACM version is a 32 bit number that is broken into three parts as 
+//  follows:
+//
+//      bits 24 - 31:   8 bit _major_ version number
+//      bits 16 - 23:   8 bit _minor_ version number
+//      bits  0 - 15:   16 bit build number
+//
+//  this is then displayed as follows:
+//
+//      bMajor = (BYTE)(dwVersion >> 24)
+//      bMinor = (BYTE)(dwVersion >> 16) & 
+//      wBuild = LOWORD(dwVersion)
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmGetVersion:DWORD; external KernelDLL name 'acmGetVersion'; // index 2A5
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmMetrics()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmMetrics(hao:HACMOBJ; uMetric:UINT; pMetric:LPVOID):MMRESULT; external KernelDLL name 'acmMetrics'; // index 2A6
+
+const
+      ACM_METRIC_COUNT_DRIVERS            = 1;
+      ACM_METRIC_COUNT_CODECS             = 2;
+      ACM_METRIC_COUNT_CONVERTERS         = 3;
+      ACM_METRIC_COUNT_FILTERS            = 4;
+      ACM_METRIC_COUNT_DISABLED           = 5;
+      ACM_METRIC_COUNT_HARDWARE           = 6;
+      ACM_METRIC_COUNT_LOCAL_DRIVERS      = 20;
+      ACM_METRIC_COUNT_LOCAL_CODECS       = 21;
+      ACM_METRIC_COUNT_LOCAL_CONVERTERS   = 22;
+      ACM_METRIC_COUNT_LOCAL_FILTERS      = 23;
+      ACM_METRIC_COUNT_LOCAL_DISABLED     = 24;
+      ACM_METRIC_HARDWARE_WAVE_INPUT      = 30;
+      ACM_METRIC_HARDWARE_WAVE_OUTPUT     = 31;
+      ACM_METRIC_MAX_SIZE_FORMAT          = 50;
+      ACM_METRIC_MAX_SIZE_FILTER          = 51;
+      ACM_METRIC_DRIVER_SUPPORT           = 100;
+      ACM_METRIC_DRIVER_PRIORITY          = 101;
+
+
+//--------------------------------------------------------------------------;
+//
+//  ACM Drivers
+//
+//--------------------------------------------------------------------------;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmDriverEnum()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+type
+     ACMDRIVERENUMCB = function(hadid:HACMDRIVERID; dwInstance:DWORD; fdwSupport:DWORD):BOOL; cdecl;
+
+
+function acmDriverEnum(fnCallback:ACMDRIVERENUMCB; dwInstance:DWORD; fdwEnum:DWORD):MMRESULT; external KernelDLL name 'acmDriverEnum'; // index 28E
+
+const
+      ACM_DRIVERENUMF_NOLOCAL     = $40000000;
+      ACM_DRIVERENUMF_DISABLED    = $80000000;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmDriverID()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmDriverID(hao:HACMOBJ; phadid:LPHACMDRIVERID; fdwDriverID:DWORD):MMRESULT; external KernelDLL name 'acmDriverID'; // index 28F
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmDriverAdd()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmDriverAdd(phadid:LPHACMDRIVERID;
+                      hinstModule:HINST;
+                      lParam:LPARAM;
+                      dwPriority:DWORD;
+                      fdwAdd:DWORD):MMRESULT; external KernelDLL name 'acmDriverAdd'; // index 28B
+
+const
+      ACM_DRIVERADDF_NOTIFYHWND   = $00000004;  // lParam is notify hwnd
+
+
+//
+//  prototype for ACM driver procedures that are installed as _functions_
+//  or _notifications_ instead of as a standalone installable driver.
+//
+type
+     ACMDRIVERPROC = function(dwID:DWORD; hDrvID:HACMDRIVERID; uMsg:UINT; lParam1:LPARAM; lParam2:LPARAM):LRESULT; cdecl;
+     LPACMDRIVERPROC = ^ACMDRIVERPROC;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmDriverRemove()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmDriverRemove(hadid:HACMDRIVERID; fdwRemove:DWORD):MMRESULT; external KernelDLL name 'acmDriverRemove'; // index 293
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmDriverOpen()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmDriverOpen(phad:LPHACMDRIVER; hadid:HACMDRIVERID; fdwOpen:DWORD):MMRESULT; external KernelDLL name 'acmDriverOpen'; // index 291
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmDriverClose()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmDriverClose(had:HACMDRIVER; fdwClose:DWORD):MMRESULT; external KernelDLL name 'acmDriverClose'; // index 28C
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmDriverMessage()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmDriverMessage(had:HACMDRIVER; uMsg:UINT; lParam1:LPARAM; lParam2:LPARAM):LRESULT; external KernelDLL name 'acmDriverMessage'; // index 290
+
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmDriverPriority
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmDriverPriority(hadid:HACMDRIVERID; dwPriority:DWORD; fdwPriority:DWORD):MMRESULT; external KernelDLL name 'acmDriverPriority'; // index 292
+
+const
+      ACM_DRIVERPRIORITYF_ENABLE      = $00000001;
+      ACM_DRIVERPRIORITYF_DISABLE     = $00000002;
+      ACM_DRIVERPRIORITYF_ABLEMASK    = $00000003;
+      ACM_DRIVERPRIORITYF_BEGIN       = $00010000;
+      ACM_DRIVERPRIORITYF_END         = $00020000;
+      ACM_DRIVERPRIORITYF_DEFERMASK   = $00030000;
+
+      
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmDriverDetails()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+
+//
+//  ACMDRIVERDETAILS
+//
+//  the ACMDRIVERDETAILS structure is used to get various capabilities from
+//  an ACM driver (codec, converter, filter).
+//
+const
+      ACMDRIVERDETAILS_SHORTNAME_CHARS    = 32;
+      ACMDRIVERDETAILS_LONGNAME_CHARS     = 128;
+      ACMDRIVERDETAILS_COPYRIGHT_CHARS    = 80;
+      ACMDRIVERDETAILS_LICENSING_CHARS    = 128;
+      ACMDRIVERDETAILS_FEATURES_CHARS     = 512;
+
+type
+     tACMDRIVERDETAILS = record
+       cbStruct:DWORD;           // number of valid bytes in structure
+       fccType:FOURCC;            // compressor type 'audc'
+       fccComp:FOURCC;            // sub-type (not used; reserved)
+
+       wMid:word;               // manufacturer id
+       wPid:word;               // product id
+
+       vdwACM:DWORD;             // version of the ACM *compiled* for
+       vdwDriver:DWORD;          // version of the driver
+
+       fdwSupport:DWORD;         // misc. support flags
+       cFormatTags:DWORD;        // total unique format tags supported
+       cFilterTags:DWORD;        // total unique filter tags supported
+
+       _hicon:HICON;              // handle to custom icon
+
+       szShortName:array[0..ACMDRIVERDETAILS_SHORTNAME_CHARS-1] of WCHAR;
+       szLongName:array[0..ACMDRIVERDETAILS_LONGNAME_CHARS-1] of WCHAR;
+       szCopyright:array[0..ACMDRIVERDETAILS_COPYRIGHT_CHARS-1] of WCHAR;
+       szLicensing:array[0..ACMDRIVERDETAILS_LICENSING_CHARS-1] of WCHAR;
+       szFeatures:array[0..ACMDRIVERDETAILS_FEATURES_CHARS-1] of WCHAR;
+     end;
+     _ACMDRIVERDETAILS = tACMDRIVERDETAILS;
+     PACMDRIVERDETAILS = ^tACMDRIVERDETAILS;
+     LPACMDRIVERDETAILS = ^tACMDRIVERDETAILS;
+
+
+//
+//  ACMDRIVERDETAILS.fccType
+//
+//  ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC: the FOURCC used in the fccType
+//  field of the ACMDRIVERDETAILS structure to specify that this is an ACM
+//  codec designed for audio.
+//
+//
+//  ACMDRIVERDETAILS.fccComp
+//
+//  ACMDRIVERDETAILS_FCCCOMP_UNDEFINED: the FOURCC used in the fccComp
+//  field of the ACMDRIVERDETAILS structure. this is currently an unused
+//  field.
+//
+const
+      ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC = FOURCC(byte(AnsiChar('a')) or
+                                                   (byte(AnsiChar('u')) shl 8) or
+                                                   (byte(AnsiChar('d')) shl 16) or
+                                                   (byte(AnsiChar('c')) shl 24)
+                                                  );
+
+      ACMDRIVERDETAILS_FCCCOMP_UNDEFINED  = FOURCC(byte(AnsiChar(#0)) or
+                                                   (byte(AnsiChar(#0)) shl 8) or
+                                                   (byte(AnsiChar(#0)) shl 16) or
+                                                   (byte(AnsiChar(#0)) shl 24) 
+                                                  );
+
+//
+//  the following flags are used to specify the type of conversion(s) that
+//  the converter/codec/filter supports. these are placed in the fdwSupport
+//  field of the ACMDRIVERDETAILS structure. note that a converter can
+//  support one or more of these flags in any combination.
+//
+//  ACMDRIVERDETAILS_SUPPORTF_CODEC: this flag is set if the driver supports
+//  conversions from one format tag to another format tag. for example, if a
+//  converter compresses WAVE_FORMAT_PCM to WAVE_FORMAT_ADPCM, then this bit
+//  should be set.
+//
+//  ACMDRIVERDETAILS_SUPPORTF_CONVERTER: this flags is set if the driver
+//  supports conversions on the same format tag. as an example, the PCM
+//  converter that is built into the ACM sets this bit (and only this bit)
+//  because it converts only PCM formats (bits, sample rate).
+//
+//  ACMDRIVERDETAILS_SUPPORTF_FILTER: this flag is set if the driver supports
+//  transformations on a single format. for example, a converter that changed
+//  the 'volume' of PCM data would set this bit. 'echo' and 'reverb' are
+//  also filter types.
+//
+//  ACMDRIVERDETAILS_SUPPORTF_HARDWARE: this flag is set if the driver supports
+//  hardware input and/or output through a waveform device.
+//
+//  ACMDRIVERDETAILS_SUPPORTF_ASYNC: this flag is set if the driver supports
+//  async conversions.
+//
+//
+//  ACMDRIVERDETAILS_SUPPORTF_LOCAL: this flag is set _by the ACM_ if a
+//  driver has been installed local to the current task. this flag is also
+//  set in the fdwSupport argument to the enumeration callback function
+//  for drivers.
+//
+//  ACMDRIVERDETAILS_SUPPORTF_DISABLED: this flag is set _by the ACM_ if a
+//  driver has been disabled. this flag is also passed set in the fdwSupport
+//  argument to the enumeration callback function for drivers.
+//
+const
+      ACMDRIVERDETAILS_SUPPORTF_CODEC     = $00000001;
+      ACMDRIVERDETAILS_SUPPORTF_CONVERTER = $00000002;
+      ACMDRIVERDETAILS_SUPPORTF_FILTER    = $00000004;
+      ACMDRIVERDETAILS_SUPPORTF_HARDWARE  = $00000008;
+      ACMDRIVERDETAILS_SUPPORTF_ASYNC     = $00000010;
+      ACMDRIVERDETAILS_SUPPORTF_LOCAL     = $40000000;
+      ACMDRIVERDETAILS_SUPPORTF_DISABLED  = $80000000;
+
+function acmDriverDetails(hadid:HACMDRIVERID;
+                          padd:LPACMDRIVERDETAILS;
+                          fdwDetails:DWORD):MMRESULT; external KernelDLL name 'acmDriverDetails'; // index 28D
+
+                          
+
+//--------------------------------------------------------------------------;
+//
+//  ACM Format Tags
+//
+//--------------------------------------------------------------------------;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmFormatTagDetails()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+const
+      ACMFORMATTAGDETAILS_FORMATTAG_CHARS = 48;
+
+type
+     tACMFORMATTAGDETAILSW = record
+       cbStruct:DWORD;
+       dwFormatTagIndex:DWORD;
+       dwFormatTag:DWORD;
+       cbFormatSize:DWORD;
+       fdwSupport:DWORD;
+       cStandardFormats:DWORD;
+       szFormatTag:array[0..ACMFORMATTAGDETAILS_FORMATTAG_CHARS-1] of WCHAR;
+     end;
+     tACMFORMATTAGDETAILS = tACMFORMATTAGDETAILSW;
+     _ACMFORMATTAGDETAILS = tACMFORMATTAGDETAILSW;
+     PACMFORMATTAGDETAILS = ^tACMFORMATTAGDETAILSW;
+     LPACMFORMATTAGDETAILS = ^tACMFORMATTAGDETAILSW;
+
+function acmFormatTagDetails(had:HACMDRIVER;
+                             paftd:LPACMFORMATTAGDETAILS;
+                             fdwDetails:DWORD):MMRESULT; external KernelDLL name 'acmFormatTagDetails'; // index 29B
+
+const
+      ACM_FORMATTAGDETAILSF_INDEX         = $00000000;
+      ACM_FORMATTAGDETAILSF_FORMATTAG     = $00000001;
+      ACM_FORMATTAGDETAILSF_LARGESTSIZE   = $00000002;
+      ACM_FORMATTAGDETAILSF_QUERYMASK     = $0000000F;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmFormatTagEnum()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+type
+     ACMFORMATTAGENUMCB = function(hadid:HACMDRIVERID;
+                                   paftd:LPACMFORMATTAGDETAILS;
+                                   dwInstance:DWORD;
+                                   fdwSupport:DWORD):BOOL; cdecl;
+
+function acmFormatTagEnum(had:HACMDRIVER;
+                          paftd:LPACMFORMATTAGDETAILS;
+                          fnCallback:ACMFORMATTAGENUMCB;
+                          dwInstance:DWORD;
+                          fdwEnum:DWORD):MMRESULT; external KernelDLL name 'acmFormatTagEnum'; // index 29C
+
+
+//--------------------------------------------------------------------------;
+//
+//  ACM Formats
+//
+//--------------------------------------------------------------------------;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmFormatDetails()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+const
+      ACMFORMATDETAILS_FORMAT_CHARS   = 128;
+
+type
+     tACMFORMATDETAILS = record
+       cbStruct:DWORD;
+       dwFormatIndex:DWORD;
+       dwFormatTag:DWORD;
+       fdwSupport:DWORD;
+       pwfx:LPWAVEFORMATEX;
+       cbwfx:DWORD;
+       szFormat:array[0..ACMFORMATDETAILS_FORMAT_CHARS-1] of WCHAR;
+     end;
+     _ACMFORMATDETAILS = tACMFORMATDETAILS;
+     PACMFORMATDETAILS = ^tACMFORMATDETAILS;
+     LPACMFORMATDETAILS = ^tACMFORMATDETAILS;
+
+function acmFormatDetails(had:HACMDRIVER; pafd:LPACMFORMATDETAILS; fdwDetails:DWORD):MMRESULT; external KernelDLL name 'acmFormatDetails'; // index 298
+
+const
+      ACM_FORMATDETAILSF_INDEX        = $00000000;
+      ACM_FORMATDETAILSF_FORMAT       = $00000001;
+      ACM_FORMATDETAILSF_QUERYMASK    = $0000000F;
+
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmFormatEnum()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+type
+     ACMFORMATENUMCB = function(hadid:HACMDRIVERID;
+                                pafd:LPACMFORMATDETAILS;
+                                dwInstance:DWORD;
+                                fdwSupport:DWORD):BOOL; cdecl;
+
+function acmFormatEnum(had:HACMDRIVER;
+                       pafd:LPACMFORMATDETAILS;
+                       fnCallback:ACMFORMATENUMCB;
+                       dwInstance:DWORD;
+                       fdwEnum:DWORD):MMRESULT; external KernelDLL name 'acmFormatEnum'; // index 299
+
+const
+      ACM_FORMATENUMF_WFORMATTAG       = $00010000;
+      ACM_FORMATENUMF_NCHANNELS        = $00020000;
+      ACM_FORMATENUMF_NSAMPLESPERSEC   = $00040000;
+      ACM_FORMATENUMF_WBITSPERSAMPLE   = $00080000;
+      ACM_FORMATENUMF_CONVERT          = $00100000;
+      ACM_FORMATENUMF_SUGGEST          = $00200000;
+      ACM_FORMATENUMF_HARDWARE         = $00400000;
+      ACM_FORMATENUMF_INPUT            = $00800000;
+      ACM_FORMATENUMF_OUTPUT           = $01000000;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmFormatSuggest()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmFormatSuggest(had:HACMDRIVER;
+                          pwfxSrc:LPWAVEFORMATEX;
+                          pwfxDst:LPWAVEFORMATEX;
+                          cbwfxDst:DWORD;
+                          fdwSuggest:DWORD):MMRESULT; external KernelDLL name 'acmFormatSuggest'; // index 29A
+
+const
+      ACM_FORMATSUGGESTF_WFORMATTAG       = $00010000;
+      ACM_FORMATSUGGESTF_NCHANNELS        = $00020000;
+      ACM_FORMATSUGGESTF_NSAMPLESPERSEC   = $00040000;
+      ACM_FORMATSUGGESTF_WBITSPERSAMPLE   = $00080000;
+
+      ACM_FORMATSUGGESTF_TYPEMASK         = $00FF0000;
+
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmFormatChoose()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+const
+      ACMHELPMSGSTRING        = 'acmchoose_help';
+      ACMHELPMSGCONTEXTMENU   = 'acmchoose_contextmenu';
+      ACMHELPMSGCONTEXTHELP   = 'acmchoose_contexthelp';
+
+//
+//  MM_ACM_FORMATCHOOSE is sent to hook callbacks by the Format Chooser
+//  Dialog...
+//
+const
+      MM_ACM_FORMATCHOOSE             = $8000;
+
+       FORMATCHOOSE_MESSAGE           = 0;
+       FORMATCHOOSE_FORMATTAG_VERIFY  = FORMATCHOOSE_MESSAGE + 0;
+       FORMATCHOOSE_FORMAT_VERIFY     = FORMATCHOOSE_MESSAGE + 1;
+       FORMATCHOOSE_CUSTOM_VERIFY     = FORMATCHOOSE_MESSAGE + 2;
+
+type
+     ACMFORMATCHOOSEHOOKPROC = function(hwnd:HWND;
+                                        uMsg:UINT;
+                                        wParam:WPARAM;
+                                        lParam:LPARAM):UINT; cdecl;
+type
+     tACMFORMATCHOOSE = record
+       cbStruct:DWORD;           // sizeof(ACMFORMATCHOOSE)
+       fdwStyle:DWORD;           // chooser style flags
+
+       hwndOwner:HWND;          // caller's window handle
+
+       pwfx:LPWAVEFORMATEX;               // ptr to wfx buf to receive choice
+       cbwfx:DWORD;              // size of mem buf for pwfx
+       pszTitle:LPCWSTR;           // dialog box title bar
+
+       szFormatTag:array[0..ACMFORMATTAGDETAILS_FORMATTAG_CHARS-1] of WCHAR;
+       szFormat:array[0..ACMFORMATDETAILS_FORMAT_CHARS-1] of WCHAR;
+
+       pszName:LPWSTR;            // custom name selection
+       cchName:DWORD;            // size in chars of mem buf for pszName
+
+       fdwEnum:DWORD;            // format enumeration restrictions
+       pwfxEnum:LPWAVEFORMATEX;  // format describing restrictions
+
+       hInstance:HINST;          // app instance containing dlg template
+       pszTemplateName:LPCWSTR;    // custom template name
+       lCustData:LPARAM;          // data passed to hook fn.
+       pfnHook:ACMFORMATCHOOSEHOOKPROC;    // ptr to hook function
+     end;
+     _ACMFORMATCHOOSE = tACMFORMATCHOOSE;
+     PACMFORMATCHOOSE = ^tACMFORMATCHOOSE;
+     LPACMFORMATCHOOSE = ^tACMFORMATCHOOSE;
+
+//
+//  ACMFORMATCHOOSE.fdwStyle
+//
+const
+      ACMFORMATCHOOSE_STYLEF_SHOWHELP              = $00000004;
+      ACMFORMATCHOOSE_STYLEF_ENABLEHOOK            = $00000008;
+      ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE        = $00000010;
+      ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE  = $00000020;
+      ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT       = $00000040;
+      ACMFORMATCHOOSE_STYLEF_CONTEXTHELP           = $00000080;
+
+function acmFormatChoose(pafmtc:LPACMFORMATCHOOSE):MMRESULT; external KernelDLL name 'acmFormatChoose'; // index 2A7
+
+
+//--------------------------------------------------------------------------;
+//
+//  ACM Filter Tags
+//
+//--------------------------------------------------------------------------;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmFilterTagDetails()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+const
+      ACMFILTERTAGDETAILS_FILTERTAG_CHARS = 48;
+
+type
+     tACMFILTERTAGDETAILS = record
+       cbStruct:DWORD;
+       dwFilterTagIndex:DWORD;
+       dwFilterTag:DWORD;
+       cbFilterSize:DWORD;
+       fdwSupport:DWORD;
+       cStandardFilters:DWORD;
+       szFilterTag:array[0..ACMFILTERTAGDETAILS_FILTERTAG_CHARS-1] of WCHAR;
+     end;
+     _ACMFILTERTAGDETAILS = tACMFILTERTAGDETAILS;
+     PACMFILTERTAGDETAILS = ^tACMFILTERTAGDETAILS;
+     LPACMFILTERTAGDETAILS = ^tACMFILTERTAGDETAILS;
+
+function acmFilterTagDetails(had:HACMDRIVER;
+                             paftd:LPACMFILTERTAGDETAILS;
+                             fdwDetails:DWORD):MMRESULT; external KernelDLL name 'acmFilterTagDetails'; // index 296 
+
+const
+      ACM_FILTERTAGDETAILSF_INDEX         = $00000000;
+      ACM_FILTERTAGDETAILSF_FILTERTAG     = $00000001;
+      ACM_FILTERTAGDETAILSF_LARGESTSIZE   = $00000002;
+      ACM_FILTERTAGDETAILSF_QUERYMASK     = $0000000F;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmFilterTagEnum()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+type
+     ACMFILTERTAGENUMCB = function(hadid:HACMDRIVERID;
+                                   paftd:LPACMFILTERTAGDETAILS;
+                                   dwInstance:DWORD;
+                                   fdwSupport:DWORD):BOOL; cdecl;
+
+function acmFilterTagEnum(had:HACMDRIVER;
+                          paftd:LPACMFILTERTAGDETAILS;
+                          fnCallback:ACMFILTERTAGENUMCB;
+                          dwInstance:DWORD;
+                          fdwEnum:DWORD):MMRESULT; external KernelDLL name 'acmFilterTagEnum'; // index 297 
+
+
+//--------------------------------------------------------------------------;
+//
+//  ACM Filters
+//
+//--------------------------------------------------------------------------;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmFilterDetails()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+const
+      ACMFILTERDETAILS_FILTER_CHARS   = 128;
+
+type
+     tACMFILTERDETAILS = record
+       cbStruct:DWORD;
+       dwFilterIndex:DWORD;
+       dwFilterTag:DWORD;
+       fdwSupport:DWORD;
+       pwfltr:LPWAVEFILTER;
+       cbwfltr:DWORD;
+       szFilter:array[0..ACMFILTERDETAILS_FILTER_CHARS-1] of WCHAR;
+     end;
+     _ACMFILTERDETAILS = tACMFILTERDETAILS;
+     PACMFILTERDETAILS = ^tACMFILTERDETAILS;
+     LPACMFILTERDETAILS = ^tACMFILTERDETAILS;
+
+function acmFilterDetails(had:HACMDRIVER;
+                          pafd:LPACMFILTERDETAILS;
+                          fdwDetails:DWORD):MMRESULT; external KernelDLL name 'acmFilterDetails'; // index 294
+
+const
+      ACM_FILTERDETAILSF_INDEX        = $00000000;
+      ACM_FILTERDETAILSF_FILTER       = $00000001;
+      ACM_FILTERDETAILSF_QUERYMASK    = $0000000F;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmFilterEnum()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+type
+     ACMFILTERENUMCB = function(hadid:HACMDRIVERID;
+                                pafd:LPACMFILTERDETAILS;      
+                                dwInstance:DWORD;
+                                fdwSupport:DWORD):BOOL; cdecl;
+
+function acmFilterEnum(had:HACMDRIVER;
+                       pafd:LPACMFILTERDETAILS;
+                       fnCallback:ACMFILTERENUMCB;
+                       dwInstance:DWORD;
+                       fdwEnum:DWORD):MMRESULT; external KernelDLL name 'acmFilterEnum'; // index 295
+
+const
+      ACM_FILTERENUMF_DWFILTERTAG         = $00010000;
+
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmFilterChoose()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+
+//
+//  MM_ACM_FILTERCHOOSE is sent to hook callbacks by the Filter Chooser
+//  Dialog...
+//
+const
+      MM_ACM_FILTERCHOOSE             = $8000;
+
+      FILTERCHOOSE_MESSAGE            = 0;
+      FILTERCHOOSE_FILTERTAG_VERIFY   = FILTERCHOOSE_MESSAGE + 0;
+      FILTERCHOOSE_FILTER_VERIFY      = FILTERCHOOSE_MESSAGE + 1;
+      FILTERCHOOSE_CUSTOM_VERIFY      = FILTERCHOOSE_MESSAGE + 2;
+
+type
+     ACMFILTERCHOOSEHOOKPROC = function(hwnd:HWND;
+                                        uMsg:UINT;                    
+                                        wParam:WPARAM;
+                                        lParam:LPARAM):UINT; cdecl;
+
+//
+//  ACMFILTERCHOOSE
+//
+type
+     tACMFILTERCHOOSE = record
+       cbStruct:DWORD;           // sizeof(ACMFILTERCHOOSE)
+       fdwStyle:DWORD;           // chooser style flags
+
+       hwndOwner:HWND;          // caller's window handle
+
+       pwfltr:LPWAVEFILTER;             // ptr to wfltr buf to receive choice
+       cbwfltr:DWORD;            // size of mem buf for pwfltr
+
+       pszTitle:LPCWSTR;
+
+       szFilterTag:array[0..ACMFILTERTAGDETAILS_FILTERTAG_CHARS-1] of WCHAR;
+       szFilter:array[0..ACMFILTERDETAILS_FILTER_CHARS-1] of WCHAR;
+       pszName:LPWSTR;            // custom name selection
+       cchName:DWORD;            // size in chars of mem buf for pszName
+
+       fdwEnum:DWORD;            // filter enumeration restrictions
+       pwfltrEnum:LPWAVEFILTER;         // filter describing restrictions
+
+       hInstance:HINST;          // app instance containing dlg template
+       pszTemplateName:LPCWSTR;    // custom template name
+       lCustData:LPARAM;          // data passed to hook fn.
+       pfnHook:ACMFILTERCHOOSEHOOKPROC;    // ptr to hook function
+     end;
+     _ACMFILTERCHOOSE = tACMFILTERCHOOSE;
+     PACMFILTERCHOOSE = ^tACMFILTERCHOOSE;
+     LPACMFILTERCHOOSE = ^tACMFILTERCHOOSE;
+
+//
+//  ACMFILTERCHOOSE.fdwStyle
+//
+const
+      ACMFILTERCHOOSE_STYLEF_SHOWHELP              = $00000004;
+      ACMFILTERCHOOSE_STYLEF_ENABLEHOOK            = $00000008;
+      ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATE        = $00000010;
+      ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATEHANDLE  = $00000020;
+      ACMFILTERCHOOSE_STYLEF_INITTOFILTERSTRUCT    = $00000040;
+      ACMFILTERCHOOSE_STYLEF_CONTEXTHELP           = $00000080;
+
+function acmFilterChoose(pafltrc:LPACMFILTERCHOOSE):MMRESULT; external KernelDLL name 'acmFilterChoose'; // index 2A8
+
+//--------------------------------------------------------------------------;
+//
+//  ACM Stream API's
+//
+//--------------------------------------------------------------------------;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmStreamOpen()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+type
+     tACMSTREAMHEADER = record
+       cbStruct:DWORD;               // sizeof(ACMSTREAMHEADER)
+       fdwStatus:DWORD;              // ACMSTREAMHEADER_STATUSF_*
+       dwUser:DWORD;                 // user instance data for hdr
+       pbSrc:LPBYTE;
+       cbSrcLength:DWORD;
+       cbSrcLengthUsed:DWORD;
+       dwSrcUser:DWORD;              // user instance data for src
+       pbDst:LPBYTE;
+       cbDstLength:DWORD;
+       cbDstLengthUsed:DWORD;
+       dwDstUser:DWORD;              // user instance data for dst
+       dwReservedDriver:array[0..9] of DWORD;   // driver reserved work space
+     end;
+     ACMSTREAMHEADER = tACMSTREAMHEADER;
+     PACMSTREAMHEADER = ^tACMSTREAMHEADER;
+     LPACMSTREAMHEADER = ^tACMSTREAMHEADER;
+
+//
+//  ACMSTREAMHEADER.fdwStatus
+//
+//  ACMSTREAMHEADER_STATUSF_DONE: done bit for async conversions.
+//
+const
+      ACMSTREAMHEADER_STATUSF_DONE        = $00010000;
+      ACMSTREAMHEADER_STATUSF_PREPARED    = $00020000;
+      ACMSTREAMHEADER_STATUSF_INQUEUE     = $00100000;
+
+function acmStreamOpen(phas:LPHACMSTREAM;       // pointer to stream handle
+                       had:HACMDRIVER;        // optional driver handle
+                       pwfxSrc:LPWAVEFORMATEX;    // source format to convert
+                       pwfxDst:LPWAVEFORMATEX;    // required destination format
+                       pwfltr:LPWAVEFILTER;     // optional filter
+                       dwCallback:DWORD; // callback
+                       dwInstance:DWORD; // callback instance data
+                       fdwOpen:DWORD     // ACM_STREAMOPENF_* and CALLBACK_*
+                      ):MMRESULT; external KernelDLL name 'acmStreamOpen'; // index 2A0
+
+const
+      ACM_STREAMOPENF_QUERY           = $00000001;
+      ACM_STREAMOPENF_ASYNC           = $00000002;
+      ACM_STREAMOPENF_NONREALTIME     = $00000004;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmStreamClose()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmStreamClose(has:HACMSTREAM;
+                        fdwClose:DWORD):MMRESULT; external KernelDLL name 'acmStreamClose'; // index 29D
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmStreamSize()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmStreamSize(has:HACMSTREAM;
+                       cbInput:DWORD;
+                       pdwOutputBytes:LPDWORD;
+                       fdwSize:DWORD):MMRESULT; external KernelDLL name 'acmStreamSize'; // index 2A3
+
+const
+      ACM_STREAMSIZEF_SOURCE          = $00000000;
+      ACM_STREAMSIZEF_DESTINATION     = $00000001;
+      ACM_STREAMSIZEF_QUERYMASK       = $0000000F;
+
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmStreamReset()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmStreamReset(has:HACMSTREAM;
+                        fdwReset:DWORD):MMRESULT; external KernelDLL name 'acmStreamReset'; // index 2A2
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmStreamMessage()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmStreamMessage(has:HACMSTREAM;
+                          uMsg:UINT;
+                          lParam1:LPARAM;
+                          lParam2:LPARAM):MMRESULT; external KernelDLL name 'acmStreamMessage'; // index 29F
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmStreamConvert()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmStreamConvert(has:HACMSTREAM;
+                          pash:LPACMSTREAMHEADER;
+                          fdwConvert:DWORD):MMRESULT; external KernelDLL name 'acmStreamConvert'; // index 29E
+
+const                          
+      ACM_STREAMCONVERTF_BLOCKALIGN   = $00000004;
+      ACM_STREAMCONVERTF_START        = $00000010;
+      ACM_STREAMCONVERTF_END          = $00000020;
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmStreamPrepareHeader()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmStreamPrepareHeader(has:HACMSTREAM;
+                                pash:LPACMSTREAMHEADER;
+                                fdwPrepare:DWORD):MMRESULT; external KernelDLL name 'acmStreamPrepareHeader'; // index 2A1
+
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+//
+//  acmStreamUnprepareHeader()
+//
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
+function acmStreamUnprepareHeader(has:HACMSTREAM;
+                                  pash:LPACMSTREAMHEADER;
+                                  fdwUnprepare:DWORD):MMRESULT; external KernelDLL name 'acmStreamUnprepareHeader'; // index 2A4
+
+{$PACKRECORDS DEFAULT} // #pragma pack()          /* Revert to default packing */
+
+
+
+// Module: msacmdlg.h
+
+// -----------------------------------------------------------------------------
+//
+//  Audio Compression Manager Common Dialogs Identifiers
+//
+// -----------------------------------------------------------------------------
+const
+      DLG_ACMFORMATCHOOSE_ID              = 70;
+      IDD_ACMFORMATCHOOSE_CMB_FORMATTAG   = 101;
+      IDD_ACMFORMATCHOOSE_CMB_FORMAT      = 102;
+
+      DLG_ACMFILTERCHOOSE_ID              = 71;
+      IDD_ACMFILTERCHOOSE_CMB_FILTERTAG   = 101;
+      IDD_ACMFILTERCHOOSE_CMB_FILTER      = 102;
+
+// End of module msacmdlg.h
+
+implementation
+
+// - Module: msacmdrv.h
+// -----------------------------------------------------------------------------
+//
+//  Audio Compression Manager Public Header File for Drivers
+//
+// -----------------------------------------------------------------------------
+function MAKE_ACM_VERSION(mjr:byte; mnr:byte; bld:word):DWORD; inline;
+begin
+  MAKE_ACM_VERSION:=(DWORD(mjr) shl 24) or (DWORD(mnr) shl 16) or bld;
+end;
+// - End of module: msacmdrv.h
+
+end.

+ 4349 - 0
packages/winceunits/src/wininet.pp

@@ -0,0 +1,4349 @@
+//
+// Module Name:
+//
+//	  wininet.h
+//
+// Abstract:
+//
+//  	Contains manifests, macros, types and prototypes for Microsoft Windows
+//  	Internet Extensions
+//
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit wininet;
+
+{$IFNDEF NO_SMART_LINK}
+{$SMARTLINK ON}
+{$ENDIF}
+
+{$CALLING cdecl}
+
+interface
+
+uses Windows;
+
+// *
+// * Set up Structure Packing to be 4 bytes
+// * for all wininet structures
+// *
+{$PACKRECORDS 4}
+{
+#if defined(_WIN64)
+#include <pshpack8.h>
+#else
+#include <pshpack4.h>
+#endif
+}
+
+//
+// internet types
+//
+type
+     HINTERNET = LPVOID;
+     LPHINTERNET = ^HINTERNET;
+
+     INTERNET_PORT = word;
+     LPINTERNET_PORT = ^INTERNET_PORT;
+
+//
+// Internet APIs
+//
+
+//
+// manifests
+//
+const
+      INTERNET_INVALID_PORT_NUMBER    = 0;           // use the protocol-specific default
+
+      INTERNET_DEFAULT_FTP_PORT       = 21;          // default for FTP servers
+      INTERNET_DEFAULT_GOPHER_PORT    = 70;          //    "     "  gopher "
+      INTERNET_DEFAULT_HTTP_PORT      = 80;          //    "     "  HTTP   "
+      INTERNET_DEFAULT_HTTPS_PORT     = 443;         //    "     "  HTTPS  "
+      INTERNET_DEFAULT_SOCKS_PORT     = 1080;        // default for SOCKS firewall servers.
+
+
+//
+// maximum field lengths (arbitrary)
+//
+const
+      INTERNET_MAX_HOST_NAME_LENGTH   = 256;
+      INTERNET_MAX_USER_NAME_LENGTH   = 128;
+      INTERNET_MAX_PASSWORD_LENGTH    = 128;
+      INTERNET_MAX_PORT_NUMBER_LENGTH = 5;           // INTERNET_PORT is unsigned short
+      INTERNET_MAX_PORT_NUMBER_VALUE  = 65535;       // maximum unsigned short value
+      INTERNET_MAX_PATH_LENGTH        = 2048;
+      INTERNET_MAX_SCHEME_LENGTH      = 32;          // longest protocol name length
+
+      INTERNET_MAX_URL_LENGTH         = INTERNET_MAX_SCHEME_LENGTH + Length('://') + INTERNET_MAX_PATH_LENGTH;
+{ Was declared as
+    INTERNET_MAX_URL_LENGTH         (INTERNET_MAX_SCHEME_LENGTH  + sizeof("://") + INTERNET_MAX_PATH_LENGTH)
+}
+
+
+//
+// values returned by InternetQueryOption() with INTERNET_OPTION_KEEP_CONNECTION:
+//
+const
+      INTERNET_KEEP_ALIVE_UNKNOWN     = DWORD(-1);
+      INTERNET_KEEP_ALIVE_ENABLED     = 1;
+      INTERNET_KEEP_ALIVE_DISABLED    = 0;
+
+//
+// flags returned by InternetQueryOption() with INTERNET_OPTION_REQUEST_FLAGS
+//
+const
+      INTERNET_REQFLAG_FROM_CACHE     = $00000001;  // response came from cache
+      INTERNET_REQFLAG_ASYNC          = $00000002;  // request was made asynchronously
+      INTERNET_REQFLAG_VIA_PROXY      = $00000004;  // request was made via a proxy
+      INTERNET_REQFLAG_NO_HEADERS     = $00000008;  // orginal response contained no headers
+      INTERNET_REQFLAG_PASSIVE        = $00000010;  // FTP: passive-mode connection
+      INTERNET_REQFLAG_CACHE_WRITE_DISABLED = $00000040;  // HTTPS: this request not cacheable
+      INTERNET_REQFLAG_NET_TIMEOUT    = $00000080;  // w/ _FROM_CACHE: net request timed out
+
+//
+// flags common to open functions (not InternetOpen()):
+//
+const
+      INTERNET_FLAG_RELOAD            = $80000000;  // retrieve the original item
+
+//
+// flags for InternetOpenUrl():
+//
+const
+      INTERNET_FLAG_RAW_DATA          = $40000000;  // FTP/gopher find: receive the item as raw (structured) data
+      INTERNET_FLAG_EXISTING_CONNECT  = $20000000;  // FTP: use existing InternetConnect handle for server if possible
+
+//
+// flags for InternetOpen():
+//
+const
+      INTERNET_FLAG_ASYNC             = $10000000;  // this request is asynchronous (where supported)
+
+//
+// protocol-specific flags:
+//
+const
+      INTERNET_FLAG_PASSIVE           = $08000000;  // used for FTP connections
+
+//
+// additional cache flags
+//
+const
+      INTERNET_FLAG_NO_CACHE_WRITE    = $04000000;  // don't write this item to the cache
+      INTERNET_FLAG_DONT_CACHE        = INTERNET_FLAG_NO_CACHE_WRITE;
+      INTERNET_FLAG_MAKE_PERSISTENT   = $02000000;  // make this item persistent in cache
+      INTERNET_FLAG_FROM_CACHE        = $01000000;  // use offline semantics
+      INTERNET_FLAG_OFFLINE           = INTERNET_FLAG_FROM_CACHE;
+
+//
+// additional flags
+//
+const
+      INTERNET_FLAG_SECURE            = $00800000;  // use PCT/SSL if applicable (HTTP)
+      INTERNET_FLAG_KEEP_CONNECTION   = $00400000;  // use keep-alive semantics
+      INTERNET_FLAG_NO_AUTO_REDIRECT  = $00200000;  // don't handle redirections automatically
+      INTERNET_FLAG_READ_PREFETCH     = $00100000;  // do background read prefetch
+      INTERNET_FLAG_NO_COOKIES        = $00080000;  // no automatic cookie handling
+      INTERNET_FLAG_NO_AUTH           = $00040000;  // no automatic authentication handling
+      INTERNET_FLAG_RESTRICTED_ZONE   = $00020000;  // apply restricted zone policies for cookies, auth
+      INTERNET_FLAG_CACHE_IF_NET_FAIL = $00010000;  // return cache file if net request fails
+
+//
+// Security Ignore Flags, Allow HttpOpenRequest to overide
+//  Secure Channel (SSL/PCT) failures of the following types.
+//
+const
+      INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP   = $00008000; // ex: https:// to http://
+      INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS  = $00004000; // ex: http:// to https://
+      INTERNET_FLAG_IGNORE_CERT_DATE_INVALID  = $00002000; // expired X509 Cert.
+      INTERNET_FLAG_IGNORE_CERT_CN_INVALID    = $00001000; // bad common name in X509 Cert.
+
+//
+// more caching flags
+//
+const
+      INTERNET_FLAG_RESYNCHRONIZE     = $00000800;  // asking wininet to update an item if it is newer
+      INTERNET_FLAG_HYPERLINK         = $00000400;  // asking wininet to do hyperlinking semantic which works right for scripts
+      INTERNET_FLAG_NO_UI             = $00000200;  // no cookie popup
+      INTERNET_FLAG_PRAGMA_NOCACHE    = $00000100;  // asking wininet to add "pragma: no-cache"
+      INTERNET_FLAG_CACHE_ASYNC       = $00000080;  // ok to perform lazy cache-write
+      INTERNET_FLAG_FORMS_SUBMIT      = $00000040;  // this is a forms submit
+      INTERNET_FLAG_FWD_BACK          = $00000020;  // fwd-back button op
+      INTERNET_FLAG_NEED_FILE         = $00000010;  // need a file for this request
+      INTERNET_FLAG_MUST_CACHE_REQUEST = INTERNET_FLAG_NEED_FILE;
+
+      INTERNET_FLAG_BGUPDATE           = $00000008; // Undocumented flag.
+
+
+//
+// FTP manifests
+//
+const
+      FTP_TRANSFER_TYPE_UNKNOWN   = $00000000;
+      FTP_TRANSFER_TYPE_ASCII     = $00000001;
+      FTP_TRANSFER_TYPE_BINARY    = $00000002;
+
+      FTP_TRANSFER_TYPE_MASK      = FTP_TRANSFER_TYPE_ASCII or FTP_TRANSFER_TYPE_BINARY;
+
+//
+// flags for FTP
+//
+const
+      INTERNET_FLAG_TRANSFER_ASCII    = FTP_TRANSFER_TYPE_ASCII;     // 0x00000001
+      INTERNET_FLAG_TRANSFER_BINARY   = FTP_TRANSFER_TYPE_BINARY;    // 0x00000002
+
+//
+// flags field masks
+//
+const
+      SECURITY_INTERNET_MASK  = INTERNET_FLAG_IGNORE_CERT_CN_INVALID or
+                                INTERNET_FLAG_IGNORE_CERT_DATE_INVALID or
+                                INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS or
+                                INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP;
+
+      INTERNET_FLAGS_MASK     = INTERNET_FLAG_RELOAD or
+                                INTERNET_FLAG_RAW_DATA or
+                                INTERNET_FLAG_EXISTING_CONNECT or
+                                INTERNET_FLAG_ASYNC or
+                                INTERNET_FLAG_PASSIVE or
+                                INTERNET_FLAG_NO_CACHE_WRITE or
+                                INTERNET_FLAG_MAKE_PERSISTENT or
+                                INTERNET_FLAG_FROM_CACHE or
+                                INTERNET_FLAG_SECURE or
+                                INTERNET_FLAG_KEEP_CONNECTION or
+                                INTERNET_FLAG_NO_AUTO_REDIRECT or
+                                INTERNET_FLAG_READ_PREFETCH or
+                                INTERNET_FLAG_NO_COOKIES or
+                                INTERNET_FLAG_NO_AUTH or
+                                INTERNET_FLAG_CACHE_IF_NET_FAIL or
+                                SECURITY_INTERNET_MASK or
+                                INTERNET_FLAG_RESYNCHRONIZE or
+                                INTERNET_FLAG_HYPERLINK or
+                                INTERNET_FLAG_NO_UI or
+                                INTERNET_FLAG_PRAGMA_NOCACHE or
+                                INTERNET_FLAG_CACHE_ASYNC or
+                                INTERNET_FLAG_FORMS_SUBMIT or
+                                INTERNET_FLAG_NEED_FILE or
+                                INTERNET_FLAG_RESTRICTED_ZONE or
+                                INTERNET_FLAG_TRANSFER_BINARY or
+                                INTERNET_FLAG_TRANSFER_ASCII or
+                                INTERNET_FLAG_FWD_BACK or
+                                INTERNET_FLAG_BGUPDATE;
+
+
+      INTERNET_ERROR_MASK_INSERT_CDROM                    = $01;
+      INTERNET_ERROR_MASK_COMBINED_SEC_CERT               = $02;
+      INTERNET_ERROR_MASK_NEED_MSN_SSPI_PKG               = $04;
+      INTERNET_ERROR_MASK_LOGIN_FAILURE_DISPLAY_ENTITY_BODY = $08;
+
+      INTERNET_OPTIONS_MASK   = DWORD(not INTERNET_FLAGS_MASK);
+
+//
+// common per-API flags (new APIs)
+//
+const
+      WININET_API_FLAG_ASYNC          = $00000001;  // force async operation
+      WININET_API_FLAG_SYNC           = $00000004;  // force sync operation
+      WININET_API_FLAG_USE_CONTEXT    = $00000008;  // use value supplied in dwContext (even if 0)
+
+//
+// INTERNET_NO_CALLBACK - if this value is presented as the dwContext parameter
+// then no call-backs will be made for that API
+//
+const
+      INTERNET_NO_CALLBACK            = 0;
+
+
+//
+// structures/types
+//
+
+//
+// INTERNET_SCHEME - enumerated URL scheme type
+//
+
+type
+     INTERNET_SCHEME = (INTERNET_SCHEME_PARTIAL := -2,
+	                       INTERNET_SCHEME_UNKNOWN := -1,
+	                       INTERNET_SCHEME_DEFAULT := 0,
+	                       INTERNET_SCHEME_FTP,
+	                       INTERNET_SCHEME_GOPHER,
+	                       INTERNET_SCHEME_HTTP,
+	                       INTERNET_SCHEME_HTTPS,
+	                       INTERNET_SCHEME_FILE,
+	                       INTERNET_SCHEME_NEWS,
+	                       INTERNET_SCHEME_MAILTO,
+	                       INTERNET_SCHEME_SOCKS,
+	                       INTERNET_SCHEME_JAVASCRIPT,
+	                       INTERNET_SCHEME_VBSCRIPT,
+	                       INTERNET_SCHEME_RES);
+
+const
+      INTERNET_SCHEME_FIRST = INTERNET_SCHEME_FTP;
+      INTERNET_SCHEME_LAST = INTERNET_SCHEME_RES;
+
+type
+     LPINTERNET_SCHEME = ^INTERNET_SCHEME;
+
+//
+// INTERNET_ASYNC_RESULT - this structure is returned to the application via
+// the callback with INTERNET_STATUS_REQUEST_COMPLETE. It is not sufficient to
+// just return the result of the async operation. If the API failed then the
+// app cannot call GetLastError() because the thread context will be incorrect.
+// Both the value returned by the async API and any resultant error code are
+// made available. The app need not check dwError if dwResult indicates that
+// the API succeeded (in this case dwError will be ERROR_SUCCESS)
+//
+
+type
+     INTERNET_ASYNC_RESULT = record
+	     //
+	     // dwResult - the HINTERNET, DWORD or BOOL return code from an async API
+	     //
+	      dwResult:DWORD_PTR;
+      //
+	     // dwError - the error code if the API failed
+	     //
+	      dwError:DWORD;
+     end;
+     LPINTERNET_ASYNC_RESULT = ^INTERNET_ASYNC_RESULT;
+
+
+//
+// INTERNET_PROXY_INFO - structure supplied with INTERNET_OPTION_PROXY to get/
+// set proxy information on a InternetOpen() handle
+//
+
+type
+     INTERNET_PROXY_INFO = record
+      //
+      // dwAccessType - INTERNET_OPEN_TYPE_DIRECT, INTERNET_OPEN_TYPE_PROXY, or
+      // INTERNET_OPEN_TYPE_PRECONFIG (set only)
+      //
+       dwAccessType:DWORD;
+
+      //
+      // lpszProxy - proxy server list
+      //
+       lpszProxy:LPCTSTR;
+
+      //
+      // lpszProxyBypass - proxy bypass list
+      //
+       lpszProxyBypass:LPCTSTR;
+     end;
+     LPINTERNET_PROXY_INFO = ^INTERNET_PROXY_INFO;
+
+//
+// INTERNET_PER_CONN_OPTION_LIST - set per-connection options such as proxy
+// and autoconfig info
+//
+// Set and queried using Internet[Set|Query]Option with
+// INTERNET_OPTION_PER_CONNECTION_OPTION
+//
+type
+     INTERNET_PER_CONN_OPTIONA = record
+	      dwOption:DWORD;			 // option to be queried or set
+       case DWORD of
+         0: (dwValue:DWORD);		 // dword value for the option
+         1: (pszValue:LPSTR);		 // pointer to string value for the option
+		       2: (ftValue:FILETIME);		 // file-time value for the option
+     end;
+     LPINTERNET_PER_CONN_OPTIONA = ^INTERNET_PER_CONN_OPTIONA;
+
+type
+     INTERNET_PER_CONN_OPTIONW = record
+	      dwOption:DWORD;			 // option to be queried or set
+       case DWORD of
+         0: (dwValue:DWORD);		 // dword value for the option
+         1: (pszValue:LPWSTR);		 // pointer to string value for the option
+		       2: (ftValue:FILETIME);		 // file-time value for the option
+     end;
+     LPINTERNET_PER_CONN_OPTIONW = ^INTERNET_PER_CONN_OPTIONW;
+
+{$IFDEF UNICODE}
+type
+     INTERNET_PER_CONN_OPTION = INTERNET_PER_CONN_OPTIONW;
+     LPINTERNET_PER_CONN_OPTION = LPINTERNET_PER_CONN_OPTIONW;
+{$ELSE UNICODE}
+type
+     INTERNET_PER_CONN_OPTION = INTERNET_PER_CONN_OPTIONA;
+     LPINTERNET_PER_CONN_OPTION = LPINTERNET_PER_CONN_OPTIONA;
+{$ENDIF UNICODE}
+
+type
+     INTERNET_PER_CONN_OPTION_LISTA = record
+       dwSize:DWORD;				// size of the INTERNET_PER_CONN_OPTION_LIST struct
+	      pszConnection:LPSTR;		// connection name to set/query options
+	      dwOptionCount:DWORD;		// number of options to set/query
+	      dwOptionError:DWORD;		// on error, which option failed
+	      pOptions:LPINTERNET_PER_CONN_OPTIONA; // array of options to set/query
+     end;
+     LPINTERNET_PER_CONN_OPTION_LISTA = ^INTERNET_PER_CONN_OPTION_LISTA;
+
+type
+     INTERNET_PER_CONN_OPTION_LISTW = record
+       dwSize:DWORD;				// size of the INTERNET_PER_CONN_OPTION_LIST struct
+	      pszConnection:LPWSTR;		// connection name to set/query options
+	      dwOptionCount:DWORD;		// number of options to set/query
+	      dwOptionError:DWORD;		// on error, which option failed
+	      pOptions:LPINTERNET_PER_CONN_OPTIONW; // array of options to set/query
+     end;
+     LPINTERNET_PER_CONN_OPTION_LISTW = ^INTERNET_PER_CONN_OPTION_LISTW;
+
+{$IFDEF UNICODE}
+type
+     INTERNET_PER_CONN_OPTION_LIST = INTERNET_PER_CONN_OPTION_LISTW;
+     LPINTERNET_PER_CONN_OPTION_LIST = LPINTERNET_PER_CONN_OPTION_LISTW;
+{$ELSE UNICODE}
+type
+     INTERNET_PER_CONN_OPTION_LIST = INTERNET_PER_CONN_OPTION_LISTA;
+     LPINTERNET_PER_CONN_OPTION_LIST = LPINTERNET_PER_CONN_OPTION_LISTA;
+{$ENDIF UNICODE}
+
+//
+// Options used in INTERNET_PER_CONN_OPTON struct
+//
+const
+      INTERNET_PER_CONN_FLAGS                         = 1;
+      INTERNET_PER_CONN_PROXY_SERVER                  = 2;
+      INTERNET_PER_CONN_PROXY_BYPASS                  = 3;
+      INTERNET_PER_CONN_AUTOCONFIG_URL                = 4;
+      INTERNET_PER_CONN_AUTODISCOVERY_FLAGS           = 5;
+      INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL      = 6;
+      INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS  = 7;
+      INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME   = 8;
+      INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL    = 9;
+
+//
+// PER_CONN_FLAGS
+//
+const
+      PROXY_TYPE_DIRECT                               = $00000001;   // direct to net
+      PROXY_TYPE_PROXY                                = $00000002;   // via named proxy
+      PROXY_TYPE_AUTO_PROXY_URL                       = $00000004;   // autoproxy URL
+      PROXY_TYPE_AUTO_DETECT                          = $00000008;   // use autoproxy detection
+
+//
+// PER_CONN_AUTODISCOVERY_FLAGS
+//
+      AUTO_PROXY_FLAG_USER_SET                        = $00000001;   // user changed this setting
+      AUTO_PROXY_FLAG_ALWAYS_DETECT                   = $00000002;   // force detection even when its not needed
+      AUTO_PROXY_FLAG_DETECTION_RUN                   = $00000004;   // detection has been run
+      AUTO_PROXY_FLAG_MIGRATED                        = $00000008;   // migration has just been done
+      AUTO_PROXY_FLAG_DONT_CACHE_PROXY_RESULT         = $00000010;   // don't cache result of host=proxy name
+      AUTO_PROXY_FLAG_CACHE_INIT_RUN                  = $00000020;   // don't initalize and run unless URL expired
+      AUTO_PROXY_FLAG_DETECTION_SUSPECT               = $00000040;   // if we're on a LAN & Modem, with only one IP, bad?!?
+
+//
+// INTERNET_VERSION_INFO - version information returned via
+// InternetQueryOption(..., INTERNET_OPTION_VERSION, ...)
+//
+type
+     INTERNET_VERSION_INFO = record
+	      dwMajorVersion:DWORD;
+	      dwMinorVersion:DWORD;
+     end;
+     LPINTERNET_VERSION_INFO = ^INTERNET_VERSION_INFO;
+
+//
+// HTTP_VERSION_INFO - query or set global HTTP version (1.0 or 1.1)
+//
+type
+     HTTP_VERSION_INFO = record
+	      dwMajorVersion:DWORD;
+	      dwMinorVersion:DWORD;
+     end;
+     LPHTTP_VERSION_INFO = ^HTTP_VERSION_INFO;
+
+//
+// INTERNET_CONNECTED_INFO - information used to set the global connected state
+//
+
+type
+     INTERNET_CONNECTED_INFO = record
+	     //
+	     // dwConnectedState - new connected/disconnected state.
+	     // See INTERNET_STATE_CONNECTED, etc.
+	     //
+	      dwConnectedState:DWORD;
+      //
+	     // dwFlags - flags controlling connected->disconnected (or disconnected->
+	     // connected) transition. See below
+	     //
+	      dwFlags:DWORD;
+     end;
+     LPINTERNET_CONNECTED_INFO = ^INTERNET_CONNECTED_INFO;
+
+
+//
+// flags for INTERNET_CONNECTED_INFO dwFlags
+//
+
+//
+// ISO_FORCE_DISCONNECTED - if set when putting Wininet into disconnected mode,
+// all outstanding requests will be aborted with a cancelled error
+//
+const
+      ISO_FORCE_DISCONNECTED  = $00000001;
+
+
+//
+// URL_COMPONENTS - the constituent parts of an URL. Used in InternetCrackUrl()
+// and InternetCreateUrl()
+//
+// For InternetCrackUrl(), if a pointer field and its corresponding length field
+// are both 0 then that component is not returned. If the pointer field is NULL
+// but the length field is not zero, then both the pointer and length fields are
+// returned if both pointer and corresponding length fields are non-zero then
+// the pointer field points to a buffer where the component is copied. The
+// component may be un-escaped, depending on dwFlags
+//
+// For InternetCreateUrl(), the pointer fields should be NULL if the component
+// is not required. If the corresponding length field is zero then the pointer
+// field is the address of a zero-terminated string. If the length field is not
+// zero then it is the string length of the corresponding pointer field
+//
+
+// #pragma warning( disable : 4121 )   // disable alignment warning
+
+type
+     URL_COMPONENTSA = record
+       dwStructSize:DWORD;		// size of this structure. Used in version check
+       lpszScheme:LPSTR;			// pointer to scheme name
+       dwSchemeLength:DWORD;		// length of scheme name
+       nScheme:INTERNET_SCHEME;	// enumerated scheme type (if known)
+       lpszHostName:LPSTR;		// pointer to host name
+       dwHostNameLength:DWORD;	// length of host name
+       nPort:INTERNET_PORT;		// converted port number
+       lpszUserName:LPSTR;		// pointer to user name
+       dwUserNameLength:DWORD;	// length of user name
+       lpszPassword:LPSTR;		// pointer to password
+       dwPasswordLength:DWORD;	// length of password
+       lpszUrlPath:LPSTR;		// pointer to URL-path
+       dwUrlPathLength:DWORD;	// length of URL-path
+       lpszExtraInfo:LPSTR;		// pointer to extra information (e.g. ?foo or #foo)
+       dwExtraInfoLength:DWORD;	// length of extra information
+     end;
+     LPURL_COMPONENTSA = ^URL_COMPONENTSA;
+
+type
+     URL_COMPONENTSW = record
+       dwStructSize:DWORD;		// size of this structure. Used in version check
+       lpszScheme:LPWSTR;			// pointer to scheme name
+       dwSchemeLength:DWORD;		// length of scheme name
+       nScheme:INTERNET_SCHEME;	// enumerated scheme type (if known)
+       lpszHostName:LPWSTR;		// pointer to host name
+       dwHostNameLength:DWORD;	// length of host name
+       nPort:INTERNET_PORT;		// converted port number
+       lpszUserName:LPWSTR;		// pointer to user name
+       dwUserNameLength:DWORD;	// length of user name
+       lpszPassword:LPWSTR;		// pointer to password
+       dwPasswordLength:DWORD;	// length of password
+       lpszUrlPath:LPWSTR;		// pointer to URL-path
+       dwUrlPathLength:DWORD;	// length of URL-path
+       lpszExtraInfo:LPWSTR;		// pointer to extra information (e.g. ?foo or #foo)
+       dwExtraInfoLength:DWORD;	// length of extra information
+     end;
+     LPURL_COMPONENTSW = ^URL_COMPONENTSW;
+
+{$IFDEF UNICODE}
+type
+     URL_COMPONENTS = URL_COMPONENTSW;
+     LPURL_COMPONENTS = LPURL_COMPONENTSW;
+{$ELSE UNICODE}
+type
+     URL_COMPONENTS = URL_COMPONENTSA;
+     LPURL_COMPONENTS = LPURL_COMPONENTSA;
+{$ENDIF UNICODE}
+
+// #pragma warning( default : 4121 )   // restore alignment warning
+
+//
+// INTERNET_CERTIFICATE_INFO lpBuffer - contains the certificate returned from
+// the server
+//
+
+type
+     INTERNET_CERTIFICATE_INFO = record
+      //
+      // ftExpiry - date the certificate expires.
+      //
+       ftExpiry:FILETIME;
+
+      //
+      // ftStart - date the certificate becomes valid.
+      //
+      ftStart:FILETIME;
+
+      //
+      // lpszSubjectInfo - the name of organization, site, and server
+      //   the cert. was issued for.
+      //
+       lpszSubjectInfo:LPTSTR;
+
+      //
+      // lpszIssuerInfo - the name of orgainzation, site, and server
+      //   the cert was issues by.
+      //
+       lpszIssuerInfo:LPTSTR;
+
+      //
+      // lpszProtocolName - the name of the protocol used to provide the secure
+      //   connection.
+      //
+       lpszProtocolName:LPTSTR;
+
+      //
+      // lpszSignatureAlgName - the name of the algorithm used for signing
+      //  the certificate.
+      //
+       lpszSignatureAlgName:LPTSTR;
+
+      //
+      // lpszEncryptionAlgName - the name of the algorithm used for
+      //  doing encryption over the secure channel (SSL/PCT) connection.
+      //
+       lpszEncryptionAlgName:LPTSTR;
+
+      //
+      // dwKeySize - size of the key.
+      //
+       dwKeySize:DWORD;
+     end;
+     LPINTERNET_CERTIFICATE_INFO = ^INTERNET_CERTIFICATE_INFO;
+
+
+//
+// INTERNET_BUFFERS - combines headers and data. May be chained for e.g. file
+// upload or scatter/gather operations. For chunked read/write, lpcszHeader
+// contains the chunked-ext
+//
+type
+     LPINTERNET_BUFFERSA = ^_INTERNET_BUFFERSA;
+     _INTERNET_BUFFERSA = record
+       dwStructSize:DWORD;					// used for API versioning. Set to sizeof(INTERNET_BUFFERS)
+       Next:LPINTERNET_BUFFERSA;	// chain of buffers
+       lpcszHeader:LPCSTR;				// pointer to headers (may be NULL)
+       dwHeadersLength:DWORD;				// length of headers if not NULL
+       dwHeadersTotal:DWORD;				// size of headers if not enough buffer
+       lpvBuffer:LPVOID;					// pointer to data buffer (may be NULL)
+       dwBufferLength:DWORD;				// length of data buffer if not NULL
+       dwBufferTotal:DWORD;				// total size of chunk, or content-length if not chunked
+       dwOffsetLow:DWORD;					// used for read-ranges (only used in HttpSendRequest2)
+       dwOffsetHigh:DWORD;
+     end;
+     INTERNET_BUFFERSA = _INTERNET_BUFFERSA;
+
+type
+     LPINTERNET_BUFFERSW = ^_INTERNET_BUFFERSW;
+     _INTERNET_BUFFERSW = record
+       dwStructSize:DWORD;					// used for API versioning. Set to sizeof(INTERNET_BUFFERS)
+       Next:LPINTERNET_BUFFERSW;	// chain of buffers
+       lpcszHeader:LPCSTR;				// pointer to headers (may be NULL)
+       dwHeadersLength:DWORD;				// length of headers if not NULL
+       dwHeadersTotal:DWORD;				// size of headers if not enough buffer
+       lpvBuffer:LPVOID;					// pointer to data buffer (may be NULL)
+       dwBufferLength:DWORD;				// length of data buffer if not NULL
+       dwBufferTotal:DWORD;				// total size of chunk, or content-length if not chunked
+       dwOffsetLow:DWORD;					// used for read-ranges (only used in HttpSendRequest2)
+       dwOffsetHigh:DWORD;
+     end;
+     INTERNET_BUFFERSW = _INTERNET_BUFFERSW;
+
+{$IFDEF UNICODE}
+type
+     INTERNET_BUFFERS = INTERNET_BUFFERSW;
+     LPINTERNET_BUFFERS = LPINTERNET_BUFFERSW;
+{$ELSE UNICODE}
+type
+     INTERNET_BUFFERS = INTERNET_BUFFERSA;
+     LPINTERNET_BUFFERS = LPINTERNET_BUFFERSA;
+{$ENDIF UNICODE}
+
+//
+// prototypes
+//
+const
+      WinInetDLL = 'wininet.dll';
+
+function InternetTimeFromSystemTimeA(pst:LPSYSTEMTIME;  // input GMT time
+								                             dwRFC:DWORD;			   // RFC format
+								                             lpszTime:LPSTR;		   // output string buffer
+								                             cbTime:DWORD			   // output buffer size
+								                            ):BOOL; external WinInetDLL name 'InternetTimeFromSystemTimeA';
+
+function InternetTimeFromSystemTimeW(pst:LPSYSTEMTIME;  // input GMT time
+								                             dwRFC:DWORD;			   // RFC format
+								                             lpszTime:LPWSTR;		   // output string buffer
+								                             cbTime:DWORD			   // output buffer size
+								                            ):BOOL; external WinInetDLL name 'InternetTimeFromSystemTimeW';
+
+{$IFDEF UNICODE}
+function InternetTimeFromSystemTime(pst:LPSYSTEMTIME;  // input GMT time
+								                            dwRFC:DWORD;			   // RFC format
+								                            lpszTime:LPWSTR;		   // output string buffer
+								                            cbTime:DWORD			   // output buffer size
+								                           ):BOOL; external WinInetDLL name 'InternetTimeFromSystemTimeW';
+{$ELSE UNICODE}
+{$IFDEF WIN32}
+function InternetTimeFromSystemTime(pst:LPSYSTEMTIME;  // input GMT time
+								                            dwRFC:DWORD;			   // RFC format
+                                    lpszTime:LPSTR;		   // output string buffer
+                                    cbTime:DWORD			   // output buffer size
+                                   ):BOOL; external WinInetDLL name 'InternetTimeFromSystemTimeA';
+{$ELSE WIN32}
+function InternetTimeFromSystemTime(pst:LPSYSTEMTIME;  // input GMT time
+								                            dwRFC:DWORD;			   // RFC format
+                                    lpszTime:LPSTR;		   // output string buffer
+                                    cbTime:DWORD			   // output buffer size
+                                   ):BOOL; external WinInetDLL name 'InternetTimeFromSystemTime';
+{$ENDIF WIN32}
+{$ENDIF UNICODE}
+
+
+//
+// constants for InternetTimeFromSystemTime
+//
+const
+      INTERNET_RFC1123_FORMAT     = 0;
+      INTERNET_RFC1123_BUFSIZE    = 30;
+
+function InternetTimeToSystemTimeA(lpszTime:LPCSTR;		  // NULL terminated string
+                                   pst:LPSYSTEMTIME;		  // output in GMT time
+								                           dwReserved:DWORD
+                                  ):BOOL; external WinInetDLL name 'InternetTimeToSystemTimeA';
+
+function InternetTimeToSystemTimeW(lpszTime:LPCWSTR;		  // NULL terminated string
+                                   pst:LPSYSTEMTIME;		  // output in GMT time
+								                           dwReserved:DWORD
+                                  ):BOOL; external WinInetDLL name 'InternetTimeToSystemTimeW';
+
+{$IFDEF UNICODE}
+function InternetTimeToSystemTime(lpszTime:LPCWSTR;		  // NULL terminated string
+                                  pst:LPSYSTEMTIME;		  // output in GMT time
+								                          dwReserved:DWORD
+                                 ):BOOL; external WinInetDLL name 'InternetTimeToSystemTimeW';
+{$ELSE UNICODE}
+{$IFDEF WIN32}
+function InternetTimeToSystemTime(lpszTime:LPCSTR;		  // NULL terminated string
+                                  pst:LPSYSTEMTIME;		  // output in GMT time
+								                          dwReserved:DWORD
+                                 ):BOOL; external WinInetDLL name 'InternetTimeToSystemTimeA';
+{$ELSE WIN32}
+function InternetTimeToSystemTime(lpszTime:LPCSTR;		  // NULL terminated string
+                                  pst:LPSYSTEMTIME;		  // output in GMT time
+								                  dwReserved:DWORD
+                                 ):BOOL; external WinInetDLL name 'InternetTimeToSystemTime';
+{$ENDIF WIN32}
+{$ENDIF UNICODE}
+
+function InternetCrackUrlA(lpszUrl:LPCSTR;
+                           dwUrlLength:DWORD;
+						                     dwFlags:DWORD;
+						                     lpUrlComponents:LPURL_COMPONENTSA
+						                    ):BOOL; external WinInetDLL name 'InternetCrackUrlA';
+
+function InternetCrackUrlW(lpszUrl:LPCWSTR;
+                           dwUrlLength:DWORD;
+						                     dwFlags:DWORD;
+						                     lpUrlComponents:LPURL_COMPONENTSW
+						                    ):BOOL; external WinInetDLL name 'InternetCrackUrlW';
+
+{$IFDEF UNICODE}
+function InternetCrackUrl(lpszUrl:LPCWSTR;
+                          dwUrlLength:DWORD;
+						                    dwFlags:DWORD;
+						                    lpUrlComponents:LPURL_COMPONENTSW
+						                   ):BOOL; external WinInetDLL name 'InternetCrackUrlW';
+{$ELSE UNICODE}
+function InternetCrackUrl(lpszUrl:LPCSTR;
+                          dwUrlLength:DWORD;
+						                    dwFlags:DWORD;
+						                    lpUrlComponents:LPURL_COMPONENTSA
+						                   ):BOOL; external WinInetDLL name 'InternetCrackUrlA';
+{$ENDIF UNICODE}
+
+function InternetCreateUrlA(lpUrlComponents:LPURL_COMPONENTSA;
+						                      dwFlags:DWORD;
+						                      lpszUrl:LPSTR;
+						                      lpdwUrlLength:LPDWORD
+						                     ):BOOL; external WinInetDLL name 'InternetCreateUrlA';
+
+function InternetCreateUrlW(lpUrlComponents:LPURL_COMPONENTSW;
+						                      dwFlags:DWORD;
+						                      lpszUrl:LPWSTR;
+						                      lpdwUrlLength:LPDWORD
+						                     ):BOOL; external WinInetDLL name 'InternetCreateUrlW';
+
+{$IFDEF UNICODE}
+function InternetCreateUrl(lpUrlComponents:LPURL_COMPONENTSW;
+						                     dwFlags:DWORD;
+						                     lpszUrl:LPWSTR;
+						                     lpdwUrlLength:LPDWORD
+						                    ):BOOL; external WinInetDLL name 'InternetCreateUrlW';
+{$ELSE UNICODE}
+function InternetCreateUrl(lpUrlComponents:LPURL_COMPONENTSA;
+						                     dwFlags:DWORD;
+						                     lpszUrl:LPSTR;
+						                     lpdwUrlLength:LPDWORD
+						                    ):BOOL; external WinInetDLL name 'InternetCreateUrlA';
+{$ENDIF UNICODE}
+
+
+function InternetCanonicalizeUrlA(lpszUrl:LPCSTR;
+								                          lpszBuffer:LPSTR;
+								                          lpdwBufferLength:LPDWORD;
+								                          dwFlags:DWORD
+								                         ):BOOL; external WinInetDLL name 'InternetCanonicalizeUrlA';
+
+function InternetCanonicalizeUrlW(lpszUrl:LPCWSTR;
+								                          lpszBuffer:LPWSTR;
+								                          lpdwBufferLength:LPDWORD;
+								                          dwFlags:DWORD
+								                         ):BOOL; external WinInetDLL name 'InternetCanonicalizeUrlW';
+
+{$IFDEF UNICODE}
+function InternetCanonicalizeUrl(lpszUrl:LPCWSTR;
+								                         lpszBuffer:LPWSTR;
+								                         lpdwBufferLength:LPDWORD;
+								                         dwFlags:DWORD
+								                        ):BOOL; external WinInetDLL name 'InternetCanonicalizeUrlW';
+{$ELSE UNICODE}
+function InternetCanonicalizeUrl(lpszUrl:LPCSTR;
+								                         lpszBuffer:LPSTR;
+								                         lpdwBufferLength:LPDWORD;
+								                         dwFlags:DWORD
+								                        ):BOOL; external WinInetDLL name 'InternetCanonicalizeUrlA';
+{$ENDIF UNICODE}
+
+function InternetCombineUrlA(lpszBaseUrl:LPCSTR;
+						                       lpszRelativeUrl:LPCSTR;
+						                       lpszBuffer:LPSTR;
+						                       lpdwBufferLength:LPDWORD;
+						                       dwFlags:DWORD
+                            ):BOOL; external WinInetDLL name 'InternetCombineUrlA';
+
+function InternetCombineUrlW(lpszBaseUrl:LPCWSTR;
+						                       lpszRelativeUrl:LPCWSTR;
+						                       lpszBuffer:LPWSTR;
+						                       lpdwBufferLength:LPDWORD;
+						                       dwFlags:DWORD
+                            ):BOOL; external WinInetDLL name 'InternetCombineUrlW';
+
+{$IFDEF UNICODE}
+function InternetCombineUrl(lpszBaseUrl:LPCWSTR;
+						                      lpszRelativeUrl:LPCWSTR;
+						                      lpszBuffer:LPWSTR;
+						                      lpdwBufferLength:LPDWORD;
+						                      dwFlags:DWORD
+                           ):BOOL; external WinInetDLL name 'InternetCombineUrlW';
+{$ELSE UNICODE}
+function InternetCombineUrl(lpszBaseUrl:LPCSTR;
+						                      lpszRelativeUrl:LPCSTR;
+						                      lpszBuffer:LPSTR;
+						                      lpdwBufferLength:LPDWORD;
+						                      dwFlags:DWORD
+                           ):BOOL; external WinInetDLL name 'InternetCombineUrlA';
+{$ENDIF UNICODE}
+
+//
+// flags for InternetCrackUrl() and InternetCreateUrl()
+//
+const
+      ICU_ESCAPE              = $80000000;  // (un)escape URL characters
+      ICU_USERNAME            = $40000000;  // use internal username & password
+      ICU_ESCAPE_AUTHORITY    = $00002000;  // causes InternetCreateUrlA to escape chars in authority components (user, pwd, host)
+
+
+//
+// flags for InternetCanonicalizeUrl() and InternetCombineUrl()
+//
+const
+      ICU_NO_ENCODE          = $20000000;  // Don't convert unsafe characters to escape sequence
+      ICU_DECODE             = $10000000;  // Convert %XX escape sequences to characters
+      ICU_NO_META            = $08000000;  // Don't convert .. etc. meta path sequences
+      ICU_ENCODE_SPACES_ONLY = $04000000;  // Encode spaces only
+      ICU_BROWSER_MODE       = $02000000; // Special encode/decode rules for browser
+      ICU_ENCODE_PERCENT     = $00001000; // Encode any percent (ASCII25)
+                                          // signs encountered, default is to not encode percent.
+
+function InternetOpenA(lpszAgent:LPCSTR;
+									              dwAccessType:DWORD;
+									              lpszProxy:LPCSTR;
+									              lpszProxyBypass:LPCSTR;
+									              dwFlags:DWORD
+									             ):HINTERNET; external WinInetDLL name 'InternetOpenA';
+
+function InternetOpenW(lpszAgent:LPCWSTR;
+									              dwAccessType:DWORD;
+									              lpszProxy:LPCWSTR;
+									              lpszProxyBypass:LPCWSTR;
+									              dwFlags:DWORD
+									             ):HINTERNET; external WinInetDLL name 'InternetOpenW';
+
+{$IFDEF UNICODE}
+function InternetOpen(lpszAgent:LPCWSTR;
+									             dwAccessType:DWORD;
+									             lpszProxy:LPCWSTR;
+									             lpszProxyBypass:LPCWSTR;
+									             dwFlags:DWORD
+									            ):HINTERNET; external WinInetDLL name 'InternetOpenW';
+{$ELSE UNICODE}
+function InternetOpen(lpszAgent:LPCSTR;
+									             dwAccessType:DWORD;
+									             lpszProxy:LPCSTR;
+									             lpszProxyBypass:LPCSTR;
+									             dwFlags:DWORD
+									            ):HINTERNET; external WinInetDLL name 'InternetOpenA';
+{$ENDIF UNICODE}
+
+//
+// access types for InternetOpen()
+//
+const
+      INTERNET_OPEN_TYPE_PRECONFIG                    = 0;   // use registry configuration
+      INTERNET_OPEN_TYPE_DIRECT                       = 1;   // direct to net
+      INTERNET_OPEN_TYPE_PROXY                        = 3;   // via named proxy
+      INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  = 4;   // prevent using java/script/INS
+
+//
+// old names for access types
+//
+const
+      PRE_CONFIG_INTERNET_ACCESS  = INTERNET_OPEN_TYPE_PRECONFIG;
+      LOCAL_INTERNET_ACCESS       = INTERNET_OPEN_TYPE_DIRECT;
+      CERN_PROXY_INTERNET_ACCESS  = INTERNET_OPEN_TYPE_PROXY;
+
+function InternetCloseHandle(_hInternet:HINTERNET):BOOL; external WinInetDLL name 'InternetCloseHandle';
+
+function InternetConnectA(_hInternet:HINTERNET;
+										                lpszServerName:LPCSTR;
+										                nServerPort:INTERNET_PORT;
+										                lpszUserName:LPCSTR;
+										                lpszPassword:LPCSTR;
+										                dwService:DWORD;
+										                dwFlags:DWORD;
+										                dwContext:DWORD_PTR
+										               ):HINTERNET; external WinInetDLL name 'InternetConnectA';
+
+function InternetConnectW(_hInternet:HINTERNET;
+										                lpszServerName:LPCWSTR;
+										                nServerPort:INTERNET_PORT;
+										                lpszUserName:LPCWSTR;
+										                lpszPassword:LPCWSTR;
+										                dwService:DWORD;
+										                dwFlags:DWORD;
+										                dwContext:DWORD_PTR
+										               ):HINTERNET; external WinInetDLL name 'InternetConnectW';
+
+{$IFDEF UNICODE}
+function InternetConnect(_hInternet:HINTERNET;
+										               lpszServerName:LPCWSTR;
+										               nServerPort:INTERNET_PORT;
+										               lpszUserName:LPCWSTR;
+										               lpszPassword:LPCWSTR;
+										               dwService:DWORD;
+										               dwFlags:DWORD;
+										               dwContext:DWORD_PTR
+										               ):HINTERNET; external WinInetDLL name 'InternetConnectW';
+{$ELSE UNICODE}
+function InternetConnect(_hInternet:HINTERNET;
+										               lpszServerName:LPCSTR;
+										               nServerPort:INTERNET_PORT;
+										               lpszUserName:LPCSTR;
+										               lpszPassword:LPCSTR;
+										               dwService:DWORD;
+										               dwFlags:DWORD;
+										               dwContext:DWORD_PTR
+										               ):HINTERNET; external WinInetDLL name 'InternetConnectA';
+{$ENDIF UNICODE}
+
+//
+// service types for InternetConnect()
+//
+const
+      INTERNET_SERVICE_FTP    = 1;
+      INTERNET_SERVICE_GOPHER = 2;
+      INTERNET_SERVICE_HTTP   = 3;
+
+
+function InternetOpenUrlA(_hInternet:HINTERNET;
+										                lpszUrl:LPCSTR;
+										                lpszHeaders:LPCSTR;
+										                dwHeadersLength:DWORD;
+										                dwFlags:DWORD;
+                          dwContext:DWORD_PTR
+										               ):HINTERNET; external WinInetDLL name 'InternetOpenUrlA';
+
+function InternetOpenUrlW(_hInternet:HINTERNET;
+										                lpszUrl:LPCWSTR;
+										                lpszHeaders:LPCWSTR;
+										                dwHeadersLength:DWORD;
+										                dwFlags:DWORD;
+                          dwContext:DWORD_PTR
+										               ):HINTERNET; external WinInetDLL name 'InternetOpenUrlW';
+
+{$IFDEF UNICODE}
+function InternetOpenUrl(_hInternet:HINTERNET;
+										               lpszUrl:LPCWSTR;
+										               lpszHeaders:LPCWSTR;
+										               dwHeadersLength:DWORD;
+										               dwFlags:DWORD;
+                         dwContext:DWORD_PTR
+										              ):HINTERNET; external WinInetDLL name 'InternetOpenUrlW';
+{$ELSE UNICODE}
+function InternetOpenUrl(_hInternet:HINTERNET;
+										               lpszUrl:LPCSTR;
+										               lpszHeaders:LPCSTR;
+										               dwHeadersLength:DWORD;
+										               dwFlags:DWORD;
+                         dwContext:DWORD_PTR
+										              ):HINTERNET; external WinInetDLL name 'InternetOpenUrlA';
+{$ENDIF UNICODE}
+
+function InternetReadFile(_hFile:HINTERNET;
+						                    lpBuffer:LPVOID;
+						                    dwNumberOfBytesToRead:DWORD;
+						                    lpdwNumberOfBytesRead:LPDWORD
+						                   ):BOOL; external WinInetDLL name 'InternetREadFile';
+
+function InternetReadFileExA(_hFile:HINTERNET;
+									                    lpBuffersOut:LPINTERNET_BUFFERSA;
+									                    dwFlags:DWORD;
+									                    dwContext:DWORD_PTR
+									                   ):BOOL; external WinInetDLL name 'InternetReadFileExA';
+
+function InternetReadFileExW(_hFile:HINTERNET;
+									                    lpBuffersOut:LPINTERNET_BUFFERSW;
+									                    dwFlags:DWORD;
+									                    dwContext:DWORD_PTR
+									                   ):BOOL; external WinInetDLL name 'InternetReadFileExW';
+
+{$IFDEF UNICODE}
+function InternetReadFileEx(_hFile:HINTERNET;
+									                   lpBuffersOut:LPINTERNET_BUFFERSW;
+									                   dwFlags:DWORD;
+									                   dwContext:DWORD_PTR
+									                  ):BOOL; external WinInetDLL name 'InternetReadFileExW';
+{$ELSE UNICODE}
+function InternetReadFileEx(_hFile:HINTERNET;
+									                   lpBuffersOut:LPINTERNET_BUFFERSA;
+								                    dwFlags:DWORD;
+								                    dwContext:DWORD_PTR
+								                   ):BOOL; external WinInetDLL name 'InternetReadFileExA';
+{$ENDIF UNICODE}
+
+
+//
+// flags for InternetReadFileEx()
+//
+const
+      IRF_ASYNC       = WININET_API_FLAG_ASYNC;
+      IRF_SYNC        = WININET_API_FLAG_SYNC;
+      IRF_USE_CONTEXT = WININET_API_FLAG_USE_CONTEXT;
+      IRF_NO_WAIT     = $00000008;
+
+function InternetSetFilePointer(_hFile:HINTERNET;
+										                      lDistanceToMove:LONG;
+										                      pReserved:PVOID;
+										                      dwMoveMethod:DWORD;
+										                      dwContext:DWORD_PTR
+										                     ):DWORD; external WinInetDLL name 'InternetSetFilePointer';
+
+function InternetWriteFile(_hFile:HINTERNET;
+						                     lpBuffer:LPCVOID;
+						                     dwNumberOfBytesToWrite:DWORD;
+						                     lpdwNumberOfBytesWritten:LPDWORD
+						                    ):BOOL; external WinInetDLL name 'InternetWriteFile';
+
+
+function InternetQueryDataAvailable(_hFile:HINTERNET;
+								                            lpdwNumberOfBytesAvailable:LPDWORD;
+								                            dwFlags:DWORD;
+								                            dwContext:DWORD_PTR
+								                           ):BOOL; external WinInetDLL name 'InternetQueryDataAvailable';
+
+function InternetFindNextFileA(hFind:HINTERNET;
+							                        lpvFindData:LPVOID
+							                       ):BOOL; external WinInetDLL name 'InternetFindNextFileA';
+
+function InternetFindNextFileW(hFind:HINTERNET;
+							                        lpvFindData:LPVOID
+							                       ):BOOL; external WinInetDLL name 'InternetFindNextFileW';
+
+{$IFDEF UNICODE}
+function InternetFindNextFile(hFind:HINTERNET;
+							                       lpvFindData:LPVOID
+							                      ):BOOL; external WinInetDLL name 'InternetFindNextFileW';
+{$ELSE UNICODE}
+function InternetFindNextFile(hFind:HINTERNET;
+						                        lpvFindData:LPVOID
+						                       ):BOOL; external WinInetDLL name 'InternetFindNextFileA';
+{$ENDIF UNICODE}
+
+function InternetQueryOptionA(_hInternet:HINTERNET;
+							                       dwOption:DWORD;
+							                       lpBuffer:LPVOID;
+							                       lpdwBufferLength:LPDWORD
+							                      ):BOOL; external WinInetDLL name 'InternetQueryOptionA';
+
+function InternetQueryOptionW(_hInternet:HINTERNET;
+							                       dwOption:DWORD;
+							                       lpBuffer:LPVOID;
+							                       lpdwBufferLength:LPDWORD
+							                      ):BOOL; external WinInetDLL name 'InternetQueryOptionW';
+
+{$IFDEF UNICODE}
+function InternetQueryOption(_hInternet:HINTERNET;
+							                      dwOption:DWORD;
+							                      lpBuffer:LPVOID;
+							                      lpdwBufferLength:LPDWORD
+							                     ):BOOL; external WinInetDLL name 'InternetQueryOptionW';
+{$ELSE UNICODE}
+function InternetQueryOption(_hInternet:HINTERNET;
+							                      dwOption:DWORD;
+							                      lpBuffer:LPVOID;
+							                      lpdwBufferLength:LPDWORD
+							                     ):BOOL; external WinInetDLL name 'InternetQueryOptionA';
+{$ENDIF UNICODE}
+
+function InternetSetOptionA(_hInternet:HINTERNET;
+						                      dwOption:DWORD;
+						                      lpBuffer:LPVOID;
+						                      dwBufferLength:DWORD
+						                     ):BOOL; external WinInetDLL name 'InternetSetOptionA';
+
+function InternetSetOptionW(_hInternet:HINTERNET;
+						                      dwOption:DWORD;
+						                      lpBuffer:LPVOID;
+						                      dwBufferLength:DWORD
+						                     ):BOOL; external WinInetDLL name 'InternetSetOptionW';
+
+{$IFDEF UNICODE}
+function InternetSetOption(_hInternet:HINTERNET;
+						                     dwOption:DWORD;
+						                     lpBuffer:LPVOID;
+						                     dwBufferLength:DWORD
+						                    ):BOOL; external WinInetDLL name 'InternetSetOptionW';
+{$ELSE UNICODE}
+function InternetSetOption(_hInternet:HINTERNET;
+						                     dwOption:DWORD;
+						                     lpBuffer:LPVOID;
+						                     dwBufferLength:DWORD
+						                    ):BOOL; external WinInetDLL name 'InternetSetOptionA';
+{$ENDIF UNICODE}
+
+function InternetSetOptionExA(_hInternet:HINTERNET;
+                              dwOption:DWORD;
+							                       lpBuffer:LPVOID;
+							                       dwBufferLength:DWORD;
+							                       dwFlags:DWORD
+							                      ):BOOL; external WinInetDLL name 'InternetSetOptionExA';
+
+function InternetSetOptionExW(_hInternet:HINTERNET;
+                              dwOption:DWORD;
+							                       lpBuffer:LPVOID;
+							                       dwBufferLength:DWORD;
+							                       dwFlags:DWORD
+							                      ):BOOL; external WinInetDLL name 'InternetSetOptionExW';
+
+{$IFDEF UNICODE}
+function InternetSetOptionEx(_hInternet:HINTERNET;
+                             dwOption:DWORD;
+                             lpBuffer:LPVOID;
+                             dwBufferLength:DWORD;
+                            dwFlags:DWORD
+                            ):BOOL; external WinInetDLL name 'InternetSetOptionExW';
+{$ELSE UNICODE}
+function InternetSetOptionEx(_hInternet:HINTERNET;
+                             dwOption:DWORD;
+                             lpBuffer:LPVOID;
+                             dwBufferLength:DWORD;
+                             dwFlags:DWORD
+                            ):BOOL; external WinInetDLL name 'InternetSetOptionExA';
+{$ENDIF UNICODE}
+
+
+function InternetLockRequestFile(_hInternet:HINTERNET;
+							                   lphLockRequestInfo:LPHANDLE
+							                  ):BOOL; external WinInetDLL name 'InternetLockRequestFile';
+
+function InternetUnlockRequestFile(hLockRequestInfo:HANDLE):BOOL; external WinInetDLL name 'InternetUnlockRequestFile';
+
+//
+// flags for InternetSetOptionEx()
+//
+const
+      ISO_GLOBAL      = $00000001;  // modify option globally
+      ISO_REGISTRY    = $00000002;  // write option to registry (where applicable)
+
+      ISO_VALID_FLAGS = ISO_GLOBAL or ISO_REGISTRY;
+
+//
+// options manifests for Internet{Query|Set}Option
+//
+const
+      INTERNET_OPTION_CALLBACK                = 1;
+      INTERNET_OPTION_CONNECT_TIMEOUT         = 2;
+      INTERNET_OPTION_CONNECT_RETRIES         = 3;
+      INTERNET_OPTION_CONNECT_BACKOFF         = 4;
+      INTERNET_OPTION_SEND_TIMEOUT            = 5;
+      INTERNET_OPTION_CONTROL_SEND_TIMEOUT    = INTERNET_OPTION_SEND_TIMEOUT;
+      INTERNET_OPTION_RECEIVE_TIMEOUT         = 6;
+      INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT = INTERNET_OPTION_RECEIVE_TIMEOUT;
+      INTERNET_OPTION_DATA_SEND_TIMEOUT       = 7;
+      INTERNET_OPTION_DATA_RECEIVE_TIMEOUT    = 8;
+      INTERNET_OPTION_HANDLE_TYPE             = 9;
+      INTERNET_OPTION_LISTEN_TIMEOUT          = 11;
+      INTERNET_OPTION_READ_BUFFER_SIZE        = 12;
+      INTERNET_OPTION_WRITE_BUFFER_SIZE       = 13;
+
+      INTERNET_OPTION_ASYNC_ID                = 15;
+      INTERNET_OPTION_ASYNC_PRIORITY          = 16;
+
+      INTERNET_OPTION_PARENT_HANDLE           = 21;
+      INTERNET_OPTION_KEEP_CONNECTION         = 22;
+      INTERNET_OPTION_REQUEST_FLAGS           = 23;
+      INTERNET_OPTION_EXTENDED_ERROR          = 24;
+
+      INTERNET_OPTION_FLUSH_CACHE             = 25;
+      INTERNET_OPTION_OFFLINE_MODE            = 26;
+      INTERNET_OPTION_CACHE_STREAM_HANDLE     = 27;
+      INTERNET_OPTION_USERNAME                = 28;
+      INTERNET_OPTION_PASSWORD                = 29;
+      INTERNET_OPTION_ASYNC                   = 30;
+      INTERNET_OPTION_SECURITY_FLAGS          = 31;
+      INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT = 32;
+      INTERNET_OPTION_DATAFILE_NAME           = 33;
+      INTERNET_OPTION_URL                     = 34;
+      INTERNET_OPTION_SECURITY_CERTIFICATE    = 35;
+      INTERNET_OPTION_SECURITY_KEY_BITNESS    = 36;
+      INTERNET_OPTION_REFRESH                 = 37;
+      INTERNET_OPTION_PROXY                   = 38;
+      INTERNET_OPTION_SETTINGS_CHANGED        = 39;
+      INTERNET_OPTION_VERSION                 = 40;
+      INTERNET_OPTION_USER_AGENT              = 41;
+      INTERNET_OPTION_END_BROWSER_SESSION     = 42;
+      INTERNET_OPTION_PROXY_USERNAME          = 43;
+      INTERNET_OPTION_PROXY_PASSWORD          = 44;
+      INTERNET_OPTION_CONTEXT_VALUE           = 45;
+      INTERNET_OPTION_CONNECT_LIMIT           = 46;
+      INTERNET_OPTION_SECURITY_SELECT_CLIENT_CERT = 47;
+      INTERNET_OPTION_POLICY                  = 48;
+      INTERNET_OPTION_DISCONNECTED_TIMEOUT    = 49;
+      INTERNET_OPTION_CONNECTED_STATE         = 50;
+      INTERNET_OPTION_IDLE_STATE              = 51;
+      INTERNET_OPTION_OFFLINE_SEMANTICS       = 52;
+      INTERNET_OPTION_SECONDARY_CACHE_KEY     = 53;
+      INTERNET_OPTION_CALLBACK_FILTER         = 54;
+      INTERNET_OPTION_CONNECT_TIME            = 55;
+      INTERNET_OPTION_SEND_THROUGHPUT         = 56;
+      INTERNET_OPTION_RECEIVE_THROUGHPUT      = 57;
+      INTERNET_OPTION_REQUEST_PRIORITY        = 58;
+      INTERNET_OPTION_HTTP_VERSION            = 59;
+      INTERNET_OPTION_RESET_URLCACHE_SESSION  = 60;
+      INTERNET_OPTION_ERROR_MASK              = 62;
+      INTERNET_OPTION_FROM_CACHE_TIMEOUT      = 63;
+      INTERNET_OPTION_BYPASS_EDITED_ENTRY     = 64;
+      INTERNET_OPTION_CODEPAGE                = 68;
+      INTERNET_OPTION_CACHE_TIMESTAMPS        = 69;
+      INTERNET_OPTION_DISABLE_AUTODIAL        = 70;
+      INTERNET_OPTION_MAX_CONNS_PER_SERVER    = 73;
+      INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER = 74;
+      INTERNET_OPTION_PER_CONNECTION_OPTION    = 75;
+      INTERNET_OPTION_DIGEST_AUTH_UNLOAD       = 76;
+      INTERNET_OPTION_IGNORE_OFFLINE           = 77;
+      INTERNET_OPTION_IDENTITY                 = 78;
+      INTERNET_OPTION_REMOVE_IDENTITY          = 79;
+      INTERNET_OPTION_ALTER_IDENTITY           = 80;
+      INTERNET_OPTION_SUPPRESS_BEHAVIOR        = 81;
+      INTERNET_OPTION_AUTODIAL_MODE            = 82;
+      INTERNET_OPTION_AUTODIAL_CONNECTION      = 83;
+      INTERNET_OPTION_CLIENT_CERT_CONTEXT      = 84;
+      INTERNET_OPTION_AUTH_FLAGS               = 85;
+      INTERNET_OPTION_COOKIES_3RD_PARTY        = 86;
+      INTERNET_OPTION_DISABLE_PASSPORT_AUTH    = 87;
+      INTERNET_OPTION_SEND_UTF8_SERVERNAME_TO_PROXY         = 88;
+      INTERNET_OPTION_EXEMPT_CONNECTION_LIMIT  = 89;
+      INTERNET_OPTION_ENABLE_PASSPORT_AUTH     = 90;
+
+      INTERNET_OPTION_HIBERNATE_INACTIVE_WORKER_THREADS       = 91;
+      INTERNET_OPTION_ACTIVATE_WORKER_THREADS                 = 92;
+      INTERNET_OPTION_RESTORE_WORKER_THREAD_DEFAULTS          = 93;
+      INTERNET_OPTION_SOCKET_SEND_BUFFER_LENGTH               = 94;
+      INTERNET_OPTION_PROXY_SETTINGS_CHANGED                  = 95;
+      INTERNET_OPTION_SERVER_CERT_CONTEXT	                    = 96;
+
+      INTERNET_OPTION_SOCKET_LINGER_TIME                      = 97;
+
+
+      INTERNET_FIRST_OPTION                   = INTERNET_OPTION_CALLBACK;
+      INTERNET_LAST_OPTION                    = INTERNET_OPTION_PROXY_SETTINGS_CHANGED;
+
+//
+// values for INTERNET_OPTION_PRIORITY
+//
+const
+      INTERNET_PRIORITY_FOREGROUND            = 1000;
+
+//
+// handle types
+//
+const
+      INTERNET_HANDLE_TYPE_INTERNET           = 1;
+      INTERNET_HANDLE_TYPE_CONNECT_FTP        = 2;
+      INTERNET_HANDLE_TYPE_CONNECT_GOPHER     = 3;
+      INTERNET_HANDLE_TYPE_CONNECT_HTTP       = 4;
+      INTERNET_HANDLE_TYPE_FTP_FIND           = 5;
+      INTERNET_HANDLE_TYPE_FTP_FIND_HTML      = 6;
+      INTERNET_HANDLE_TYPE_FTP_FILE           = 7;
+      INTERNET_HANDLE_TYPE_FTP_FILE_HTML      = 8;
+      INTERNET_HANDLE_TYPE_GOPHER_FIND        = 9;
+      INTERNET_HANDLE_TYPE_GOPHER_FIND_HTML   = 10;
+      INTERNET_HANDLE_TYPE_GOPHER_FILE        = 11;
+      INTERNET_HANDLE_TYPE_GOPHER_FILE_HTML   = 12;
+      INTERNET_HANDLE_TYPE_HTTP_REQUEST       = 13;
+      INTERNET_HANDLE_TYPE_FILE_REQUEST       = 14;
+
+
+//
+// values for INTERNET_OPTION_AUTH_FLAGS
+//
+const
+      AUTH_FLAG_DISABLE_NEGOTIATE             = $00000001;
+      AUTH_FLAG_ENABLE_NEGOTIATE              = $00000002;
+
+//
+// values for INTERNET_OPTION_SECURITY_FLAGS
+//
+
+// query only
+const
+      SECURITY_FLAG_SECURE                    = $00000001; // can query only
+      SECURITY_FLAG_STRENGTH_WEAK             = $10000000;
+      SECURITY_FLAG_STRENGTH_MEDIUM           = $40000000;
+      SECURITY_FLAG_STRENGTH_STRONG           = $20000000;
+      SECURITY_FLAG_UNKNOWNBIT                = $80000000;
+      SECURITY_FLAG_FORTEZZA                  = $08000000;
+      SECURITY_FLAG_NORMALBITNESS             = SECURITY_FLAG_STRENGTH_WEAK;
+
+
+
+// The following are unused
+const
+      SECURITY_FLAG_SSL                       = $00000002;
+      SECURITY_FLAG_SSL3                      = $00000004;
+      SECURITY_FLAG_PCT                       = $00000008;
+      SECURITY_FLAG_PCT4                      = $00000010;
+      SECURITY_FLAG_IETFSSL4                  = $00000020;
+
+// The following are for backwards compatability only.
+const
+      SECURITY_FLAG_40BIT                     = SECURITY_FLAG_STRENGTH_WEAK;
+      SECURITY_FLAG_128BIT                    = SECURITY_FLAG_STRENGTH_STRONG;
+      SECURITY_FLAG_56BIT                     = SECURITY_FLAG_STRENGTH_MEDIUM;
+
+// setable flags
+const
+      SECURITY_FLAG_IGNORE_REVOCATION         = $00000080;
+      SECURITY_FLAG_IGNORE_UNKNOWN_CA         = $00000100;
+      SECURITY_FLAG_IGNORE_WRONG_USAGE        = $00000200;
+
+      SECURITY_FLAG_IGNORE_CERT_CN_INVALID    = INTERNET_FLAG_IGNORE_CERT_CN_INVALID;
+      SECURITY_FLAG_IGNORE_CERT_DATE_INVALID  = INTERNET_FLAG_IGNORE_CERT_DATE_INVALID;
+
+
+      SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS  = INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS;
+      SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP   = INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP;
+
+
+
+      SECURITY_SET_MASK       = SECURITY_FLAG_IGNORE_REVOCATION or
+                                SECURITY_FLAG_IGNORE_UNKNOWN_CA or
+                                SECURITY_FLAG_IGNORE_CERT_CN_INVALID or
+                                SECURITY_FLAG_IGNORE_CERT_DATE_INVALID or
+                                SECURITY_FLAG_IGNORE_WRONG_USAGE;
+
+// valid autodial modes
+const
+      AUTODIAL_MODE_NEVER                     = 1;
+      AUTODIAL_MODE_ALWAYS                    = 2;
+      AUTODIAL_MODE_NO_NETWORK_PRESENT        = 4;
+
+
+function InternetGetLastResponseInfoA(lpdwError:LPDWORD;
+									                    lpszBuffer:LPSTR;
+									                    lpdwBufferLength:LPDWORD
+									                   ):BOOL; external WinInetDLL name 'InternetGetLastResponseInfoA';
+
+function InternetGetLastResponseInfoW(lpdwError:LPDWORD;
+									                    lpszBuffer:LPWSTR;
+									                    lpdwBufferLength:LPDWORD
+									                   ):BOOL; external WinInetDLL name 'InternetGetLastResponseInfoW';
+
+{$IFDEF UNICODE}
+function InternetGetLastResponseInfo(lpdwError:LPDWORD;
+									                   lpszBuffer:LPWSTR;
+									                   lpdwBufferLength:LPDWORD
+									                  ):BOOL; external WinInetDLL name 'InternetGetLastResponseInfoW';
+{$ELSE UNICODE}
+function InternetGetLastResponseInfo(lpdwError:LPDWORD;
+									                   lpszBuffer:LPSTR;
+									                   lpdwBufferLength:LPDWORD
+									                  ):BOOL; external WinInetDLL name 'InternetGetLastResponseInfoA';
+{$ENDIF UNICODE}
+
+
+//
+// callback function for InternetSetStatusCallback
+//
+
+type
+     INTERNET_STATUS_CALLBACK = procedure(_hInternet:HINTERNET;
+									                        dwContext:DWORD_PTR;
+									                        dwInternetStatus:DWORD;
+									                        lpvStatusInformation:LPVOID;
+									                        dwStatusInformationLength:DWORD); cdecl;
+
+
+     LPINTERNET_STATUS_CALLBACK = INTERNET_STATUS_CALLBACK;
+
+
+function InternetSetStatusCallbackA(_hInternet:HINTERNET;
+																    lpfnInternetCallback:INTERNET_STATUS_CALLBACK
+																   ):INTERNET_STATUS_CALLBACK; external WinInetDLL name 'InternetSetStatusCallbackA';
+
+function InternetSetStatusCallbackW(_hInternet:HINTERNET;
+																    lpfnInternetCallback:INTERNET_STATUS_CALLBACK
+																   ):INTERNET_STATUS_CALLBACK; external WinInetDLL name 'InternetSetStatusCallbackW';
+
+{$IFDEF UNICODE}
+function InternetSetStatusCallback(_hInternet:HINTERNET;
+																   lpfnInternetCallback:INTERNET_STATUS_CALLBACK
+																  ):INTERNET_STATUS_CALLBACK; external WinInetDLL name 'InternetSetStatusCallbackW';
+{$ELSE UNICODE}
+{$IFDEF WIN32}
+function InternetSetStatusCallback(_hInternet:HINTERNET;
+																   lpfnInternetCallback:INTERNET_STATUS_CALLBACK
+																  ):INTERNET_STATUS_CALLBACK; external WinInetDLL name 'InternetSetStatusCallbackA';
+{$ELSE WIN32}
+function InternetSetStatusCallback(_hInternet:HINTERNET;
+																   lpfnInternetCallback:INTERNET_STATUS_CALLBACK
+																  ):INTERNET_STATUS_CALLBACK; external WinInetDLL name 'InternetSetStatusCallback';
+{$ENDIF WIN32}
+{$ENDIF UNICODE}
+
+//
+// status manifests for Internet status callback
+//
+const
+      INTERNET_STATUS_RESOLVING_NAME          = 10;
+      INTERNET_STATUS_NAME_RESOLVED           = 11;
+      INTERNET_STATUS_CONNECTING_TO_SERVER    = 20;
+      INTERNET_STATUS_CONNECTED_TO_SERVER     = 21;
+      INTERNET_STATUS_SENDING_REQUEST         = 30;
+      INTERNET_STATUS_REQUEST_SENT            = 31;
+      INTERNET_STATUS_RECEIVING_RESPONSE      = 40;
+      INTERNET_STATUS_RESPONSE_RECEIVED       = 41;
+      INTERNET_STATUS_CTL_RESPONSE_RECEIVED   = 42;
+      INTERNET_STATUS_PREFETCH                = 43;
+      INTERNET_STATUS_CLOSING_CONNECTION      = 50;
+      INTERNET_STATUS_CONNECTION_CLOSED       = 51;
+      INTERNET_STATUS_HANDLE_CREATED          = 60;
+      INTERNET_STATUS_HANDLE_CLOSING          = 70;
+      INTERNET_STATUS_DETECTING_PROXY         = 80;
+      INTERNET_STATUS_REQUEST_COMPLETE        = 100;
+      INTERNET_STATUS_REDIRECT                = 110;
+      INTERNET_STATUS_INTERMEDIATE_RESPONSE   = 120;
+      INTERNET_STATUS_USER_INPUT_REQUIRED     = 140;
+      INTERNET_STATUS_STATE_CHANGE            = 200;
+      INTERNET_STATUS_COOKIE_SENT             = 320;
+      INTERNET_STATUS_COOKIE_RECEIVED         = 321;
+      INTERNET_STATUS_COOKIE_STATE            = 322;
+      INTERNET_STATUS_COOKIE_SUPPRESSED       = 323;
+      INTERNET_STATUS_PRIVACY_IMPACTED        = 324;
+      INTERNET_STATUS_P3P_HEADER              = 325;
+      INTERNET_STATUS_P3P_POLICYREF           = 326;
+      INTERNET_STATUS_COOKIE_HISTORY          = 327;
+      INTERNET_STATUS_SSL_NEGOTIATION_COMPLETE	= 401;
+
+//
+// the following can be indicated in a state change notification:
+//
+const
+      INTERNET_STATE_CONNECTED                = $00000001;  // connected state (mutually exclusive with disconnected)
+      INTERNET_STATE_DISCONNECTED             = $00000002;  // disconnected from network
+      INTERNET_STATE_DISCONNECTED_BY_USER     = $00000010;  // disconnected by user request
+      INTERNET_STATE_IDLE                     = $00000100;  // no network requests being made (by Wininet)
+      INTERNET_STATE_BUSY                     = $00000200;  // network requests being made (by Wininet)
+
+//
+// the following values are used for cookie state:
+//
+type
+     InternetCookieState = (COOKIE_STATE_UNKNOWN := $00,
+                            COOKIE_STATE_ACCEPT  := $01,
+	                           COOKIE_STATE_PROMPT  := $02,
+	                           COOKIE_STATE_LEASH   := $03,
+	                           COOKIE_STATE_DOWNGRADE := $04,
+	                           COOKIE_STATE_REJECT    := $05);
+
+const
+      COOKIE_STATE_MAX   = COOKIE_STATE_REJECT;
+
+type
+     IncomingCookieState = record
+	     cSession:longint;			// Session cookies received
+	     cPersistent:longint;		// Persistent cookies received
+
+	     cAccepted:longint;			// Number of cookies accepted
+	     cLeashed:longint;			//               ... leashed
+	     cDowngraded:longint;		//               ... converted to session-cookies
+	     cBlocked:longint;			//               ... rejected
+
+	     pszLocation:PChar;		// Optional: URL associated with reported cookie events
+   					                // This can be used to override request URL
+     end;
+
+type
+     OutgoingCookieState = record
+	     cSent:longint;
+	     cSuppressed:longint;
+
+	     pszLocation:PChar;		// Optional: URL associated with reported cookie events
+									          // This can be used to override request URL
+     end;
+
+type
+     InternetCookieHistory = record
+       fAccepted:BOOL;
+	      fLeashed:BOOL;
+	      fDowngraded:BOOL;
+	      fRejected:BOOL;
+     end;
+
+type
+     CookieDecision = record
+       dwCookieState:DWORD;
+	      fAllowSession:BOOL;
+     end;
+
+//
+// if the following value is returned by InternetSetStatusCallback, then
+// probably an invalid (non-code) address was supplied for the callback
+//
+const
+      INTERNET_INVALID_STATUS_CALLBACK        = pointer(-1); // INTERNET_STATUS_CALLBACK(longint(-1));
+
+//
+// FTP
+//
+
+//
+// prototypes
+//
+
+function FtpFindFirstFileA(hConnect:HINTERNET;
+										       lpszSearchFile:LPCSTR;
+										       lpFindFileData:LPWIN32_FIND_DATAA;
+										       dwFlags:DWORD;
+										       dwContext:DWORD_PTR
+										      ):HINTERNET; external WinInetDLL name 'FtpFindFirstFileA';
+
+function FtpFindFirstFileW(hConnect:HINTERNET;
+										       lpszSearchFile:LPCWSTR;
+										       lpFindFileData:LPWIN32_FIND_DATAW;
+										       dwFlags:DWORD;
+										       dwContext:DWORD_PTR
+										      ):HINTERNET; external WinInetDLL name 'FtpFindFirstFileW';
+
+{$IFDEF UNICODE}
+function FtpFindFirstFile(hConnect:HINTERNET;
+										      lpszSearchFile:LPCWSTR;
+										      lpFindFileData:LPWIN32_FIND_DATAW;
+										      dwFlags:DWORD;
+										      dwContext:DWORD_PTR
+										     ):HINTERNET; external WinInetDLL name 'FtpFindFirstFileW';
+{$ELSE UNICODE}
+function FtpFindFirstFile(hConnect:HINTERNET;
+										      lpszSearchFile:LPCSTR;
+										      lpFindFileData:LPWIN32_FIND_DATAA;
+										      dwFlags:DWORD;
+										      dwContext:DWORD_PTR
+										     ):HINTERNET; external WinInetDLL name 'FtpFindFirstFileA';
+{$ENDIF UNICODE}
+
+function FtpGetFileA(hConnect:HINTERNET;
+				             lpszRemoteFile:LPCSTR;
+                     lpszNewFile:LPCSTR;
+				             fFailIfExists:BOOL;
+				             dwFlagsAndAttributes:DWORD;
+				             dwFlags:DWORD;
+				             dwContext:DWORD_PTR
+				            ):BOOL; external WinInetDLL name 'FtpGetFileA';
+
+function FtpGetFileW(hConnect:HINTERNET;
+				             lpszRemoteFile:LPCWSTR;
+                     lpszNewFile:LPCWSTR;
+				             fFailIfExists:BOOL;
+				             dwFlagsAndAttributes:DWORD;
+				             dwFlags:DWORD;
+				             dwContext:DWORD_PTR
+				            ):BOOL; external WinInetDLL name 'FtpGetFileW';
+
+{$IFDEF UNICODE}
+function FtpGetFile(hConnect:HINTERNET;
+				            lpszRemoteFile:LPCWSTR;
+                    lpszNewFile:LPCWSTR;
+				            fFailIfExists:BOOL;
+				            dwFlagsAndAttributes:DWORD;
+				            dwFlags:DWORD;
+				            dwContext:DWORD_PTR
+				           ):BOOL; external WinInetDLL name 'FtpGetFileW';
+{$ELSE UNICODE}
+function FtpGetFile(hConnect:HINTERNET;
+				            lpszRemoteFile:LPCSTR;
+                    lpszNewFile:LPCSTR;
+				            fFailIfExists:BOOL;
+				            dwFlagsAndAttributes:DWORD;
+				            dwFlags:DWORD;
+				            dwContext:DWORD_PTR
+				           ):BOOL; external WinInetDLL name 'FtpGetFileA';
+{$ENDIF UNICODE}
+
+function FtpPutFileA(hConnect:HINTERNET;
+				             lpszLocalFile:LPCSTR;
+				             lpszNewRemoteFile:LPCSTR;
+				             dwFlags:DWORD;
+				             dwContext:DWORD_PTR
+				            ):BOOL; external WinInetDLL name 'FtpPutFileA';
+
+function FtpPutFileW(hConnect:HINTERNET;
+				             lpszLocalFile:LPCWSTR;
+				             lpszNewRemoteFile:LPCWSTR;
+				             dwFlags:DWORD;
+				             dwContext:DWORD_PTR
+				            ):BOOL; external WinInetDLL name 'FtpPutFileW';
+
+{$IFDEF UNICODE}
+function FtpPutFile(hConnect:HINTERNET;
+				            lpszLocalFile:LPCWSTR;
+				            lpszNewRemoteFile:LPCWSTR;
+				            dwFlags:DWORD;
+				            dwContext:DWORD_PTR
+				           ):BOOL; external WinInetDLL name 'FtpPutFileW';
+{$ELSE UNICODE}
+function FtpPutFile(hConnect:HINTERNET;
+				            lpszLocalFile:LPCSTR;
+				            lpszNewRemoteFile:LPCSTR;
+				            dwFlags:DWORD;
+				            dwContext:DWORD_PTR
+				           ):BOOL; external WinInetDLL name 'FtpPutFileA';
+{$ENDIF UNICODE}
+
+function FtpGetFileEx(hFtpSession:HINTERNET;
+                      lpszRemoteFile:LPCSTR;
+					            lpszNewFile:LPCWSTR;
+					            fFailIfExists:BOOL;
+					            dwFlagsAndAttributes:DWORD;
+					            dwFlags:DWORD;
+					            dwContext:DWORD_PTR
+					           ):BOOL; external WinInetDLL name 'FtpGetFileEx';
+
+function FtpPutFileEx(hFtpSession:HINTERNET;
+					            lpszLocalFile:LPCWSTR;
+					            lpszNewRemoteFile:LPCSTR;
+					            dwFlags:DWORD;
+					            dwContext:DWORD_PTR
+					           ):BOOL; external WinInetDLL name 'FtpPutFileEx';
+
+function FtpDeleteFileA(hConnect:HINTERNET;
+					              lpszFileName:LPCSTR
+					             ):BOOL; external WinInetDLL name 'FtpDeleteFileA';
+
+function FtpDeleteFileW(hConnect:HINTERNET;
+					              lpszFileName:LPCWSTR
+					             ):BOOL; external WinInetDLL name 'FtpDeleteFileW';
+
+{$IFDEF UNICODE}
+function FtpDeleteFile(hConnect:HINTERNET;
+					             lpszFileName:LPCWSTR
+					            ):BOOL; external WinInetDLL name 'FtpDeleteFileW';
+{$ELSE UNICODE}
+function FtpDeleteFile(hConnect:HINTERNET;
+					             lpszFileName:LPCSTR
+					            ):BOOL; external WinInetDLL name 'FtpDeleteFileA';
+{$ENDIF UNICODE}
+
+function FtpRenameFileA(hConnect:HINTERNET;
+					              lpszExisting:LPCSTR;
+					              lpszNew:LPCSTR
+					             ):BOOL; external WinInetDLL name 'FtpRenameFileA';
+
+function FtpRenameFileW(hConnect:HINTERNET;
+					              lpszExisting:LPCWSTR;
+					              lpszNew:LPCWSTR
+					             ):BOOL; external WinInetDLL name 'FtpRenameFileW';
+{$IFDEF UNICODE}
+function FtpRenameFile(hConnect:HINTERNET;
+					             lpszExisting:LPCWSTR;
+					             lpszNew:LPCWSTR
+					            ):BOOL; external WinInetDLL name 'FtpRenameFileW';
+{$ELSE UNICODE}
+function FtpRenameFile(hConnect:HINTERNET;
+					             lpszExisting:LPCSTR;
+					             lpszNew:LPCSTR
+					            ):BOOL; external WinInetDLL name 'FtpRenameFileA';
+{$ENDIF UNICODE}
+
+function FtpOpenFileA(hConnect:HINTERNET;
+									    lpszFileName:LPCSTR;
+									    dwAccess:DWORD;
+									    dwFlags:DWORD;
+									    dwContext:DWORD_PTR
+									   ):HINTERNET; external WinInetDLL name 'FtpOpenFileA';
+
+function FtpOpenFileW(hConnect:HINTERNET;
+									    lpszFileName:LPCWSTR;
+									    dwAccess:DWORD;
+									    dwFlags:DWORD;
+									    dwContext:DWORD_PTR
+									   ):HINTERNET; external WinInetDLL name 'FtpOpenFileW';
+
+{$IFDEF UNICODE}
+function FtpOpenFile(hConnect:HINTERNET;
+									   lpszFileName:LPCWSTR;
+									   dwAccess:DWORD;
+									   dwFlags:DWORD;
+									   dwContext:DWORD_PTR
+									  ):HINTERNET; external WinInetDLL name 'FtpOpenFileW';
+{$ELSE UNICODE}
+function FtpOpenFile(hConnect:HINTERNET;
+									   lpszFileName:LPCSTR;
+									   dwAccess:DWORD;
+									   dwFlags:DWORD;
+									   dwContext:DWORD_PTR
+									  ):HINTERNET; external WinInetDLL name 'FtpOpenFileA';
+{$ENDIF UNICODE}
+
+function FtpCreateDirectoryA(hConnect:HINTERNET;
+						                 lpszDirectory:LPCSTR
+						                ):BOOL; external WinInetDLL name 'FtpCreateDirectoryA';
+
+function FtpCreateDirectoryW(hConnect:HINTERNET;
+						                 lpszDirectory:LPCWSTR
+						                ):BOOL; external WinInetDLL name 'FtpCreateDirectoryW';
+
+{$IFDEF UNICODE}
+function FtpCreateDirectory(hConnect:HINTERNET;
+						                lpszDirectory:LPCWSTR
+						               ):BOOL; external WinInetDLL name 'FtpCreateDirectoryW';
+{$ELSE UNICODE}
+function FtpCreateDirectory(hConnect:HINTERNET;
+						                lpszDirectory:LPCSTR
+						               ):BOOL; external WinInetDLL name 'FtpCreateDirectoryA';
+{$ENDIF UNICODE}
+
+function FtpRemoveDirectoryA(hConnect:HINTERNET;
+						                 lpszDirectory:LPCSTR
+						                ):BOOL; external WinInetDLL name 'FtpRemoveDirectoryA';
+
+function FtpRemoveDirectoryW(hConnect:HINTERNET;
+						                 lpszDirectory:LPCWSTR
+						                ):BOOL; external WinInetDLL name 'FtpRemoveDirectoryW';
+
+{$IFDEF UNICODE}
+function FtpRemoveDirectory(hConnect:HINTERNET;
+						                lpszDirectory:LPCWSTR
+						               ):BOOL; external WinInetDLL name 'FtpRemoveDirectoryW';
+{$ELSE UNICODE}
+function FtpRemoveDirectory(hConnect:HINTERNET;
+						                lpszDirectory:LPCSTR
+						               ):BOOL; external WinInetDLL name 'FtpRemoveDirectoryA';
+{$ENDIF UNICODE}
+
+function FtpSetCurrentDirectoryA(hConnect:HINTERNET;
+     				  	  	                  lpszDirectory:LPCSTR
+					        		                 ):BOOL; external WinInetDLL name 'FtpSetCurrentDirectoryA';
+
+function FtpSetCurrentDirectoryW(hConnect:HINTERNET;
+     				  	  	                  lpszDirectory:LPCWSTR
+					        		                 ):BOOL; external WinInetDLL name 'FtpSetCurrentDirectoryW';
+
+{$IFDEF UNICODE}
+function FtpSetCurrentDirectory(hConnect:HINTERNET;
+     				  	  	                 lpszDirectory:LPCWSTR
+					        		                ):BOOL; external WinInetDLL name 'FtpSetCurrentDirectoryW';
+{$ELSE UNICODE}
+function FtpSetCurrentDirectory(hConnect:HINTERNET;
+     				  	  	                 lpszDirectory:LPCSTR
+					        		                ):BOOL; external WinInetDLL name 'FtpSetCurrentDirectoryA';
+{$ENDIF UNICODE}
+
+function FtpGetCurrentDirectoryA(hConnect:HINTERNET;
+							                          lpszCurrentDirectory:LPSTR;
+							                          lpdwCurrentDirectory:LPDWORD
+							                         ):BOOL; external WinInetDLL name 'FtpGetCurrentDirectoryA';
+
+function FtpGetCurrentDirectoryW(hConnect:HINTERNET;
+							                          lpszCurrentDirectory:LPWSTR;
+							                          lpdwCurrentDirectory:LPDWORD
+							                         ):BOOL; external WinInetDLL name 'FtpGetCurrentDirectoryW';
+
+{$IFDEF UNICODE}
+function FtpGetCurrentDirectory(hConnect:HINTERNET;
+							                         lpszCurrentDirectory:LPWSTR;
+							                         lpdwCurrentDirectory:LPDWORD
+							                        ):BOOL; external WinInetDLL name 'FtpGetCurrentDirectoryW';
+{$ELSE UNICODE}
+function FtpGetCurrentDirectory(hConnect:HINTERNET;
+							                         lpszCurrentDirectory:LPSTR;
+							                         lpdwCurrentDirectory:LPDWORD
+							                        ):BOOL; external WinInetDLL name 'FtpGetCurrentDirectoryA';
+{$ENDIF UNICODE}
+
+function FtpCommandA(hConnect:HINTERNET;
+              				   fExpectResponse:BOOL;
+				                 dwFlags:DWORD;
+				                 lpszCommand:LPCSTR;
+				                 dwContext:DWORD_PTR;
+				                 phFtpCommand:LPHINTERNET
+				                ):BOOL; external WinInetDLL name 'FtpCommandA';
+
+function FtpCommandW(hConnect:HINTERNET;
+              				   fExpectResponse:BOOL;
+				                 dwFlags:DWORD;
+				                 lpszCommand:LPCWSTR;
+				                 dwContext:DWORD_PTR;
+				                 phFtpCommand:LPHINTERNET
+				                ):BOOL; external WinInetDLL name 'FtpCommandW';
+
+{$IFDEF UNICODE}
+function FtpCommand(hConnect:HINTERNET;
+              				  fExpectResponse:BOOL;
+				                dwFlags:DWORD;
+				                lpszCommand:LPCWSTR;
+				                dwContext:DWORD_PTR;
+				                phFtpCommand:LPHINTERNET
+				               ):BOOL; external WinInetDLL name 'FtpCommandW';
+{$ELSE UNICODE}
+function FtpCommand(hConnect:HINTERNET;
+              				  fExpectResponse:BOOL;
+				                dwFlags:DWORD;
+				                lpszCommand:LPCSTR;
+				                dwContext:DWORD_PTR;
+				                phFtpCommand:LPHINTERNET
+				               ):BOOL; external WinInetDLL name 'FtpCommandA';
+{$ENDIF UNICODE}
+
+function FtpGetFileSize(_hFile:HINTERNET;
+								                lpdwFileSizeHigh:LPDWORD
+								               ):DWORD; external WinInetDLL name 'FtpGetFileSize';
+
+
+
+
+//
+// Gopher
+//
+
+//
+// manifests
+//
+
+//
+// string field lengths (in characters, not bytes)
+//
+const
+       MAX_GOPHER_DISPLAY_TEXT     = 128;
+       MAX_GOPHER_SELECTOR_TEXT    = 256;
+       MAX_GOPHER_HOST_NAME        = INTERNET_MAX_HOST_NAME_LENGTH;
+       MAX_GOPHER_LOCATOR_LENGTH   = 1 +
+                                     MAX_GOPHER_DISPLAY_TEXT +
+                                     1 +
+                                     MAX_GOPHER_SELECTOR_TEXT +
+                                     1 +
+                                     MAX_GOPHER_HOST_NAME +
+                                     1 +
+                                     INTERNET_MAX_PORT_NUMBER_LENGTH +
+                                     1 +
+                                     1 +
+                                     2;
+
+
+//
+// structures/types
+//
+
+//
+// GOPHER_FIND_DATA - returns the results of a GopherFindFirstFile()/
+// InternetFindNextFile() request
+//
+
+type
+     GOPHER_FIND_DATAA = record
+	      DisplayString:array[0..MAX_GOPHER_DISPLAY_TEXT] of char;
+	      GopherType:DWORD;	// GOPHER_TYPE_, if known
+	      SizeLow:DWORD;
+	      SizeHigh:DWORD;
+	      LastModificationTime:FILETIME;
+	      Locator:array[0..MAX_GOPHER_LOCATOR_LENGTH] of char;
+     end;
+     LPGOPHER_FIND_DATAA = ^GOPHER_FIND_DATAA;
+
+     GOPHER_FIND_DATAW = record
+	      DisplayString:array[0..MAX_GOPHER_DISPLAY_TEXT] of WCHAR;
+	      GopherType:DWORD;	// GOPHER_TYPE_, if known
+	      SizeLow:DWORD;
+	      SizeHigh:DWORD;
+	      LastModificationTime:FILETIME;
+	      Locator:array[0..MAX_GOPHER_LOCATOR_LENGTH] of WCHAR;
+     end;
+     LPGOPHER_FIND_DATAW = ^GOPHER_FIND_DATAW;
+
+
+{$IFDEF UNICODE}
+type
+     GOPHER_FIND_DATA = GOPHER_FIND_DATAW;
+     LPGOPHER_FIND_DATA = LPGOPHER_FIND_DATAW;
+{$ELSE UNICODE}
+type
+     GOPHER_FIND_DATA = GOPHER_FIND_DATAA;
+     LPGOPHER_FIND_DATA = LPGOPHER_FIND_DATAA;
+{$ENDIF UNICODE}
+
+//
+// manifests for GopherType
+//
+const
+       GOPHER_TYPE_TEXT_FILE       = $00000001;
+       GOPHER_TYPE_DIRECTORY       = $00000002;
+       GOPHER_TYPE_CSO             = $00000004;
+       GOPHER_TYPE_ERROR           = $00000008;
+       GOPHER_TYPE_MAC_BINHEX      = $00000010;
+       GOPHER_TYPE_DOS_ARCHIVE     = $00000020;
+       GOPHER_TYPE_UNIX_UUENCODED  = $00000040;
+       GOPHER_TYPE_INDEX_SERVER    = $00000080;
+       GOPHER_TYPE_TELNET          = $00000100;
+       GOPHER_TYPE_BINARY          = $00000200;
+       GOPHER_TYPE_REDUNDANT       = $00000400;
+       GOPHER_TYPE_TN3270          = $00000800;
+       GOPHER_TYPE_GIF             = $00001000;
+       GOPHER_TYPE_IMAGE           = $00002000;
+       GOPHER_TYPE_BITMAP          = $00004000;
+       GOPHER_TYPE_MOVIE           = $00008000;
+       GOPHER_TYPE_SOUND           = $00010000;
+       GOPHER_TYPE_HTML            = $00020000;
+       GOPHER_TYPE_PDF             = $00040000;
+       GOPHER_TYPE_CALENDAR        = $00080000;
+       GOPHER_TYPE_INLINE          = $00100000;
+       GOPHER_TYPE_UNKNOWN         = $20000000;
+       GOPHER_TYPE_ASK             = $40000000;
+       GOPHER_TYPE_GOPHER_PLUS     = $80000000;
+
+//
+// gopher type macros
+//
+function IS_GOPHER_FILE(_type:DWORD):BOOL;
+function IS_GOPHER_DIRECTORY(_type:DWORD):BOOL;
+function IS_GOPHER_PHONE_SERVER(_type:DWORD):BOOL;
+function IS_GOPHER_ERROR(_type:DWORD):BOOL;
+function IS_GOPHER_INDEX_SERVER(_type:DWORD):BOOL;
+function IS_GOPHER_TELNET_SESSION(_type:DWORD):BOOL;
+function IS_GOPHER_BACKUP_SERVER(_type:DWORD):BOOL;
+function IS_GOPHER_TN3270_SESSION(_type:DWORD):BOOL;
+function IS_GOPHER_ASK(_type:DWORD):BOOL;
+function IS_GOPHER_PLUS(_type:DWORD):BOOL;
+function IS_GOPHER_TYPE_KNOWN(_type:DWORD):BOOL;
+
+//
+// GOPHER_TYPE_FILE_MASK - use this to determine if a locator identifies a
+// (known) file type
+//
+const
+      GOPHER_TYPE_FILE_MASK       = GOPHER_TYPE_TEXT_FILE or
+                                    GOPHER_TYPE_MAC_BINHEX or
+                                    GOPHER_TYPE_DOS_ARCHIVE or
+                                    GOPHER_TYPE_UNIX_UUENCODED or
+                                    GOPHER_TYPE_BINARY or
+                                    GOPHER_TYPE_GIF or
+                                    GOPHER_TYPE_IMAGE or
+                                    GOPHER_TYPE_BITMAP or
+                                    GOPHER_TYPE_MOVIE or
+                                    GOPHER_TYPE_SOUND or
+                                    GOPHER_TYPE_HTML or
+                                    GOPHER_TYPE_PDF or
+                                    GOPHER_TYPE_CALENDAR or
+                                    GOPHER_TYPE_INLINE;
+
+
+//
+// structured gopher attributes (as defined in gopher+ protocol document)
+//
+type
+     GOPHER_ADMIN_ATTRIBUTE_TYPE = record
+	      Comment:LPCTSTR;
+	      EmailAddress:LPCTSTR;
+     end;
+     LPGOPHER_ADMIN_ATTRIBUTE_TYPE = ^GOPHER_ADMIN_ATTRIBUTE_TYPE;
+
+type
+     GOPHER_MOD_DATE_ATTRIBUTE_TYPE = record
+	      DateAndTime:FILETIME;
+     end;
+     LPGOPHER_MOD_DATE_ATTRIBUTE_TYPE = ^GOPHER_MOD_DATE_ATTRIBUTE_TYPE;
+
+type
+     GOPHER_TTL_ATTRIBUTE_TYPE = record
+	      Ttl:DWORD;
+     end;
+     LPGOPHER_TTL_ATTRIBUTE_TYPE = ^GOPHER_TTL_ATTRIBUTE_TYPE;
+
+type
+     GOPHER_SCORE_ATTRIBUTE_TYPE = record
+	      Score:longint;
+     end;
+     LPGOPHER_SCORE_ATTRIBUTE_TYPE = ^GOPHER_SCORE_ATTRIBUTE_TYPE;
+
+type
+     GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE = record
+	      LowerBound:longint;
+	      UpperBound:longint;
+     end;
+     LPGOPHER_SCORE_RANGE_ATTRIBUTE_TYPE = ^GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE;
+
+type
+     GOPHER_SITE_ATTRIBUTE_TYPE = record
+	      Site:LPCTSTR;
+     end;
+     LPGOPHER_SITE_ATTRIBUTE_TYPE = ^GOPHER_SITE_ATTRIBUTE_TYPE;
+
+type
+     GOPHER_ORGANIZATION_ATTRIBUTE_TYPE = record
+	      Organization:LPCTSTR;
+     end;
+     LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPE = ^GOPHER_ORGANIZATION_ATTRIBUTE_TYPE;
+
+type
+     GOPHER_LOCATION_ATTRIBUTE_TYPE = record
+	      Location:LPCTSTR;
+     end;
+     LPGOPHER_LOCATION_ATTRIBUTE_TYPE = ^GOPHER_LOCATION_ATTRIBUTE_TYPE;
+
+type
+     GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE = record
+	      DegreesNorth:longint;
+	      MinutesNorth:longint;
+	      SecondsNorth:longint;
+	      DegreesEast:longint;
+	      MinutesEast:longint;
+	      SecondsEast:longint;
+     end;
+     LPGOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE = ^GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE;
+
+type
+     GOPHER_TIMEZONE_ATTRIBUTE_TYPE = record
+	      Zone:longint;
+     end;
+     LPGOPHER_TIMEZONE_ATTRIBUTE_TYPE = ^GOPHER_TIMEZONE_ATTRIBUTE_TYPE;
+
+type
+      GOPHER_PROVIDER_ATTRIBUTE_TYPE = record
+  	     Provider:LPCTSTR;
+      end;
+      LPGOPHER_PROVIDER_ATTRIBUTE_TYPE = ^GOPHER_PROVIDER_ATTRIBUTE_TYPE;
+
+type
+     GOPHER_VERSION_ATTRIBUTE_TYPE = record
+	      Version:LPCTSTR;
+     end;
+     LPGOPHER_VERSION_ATTRIBUTE_TYPE = ^GOPHER_VERSION_ATTRIBUTE_TYPE;
+
+type
+     GOPHER_ABSTRACT_ATTRIBUTE_TYPE = record
+	      ShortAbstract:LPCTSTR;
+	      AbstractFile:LPCTSTR;
+     end;
+     LPGOPHER_ABSTRACT_ATTRIBUTE_TYPE = ^GOPHER_ABSTRACT_ATTRIBUTE_TYPE;
+
+type
+     GOPHER_VIEW_ATTRIBUTE_TYPE = record
+	      ContentType:LPCTSTR;
+	      Language:LPCTSTR;
+	      Size:DWORD;
+     end;
+     LPGOPHER_VIEW_ATTRIBUTE_TYPE = ^GOPHER_VIEW_ATTRIBUTE_TYPE;
+
+type
+     GOPHER_VERONICA_ATTRIBUTE_TYPE = record
+	      TreeWalk:BOOL;
+     end;
+     LPGOPHER_VERONICA_ATTRIBUTE_TYPE = ^GOPHER_VERONICA_ATTRIBUTE_TYPE;
+
+type
+     GOPHER_ASK_ATTRIBUTE_TYPE = record
+	      QuestionType:LPCTSTR;
+	      QuestionText:LPCTSTR;
+     end;
+     LPGOPHER_ASK_ATTRIBUTE_TYPE = ^GOPHER_ASK_ATTRIBUTE_TYPE;
+
+//
+// GOPHER_UNKNOWN_ATTRIBUTE_TYPE - this is returned if we retrieve an attribute
+// that is not specified in the current gopher/gopher+ documentation. It is up
+// to the application to parse the information
+//
+
+type
+      GOPHER_UNKNOWN_ATTRIBUTE_TYPE = record
+	       Text:LPCTSTR;
+      end;
+      LPGOPHER_UNKNOWN_ATTRIBUTE_TYPE = ^GOPHER_UNKNOWN_ATTRIBUTE_TYPE;
+
+//
+// GOPHER_ATTRIBUTE_TYPE - returned in the user's buffer when an enumerated
+// GopherGetAttribute call is made
+//
+
+type
+     GOPHER_ATTRIBUTE_TYPE = record
+	      CategoryId:DWORD;	// e.g. GOPHER_CATEGORY_ID_ADMIN
+	      AttributeId:DWORD;	// e.g. GOPHER_ATTRIBUTE_ID_ADMIN
+       case longint of // AttributeType
+		       0: (Admin:GOPHER_ADMIN_ATTRIBUTE_TYPE);
+		       1: (ModDate:GOPHER_MOD_DATE_ATTRIBUTE_TYPE);
+		       2: (Ttl:GOPHER_TTL_ATTRIBUTE_TYPE);
+		       3: (Score:GOPHER_SCORE_ATTRIBUTE_TYPE);
+		       4: (ScoreRange:GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE);
+		       5: (Site:GOPHER_SITE_ATTRIBUTE_TYPE);
+		       6: (Organization:GOPHER_ORGANIZATION_ATTRIBUTE_TYPE);
+		       7: (Location:GOPHER_LOCATION_ATTRIBUTE_TYPE);
+		       8: (GeographicalLocation:GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE);
+		       9: (TimeZone:GOPHER_TIMEZONE_ATTRIBUTE_TYPE);
+		       10: (Provider:GOPHER_PROVIDER_ATTRIBUTE_TYPE);
+		       11: (Version:GOPHER_VERSION_ATTRIBUTE_TYPE);
+		       12: (_Abstract:GOPHER_ABSTRACT_ATTRIBUTE_TYPE);
+		       13: (View:GOPHER_VIEW_ATTRIBUTE_TYPE);
+		       14: (Veronica:GOPHER_VERONICA_ATTRIBUTE_TYPE);
+		       15: (Ask:GOPHER_ASK_ATTRIBUTE_TYPE);
+		       16: (Unknown:GOPHER_UNKNOWN_ATTRIBUTE_TYPE);
+     end;
+     LPGOPHER_ATTRIBUTE_TYPE = ^GOPHER_ATTRIBUTE_TYPE;
+
+const
+      MAX_GOPHER_CATEGORY_NAME    = 128;     // arbitrary
+      MAX_GOPHER_ATTRIBUTE_NAME   = 128;     //     "
+      MIN_GOPHER_ATTRIBUTE_LENGTH = 256;     //     "
+
+//
+// known gopher attribute categories. See below for ordinals
+//
+const
+      GOPHER_INFO_CATEGORY        = '+INFO';
+      GOPHER_ADMIN_CATEGORY       = '+ADMIN';
+      GOPHER_VIEWS_CATEGORY       = '+VIEWS';
+      GOPHER_ABSTRACT_CATEGORY    = '+ABSTRACT';
+      GOPHER_VERONICA_CATEGORY    = '+VERONICA';
+
+//
+// known gopher attributes. These are the attribute names as defined in the
+// gopher+ protocol document
+//
+const
+      GOPHER_ADMIN_ATTRIBUTE      = 'Admin';
+      GOPHER_MOD_DATE_ATTRIBUTE   = 'Mod-Date';
+      GOPHER_TTL_ATTRIBUTE        = 'TTL';
+      GOPHER_SCORE_ATTRIBUTE      = 'Score';
+      GOPHER_RANGE_ATTRIBUTE      = 'Score-range';
+      GOPHER_SITE_ATTRIBUTE       = 'Site';
+      GOPHER_ORG_ATTRIBUTE        = 'Org';
+      GOPHER_LOCATION_ATTRIBUTE   = 'Loc';
+      GOPHER_GEOG_ATTRIBUTE       = 'Geog';
+      GOPHER_TIMEZONE_ATTRIBUTE   = 'TZ';
+      GOPHER_PROVIDER_ATTRIBUTE   = 'Provider';
+      GOPHER_VERSION_ATTRIBUTE    = 'Version';
+      GOPHER_ABSTRACT_ATTRIBUTE   = 'Abstract';
+      GOPHER_VIEW_ATTRIBUTE       = 'View';
+      GOPHER_TREEWALK_ATTRIBUTE   = 'treewalk';
+
+//
+// identifiers for attribute strings
+//
+const
+      GOPHER_ATTRIBUTE_ID_BASE        = $ABCCCC00;
+
+      GOPHER_CATEGORY_ID_ALL          = GOPHER_ATTRIBUTE_ID_BASE + 1;
+
+      GOPHER_CATEGORY_ID_INFO         = GOPHER_ATTRIBUTE_ID_BASE + 2;
+      GOPHER_CATEGORY_ID_ADMIN        = GOPHER_ATTRIBUTE_ID_BASE + 3;
+      GOPHER_CATEGORY_ID_VIEWS        = GOPHER_ATTRIBUTE_ID_BASE + 4;
+      GOPHER_CATEGORY_ID_ABSTRACT     = GOPHER_ATTRIBUTE_ID_BASE + 5;
+      GOPHER_CATEGORY_ID_VERONICA     = GOPHER_ATTRIBUTE_ID_BASE + 6;
+      GOPHER_CATEGORY_ID_ASK          = GOPHER_ATTRIBUTE_ID_BASE + 7;
+
+      GOPHER_CATEGORY_ID_UNKNOWN      = GOPHER_ATTRIBUTE_ID_BASE + 8;
+
+      GOPHER_ATTRIBUTE_ID_ALL         = GOPHER_ATTRIBUTE_ID_BASE + 9;
+
+      GOPHER_ATTRIBUTE_ID_ADMIN       = GOPHER_ATTRIBUTE_ID_BASE + 10;
+      GOPHER_ATTRIBUTE_ID_MOD_DATE    = GOPHER_ATTRIBUTE_ID_BASE + 11;
+      GOPHER_ATTRIBUTE_ID_TTL         = GOPHER_ATTRIBUTE_ID_BASE + 12;
+      GOPHER_ATTRIBUTE_ID_SCORE       = GOPHER_ATTRIBUTE_ID_BASE + 13;
+      GOPHER_ATTRIBUTE_ID_RANGE       = GOPHER_ATTRIBUTE_ID_BASE + 14;
+      GOPHER_ATTRIBUTE_ID_SITE        = GOPHER_ATTRIBUTE_ID_BASE + 15;
+      GOPHER_ATTRIBUTE_ID_ORG         = GOPHER_ATTRIBUTE_ID_BASE + 16;
+      GOPHER_ATTRIBUTE_ID_LOCATION    = GOPHER_ATTRIBUTE_ID_BASE + 17;
+      GOPHER_ATTRIBUTE_ID_GEOG        = GOPHER_ATTRIBUTE_ID_BASE + 18;
+      GOPHER_ATTRIBUTE_ID_TIMEZONE    = GOPHER_ATTRIBUTE_ID_BASE + 19;
+      GOPHER_ATTRIBUTE_ID_PROVIDER    = GOPHER_ATTRIBUTE_ID_BASE + 20;
+      GOPHER_ATTRIBUTE_ID_VERSION     = GOPHER_ATTRIBUTE_ID_BASE + 21;
+      GOPHER_ATTRIBUTE_ID_ABSTRACT    = GOPHER_ATTRIBUTE_ID_BASE + 22;
+      GOPHER_ATTRIBUTE_ID_VIEW        = GOPHER_ATTRIBUTE_ID_BASE + 23;
+      GOPHER_ATTRIBUTE_ID_TREEWALK    = GOPHER_ATTRIBUTE_ID_BASE + 24;
+
+      GOPHER_ATTRIBUTE_ID_UNKNOWN     = GOPHER_ATTRIBUTE_ID_BASE + 25;
+
+//
+// prototypes
+//
+
+function GopherCreateLocatorA(lpszHost:LPCSTR;
+							                       nServerPort:INTERNET_PORT;
+							                       lpszDisplayString:INTERNET_PORT;
+							                       lpszSelectorString:LPCSTR;
+							                       dwGopherType:DWORD;
+							                       lpszLocator:LPSTR;
+							                       lpdwBufferLength:LPDWORD):BOOL; external WinInetDLL name 'GopherCreateLocatorA';
+
+function GopherCreateLocatorW(lpszHost:LPCWSTR;
+							                       nServerPort:INTERNET_PORT;
+							                       lpszDisplayString:INTERNET_PORT;
+							                       lpszSelectorString:LPCWSTR;
+							                       dwGopherType:DWORD;
+							                       lpszLocator:LPWSTR;
+							                       lpdwBufferLength:LPDWORD):BOOL; external WinInetDLL name 'GopherCreateLocatorW';
+
+{$IFDEF UNICODE}
+function GopherCreateLocator(lpszHost:LPCWSTR;
+							                      nServerPort:INTERNET_PORT;
+							                      lpszDisplayString:INTERNET_PORT;
+							                      lpszSelectorString:LPCWSTR;
+							                      dwGopherType:DWORD;
+							                      lpszLocator:LPWSTR;
+							                      lpdwBufferLength:LPDWORD):BOOL; external WinInetDLL name 'GopherCreateLocatorW';
+{$ELSE UNICODE}
+function GopherCreateLocator(lpszHost:LPCSTR;
+							                      nServerPort:INTERNET_PORT;
+							                      lpszDisplayString:INTERNET_PORT;
+							                      lpszSelectorString:LPCSTR;
+							                      dwGopherType:DWORD;
+							                      lpszLocator:LPSTR;
+							                      lpdwBufferLength:LPDWORD):BOOL; external WinInetDLL name 'GopherCreateLocatorA';
+{$ENDIF UNICODE}
+
+function GopherGetLocatorTypeA(lpszLocator:LPCSTR;
+							                        lpdwGopherType:LPDWORD):BOOL; external WinInetDLL name 'GopherGetLocatorTypeA';
+
+function GopherGetLocatorTypeW(lpszLocator:LPCWSTR;
+							                        lpdwGopherType:LPDWORD):BOOL; external WinInetDLL name 'GopherGetLocatorTypeW';
+
+{$IFDEF UNICODE}
+function GopherGetLocatorType(lpszLocator:LPCWSTR;
+							                       lpdwGopherType:LPDWORD):BOOL; external WinInetDLL name 'GopherGetLocatorTypeW';
+{$ELSE UNICODE}
+function GopherGetLocatorType(lpszLocator:LPCSTR;
+							                       lpdwGopherType:LPDWORD):BOOL; external WinInetDLL name 'GopherGetLocatorTypeA';
+{$ENDIF UNICODE}
+
+function GopherFindFirstFileA(hConnect:HINTERNET;
+											                   lpszLocator:LPCSTR;
+											                   lpszSearchString:LPCSTR;
+											                   lpFindData:LPGOPHER_FIND_DATAA;
+											                   dwFlags:DWORD;
+											                   dwContext:DWORD_PTR
+											                  ):HINTERNET; external WinInetDLL name 'GopherFindFirstFileA';
+
+function GopherFindFirstFileW(hConnect:HINTERNET;
+											                   lpszLocator:LPCWSTR;
+											                   lpszSearchString:LPCWSTR;
+											                   lpFindData:LPGOPHER_FIND_DATAW;
+											                   dwFlags:DWORD;
+											                   dwContext:DWORD_PTR
+											                  ):HINTERNET; external WinInetDLL name 'GopherFindFirstFileW';
+
+{$IFDEF UNICODE}
+function GopherFindFirstFile(hConnect:HINTERNET;
+											                  lpszLocator:LPCWSTR;
+											                  lpszSearchString:LPCWSTR;
+											                  lpFindData:LPGOPHER_FIND_DATAW;
+											                  dwFlags:DWORD;
+											                  dwContext:DWORD_PTR
+											                 ):HINTERNET; external WinInetDLL name 'GopherFindFirstFileW';
+{$ELSE UNICODE}
+function GopherFindFirstFile(hConnect:HINTERNET;
+											                  lpszLocator:LPCSTR;
+											                  lpszSearchString:LPCSTR;
+											                  lpFindData:LPGOPHER_FIND_DATAA;
+											                  dwFlags:DWORD;
+											                  dwContext:DWORD_PTR
+											                 ):HINTERNET; external WinInetDLL name 'GopherFindFirstFileA';
+{$ENDIF UNICODE}
+
+function GopherOpenFileA(hConnect:HINTERNET;
+									                lpszLocator:LPCSTR;
+									                lpszView:LPCSTR;
+									                dwFlags:DWORD;
+									                dwContext:DWORD_PTR
+									               ):HINTERNET; external WinInetDLL name 'GopherOpenFileA';
+
+function GopherOpenFileW(hConnect:HINTERNET;
+									                lpszLocator:LPCWSTR;
+									                lpszView:LPCWSTR;
+									                dwFlags:DWORD;
+									                dwContext:DWORD_PTR
+									               ):HINTERNET; external WinInetDLL name 'GopherOpenFileW';
+
+{$IFDEF UNICODE}
+function GopherOpenFile(hConnect:HINTERNET;
+									               lpszLocator:LPCWSTR;
+									               lpszView:LPCWSTR;
+									               dwFlags:DWORD;
+									               dwContext:DWORD_PTR
+									              ):HINTERNET; external WinInetDLL name 'GopherOpenFileW';
+{$ELSE UNICODE}
+function GopherOpenFile(hConnect:HINTERNET;
+									               lpszLocator:LPCSTR;
+                        lpszView:LPCSTR;
+									               dwFlags:DWORD;
+									               dwContext:DWORD_PTR
+									              ):HINTERNET; external WinInetDLL name 'GopherOpenFileA';
+{$ENDIF UNICODE}
+
+type
+     GOPHER_ATTRIBUTE_ENUMERATOR = function(lpAttributeInfo:LPGOPHER_ATTRIBUTE_TYPE;
+                                            dwError:DWORD):BOOL; cdecl;
+
+function GopherGetAttributeA(hConnect:HINTERNET;
+						                       lpszLocator:LPCSTR;
+						                       lpszAttributeName:LPCSTR;
+						                       lpBuffer:LPBYTE;
+						                       dwBufferLength:DWORD;
+						                       lpdwCharactersReturned:LPDWORD;
+						                       lpfnEnumerator:GOPHER_ATTRIBUTE_ENUMERATOR;
+						                       dwContext:DWORD_PTR
+						                      ):BOOL; external WinInetDLL name 'GopherGetAttributeA';
+
+function GopherGetAttributeW(hConnect:HINTERNET;
+						                       lpszLocator:LPCWSTR;
+						                       lpszAttributeName:LPCWSTR;
+						                       lpBuffer:LPBYTE;
+						                       dwBufferLength:DWORD;
+						                       lpdwCharactersReturned:LPDWORD;
+						                       lpfnEnumerator:GOPHER_ATTRIBUTE_ENUMERATOR;
+						                       dwContext:DWORD_PTR
+						                      ):BOOL; external WinInetDLL name 'GopherGetAttributeW';
+
+{$IFDEF UNICODE}
+function GopherGetAttribute(hConnect:HINTERNET;
+						                      lpszLocator:LPCWSTR;
+						                      lpszAttributeName:LPCWSTR;
+						                      lpBuffer:LPBYTE;
+						                      dwBufferLength:DWORD;
+						                      lpdwCharactersReturned:LPDWORD;
+						                      lpfnEnumerator:GOPHER_ATTRIBUTE_ENUMERATOR;
+						                      dwContext:DWORD_PTR
+						                     ):BOOL; external WinInetDLL name 'GopherGetAttributeW';
+{$ELSE UNICODE}
+function GopherGetAttribute(hConnect:HINTERNET;
+						                      lpszLocator:LPCSTR;
+						                      lpszAttributeName:LPCSTR;
+						                      lpBuffer:LPBYTE;
+						                      dwBufferLength:DWORD;
+						                      lpdwCharactersReturned:LPDWORD;
+						                      lpfnEnumerator:GOPHER_ATTRIBUTE_ENUMERATOR;
+						                      dwContext:DWORD_PTR
+						                     ):BOOL; external WinInetDLL name 'GopherGetAttributeA';
+{$ENDIF UNICODE}
+
+
+//
+// HTTP
+//
+
+//
+// manifests
+//
+
+//
+// the default major/minor HTTP version numbers
+//
+const
+      HTTP_MAJOR_VERSION      = 1;
+      HTTP_MINOR_VERSION      = 0;
+
+      HTTP_VERSIONA            = 'HTTP/1.0';
+      HTTP_VERSIONW:WideString = 'HTTP/1.0';
+
+{$IFDEF UNICODE}
+      HTTP_VERSION:WideString = 'HTTP/1.0'; // HTTP_VERSIONW
+{$ELSE UNICODE}
+      HTTP_VERSION             = HTTP_VERSIONA;
+{$ENDIF UNICODE}
+
+//
+// HttpQueryInfo info levels. Generally, there is one info level
+// for each potential RFC822/HTTP/MIME header that an HTTP server
+// may send as part of a request response.
+//
+// The HTTP_QUERY_RAW_HEADERS info level is provided for clients
+// that choose to perform their own header parsing.
+//
+const
+      HTTP_QUERY_MIME_VERSION                 = 0;
+      HTTP_QUERY_CONTENT_TYPE                 = 1;
+      HTTP_QUERY_CONTENT_TRANSFER_ENCODING    = 2;
+      HTTP_QUERY_CONTENT_ID                   = 3;
+      HTTP_QUERY_CONTENT_DESCRIPTION          = 4;
+      HTTP_QUERY_CONTENT_LENGTH               = 5;
+      HTTP_QUERY_CONTENT_LANGUAGE             = 6;
+      HTTP_QUERY_ALLOW                        = 7;
+      HTTP_QUERY_PUBLIC                       = 8;
+      HTTP_QUERY_DATE                         = 9;
+      HTTP_QUERY_EXPIRES                      = 10;
+      HTTP_QUERY_LAST_MODIFIED                = 11;
+      HTTP_QUERY_MESSAGE_ID                   = 12;
+      HTTP_QUERY_URI                          = 13;
+      HTTP_QUERY_DERIVED_FROM                 = 14;
+      HTTP_QUERY_COST                         = 15;
+      HTTP_QUERY_LINK                         = 16;
+      HTTP_QUERY_PRAGMA                       = 17;
+      HTTP_QUERY_VERSION                      = 18;  // special: part of status line
+      HTTP_QUERY_STATUS_CODE                  = 19;  // special: part of status line
+      HTTP_QUERY_STATUS_TEXT                  = 20;  // special: part of status line
+      HTTP_QUERY_RAW_HEADERS                  = 21;  // special: all headers as ASCIIZ
+      HTTP_QUERY_RAW_HEADERS_CRLF             = 22;  // special: all headers
+      HTTP_QUERY_CONNECTION                   = 23;
+      HTTP_QUERY_ACCEPT                       = 24;
+      HTTP_QUERY_ACCEPT_CHARSET               = 25;
+      HTTP_QUERY_ACCEPT_ENCODING              = 26;
+      HTTP_QUERY_ACCEPT_LANGUAGE              = 27;
+      HTTP_QUERY_AUTHORIZATION                = 28;
+      HTTP_QUERY_CONTENT_ENCODING             = 29;
+      HTTP_QUERY_FORWARDED                    = 30;
+      HTTP_QUERY_FROM                         = 31;
+      HTTP_QUERY_IF_MODIFIED_SINCE            = 32;
+      HTTP_QUERY_LOCATION                     = 33;
+      HTTP_QUERY_ORIG_URI                     = 34;
+      HTTP_QUERY_REFERER                      = 35;
+      HTTP_QUERY_RETRY_AFTER                  = 36;
+      HTTP_QUERY_SERVER                       = 37;
+      HTTP_QUERY_TITLE                        = 38;
+      HTTP_QUERY_USER_AGENT                   = 39;
+      HTTP_QUERY_WWW_AUTHENTICATE             = 40;
+      HTTP_QUERY_PROXY_AUTHENTICATE           = 41;
+      HTTP_QUERY_ACCEPT_RANGES                = 42;
+      HTTP_QUERY_SET_COOKIE                   = 43;
+      HTTP_QUERY_COOKIE                       = 44;
+      HTTP_QUERY_REQUEST_METHOD               = 45;  // special: GET/POST etc.
+      HTTP_QUERY_REFRESH                      = 46;
+      HTTP_QUERY_CONTENT_DISPOSITION          = 47;
+
+//
+// HTTP 1.1 defined headers
+//
+
+      HTTP_QUERY_AGE                          = 48;
+      HTTP_QUERY_CACHE_CONTROL                = 49;
+      HTTP_QUERY_CONTENT_BASE                 = 50;
+      HTTP_QUERY_CONTENT_LOCATION             = 51;
+      HTTP_QUERY_CONTENT_MD5                  = 52;
+      HTTP_QUERY_CONTENT_RANGE                = 53;
+      HTTP_QUERY_ETAG                         = 54;
+      HTTP_QUERY_HOST                         = 55;
+      HTTP_QUERY_IF_MATCH                     = 56;
+      HTTP_QUERY_IF_NONE_MATCH                = 57;
+      HTTP_QUERY_IF_RANGE                     = 58;
+      HTTP_QUERY_IF_UNMODIFIED_SINCE          = 59;
+      HTTP_QUERY_MAX_FORWARDS                 = 60;
+      HTTP_QUERY_PROXY_AUTHORIZATION          = 61;
+      HTTP_QUERY_RANGE                        = 62;
+      HTTP_QUERY_TRANSFER_ENCODING            = 63;
+      HTTP_QUERY_UPGRADE                      = 64;
+      HTTP_QUERY_VARY                         = 65;
+      HTTP_QUERY_VIA                          = 66;
+      HTTP_QUERY_WARNING                      = 67;
+      HTTP_QUERY_EXPECT                       = 68;
+      HTTP_QUERY_PROXY_CONNECTION             = 69;
+      HTTP_QUERY_UNLESS_MODIFIED_SINCE        = 70;
+
+
+
+      HTTP_QUERY_ECHO_REQUEST                 = 71;
+      HTTP_QUERY_ECHO_REPLY                   = 72;
+
+// These are the set of headers that should be added back to a request when
+// re-doing a request after a RETRY_WITH response.
+      HTTP_QUERY_ECHO_HEADERS                 = 73;
+      HTTP_QUERY_ECHO_HEADERS_CRLF            = 74;
+
+      HTTP_QUERY_PROXY_SUPPORT                = 75;
+      HTTP_QUERY_AUTHENTICATION_INFO          = 76;
+      HTTP_QUERY_PASSPORT_URLS                = 77;
+      HTTP_QUERY_PASSPORT_CONFIG              = 78;
+
+      HTTP_QUERY_MAX                          = 78;
+
+//
+// HTTP_QUERY_CUSTOM - if this special value is supplied as the dwInfoLevel
+// parameter of HttpQueryInfo() then the lpBuffer parameter contains the name
+// of the header we are to query
+//
+
+      HTTP_QUERY_CUSTOM                       = 65535;
+
+//
+// HTTP_QUERY_FLAG_REQUEST_HEADERS - if this bit is set in the dwInfoLevel
+// parameter of HttpQueryInfo() then the request headers will be queried for the
+// request information
+//
+
+      HTTP_QUERY_FLAG_REQUEST_HEADERS         = $80000000;
+
+//
+// HTTP_QUERY_FLAG_SYSTEMTIME - if this bit is set in the dwInfoLevel parameter
+// of HttpQueryInfo() AND the header being queried contains date information,
+// e.g. the "Expires:" header then lpBuffer will contain a SYSTEMTIME structure
+// containing the date and time information converted from the header string
+//
+
+      HTTP_QUERY_FLAG_SYSTEMTIME              = $40000000;
+
+//
+// HTTP_QUERY_FLAG_NUMBER - if this bit is set in the dwInfoLevel parameter of
+// HttpQueryInfo(), then the value of the header will be converted to a number
+// before being returned to the caller, if applicable
+//
+
+      HTTP_QUERY_FLAG_NUMBER                  = $20000000;
+
+//
+// HTTP_QUERY_FLAG_COALESCE - combine the values from several headers of the
+// same name into the output buffer
+//
+
+      HTTP_QUERY_FLAG_COALESCE                = $10000000;
+
+
+      HTTP_QUERY_MODIFIER_FLAGS_MASK          = HTTP_QUERY_FLAG_REQUEST_HEADERS or
+                                                HTTP_QUERY_FLAG_SYSTEMTIME or
+                                                HTTP_QUERY_FLAG_NUMBER or
+                                                HTTP_QUERY_FLAG_COALESCE;
+
+
+      HTTP_QUERY_HEADER_MASK                  = (not HTTP_QUERY_MODIFIER_FLAGS_MASK);
+
+//
+// HTTP Response Status Codes:
+//
+
+      HTTP_STATUS_CONTINUE            = 100; // OK to continue with request
+      HTTP_STATUS_SWITCH_PROTOCOLS    = 101; // server has switched protocols in upgrade header
+
+      HTTP_STATUS_OK                  = 200; // request completed
+      HTTP_STATUS_CREATED             = 201; // object created, reason = new URI
+      HTTP_STATUS_ACCEPTED            = 202; // async completion (TBS)
+      HTTP_STATUS_PARTIAL             = 203; // partial completion
+      HTTP_STATUS_NO_CONTENT          = 204; // no info to return
+      HTTP_STATUS_RESET_CONTENT       = 205; // request completed, but clear form
+      HTTP_STATUS_PARTIAL_CONTENT     = 206; // partial GET furfilled
+
+      HTTP_STATUS_AMBIGUOUS           = 300; // server couldn't decide what to return
+      HTTP_STATUS_MOVED               = 301; // object permanently moved
+      HTTP_STATUS_REDIRECT            = 302; // object temporarily moved
+      HTTP_STATUS_REDIRECT_METHOD     = 303; // redirection w/ new access method
+      HTTP_STATUS_NOT_MODIFIED        = 304; // if-modified-since was not modified
+      HTTP_STATUS_USE_PROXY           = 305; // redirection to proxy, location header specifies proxy to use
+      HTTP_STATUS_REDIRECT_KEEP_VERB  = 307; // HTTP/1.1: keep same verb
+
+      HTTP_STATUS_BAD_REQUEST         = 400; // invalid syntax
+      HTTP_STATUS_DENIED              = 401; // access denied
+      HTTP_STATUS_PAYMENT_REQ         = 402; // payment required
+      HTTP_STATUS_FORBIDDEN           = 403; // request forbidden
+      HTTP_STATUS_NOT_FOUND           = 404; // object not found
+      HTTP_STATUS_BAD_METHOD          = 405; // method is not allowed
+      HTTP_STATUS_NONE_ACCEPTABLE     = 406; // no response acceptable to client found
+      HTTP_STATUS_PROXY_AUTH_REQ      = 407; // proxy authentication required
+      HTTP_STATUS_REQUEST_TIMEOUT     = 408; // server timed out waiting for request
+      HTTP_STATUS_CONFLICT            = 409; // user should resubmit with more info
+      HTTP_STATUS_GONE                = 410; // the resource is no longer available
+      HTTP_STATUS_LENGTH_REQUIRED     = 411; // the server refused to accept request w/o a length
+      HTTP_STATUS_PRECOND_FAILED      = 412; // precondition given in request failed
+      HTTP_STATUS_REQUEST_TOO_LARGE   = 413; // request entity was too large
+      HTTP_STATUS_URI_TOO_LONG        = 414; // request URI too long
+      HTTP_STATUS_UNSUPPORTED_MEDIA   = 415; // unsupported media type
+      HTTP_STATUS_RETRY_WITH          = 449; // retry after doing the appropriate action.
+
+      HTTP_STATUS_SERVER_ERROR        = 500; // internal server error
+      HTTP_STATUS_NOT_SUPPORTED       = 501; // required not supported
+      HTTP_STATUS_BAD_GATEWAY         = 502; // error response received from gateway
+      HTTP_STATUS_SERVICE_UNAVAIL     = 503; // temporarily overloaded
+      HTTP_STATUS_GATEWAY_TIMEOUT     = 504; // timed out waiting for gateway
+      HTTP_STATUS_VERSION_NOT_SUP     = 505; // HTTP version not supported
+
+      HTTP_STATUS_FIRST               = HTTP_STATUS_CONTINUE;
+      HTTP_STATUS_LAST                = HTTP_STATUS_VERSION_NOT_SUP;
+
+//
+// prototypes
+//
+
+function HttpOpenRequestA(hConnect:HINTERNET;
+										                lpszVerb:LPCSTR;
+										                lpszObjectName:LPCSTR;
+										                lpszVersion:LPCSTR;
+										                lpszReferrer:LPCSTR;
+										                lplpszAcceptTypes:PLPSTR;
+										                dwFlags:DWORD;
+										                dwContext:DWORD_PTR
+										               ):HINTERNET; external WinInetDLL name 'HttpOpenRequestA';
+
+function HttpOpenRequestW(hConnect:HINTERNET;
+										                lpszVerb:LPCWSTR;
+										                lpszObjectName:LPCWSTR;
+										                lpszVersion:LPCWSTR;
+										                lpszReferrer:LPCWSTR;
+										                lplpszAcceptTypes:PLPWSTR;
+										                dwFlags:DWORD;
+										                dwContext:DWORD_PTR
+										               ):HINTERNET; external WinInetDLL name 'HttpOpenRequestW';
+
+{$IFDEF UNICODE}
+function HttpOpenRequest(hConnect:HINTERNET;
+										               lpszVerb:LPCWSTR;
+                         lpszObjectName:LPCWSTR;
+                         lpszVersion:LPCWSTR;
+                         lpszReferrer:LPCWSTR;
+                         lplpszAcceptTypes:PLPWSTR;
+                         dwFlags:DWORD;
+                         dwContext:DWORD_PTR
+                        ):HINTERNET; external WinInetDLL name 'HttpOpenRequestW';
+{$ELSE UNICODE}
+function HttpOpenRequest(hConnect:HINTERNET;
+										               lpszVerb:LPCSTR;
+                         lpszObjectName:LPCSTR;
+                         lpszVersion:LPCSTR;
+                         lpszReferrer:LPCSTR;
+                         lplpszAcceptTypes:PLPSTR;
+                         dwFlags:DWORD;
+                         dwContext:DWORD_PTR
+                        ):HINTERNET; external WinInetDLL name 'HttpOpenRequestA';
+{$ENDIF UNICODE}
+
+function HttpAddRequestHeadersA(hRequest:HINTERNET;
+							                         lpszHeaders:LPCSTR;
+							                         dwHeadersLength:DWORD;
+							                         dwModifiers:DWORD
+							                        ):BOOL; external WinInetDLL name 'HttpAddRequestHeadersA';
+
+function HttpAddRequestHeadersW(hRequest:HINTERNET;
+							                         lpszHeaders:LPCWSTR;
+							                         dwHeadersLength:DWORD;
+							                         dwModifiers:DWORD
+							                        ):BOOL; external WinInetDLL name 'HttpAddRequestHeadersW';
+
+{$IFDEF UNICODE}
+function HttpAddRequestHeaders(hRequest:HINTERNET;
+							                        lpszHeaders:LPCWSTR;
+							                        dwHeadersLength:DWORD;
+							                        dwModifiers:DWORD
+							                       ):BOOL; external WinInetDLL name 'HttpAddRequestHeadersW';
+{$ELSE UNICODE}
+function HttpAddRequestHeaders(hRequest:HINTERNET;
+							                        lpszHeaders:LPCSTR;
+							                        dwHeadersLength:DWORD;
+							                        dwModifiers:DWORD
+							                       ):BOOL; external WinInetDLL name 'HttpAddRequestHeadersA';
+{$ENDIF UNICODE}
+
+//
+// values for dwModifiers parameter of HttpAddRequestHeaders()
+//
+const
+      HTTP_ADDREQ_INDEX_MASK      = $0000FFFF;
+      HTTP_ADDREQ_FLAGS_MASK      = $FFFF0000;
+
+//
+// HTTP_ADDREQ_FLAG_ADD_IF_NEW - the header will only be added if it doesn't
+// already exist
+//
+const
+      HTTP_ADDREQ_FLAG_ADD_IF_NEW = $10000000;
+
+//
+// HTTP_ADDREQ_FLAG_ADD - if HTTP_ADDREQ_FLAG_REPLACE is set but the header is
+// not found then if this flag is set, the header is added anyway, so long as
+// there is a valid header-value
+//
+const
+      HTTP_ADDREQ_FLAG_ADD        = $20000000;
+
+//
+// HTTP_ADDREQ_FLAG_COALESCE - coalesce headers with same name. e.g.
+// "Accept: text/*" and "Accept: audio/*" with this flag results in a single
+// header: "Accept: text/*, audio/*"
+//
+const
+      HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA       = $40000000;
+      HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON   = $01000000;
+      HTTP_ADDREQ_FLAG_COALESCE                  = HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA;
+
+//
+// HTTP_ADDREQ_FLAG_REPLACE - replaces the specified header. Only one header can
+// be supplied in the buffer. If the header to be replaced is not the first
+// in a list of headers with the same name, then the relative index should be
+// supplied in the low 8 bits of the dwModifiers parameter. If the header-value
+// part is missing, then the header is removed
+//
+const
+      HTTP_ADDREQ_FLAG_REPLACE    = $80000000;
+
+function HttpSendRequestA(hRequest:HINTERNET;
+						                    lpszHeaders:LPCSTR;
+						                    dwHeadersLength:DWORD;
+						                    lpOptional:LPVOID;
+						                    dwOptionalLength:DWORD
+						                   ):BOOL; external WinInetDLL name 'HttpSendRequestA';
+
+function HttpSendRequestW(hRequest:HINTERNET;
+						                    lpszHeaders:LPCWSTR;
+						                    dwHeadersLength:DWORD;
+						                    lpOptional:LPVOID;
+						                    dwOptionalLength:DWORD
+						                   ):BOOL; external WinInetDLL name 'HttpSendRequestW';
+
+{$IFDEF UNICODE}
+function HttpSendRequest(hRequest:HINTERNET;
+						                   lpszHeaders:LPCWSTR;
+						                   dwHeadersLength:DWORD;
+						                   lpOptional:LPVOID;
+						                   dwOptionalLength:DWORD
+						                  ):BOOL; external WinInetDLL name 'HttpSendRequestW';
+{$ELSE UNICODE}
+function HttpSendRequest(hRequest:HINTERNET;
+						                   lpszHeaders:LPCSTR;
+						                   dwHeadersLength:DWORD;
+						                   lpOptional:LPVOID;
+						                   dwOptionalLength:DWORD
+						                  ):BOOL; external WinInetDLL name 'HttpSendRequestA';
+{$ENDIF UNICODE}
+
+function HttpSendRequestExA(hRequest:HINTERNET;
+									                   lpBuffersIn:LPINTERNET_BUFFERSA;
+									                   lpBuffersOut:LPINTERNET_BUFFERSA;
+									                   dwFlags:DWORD;
+									                   dwContext:DWORD_PTR
+									                  ):BOOL; external WinInetDLL name 'HttpSendRequestExA';
+
+function HttpSendRequestExW(hRequest:HINTERNET;
+									                   lpBuffersIn:LPINTERNET_BUFFERSW;
+									                   lpBuffersOut:LPINTERNET_BUFFERSW;
+									                   dwFlags:DWORD;
+									                   dwContext:DWORD_PTR
+									                  ):BOOL; external WinInetDLL name 'HttpSendRequestExW';
+
+{$IFDEF UNICODE}
+function HttpSendRequestEx(hRequest:HINTERNET;
+									                  lpBuffersIn:LPINTERNET_BUFFERS;
+									                  lpBuffersOut:LPINTERNET_BUFFERS;
+									                  dwFlags:DWORD;
+									                  dwContext:DWORD_PTR
+									                 ):BOOL; external WinInetDLL name 'HttpSendRequestExW';
+{$ELSE UNICODE}
+function HttpSendRequestEx(hRequest:HINTERNET;
+									                  lpBuffersIn:LPINTERNET_BUFFERS;
+									                  lpBuffersOut:LPINTERNET_BUFFERS;
+									                  dwFlags:DWORD;
+									                  dwContext:DWORD_PTR
+									                 ):BOOL; external WinInetDLL name 'HttpSendRequestExA';
+{$ENDIF UNICODE}
+
+//
+// flags for HttpSendRequestEx(), HttpEndRequest()
+//
+const
+      HSR_ASYNC       = WININET_API_FLAG_ASYNC;          // force async
+      HSR_SYNC        = WININET_API_FLAG_SYNC;           // force sync
+      HSR_USE_CONTEXT = WININET_API_FLAG_USE_CONTEXT;    // use dwContext value
+      HSR_INITIATE    = $00000008;                      // iterative operation (completed by HttpEndRequest)
+      HSR_DOWNLOAD    = $00000010;                      // download to file
+      HSR_CHUNKED     = $00000020;                      // operation is send of chunked data
+
+function HttpEndRequestA(hRequest:HINTERNET;
+								                 lpBuffersOut:LPINTERNET_BUFFERSA;
+								                 dwFlags:DWORD;
+								                 dwContext:DWORD_PTR
+								                ):BOOL; external WinInetDLL name 'HttpEndRequestA';
+
+function HttpEndRequestW(hRequest:HINTERNET;
+								                 lpBuffersOut:LPINTERNET_BUFFERSW;
+								                 dwFlags:DWORD;
+								                 dwContext:DWORD_PTR
+								                ):BOOL; external WinInetDLL name 'HttpEndRequestW';
+
+{$IFDEF UNICODE}
+function HttpEndRequest(hRequest:HINTERNET;
+								                lpBuffersOut:LPINTERNET_BUFFERS;
+							                 dwFlags:DWORD;
+							                 dwContext:DWORD_PTR
+							                ):BOOL; external WinInetDLL name 'HttpEndRequestW';
+{$ELSE UNICODE}
+function HttpEndRequest(hRequest:HINTERNET;
+								                lpBuffersOut:LPINTERNET_BUFFERS;
+							                 dwFlags:DWORD;
+							                 dwContext:DWORD_PTR
+							                ):BOOL; external WinInetDLL name 'HttpEndRequestA';
+{$ENDIF UNICODE}
+
+function HttpQueryInfoA(hRequest:HINTERNET;
+					                   dwInfoLevel:DWORD;
+					                   lpBuffer:LPVOID;
+					                   lpdwBufferLength:LPDWORD;
+					                   lpdwIndex:LPDWORD
+					                  ):BOOL; external WinInetDLL name 'HttpQueryInfoA';
+
+function HttpQueryInfoW(hRequest:HINTERNET;
+					                   dwInfoLevel:DWORD;
+					                   lpBuffer:LPVOID;
+					                   lpdwBufferLength:LPDWORD;
+					                   lpdwIndex:LPDWORD
+					                  ):BOOL; external WinInetDLL name 'HttpQueryInfoW';
+
+{$IFDEF UNICODE}
+function HttpQueryInfo(hRequest:HINTERNET;
+					                  dwInfoLevel:DWORD;
+					                  lpBuffer:LPVOID;
+					                  lpdwBufferLength:LPDWORD;
+					                  lpdwIndex:LPDWORD
+					                 ):BOOL; external WinInetDLL name 'HttpQueryInfoW';
+{$ELSE UNICODE}
+function HttpQueryInfo(hRequest:HINTERNET;
+					                  dwInfoLevel:DWORD;
+					                  lpBuffer:LPVOID;
+					                  lpdwBufferLength:LPDWORD;
+					                  lpdwIndex:LPDWORD
+					                 ):BOOL; external WinInetDLL name 'HttpQueryInfoA';
+{$ENDIF UNICODE}
+
+
+//
+// Cookie APIs
+//
+const
+      INTERNET_COOKIE_IS_SECURE       = $01;
+      INTERNET_COOKIE_IS_SESSION      = $02;
+      INTERNET_COOKIE_THIRD_PARTY     = $10;
+      INTERNET_COOKIE_PROMPT_REQUIRED = $20;
+      INTERNET_COOKIE_EVALUATE_P3P    = $40;
+      INTERNET_COOKIE_APPLY_P3P       = $80;
+
+      INTERNET_COOKIE_P3P_ENABLED     = $100;
+      INTERNET_COOKIE_IS_RESTRICTED   = $200;
+      INTERNET_COOKIE_IE6             = $400;
+      INTERNET_COOKIE_IS_LEGACY       = $800;
+
+function InternetSetCookieA(lpszUrl:LPCSTR;
+						                      lpszCookieName:LPCSTR;
+						                      lpszCookieData:LPCSTR
+						                     ):BOOL; external WinInetDLL name 'InternetSetCookieA';
+
+function InternetSetCookieW(lpszUrl:LPCWSTR;
+						                      lpszCookieName:LPCWSTR;
+						                      lpszCookieData:LPCWSTR
+						                     ):BOOL; external WinInetDLL name 'InternetSetCookieW';
+
+{$IFDEF UNICODE}
+function InternetSetCookie(lpszUrl:LPCWSTR;
+						                     lpszCookieName:LPCWSTR;
+						                     lpszCookieData:LPCWSTR
+						                    ):BOOL; external WinInetDLL name 'InternetSetCookieW';
+{$ELSE UNICODE}
+function InternetSetCookie(lpszUrl:LPCSTR;
+						                     lpszCookieName:LPCSTR;
+						                     lpszCookieData:LPCSTR
+						                    ):BOOL; external WinInetDLL name 'InternetSetCookieA';
+{$ENDIF UNICODE}
+
+function InternetGetCookieA(lpszUrl:LPCSTR;
+						                      lpszCookieName:LPCSTR;
+						                      lpCookieData:LPCSTR;
+						                      lpdwSize:LPDWORD
+						                     ):BOOL; external WinInetDLL name 'InternetGetCookieA';
+
+function InternetGetCookieW(lpszUrl:LPCWSTR;
+						                      lpszCookieName:LPCWSTR;
+						                      lpCookieData:LPCWSTR;
+						                      lpdwSize:LPDWORD
+						                     ):BOOL; external WinInetDLL name 'InternetGetCookieW';
+
+{$IFDEF UNICODE}
+function InternetGetCookie(lpszUrl:LPCWSTR;
+						                     lpszCookieName:LPCWSTR;
+						                     lpCookieData:LPCWSTR;
+						                     lpdwSize:LPDWORD
+						                    ):BOOL; external WinInetDLL name 'InternetGetCookieW';
+{$ELSE UNICODE}
+function InternetGetCookie(lpszUrl:LPCSTR;
+						                     lpszCookieName:LPCSTR;
+						                     lpCookieData:LPCSTR;
+						                     lpdwSize:LPDWORD
+						                    ):BOOL; external WinInetDLL name 'InternetGetCookieA';
+{$ENDIF UNICODE}
+
+function InternetSetCookieExA(lpszUrl:LPCSTR;
+										                    lpszCookieName:LPCSTR;
+										                    lpszCookieData:LPCSTR;
+										                    dwFlags:DWORD;
+										                    dwReserved:DWORD_PTR
+										                   ):DWORD; external WinInetDLL name 'InternetSetCookieExA';
+
+function InternetSetCookieExW(lpszUrl:LPCWSTR;
+										                    lpszCookieName:LPCWSTR;
+										                    lpszCookieData:LPCWSTR;
+										                    dwFlags:DWORD;
+										                    dwReserved:DWORD_PTR
+										                   ):DWORD; external WinInetDLL name 'InternetSetCookieExW';
+
+{$IFDEF UNICODE}
+function InternetSetCookieEx(lpszUrl:LPCWSTR;
+										                   lpszCookieName:LPCWSTR;
+										                   lpszCookieData:LPCWSTR;
+										                   dwFlags:DWORD;
+										                   dwReserved:DWORD_PTR
+										                  ):DWORD; external WinInetDLL name 'InternetSetCookieExW';
+{$ELSE UNICODE}
+function InternetSetCookieEx(lpszUrl:LPCSTR;
+										                   lpszCookieName:LPCSTR;
+										                   lpszCookieData:LPCSTR;
+										                   dwFlags:DWORD;
+										                   dwReserved:DWORD_PTR
+										                  ):DWORD; external WinInetDLL name 'InternetSetCookieExA';
+{$ENDIF UNICODE}
+
+
+//
+// offline browsing
+//
+
+function InternetAttemptConnect(dwReserved:DWORD):DWORD; external WinInetDLL name 'InternetAttemptConnect';
+
+function InternetCheckConnectionA(lpszUrl:LPCSTR;
+								                          dwFlags:DWORD;
+								                          dwReserved:DWORD
+								                         ):BOOL; external WinInetDLL name 'InternetCheckConnectionA';
+
+function InternetCheckConnectionW(lpszUrl:LPCWSTR;
+								                          dwFlags:DWORD;
+								                          dwReserved:DWORD
+								                         ):BOOL; external WinInetDLL name 'InternetCheckConnectionW';
+
+{$IFDEF UNICODE}
+function InternetCheckConnection(lpszUrl:LPCWSTR;
+								                         dwFlags:DWORD;
+								                         dwReserved:DWORD
+								                        ):BOOL; external WinInetDLL name 'InternetCheckConnectionW';
+{$ELSE UNICODE}
+function InternetCheckConnection(lpszUrl:LPCSTR;
+								                         dwFlags:DWORD;
+								                         dwReserved:DWORD
+								                        ):BOOL; external WinInetDLL name 'InternetCheckConnectionA';
+{$ENDIF UNICODE}
+
+const
+      FLAG_ICC_FORCE_CONNECTION       = $00000001;
+
+//
+// Internet UI
+//
+
+//
+// InternetErrorDlg - Provides UI for certain Errors.
+//
+const
+      FLAGS_ERROR_UI_FILTER_FOR_ERRORS        = $01;
+      FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS     = $02;
+      FLAGS_ERROR_UI_FLAGS_GENERATE_DATA      = $04;
+      FLAGS_ERROR_UI_FLAGS_NO_UI              = $08;
+      FLAGS_ERROR_UI_SERIALIZE_DIALOGS        = $10;
+
+//
+// If SERIALIZE_DIALOGS flag set, client should implement thread-safe non-blocking callback...
+//
+
+type
+     PFN_AUTH_NOTIFY = function(dwContext:DWORD_PTR; // as passed to InternetErrorDlg
+                                dwReturn:DWORD;      // error code: success, resend, or cancel
+                                lpResrved:LPVOID     // reserved: will be set to null
+                               ):DWORD; cdecl;
+
+//
+// ... and last parameter of InternetErrorDlg should point to...
+//
+
+type
+     INTERNET_AUTH_NOTIFY_DATA = record
+       cbStruct:DWORD;	  // size of this structure
+	      dwOptions:DWORD;	  // reserved: must set to 0
+	      pfnNotify:PFN_AUTH_NOTIFY;	  // notification callback to retry InternetErrorDlg
+       dwContext:DWORD_PTR;	  // context to pass to to notification function
+     end;
+
+
+function ResumeSuspendedDownload(hRequest:HINTERNET;
+										                       dwResultCode:DWORD
+										                      ):BOOL; external WinInetDLL name 'ResumeSuspendedDownload';
+
+function InternetErrorDlg(_hWnd:HWND;
+									                 hRequest:HINTERNET;
+									                 dwError:DWORD;
+									                 dwFlags:DWORD;
+									                 lppvData:PPVOID
+									                ):DWORD; external WinInetDLL name 'InternetErrorDlg';
+
+function InternetConfirmZoneCrossingA(_hWnd:HWND;
+												                          szUrlPrev:LPSTR;
+												                          szUrlNew:LPSTR;
+												                          bPost:BOOL
+												                         ):DWORD; external WinInetDLL name 'InternetConfirmZoneCrossingA';
+
+function InternetConfirmZoneCrossingW(_hWnd:HWND;
+												                          szUrlPrev:LPWSTR;
+												                          szUrlNew:LPWSTR;
+												                          bPost:BOOL
+												                         ):DWORD; external WinInetDLL name 'InternetConfirmZoneCrossingW';
+
+{$IFDEF UNICODE}
+function InternetConfirmZoneCrossing(_hWnd:HWND;
+												                         szUrlPrev:LPWSTR;
+												                         szUrlNew:LPWSTR;
+												                         bPost:BOOL
+												                        ):DWORD; external WinInetDLL name 'InternetConfirmZoneCrossingW';
+{$ELSE UNICODE}
+{$IFDEF WINX32}
+function InternetConfirmZoneCrossing(_hWnd:HWND;
+												                         szUrlPrev:LPSTR;
+												                         szUrlNew:LPSTR;
+												                         bPost:BOOL
+												                        ):DWORD; external WinInetDLL name 'InternetConfirmZoneCrossingA';
+{$ELSE WINX32}
+function InternetConfirmZoneCrossing(_hWnd:HWND;
+												                         szUrlPrev:LPSTR;
+												                         szUrlNew:LPSTR;
+												                         bPost:BOOL
+												                        ):DWORD; external WinInetDLL name 'InternetConfirmZoneCrossing';
+{$ENDIF WINX32}
+{$ENDIF UNICODE}
+
+//
+// Internet API error returns
+//
+const
+      INTERNET_ERROR_BASE                     = 12000;
+
+      ERROR_INTERNET_OUT_OF_HANDLES           = INTERNET_ERROR_BASE + 1;
+      ERROR_INTERNET_TIMEOUT                  = INTERNET_ERROR_BASE + 2;
+      ERROR_INTERNET_EXTENDED_ERROR           = INTERNET_ERROR_BASE + 3;
+      ERROR_INTERNET_INTERNAL_ERROR           = INTERNET_ERROR_BASE + 4;
+      ERROR_INTERNET_INVALID_URL              = INTERNET_ERROR_BASE + 5;
+      ERROR_INTERNET_UNRECOGNIZED_SCHEME      = INTERNET_ERROR_BASE + 6;
+      ERROR_INTERNET_NAME_NOT_RESOLVED        = INTERNET_ERROR_BASE + 7;
+      ERROR_INTERNET_PROTOCOL_NOT_FOUND       = INTERNET_ERROR_BASE + 8;
+      ERROR_INTERNET_INVALID_OPTION           = INTERNET_ERROR_BASE + 9;
+      ERROR_INTERNET_BAD_OPTION_LENGTH        = INTERNET_ERROR_BASE + 10;
+      ERROR_INTERNET_OPTION_NOT_SETTABLE      = INTERNET_ERROR_BASE + 11;
+      ERROR_INTERNET_SHUTDOWN                 = INTERNET_ERROR_BASE + 12;
+      ERROR_INTERNET_INCORRECT_USER_NAME      = INTERNET_ERROR_BASE + 13;
+      ERROR_INTERNET_INCORRECT_PASSWORD       = INTERNET_ERROR_BASE + 14;
+      ERROR_INTERNET_LOGIN_FAILURE            = INTERNET_ERROR_BASE + 15;
+      ERROR_INTERNET_INVALID_OPERATION        = INTERNET_ERROR_BASE + 16;
+      ERROR_INTERNET_OPERATION_CANCELLED      = INTERNET_ERROR_BASE + 17;
+      ERROR_INTERNET_INCORRECT_HANDLE_TYPE    = INTERNET_ERROR_BASE + 18;
+      ERROR_INTERNET_INCORRECT_HANDLE_STATE   = INTERNET_ERROR_BASE + 19;
+      ERROR_INTERNET_NOT_PROXY_REQUEST        = INTERNET_ERROR_BASE + 20;
+      ERROR_INTERNET_REGISTRY_VALUE_NOT_FOUND = INTERNET_ERROR_BASE + 21;
+      ERROR_INTERNET_BAD_REGISTRY_PARAMETER   = INTERNET_ERROR_BASE + 22;
+      ERROR_INTERNET_NO_DIRECT_ACCESS         = INTERNET_ERROR_BASE + 23;
+      ERROR_INTERNET_NO_CONTEXT               = INTERNET_ERROR_BASE + 24;
+      ERROR_INTERNET_NO_CALLBACK              = INTERNET_ERROR_BASE + 25;
+      ERROR_INTERNET_REQUEST_PENDING          = INTERNET_ERROR_BASE + 26;
+      ERROR_INTERNET_INCORRECT_FORMAT         = INTERNET_ERROR_BASE + 27;
+      ERROR_INTERNET_ITEM_NOT_FOUND           = INTERNET_ERROR_BASE + 28;
+      ERROR_INTERNET_CANNOT_CONNECT           = INTERNET_ERROR_BASE + 29;
+      ERROR_INTERNET_CONNECTION_ABORTED       = INTERNET_ERROR_BASE + 30;
+      ERROR_INTERNET_CONNECTION_RESET         = INTERNET_ERROR_BASE + 31;
+      ERROR_INTERNET_FORCE_RETRY              = INTERNET_ERROR_BASE + 32;
+      ERROR_INTERNET_INVALID_PROXY_REQUEST    = INTERNET_ERROR_BASE + 33;
+      ERROR_INTERNET_NEED_UI                  = INTERNET_ERROR_BASE + 34;
+
+      ERROR_INTERNET_HANDLE_EXISTS            = INTERNET_ERROR_BASE + 36;
+      ERROR_INTERNET_SEC_CERT_DATE_INVALID    = INTERNET_ERROR_BASE + 37;
+      ERROR_INTERNET_SEC_CERT_CN_INVALID      = INTERNET_ERROR_BASE + 38;
+      ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR   = INTERNET_ERROR_BASE + 39;
+      ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR   = INTERNET_ERROR_BASE + 40;
+      ERROR_INTERNET_MIXED_SECURITY           = INTERNET_ERROR_BASE + 41;
+      ERROR_INTERNET_CHG_POST_IS_NON_SECURE   = INTERNET_ERROR_BASE + 42;
+      ERROR_INTERNET_POST_IS_NON_SECURE       = INTERNET_ERROR_BASE + 43;
+      ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED  = INTERNET_ERROR_BASE + 44;
+      ERROR_INTERNET_INVALID_CA               = INTERNET_ERROR_BASE + 45;
+      ERROR_INTERNET_CLIENT_AUTH_NOT_SETUP    = INTERNET_ERROR_BASE + 46;
+      ERROR_INTERNET_ASYNC_THREAD_FAILED      = INTERNET_ERROR_BASE + 47;
+      ERROR_INTERNET_REDIRECT_SCHEME_CHANGE   = INTERNET_ERROR_BASE + 48;
+      ERROR_INTERNET_DIALOG_PENDING           = INTERNET_ERROR_BASE + 49;
+      ERROR_INTERNET_RETRY_DIALOG             = INTERNET_ERROR_BASE + 50;
+      ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR  = INTERNET_ERROR_BASE + 52;
+      ERROR_INTERNET_INSERT_CDROM             = INTERNET_ERROR_BASE + 53;
+      ERROR_INTERNET_FORTEZZA_LOGIN_NEEDED    = INTERNET_ERROR_BASE + 54;
+      ERROR_INTERNET_SEC_CERT_ERRORS          = INTERNET_ERROR_BASE + 55;
+      ERROR_INTERNET_SEC_CERT_NO_REV          = INTERNET_ERROR_BASE + 56;
+      ERROR_INTERNET_SEC_CERT_REV_FAILED      = INTERNET_ERROR_BASE + 57;
+
+//
+// FTP API errors
+//
+const
+      ERROR_FTP_TRANSFER_IN_PROGRESS          = INTERNET_ERROR_BASE + 110;
+      ERROR_FTP_DROPPED                       = INTERNET_ERROR_BASE + 111;
+      ERROR_FTP_NO_PASSIVE_MODE               = INTERNET_ERROR_BASE + 112;
+
+//
+// gopher API errors
+//
+const
+      ERROR_GOPHER_PROTOCOL_ERROR             = INTERNET_ERROR_BASE + 130;
+      ERROR_GOPHER_NOT_FILE                   = INTERNET_ERROR_BASE + 131;
+      ERROR_GOPHER_DATA_ERROR                 = INTERNET_ERROR_BASE + 132;
+      ERROR_GOPHER_END_OF_DATA                = INTERNET_ERROR_BASE + 133;
+      ERROR_GOPHER_INVALID_LOCATOR            = INTERNET_ERROR_BASE + 134;
+      ERROR_GOPHER_INCORRECT_LOCATOR_TYPE     = INTERNET_ERROR_BASE + 135;
+      ERROR_GOPHER_NOT_GOPHER_PLUS            = INTERNET_ERROR_BASE + 136;
+      ERROR_GOPHER_ATTRIBUTE_NOT_FOUND        = INTERNET_ERROR_BASE + 137;
+      ERROR_GOPHER_UNKNOWN_LOCATOR            = INTERNET_ERROR_BASE + 138;
+
+//
+// HTTP API errors
+//
+const
+      ERROR_HTTP_HEADER_NOT_FOUND             = INTERNET_ERROR_BASE + 150;
+      ERROR_HTTP_DOWNLEVEL_SERVER             = INTERNET_ERROR_BASE + 151;
+      ERROR_HTTP_INVALID_SERVER_RESPONSE      = INTERNET_ERROR_BASE + 152;
+      ERROR_HTTP_INVALID_HEADER               = INTERNET_ERROR_BASE + 153;
+      ERROR_HTTP_INVALID_QUERY_REQUEST        = INTERNET_ERROR_BASE + 154;
+      ERROR_HTTP_HEADER_ALREADY_EXISTS        = INTERNET_ERROR_BASE + 155;
+      ERROR_HTTP_REDIRECT_FAILED              = INTERNET_ERROR_BASE + 156;
+      ERROR_HTTP_NOT_REDIRECTED               = INTERNET_ERROR_BASE + 160;
+      ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION    = INTERNET_ERROR_BASE + 161;
+      ERROR_HTTP_COOKIE_DECLINED              = INTERNET_ERROR_BASE + 162;
+      ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION  = INTERNET_ERROR_BASE + 168;
+
+//
+// additional Internet API error codes
+//
+const
+      ERROR_INTERNET_SECURITY_CHANNEL_ERROR   = INTERNET_ERROR_BASE + 157;
+      ERROR_INTERNET_UNABLE_TO_CACHE_FILE     = INTERNET_ERROR_BASE + 158;
+      ERROR_INTERNET_TCPIP_NOT_INSTALLED      = INTERNET_ERROR_BASE + 159;
+      ERROR_INTERNET_DISCONNECTED             = INTERNET_ERROR_BASE + 163;
+      ERROR_INTERNET_SERVER_UNREACHABLE       = INTERNET_ERROR_BASE + 164;
+      ERROR_INTERNET_PROXY_SERVER_UNREACHABLE = INTERNET_ERROR_BASE + 165;
+
+      ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT    = INTERNET_ERROR_BASE + 166;
+      ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT = INTERNET_ERROR_BASE + 167;
+      ERROR_INTERNET_SEC_INVALID_CERT         = INTERNET_ERROR_BASE + 169;
+      ERROR_INTERNET_SEC_CERT_REVOKED         = INTERNET_ERROR_BASE + 170;
+
+// InternetAutodial specific errors
+const
+      ERROR_INTERNET_FAILED_DUETOSECURITYCHECK  = INTERNET_ERROR_BASE + 171;
+      ERROR_INTERNET_NOT_INITIALIZED            = INTERNET_ERROR_BASE + 172;
+      ERROR_INTERNET_NEED_MSN_SSPI_PKG          = INTERNET_ERROR_BASE + 173;
+      ERROR_INTERNET_LOGIN_FAILURE_DISPLAY_ENTITY_BODY   = INTERNET_ERROR_BASE + 174;
+
+
+      INTERNET_ERROR_LAST                     = ERROR_INTERNET_LOGIN_FAILURE_DISPLAY_ENTITY_BODY;
+
+
+//
+// URLCACHE APIs
+//
+
+//
+// datatype definitions.
+//
+
+//
+// cache entry type flags.
+//
+const
+      NORMAL_CACHE_ENTRY              = $00000001;
+      STICKY_CACHE_ENTRY              = $00000004;
+      EDITED_CACHE_ENTRY              = $00000008;
+      TRACK_OFFLINE_CACHE_ENTRY       = $00000010;
+      TRACK_ONLINE_CACHE_ENTRY        = $00000020;
+      SPARSE_CACHE_ENTRY              = $00010000;
+      COOKIE_CACHE_ENTRY              = $00100000;
+      URLHISTORY_CACHE_ENTRY          = $00200000;
+
+
+      URLCACHE_FIND_DEFAULT_FILTER    = NORMAL_CACHE_ENTRY or
+                                        COOKIE_CACHE_ENTRY or
+                                        URLHISTORY_CACHE_ENTRY or
+                                        TRACK_OFFLINE_CACHE_ENTRY or
+                                        TRACK_ONLINE_CACHE_ENTRY or       
+                                        STICKY_CACHE_ENTRY;
+
+
+
+//
+// INTERNET_CACHE_ENTRY_INFO -
+//
+
+type
+     _INTERNET_CACHE_ENTRY_INFOA = record
+	      dwStructSize:DWORD;			// version of cache system.
+	      lpszSourceUrlName:LPSTR;	  // embedded pointer to the URL name string.
+	      lpszLocalFileName:LPSTR;	// embedded pointer to the local file name.
+	      CacheEntryType:DWORD;		// cache type bit mask.
+	      dwUseCount:DWORD;			// current users count of the cache entry.
+	      dwHitRate:DWORD;			// num of times the cache entry was retrieved.
+	      dwSizeLow:DWORD;			// low DWORD of the file size.
+	      dwSizeHigh:DWORD;			// high DWORD of the file size.
+	      LastModifiedTime:FILETIME;	// last modified time of the file in GMT format.
+	      ExpireTime:FILETIME;		// expire time of the file in GMT format
+	      LastAccessTime:FILETIME;	// last accessed time in GMT format
+	      LastSyncTime:FILETIME;		// last time the URL was synchronized with the source
+	      lpHeaderInfo:LPSTR;		 // embedded pointer to the header info.
+	      dwHeaderInfoSize:DWORD;		// size of the above header.
+	      lpszFileExtension:LPSTR;	// File extension used to retrive the urldata as a file.
+       case longint of // Exemption delta from last access time.
+		       0: (dwReserved:DWORD);
+         1: (dwExemptDelta:DWORD);
+     end;
+     INTERNET_CACHE_ENTRY_INFOA = _INTERNET_CACHE_ENTRY_INFOA;
+     LPINTERNET_CACHE_ENTRY_INFOA = ^_INTERNET_CACHE_ENTRY_INFOA;
+
+     _INTERNET_CACHE_ENTRY_INFOW = record
+	      dwStructSize:DWORD;			// version of cache system.
+	      lpszSourceUrlName:LPWSTR;	  // embedded pointer to the URL name string.
+	      lpszLocalFileName:LPWSTR;	// embedded pointer to the local file name.
+	      CacheEntryType:DWORD;		// cache type bit mask.
+	      dwUseCount:DWORD;			// current users count of the cache entry.
+	      dwHitRate:DWORD;			// num of times the cache entry was retrieved.
+	      dwSizeLow:DWORD;			// low DWORD of the file size.
+	      dwSizeHigh:DWORD;			// high DWORD of the file size.
+	      LastModifiedTime:FILETIME;	// last modified time of the file in GMT format.
+	      ExpireTime:FILETIME;		// expire time of the file in GMT format
+	      LastAccessTime:FILETIME;	// last accessed time in GMT format
+	      LastSyncTime:FILETIME;		// last time the URL was synchronized with the source
+	      lpHeaderInfo:LPWSTR;		 // embedded pointer to the header info.
+	      dwHeaderInfoSize:DWORD;		// size of the above header.
+	      lpszFileExtension:LPWSTR;	// File extension used to retrive the urldata as a file.
+       case longint of // Exemption delta from last access time.
+		       0: (dwReserved:DWORD);
+         1: (dwExemptDelta:DWORD);
+     end;
+     INTERNET_CACHE_ENTRY_INFOW = _INTERNET_CACHE_ENTRY_INFOW;
+     LPINTERNET_CACHE_ENTRY_INFOW = ^_INTERNET_CACHE_ENTRY_INFOW;
+
+{$IFDEF UNICODE}
+type
+     INTERNET_CACHE_ENTRY_INFO = INTERNET_CACHE_ENTRY_INFOW;
+     LPINTERNET_CACHE_ENTRY_INFO = LPINTERNET_CACHE_ENTRY_INFOW;
+{$ELSE UNICODE}
+type
+     INTERNET_CACHE_ENTRY_INFO = INTERNET_CACHE_ENTRY_INFOA;
+     LPINTERNET_CACHE_ENTRY_INFO = LPINTERNET_CACHE_ENTRY_INFOA;
+{$ENDIF UNICODE}
+
+type
+     _INTERNET_CACHE_TIMESTAMPS = record
+       ftExpires:FILETIME;
+	      ftLastModified:FILETIME;
+     end;
+     INTERNET_CACHE_TIMESTAMPS = _INTERNET_CACHE_TIMESTAMPS;
+     LPINTERNET_CACHE_TIMESTAMPS = ^_INTERNET_CACHE_TIMESTAMPS;
+
+
+
+//
+// Cache Group
+//
+type
+     GROUPID = LONGLONG;
+     LPGROUPID = ^GROUPID;
+
+
+//
+// Cache Group Flags
+//
+const
+      CACHEGROUP_ATTRIBUTE_GET_ALL        = $ffffffff;
+      CACHEGROUP_ATTRIBUTE_BASIC          = $00000001;
+      CACHEGROUP_ATTRIBUTE_FLAG           = $00000002;
+      CACHEGROUP_ATTRIBUTE_TYPE           = $00000004;
+      CACHEGROUP_ATTRIBUTE_QUOTA          = $00000008;
+      CACHEGROUP_ATTRIBUTE_GROUPNAME      = $00000010;
+      CACHEGROUP_ATTRIBUTE_STORAGE        = $00000020;
+
+      CACHEGROUP_FLAG_NONPURGEABLE        = $00000001;
+      CACHEGROUP_FLAG_GIDONLY             = $00000004;
+
+      CACHEGROUP_FLAG_FLUSHURL_ONDELETE   = $00000002;
+
+      CACHEGROUP_SEARCH_ALL               = $00000000;
+      CACHEGROUP_SEARCH_BYURL             = $00000001;
+
+      CACHEGROUP_TYPE_INVALID             = $00000001;
+
+
+//
+// updatable cache group fields
+//
+const
+      CACHEGROUP_READWRITE_MASK = CACHEGROUP_ATTRIBUTE_TYPE or
+                                  CACHEGROUP_ATTRIBUTE_QUOTA or
+                                  CACHEGROUP_ATTRIBUTE_GROUPNAME or
+                                  CACHEGROUP_ATTRIBUTE_STORAGE;
+
+//
+// INTERNET_CACHE_GROUP_INFO
+//
+const
+       GROUPNAME_MAX_LENGTH       = 120;
+       GROUP_OWNER_STORAGE_SIZE   = 4;
+
+type
+     _INTERNET_CACHE_GROUP_INFOA = record
+       dwGroupSize:DWORD;
+	      dwGroupFlags:DWORD;
+	      dwGroupType:DWORD;
+	      dwDiskUsage:DWORD;	// in KB
+	      dwDiskQuota:DWORD;	// in KB
+	      dwOwnerStorage:array[0..GROUP_OWNER_STORAGE_SIZE-1] of DWORD;
+	      szGroupName:array[0..GROUPNAME_MAX_LENGTH-1] of char;
+     end;
+     INTERNET_CACHE_GROUP_INFOA = _INTERNET_CACHE_GROUP_INFOA;
+     LPINTERNET_CACHE_GROUP_INFOA = ^INTERNET_CACHE_GROUP_INFOA;
+
+     _INTERNET_CACHE_GROUP_INFOW = record
+       dwGroupSize:DWORD;
+	      dwGroupFlags:DWORD;
+	      dwGroupType:DWORD;
+	      dwDiskUsage:DWORD;	// in KB
+	      dwDiskQuota:DWORD;	// in KB
+	      dwOwnerStorage:array[0..GROUP_OWNER_STORAGE_SIZE-1] of DWORD;
+	      szGroupName:array[0..GROUPNAME_MAX_LENGTH-1] of WCHAR;
+     end;
+     INTERNET_CACHE_GROUP_INFOW = _INTERNET_CACHE_GROUP_INFOW;
+     LPINTERNET_CACHE_GROUP_INFOW = ^INTERNET_CACHE_GROUP_INFOW;
+
+
+{$IFDEF UNICODE}
+type
+     INTERNET_CACHE_GROUP_INFO = INTERNET_CACHE_GROUP_INFOW;
+     LPINTERNET_CACHE_GROUP_INFO = LPINTERNET_CACHE_GROUP_INFOW;
+{$ELSE UNICODE}
+type
+     INTERNET_CACHE_GROUP_INFO = INTERNET_CACHE_GROUP_INFOA;
+     LPINTERNET_CACHE_GROUP_INFO = LPINTERNET_CACHE_GROUP_INFOA;
+{$ENDIF UNICODE}
+
+
+//
+// Cache APIs
+//
+
+function CreateUrlCacheEntryA(lpszUrlName:LPCSTR;
+							                       dwExpectedFileSize:DWORD;
+							                       lpszFileExtension:LPCSTR;
+							                       lpszFileName:LPSTR;
+							                       dwReserved:DWORD
+							                      ):BOOL; external WinInetDLL name 'CreateUrlCacheEntryA';
+
+function CreateUrlCacheEntryW(lpszUrlName:LPCWSTR;
+							                       dwExpectedFileSize:DWORD;
+							                       lpszFileExtension:LPCWSTR;
+							                       lpszFileName:LPWSTR;
+							                       dwReserved:DWORD
+							                      ):BOOL; external WinInetDLL name 'CreateUrlCacheEntryW';
+
+{$IFDEF UNICODE}
+function CreateUrlCacheEntry(lpszUrlName:LPCWSTR;
+							                      dwExpectedFileSize:DWORD;
+							                      lpszFileExtension:LPCWSTR;
+							                      lpszFileName:LPWSTR;
+							                      dwReserved:DWORD
+							                     ):BOOL; external WinInetDLL name 'CreateUrlCacheEntryW';
+{$ELSE UNICODE}
+function CreateUrlCacheEntry(lpszUrlName:LPCSTR;
+							                      dwExpectedFileSize:DWORD;
+							                      lpszFileExtension:LPCSTR;
+							                      lpszFileName:LPSTR;
+							                      dwReserved:DWORD
+							                     ):BOOL; external WinInetDLL name 'CreateUrlCacheEntryA';
+{$ENDIF UNICODE}
+
+{$IFNDEF USE_FIXED_COMMIT_URL_CACHE_ENTRY}
+// Temporary state of affairs until we reconcile our apis.
+
+// Why are we doing this? HeaderInfo _should_ be string data.
+// However, one group is passing binary data instead. For the
+// unicode api, we've decided to disallow this, but this
+// brings up an inconsistency between the u and a apis, which
+// is undesirable.
+
+// For Beta 1, we'll go with this behaviour, but in future releases
+// we want to make these apis consistent.
+
+function CommitUrlCacheEntryA(lpszUrlName:LPCSTR;
+							                       lpszLocalFileName:LPCSTR;
+							                       ExpireTime:FILETIME;
+                              LastModifiedTime:FILETIME;
+							                       CacheEntryType:DWORD;
+							                       lpHeaderInfo:LPBYTE;
+							                       dwHeaderSize:DWORD;
+							                       lpszFileExtension:LPCSTR;
+							                       lpszOriginalUrl:LPCSTR
+							                      ):BOOL; external WinInetDLL name 'CommitUrlCacheEntryA';
+
+function CommitUrlCacheEntryW(lpszUrlName:LPCWSTR;
+							                       lpszLocalFileName:LPCWSTR;
+							                       ExpireTime:FILETIME;
+                              LastModifiedTime:FILETIME;
+							                       CacheEntryType:DWORD;
+							                       lpHeaderInfo:LPWSTR;
+							                       dwHeaderSize:DWORD;
+							                       lpszFileExtension:LPCWSTR;
+							                       lpszOriginalUrl:LPCWSTR
+							                      ):BOOL; external WinInetDLL name 'CommitUrlCacheEntryW';
+
+{$IFDEF UNICODE}
+function CommitUrlCacheEntry(lpszUrlName:LPCWSTR;
+                             lpszLocalFileName:LPCWSTR;
+                             ExpireTime:FILETIME;
+                             LastModifiedTime:FILETIME;
+                             CacheEntryType:DWORD;
+                             lpHeaderInfo:LPWSTR;
+                             dwHeaderSize:DWORD;
+                             lpszFileExtension:LPCWSTR;
+                             lpszOriginalUrl:LPCWSTR
+                            ):BOOL; external WinInetDLL name 'CommitUrlCacheEntryW';
+{$ELSE UNICODE}
+function CommitUrlCacheEntry(lpszUrlName:LPCSTR;
+                             lpszLocalFileName:LPCSTR;
+                             ExpireTime:FILETIME;
+                             LastModifiedTime:FILETIME;
+                             CacheEntryType:DWORD;
+                             lpHeaderInfo:LPBYTE;
+                             dwHeaderSize:DWORD;
+                             lpszFileExtension:LPCSTR;
+                             lpszOriginalUrl:LPCSTR
+                            ):BOOL; external WinInetDLL name 'CommitUrlCacheEntryA';
+{$ENDIF UNICODE}
+{$ELSE USE_FIXED_COMMIT_URL_CACHE_ENTRY}
+function CommitUrlCacheEntryA(lpszUrlName:LPCSTR;
+							                       lpszLocalFileName:LPCSTR;
+							                       ExpireTime:FILETIME;
+                              LastModifiedTime:FILETIME;
+							                       CacheEntryType:DWORD;
+							                       lpHeaderInfo:LPCSTR;
+							                       dwHeaderSize:DWORD;
+							                       lpszFileExtension:LPCSTR;
+							                       lpszOriginalUrl:LPCSTR
+							                      ):BOOL; external WinInetDLL name 'CommitUrlCacheEntryA';
+
+function CommitUrlCacheEntryW(lpszUrlName:LPCWSTR;
+							                       lpszLocalFileName:LPCWSTR;
+							                       ExpireTime:FILETIME;
+                              LastModifiedTime:FILETIME;
+							                       CacheEntryType:DWORD;
+							                       lpHeaderInfo:LPCWSTR;
+							                       dwHeaderSize:DWORD;
+							                       lpszFileExtension:LPCWSTR;
+							                       lpszOriginalUrl:LPCWSTR
+							                      ):BOOL; external WinInetDLL name 'CommitUrlCacheEntryW';
+
+{$IFDEF UNICODE}
+function CommitUrlCacheEntry(lpszUrlName:LPCWSTR;
+                             lpszLocalFileName:LPCWSTR;
+                             ExpireTime:FILETIME;
+                             LastModifiedTime:FILETIME;
+                             CacheEntryType:DWORD;
+                             lpHeaderInfo:LPCWSTR;
+                             dwHeaderSize:DWORD;
+                             lpszFileExtension:LPCWSTR;
+                             lpszOriginalUrl:LPCWSTR
+                            ):BOOL; external WinInetDLL name 'CommitUrlCacheEntryW';
+{$ELSE UNICODE}
+function CommitUrlCacheEntry(lpszUrlName:LPCSTR;
+                             lpszLocalFileName:LPCSTR;
+                             ExpireTime:FILETIME;
+                             LastModifiedTime:FILETIME;
+                             CacheEntryType:DWORD;
+                             lpHeaderInfo:LPCSTR;
+                             dwHeaderSize:DWORD;
+                             lpszFileExtension:LPCSTR;
+                             lpszOriginalUrl:LPCSTR
+                            ):BOOL; external WinInetDLL name 'CommitUrlCacheEntryA';
+{$ENDIF UNICODE}
+{$ENDIF USE_FIXED_COMMIT_URL_CACHE_ENTRY}
+
+function RetrieveUrlCacheEntryFileA(lpszUrlName:LPCSTR;
+								                            lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+								                            lpdwCacheEntryInfoBufferSize:LPDWORD;
+								                            dwReserved:DWORD
+								                           ):BOOL; external WinInetDLL name 'RetrieveUrlCacheEntryFileA';
+
+function RetrieveUrlCacheEntryFileW(lpszUrlName:LPCWSTR;
+								                            lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+								                            lpdwCacheEntryInfoBufferSize:LPDWORD;
+								                            dwReserved:DWORD
+								                           ):BOOL; external WinInetDLL name 'RetrieveUrlCacheEntryFileW';
+
+{$IFDEF UNICODE}
+function RetrieveUrlCacheEntryFile(lpszUrlName:LPCWSTR;
+								                           lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+								                           lpdwCacheEntryInfoBufferSize:LPDWORD;
+								                           dwReserved:DWORD
+								                          ):BOOL; external WinInetDLL name 'RetrieveUrlCacheEntryFileW';
+{$ELSE UNICODE}
+function RetrieveUrlCacheEntryFile(lpszUrlName:LPCSTR;
+								                           lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+								                           lpdwCacheEntryInfoBufferSize:LPDWORD;
+								                           dwReserved:DWORD
+								                          ):BOOL; external WinInetDLL name 'RetrieveUrlCacheEntryFileA';
+{$ENDIF UNICODE}
+
+function UnlockUrlCacheEntryFileA(lpszUrlName:LPCSTR;
+								                          dwReserved:DWORD
+								                         ):BOOL; external WinInetDLL name 'UnlockUrlCacheEntryFileA';
+
+function UnlockUrlCacheEntryFileW(lpszUrlName:LPCWSTR;
+								                          dwReserved:DWORD
+								                         ):BOOL; external WinInetDLL name 'UnlockUrlCacheEntryFileW';
+
+{$IFDEF UNICODE}
+function UnlockUrlCacheEntryFile(lpszUrlName:LPCWSTR;
+								                         dwReserved:DWORD
+								                        ):BOOL; external WinInetDLL name 'UnlockUrlCacheEntryFileW';
+{$ELSE UNICODE}
+{$IFDEF WIN32}
+function UnlockUrlCacheEntryFile(lpszUrlName:LPCSTR;
+								                         dwReserved:DWORD
+								                        ):BOOL; external WinInetDLL name 'UnlockUrlCacheEntryFileA';
+{$ELSE WIN32}
+function UnlockUrlCacheEntryFile(lpszUrlName:LPCSTR;
+								                         dwReserved:DWORD
+								                        ):BOOL; external WinInetDLL name 'UnlockUrlCacheEntryFile';
+{$ENDIF WIN32}
+{$ENDIF UNICODE}
+
+function RetrieveUrlCacheEntryStreamA(lpszUrlName:LPCSTR;
+												                          lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+												                          lpdwCacheEntryInfoBufferSize:LPDWORD;
+												                          fRandomRead:BOOL;
+												                          dwReserved:DWORD
+											                          ):HANDLE; external WinInetDLL name 'RetrieveUrlCacheEntryStreamA';
+
+function RetrieveUrlCacheEntryStreamW(lpszUrlName:LPCWSTR;
+												                          lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+												                          lpdwCacheEntryInfoBufferSize:LPDWORD;
+												                          fRandomRead:BOOL;
+												                          dwReserved:DWORD
+											                          ):HANDLE; external WinInetDLL name 'RetrieveUrlCacheEntryStreamW';
+
+{$IFDEF UNICODE}
+function RetrieveUrlCacheEntryStream(lpszUrlName:LPCWSTR;
+												                         lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+												                         lpdwCacheEntryInfoBufferSize:LPDWORD;
+												                         fRandomRead:BOOL;
+												                         dwReserved:DWORD
+											                         ):HANDLE; external WinInetDLL name 'RetrieveUrlCacheEntryStreamW';
+{$ELSE UNICODE}
+function RetrieveUrlCacheEntryStream(lpszUrlName:LPCSTR;
+												                         lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+												                         lpdwCacheEntryInfoBufferSize:LPDWORD;
+												                         fRandomRead:BOOL;
+												                         dwReserved:DWORD
+											                         ):HANDLE; external WinInetDLL name 'RetrieveUrlCacheEntryStreamA';
+{$ENDIF UNICODE}
+
+function ReadUrlCacheEntryStream(hUrlCacheStream:HANDLE;
+							                          dwLocation:DWORD;
+							                          lpBuffer:LPVOID;
+							                          lpdwLen:LPDWORD;
+							                          Reserved:DWORD
+							                         ):BOOL; external WinInetDLL name 'ReadUrlCacheEntryStream';
+
+function UnlockUrlCacheEntryStream(hUrlCacheStream:HANDLE;
+								                           Reserved:DWORD
+								                          ):BOOL; external WinInetDLL name 'UnlockUrlCacheEntryStream';
+
+function GetUrlCacheEntryInfoA(lpszUrlName:LPCSTR;
+										                     lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+										                     lpdwCacheEntryInfoBufferSize:LPDWORD
+										                    ):BOOL; external WinInetDLL name 'GetUrlCacheEntryInfoA';
+
+function GetUrlCacheEntryInfoW(lpszUrlName:LPCWSTR;
+										                     lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+										                     lpdwCacheEntryInfoBufferSize:LPDWORD
+										                    ):BOOL; external WinInetDLL name 'GetUrlCacheEntryInfoW';
+
+{$IFDEF UNICODE}
+function GetUrlCacheEntryInfo(lpszUrlName:LPCWSTR;
+										                    lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+										                    lpdwCacheEntryInfoBufferSize:LPDWORD
+										                   ):BOOL; external WinInetDLL name 'GetUrlCacheEntryInfoW';
+{$ELSE UNICODE}
+function GetUrlCacheEntryInfo(lpszUrlName:LPCSTR;
+										                    lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+										                    lpdwCacheEntryInfoBufferSize:LPDWORD
+										                   ):BOOL; external WinInetDLL name 'GetUrlCacheEntryInfoA';
+{$ENDIF UNICODE}
+
+function FindFirstUrlCacheGroup(dwFlags:DWORD;
+										                      dwFilter:DWORD;
+										                      lpSearchCondition:LPVOID;
+										                      dwSearchCondition:DWORD;
+										                      lpGroupId:LPGROUPID;
+										                      lpReserved:LPVOID
+										                     ):HANDLE; external WinInetDLL name 'FindFirstUrlCacheGroup';
+
+function FindNextUrlCacheGroup(hFind:HANDLE;
+										                     lpGroupId:LPGROUPID;
+										                     lpReserved:LPVOID
+										                    ):BOOL; external WinInetDLL name 'FindNextUrlCacheGroup';
+
+
+function GetUrlCacheGroupAttributeA(gid:GROUPID;
+                                    dwFlags:DWORD;
+											                         dwAttributes:DWORD;
+											                         lpGroupInfo:LPINTERNET_CACHE_GROUP_INFOA;
+											                         lpdwGroupInfo:LPDWORD;
+											                         lpReserved:LPVOID
+											                        ):BOOL; external WinInetDLL name 'GetUrlCacheGroupAttributeA';
+
+function GetUrlCacheGroupAttributeW(gid:GROUPID;
+                                    dwFlags:DWORD;
+											                         dwAttributes:DWORD;
+											                         lpGroupInfo:LPINTERNET_CACHE_GROUP_INFOW;
+											                         lpdwGroupInfo:LPDWORD;
+											                         lpReserved:LPVOID
+											                        ):BOOL; external WinInetDLL name 'GetUrlCacheGroupAttributeW';
+
+{$IFDEF UNICODE}
+function GetUrlCacheGroupAttribute(gid:GROUPID;
+                                   dwFlags:DWORD;
+											                        dwAttributes:DWORD;
+											                        lpGroupInfo:LPINTERNET_CACHE_GROUP_INFOW;
+											                        lpdwGroupInfo:LPDWORD;
+											                        lpReserved:LPVOID
+											                       ):BOOL; external WinInetDLL name 'GetUrlCacheGroupAttributeW';
+{$ELSE UNICODE}
+function GetUrlCacheGroupAttribute(gid:GROUPID;
+                                   dwFlags:DWORD;
+											                        dwAttributes:DWORD;
+											                        lpGroupInfo:LPINTERNET_CACHE_GROUP_INFOA;
+											                        lpdwGroupInfo:LPDWORD;
+											                        lpReserved:LPVOID
+											                       ):BOOL; external WinInetDLL name 'GetUrlCacheGroupAttributeA';
+{$ENDIF UNICODE}
+
+function SetUrlCacheGroupAttributeA(gid:GROUPID;
+											                         dwFlags:DWORD;
+											                         dwAttributes:DWORD;
+											                         lpGroupInfo:LPINTERNET_CACHE_GROUP_INFOA;
+											                         lpReserved:LPVOID
+											                        ):BOOL; external WinInetDLL name 'SetUrlCacheGroupAttributeA';
+
+function SetUrlCacheGroupAttributeW(gid:GROUPID;
+											                         dwFlags:DWORD;
+											                         dwAttributes:DWORD;
+											                         lpGroupInfo:LPINTERNET_CACHE_GROUP_INFOW;
+											                         lpReserved:LPVOID
+											                        ):BOOL; external WinInetDLL name 'SetUrlCacheGroupAttributeW';
+
+{$IFDEF UNICODE}
+function SetUrlCacheGroupAttribute(gid:GROUPID;
+											                        dwFlags:DWORD;
+											                        dwAttributes:DWORD;
+											                        lpGroupInfo:LPINTERNET_CACHE_GROUP_INFOW;
+											                        lpReserved:LPVOID
+											                       ):BOOL; external WinInetDLL name 'SetUrlCacheGroupAttributeW';
+{$ELSE UNICODE}
+function SetUrlCacheGroupAttribute(gid:GROUPID;
+											                        dwFlags:DWORD;
+											                        dwAttributes:DWORD;
+											                        lpGroupInfo:LPINTERNET_CACHE_GROUP_INFOA;
+											                        lpReserved:LPVOID
+											                       ):BOOL; external WinInetDLL name 'SetUrlCacheGroupAttributeA';
+{$ENDIF UNICODE}
+
+
+function GetUrlCacheEntryInfoExA(lpszUrl:LPCSTR;
+							                          lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+							                          lpdwCacheEntryInfoBufSize:LPDWORD;
+							                          lpszReserved:LPSTR;  // must pass null
+							                          lpdwReserved:LPDWORD;	 // must pass null
+							                          lpReserved:LPVOID;	 // must pass null
+							                          dwFlags:DWORD		 // reserved
+							                         ):BOOL; external WinInetDLL name 'GetUrlCacheEntryInfoExA';
+
+function GetUrlCacheEntryInfoExW(lpszUrl:LPCWSTR;
+							                          lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+							                          lpdwCacheEntryInfoBufSize:LPDWORD;
+							                          lpszReserved:LPWSTR;  // must pass null
+							                          lpdwReserved:LPDWORD;	 // must pass null
+							                          lpReserved:LPVOID;	 // must pass null
+							                          dwFlags:DWORD		 // reserved
+							                         ):BOOL; external WinInetDLL name 'GetUrlCacheEntryInfoExW';
+
+{$IFDEF UNICODE}
+function GetUrlCacheEntryInfoEx(lpszUrl:LPCWSTR;
+                                lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+                                lpdwCacheEntryInfoBufSize:LPDWORD;
+                                lpszReserved:LPWSTR;  // must pass null
+                                lpdwReserved:LPDWORD;	 // must pass null
+                                lpReserved:LPVOID;	 // must pass null
+                                dwFlags:DWORD		 // reserved
+                               ):BOOL; external WinInetDLL name 'GetUrlCacheEntryInfoExW';
+{$ELSE UNICODE}
+function GetUrlCacheEntryInfoEx(lpszUrl:LPCSTR;
+                                lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+                                lpdwCacheEntryInfoBufSize:LPDWORD;
+                                lpszReserved:LPSTR;  // must pass null
+                                lpdwReserved:LPDWORD;	 // must pass null
+                                lpReserved:LPVOID;	 // must pass null
+                                dwFlags:DWORD		 // reserved
+                               ):BOOL; external WinInetDLL name 'GetUrlCacheEntryInfoExA';
+{$ENDIF UNICODE}
+
+const
+      CACHE_ENTRY_ATTRIBUTE_FC    = $00000004;
+      CACHE_ENTRY_HITRATE_FC      = $00000010;
+      CACHE_ENTRY_MODTIME_FC      = $00000040;
+      CACHE_ENTRY_EXPTIME_FC      = $00000080;
+      CACHE_ENTRY_ACCTIME_FC      = $00000100;
+      CACHE_ENTRY_SYNCTIME_FC     = $00000200;
+      CACHE_ENTRY_HEADERINFO_FC   = $00000400;
+      CACHE_ENTRY_EXEMPT_DELTA_FC = $00000800;
+
+function SetUrlCacheEntryInfoA(lpszUrlName:LPCSTR;
+							                        lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+							                        dwFieldControl:DWORD
+							                       ):BOOL; external WinInetDLL name 'SetUrlCacheEntryInfoA';
+
+function SetUrlCacheEntryInfoW(lpszUrlName:LPCWSTR;
+							                        lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+							                        dwFieldControl:DWORD
+							                       ):BOOL; external WinInetDLL name 'SetUrlCacheEntryInfoW';
+
+{$IFDEF UNICODE}
+function SetUrlCacheEntryInfo(lpszUrlName:LPCWSTR;
+						                        lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+						                        dwFieldControl:DWORD
+						                       ):BOOL; external WinInetDLL name 'SetUrlCacheEntryInfoW';
+{$ELSE UNICODE}
+function SetUrlCacheEntryInfo(lpszUrlName:LPCSTR;
+						                        lpCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+						                        dwFieldControl:DWORD
+						                       ):BOOL; external WinInetDLL name 'SetUrlCacheEntryInfoA';
+{$ENDIF UNICODE}
+
+
+//
+// Cache Group Functions
+//
+
+function CreateUrlCacheGroup(dwFlags:DWORD;
+										                   lpReserved:LPVOID  // must pass NULL
+										                  ):GROUPID; external WinInetDLL name 'CreateUrlCacheGroup';
+
+function DeleteUrlCacheGroup(GroupId:GROUPID;
+						                       dwFlags:DWORD;		  // must pass 0
+						                       lpReserved:LPVOID	  // must pass NULL
+						                      ):BOOL; external WinInetDLL name 'DeleteUrlCacheGroup';
+
+// Flags for SetUrlCacheEntryGroup
+const
+      INTERNET_CACHE_GROUP_ADD      = 0;
+      INTERNET_CACHE_GROUP_REMOVE   = 1;
+
+function SetUrlCacheEntryGroupA(lpszUrlName:LPCSTR;
+                                dwFlags:DWORD;
+                                GroupId:GROUPID;
+                                pbGroupAttributes:LPBYTE; // must pass NULL
+                                cbGroupAttributes:DWORD; // must pass 0
+							                         lpReserved:LPVOID		 // must pass NULL
+							                        ):BOOL; external WinInetDLL name 'SetUrlCacheEntryGroupA';
+
+function SetUrlCacheEntryGroupW(lpszUrlName:LPCWSTR;
+                                dwFlags:DWORD;
+                                GroupId:GROUPID;
+                                pbGroupAttributes:LPBYTE; // must pass NULL
+                                cbGroupAttributes:DWORD; // must pass 0
+							                         lpReserved:LPVOID		 // must pass NULL
+							                        ):BOOL; external WinInetDLL name 'SetUrlCacheEntryGroupW';
+
+{$IFDEF UNICODE}
+function SetUrlCacheEntryGroup(lpszUrlName:LPCWSTR;
+                               dwFlags:DWORD;
+                               GroupId:GROUPID;
+                               pbGroupAttributes:LPBYTE; // must pass NULL
+                               cbGroupAttributes:DWORD; // must pass 0
+                               lpReserved:LPVOID		 // must pass NULL
+                              ):BOOL; external WinInetDLL name 'SetUrlCacheEntryGroupW';
+{$ELSE UNICODE}
+{$IFDEF WIN32}
+function SetUrlCacheEntryGroup(lpszUrlName:LPCSTR;
+                               dwFlags:DWORD;
+                               GroupId:GROUPID;
+                               pbGroupAttributes:LPBYTE; // must pass NULL
+                               cbGroupAttributes:DWORD; // must pass 0
+                               lpReserved:LPVOID		 // must pass NULL
+                              ):BOOL; external WinInetDLL name 'SetUrlCacheEntryGroupA';
+{$ELSE WIN32}
+function SetUrlCacheEntryGroup(lpszUrlName:LPCSTR;
+                               dwFlags:DWORD;
+                               GroupId:GROUPID;
+                               pbGroupAttributes:LPBYTE; // must pass NULL
+                               cbGroupAttributes:DWORD; // must pass 0
+                               lpReserved:LPVOID		 // must pass NULL
+                              ):BOOL; external WinInetDLL name 'SetUrlCacheEntryGroup';
+{$ENDIF WIN32}
+{$ENDIF UNICODE}
+
+function FindFirstUrlCacheEntryExA(lpszUrlSearchPattern:LPCSTR;
+                                   dwFlags:DWORD;
+											                        dwFilter:DWORD;
+											                        GroupId:GROUPID;
+											                        lpFirstCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+											                        lpdwFirstCacheEntryInfoBufferSize:LPDWORD;
+											                        lpReserved:LPVOID;	   // must pass NULL
+											                        pcbReserved2:LPDWORD;   // must pass NULL
+											                        lpReserved3:LPVOID	   // must pass NULL
+											                       ):HANDLE; external WinInetDLL name 'FindFirstUrlCacheEntryExA';
+
+function FindFirstUrlCacheEntryExW(lpszUrlSearchPattern:LPCWSTR;
+                                   dwFlags:DWORD;
+											                        dwFilter:DWORD;
+											                        GroupId:GROUPID;
+											                        lpFirstCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+											                        lpdwFirstCacheEntryInfoBufferSize:LPDWORD;
+											                        lpReserved:LPVOID;	   // must pass NULL
+											                        pcbReserved2:LPDWORD;   // must pass NULL
+											                        lpReserved3:LPVOID	   // must pass NULL
+											                       ):HANDLE; external WinInetDLL name 'FindFirstUrlCacheEntryExW';
+
+{$IFDEF UNICODE}
+function FindFirstUrlCacheEntryEx(lpszUrlSearchPattern:LPCWSTR;
+                                  dwFlags:DWORD;
+                                  dwFilter:DWORD;
+                                  GroupId:GROUPID;
+                                  lpFirstCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+                                  lpdwFirstCacheEntryInfoBufferSize:LPDWORD;
+                                  lpReserved:LPVOID;	   // must pass NULL
+                                  pcbReserved2:LPDWORD;   // must pass NULL
+                                  lpReserved3:LPVOID	   // must pass NULL
+                                 ):HANDLE; external WinInetDLL name 'FindFirstUrlCacheEntryExW';
+{$ELSE UNICODE}
+function FindFirstUrlCacheEntryEx(lpszUrlSearchPattern:LPCSTR;
+                                  dwFlags:DWORD;
+                                  dwFilter:DWORD;
+                                  GroupId:GROUPID;
+                                  lpFirstCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+                                  lpdwFirstCacheEntryInfoBufferSize:LPDWORD;
+                                  lpReserved:LPVOID;	   // must pass NULL
+                                  pcbReserved2:LPDWORD;   // must pass NULL
+                                  lpReserved3:LPVOID	   // must pass NULL
+                                 ):HANDLE; external WinInetDLL name 'FindFirstUrlCacheEntryExA';
+{$ENDIF UNICODE}
+
+function FindNextUrlCacheEntryExA(hEnumHandle:HANDLE;
+								                          lpFirstCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+                                  lpdwFirstCacheEntryInfoBufferSize:LPDWORD;
+								                          lpReserved:LPVOID;	 // must pass NULL
+								                          pcbReserved2:LPDWORD;	 // must pass NULL
+								                          lpReserved3:LPVOID	 // must pass NULL
+								                         ):BOOL; external WinInetDLL name 'FindNextUrlCacheEntryExA';
+
+function FindNextUrlCacheEntryExW(hEnumHandle:HANDLE;
+								                          lpFirstCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+                                  lpdwFirstCacheEntryInfoBufferSize:LPDWORD;
+								                          lpReserved:LPVOID;	 // must pass NULL
+								                          pcbReserved2:LPDWORD;	 // must pass NULL
+								                          lpReserved3:LPVOID	 // must pass NULL
+								                         ):BOOL; external WinInetDLL name 'FindNextUrlCacheEntryExW';
+
+{$IFDEF UNICODE}
+function FindNextUrlCacheEntryEx(hEnumHandle:HANDLE;
+                                 lpFirstCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+                                 lpdwFirstCacheEntryInfoBufferSize:LPDWORD;
+                                 lpReserved:LPVOID;	 // must pass NULL
+                                 pcbReserved2:LPDWORD;	 // must pass NULL
+                                 lpReserved3:LPVOID	 // must pass NULL
+                                ):BOOL; external WinInetDLL name 'FindNextUrlCacheEntryExW';
+{$ELSE UNICODE}
+function FindNextUrlCacheEntryEx(hEnumHandle:HANDLE;
+                                 lpFirstCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+                                 lpdwFirstCacheEntryInfoBufferSize:LPDWORD;
+                                 lpReserved:LPVOID;	 // must pass NULL
+                                 pcbReserved2:LPDWORD;	 // must pass NULL
+                                 lpReserved3:LPVOID	 // must pass NULL
+                                ):BOOL; external WinInetDLL name 'FindNextUrlCacheEntryExA';
+{$ENDIF UNICODE}
+
+function FindFirstUrlCacheEntryA(lpszUrlSearchPattern:LPCSTR;
+											                      lpFirstCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+											                      lpdwFirstCacheEntryInfoBufferSize:LPDWORD
+											                     ):HANDLE; external WinInetDLL name 'FindFirstUrlCacheEntryA';
+
+function FindFirstUrlCacheEntryW(lpszUrlSearchPattern:LPCWSTR;
+											                      lpFirstCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+											                      lpdwFirstCacheEntryInfoBufferSize:LPDWORD
+											                     ):HANDLE; external WinInetDLL name 'FindFirstUrlCacheEntryW';
+
+{$IFDEF UNICODE}
+function FindFirstUrlCacheEntry(lpszUrlSearchPattern:LPCWSTR;
+                                lpFirstCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+                                lpdwFirstCacheEntryInfoBufferSize:LPDWORD
+                               ):HANDLE; external WinInetDLL name 'FindFirstUrlCacheEntryW';
+{$ELSE UNICODE}
+function FindFirstUrlCacheEntry(lpszUrlSearchPattern:LPCSTR;
+                                lpFirstCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+                                lpdwFirstCacheEntryInfoBufferSize:LPDWORD
+                               ):HANDLE; external WinInetDLL name 'FindFirstUrlCacheEntryA';
+{$ENDIF UNICODE}
+
+function FindNextUrlCacheEntryA(hEnumHandle:HANDLE;
+							                         lpNextCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+							                         lpdwNextCacheEntryInfoBufferSize:LPDWORD
+							                        ):BOOL; external WinInetDLL name 'FindNextUrlCacheEntryA';
+
+function FindNextUrlCacheEntryW(hEnumHandle:HANDLE;
+							                         lpNextCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+							                         lpdwNextCacheEntryInfoBufferSize:LPDWORD
+							                        ):BOOL; external WinInetDLL name 'FindNextUrlCacheEntryW';
+
+{$IFDEF UNICODE}
+function FindNextUrlCacheEntry(hEnumHandle:HANDLE;
+							                        lpNextCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOW;
+							                        lpdwNextCacheEntryInfoBufferSize:LPDWORD
+							                       ):BOOL; external WinInetDLL name 'FindNextUrlCacheEntryW';
+{$ELSE UNICODE}
+function FindNextUrlCacheEntry(hEnumHandle:HANDLE;
+							                        lpNextCacheEntryInfo:LPINTERNET_CACHE_ENTRY_INFOA;
+							                        lpdwNextCacheEntryInfoBufferSize:LPDWORD
+							                       ):BOOL; external WinInetDLL name 'FindNextUrlCacheEntryA';
+{$ENDIF UNICODE}
+
+
+function FindCloseUrlCache(hEnumHandle:HANDLE):BOOL; external WinInetDLL name 'FindCloseUrlCache';
+
+function DeleteUrlCacheEntryA(lpszUrlName:LPCSTR):BOOL; external WinInetDLL name 'DeleteUrlCacheEntryA';
+
+function DeleteUrlCacheEntryW(lpszUrlName:LPCWSTR):BOOL; external WinInetDLL name 'DeleteUrlCacheEntryW';
+
+{$IFDEF UNICODE}
+function DeleteUrlCacheEntry(lpszUrlName:LPCWSTR):BOOL; external WinInetDLL name 'DeleteUrlCacheEntryW';
+{$ELSE UNICODE}
+{$IFDEF WIN32}
+function DeleteUrlCacheEntry(lpszUrlName:LPCSTR):BOOL; external WinInetDLL name 'DeleteUrlCacheEntryA';
+{$ELSE WIN32}
+function DeleteUrlCacheEntry(lpszUrlName:LPCSTR):BOOL; external WinInetDLL name 'DeleteUrlCacheEntry';
+{$ENDIF WIN32}
+{$ENDIF UNICODE}
+
+
+
+//
+// Autodial APIs
+//
+
+{$IFNDEF WINCE}
+// Despite the functions
+// InternetDial
+// InternetHangUp
+// InternetAutodial
+// InternetAutodialHangup
+// InternetInitializeAutoProxyDll
+// are declared in wininet.h for both WIN32 and WINCE there are no such
+// functions exported by wininet.dll under CE.
+function InternetDialA(hwndParent:HWND;
+                       lpszConnectoid:LPSTR;
+                       dwFlags:DWORD;
+								               lpdwConnection:PDWORD_PTR;
+								               dwReserved:DWORD
+								              ):DWORD; external WinInetDLL name 'InternetDialA';
+
+function InternetDialW(hwndParent:HWND;
+                       lpszConnectoid:LPWSTR;
+                       dwFlags:DWORD;
+								               lpdwConnection:PDWORD_PTR;
+								               dwReserved:DWORD
+								              ):DWORD; external WinInetDLL name 'InternetDialW';
+
+{$IFDEF UNICODE}
+function InternetDial(hwndParent:HWND;
+                      lpszConnectoid:LPWSTR;
+                      dwFlags:DWORD;
+								              lpdwConnection:PDWORD_PTR;
+								              dwReserved:DWORD
+								             ):DWORD; external WinInetDLL name 'InternetDialW';
+{$ELSE UNICODE}
+{$IFDEF WIN32}
+function InternetDial(hwndParent:HWND;
+                      lpszConnectoid:LPSTR;
+                      dwFlags:DWORD;
+								              lpdwConnection:PDWORD_PTR;
+								              dwReserved:DWORD
+								             ):DWORD; external WinInetDLL name 'InternetDialA';
+{$ELSE WIN32}
+function InternetDial(hwndParent:HWND;
+                      lpszConnectoid:LPSTR;
+                      dwFlags:DWORD;
+								              lpdwConnection:PDWORD_PTR;
+								              dwReserved:DWORD
+								             ):DWORD; external WinInetDLL name 'InternetDial';
+{$ENDIF WIN32}
+{$ENDIF UNICODE}
+
+// Flags for InternetDial - must not conflict with InternetAutodial flags
+//                          as they are valid here also.
+const
+      INTERNET_DIAL_FORCE_PROMPT     = $2000;
+      INTERNET_DIAL_SHOW_OFFLINE     = $4000;
+      INTERNET_DIAL_UNATTENDED       = $8000;
+
+function InternetHangUp(dwConnection:DWORD_PTR;
+								                dwReserved:DWORD
+                       ):DWORD; external WinInetDLL name 'InternetHangUp';
+
+function InternetAutodial(dwFlags:DWORD;
+								                  hwndParent:HWND
+                         ):BOOL; external WinInetDLL name 'InternetAutodial';
+
+// Flags for InternetAutodial
+const
+      INTERNET_AUTODIAL_FORCE_ONLINE          = 1;
+      INTERNET_AUTODIAL_FORCE_UNATTENDED      = 2;
+      INTERNET_AUTODIAL_FAILIFSECURITYCHECK   = 4;
+      INTERNET_AUTODIAL_OVERRIDE_NET_PRESENT  = 8;
+
+      INTERNET_AUTODIAL_FLAGS_MASK = INTERNET_AUTODIAL_FORCE_ONLINE or
+                                     INTERNET_AUTODIAL_FORCE_UNATTENDED or
+                                     INTERNET_AUTODIAL_FAILIFSECURITYCHECK or
+                                     INTERNET_AUTODIAL_OVERRIDE_NET_PRESENT;
+
+function InternetAutodialHangup(dwReserved:DWORD):BOOL; external WinInetDLL name 'InternetAutodialHangup';
+
+function InternetInitializeAutoProxyDll(dwReserved:DWORD):BOOL; external WinInetDLL name 'InternetInitializeAutoProxyDll';
+{$ENDIF WINCE}
+
+const
+      INTERENT_GOONLINE_REFRESH = $00000001;
+      INTERENT_GOONLINE_MASK    = $00000001;
+
+function InternetGoOnlineA(lpszURL:LPSTR;
+									                  hwndParent:HWND;
+                           dwFlags:DWORD
+									                 ):BOOL; external WinInetDLL name 'InternetGoOnlineA';
+
+function InternetGoOnlineW(lpszURL:LPWSTR;
+									                  hwndParent:HWND;
+                           dwFlags:DWORD
+									                 ):BOOL; external WinInetDLL name 'InternetGoOnlineW';
+
+{$IFDEF UNICODE}
+function InternetGoOnline(lpszURL:LPWSTR;
+								                  hwndParent:HWND;
+                          dwFlags:DWORD
+								                 ):BOOL; external WinInetDLL name 'InternetGoOnlineW';
+{$ELSE UNICODE}
+{$IFDEF WIN32}
+function InternetGoOnline(lpszURL:LPSTR;
+								                  hwndParent:HWND;
+                          dwFlags:DWORD
+								                 ):BOOL; external WinInetDLL name 'InternetGoOnlineA';
+{$ELSE WIN32}
+function InternetGoOnline(lpszURL:LPSTR;
+								                  hwndParent:HWND;
+                          dwFlags:DWORD
+								                 ):BOOL; external WinInetDLL name 'InternetGoOnline';
+{$ENDIF WIN32}
+{$ENDIF UNICODE}
+
+
+function InternetGetConnectedState(lpdwFlags:LPDWORD;
+											                        dwReserved:DWORD
+                                  ):BOOL; external WinInetDLL name 'InternetGetConnectedState';
+
+
+function InternetGetConnectedStateExA(lpdwFlags:LPDWORD;
+											                           lpszConnectionName:LPSTR;
+                                      dwNameLen:DWORD;
+                                      dwReserved:DWORD
+											                          ):BOOL; external WinInetDLL name 'InternetGetConnectedStateExA';
+
+function InternetGetConnectedStateExW(lpdwFlags:LPDWORD;
+											                           lpszConnectionName:LPWSTR;
+                                      dwNameLen:DWORD;
+                                      dwReserved:DWORD
+											                          ):BOOL; external WinInetDLL name 'InternetGetConnectedStateExW';
+
+{$IFDEF UNICODE}
+function InternetGetConnectedStateEx(lpdwFlags:LPDWORD;
+											                          lpszConnectionName:LPWSTR;
+                                     dwNameLen:DWORD;
+                                     dwReserved:DWORD
+											                         ):BOOL; external WinInetDLL name 'InternetGetConnectedStateExW';
+{$ELSE UNICODE}
+{$IFDEF WIN32}
+function InternetGetConnectedStateEx(lpdwFlags:LPDWORD;
+											                          lpszConnectionName:LPSTR;
+                                     dwNameLen:DWORD;
+                                     dwReserved:DWORD
+											                         ):BOOL; external WinInetDLL name 'InternetGetConnectedStateExA';
+{$ELSE WIN32}
+function InternetGetConnectedStateEx(lpdwFlags:LPDWORD;
+											                          lpszConnectionName:LPSTR;
+                                     dwNameLen:DWORD;
+                                     dwReserved:DWORD
+											                         ):BOOL; external WinInetDLL name 'InternetGetConnectedStateEx';
+{$ENDIF WIN32}
+{$ENDIF UNICODE}
+
+// Flags for InternetGetConnectedState and Ex
+const
+      INTERNET_CONNECTION_MODEM           = $01;
+      INTERNET_CONNECTION_LAN             = $02;
+      INTERNET_CONNECTION_PROXY           = $04;
+      INTERNET_CONNECTION_MODEM_BUSY      = $08;  // no longer used 
+      INTERNET_RAS_INSTALLED              = $10;
+      INTERNET_CONNECTION_OFFLINE         = $20;
+      INTERNET_CONNECTION_CONFIGURED      = $40;
+
+//
+// Custom dial handler functions
+//
+
+// Custom dial handler prototype
+type
+     PFN_DIAL_HANDLER = function(param1:HWND; param2:LPCSTR; param3:DWORD; param4:LPDWORD):DWORD; cdecl;
+
+// Flags for custom dial handler
+const
+      INTERNET_CUSTOMDIAL_CONNECT         = 0;
+      INTERNET_CUSTOMDIAL_UNATTENDED      = 1;
+      INTERNET_CUSTOMDIAL_DISCONNECT      = 2;
+      INTERNET_CUSTOMDIAL_SHOWOFFLINE     = 4;
+
+// Custom dial handler supported functionality flags
+const
+      INTERNET_CUSTOMDIAL_SAFE_FOR_UNATTENDED = 1;
+      INTERNET_CUSTOMDIAL_WILL_SUPPLY_STATE   = 2;
+      INTERNET_CUSTOMDIAL_CAN_HANGUP          = 4;
+
+{
+  The obsolete functions InternetSetDialStateA and InternetSetDialStateW and
+  constants for them are left out.
+}
+
+
+function InternetSetPerSiteCookieDecisionA(pchHostName:LPCSTR;
+                                           dwDecision:DWORD
+                                          ):BOOL; external WinInetDLL name 'InternetSetPerSiteCookieDecisionA';
+
+function InternetSetPerSiteCookieDecisionW(pchHostName:LPCWSTR;
+                                           dwDecision:DWORD
+                                          ):BOOL; external WinInetDLL name 'InternetSetPerSiteCookieDecisionW';
+
+{$IFDEF UNICODE}
+function InternetSetPerSiteCookieDecision(pchHostName:LPCWSTR;
+                                          dwDecision:DWORD
+                                         ):BOOL; external WinInetDLL name 'InternetSetPerSiteCookieDecisionW';
+{$ELSE UNICODE}
+function InternetSetPerSiteCookieDecision(pchHostName:LPCSTR;
+                                          dwDecision:DWORD
+                                         ):BOOL; external WinInetDLL name 'InternetSetPerSiteCookieDecisionA';
+{$ENDIF UNICODE}
+
+function InternetGetPerSiteCookieDecisionA(pchHostName:LPCSTR;
+                                           pResult:PULONG
+                                          ):BOOL; external WinInetDLL name 'InternetGetPerSiteCookieDecisionA';
+
+function InternetGetPerSiteCookieDecisionW(pchHostName:LPCWSTR;
+                                           pResult:PULONG
+                                          ):BOOL; external WinInetDLL name 'InternetGetPerSiteCookieDecisionW';
+
+{$IFDEF UNICODE}
+function InternetGetPerSiteCookieDecision(pchHostName:LPCWSTR;
+                                          pResult:PULONG
+                                         ):BOOL; external WinInetDLL name 'InternetGetPerSiteCookieDecisionW';
+{$ELSE UNICODE}
+function InternetGetPerSiteCookieDecision(pchHostName:LPCSTR;
+                                          pResult:PULONG
+                                         ):BOOL; external WinInetDLL name 'InternetGetPerSiteCookieDecisionA';
+{$ENDIF UNICODE}
+
+function InternetClearAllPerSiteCookieDecisions:BOOL; external WinInetDLL name 'InternetClearAllPerSiteCookieDecisions';
+
+
+function InternetEnumPerSiteCookieDecisionA(pszSiteName:LPSTR;
+                                            pcSiteNameSize:PULONG;
+                                            pdwDecision:PULONG;
+                                            dwIndex:ULONG
+                                           ):BOOL; external WinInetDLL name 'InternetEnumPerSiteCookieDecisionA';
+
+function InternetEnumPerSiteCookieDecisionW(pszSiteName:LPWSTR;
+                                            pcSiteNameSize:PULONG;
+                                            pdwDecision:PULONG;
+                                            dwIndex:ULONG
+                                           ):BOOL; external WinInetDLL name 'InternetEnumPerSiteCookieDecisionW';
+
+{$IFDEF UNICODE}
+function InternetEnumPerSiteCookieDecision(pszSiteName:LPWSTR;
+                                           pcSiteNameSize:PULONG;
+                                           pdwDecision:PULONG;
+                                           dwIndex:ULONG
+                                          ):BOOL; external WinInetDLL name 'InternetEnumPerSiteCookieDecisionW';
+{$ELSE UNICODE}
+function InternetEnumPerSiteCookieDecision(pszSiteName:LPSTR;
+                                           pcSiteNameSize:PULONG;
+                                           pdwDecision:PULONG;
+                                           dwIndex:ULONG
+                                          ):BOOL; external WinInetDLL name 'InternetEnumPerSiteCookieDecisionA';
+{$ENDIF UNICODE}
+
+const
+      INTERNET_IDENTITY_FLAG_PRIVATE_CACHE        = $01;
+      INTERNET_IDENTITY_FLAG_SHARED_CACHE         = $02;
+      INTERNET_IDENTITY_FLAG_CLEAR_DATA           = $04;
+      INTERNET_IDENTITY_FLAG_CLEAR_COOKIES        = $08;
+      INTERNET_IDENTITY_FLAG_CLEAR_HISTORY        = $10;
+      INTERNET_IDENTITY_FLAG_CLEAR_CONTENT        = $20;
+
+      INTERNET_SUPPRESS_RESET_ALL                 = $00;
+      INTERNET_SUPPRESS_COOKIE_POLICY             = $01;
+      INTERNET_SUPPRESS_COOKIE_POLICY_RESET       = $02;
+
+//
+// Privacy settings values and APIs
+//
+const
+      PRIVACY_TEMPLATE_NO_COOKIES     = 0;
+      PRIVACY_TEMPLATE_HIGH           = 1;
+      PRIVACY_TEMPLATE_MEDIUM_HIGH    = 2;
+      PRIVACY_TEMPLATE_MEDIUM         = 3;
+      PRIVACY_TEMPLATE_MEDIUM_LOW     = 4;
+      PRIVACY_TEMPLATE_LOW            = 5;
+      PRIVACY_TEMPLATE_CUSTOM         = 100;
+      PRIVACY_TEMPLATE_ADVANCED       = 101;
+
+      PRIVACY_TEMPLATE_MAX            = PRIVACY_TEMPLATE_LOW;
+
+      PRIVACY_TYPE_FIRST_PARTY        = 0;
+      PRIVACY_TYPE_THIRD_PARTY        = 1;
+
+function PrivacySetZonePreferenceW(dwZone:DWORD;
+						                             dwType:DWORD;
+						                             dwTemplate:DWORD;
+                                   pszPreference:LPCWSTR
+						                            ):DWORD; external WinInetDLL name 'PrivacySetZonePreferenceW';
+function PrivacySetZonePreference(dwZone:DWORD;
+						                            dwType:DWORD;
+						                            dwTemplate:DWORD;
+                                  pszPreference:LPCWSTR
+						                           ):DWORD; external WinInetDLL name 'PrivacySetZonePreferenceW';
+
+function PrivacyGetZonePreferenceW(dwZone:DWORD;
+						                             dwType:DWORD;
+						                             pdwTemplate:LPDWORD;
+                                   pszBuffer:LPWSTR;
+                                   pdwBufferLength:LPDWORD
+						                            ):DWORD; external WinInetDLL name 'PrivacyGetZonePreferenceW';
+function PrivacyGetZonePreference(dwZone:DWORD;
+						                            dwType:DWORD;
+						                            pdwTemplate:LPDWORD;
+                                  pszBuffer:LPWSTR;
+                                  pdwBufferLength:LPDWORD
+						                           ):DWORD; external WinInetDLL name 'PrivacyGetZonePreferenceW';
+
+// *
+// * Return packing to whatever it was before we
+// * entered this file
+// *
+{$PACKRECORDS DEFAULT} // #include <poppack.h>
+
+implementation
+
+//
+// gopher type macros
+//
+function IS_GOPHER_FILE(_type:DWORD):BOOL; inline;
+begin
+  IS_GOPHER_FILE:=(_type and GOPHER_TYPE_FILE_MASK)<>0;
+end;
+
+function IS_GOPHER_DIRECTORY(_type:DWORD):BOOL; inline;
+begin
+  IS_GOPHER_DIRECTORY:=(_type and GOPHER_TYPE_DIRECTORY)<>0;
+end;
+
+function IS_GOPHER_PHONE_SERVER(_type:DWORD):BOOL; inline;
+begin
+  IS_GOPHER_PHONE_SERVER:=(_type and GOPHER_TYPE_CSO)<>0;
+end;
+
+function IS_GOPHER_ERROR(_type:DWORD):BOOL; inline;
+begin
+  IS_GOPHER_ERROR:=(_type and GOPHER_TYPE_ERROR)<>0;
+end;
+
+function IS_GOPHER_INDEX_SERVER(_type:DWORD):BOOL; inline;
+begin
+  IS_GOPHER_INDEX_SERVER:=(_type and GOPHER_TYPE_INDEX_SERVER)<>0;
+end;
+
+function IS_GOPHER_TELNET_SESSION(_type:DWORD):BOOL; inline;
+begin
+  IS_GOPHER_TELNET_SESSION:=(_type and GOPHER_TYPE_TELNET)<>0;
+end;
+
+function IS_GOPHER_BACKUP_SERVER(_type:DWORD):BOOL; inline;
+begin
+  IS_GOPHER_BACKUP_SERVER:=(_type and GOPHER_TYPE_REDUNDANT)<>0;
+end;
+
+function IS_GOPHER_TN3270_SESSION(_type:DWORD):BOOL; inline;
+begin
+  IS_GOPHER_TN3270_SESSION:=(_type and GOPHER_TYPE_TN3270)<>0;
+end;
+
+function IS_GOPHER_ASK(_type:DWORD):BOOL; inline;
+begin
+  IS_GOPHER_ASK:=(_type and GOPHER_TYPE_ASK)<>0;
+end;
+
+function IS_GOPHER_PLUS(_type:DWORD):BOOL; inline;
+begin
+  IS_GOPHER_PLUS:=(_type and GOPHER_TYPE_GOPHER_PLUS)<>0;
+end;
+
+function IS_GOPHER_TYPE_KNOWN(_type:DWORD):BOOL; inline;
+begin
+  IS_GOPHER_TYPE_KNOWN:=(_type and GOPHER_TYPE_UNKNOWN)=0;
+end;
+
+end.

+ 0 - 51
rtl/wince/wininc/coredll.inc

@@ -215,10 +215,8 @@
       30C DumpKCallProfile
       30C DumpKCallProfile
       3DB EnableCaretSystemWide
       3DB EnableCaretSystemWide
       553 EnableEUDC
       553 EnableEUDC
-       BF EnumDevices
       50E EnumDisplayDevices
       50E EnumDisplayDevices
       666 EnumDisplayMonitors
       666 EnumDisplayMonitors
-       BE EnumPnpIds
       14D EnumUILanguagesW
       14D EnumUILanguagesW
       374 ExtractResource
       374 ExtractResource
       17F FileSystemPowerFunction
       17F FileSystemPowerFunction
@@ -239,7 +237,6 @@
        29 GetCurrentFT
        29 GetCurrentFT
       39F GetCurrentPermissions
       39F GetCurrentPermissions
       186 GetDeviceByIndex
       186 GetDeviceByIndex
-       C0 GetDeviceKeys
       2FA GetEventData
       2FA GetEventData
       394 GetFSHeapInfo
       394 GetFSHeapInfo
       407 GetForegroundInfo
       407 GetForegroundInfo
@@ -377,7 +374,6 @@
       36F NKvDbgPrintfW
       36F NKvDbgPrintfW
       30F NotifyForceCleanboot
       30F NotifyForceCleanboot
       410 NotifyWinUserSystem
       410 NotifyWinUserSystem
-       C1 OpenDeviceKey
       395 OtherThreadsRunning
       395 OtherThreadsRunning
       3BB PPSHRestart
       3BB PPSHRestart
         C PSLNotify
         C PSLNotify
@@ -401,7 +397,6 @@
       2D4 PegSetUserNotification
       2D4 PegSetUserNotification
       1CE PegWriteRecordProps
       1CE PegWriteRecordProps
       2F1 PerformCallBack4
       2F1 PerformCallBack4
-      267 PlaySoundW
       3A3 PowerOffSystem
       3A3 PowerOffSystem
       37C PrintTrackedItem
       37C PrintTrackedItem
       373 ProcessDetachAllDLLs
       373 ProcessDetachAllDLLs
@@ -1886,16 +1881,6 @@
       584 ldexp
       584 ldexp
       585 ldiv
       585 ldiv
       589 longjmp
       589 longjmp
-      2B2 mixerClose
-      2A9 mixerGetControlDetails
-      2AA mixerGetDevCaps
-      2AB mixerGetID
-      2AC mixerGetLineControls
-      2AD mixerGetLineInfo
-      2AE mixerGetNumDevs
-      2AF mixerMessage
-      2B0 mixerOpen
-      2B1 mixerSetControlDetails
       596 modf
       596 modf
       599 pow
       599 pow
       60D printf
       60D printf
@@ -1909,7 +1894,6 @@
       62F setvbuf
       62F setvbuf
       5A0 sin
       5A0 sin
       5A1 sinh
       5A1 sinh
-      266 sndPlaySoundW
       608 sprintf
       608 sprintf
       5A2 sqrt
       5A2 sqrt
       68E sqrtf
       68E sqrtf
@@ -1948,41 +1932,6 @@
       609 vsprintf
       609 vsprintf
       604 vswprintf
       604 vswprintf
       633 vwprintf
       633 vwprintf
-      283 waveInAddBuffer
-      280 waveInClose
-      27E waveInGetDevCaps
-      27F waveInGetErrorText
-      288 waveInGetID
-      27D waveInGetNumDevs
-      287 waveInGetPosition
-      289 waveInMessage
-      28A waveInOpen
-      281 waveInPrepareHeader
-      286 waveInReset
-      284 waveInStart
-      285 waveInStop
-      282 waveInUnprepareHeader
-      274 waveOutBreakLoop
-      26D waveOutClose
-      269 waveOutGetDevCaps
-      26C waveOutGetErrorText
-      27A waveOutGetID
-      268 waveOutGetNumDevs
-      276 waveOutGetPitch
-      278 waveOutGetPlaybackRate
-      275 waveOutGetPosition
-      26A waveOutGetVolume
-      27B waveOutMessage
-      27C waveOutOpen
-      271 waveOutPause
-      26E waveOutPrepareHeader
-      273 waveOutReset
-      272 waveOutRestart
-      277 waveOutSetPitch
-      279 waveOutSetPlaybackRate
-      26B waveOutSetVolume
-      26F waveOutUnprepareHeader
-      270 waveOutWrite
       632 wprintf
       632 wprintf
       631 wscanf
       631 wscanf
 
 

+ 5 - 1
rtl/wince/wininc/messages.inc

@@ -227,7 +227,8 @@
      EM_STREAMIN = 1097;
      EM_STREAMIN = 1097;
      EM_STREAMOUT = 1098;
      EM_STREAMOUT = 1098;
      EM_UNDO = 199;
      EM_UNDO = 199;
-  { Edit control  }
+
+  { Edit control notifications  }
      EN_SETFOCUS     =$0100;
      EN_SETFOCUS     =$0100;
      EN_KILLFOCUS    =$0200;
      EN_KILLFOCUS    =$0200;
      EN_CHANGE       =$0300;
      EN_CHANGE       =$0300;
@@ -236,6 +237,9 @@
      EN_MAXTEXT      =$0501;
      EN_MAXTEXT      =$0501;
      EN_HSCROLL      =$0601;
      EN_HSCROLL      =$0601;
      EN_VSCROLL      =$0602;
      EN_VSCROLL      =$0602;
+     EN_ALIGN_LTR_EC = $0700;
+     EN_ALIGN_RTL_EC = $0701;
+
 
 
      EN_CORRECTTEXT = 1797;
      EN_CORRECTTEXT = 1797;
      EN_DROPFILES = 1795;
      EN_DROPFILES = 1795;

+ 20 - 1
rtl/wince/wininc/struct.inc

@@ -7120,6 +7120,25 @@
      TVSFIXEDFILEINFO = VS_FIXEDFILEINFO;
      TVSFIXEDFILEINFO = VS_FIXEDFILEINFO;
      PVSFIXEDFILEINFO = ^VS_FIXEDFILEINFO;
      PVSFIXEDFILEINFO = ^VS_FIXEDFILEINFO;
 
 
+
+// Windows CE File API definitions copied from NT's winbase.h
+     _WIN32_FIND_DATAA =record
+       dwFileAttributes:DWORD;
+       ftCreationTime:FILETIME;
+       ftLastAccessTime:FILETIME;
+       ftLastWriteTime:FILETIME;
+       nFileSizeHigh:DWORD;
+       nFileSizeLow:DWORD;
+       dwReserved0:DWORD;
+       dwReserved1:DWORD;
+       cFileName:array[0..MAX_PATH-1] of char;
+       cAlternateFileName:array[0..13] of char;
+     end;
+     WIN32_FIND_DATAA = _WIN32_FIND_DATAA;
+     PWIN32_FIND_DATAA = ^_WIN32_FIND_DATAA;
+     LPWIN32_FIND_DATAA = ^_WIN32_FIND_DATAA;
+
+
      WIN32_FIND_DATAW = record
      WIN32_FIND_DATAW = record
           dwFileAttributes : DWORD;
           dwFileAttributes : DWORD;
           ftCreationTime : FILETIME;
           ftCreationTime : FILETIME;
@@ -7128,7 +7147,7 @@
           nFileSizeHigh : DWORD;
           nFileSizeHigh : DWORD;
           nFileSizeLow : DWORD;
           nFileSizeLow : DWORD;
           dwOID: DWORD;
           dwOID: DWORD;
-          cFileName : array[0..MAX_PATH] of WCHAR;
+          cFileName : array[0..MAX_PATH-1] of WCHAR;
        end;
        end;
 
 
      LPWIN32_FIND_DATAW = ^WIN32_FIND_DATAW;
      LPWIN32_FIND_DATAW = ^WIN32_FIND_DATAW;

+ 34 - 0
rtl/wince/winsock2.pp

@@ -386,6 +386,40 @@ type
   PSockAddr = ^TSockAddr;
   PSockAddr = ^TSockAddr;
   TSockAddr = TSockAddrIn;
   TSockAddr = TSockAddrIn;
 
 
+{*
+ * Portable socket structure (RFC 2553).
+ *}
+
+{*
+ * Desired design of maximum size and alignment.
+ * These are implementation specific.
+ *}
+const
+      _SS_MAXSIZE = 128;                  // Maximum size.
+      _SS_ALIGNSIZE = SizeOf(Int64);  // Desired alignment.
+
+{*
+ * Definitions used for sockaddr_storage structure paddings design.
+ *}
+const
+      _SS_PAD1SIZE = _SS_ALIGNSIZE - SizeOf(SmallInt);
+      _SS_PAD2SIZE = _SS_MAXSIZE - (SizeOf(SmallInt) + _SS_PAD1SIZE  + _SS_ALIGNSIZE);
+
+type
+     sockaddr_storage = record
+       ss_family:SmallInt;                          // Address family.
+       __ss_pad1:array[0.._SS_PAD1SIZE-1] of char;  // 6 byte pad, this is to make
+                                                    // implementation specific pad up to
+                                                    // alignment field that follows explicit
+                                                    // in the data structure.
+       __ss_align:Int64;                            // Field to force desired structure.
+       __ss_pad2:array[0.._SS_PAD2SIZE-1] of char;  // 112 byte pad to achieve desired size;
+                                                    // _SS_MAXSIZE value minus size of
+                                                    // ss_family, __ss_pad1, and
+                                                    // __ss_align fields is 112.
+     end;
+
+
   { Structure used by kernel to pass protocol information in raw sockets. }
   { Structure used by kernel to pass protocol information in raw sockets. }
   PSockProto = ^TSockProto;
   PSockProto = ^TSockProto;
   TSockProto = record
   TSockProto = record