Browse Source

Merged revisions 11191-11192,11203-11204,11218,11904-11906 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r11191 | yury | 2008-06-04 17:13:39 +0300 (Ср, 04 июн 2008) | 1 line

* Added CP_UTF7 and CP_UTF8 constants. Mantis #10822.
........
r11192 | yury | 2008-06-04 17:58:20 +0300 (Ср, 04 июн 2008) | 1 line

+ Added many new wince api interface units by Vasil Maximov.
........
r11203 | yury | 2008-06-05 11:27:26 +0300 (Чт, 05 июн 2008) | 2 lines

* Added some types by Vasil Maximov.
........
r11204 | yury | 2008-06-05 11:39:00 +0300 (Чт, 05 июн 2008) | 1 line

+ Added more wince api interface units by Vasil Maximov.
........
r11218 | yury | 2008-06-11 13:50:18 +0300 (Ср, 11 июн 2008) | 1 line

* Some additions to Windows unit by Vasil Maximov.
........
r11904 | yury | 2008-10-16 14:43:01 +0300 (Чт, 16 окт 2008) | 1 line

+ New wince api units and some fixes to existing api units by Vasil Maximov.
........
r11905 | yury | 2008-10-17 13:41:46 +0300 (Пт, 17 окт 2008) | 1 line

+ Some fixes to wince api units by Vasil Maximov.
........
r11906 | yury | 2008-10-17 13:45:52 +0300 (Пт, 17 окт 2008) | 1 line

+ ras and raserror wince api units by Vasil Maximov.
........

git-svn-id: branches/fixes_2_2@12374 -

yury 17 years ago
parent
commit
46f5adba2b

+ 19 - 0
.gitattributes

@@ -4403,30 +4403,49 @@ packages/uuid/tests/testuid.pp svneol=native#text/plain
 packages/winceunits/Makefile svneol=native#text/plain
 packages/winceunits/Makefile.fpc svneol=native#text/plain
 packages/winceunits/src/aygshell.pp svneol=native#text/plain
+packages/winceunits/src/bt_api.pp svneol=native#text/plain
+packages/winceunits/src/bt_sdp.pp svneol=native#text/plain
+packages/winceunits/src/bthapi.pp svneol=native#text/plain
+packages/winceunits/src/bthutil.pp svneol=native#text/plain
 packages/winceunits/src/buildwinceunits.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/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/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/gx.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/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/nled.pp svneol=native#text/plain
 packages/winceunits/src/notify.pp svneol=native#text/plain
 packages/winceunits/src/oleauto.pp svneol=native#text/plain
+packages/winceunits/src/phone.pp svneol=native#text/plain
 packages/winceunits/src/pm.pp svneol=native#text/plain
 packages/winceunits/src/power.pp svneol=native#text/plain
 packages/winceunits/src/rapi.pp svneol=native#text/plain
+packages/winceunits/src/ras.pp svneol=native#text/plain
+packages/winceunits/src/raserror.pp svneol=native#text/plain
+packages/winceunits/src/ril.pp svneol=native#text/plain
 packages/winceunits/src/service.pp svneol=native#text/plain
 packages/winceunits/src/shellapi.pp svneol=native#text/plain
 packages/winceunits/src/simmgr.pp svneol=native#text/plain
 packages/winceunits/src/sipapi.pp svneol=native#text/plain
+packages/winceunits/src/sms.pp svneol=native#text/plain
 packages/winceunits/src/tapi.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_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/ws2bth.pp svneol=native#text/plain
 packages/winunits-base/Makefile svneol=native#text/plain
 packages/winunits-base/Makefile.fpc svneol=native#text/plain
 packages/winunits-base/fpmake.pp 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/12/16]
 #
 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
@@ -115,6 +115,10 @@ FPC:=$(shell $(FPCPROG) -PB)
 endif
 ifneq ($(findstring Error,$(FPC)),)
 override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+else
+ifeq ($(strip $(wildcard $(FPC))),)
+FPC:=$(firstword $(FPCPROG))
+endif
 endif
 else
 override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
@@ -270,10 +274,10 @@ ifeq ($(FULL_TARGET),arm-wince)
 override TARGET_UNITS+=buildwinceunits
 endif
 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
+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 ril sms ws2bth keybd nled phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror
 endif
 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
+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 ril sms ws2bth keybd nled phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror
 endif
 override INSTALL_BUILDUNIT=buildwinceunits
 override INSTALL_FPCPACKAGE=y

+ 2 - 1
packages/winceunits/Makefile.fpc

@@ -10,7 +10,8 @@ version=2.2.3
 units_wince=buildwinceunits
 implicitunits_wince=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi \
                     gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl \
-                    sipapi cpl
+                    sipapi cpl bt_api bt_sdp bthapi bthutil ril sms ws2bth keybd nled \
+                    phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror
 units_win32=rapi cesync
 
 [install]

+ 4 - 5
packages/winceunits/src/aygshell.pp

@@ -43,7 +43,6 @@
             29    ComboEditAutoComplete
             45    ComboSubProc
            190    CreateImageCache
-          2021    DMProcessConfigXML
            330    DPI_ExtractIconEx
            311    DPI_LoadImageFile
            310    DPI_LoadLibraryRes
@@ -364,10 +363,10 @@ const
   SIP_STATUS_UNAVAILABLE = 0;
   SIP_STATUS_AVAILABLE  = 1;
 
-  SIPF_OFF    =	$00000000;
-  SIPF_ON     =	$00000001;
-  SIPF_DOCKED =	$00000002;
-  SIPF_LOCKED =	$00000004;
+  SIPF_OFF    = $00000000;
+  SIPF_ON     = $00000001;
+  SIPF_DOCKED = $00000002;
+  SIPF_LOCKED = $00000004;
 
   {Supported system parameters}
   SPI_SETCOMPLETIONINFO  = 223;

+ 595 - 0
packages/winceunits/src/bt_api.pp

@@ -0,0 +1,595 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+//------------------------------------------------------------------------------
+//
+//      Bluetooth client API declarations
+//
+//
+// Module Name:
+//
+//      bt_api.h
+//
+// Abstract:
+//
+//      This file defines client-level APIs to Bluetooth stack
+//
+//
+//------------------------------------------------------------------------------
+//
+//	Bluetooth client API
+//
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit bt_api;
+
+{$CALLING cdecl}
+
+interface
+
+uses Windows, WinSock2, WinIOCtl, ws2bth;
+
+//
+//		COD classes
+//
+const
+      BTH_COD_MAJOR_SERVICE_CLASS_INFORMATION		= $800000;
+      BTH_COD_MAJOR_SERVICE_CLASS_TELEPHONY		  = $400000;
+      BTH_COD_MAJOR_SERVICE_CLASS_AUDIO			     = $200000;
+      BTH_COD_MAJOR_SERVICE_CLASS_OBEX			      = $100000;
+      BTH_COD_MAJOR_SERVICE_CLASS_CAPTURE			   = $080000;
+      BTH_COD_MAJOR_SERVICE_CLASS_RENDERING		  = $040000;
+      BTH_COD_MAJOR_SERVICE_CLASS_NETWORK			   = $020000;
+      BTH_COD_MAJOR_SERVICE_CLASS_LIMITED_DISC	= $002000;
+
+      BTH_COD_MAJOR_DEVICE_CLASS_MISC				      = $000000;
+      BTH_COD_MAJOR_DEVICE_CLASS_COMPUTER			   = $000100;
+      BTH_COD_MAJOR_DEVICE_CLASS_PHONE			      = $000200;
+      BTH_COD_MAJOR_DEVICE_CLASS_LAP				       = $000300;
+      BTH_COD_MAJOR_DEVICE_CLASS_AUDIO			      = $000400;
+      BTH_COD_MAJOR_DEVICE_CLASS_PERIPHERAL		  = $000500;
+      BTH_COD_MAJOR_DEVICE_CLASS_UNCLASSIFIED		= $001f00;
+
+      BTH_COD_MINOR_COMPUTER_UNCLASSIFIED			   = $000000;
+      BTH_COD_MINOR_COMPUTER_DESKTOP				       = $000004;
+      BTH_COD_MINOR_COMPUTER_SERVER				        = $000008;
+      BTH_COD_MINOR_COMPUTER_LAPTOP				        = $00000c;
+      BTH_COD_MINOR_COMPUTER_HANDHELD				      = $000010;
+      BTH_COD_MINOR_COMPUTER_PDA					          = $000014;
+
+      BTH_COD_MINOR_PHONE_UNCLASSIFIED			      = $000000;
+      BTH_COD_MINOR_PHONE_CELL					            = $000004;
+      BTH_COD_MINOR_PHONE_CORDLESS				         = $000008;
+      BTH_COD_MINOR_PHONE_SMART					           = $00000c;
+      BTH_COD_MINOR_PHONE_WIRED					           = $000010;
+
+      BTH_COD_MINOR_LAP_AVAILABLE					         = $000000;
+      BTH_COD_MINOR_LAP_1_17						             = $000004;
+      BTH_COD_MINOR_LAP_17_33						            = $000008;
+      BTH_COD_MINOR_LAP_33_50						            = $00000c;
+      BTH_COD_MINOR_LAP_50_67						            = $000010;
+      BTH_COD_MINOR_LAP_67_83						            = $000014;
+      BTH_COD_MINOR_LAP_83_99						            = $000018;
+      BTH_COD_MINOR_LAP_NO_SERVICE				         = $00001c;
+
+      BTH_COD_MINOR_AUDIO_UNCLASSIFIED			      = $000000;
+      BTH_COD_MINOR_AUDIO_HEADSET					         = $000004;
+
+      BTH_NAMEDEVENT_PAIRING_CHANGED           = 'system/events/bluetooth/PairingChange';
+      BTH_NAMEDEVENT_HARDWARE_CHANGED          = 'system/events/bluetooth/HardwareChange';
+      BTH_NAMEDEVENT_DEVICEID_CHANGED          = 'system/events/bluetooth/DeviceIdChange';
+      BTH_NAMEDEVENT_CONNECTIVITY_CHANGED      = 'system/events/bluetooth/ConnectivityChange';
+      BTH_NAMEDEVENT_SECURITY_CHANGED          = 'system/events/bluetooth/SecurityChange';
+      BTH_NAMEDEVENT_CONNECTIONS_CHANGED       = 'system/events/bluetooth/ConnectionsChange';
+      BTH_NAMEDEVENT_BASEBAND_CHANGED          = 'system/events/bluetooth/BasebandChange';
+      BTH_NAMEDEVENT_STACK_INITED              = 'system/events/bluetooth/StackInitialized';
+      BTH_NAMEDEVENT_PAN_REFRESH               = 'system/events/bluetooth/pan/refresh';
+
+
+{$IFNDEF __bt_ddi_H__}
+//
+//  Attention: also defined in bt_ddi.h! Keep in sync!
+//
+//	Hardware Status
+//
+const
+      HCI_HARDWARE_UNKNOWN							= 0;
+      HCI_HARDWARE_NOT_PRESENT			=	1;
+      HCI_HARDWARE_INITIALIZING		=	2;
+      HCI_HARDWARE_RUNNING							= 3;
+      HCI_HARDWARE_SHUTDOWN						=	4;
+      HCI_HARDWARE_ERROR								 = 5;
+{$ENDIF __bt_ddi_H__}
+
+const
+      BTH_GET_BASEBAND_CONNECTIONS_EX_API_VERSION      = 1;
+
+type
+     _BASEBAND_CONNECTION = record
+	    		hConnection:USHORT;
+	 	    baAddress:BT_ADDR;
+	      cDataPacketsPending:longint;
+       _flags:UINT;
+{
+	      UINT		fLinkType		: 1;     // The type of link. Zero (0) indicates SCO, and 1 indicates ACL.
+	      UINT		fEncrypted		: 1;    // Encryption is enabled.
+	      UINT		fAuthenticated	: 1; // Indicates whether the connection has been authenticated.
+	      UINT		fMode			: 3;        // The connection mode.
+}
+     end;
+     BASEBAND_CONNECTION = _BASEBAND_CONNECTION;
+     PBASEBAND_CONNECTION = ^_BASEBAND_CONNECTION;
+
+type
+     _BASEBAND_CONNECTION_EX = record
+	    		hConnection:USHORT;
+	 	    baAddress:BT_ADDR;
+	      cDataPacketsPending:longint;
+       link_type:UCHAR;
+       mode:UCHAR;
+       _flags:UINT;
+{
+       UINT        fEncrypted      : 1;
+       BOOL        fAuthenticated  : 1;
+}
+     end;
+     BASEBAND_CONNECTION_EX = _BASEBAND_CONNECTION_EX;
+     PBASEBAND_CONNECTION_EX = ^_BASEBAND_CONNECTION_EX;
+
+const
+      HCI_PAGE_SCAN_TYPE_STANDARD         = $00;
+      HCI_PAGE_SCAN_TYPE_INTERLACED       = $01;
+
+      HCI_INQUIRY_SCAN_TYPE_STANDARD      = $00;
+      HCI_INQUIRY_SCAN_TYPE_INTERLACED    = $01;
+
+
+//
+// Warning: To use the following Bth* APIs you must link to btdrt.lib.
+//          This library may or may not be available in your SDK.
+//
+// To preserve Win32 compatibility, consider using the Winsock equivalent
+// of these functions.
+//
+
+
+
+const
+      BtdrtDll = 'btdrt.dll';
+
+//
+//	Management APIs
+//
+function BthWriteScanEnableMask(mask:byte):longint; external BtdrtDll name 'BthWriteScanEnableMask';
+
+function BthReadScanEnableMask(pmask:LPBYTE):longint; external BtdrtDll name 'BthReadScanEnableMask';
+
+function BthWritePageTimeout(timeout:word):longint; external BtdrtDll name 'BthWritePageTimeout';
+
+function BthReadPageTimeout(ptimeout:LPWORD):longint; external BtdrtDll name 'BthReadPageTimeout';
+
+function BthWriteCOD(cod:dword):longint; external BtdrtDll name 'BthWriteCOD';
+
+function BthReadCOD(pcod:LPDWORD):longint; external BtdrtDll name 'BthReadCOD';
+
+function BthGetRemoteCOD(pbt:PBT_ADDR; pcod:LPDWORD):longint; external BtdrtDll name 'BthGetRemoteCOD';
+
+function BthWriteAuthenticationEnable(ae:byte):longint; external BtdrtDll name 'BthWriteAuthenticationEnable';
+
+function BthReadAuthenticationEnable(pae:LPBYTE):longint; external BtdrtDll name 'BthReadAuthenticationEnable';
+
+function BthWriteLinkPolicySettings(pba:PBT_ADDR; lps:word):longint; external BtdrtDll name 'BthWriteLinkPolicySettings';
+
+function BthReadLinkPolicySettings(pba:PBT_ADDR; plps:LPWORD):longint; external BtdrtDll name 'BthReadLinkPolicySettings';
+
+function BthEnterHoldMode(pba:PBT_ADDR; hold_mode_max:word; hold_mode_min:word; pinterval:LPWORD):longint; external BtdrtDll name 'BthEnterHoldMode';
+
+function BthEnterSniffMode(pba:PBT_ADDR;
+                           sniff_mode_max:word;
+                           sniff_mode_min:word;
+                           sniff_attempt:word;
+                           sniff_timeout:word;
+                           pinterval:LPWORD):longint; external BtdrtDll name 'BthEnterSniffMode';
+
+function BthExitSniffMode(pba:PBT_ADDR):longint; external BtdrtDll name 'BthExitSniffMode';
+
+function BthEnterParkMode(pba:PBT_ADDR; beacon_max:word; beacon_min:word; pinterval:LPWORD):longint; external BtdrtDll name 'BthEnterParkMode';
+
+function BthExitParkMode(pba:PBT_ADDR):longint; external BtdrtDll name 'BthExitParkMode';
+
+function BthGetCurrentMode(pba:PBT_ADDR; pmode:LPBYTE):longint; external BtdrtDll name 'BthGetCurrentMode';
+
+function BthGetBasebandHandles(cHandles:longint; pHandles:LPWORD; pcHandlesReturned:PLongint):longint; external BtdrtDll name 'BthGetBasebandHandles';
+
+function BthGetBasebandConnections(cConnections:longint; pConnections:PBASEBAND_CONNECTION; pcConnectionsReturned:PLongint):longint; external BtdrtDll name 'BthGetBasebandConnections';
+
+function BthGetBasebandConnectionsEx(dwApiVersion:DWORD;
+                                     cConnections:longint;
+                                     pConnections:PBASEBAND_CONNECTION_EX;
+                                     pcConnectionsReturned:PLongint):longint; external BtdrtDll name 'BthGetBasebandConnectionsEx';
+
+function BthGetAddress(_handle:word; pba:PBT_ADDR):longint; external BtdrtDll name 'BthGetAddress';
+
+function BthReadLocalAddr(pba:PBT_ADDR):longint; external BtdrtDll name 'BthReadLocalAddr';
+
+function BthGetHardwareStatus(pistatus:PLongint):longint; external BtdrtDll name 'BthGetHardwareStatus';
+
+function BthReadLocalVersion(phci_version:LPBYTE;
+                             phci_revision:LPWORD;
+                             plmp_version:LPBYTE;
+                             plmp_subversion:LPWORD;
+                             pmanufacturer:LPWORD;
+                             plmp_features:LPBYTE):longint; external BtdrtDll name 'BthReadLocalVersion';
+
+function BthReadRemoteVersion(pba:PBT_ADDR;
+                              plmp_version:LPBYTE;
+                              plmp_subversion:LPWORD;
+                              pmanufacturer:LPWORD;
+                              plmp_features:LPBYTE):longint; external BtdrtDll name 'BthReadRemoteVersion';
+
+function BthPerformInquiry(LAP:LongWord;
+                           _length:byte;
+                           num_responses:byte;
+                           cBuffer:LongWord;
+                           pcDiscoveredDevices:LPDWORD;
+                           InquiryList:PBthInquiryResult):longint; external BtdrtDll name 'BthPerformInquiry';
+
+function BthCancelInquiry:longint; external BtdrtDll name 'BthCancelInquiry';
+
+function BthRemoteNameQuery(pba:PBT_ADDR;	cBuffer:LongWord; pcRequired:LPDWORD; szString:PWCHAR):longint; external BtdrtDll name 'BthRemoteNameQuery';
+
+function BthTerminateIdleConnections:longint; external BtdrtDll name 'BthTerminateIdleConnections';
+
+function BthSetInquiryFilter(pba:PBT_ADDR):longint; external BtdrtDll name 'BthSetInquiryFilter';
+
+function BthSetCODInquiryFilter(cod:LongWord; codMask:LongWord):longint; external BtdrtDll name 'BthSetCODInquiryFilter';
+
+function BthClearInquiryFilter:longint; external BtdrtDll name 'BthClearInquiryFilter';
+
+function BthSwitchRole(pbt:PBT_ADDR; usRole:USHORT):longint; external BtdrtDll name 'BthSwitchRole';
+
+function BthGetRole(pbt:PBT_ADDR; pusRole:PUSHORT):longint; external BtdrtDll name 'BthGetRole';
+
+function BthReadRSSI(pbt:PBT_ADDR; pbRSSI:LPBYTE):longint; external BtdrtDll name 'BthReadRSSI';
+
+//
+//   Security manager APIs
+//
+function BthSetPIN(pba:PBT_ADDR; cPinLength:longint; ppin:LPBYTE):longint; external BtdrtDll name 'BthSetPIN';
+
+function BthRevokePIN(pba:PBT_ADDR):longint; external BtdrtDll name 'BthRevokePIN';
+
+type
+     TBthLinkKey = packed array[0..15] of byte;
+     PBthLinkKey = ^TBthLinkKey;
+
+
+function BthSetLinkKey(pba:PBT_ADDR; key:TBthLinkKey):longint; external BtdrtDll name 'BthSetLinkKey';
+
+function BthGetLinkKey(pba:PBT_ADDR; key:TBthLinkKey):longint; external BtdrtDll name 'BthGetLinkKey';
+
+function BthRevokeLinkKey(pba:PBT_ADDR):longint; external BtdrtDll name 'BthRevokeLinkKey';
+
+function BthAuthenticate(pba:PBT_ADDR):longint; external BtdrtDll name 'BthAuthenticate';
+
+function BthSetEncryption(pba:PBT_ADDR; fOn:longint):longint; external BtdrtDll name 'BthSetEncryption';
+
+function BthSetSecurityUI(_hEvent:HANDLE; dwStoreTimeout:DWORD; dwProcTimeout:DWORD):longint; external BtdrtDll name 'BthSetSecurityUI';
+
+function BthGetPINRequest(pbt:PBT_ADDR):longint; external BtdrtDll name 'BthGetPINRequest';
+
+function BthRefusePINRequest(pbt:PBT_ADDR):longint; external BtdrtDll name 'BthRefusePINRequest';
+
+function BthAnswerPairRequest(pba:PBT_ADDR; cPinLength:longint; ppin:LPBYTE):longint; external BtdrtDll name 'BthAnswerPairRequest';
+
+function BthPairRequest(pba:PBT_ADDR; cPinLength:longint; ppin:LPBYTE):longint; external BtdrtDll name 'BthAnswerPairRequest';
+
+//
+//  Connection APIs
+//
+
+function BthCreateACLConnection(pbt:PBT_ADDR; _phandle:LPWORD):longint; external BtdrtDll name 'BthCreateACLConnection';
+
+function BthCreateSCOConnection(pbt:PBT_ADDR; _phandle:LPWORD):longint; external BtdrtDll name 'BthCreateSCOConnection';
+
+function BthCloseConnection(_handle:word):longint; external BtdrtDll name 'BthCloseConnection';
+
+function BthAcceptSCOConnections(fAccept:BOOL):longint; external BtdrtDll name 'BthAcceptSCOConnections';
+
+function BthWritePageScanActivity(pageScanInterval:word; pageScanWindow:word):longint; external BtdrtDll name 'BthWritePageScanActivity';
+
+function BthWriteInquiryScanActivity(inquiryScanInterval:word; inquiryScanWindow:word):longint; external BtdrtDll name 'BthWriteInquiryScanActivity';
+
+function BthReadPageScanActivity(pPageScanInterval:LPWORD; pPageScanWindow:LPWORD):longint; external BtdrtDll name 'BthReadPageScanActivity';
+
+function BthReadInquiryScanActivity(pInquiryScanInterval:LPWORD; pInquiryScanWindow:LPWORD):longint; external BtdrtDll name 'BthReadInquiryScanActivity';
+
+function BthWritePageScanType(pageScanType:byte):longint; external BtdrtDll name 'BthWritePageScanType';
+
+function BthWriteInquiryScanType(inquiryScanType:byte):longint; external BtdrtDll name 'BthWriteInquiryScanType';
+
+function BthReadPageScanType(pPageScanType:LPBYTE):longint; external BtdrtDll name 'BthReadPageScanType';
+
+function BthReadInquiryScanType(pInquiryScanType:LPBYTE):longint; external BtdrtDll name 'BthReadInquiryScanType';
+
+function BthCreateSynchronousConnection(pbt:PBT_ADDR;
+                                        pHandle:LPWORD;
+                                        txBandwidth:LongWord;
+                                        rxBandwidth:LongWord;
+                                        maxLatency:word;
+                                        voiceSetting:word;
+                                        retransmit:byte):longint; external BtdrtDll name 'BthCreateSynchronousConnection';
+
+function BthAcceptSynchronousConnections(fAccept:BOOL):longint; external BtdrtDll name 'BthAcceptSynchronousConnections';
+
+
+//
+//	SDP Name Service APIs
+//
+type
+{
+     SdpAttributeRange = _SdpAttributeRange;
+     SdpQueryUuid = _SdpQueryUuid;
+}
+
+     _WSAQuerySetW = TWSAQuerySetW;
+
+     _WSAESETSERVICEOP = TWSAeSetServiceOp;
+     WSAESETSERVICEOP = _WSAESETSERVICEOP;
+
+function BthNsSetService(pSet:LPWSAQUERYSET; op:WSAESETSERVICEOP; dwFlags:DWORD):longint; external BtdrtDll name 'BthNsSetService';
+
+function BthNsLookupServiceBegin(pQuerySet:LPWSAQUERYSET; dwFlags:DWORD; lphLookup:LPHANDLE):longint; external BtdrtDll name 'BthNsLookupServiceBegin';
+
+function BthNsLookupServiceNext(hLookup:HANDLE; dwFlags:DWORD; lpdwBufferLength:LPDWORD; pResults:LPWSAQUERYSET):longint; external BtdrtDll name 'BthNsLookupServiceNext';
+
+function BthNsLookupServiceEnd(hLookup:HANDLE):longint; external BtdrtDll name 'BthNsLookupServiceEnd';
+
+//
+//	RFCOMM Apis
+//
+const
+      RFCOMM_PORT_FLAGS_REMOTE_DCB    = $00000001;
+      RFCOMM_PORT_FLAGS_KEEP_DCD      = $00000002;
+      RFCOMM_PORT_FLAGS_AUTHENTICATE	 = $00000004;
+      RFCOMM_PORT_FLAGS_ENCRYPT       = $00000008;
+
+{$IFNDEF __bt_ddi_H__}
+//
+//  Attention: also defined in bt_ddi.h! Keep in sync!
+//
+//	channel:
+//		RFCOMM_CHANNEL_ALL			accept connection on all channels (default upper layer)
+//		RFCOMM_CHANNEL_CLIENT_ONLY	do not accept connections at all (client only)
+//		...or channel to restrict connections on
+//
+const
+      RFCOMM_CHANNEL_ALL			      = $00;
+      RFCOMM_CHANNEL_MULTIPLE		  = $fe;
+      RFCOMM_CHANNEL_CLIENT_ONLY	= $ff;
+{$ENDIF __bt_ddi_H__}
+
+type
+     _portemu_port_params = record
+	      channel:longint;
+	      flocal:longint;
+       device:BT_ADDR;
+	      imtu:longint;
+	      iminmtu:longint;
+	      imaxmtu:longint;
+	      isendquota:longint;
+	      irecvquota:longint;
+				   uuidService:GUID;
+	      uiportflags:LongWord;
+     end;
+     PORTEMUPortParams = _portemu_port_params;
+
+//	Bluetooth serial IOCTLs are cross-defined in pegdser.h to reserve spot there.
+const
+      IOCTL_BLUETOOTH_GET_RFCOMM_CHANNEL	= (FILE_DEVICE_SERIAL_PORT shl 16) or
+                                           (FILE_ANY_ACCESS shl 14) or
+                                           (24 shl 2) or
+                                           METHOD_BUFFERED;
+// #define IOCTL_BLUETOOTH_GET_RFCOMM_CHANNEL	CTL_CODE(FILE_DEVICE_SERIAL_PORT,24,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+      IOCTL_BLUETOOTH_GET_PEER_DEVICE    = (FILE_DEVICE_SERIAL_PORT shl 16) or
+                                           (FILE_ANY_ACCESS shl 14) or
+                                           (25 shl 2) or
+                                           METHOD_BUFFERED;
+// #define IOCTL_BLUETOOTH_GET_PEER_DEVICE 	CTL_CODE(FILE_DEVICE_SERIAL_PORT,25,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+//
+// Bluetooth notification system
+//
+function RequestBluetoothNotifications(
+                                       dwClass:DWORD; // class of notifications to register for
+                                       hMsgQ:HANDLE   // message queue created by caller
+                                      ):HANDLE; external BtdrtDll name 'RequestBluetoothNotifications';
+
+function StopBluetoothNotifications(
+                                    h:HANDLE // Handle returned from RequestBluetoothNotifications
+                                   ):BOOL; external BtdrtDll name 'StopBluetoothNotifications';
+
+type
+     _BTEVENT = record
+       dwEventId:DWORD;        // Event ID
+       dwReserved:DWORD;       // Reserved
+       baEventData:array[0..63] of byte;   // Event Data
+     end;
+     BTEVENT = _BTEVENT;
+     PBTEVENT = ^_BTEVENT;
+
+//
+// Class of events to notify connections going up/down
+// and other connection-related changes (role, mode).
+//
+const
+      BTE_CLASS_CONNECTIONS	= 1;
+
+      BTE_CONNECTION			     = 100;
+      BTE_DISCONNECTION		   = 101;
+      BTE_ROLE_SWITCH			    = 102;
+      BTE_MODE_CHANGE			    = 103;
+      BTE_PAGE_TIMEOUT		    = 104;
+
+type
+     BT_CONNECT_EVENT = record
+       dwSize:DWORD;         // To keep track of version
+       hConnection:USHORT;   // Baseband connection handle
+       bta:BT_ADDR;          // Address of remote device
+       ucLinkType:UCHAR;     // Link Type (ACL/SCO)
+       ucEncryptMode:UCHAR;  // Encryption mode
+     end;
+     PBT_CONNECT_EVENT = ^BT_CONNECT_EVENT;
+
+type
+     BT_DISCONNECT_EVENT = record
+       dwSize:DWORD;         // To keep track of version
+       hConnection:USHORT;   // Baseband connection handle
+       ucReason:UCHAR;       // Reason for disconnection
+     end;
+     PBT_DISCONNECT_EVENT = ^BT_DISCONNECT_EVENT;
+
+type
+     BT_ROLE_SWITCH_EVENT = record
+       dwSize:DWORD;         // To keep track of version
+       bta:BT_ADDR;          // Address of remote device
+       _flags:UINT;
+{
+       UINT fRole : 1;       // New Role (master/slave)
+}
+     end;
+     PBT_ROLE_SWITCH_EVENT = ^BT_ROLE_SWITCH_EVENT;
+
+type
+     BT_MODE_CHANGE_EVENT = record
+       dwSize:DWORD;         // To keep track of version
+       hConnection:USHORT;   // Baseband connection handle
+       bta:BT_ADDR;          // Address of remote device
+       bMode:byte;           // Power mode (sniff, etc)
+       usInterval:USHORT;    // Power mode interval
+     end;
+     PBT_MODE_CHANGE_EVENT = ^BT_MODE_CHANGE_EVENT;
+
+//
+// Class of events to notify changes in pairing.
+//
+const
+      BTE_CLASS_PAIRING		= 2;
+
+      BTE_KEY_NOTIFY			  = 200;
+      BTE_KEY_REVOKED			 = 201;
+
+type
+     BT_LINK_KEY_EVENT = record
+       dwSize:DWORD;        // To keep track of version
+       bta:BT_ADDR;         // Address of remote device
+       link_key:array[0..15] of UCHAR;  // Link key data
+       key_type:UCHAR;      // Link key type
+     end;
+     PBT_LINK_KEY_EVENT = ^BT_LINK_KEY_EVENT;
+
+//
+// Class of events to notify changes specific to the 
+// local device (cod, name)
+//
+const
+      BTE_CLASS_DEVICE		= 4;
+
+      BTE_LOCAL_NAME			 = 300;
+      BTE_COD					      = 301;
+
+//
+// Class of events to notify change of state of the
+// core stack.
+//
+const
+      BTE_CLASS_STACK			= 8;
+
+      BTE_STACK_UP			   = 400;
+      BTE_STACK_DOWN			 = 401;
+
+//
+// Class of events to notify change of state of AVDTP
+//
+const
+      BTE_CLASS_AVDTP			= 16;
+
+      BTE_AVDTP_STATE			= 500;
+
+      BT_AVDTP_STATE_DISCONNECTED     = 0;
+      BT_AVDTP_STATE_SUSPENDED        = 1;
+      BT_AVDTP_STATE_STREAMING        = 2;
+
+type
+     BT_AVDTP_STATE_CHANGE = record
+       dwSize:DWORD;       // To keep track of version
+       bta:BT_ADDR;        // Address of remote device
+       dwState:DWORD;      // New state of the AVDTP stream
+     end;
+     PBT_AVDTP_STATE_CHANGE = ^BT_AVDTP_STATE_CHANGE;
+
+//
+// Class of events to notify change of PAN state
+//
+const
+      BTE_CLASS_PAN           = 32;
+
+      BTE_PAN_CONNECTIONS     = 600;
+
+type
+     BT_PAN_NUM_CONNECTIONS = record
+       dwSize:DWORD;       // To keep track of version
+       NumConnections:DWORD; // Number of peers connected
+     end;
+     PBT_PAN_NUM_CONNECTIONS = ^BT_PAN_NUM_CONNECTIONS;
+
+//
+// PAN APIs
+//
+function BthActivatePAN(fActivate:BOOL):longint; external BtdrtDll name 'BthActivatePAN';
+
+
+function rfRegisterDevice(lpszType:LPCWSTR; dwIndex:DWORD; lpszLib:LPCWSTR; dwInfo:DWORD):HANDLE; external KernelDLL name 'RegisterDevice'; // index 14F
+
+function rfDeregisterDevice(hDevice:HANDLE):BOOL; external KernelDLL name 'DeregisterDevice';
+
+function rfCreateFile(lpFileName:LPCTSTR;
+                      dwDesiredAccess:DWORD;
+                      dwShareMode:DWORD;
+                      lpSecurityAttributes:LPSECURITY_ATTRIBUTES;
+                      dwCreationDisposition:DWORD;
+                      dwFlagsAndAttributes:DWORD;
+                      hTemplateFile:HANDLE):HANDLE; external KernelDLL name 'CreateFileW';
+
+function rfReadFile(_hFile:HANDLE;                // handle to file
+                    lpBuffer:LPVOID;             // data buffer
+                    nNumberOfBytesToRead:DWORD;  // number of bytes to read
+                    lpNumberOfBytesRead:LPDWORD; // number of bytes read
+                    lpOverlapped:LPOVERLAPPED    // overlapped buffer
+                   ):BOOL; external KernelDLL name 'ReadFile'; // index F4
+
+function rfWriteFile(_hFile:HANDLE;                    // handle to file
+                     lpBuffer:LPCVOID;                // data buffer
+                     nNumberOfBytesToWrite:DWORD;     // number of bytes to write
+                     lpNumberOfBytesWritten:LPDWORD;  // number of bytes written
+                     lpOverlapped:LPOVERLAPPED        // overlapped buffer
+                    ):BOOL; external KernelDLL name 'WriteFile';
+
+function rfCloseHandle(_hFile:HANDLE):BOOL; external KernelDLL name 'CloseHandle';
+
+implementation
+
+end.

+ 228 - 0
packages/winceunits/src/bt_sdp.pp

@@ -0,0 +1,228 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+//------------------------------------------------------------------------------
+//
+//      Bluetooth Test Client
+//
+// Module Name:
+//
+//      bt_sdp.h
+//
+// Abstract:
+//
+//      This file contains constants and structures for Simple Discovery Protocol.
+//
+//------------------------------------------------------------------------------
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit bt_sdp;
+
+interface
+
+uses Windows;
+
+const
+      SDP_ERROR_INVALID_SDP_VERSION           = $0001;
+      SDP_ERROR_INVALID_RECORD_HANDLE         = $0002;
+      SDP_ERROR_INVALID_REQUEST_SYNTAX        = $0003;
+      SDP_ERROR_INVALID_PDU_SIZE              = $0004;
+      SDP_ERROR_INVALID_CONTINUATION_STATE    = $0005;
+      SDP_ERROR_INSUFFICIENT_RESOURCES        = $0006;
+
+const      
+      SDP_ATTRIB_RECORD_HANDLE            = $0000;
+      SDP_ATTRIB_CLASS_ID_LIST            = $0001;
+      SDP_ATTRIB_RECORD_STATE             = $0002;
+      SDP_ATTRIB_SERVICE_ID               = $0003;
+      SDP_ATTRIB_PROTOCOL_DESCRIPTOR_LIST = $0004;
+      SDP_ATTRIB_BROWSE_GROUP_LIST        = $0005;
+      SDP_ATTRIB_LANG_BASE_ATTRIB_ID_LIST = $0006;
+      SDP_ATTRIB_INFO_TIME_TO_LIVE        = $0007;
+      SDP_ATTRIB_AVAILABILITY             = $0008;
+      SDP_ATTRIB_PROFILE_DESCRIPTOR_LIST  = $0009;
+      SDP_ATTRIB_DOCUMENTATION_URL        = $000A;
+      SDP_ATTRIB_CLIENT_EXECUTABLE_URL    = $000B;
+      SDP_ATTRIB_ICON_URL                 = $000C;
+
+//
+// Attribute IDs in the range of = $000D - = $01FF are reserved for future use
+//
+      SDP_ATTRIB_PROFILE_SPECIFIC                     = $0200;
+
+      STRING_NAME_OFFSET                              = $0000;
+      STRING_DESCRIPTION_OFFSET                       = $0001;
+      STRING_PROVIDER_NAME_OFFSET                     = $0002;
+
+      SDP_ATTRIB_SDP_VERSION_NUMBER_LIST              = $0200;
+      SDP_ATTRIB_SDP_DATABASE_STATE                   = $0201;
+
+      SDP_ATTRIB_BROWSE_GROUP_ID                      = $0200;
+
+      SDP_ATTRIB_CORDLESS_EXTERNAL_NETWORK            = $0301;
+
+      SDP_ATTRIB_FAX_CLASS_1_SUPPORT                  = $0302;
+      SDP_ATTRIB_FAX_CLASS_2_0_SUPPORT                = $0303;
+      SDP_ATTRIB_FAX_CLASS_2_SUPPORT                  = $0304;
+      SDP_ATTRIB_FAX_AUDIO_FEEDBACK_SUPPORT           = $0305;
+
+      SDP_ATTRIB_HEADSET_REMOTE_AUDIO_VOLUME_CONTROL  = $0302;
+
+      SDP_ATTRIB_LAN_LPSUBNET                         = $0200;
+
+      SDP_ATTRIB_OBJECT_PUSH_SUPPORTED_FORMATS_LIST   = $0303;
+
+      SDP_ATTRIB_SYNCH_SUPPORTED_DATA_STORES_LIST     = $0301;
+
+//  this is in the assigned numbers doc, but it does not show up in any profile
+      SDP_ATTRIB_SERVICE_VERSION                      = $0300;
+
+      SDP_ATTRIB_PAN_SECURITY_DESCRIPTION             = $030A;
+      SDP_ATTRIB_PAN_NET_ACCESS_TYPE                  = $030B;
+      SDP_ATTRIB_PAN_MAX_NET_ACCESS_RATE              = $030C;
+      SDP_ATTRIB_PAN_IPV4_SUBNET                      = $030D;
+      SDP_ATTRIB_PAN_IPV6_SUBNET                      = $030E;
+
+
+// Bluetooth base UUID for service discovery
+const
+//      Bluetooth_Base_UUID:GUID = '{00000000-0000-1000-7007-00805F9B34FB}';
+      Bluetooth_Base_UUID :GUID = '{00000000-0000-1000-8000-00805F9B34FB}';
+      
+      SDP_PROTOCOL_UUID   :GUID = '{00000001-0000-1000-8000-00805F9B34FB}';
+      UDP_PROTOCOL_UUID   :GUID = '{00000002-0000-1000-8000-00805F9B34FB}';
+      RFCOMM_PROTOCOL_UUID:GUID = '{00000003-0000-1000-8000-00805F9B34FB}';
+      TCP_PROTOCOL_UUID   :GUID = '{00000004-0000-1000-8000-00805F9B34FB}';
+      TCSBIN_PROTOCOL_UUID:GUID = '{00000005-0000-1000-8000-00805F9B34FB}';
+      TCSAT_PROTOCOL_UUID :GUID = '{00000006-0000-1000-8000-00805F9B34FB}';
+      OBEX_PROTOCOL_UUID  :GUID = '{00000008-0000-1000-8000-00805F9B34FB}';
+      IP_PROTOCOL_UUID    :GUID = '{00000009-0000-1000-8000-00805F9B34FB}';
+      FTP_PROTOCOL_UUID   :GUID = '{0000000A-0000-1000-8000-00805F9B34FB}';
+      HTTP_PROTOCOL_UUID  :GUID = '{0000000C-0000-1000-8000-00805F9B34FB}';
+      WSP_PROTOCOL_UUID   :GUID = '{0000000E-0000-1000-8000-00805F9B34FB}';
+      BNEP_PROTOCOL_UUID  :GUID = '{0000000F-0000-1000-8000-00805F9B34FB}';
+      L2CAP_PROTOCOL_UUID :GUID = '{00000100-0000-1000-8000-00805F9B34FB}';
+
+      ServiceDiscoveryServerServiceClassID_UUID :GUID = '{00001000-0000-1000-8008-00805F9B34FB}';
+      BrowseGroupDescriptorServiceClassID_UUID  :GUID = '{00001001-0000-1000-8000-00805F9B34FB}';
+      PublicBrowseGroupServiceClass_UUID        :GUID = '{00001002-0000-1000-8000-00805F9B34FB}';
+      SerialPortServiceClass_UUID               :GUID = '{00001101-0000-1000-8000-00805F9B34FB}';
+      LANAccessUsingPPPServiceClass_UUID        :GUID = '{00001102-0000-1000-8000-00805F9B34FB}';
+      DialupNetworkingServiceClass_UUID         :GUID = '{00001103-0000-1000-8000-00805F9B34FB}';
+      IrMCSyncServiceClass_UUID                 :GUID = '{00001104-0000-1000-8000-00805F9B34FB}';
+      OBEXObjectPushServiceClass_UUID           :GUID = '{00001105-0000-1000-8000-00805F9B34FB}';
+      OBEXFileTransferServiceClass_UUID         :GUID = '{00001106-0000-1000-8000-00805F9B34FB}';
+      IrMCSyncCommandServiceClass_UUID          :GUID = '{00001107-0000-1000-8000-00805F9B34FB}';
+      HeadsetServiceClass_UUID                  :GUID = '{00001108-0000-1000-8000-00805F9B34FB}';
+      CordlessTelephonyServiceClass_UUID        :GUID = '{00001109-0000-1000-8000-00805F9B34FB}';
+      AudioSourceServiceClass_UUID              :GUID = '{0000110A-0000-1000-8000-00805F9B34FB}';
+      AudioSinkServiceClass_UUID                :GUID = '{0000110B-0000-1000-8000-00805F9B34FB}';
+      AV_RemoteControlTargetServiceClass_UUID   :GUID = '{0000110C-0000-1000-8000-00805F9B34FB}';
+      AdvancedAudioDistributionServiceClass_UUID:GUID = '{0000110D-0000-1000-8000-00805F9B34FB}';
+      AV_RemoteControlServiceClass_UUID         :GUID = '{0000110E-0000-1000-8000-00805F9B34FB}';
+      VideoConferencingServiceClass_UUID        :GUID = '{0000110F-0000-1000-8000-00805F9B34FB}';
+      IntercomServiceClass_UUID                 :GUID = '{00001110-0000-1000-8000-00805F9B34FB}';
+      FaxServiceClass_UUID                      :GUID = '{00001111-0000-1000-8000-00805F9B34FB}';
+      HeadsetAudioGatewayServiceClass_UUID      :GUID = '{00001112-0000-1000-8000-00805F9B34FB}';
+      PANUServiceClass_UUID                     :GUID = '{00001115-0000-1000-8000-00805F9B34FB}';
+      NAPServiceClass_UUID                      :GUID = '{00001116-0000-1000-8000-00805F9B34FB}';
+      GNServiceClass_UUID                       :GUID = '{00001117-0000-1000-8000-00805F9B34FB}';
+      HandsfreeServiceClass_UUID                :GUID = '{0000111E-0000-1000-8000-00805F9B34FB}';
+      HandsfreeAudioGatewayServiceClass_UUID    :GUID = '{0000111F-0000-1000-8000-00805F9B34FB}';
+      PnPInformationServiceClass_UUID           :GUID = '{00001200-0000-1000-8000-00805F9B34FB}';
+      GenericNetworkingServiceClass_UUID        :GUID = '{00001201-0000-1000-8000-00805F9B34FB}';
+      GenericFileTransferServiceClass_UUID      :GUID = '{00001202-0000-1000-8000-00805F9B34FB}';
+      GenericAudioServiceClass_UUID             :GUID = '{00001203-0000-1000-8000-00805F9B34FB}';
+      GenericTelephonyServiceClass_UUID         :GUID = '{00001204-0000-1000-8000-00805F9B34FB}';
+
+
+const
+      SDP_PROTOCOL_UUID16     = $0001;
+      UDP_PROTOCOL_UUID16     = $0002;
+      RFCOMM_PROTOCOL_UUID16  = $0003;
+      TCP_PROTOCOL_UUID16     = $0004;
+      TCSBIN_PROTOCOL_UUID16  = $0005;
+      TCSAT_PROTOCOL_UUID16   = $0006;
+      OBEX_PROTOCOL_UUID16    = $0008;
+      IP_PROTOCOL_UUID16      = $0009;
+      FTP_PROTOCOL_UUID16     = $000A;
+      HTTP_PROTOCOL_UUID16    = $000C;
+      WSP_PROTOCOL_UUID16     = $000E;
+      BNEP_PROTOCOL_UUID16    = $000F;
+      HID_PROTOCOL_UUID16     = $0011;
+      AVCTP_PROTOCOL_UUID16   = $0017;
+      AVDTP_PROTOCOL_UUID16   = $0019;
+      L2CAP_PROTOCOL_UUID16   = $0100;
+
+      ServiceDiscoveryServerServiceClassID_UUID16     = $1000;
+      BrowseGroupDescriptorServiceClassID_UUID16      = $1001;
+      PublicBrowseGroupServiceClassID_UUID16          = $1002;
+      SerialPortServiceClassID_UUID16                 = $1101;
+      LANAccessUsingPPPServiceClassID_UUID16          = $1102;
+      DialupNetworkingServiceClassID_UUID16           = $1103;
+      IrMCSyncServiceClassID_UUID16                   = $1104;
+      OBEXObjectPushServiceClassID_UUID16             = $1105;
+      OBEXFileTransferServiceClassID_UUID16           = $1106;
+      IrMcSyncCommandServiceClassID_UUID16            = $1107;
+      HeadsetServiceClassID_UUID16                    = $1108;
+      CordlessServiceClassID_UUID16                   = $1109;
+      AudioSourceServiceClassID_UUID16                = $110A;
+      AudioSinkServiceClassID_UUID16                  = $110B;
+      AV_RemoteControlTargetServiceClassID_UUID16     = $110C;
+      AdvancedAudioDistributionServiceClassID_UUID16  = $110D;
+      AV_RemoteControlServiceClassID_UUID16           = $110E;
+      VideoConferencingServiceClassID_UUID16          = $110F;
+      IntercomServiceClassID_UUID16                   = $1110;
+      FaxServiceClassID_UUID16                        = $1111;
+      HeadsetAudioGatewayServiceClassID_UUID16        = $1112;
+      PANUServiceClassID_UUID16                       = $1115;
+      NAPServiceClassID_UUID16                        = $1116;
+      GNServiceClassID_UUID16                         = $1117;
+      HandsfreeServiceClassID_UUID16                  = $111E;
+      HandsfreeAudioGatewayServiceClassID_UUID16      = $111F;
+      PnPInformationServiceClassID_UUID16             = $1200;
+      GenericNetworkingServiceClassID_UUID16          = $1201;
+      GenericFileTransferServiceClassID_UUID16        = $1202;
+      GenericAudioServiceClassID_UUID16               = $1203;
+      GenericTelephonyServiceClassID_UUID16           = $1204;
+
+      PSM_SDP                 = $0001;
+      PSM_RFCOMM              = $0003;
+      PSM_TCS_BIN             = $0005;
+      PSM_TCS_BIN_CORDLESS    = $0007;
+
+
+// HID specific SDP attrib ids.
+const
+      SDP_ATTRIB_HID_DEVICE_RELEASE_NUMBER    = $0200;
+      SDP_ATTRIB_HID_PARSER_VERSION           = $0201;
+      SDP_ATTRIB_HID_DEVICE_SUBCLASS          = $0202;
+      SDP_ATTRIB_HID_COUNTRY_CODE             = $0203;
+      SDP_ATTRIB_HID_VIRTUAL_CABLE            = $0204;
+      SDP_ATTRIB_HID_RECONNECT_INITIATE       = $0205;
+      SDP_ATTRIB_HID_DESCRIPTOR_LIST          = $0206;
+      SDP_ATTRIB_HID_LANGID_BASE_LIST         = $0207;
+      SDP_ATTRIB_HID_SDP_DISABLE              = $0208;
+      SDP_ATTRIB_HID_BATTERY_POWER            = $0209;
+      SDP_ATTRIB_HID_REMOTE_WAKE              = $020A;
+      SDP_ATTRIB_HID_PROFILE_VERSION          = $020B;
+      SDP_ATTRIB_HID_SUPERVISION_TIMEOUT      = $020C;
+      SDP_ATTRIB_HID_NORMALLY_CONNECTABLE     = $020D;
+      SDP_ATTRIB_HID_BOOT_DEVICE              = $020E;
+
+
+implementation
+
+end.

+ 388 - 0
packages/winceunits/src/bthapi.pp

@@ -0,0 +1,388 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+//
+// Module: bthapi.h, bthapi.idl
+//
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit bthapi;
+
+{$MODE OBJFPC}
+
+interface
+
+uses Windows;
+
+const
+      LIBID_BTHAPILib:TIID = '{00BC26C8-0A87-41d0-82BA-61FF9E0B1BB5}';
+
+const
+     IID_ISdpWalk:TIID = '{57134AE6-5D3C-462D-BF2F-810361FBD7E7}';
+     IID_ISdpNodeContainer:TIID = '{43F6ED49-6E22-4F81-A8EB-DCED40811A77}';
+     IID_ISdpSearch:TIID = '{D93B6B2A-5EEF-4E1E-BECF-F5A4340C65F5}';
+     IID_ISdpStream = '{A6ECD9FB-0C7A-41A3-9FF0-0B617E989357}';
+     IID_ISdpRecord:TIID = '{10276714-1456-46D7-B526-8B1E83D5116E}';
+     IID_IBluetoothDevice:TIID = '{5BD0418B-D705-4766-B215-183E4EADE341}';
+     IID_IBluetoothAuthenticate:TIID = '{5F0FBA2B-8300-429D-99AD-96A2835D4901}';
+
+const
+      CLSID_SdpNodeContainer:CLSID = '{D5CA76C5-0DEE-4453-96A1-E603C2401766}';
+
+      CLSID_SdpSearch:CLSID = '{3B898402-857E-4E41-9145-BC35431B7B4D}';
+
+      CLSID_SdpWalk:CLSID = '{ED384010-59AE-44c7-8FCA-F3DF22CDCD28}';
+
+      CLSID_SdpStream:CLSID = '{249797FA-19DB-4dda-94D4-E0BCD30EA65E}';
+
+      CLSID_SdpRecord:CLSID = '{ACD02BA7-9667-4085-A100-CC6ACA9621D6}';
+
+
+{$IFNDEF __BTHSDPDEF_H__}
+type
+     SDP_LARGE_INTEGER_16 = record
+       LowPart:ULONGLONG;
+       HighPart:LONGLONG;
+     end;
+     PSDP_LARGE_INTEGER_16 = ^SDP_LARGE_INTEGER_16;
+     LPSDP_LARGE_INTEGER_16 = ^SDP_LARGE_INTEGER_16;
+
+     SDP_ULARGE_INTEGER_16 = record
+       LowPart:ULONGLONG;
+       HighPart:ULONGLONG;
+     end;
+     PSDP_ULARGE_INTEGER_16 = ^SDP_ULARGE_INTEGER_16;
+     LPSDP_ULARGE_INTEGER_16 = ^SDP_ULARGE_INTEGER_16;
+
+
+type
+     NodeContainerType = (NodeContainerTypeSequence	:= 0,
+                          NodeContainerTypeAlternative);
+     PNodeContainerType = ^NodeContainerType;
+
+
+type
+     SDP_ERROR = USHORT;
+     PSDP_ERROR = ^SDP_ERROR;
+
+type
+     SDP_TYPE = (SDP_TYPE_NIL	:= 0,
+	                SDP_TYPE_UINT	:= $1,
+	                SDP_TYPE_INT	:= $2,
+	                SDP_TYPE_UUID	:= $3,
+	                SDP_TYPE_STRING	:= $4,
+	                SDP_TYPE_BOOLEAN	:= $5,
+	                SDP_TYPE_SEQUENCE	:= $6,
+	                SDP_TYPE_ALTERNATIVE	:= $7,
+	                SDP_TYPE_URL	:= $8,
+	                SDP_TYPE_CONTAINER	:= $20);
+     PSDP_TYPE = ^SDP_TYPE;
+
+     SDP_SPECIFICTYPE = (SDP_ST_NONE	:= 0,
+	                        SDP_ST_UINT8	:= $10,
+                         SDP_ST_INT8	:= $20,
+	                        SDP_ST_UINT16	:= $110,
+                         SDP_ST_INT16	:= $120,
+                         SDP_ST_UUID16	:= $130,
+	                        SDP_ST_UINT32	:= $210,
+                         SDP_ST_INT32	:= $220,
+                         SDP_ST_UUID32	:= $230,
+	                        SDP_ST_UINT64	:= $310,
+                         SDP_ST_INT64	:= $320,
+	                        SDP_ST_UINT128	:= $410,
+	                        SDP_ST_INT128	:= $420,
+	                        SDP_ST_UUID128	:= $430);
+     PSDP_SPECIFICTYPE = ^SDP_SPECIFICTYPE;
+
+
+type
+     _SdpAttributeRange = record
+       minAttribute:USHORT;
+       maxAttribute:USHORT;
+     end;
+     SdpAttributeRange = _SdpAttributeRange;
+     PSdpAttributeRange = ^_SdpAttributeRange;
+
+type
+     SdpQueryUuidUnion = record
+       case integer of
+         0: (uuid128:GUID);
+         1: (uuid32:ULONG);
+         2: (uuid16:USHORT);
+     end;
+
+type
+     _SdpQueryUuid = record
+       u:SdpQueryUuidUnion;
+       uuidType:USHORT;
+     end;
+     SdpQueryUuid = _SdpQueryUuid;
+     PSdpQueryUuid = ^_SdpQueryUuid;
+
+
+const
+      BTH_SDP_VERSION = 1;
+
+type
+     _BTHNS_SETBLOB = record
+       pSdpVersion:PULONG;
+       pRecordHandle:PULONG;
+       Reserved:array[0..3] of ULONG;
+       fSecurity:ULONG;
+       fOptions:ULONG;
+       ulRecordLength:ULONG;
+       pRecord:array[0..0] of UCHAR;
+     end;
+     BTHNS_SETBLOB = _BTHNS_SETBLOB;
+     PBTHNS_SETBLOB = ^_BTHNS_SETBLOB;
+
+const
+      MAX_UUIDS_IN_QUERY                   = 12;
+      SDP_SERVICE_SEARCH_REQUEST           = 1;
+      SDP_SERVICE_ATTRIBUTE_REQUEST        = 2;
+      SDP_SERVICE_SEARCH_ATTRIBUTE_REQUEST = 3;
+
+//
+// The following may be passed as parameters to BthNsLookupServiceNext as extended
+// dwFlags options for device inquiry.
+//
+const
+// Causes traversal through list to be reset to first element.
+      BTHNS_LUP_RESET_ITERATOR = $00010000;
+// Does not increment list, causes next query to be performed on current item as well.
+      BTHNS_LUP_NO_ADVANCE     = $00020000;
+// Causes LookupServiceEnd to abort current inquiry.
+      BTHNS_ABORT_CURRENT_INQUIRY = $fffffffd;
+
+
+type
+     _BTHNS_INQUIRYBLOB = record
+       LAP:ULONG;
+       _length:byte;
+       num_responses:byte;
+     end;
+     BTHNS_INQUIRYBLOB = _BTHNS_INQUIRYBLOB;
+     PBTHNS_INQUIRYBLOB = ^_BTHNS_INQUIRYBLOB;
+
+type
+     _BTHNS_RESTRICTIONBLOB = record
+       _type:ULONG;
+       serviceHandle:ULONG;
+       uuids:array[0..11] of SdpQueryUuid;
+       numRange:ULONG;
+       pRange:array[0..0] of SdpAttributeRange;
+     end;
+     BTHNS_RESTRICTIONBLOB = _BTHNS_RESTRICTIONBLOB;
+     PBTHNS_RESTRICTIONBLOB = ^_BTHNS_RESTRICTIONBLOB;
+
+{$DEFINE __BTHSDPDEF_H__}
+{$ENDIF __BTHSDPDEF_H__}
+
+
+type
+     SdpString = record
+       val:^ShortInt;
+       _length:ULONG;
+     end;
+
+//
+// flags for fConnect in SdpSearch::Connect
+//
+const
+      SDP_SEARCH_LOCAL    = $00000001;
+      SDP_SEARCH_CACHED   = $00000002;
+
+type
+// Forward declarations.
+     ISdpNodeContainer = interface;
+     ISdpRecord = interface;
+
+     PISdpRecord = ^ISdpRecord;
+     PPISdpRecord = ^PISdpRecord;
+
+     NodeDataUnion = record
+       case integer of
+         0: (int128:SDP_LARGE_INTEGER_16);
+         1: (uint128:SDP_ULARGE_INTEGER_16);
+         2: (uuid128:GUID);
+         3: (uuid32:ULONG);
+         4: (uuid16:USHORT);
+         5: (int64:LONGLONG);
+         6: (uint64:ULONGLONG);
+         7: (int32:LONG);
+         8: (uint32:ULONG);
+         9: (int16:SHORT);
+         10: (uint16:USHORT);
+         11: (int8:ShortInt);
+         12: (uint8:UCHAR);
+         13: (booleanVal:UCHAR);
+         14: (str:SdpString);
+         15: (url:SdpString);
+         16: (container:pointer{ISdpNodeContainer});
+     end;
+
+     NodeData = record
+       _type:USHORT;
+       specificType:USHORT;
+       u:NodeDataUnion;
+     end;
+     PNODEDATA = ^NodeData;
+
+     BthDeviceStringType = (BthDeviceStringTypeFriendlyName	:= 0,
+	                          BthDeviceStringTypeDeviceName,
+	                          BthDeviceStringTypeDisplay,
+	                          BthDeviceStringTypeClass,
+	                          BthDeviceStringTypeAddress);
+
+// #pragma pack(push)
+// #pragma pack(1)
+{$PACKRECORDS 1}
+     _BthDeviceInfo = record
+       btAddress:ULONGLONG;
+       cod:ULONG;
+       lmpSupportedFeatures:ULONGLONG;
+       name:array[0..247] of ShortInt;
+     end;
+     BthDeviceInfo = _BthDeviceInfo;
+     PBthDeviceInfo = ^_BthDeviceInfo;
+{$PACKRECORDS DEFAULT}
+// #pragma pack(pop)
+
+// Needful types.
+     PPUCHAR = ^PUCHAR;
+     PPUSHORT = ^PUSHORT;
+     PPWCHAR = ^PWCHAR;
+
+     ISdpWalk = interface(IUnknown)
+      ['{57134AE6-5D3C-462D-BF2F-810361FBD7E7}']
+       function WalkNode(pData:PNODEDATA; state:ULONG):HRESULT; stdcall;
+       function WalkStream(elementType:UCHAR; elementSize:ULONG; pStream:PUCHAR):HRESULT; stdcall;
+     end;
+
+		   ISdpNodeContainer = interface(IUnknown)
+      ['{43F6ED49-6E22-4F81-A8EB-DCED40811A77}']
+       function CreateStream(out ppStream:PUCHAR;{ppStream:PPUCHAR;} pSize:PULONG):HRESULT; stdcall;
+       function WriteStream(pStream:PUCHAR; pNumBytesWritten:PULONG):HRESULT; stdcall;
+       function AppendNode(pData:PNODEDATA):HRESULT; stdcall;
+       function GetType(pType:PNodeContainerType):HRESULT; stdcall;
+       function SetType(_type:NodeContainerType):HRESULT; stdcall;
+       function Walk(pWalk:ISdpWalk):HRESULT; stdcall;
+       function SetNode(nodeIndex:ULONG; pData:PNODEDATA):HRESULT; stdcall;
+       function GetNode(nodeIndex:ULONG; pData:PNODEDATA):HRESULT; stdcall;
+       function LockContainer(lock:UCHAR):HRESULT; stdcall;
+       function GetNodeCount(pNodeCount:PULONG):HRESULT; stdcall;
+       function CreateFromStream(pStream:PUCHAR; _size:ULONG):HRESULT; stdcall;
+       function GetNodeStringData(nodeIndex:ULONG; pData:PNODEDATA):HRESULT; stdcall;
+       function GetStreamSize(pSize:PULONG):HRESULT; stdcall;
+     end;
+
+   		ISdpSearch = interface(IUnknown)
+      ['{D93B6B2A-5EEF-4E1E-BECF-F5A4340C65F5}']
+		     function _Begin(pAddrss:PULONGLONG; fConnect:ULONG):HRESULT; stdcall;
+		     function _End:HRESULT; stdcall;
+		     function ServiceSearch(pUuidList:PSdpQueryUuid;
+                              listSize:ULONG;
+                              pHandles:PULONG;
+                              pNumHandles:PUSHORT):HRESULT; stdcall;
+       function AttributeSearch(_handle:ULONG;
+                                pRangeListP:SdpAttributeRange;
+                                numRanges:ULONG;
+                                out ppSdpRecord:ISdpRecord{ppSdpRecord:PISdpRecord}):HRESULT; stdcall;
+       function ServiceAndAttributeSearch(pUuidList:PSdpQueryUuid;
+                                          listSize:ULONG;
+                                          pRangeList:PSdpAttributeRange;
+                                          numRanges:ULONG;
+                                          out pppSdpRecord:PISdpRecord{pppSdpRecord:PPISdpRecord};
+                                          pNumRecords:PULONG):HRESULT; stdcall;
+     end;
+
+
+     ISdpStream = interface(IUnknown)
+      ['{A6ECD9FB-0C7A-41A3-9FF0-0B617E989357}']
+{$IF DEFINED(WINCE) OR DEFINED(WINCE_EMULATION)}
+       function Validate(pStream:PUCHAR; _size:ULONG; pErrorByte:PULONG):HRESULT; stdcall;
+{$ELSE}
+       function Validate(pStream:PUCHAR; _size:ULONG; pErrorByte:PULONG_PTR):HRESULT; stdcall;
+{$ENDIF}
+       function Walk(pStream:PUCHAR; _size:ULONG; pWalk:ISdpWalk):HRESULT; stdcall;
+
+       function RetrieveRecords(pStream:PUCHAR; _size:ULONG; var ppSdpRecords:ISdpRecord;{ppSdpRecords:PISdpRecord;} pNumRecords:PULONG):HRESULT; stdcall;
+
+       function RetrieveUuid128(pStream:PUCHAR; pUuid128:PGUID):HRESULT; stdcall;
+
+       function RetrieveUint16(pStream:PUCHAR; pUint16:PUSHORT):HRESULT; stdcall;
+       function RetrieveUint32(pStream:PUCHAR; pUint32:ULONG):HRESULT; stdcall;
+       function RetrieveUint64(pStream:PUCHAR; pUint64:PULONGLONG):HRESULT; stdcall;
+       function RetrieveUint128(pStream:PUCHAR; pUint128:PSDP_ULARGE_INTEGER_16):HRESULT; stdcall;
+       function RetrieveInt16(pStream:PUCHAR; pInt16:PSHORT):HRESULT; stdcall;
+       function RetrieveInt32(pStream:PUCHAR; pInt32:PLONG):HRESULT; stdcall;
+       function RetrieveInt64(pStream:PUCHAR; pInt64:PLONGLONG):HRESULT; stdcall;
+       function RetrieveInt128(pStream:PUCHAR; pInt128:PSDP_LARGE_INTEGER_16):HRESULT; stdcall;
+
+       function ByteSwapUuid128(pInUuid128:PGUID; pOutUuid128:PGUID):HRESULT; stdcall;
+       function ByteSwapUint128(pInUint128:PSDP_ULARGE_INTEGER_16; pOutUint128:PSDP_ULARGE_INTEGER_16):HRESULT; stdcall;
+       function ByteSwapUint64(inUint64:ULONGLONG; pOutUint64:PULONGLONG):HRESULT; stdcall;
+       function ByteSwapUint32(uint32:ULONG; pUint32:PULONG):HRESULT; stdcall;
+       function ByteSwapUint16(uint16:USHORT; pUint16:PUSHORT):HRESULT; stdcall;
+       function ByteSwapInt128(pInInt128:PSDP_LARGE_INTEGER_16; pOutInt128:PSDP_LARGE_INTEGER_16):HRESULT; stdcall;
+       function ByteSwapInt64(inInt64:LONGLONG; pOutInt64:PLONGLONG):HRESULT; stdcall;
+       function ByteSwapInt32(int32:LONG; pInt32:PLONG):HRESULT; stdcall;
+       function ByteSwapInt16(int16:SHORT; pInt16:PSHORT):HRESULT; stdcall;
+
+       function NormalizeUuid(pDataUuid:PNODEDATA; pNormalizeUuid:PGUID):HRESULT; stdcall;
+       function RetrieveElementInfo(pStream:PUCHAR;
+                                    pElementType:PSDP_TYPE;
+                                    pElementSpecificType:PSDP_SPECIFICTYPE;
+                                    pElementSize:PULONG;
+                                    pStorageSize:PULONG;
+                                    out ppData:PUCHAR{ppData:PPUCHAR}):HRESULT; stdcall;
+       function VerifySequenceOf(pStream:PUCHAR; _size:PULONG; ofType:SDP_TYPE; pSpecificSizes:PUCHAR; pNumFound:PULONG):HRESULT; stdcall;
+     end;
+
+     ISdpRecord = interface(IUnknown)
+      ['{10276714-1456-46D7-B526-8B1E83D5116E}']
+       function CreateFromStream(pStream:PUCHAR; _size:ULONG):HRESULT; stdcall;
+       function WriteToStream(out ppStream:PUCHAR;{ppStream:PPUCHAR;} pStreamSize:PULONG; preSize:ULONG; postSize:ULONG):HRESULT; stdcall;
+       function SetAttribute(attribute:USHORT; pNode:PNODEDATA):HRESULT; stdcall;
+       function SetAttributeFromStream(attribute:USHORT; pStream:PUCHAR; _size:ULONG):HRESULT; stdcall;
+       function GetAttribute(attribute:USHORT; pNode:PNODEDATA):HRESULT; stdcall;
+       function GetAttributeAsStream(attribute:USHORT; out ppStream:PUCHAR;{ppStream:PPUCHAR;} pSize:PULONG):HRESULT; stdcall;
+       function Walk(pWalk:ISdpWalk):HRESULT; stdcall;
+       function GetAttributeList(out ppList:PUSHORT;{ppList:PPUSHORT;} pListSize:PULONG):HRESULT; stdcall;
+       function GetString(_offset:USHORT; pLangId:PUSHORT; var ppString:PWCHAR{ppString:PPWCHAR}):HRESULT; stdcall;
+       function GetIcon(cxRes:longint; cyRes:longint; phIcon:LPHICON):HRESULT; stdcall;
+       function GetServiceClass(pServiceClass:LPGUID):HRESULT; stdcall;
+     end;
+
+
+     IBluetoothDevice = interface(IUnknown)
+      ['{5BD0418B-D705-4766-B215-183E4EADE341}']
+       function Initialize(pInfo:PBthDeviceInfo):HRESULT; stdcall;
+       function GetInfo(pInfo:PBthDeviceInfo):HRESULT; stdcall;
+       function GetString(_type:BthDeviceStringType; var ppString:PWCHAR{ppString:PPWCHAR}):HRESULT; stdcall;
+       function SetString(_type:BthDeviceStringType; pString:PWCHAR):HRESULT; stdcall;
+       function GetIcon(cxRes:longint; cyRes:longint; phIcon:LPHICON):HRESULT; stdcall;
+       function GetApprovedServices(pServices:PGUID; pServiceCount:PULONG):HRESULT; stdcall;
+       function GetPassKey(hwndParent:HWND; pPassKey:PUCHAR; pPassKeyLength:PUCHAR):HRESULT; stdcall;
+     end;
+
+     IBluetoothAuthenticate = interface(IUnknown)
+      ['{5F0FBA2B-8300-429D-99AD-96A2835D4901}']
+
+     end;
+
+implementation
+
+end.

+ 83 - 0
packages/winceunits/src/bthutil.pp

@@ -0,0 +1,83 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit bthutil;
+
+{$CALLING cdecl}
+
+interface
+
+uses Windows;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// @enum    BTH_RADIO_MODE |
+//          Enumerate all the possible modes of operation of the bluetooth radio
+//
+////////////////////////////////////////////////////////////////////////////////
+
+type
+     BTH_RADIO_MODE = DWORD;
+
+const
+      BTH_POWER_OFF    = 0;
+      BTH_CONNECTABLE  = 1;
+      BTH_DISCOVERABLE = 2;
+
+const
+      BthutilDLL = 'bthutil.dll';
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// @func    int | BthSetMode |
+//          This function set the bluetooth Mode of operation and reflects it in
+//          the control panel.  It also persist that state across hardware insertion
+//          and reboot
+//
+// @syntax  BthSetMode( DWORD dwMode )
+//
+// @parm    DWORD | dwMode |
+//          BTH_POWER_OFF to turn the bluetooth radio OFF
+//          BTH_CONNECTABLE to turn the bluetooth radio ON and CONNECTABLE
+//          BTH_DISCOVERABLE to turn the bluetooth radio ON and CONNECTABLE and DISCOVERABLE
+//
+// @rdesc   int: ERROR_SUCCESS on success.  Error code describing error on failure.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+function BthSetMode(dwMode:DWORD):longint; external BthutilDLL name 'BthSetMode';
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// @func    int | BthGetMode |
+//          This function retrieves the current mode of operation of the bluetooth radio
+//
+// @syntax  BthGetMode( DWORD* pdwMode )
+//
+// @parm    DWORD* | pdwMode |
+//          BTH_POWER_OFF to indicate the bluetooth radio is OFF
+//          BTH_CONNECTABLE to indicate the bluetooth radio ON and CONNECTABLE
+//          BTH_DISCOVERABLE to indicate the bluetooth radio ON and CONNECTABLE and DISCOVERABLE
+//
+// @rdesc   int: ERROR_SUCCESS on success.  Error code describing error on failure.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+function BthGetMode(pdwMode:LPDWORD):longint; external BthutilDLL name 'BthGetMode';
+
+implementation
+
+end.

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

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

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

@@ -0,0 +1,726 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+
+//
+// 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.

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

@@ -0,0 +1,240 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+
+//
+// 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.

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

@@ -0,0 +1,73 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+
+//
+// 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.

+ 315 - 0
packages/winceunits/src/keybd.pp

@@ -0,0 +1,315 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+//
+// Module: keybd.h
+//
+// Non Win32 defines and structs for WinCE keyboard.
+//
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit keybd;
+
+interface
+
+uses windows, WinIOCtl;
+
+// EXTERNAL DRIVERS
+// KEY_STATE_FLAGS | Flags for keyboard events and shift state.
+{
+These flags perform a number of functions:
+
+The low order bits are used to keep track of a key state.  This
+allows using 256 UINT8's for the key state array just like Windows does
+already.
+
+The upper bits keep track of shift state on a per key basis.  Since
+we are not maintaining a complete key state array for each task, this
+gives us some extra info without a big memory penalty.
+
+The KeyStateDownFlag does double duty internal to the driver to
+identify key up or key down events.
+
+KeyShiftDeadFlag is set by the <f KeybdDriverVKeyToUnicode> function
+to signify that the character generated is a dead character.
+
+KeyShiftNoCharacterFlag is set by the <f KeybdDriverVKeyToUnicode>
+function to signify that there is no valid character to generate for the
+given virtual key event.  This may be the case on a key up event or a key
+which only changes the shift state.
+
+The control, alt, shift and capital flags are set by the <f
+KeybdDriverVKeyToUnicode> function to encapsulate the shift state when the
+character was generated.
+
+KeybdDriverVKeyToUnicode
+KeybdEventCallback
+}
+
+type
+     KEY_STATE_FLAGS = UINT32;
+
+const
+      KeyStateToggledFlag			 = $0001;	//	Key is toggled.
+      KeyStateGetAsyncDownFlag = $0002;	//	Key went down since last GetAsyncKey call.
+      KeyStateReserved4			   = $0004;
+      KeyStateReserved8			   = $0008;
+      KeyStateReserved10			 = $0010;
+      KeyStateReserved20			 = $0020;
+      KeyStatePrevDownFlag		 = $0040;	//	Key was previously down.
+      KeyStateDownFlag			   = $0080;	//	Key is currently down.
+
+      KeyStateKeyEventFlag		= $80000000;	//	Internal
+      KeyShiftAnyCtrlFlag			= $40000000;  //  L or R control is down.
+      KeyShiftAnyShiftFlag		= $20000000;  //  L or R shift is down.
+      KeyShiftAnyAltFlag			= $10000000;  //  L or R alt is down.
+      KeyShiftCapitalFlag			= $08000000;  //  VK_CAPITAL is toggled.
+      KeyShiftLeftCtrlFlag		= $04000000;  //  L control is down.
+      KeyShiftLeftShiftFlag		= $02000000;  //  L shift is down.
+      KeyShiftLeftAltFlag			= $01000000;  //  L alt is down.
+      KeyShiftLeftWinFlag			= $00800000;  //  L Win key is down.
+      KeyShiftRightCtrlFlag		= $00400000;  //  R control is down.
+      KeyShiftRightShiftFlag	= $00200000;  //  R shift is down.
+      KeyShiftRightAltFlag		= $00100000;  //  R alt is down.
+      KeyShiftRightWinFlag		= $00080000;  //  R Win key is down.
+      KeyShiftReserved40000		= $00040000;  //  Reserved.
+      KeyShiftDeadFlag			  = $00020000;  //  Corresponding char is dead char.
+      KeyShiftNoCharacterFlag	= $00010000;  //  No corresponding char.
+
+			KeyShiftLanguageFlag1		= $00008000;  //  Use for language specific shifts.
+      KeyShiftKeybdEventFlag	= $00004000;	//	Not for external use.
+
+      KeyShiftUseVKNullFlag		= $00002000;  //  Not for external use.
+      KeyShiftNumLockFlag			= $00001000;  //  NumLock toggled state.
+      KeyShiftScrollLockFlag	= $00000800;  //  ScrollLock toggled state.
+      KeyShiftReserved400			= $00000400;  //  Reserved.
+      KeyShiftReserved200			= $00000200;  //  Reserved.
+      KeyShiftReserved100			= $00000100;  //  Reserved.
+
+// Japanese keyboard
+      KeyShiftKanaFlag			  = KeyShiftLanguageFlag1;  //  Kana lock is toggled.
+
+
+function KeyStateIsDown(Flags:KEY_STATE_FLAGS):BOOL;
+
+function KeyStateIsPrevDown(Flags:KEY_STATE_FLAGS):BOOL;
+
+function KeyStateIsToggled(Flags:KEY_STATE_FLAGS):BOOL;
+
+function KeyStateIsDownTransition(Flags:KEY_STATE_FLAGS):BOOL;
+
+const
+      COUNT_VKEYS     = 256;
+
+{
+		EXTERNAL DRIVERS
+		KEY_STATE       | Array of virtual key states.
+}
+type
+     KEY_STATE = array[0..COUNT_VKEYS-1] of UINT8;
+
+//
+// KeyboardDriverGetDeviceInfo query capability definitions
+//
+
+
+//	EXTERNAL DRIVERS
+//	ULONG | KBDI_VKEY_TO_UNICODE_INFO_ID |
+//  Id for KeybdDriverGetInfo to get Unicode conversion info.
+//
+// xref
+//	KeybdDriverGetInfo
+//	KBDI_VKEY_TO_UNICODE_INFO
+//	KeybdDriverVKeyToUnicode
+const
+      KBDI_VKEY_TO_UNICODE_INFO_ID	= 0;
+
+
+// EXTERNAL DRIVERS KEYBD_DRIVER
+// KBDI_VKEY_TO_UNICODE_INFO
+// Info required to set up for Unicode conversion.
+//
+// xref
+//	KeybdDriverGetInfo
+//	KBDI_VKEY_TO_UNICODE_INFO_ID
+//	KeybdDriverVKeyToUnicode
+//	TO_UNICODE_STATE
+{
+cbToUnicodeState is the number of bytes necessary to store the
+driver specific state which is required to generate characters from a
+virtual key.  For example, a French keyboard driver may need to remember
+that an accent key was previously pressed in order to decide on a specific
+Unicode character to generate for a virtual key.  This value may be 0 if
+no other state besides <t KEY_STATE> is required to generate characters,
+e.g., English keyboard drivers.
+
+cMaxToUnicodeCharacters is the maximum number of characters that may
+be generated by a call to KeybdDriverVKeyToUnicode.  For example, if a
+user presses the '^' key and then the 'b' key, a French keyboard driver
+would generate the two characters, '^' 'b', when the second key is
+pressed.  Note that this is not the count of bytes required to store the
+characters, it is just the number of characters.
+}
+type
+     KBDI_VKEY_TO_UNICODE_INFO = record
+       cbToUnicodeState:UINT32;				// @FIELD 	Count of bytes required
+											                //			for state info for Unicode
+											                //			character generation.
+       cMaxToUnicodeCharacters:UINT32;		// @FIELD	Maximum number of characters
+											                    //			generated for a single virtual key.
+     end;
+
+// EXTERNAL DRIVERS
+// ULONG | KBDI_AUTOREPEAT_INFO_ID
+// Id for KeybdDriverGetInfo to get keyboard auto-repeat info.
+//
+// xref
+//  KeybdDriverGetInfo
+//  KBDI_AUTOREPEAT_INFO
+//	KBDI_AUTOREPEAT_SELECTIONS_INFO_ID
+const
+      KBDI_AUTOREPEAT_INFO_ID	= 1;
+
+
+// Info about the keyboard autorepeat capabilities and settings.
+{
+cInitialDelaysSelectable gives the number of initial delays which
+may be set.  Query again using <c KBDI_AUTOREPEAT_SELECTIONS_INFO_ID> to
+get the actual values available.
+
+cRepeatRatesSelectable is similar to cInitialDelaysSelectable except
+that it gives the number of repeat rates available.
+}
+type
+     KBDI_AUTOREPEAT_INFO = record
+	   	 CurrentInitialDelay:INT32;		// @FIELD	Current initial delay in milliseconds.
+	     CurrentRepeatRate:INT32;			// @FIELD	Current repeat rate in keys per second.
+	     cInitialDelaysSelectable:INT32;	// @FIELD	Number of initial delays selectable.
+	     cRepeatRatesSelectable:INT32;		// @FIELD	Number of repeat rates supported.
+     end;
+
+const
+      KBD_AUTO_REPEAT_INITIAL_DELAY_DEFAULT  =   500;
+      KBD_AUTO_REPEAT_INITIAL_DELAY_MIN      =   250;
+      KBD_AUTO_REPEAT_INITIAL_DELAY_MAX      =  1000;
+
+      KBD_AUTO_REPEAT_KEYS_PER_SEC_DEFAULT   =    20;
+      KBD_AUTO_REPEAT_KEYS_PER_SEC_MIN       =     2;
+      KBD_AUTO_REPEAT_KEYS_PER_SEC_MAX       =    30;
+
+
+// Id for KeybdDriverGetInfo to get keyboard auto-repeat selections info.
+{
+When KeybdDriverGetInfo is called with this value, the lpOutput
+parameter should be a pointer to an array of INT32's to hold the selection
+info.  The initial delays will be put at the beginning of the array
+followed by the repeat rate selections.  The number of initial delay
+values is determined by calling <f KeybdDriverGetInfo> using <c
+KBDI_AUTOREPEAT_INFO_ID> and looking at the returned
+cInitialDelaysSelectable field.  If this value is -1, there will be two
+(2) values, the min and max and the initial delay may be set to any value
+in this range.  This value may be 0 if the initial delay is not settable.
+Similarly, if cRepeatRatesSelectable is 0, there will be no repeat rate
+information.  If it is -1, there will be two (2) values, the min and max.
+
+Initial delay values are in milliseconds.  Repeat rates are in keys per
+second.
+}
+const
+      KBDI_AUTOREPEAT_SELECTIONS_INFO_ID	= 2;
+
+// INTERNATIONAL
+const
+      KBDI_KEYBOARD_STATUS_ID = 3;
+
+const
+      KBDI_KEYBOARD_PRESENT	  = $0001;
+      KBDI_KEYBOARD_ENABLED	  = $0002;
+      KBDI_KEYBOARD_ENTER_ESC	= $0004;
+      KBDI_KEYBOARD_ALPHA_NUM	= $0008;
+
+
+// Reserve for SHIME_MODE.
+// Pass in the SHIME_MODE as the input parameter.
+const
+      KBDI_SHIME_MODE_ID = 4;
+
+      KBDI_SHIME_MODE_NONE                = $0000;
+      KBDI_SHIME_MODE_SPELL               = $0001;
+      KBDI_SHIME_MODE_SPELL_CAPS          = $0002;
+      KBDI_SHIME_MODE_SPELL_CAPS_LOCK     = $0003;
+      KBDI_SHIME_MODE_AMBIGUOUS           = $0004;
+      KBDI_SHIME_MODE_AMBIGUOUS_CAPS      = $0005;
+      KBDI_SHIME_MODE_AMBIGUOUS_CAPS_LOCK = $0006;
+      KBDI_SHIME_MODE_NUMBERS             = $0007;
+      KBDI_SHIME_MODE_CUSTOM              = $0008;
+
+
+// External keyboard interface
+const
+      DEVCLASS_KEYBOARD_STRING = '{CBE6DDF2-F5D4-4E16-9F61-4CCC0B6695F3}';
+      DEVCLASS_KEYBOARD_GUID:System.TGUID = (D1: $CBE6DDF2; D2: $F5D4; D3: $4E16; D4: ($9F, $61, $4C, $CC, $0B, $66, $95, $F3));
+//      DEVCLASS_KEYBOARD_GUID:System.TGUID = '{CBE6DDF2-F5D4-4E16-9F61-4CCC0B6695F3}';
+
+
+// Pass in the KEY_STATE_FLAGS as the input parameter.
+const
+      IOCTL_KBD_SET_MODIFIERS = (FILE_DEVICE_KEYBOARD shl 16) or
+                                (1 shl 2) or
+                                METHOD_BUFFERED or
+                                (FILE_ANY_ACCESS shl 14);
+
+
+      IOCTL_HID_SET_MODIFIERS = IOCTL_KBD_SET_MODIFIERS;
+
+// Pass in the KBDI_AUTOREPEAT_INFO as the input parameter.
+const
+      IOCTL_KBD_SET_AUTOREPEAT = (FILE_DEVICE_KEYBOARD shl 16) or
+                                 (2 shl 2) or
+                                 METHOD_BUFFERED or
+                                 (FILE_ANY_ACCESS shl 14);
+
+      IOCTL_HID_SET_AUTOREPEAT = IOCTL_KBD_SET_AUTOREPEAT;
+
+// Pass in the Input Language's fLocaleFlags as the input parameter.
+const
+      IOCTL_KBD_SET_LOCALE_FLAGS = (FILE_DEVICE_KEYBOARD shl 16) or
+                                   (3 shl 2) or
+                                   METHOD_BUFFERED or
+                                   (FILE_ANY_ACCESS shl 14);
+
+implementation
+
+function KeyStateIsDown(Flags:KEY_STATE_FLAGS):BOOL; inline;
+begin
+  KeyStateIsDown:=(Flags and KeyStateDownFlag)<>0;
+end;
+
+function KeyStateIsPrevDown(Flags:KEY_STATE_FLAGS):BOOL; inline;
+begin
+  KeyStateIsPrevDown:=(Flags and KeyStatePrevDownFlag)<>0;
+end;
+
+function KeyStateIsToggled(Flags:KEY_STATE_FLAGS):BOOL; inline;
+begin
+  KeyStateIsToggled:=(Flags and KeyStateToggledFlag)<>0;
+end;
+
+function KeyStateIsDownTransition(Flags:KEY_STATE_FLAGS):BOOL; inline;
+begin
+  KeyStateIsDownTransition:=KeyStateIsDown(Flags) and (not KeyStateIsPrevDown(Flags));
+end;
+
+end.

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

@@ -0,0 +1,3135 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+
+//
+// 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.

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

@@ -0,0 +1,1881 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+
+//
+// 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.

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

@@ -0,0 +1,1182 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+
+// -----------------------------------------------------------------------------
+//
+//  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.

+ 244 - 0
packages/winceunits/src/nled.pp

@@ -0,0 +1,244 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+//
+//File Name:	nled.h
+//
+//Abstract:   Notification LED interface.
+//
+//Notes:
+//
+//The notification LED is distinguished from other LED's which may be on the system
+//in that it can be on or blinking even if the rest of the system is powered down.  This
+//implies a certain level of hardware support for this functionality.
+//
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit NLed;
+
+{$CALLING cdecl}
+
+interface
+
+uses Windows, WinIOCtl;
+
+// @CESYSGEN IF COREDLL_NLED
+
+//
+// NLedDriverGetDeviceInfo query definitions
+//
+
+{		@DOC	EXTERNAL DRIVERS
+		@const	ULONG | NLED_COUNT_INFO_ID |
+
+Id for <f NLedDriverGetDeviceInfo> to get count of notification LED's
+
+		@XREF
+
+			<tab><f NLedDriverGetDeviceInfo><nl>
+			<tab><t NLDI_COUNT_INFO><nl>
+
+}
+const
+      NLED_COUNT_INFO_ID	= 0;
+
+
+{      @DOC    EXTERNAL DRIVERS
+		@STRUCT	NLED_COUNT_NFO |
+
+Info about number of notification LED's.
+
+		@XREF
+
+			<tab><f NLedDriverGetDeviceInfo><nl>
+			<tab><c NLED_COUNT_INFO_ID><nl>
+
+		@COMM
+
+A device will usually have one notification LED.  Some devices may have
+none however.  It would be unusual to have more than one because of the
+power drain.
+
+
+}
+type
+     NLED_COUNT_INFO = record
+	    	 cLeds:UINT;				// @FIELD 	Count of LED's
+     end;
+
+{		@DOC	EXTERNAL DRIVERS
+		@const	ULONG | NLED_SUPPORTS_INFO_ID |
+
+Id for <f NLedDriverGetDeviceInfo> to get supported capabilities of a
+notification LED.
+
+
+		@XREF
+
+			<tab><f NLedDriverGetDeviceInfo><nl>
+			<tab><t NLDI_SUPPORTS_INFO><nl>
+
+}
+const
+      NLED_SUPPORTS_INFO_ID	= 1;
+
+
+{      @DOC    EXTERNAL DRIVERS
+		@STRUCT	NLED_SUPPORTS_NFO |
+
+Info about what a notification LED supports.
+
+		@XREF
+
+			<tab><f NLedDriverGetDeviceInfo><nl>
+			<tab><c NLED_SUPPORTS_INFO_ID><nl>
+
+		@COMM
+
+Caller should first get the number of notification LED's on the system.  
+This is usually one but may be 0 and could be greater than 1.  Caller 
+should fill in the LedNum and then call <f NLedDriverGetDeviceInfo>.  Led 
+numbering starts at 0.
+
+The lCycleAdjust field is the granularity to which cycle time adjustments 
+can be made.  E.g., if the granularity is 1/16 second, lCycleAdjust = 
+62500 microseconds.  If the LED does not support blinking, this value 
+should be 0.
+
+Values are given in microseconds only to deal with computations involving 
+fractional milliseconds.  Usually only settings in the milliseconds range 
+are meaningful.  
+
+Usually a device will report that it supports up to two of:
+
+	fAdjustTotalCycleTime
+	fAdjustOnTime
+	fAdjustOffTime
+
+since any two determine the third.  The most likely settings are:
+
+	1. The cycle time is not adjustable:
+
+		fAdjustTotalCycleTime == FALSE
+		fAdjustOnTime == FALSE
+		fAdjustOffTime == FALSE
+
+	2. Only the overall cycle time is adjustable:
+
+		fAdjustTotalCycleTime == TRUE
+		fAdjustOnTime == FALSE
+		fAdjustOffTime == FALSE
+
+	3. The on and off times are independently adjustable.
+
+		fAdjustTotalCycleTime == FALSE
+		fAdjustOnTime == TRUE
+		fAdjustOffTime == TRUE
+}
+
+type
+     NLED_SUPPORTS_INFO = record
+	    	 LedNum:UINT;						// @FIELD 	LED number, 0 is first LED
+	      lCycleAdjust:LONG;				// @FIELD	Granularity of cycle time adjustments (microseconds)
+	      fAdjustTotalCycleTime:BOOL;		// @FIELD	LED has an adjustable total cycle time
+	      fAdjustOnTime:BOOL;				// @FIELD	LED has separate on time
+	      fAdjustOffTime:BOOL;				// @FIELD	LED has separate off time
+	      fMetaCycleOn:BOOL;				// @FIELD	LED can do blink n, pause, blink n, ...
+	      fMetaCycleOff:BOOL;				// @FIELD	LED can do blink n, pause n, blink n, ...
+     end;
+
+
+{		@DOC	EXTERNAL DRIVERS
+		@const	ULONG | NLED_SETTINGS_INFO_ID |
+
+Id for <f NLedDriverGetDeviceInfo> to get current settings of a
+notification LED.
+
+
+		@XREF
+
+			<tab><f NLedDriverGetDeviceInfo><nl>
+			<tab><t NLDI_SETTINGS_INFO><nl>
+}
+const
+      NLED_SETTINGS_INFO_ID	= 2;
+
+
+{      @DOC    EXTERNAL DRIVERS
+		@STRUCT	NLED_SETTINGS_NFO |
+
+Info about the current settings of a notification LED.
+
+		@XREF
+
+			<tab><f NLedDriverGetDeviceInfo><nl>
+			<tab><c NLED_SETTINGS_INFO_ID><nl>
+
+		@COMM
+
+Caller should first get the number of notification LED's on the system.
+This is usually one but may be 0 and could be greater than 1.  Caller
+should fill in the LedNum and then call <f NLedDriverGetDeviceInfo>.  Led
+numbering starts at 0.
+
+Note that the hardware may have some minimum on or off time, so setting the OnTime or OffTime
+fields to 0 may still result in a non-zero on or off time.
+}
+type
+     NLED_SETTINGS_INFO = record
+       LedNum:UINT;                 // @FIELD   LED number, 0 is first LED
+       OffOnBlink:longint;             // @FIELD   0 == off, 1 == on, 2 == blink
+       TotalCycleTime:LONG;         // @FIELD   total cycle time of a blink in microseconds
+       OnTime:LONG;                 // @FIELD   on time of a cycle in microseconds
+       OffTime:LONG;                // @FIELD   off time of a cycle in microseconds
+       MetaCycleOn:longint;            // @FIELD   number of on blink cycles
+       MetaCycleOff:longint;           // @FIELD   number of off blink cycles
+     end;
+
+
+// NLED driver IOCTL codes
+const
+      IOCTL_NLED_GETDEVICEINFO = (FILE_DEVICE_NLED shl 16) or
+                                 (FILE_ANY_ACCESS shl 14) or
+                                 ($0100 shl 2) or
+                                 METHOD_BUFFERED;
+
+      IOCTL_NLED_SETDEVICE =(FILE_DEVICE_NLED shl 16) or
+                            (FILE_ANY_ACCESS shl 14) or
+                            ($0101 shl 2) or
+                            METHOD_BUFFERED;
+
+// Battery driver interface GUID (used with AdvertiseInterface())
+const
+      NLED_DRIVER_CLASS        = '{CBB4F234-F35F-485b-A490-ADC7804A4EF3}';
+
+// API event name for the NLED interface.  If calling OpenEvent() on this name returns a valid
+// handle, the NLED APIs exist on the platform.  The handle will be signaled when the APIs become
+// ready.
+const
+      NLED_API_EVENT_NAME     = 'SYSTEM/NLedAPIsReady';
+
+type
+     PFN_NLED_SET_DEVICE = function(nDeviceId:UINT; pInput:pointer):BOOL; cdecl;
+     PFN_NLED_GET_DEVICE_INFO = function(nInfoId:UINT; pOutput:pointer):BOOL; cdecl;
+
+function NLedGetDeviceInfo(nInfoId:UINT; pOutput:pointer):BOOL; external KernelDLL name 'NLedGetDeviceInfo'; // index 49F
+function NLedSetDevice(nDeviceId:UINT; pInput:pointer):BOOL;  external KernelDLL name 'NLedSetDevice'; // index 4A0
+
+// @CESYSGEN ENDIF COREDLL_NLED
+
+implementation
+
+end.

+ 325 - 0
packages/winceunits/src/phone.pp

@@ -0,0 +1,325 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+//
+// phone.h
+//
+// Phone API
+//
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit phone;
+
+{$CALLING cdecl}
+
+interface
+
+uses Windows;
+
+type
+     CALLERIDTYPE = (CALLERIDTYPE_UNAVAILABLE,
+                     CALLERIDTYPE_BLOCKED,
+                     CALLERIDTYPE_AVAILABLE);
+
+type
+     IOM = (IOM_MISSED,
+            IOM_INCOMING,
+            IOM_OUTGOING);
+
+type
+     CALLLOGSEEK = (CALLLOGSEEK_BEGINNING := 2,
+                    CALLLOGSEEK_END := 4);
+
+// Thought out by me specially for CALLLOGENTRY._flags field.
+const
+      CALLLOGENTRY_FLAG_INCOMING  = 0; // direction of call.  (Missed calls are incoming.)
+      CALLLOGENTRY_FLAG_OUTGOING  = 1; // direction of call.  (Missed calls are incoming.)
+      CALLLOGENTRY_FLAG_CONNECTED = 2; // Did the call connect? (as opposed to busy, no answer)
+      CALLLOGENTRY_FLAG_ENDED     = 4; // Was the call ended? (as opposed to dropped)
+      CALLLOGENTRY_FLAG_DROPPED   = 0; // Was the call dropped? (as opposed to ended)
+      CALLLOGENTRY_FLAG_ROAMING   = 8; // Roaming (vs. local)
+      CALLLOGENTRY_FLAG_LOCAL     = 0; // Local
+
+type
+     CALLLOGENTRY = record
+       cbSize:DWORD;  // sizeof CALLLOGENTRY
+       ftStartTime:FILETIME;
+       ftEndTime:FILETIME;
+       _iom:IOM;
+       _flags:UINT;
+{
+       BOOL fOutgoing:1;        // direction of call.  (Missed calls are incoming.)
+       BOOL fConnected:1;     // Did the call connect? (as opposed to busy, no answer)
+       BOOL fEnded:1;        // Was the call ended? (as opposed to dropped)
+       BOOL fRoam:1;        // Roaming (vs. local)
+}
+       cidt:CALLERIDTYPE;
+       pszNumber:PTSTR;
+       pszName:PTSTR;
+       pszNameType:PTSTR;    // "w" for work tel, "h" for home tel, for example
+       pszNote:PTSTR;    // filename of associated Notes file
+     end;
+     PCALLLOGENTRY = ^CALLLOGENTRY;
+
+const
+      PhoneDLL = 'phone.dll';
+
+// Open the call log and set the seek pointer to the beginning.
+function PhoneOpenCallLog(ph:LPHANDLE):HRESULT; external PhoneDLL name 'PhoneOpenCallLog';
+
+// PhoneGetCallLogEntry returns one call log entry and advances the seek
+// pointer.
+// pentry->cbSize must be set to "sizeof CALLLOGENTRY" before this function is
+// called.
+// The entries are returned in order of start time, the most recent call first.
+// It is the responsibility of the caller to LocalFree any strings
+// which are returned.
+// A return value of S_FALSE indicates there are no more entries.
+function PhoneGetCallLogEntry(h:HANDLE; pentry:PCALLLOGENTRY):HRESULT; external PhoneDLL name 'PhoneGetCallLogEntry';
+
+// PhoneSeekCallLog seeks to a record in the call log.
+// iRecord is the zero-based index of the  record, starting at the beginning
+// if seek == CALLLOGSEEK_BEGINNING, at the end if CALLLOGSEEK_END.
+// piRecord returns the zero-based index (from the beginning) of the seek
+// pointer after the seek is performed.
+// PhoneSeekCallLog(h, CALLLOGSEEK_END, 0, &count) will return the number of
+// records.
+function PhoneSeekCallLog(hdb:HANDLE;
+                          _seek:CALLLOGSEEK;
+                          iRecord:DWORD;
+                          piRecord:LPDWORD):HRESULT; external PhoneDLL name 'PhoneGetCallLogEntry';
+
+// Close the call log
+function PhoneCloseCallLog(h:HANDLE):HRESULT; external PhoneDLL name 'PhoneCloseCallLog';
+
+
+// The Call Log application supports the context menu extensibility mechanism.
+// The Context name is "Phone" and the Class name is "Log".
+// The IUnknown pointer passed to the context menu handler supports IPropertyBag,
+// and the set of properties supported is as follows:
+//
+// property name:   type:   value:
+// --------------   -----   ------
+// PropSet          BSTR    "CallLog"
+// Number           BSTR    the phone number of the other person on the call
+// NumberType       BSTR    the type of phone number (e.g. "h" for home)
+// Name             BSTR    person's name
+// Year             I2      the year of the beginning time of the call
+// Month            I2      the month of the beginning time of the call
+// Day              I2      the day of the beginning time of the call
+// Hour             I2      the hour of the beginning time of the call
+// Minute           I2      the minute of the beginning time of the call
+// Second           I2      the second of the beginning time of the call
+// DayOfWeek        I2      the day of the week of the beginning time of the call
+// Duration         UI4     the duration of the call in seconds
+// CallerIDType     UI4     a CALLERIDTYPE value (see above)
+// Connected        BOOL    Did the call connect? (as opposed to busy, no answer)
+// Ended            BOOL    Was the call ended? (as opposed to dropped)
+// Outgoing         BOOL    Was the call outgoing?  (Missed calls are incoming.)
+// Roaming          BOOL    Roaming?
+// IOM              UI4     an IOM value (see above)
+
+
+// PhoneShowCallLog
+//
+// Show the Call Log, and filter it
+type
+     CALLLOGFILTER = (CALLLOGFILTER_ALL_CALLS,
+                      CALLLOGFILTER_MISSED,
+                      CALLLOGFILTER_INCOMING,
+                      CALLLOGFILTER_OUTGOING);
+
+function PhoneShowCallLog(iCallLogFilter:CALLLOGFILTER):HRESULT; external PhoneDLL name 'PhoneShowCallLog';
+
+//++++++
+//
+//  PhoneMakeCall
+//
+//       Dials a number
+type
+     tagPHONEMAKECALLINFO = record
+       cbSize:DWORD;
+       dwFlags:DWORD;
+
+      //Params to tapiRequestMakeCall
+       pszDestAddress:PCWSTR;
+       pszAppName:PCWSTR;
+       pszCalledParty:PCWSTR;
+       pszComment:PCWSTR;
+
+      // owner window for dialog box that appears when the PMCF_EDITBEFORECALLING flag is passed into PhoneMakeCall
+       hwndOwner:HWND;
+     end;
+     PHONEMAKECALLINFO = tagPHONEMAKECALLINFO;
+     PPHONEMAKECALLINFO = ^tagPHONEMAKECALLINFO;
+
+// PhoneMakeCall flags
+const
+      PMCF_DEFAULT                = $00000001;
+      PMCF_PROMPTBEFORECALLING    = $00000002;
+      PMCF_EDITBEFORECALLING      = $00000020;
+
+function PhoneMakeCall(ppmci:PPHONEMAKECALLINFO):LONG; external PhoneDLL name 'PhoneMakeCall';
+
+//
+// End PhoneMakeCall
+//
+//------
+
+
+//++++++
+//
+//  PhoneAddSpeedDial
+//
+//       adds a speed dial entry
+//
+// dwFlags - currently unused, set to 0
+//
+// piKey - in/out: the key sequence which will invoke the speed dial.
+//           currently an entry between 2 and 99 (inclusive) is valid.
+//            the API will cause existing entries to be overwritten
+//
+// pszDisplayName - the non-empty display name for the speed dial
+//
+// pszTelNumber - the non-empty tel# to be dialed
+//
+
+function PhoneAddSpeedDial(dwFlags:DWORD;
+                           piKey:LPDWORD;
+                           pszDisplayName:PTCHAR;
+                           pszTelNumber:PTCHAR):HRESULT; external PhoneDLL name 'PhoneAddSpeedDial';
+                           
+//
+// End PhoneAddSpeedDial
+//
+//------
+
+
+
+
+//++++++
+//
+//  PhoneSendDTMFStart
+//
+//  Allows an application to begin sending a DTMF tone using the
+//  current phone call.
+//
+//  Parameters:
+//    chDTMF - DTMF character to send. Must be '0'-'9', 
+//             'A'-'D', '*', or '#'.
+//
+//  Return Value:
+//    -----------------------------------------------------------
+//    Value                        Description
+//    ------------------------------------------------------------
+//    S_OK                         The operation completed successfully.
+//    E_FAIL                       An unknown error occurred.
+//    E_INVALIDARG                 chDTMF is invalid.
+//    E_NOTIMPL                    No phone is present on the device, the 
+//                                 phone service is not running, or no 
+//                                 calls are currently active.
+//    
+//    Other custom failure codes where the facility code is
+//    FACILITY_WINDOWS_CE may be retrieved using the HRESULT_CODE
+//    macro:
+//    -----------------------------------------------------------
+//    Error Code                   Description
+//    ------------------------------------------------------------
+//    ERROR_DEVICE_NOT_CONNECTED   No phone is present on the device, 
+//                                 the phone service is not running, or 
+//                                 no calls are currently active.
+//
+//  Remarks:
+//    Caller must call PhoneSendDTMFStop to stop the DTMF tone.
+//
+//    This function will fail if no phone is present on the 
+//    device, the phone service is not running, or no calls are  
+//    currently active. If a subsequent call to this API is made 
+//    by the caller or any other application before the DTMF tone  
+//    is finished the original DTMF tone will cease and the new 
+//    DTMF will be sent.
+//
+
+function PhoneSendDTMFStart(chDTMF:TCHAR):HRESULT; external PhoneDLL name 'PhoneSendDTMFStart';
+
+//
+// End PhoneSendDTMFStart
+//
+//------
+
+
+
+//++++++
+//
+//  PhoneSendDTMFStop
+//
+//  Stops an existing DTMF tone.
+//
+//  Remarks:
+//    This function stops all DTMF tones. Applications
+//    may use PhoneSendDTMFStart to begin a DTMF tone.
+//
+
+procedure PhoneSendDTMFStop; external PhoneDLL name 'PhoneSendDTMFStop';
+
+//
+// End PhoneSendDTMFStop
+//
+//------
+
+
+//++++++
+//
+//  PhoneIsEmergencyNumber
+//
+//  Determines if a string contains an emergency phone number.
+//
+//  Parameters:
+//    fTailMatchOnly
+//        [in] If this argument is set to TRUE, the function only 
+//        attempts to match emergency numbers at the end of 
+//        pszNumber. If this value is FALSE, the function attempts 
+//        to match the emergency string with the full pszNumber 
+///       argument exactly.
+//    pszNumber
+//        [in] String to match. If this pointer is NULL or points 
+//        to an empty string, the function returns FALSE.
+//    ppszEmergencyNumber
+//        [out] On success, constant pointer to the emergency phone 
+//        number matched in pszNumber. Caller must not free. On 
+//        failure, this pointer is undefined. Optional, may be NULL.
+//
+//  Return Value:
+//    TRUE if pszNumber contains an emergency number; otherwise FALSE.
+//
+//  Remarks:
+//    The system merges the list of emergency phone numbers from 
+//    the registry and the SIM, if available. The list of emergency 
+//    numbers can vary by device.
+//
+
+function PhoneIsEmergencyNumber(fTailMatchOnly:BOOL;
+                                pszNumber:LPCTSTR;
+                                ppszEmergencyNumber:PLPWStr):BOOL;external PhoneDLL name 'PhoneIsEmergencyNumber';
+
+//
+// End PhoneIsEmergencyNumber
+//
+//------
+
+
+implementation
+
+end.

+ 901 - 0
packages/winceunits/src/ras.pp

@@ -0,0 +1,901 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+//
+// Module Name:
+//
+//   ras.h
+//
+// Abstract:
+//
+//   Remote Access Service structures and defines
+//
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit RAS;
+
+{$CALLING cdecl}
+
+interface
+
+uses Windows, Tapi;
+
+{$PACKRECORDS 4} // #include "pshpack4.h"
+
+const
+      RAS_MaxEntryName      = 20;
+      RAS_MaxDeviceName     = 128;
+      RAS_MaxDeviceType     = 16;
+      RAS_MaxParamKey       = 32;
+      RAS_MaxParamValue     = 128;
+      RAS_MaxPhoneNumber    = 128;
+      RAS_MaxCallbackNumber = 48;
+      RAS_MaxIpAddress      = 15;
+      RAS_MaxIpxAddress     = 21;
+
+// Ras extensions
+
+     	RAS_MaxAreaCode			= 10;
+     	RAS_MaxPadType			 = 32;
+     	RAS_MaxX25Address	= 200;
+     	RAS_MaxFacilities	= 200;
+     	RAS_MaxUserData			= 200;
+
+// RAS IP Address
+
+type
+     tagRasIpAddr = record
+       a:byte;
+       b:byte;
+       c:byte;
+       d:byte;
+     end;
+     RASIPADDR = tagRasIpAddr;
+
+// RAS Entry Definition
+type
+      tagRASENTRYW = RECORD
+	       dwSize:DWORD;
+	       dwfOptions:DWORD;
+	       dwCountryID:DWORD;
+	       dwCountryCode:DWORD;
+			     szAreaCode:array[0..RAS_MaxAreaCode] of WCHAR;
+	       szLocalPhoneNumber:array[0..RAS_MaxPhoneNumber] of WCHAR;
+        dwAlternateOffset:DWORD;
+	       ipaddr:RASIPADDR;
+	       ipaddrDns:RASIPADDR;
+	       ipaddrDnsAlt:RASIPADDR;
+	       ipaddrWins:RASIPADDR;
+	       ipaddrWinsAlt:RASIPADDR;
+	       dwFrameSize:DWORD;
+	       dwfNetProtocols:DWORD;
+	       dwFramingProtocol:DWORD;
+        szScript:array[0..MAX_PATH-1] of WCHAR;
+	       szAutodialDll:array[0..MAX_PATH-1] of WCHAR;
+	       szAutodialFunc:array[0..MAX_PATH-1] of WCHAR;
+			     szDeviceType:array[0..RAS_MaxDeviceType] of WCHAR;
+	       szDeviceName:array[0..RAS_MaxDeviceName] of WCHAR;
+	       szX25PadType:array[0..RAS_MaxPadType] of WCHAR;
+	       szX25Address:array[0..RAS_MaxX25Address] of WCHAR;
+	       szX25Facilities:array[0..RAS_MaxFacilities] of WCHAR;
+	       szX25UserData:array[0..RAS_MaxUserData] of WCHAR;
+	       dwChannels:DWORD;
+	       dwReserved1:DWORD;
+	       dwReserved2:DWORD;
+
+	       dwCustomAuthKey:DWORD; // EAP extension type to use
+      end;
+      RASENTRYW = tagRASENTRYW;
+
+      RASENTRY    = RASENTRYW;
+      LPRASENTRYW = ^RASENTRYW;
+      LPRASENTRY  = ^RASENTRY;
+
+// Describes Country Information
+
+      RASCTRYINFO = record
+	       dwSize:DWORD;
+	       dwCountryID:DWORD;
+	       dwNextCountryID:DWORD;
+	       dwCountryCode:DWORD;
+	       dwCountryNameOffset:DWORD;
+      end;
+
+      LPRASCTRYINFO = ^RASCTRYINFO;
+      RASCTRYINFOW  = RASCTRYINFO;
+      LPRASCTRYINFOW = ^RASCTRYINFOW;
+
+// Describes RAS Device Information
+      tagRASDEVINFOW = record
+        dwSize:DWORD;
+	       szDeviceType:array[0..RAS_MaxDeviceType] of WCHAR;
+	       szDeviceName:array[0..RAS_MaxDeviceName] of WCHAR;
+      end;
+      RASDEVINFOW = tagRASDEVINFOW;
+      RASDEVINFO		= RASDEVINFOW;
+      LPRASDEVINFOW	= ^RASDEVINFOW;
+      LPRASDEVINFO	= ^RASDEVINFO;
+
+// RASENTRY 'dwfOptions' bit flags.
+const
+      RASEO_UseCountryAndAreaCodes  = $00000001;
+      RASEO_SpecificIpAddr          = $00000002;
+      RASEO_SpecificNameServers     = $00000004;
+      RASEO_IpHeaderCompression     = $00000008;
+      RASEO_RemoteDefaultGateway    = $00000010;
+      RASEO_DisableLcpExtensions    = $00000020;
+      RASEO_TerminalBeforeDial      = $00000040;
+      RASEO_TerminalAfterDial       = $00000080;
+      RASEO_ModemLights             = $00000100;
+      RASEO_SwCompression           = $00000200;
+      RASEO_RequireEncryptedPw      = $00000400;
+      RASEO_RequireMsEncryptedPw    = $00000800;
+      RASEO_RequireDataEncryption   = $00001000;
+      RASEO_NetworkLogon            = $00002000;
+      RASEO_UseLogonCredentials     = $00004000;
+      RASEO_PromoteAlternates       = $00008000;
+      RASEO_SecureLocalFiles        = $00010000;
+      RASEO_DialAsLocalCall         = $00020000;
+
+      RASEO_ProhibitPAP             = $00040000;
+      RASEO_ProhibitCHAP            = $00080000;
+      RASEO_ProhibitMsCHAP          = $00100000;
+      RASEO_ProhibitMsCHAP2         = $00200000;
+      RASEO_ProhibitEAP             = $00400000;
+      RASEO_PreviewUserPw           = $01000000;
+      RASEO_NoUserPwRetryDialog     = $02000000;
+      RASEO_CustomScript            = $80000000;
+
+
+// RASENTRY 'dwfNetProtocols' bit flags. (session negotiated protocols)
+      RASNP_NetBEUI       = $00000001;  // Negotiate NetBEUI
+      RASNP_Ipx           = $00000002;  // Negotiate IPX
+      RASNP_Ip            = $00000004;  // Negotiate TCP/IP
+
+
+// RASENTRY 'dwFramingProtocols' (framing protocols used by the server)
+      RASFP_Ppp           = $00000001;  // Point-to-Point Protocol (PPP)
+      RASFP_Slip          = $00000002;  // Serial Line Internet Protocol (SLIP)
+      RASFP_Ras           = $00000004;  // Microsoft proprietary protocol
+
+
+// RASENTRY 'szDeviceType' strings
+      RASDT_Direct        = 'direct';    // Direct Connect (WINCE Extension)
+      RASDT_Modem         = 'modem';     // Modem
+      RASDT_Isdn          = 'isdn';      // ISDN
+      RASDT_X25           = 'x25';       // X.25
+      RASDT_Vpn           = 'vpn';		  // PPTP
+      RASDT_PPPoE         = 'PPPoE';     // PPPoE
+
+type
+    HRASCONN = HANDLE;
+    LPHRASCONN = ^HRASCONN;
+
+// Identifies an active RAS connection.  (See RasEnumConnections)
+
+    tagRASCONNW = record
+      dwSize:DWORD;
+      hrasconn:HRASCONN;
+      szEntryName:array[0..RAS_MaxEntryName] of WCHAR;
+    end;
+    RASCONNW = tagRASCONNW;
+    RASCONN = RASCONNW;
+
+    LPRASCONNW = ^RASCONNW;
+    LPRASCONN  = ^RASCONN;
+
+
+// Enumerates intermediate states to a connection.  (See RasDial)
+const
+      RASCS_PAUSED = $1000;
+      RASCS_DONE   = $2000;
+
+type
+      tagRASCONNSTATE = (RASCS_OpenPort := 0,
+                         RASCS_PortOpened,
+                         RASCS_ConnectDevice,
+                         RASCS_DeviceConnected,
+                         RASCS_AllDevicesConnected,
+                         RASCS_Authenticate,
+                         RASCS_AuthNotify,
+                         RASCS_AuthRetry,
+                         RASCS_AuthCallback,
+                         RASCS_AuthChangePassword,
+                         RASCS_AuthProject,
+                         RASCS_AuthLinkSpeed,
+                         RASCS_AuthAck,
+                         RASCS_ReAuthenticate,
+                         RASCS_Authenticated,
+                         RASCS_PrepareForCallback,
+                         RASCS_WaitForModemReset,
+                         RASCS_WaitForCallback,
+                         RASCS_Projected,
+
+                         RASCS_Interactive 			= RASCS_PAUSED,
+                         RASCS_RetryAuthentication,
+                         RASCS_CallbackSetByCaller,
+                         RASCS_PasswordExpired,
+
+                         RASCS_Connected 			= RASCS_DONE,
+                         RASCS_Disconnected
+                        );
+      RASCONNSTATE = tagRASCONNSTATE;
+      LPRASCONNSTATE = ^tagRASCONNSTATE;
+
+
+// Describes the status of a RAS connection.  (See RasConnectionStatus)
+
+      tagRASCONNSTATUSW = record
+        dwSize:DWORD;
+        rasconnstate:RASCONNSTATE;
+        dwError:DWORD;
+        szDeviceType:array[0..RAS_MaxDeviceType] of WCHAR;
+        szDeviceName:array[0..RAS_MaxDeviceName] of WCHAR;
+      end;
+      RASCONNSTATUSW = tagRASCONNSTATUSW;
+      RASCONNSTATUS = RASCONNSTATUSW;
+      LPRASCONNSTATUSW = ^RASCONNSTATUSW;
+      LPRASCONNSTATUS  = ^RASCONNSTATUS;
+
+// Describes connection establishment parameters.  (See RasDial)
+
+      tagRASDIALPARAMSW = record
+        dwSize:DWORD;
+        szEntryName:array[0..RAS_MaxEntryName] of WCHAR;
+        szPhoneNumber:array[0..RAS_MaxPhoneNumber] of WCHAR;
+        szCallbackNumber:array[0..RAS_MaxCallbackNumber] of WCHAR;
+        szUserName:array[0..UNLEN] of WCHAR;
+        szPassword:array[0..PWLEN] of WCHAR;
+        szDomain:array[0..DNLEN] of WCHAR;
+      end;
+      RASDIALPARAMSW = tagRASDIALPARAMSW;
+      RASDIALPARAMS = RASDIALPARAMSW;
+
+      LPRASDIALPARAMSW = ^RASDIALPARAMSW;
+      LPRASDIALPARAMS  = ^RASDIALPARAMS;
+
+// Describes extended connection establishment options.  (See RasDial)
+
+      tagRASDIALEXTENSIONS = record
+        dwSize:DWORD;
+        dwfOptions:DWORD;
+        hwndParent:HWND;
+        reserved:DWORD;
+      end;
+      RASDIALEXTENSIONS = tagRASDIALEXTENSIONS;
+      LPRASDIALEXTENSIONS = ^RASDIALEXTENSIONS;
+
+// 'dwfOptions' bit flags.
+const
+      RDEOPT_UsePrefixSuffix           = $00000001;
+      RDEOPT_PausedStates              = $00000002;
+      RDEOPT_IgnoreModemSpeaker        = $00000004;
+      RDEOPT_SetModemSpeaker           = $00000008;
+      RDEOPT_IgnoreSoftwareCompression = $00000010;
+      RDEOPT_SetSoftwareCompression    = $00000020;
+
+
+// Describes an enumerated RAS phone book entry name.  (See RasEntryEnum)
+type
+     tagRASENTRYNAMEW = record
+       dwSize:DWORD;
+       szEntryName:array[0..RAS_MaxEntryName] of WCHAR;
+     end;
+     RASENTRYNAMEW = tagRASENTRYNAMEW;
+     RASENTRYNAME = RASENTRYNAMEW;
+     LPRASENTRYNAMEW = ^RASENTRYNAMEW;
+     LPRASENTRYNAME  = ^RASENTRYNAME;
+
+//
+// Custom Script Dll Support
+//
+type
+     tagRASCOMMSETTINGS = record
+       dwSize:DWORD;
+       bParity:byte;
+       bStop:byte;
+       wAlign:word;
+     end;
+     RASCOMMSETTINGS = tagRASCOMMSETTINGS;
+     LPRASCOMMSETTINGS = ^tagRASCOMMSETTINGS;
+
+type
+      PFNRASSETCOMMSETTINGS = function(hPort:HANDLE;
+                                       pRasCommSettings:LPRASCOMMSETTINGS;
+                                       pvReserved:PVOID):DWORD; cdecl;
+
+type
+     RASCUSTOMSCRIPTEXTENSIONS = record
+       dwSize:DWORD;
+       pfRasSetCommSettings:PFNRASSETCOMMSETTINGS;
+     end;
+
+type
+     PFNRASGETBUFFER = function(ppBuffer:LPBYTE;
+                                pdwSize:LPDWORD):DWORD; cdecl;
+
+     PFNRASFREEBUFFER = function (pBuffer:LPBYTE):DWORD; cdecl;
+
+     PFNRASSENDBUFFER = function(hPort:HANDLE;
+                                 pBuffer:LPBYTE;
+                                 dwSize:DWORD):DWORD; cdecl;
+
+     PFNRASRECEIVEBUFFER = function(hPort:HANDLE;
+                                    pBuffer:LPBYTE;
+                                    pdwSize:LPDWORD;
+                                    dwTimeoutMilliseconds:DWORD;
+                                    hEvent:HANDLE):DWORD; cdecl;
+
+    PFNRASRETRIEVEBUFFER = function(hPort:HANDLE;
+                                    pBuffer:LPBYTE;
+                                    pdwSize:LPDWORD):DWORD; cdecl;
+
+// Protocol code to projection data structure mapping.
+
+type
+     tagRASPROJECTION = (RASP_PppIp := $8021,
+                         RASP_PppIpx := $802B,
+                         RASP_PppNbf := $803F,
+                         RASP_PppIpV6 := $8057,
+                         RASP_PppLcp := $C021,
+                         RASP_Amb := $10000,
+                         RASP_Slip := $20000);
+     RASPROJECTION = tagRASPROJECTION;
+     LPRASPROJECTION = ^RASPROJECTION;
+
+{*
+** Describes the result of a RAS AMB (Authentication Message Block)
+** projection.  This protocol is used with NT 3.1 and OS/2 1.3 downlevel
+** RAS servers.
+*}
+
+type
+     tagRASAMBA = record
+       dwSize:DWORD;
+       dwError:DWORD;
+       szNetBiosError:array[0..NETBIOS_NAME_LEN] of TCHAR;
+       bLana:byte;
+     end;
+     LPRASAMB = ^RASAMB;
+
+// Describes the result of a PPP NBF (NetBEUI) projection.
+
+type
+     tagRASPPPNBFW = record
+       dwSize:DWORD;
+       dwError:DWORD;
+       dwNetBiosError:DWORD;
+       szNetBiosError:array[0..NETBIOS_NAME_LEN] of TCHAR;
+       szWorkstationName:array[0..NETBIOS_NAME_LEN] of TCHAR;
+       bLana:byte;
+     end;
+
+     RASPPPNBF = tagRASPPPNBFW;
+     LPRASPPPNBF = ^tagRASPPPNBFW;
+
+
+// Describes the results of a PPP IPX (Internetwork Packet Exchange)
+// projection.
+
+type
+     tagRASIPX = record
+       dwSize:DWORD;
+       dwError:DWORD;
+       szIpxAddress:array[0..RAS_MaxIpxAddress] of TCHAR;
+     end;
+     RASPPPIPX = tagRASIPX;
+     LPRASPPPIPX = ^tagRASIPX;
+
+// Describes the results of an PPP IP (Internet) projection.
+
+     tagRASPPPIPW = record
+       dwSize:DWORD;
+       dwError:DWORD;
+       szIpAddress:array[0..RAS_MaxIpAddress] of WCHAR;
+       szServerIpAddress:array[0..RAS_MaxIpAddress] of WCHAR;
+	      dwOptions:DWORD;
+	      dwServerOptions:DWORD;
+     end;
+     RASPPPIPW = tagRASPPPIPW;
+     RASPPPIP = RASPPPIPW;
+
+     LPRASPPPIPW = ^RASPPPIPW;
+     LPRASPPPIP  = ^RASPPPIP;
+
+//
+// RASPPPIP 'dwOptions' and 'dwServerOptions' flags.
+//
+const
+      RASIPO_VJ       = $00000001;		// Indicates that VJ compression is on
+
+// Describes the results of an PPP IPV6 (Internet) projection.
+type
+     tagRASPPPIPV6 = record
+       dwSize:DWORD;
+       dwError:DWORD;
+       LocalInterfaceIdentifier:array[0..7]of byte;
+       PeerInterfaceIdentifier:array[0..7] of byte;
+	      LocalCompressionProtocol:array[0..1] of byte;
+	      PeerCompressionProtocol:array[0..1] of byte;
+     end;
+     RASPPPIPV6 = tagRASPPPIPV6;
+     LPRASPPPIPV6 = ^RASPPPIPV6;
+
+// Describes results of a GET_WINS/DNS I/O control. If
+// the requested address has been negotiated the boolean
+// valid is TRUE and the IpAddress contains the address of
+// the requested server.  If Valid is false IpAddress is
+// zero.
+
+     tagRASPPPAddr = record
+	      dwSize:DWORD;
+	      dwError:DWORD;
+	      Valid:BOOL;
+	      IpAddress:DWORD;
+     end;
+     RASPPPADDR = tagRASPPPAddr;
+
+// Describes the results of a SLIP (Serial Line IP) projection.
+type
+     tagRASSLIPW = record
+       dwSize:DWORD;
+       dwError:DWORD;
+       szIpAddress:array[0..RAS_MaxIpAddress] of WCHAR;
+     end;
+     RASSLIPW = tagRASSLIPW;
+     RASSLIP = RASSLIPW;
+     LPRASSLIPW = ^RASSLIPW;
+     LPRASSLIP = ^RASSLIP;
+
+
+// 	RAS Control Structures
+//
+// 	Control Request Enumeration
+type
+     tagRasCntlEnum = (RASCNTL_SET_DEBUG,							// obsolete
+	                      RASCNTL_LOCK_STATUS,						// obsolete
+                       RASCNTL_PRINT_CS,							// obsolete
+                       RASCNTL_STATISTICS,							// Get statistics
+                       RASCNTL_ENUMDEV,							// Enum Devices
+                       RASCNTL_GETPROJINFO,						// RasGetProjectionInfoW
+                       RASCNTL_GETDISPPHONE,						// RasGetDispPhoneNumW
+                       RASCNTL_DEVCONFIGDIALOGEDIT,				// RasDevConfigDialogEditW
+                       RASCNTL_SERVER_GET_STATUS,					// Get status of PPP server and lines               NULL                   RASCNTL_SERVERSTATUS + dwNumLines * RASCNTL_SERVERLINE
+                       RASCNTL_SERVER_ENABLE,					    // Turn the PPP server on                           NULL                   NULL
+                       RASCNTL_SERVER_DISABLE,					    // Turn the PPP server off                          NULL                   NULL
+                       RASCNTL_SERVER_GET_PARAMETERS,				// Get global server parameters                     NULL                   RASCNTL_SERVERSTATUS
+                       RASCNTL_SERVER_SET_PARAMETERS,				// Set global server parameters                     RASCNTL_SERVERSTATUS   NULL
+                       RASCNTL_SERVER_LINE_ADD,					// Add a line to be managed by the PPP server       RASCNTL_SERVERLINE     NULL
+                       RASCNTL_SERVER_LINE_REMOVE,					// Remove a line being managed by the PPP server    RASCNTL_SERVERLINE     NULL
+                       RASCNTL_SERVER_LINE_ENABLE,				    // Enable management of a line                      RASCNTL_SERVERLINE     NULL
+                       RASCNTL_SERVER_LINE_DISABLE,			    // Disable management of a line                     RASCNTL_SERVERLINE     NULL
+                       RASCNTL_SERVER_LINE_GET_PARAMETERS,		    // Get line parameters                              RASCNTL_SERVERLINE     RASCNTL_SERVERLINE
+                       RASCNTL_SERVER_LINE_SET_PARAMETERS,		    // Set line parameters                              RASCNTL_SERVERLINE     NULL
+                       RASCNTL_SERVER_USER_SET_CREDENTIALS,		// Allow a username/password                        RASCNTL_SERVERUSERCREDENTIALS NULL
+                       RASCNTL_SERVER_USER_DELETE_CREDENTIALS,		// Remove a username                                RASCNTL_SERVERUSERCREDENTIALS NULL
+                       RASCNTL_EAP_GET_USER_DATA,					// Get a ras entry's EAP user data
+                       RASCNTL_EAP_SET_USER_DATA,					// Set a ras entry's EAP user data
+                       RASCNTL_EAP_GET_CONNECTION_DATA,			// Get a ras entry's EAP conn data
+                       RASCNTL_EAP_SET_CONNECTION_DATA,			// Set a ras entry's EAP conn data
+                       RASCNTL_ENABLE_LOGGING,					    // Load logging extension dll if present
+                       RASCNTL_DISABLE_LOGGING,					// Unload logging extension dll if loaded, stop logging
+                       RASCNTL_SERVER_LINE_GET_CONNECTION_INFO,    // Get state info on a server lines                 RASCNTL_SERVERLINE               RASCNTL_SERVERCONNECTION
+                       RASCNTL_SERVER_GET_IPV6_NET_PREFIX,         // Get IPV6 Network prefix pool                     NULL                             RASCNTL_SERVER_IPV6_NET_PREFIX
+                       RASCNTL_SERVER_SET_IPV6_NET_PREFIX,         // Set IPV6 Network prefix pool                     PRASCNTL_SERVER_IPV6_NET_PREFIX  NULL
+                       RASCNTL_LAYER_OPEN,                         // Open LCP/Auth/CCP/IPCP                           DWORD (Layer Id)                 NULL
+                       RASCNTL_LAYER_CLOSE,                        // Close LCP/Auth/CCP/IPCP                          DWORD (Layer Id)                 NULL
+                       RASCNTL_LAYER_RENEGOTIATE,                  // Renegotiate LCP/Auth/CCP/IPCP                    DWORD (Layer Id)                 NULL
+                       RASCNTL_LAYER_PARAMETER_GET,                // Get LCP/Auth/CCP/IPCP value                      RASCNTL_LAYER_PARAMETER          RASCNTL_LAYER_PARAMETER
+                       RASCNTL_LAYER_PARAMETER_SET                 // Set LCP/Auth/CCP/IPCP value                      RASCNTL_LAYER_PARAMETER          NULL
+                       // Add others here
+                      );
+     RasCntlEnum_t = tagRasCntlEnum;
+
+const
+      RASCNTL_LAYER_PARAMETER_TYPE_NONE	 = 0;
+      RASCNTL_LAYER_PARAMETER_TYPE_DWORD	= 1;
+      RASCNTL_LAYER_PARAMETER_TYPE_BYTES	= 2;
+
+type
+     _RASCNTL_LAYER_PARAMETER = record
+	      dwProtocolType:DWORD;
+	      dwParameterId:DWORD;
+	      dwValueType:DWORD;
+	      dwValueSize:DWORD;
+       case DWORD of
+         0: (dwValue:DWORD);       // for most (simple integer) values
+         1: (bytesValue:array[0..0] of byte); // array of bytes (size 1 is placeholder)
+     end;
+     RASCNTL_LAYER_PARAMETER = _RASCNTL_LAYER_PARAMETER;
+     PRASCNTL_LAYER_PARAMETER = ^_RASCNTL_LAYER_PARAMETER;
+
+type
+     tagRasCntlDevConfigDlgEdit = record
+	      szDeviceName:array[0..RAS_MaxDeviceName] of WCHAR;
+	      szDeviceType:array[0..RAS_MaxDeviceType] of WCHAR;
+	      hWndOwner:HWND;
+	      dwSize:DWORD;
+	      DataBuf:array[0..0] of byte;
+     end;
+     RASCNTL_DEVCFGDLGED = tagRasCntlDevConfigDlgEdit;
+     PRASCNTL_DEVCFGDLGED = ^tagRasCntlDevConfigDlgEdit;
+
+const
+      MAX_IF_NAME_LEN	= 256;
+
+//
+//	RASCNTL_SERVERSTATUS is...
+//
+//	..Returned by:
+//		RASCNTL_SERVER_GET_STATUS
+//		RASCNTL_SERVER_GET_PARAMETERS
+//  ..Passed to:
+//		RASCNTL_SERVER_SET_PARAMETERS
+//
+const
+      PPPSRV_FLAG_REQUIRE_DATA_ENCRYPTION			   = 1 shl 1;	// Require encryption on this connection.
+      PPPSRV_FLAG_ALLOW_UNAUTHENTICATED_ACCESS	= 1 shl 2;	// Do not require authentication on the connection
+      PPPSRV_FLAG_NO_VJ_HEADER_COMPRESSION		   = 1 shl 3;	// Prevent VJ TCP/IP header compression
+      PPPSRV_FLAG_NO_DATA_COMPRESSION				      = 1 shl 4;	// Prevent MS data compression
+      PPPSRV_FLAG_ADD_CLIENT_SUBNET				        = 1 shl 5;	// Add a subnet route for a client connection
+
+type
+     tagRasCntlServerStatus = record
+	      bEnable:BOOL;
+	      bmFlags:DWORD;
+	      bUseDhcpAddresses:BOOL;		// Obtain addresses from DHCP server rather than static pool
+	      dwStaticIpAddrStart:DWORD;	// If using static IP address pool, this is the first address
+	      dwStaticIpAddrCount:DWORD;	// Number of static IP addresses following IpAddrStart in pool
+	      bmAuthenticationMethods:DWORD;// Bitmask of authentication methods to be disallowed, see
+      // RASEO_ProhibitXxx in ras.h
+
+	      dwNumLines:DWORD;
+
+	      bUseAutoIpAddresses:BOOL;    // TRUE if IP addresses for clients should be generated from AutoIp pool
+	      dwAutoIpSubnet:DWORD;         // Defines AutoIP address pool
+	      dwAutoIpSubnetMask:DWORD;
+
+	      wszDhcpInterface:array[0..MAX_IF_NAME_LEN] of WCHAR;
+     end;
+     RASCNTL_SERVERSTATUS = tagRasCntlServerStatus;
+     PRASCNTL_SERVERSTATUS = ^tagRasCntlServerStatus;
+
+//
+//	Structure passed to the following IOCTLs
+//		 RASCNTL_SERVER_LINE_GET_PARAMETERS
+//		 RASCNTL_SERVER_LINE_SET_PARAMETERS
+//		 RASCNTL_SERVER_LINE_ENABLE
+//		 RASCNTL_SERVER_LINE_DISABLE
+//
+type
+     tagRasCntlServerLine = record
+		     rasDevInfo:RASDEVINFO;				// szDeviceType and szDeviceName of the line
+	      bEnable:BOOL;
+	      bmFlags:DWORD;
+	      DisconnectIdleSeconds:UINT;
+	      dwDevConfigSize:DWORD;
+	      DevConfig:array[0..0] of byte;			// Variable size (dwDevConfigSize bytes) array of device config info
+     end;
+     RASCNTL_SERVERLINE = tagRasCntlServerLine;
+     PRASCNTL_SERVERLINE = ^tagRasCntlServerLine;
+
+//
+//	Structure passed to the following IOCTLs
+//		RASCNTL_SERVER_USER_SET_CREDENTIALS			 Allow a username/password
+//		RASCNTL_SERVER_USER_DELETE_CREDENTIALS		 Remove a username
+//
+type
+     tagRasCntlServerUser = record
+	      tszUserName:array[0..UNLEN] of TCHAR;
+	      tszDomainName:array[0..DNLEN] of TCHAR;			// may be null
+	      password:array[0..PWLEN-1] of byte;
+			    cbPassword:DWORD;
+     end;
+     RASCNTL_SERVERUSERCREDENTIALS = tagRasCntlServerUser;
+     PRASCNTL_SERVERUSERCREDENTIALS = ^tagRasCntlServerUser;
+
+//
+//  Structure containing info describing an enabled line's connection status
+//
+//  Used with the IOCTLS:
+//	    RASCNTL_SERVER_LINE_GET_CONNECTION_INFO
+//
+type
+     tagRasCntlServerConnection = record
+       rasDevInfo:RASDEVINFO;		                 // szDeviceType and szDeviceName of the line
+       hrasconn:HRASCONN;                           // handle that can be used in RasGetLinkStatistics (NULL if line is not enabled)
+       dwServerIpAddress:DWORD;                  // IP Address for server line IP interface
+       dwClientIpAddress:DWORD;                  // IP Address that will be assigned to client connecting to this line
+       RasConnState:RASCONNSTATE;                       // RASCS_Disconnected, etc.
+       tszUserName:array[0..DNLEN+1+UNLEN] of TCHAR; // Name of user logged in to the port
+     end;
+     RASCNTL_SERVERCONNECTION = tagRasCntlServerConnection;
+     PRASCNTL_SERVERCONNECTION = ^tagRasCntlServerConnection;
+
+//
+//  Structure containing info describing the pool of IPV6 network prefixes that
+//  can be assigned by the server.
+//  Used with the IOCTLS:
+//	    RASCNTL_SERVER_GET_IPV6_NET_PREFIX
+//	    RASCNTL_SERVER_SET_IPV6_NET_PREFIX
+//
+type
+     tagRasCntlServerIPV6NetPrefix = record
+       IPV6NetPrefix:array[0..15] of byte;
+       IPV6NetPrefixBitLength:DWORD;
+       IPV6NetPrefixCount:DWORD;
+     end;
+     RASCNTL_SERVER_IPV6_NET_PREFIX = tagRasCntlServerIPV6NetPrefix;
+     PRASCNTL_SERVER_IPV6_NET_PREFIX = ^tagRasCntlServerIPV6NetPrefix;
+
+//
+// RasDial message notifications are sent with Message ID set to
+// WM_RASDIALEVENT
+//
+const
+      RASDIALEVENT    	= 'RasDialEvent';
+
+      WM_RASDIALEVENT 	= $CCCD;
+
+
+type
+     _RAS_STATS = record
+       dwSize:DWORD;
+       dwBytesXmited:DWORD;
+       dwBytesRcved:DWORD;
+       dwFramesXmited:DWORD;
+       dwFramesRcved:DWORD;
+       dwCrcErr:DWORD;
+       dwTimeoutErr:DWORD;
+       dwAlignmentErr:DWORD;
+       dwHardwareOverrunErr:DWORD;
+       dwFramingErr:DWORD;
+       dwBufferOverrunErr:DWORD;
+       dwCompressionRatioIn:DWORD;
+       dwCompressionRatioOut:DWORD;
+       dwBps:DWORD;
+       dwConnectDuration:DWORD;
+     end;
+
+     RAS_STATS = _RAS_STATS;
+     PRAS_STATS = ^_RAS_STATS;
+
+
+{$IFDEF WINCE} // #ifdef UNDER_CE
+
+// This structure is used by the RnaApp application on WINCE
+// to signal when a connection has occured.
+
+type
+     tagRNAAppInfo = record
+	      dwSize:DWORD;					// The size of this structure
+	      hWndRNAApp:DWORD;				// The handle of the RNAApp window
+	      Context:DWORD;				// Context value specified on CmdLine
+	      ErrorCode:DWORD;				// Last error code
+	      RasEntryName:array[0..RAS_MaxEntryName] of TCHAR;
+     end;
+     RNAAPP_INFO = tagRNAAppInfo;
+     PRNAAPP_INFO = ^tagRNAAppInfo;
+
+const
+      RNA_RASCMD		= WM_USER+1;
+      RNA_ADDREF		= 1;
+      RNA_DELREF		= 2;
+{$ENDIF WINCE}
+
+{$PACKRECORDS DEFAULT} // #include "poppack.h"
+
+{$IFNDEF RASAPI}
+{$DEFINE RASAPI}
+{$ENDIF RASAPI}
+
+function RasDial(dialExtensions:LPRASDIALEXTENSIONS;
+	                phoneBookPath:LPTSTR;
+	                rasDialParam:LPRASDIALPARAMS;
+	                NotifierType:DWORD;
+	                notifier:LPVOID;
+	                pRasConn:LPHRASCONN):DWORD; external KernelDLL name 'RasDial'; // index 1F3
+
+function RasDialW(dialExtensions:LPRASDIALEXTENSIONS;
+ 	                phoneBookPath:LPTSTR;
+	                 rasDialParam:LPRASDIALPARAMS;
+	                 NotifierType:DWORD;
+	                 notifier:LPVOID;
+	                 pRasConn:LPHRASCONN):DWORD; external KernelDLL name 'RasDial'; // index 1F3
+
+function RasHangUp(Session:HRASCONN):DWORD; external KernelDLL name 'RasHangUp'; // index 1F4, 1F5
+function RasHangUpW(Session:HRASCONN):DWORD; external KernelDLL name 'RasHangUp'; // index 1F4, 1F5
+
+function RasEnumEntries(Reserved:LPWSTR;
+		                      lpszPhoneBookPath:LPWSTR;
+		                      lprasentryname:LPRASENTRYNAME;
+		                      lpcb:LPDWORD;
+		                      lpcEntries:LPDWORD):DWORD; external KernelDLL name 'RasEnumEntries'; // index 1F6
+function RasEnumEntriesW(Reserved:LPWSTR;
+		                       lpszPhoneBookPath:LPWSTR;
+		                       lprasentryname:LPRASENTRYNAME;
+		                       lpcb:LPDWORD;
+		                       lpcEntries:LPDWORD):DWORD; external KernelDLL name 'RasEnumEntries'; // index 1F6
+
+function RasGetEntryDialParams(lpszPhoneBook:LPWSTR;
+			                            lpRasDialParams:LPRASDIALPARAMS;
+			                            lpfPassword:LPBOOL):DWORD; external KernelDLL name 'RasGetEntryDialParams'; // index 1F7 
+function RasGetEntryDialParamsW(lpszPhoneBook:LPWSTR;
+			                             lpRasDialParams:LPRASDIALPARAMS;
+			                             lpfPassword:LPBOOL):DWORD; external KernelDLL name 'RasGetEntryDialParams'; // index 1F7
+
+function RasSetEntryDialParams(lpszPhoneBook:LPWSTR;
+			                            lpRasDialParams:LPRASDIALPARAMS;
+			                            fRemovePassword:BOOL):DWORD; external KernelDLL name 'RasSetEntryDialParams'; // index 1F8
+function RasSetEntryDialParamsW(lpszPhoneBook:LPWSTR;
+			                             lpRasDialParams:LPRASDIALPARAMS;
+			                             fRemovePassword:BOOL):DWORD; external KernelDLL name 'RasSetEntryDialParams'; // index 1F8
+
+function RasGetEntryProperties(lpszPhoneBook:LPWSTR;
+			                            szEntry:LPWSTR;
+			                            lpEntry:LPRASENTRY;
+			                            lpdwEntrySize:LPDWORD;
+			                            lpb:LPBYTE;
+			                            lpdwSize:LPDWORD):DWORD; external KernelDLL name 'RasGetEntryProperties'; // index 1F9
+function RasGetEntryPropertiesW(lpszPhoneBook:LPWSTR;
+			                             szEntry:LPWSTR;
+			                             lpEntry:LPRASENTRY;
+			                             lpdwEntrySize:LPDWORD;
+			                             lpb:LPBYTE;
+			                             lpdwSize:LPDWORD):DWORD; external KernelDLL name 'RasGetEntryProperties'; // index 1F9
+
+
+function RasSetEntryProperties(lpszPhoneBook:LPWSTR;
+			                            szEntry:LPWSTR;
+			                            lpEntry:LPRASENTRY;
+			                            dwEntrySize:DWORD;
+			                            lpb:LPBYTE;
+			                            dwSize:DWORD):DWORD; external KernelDLL name 'RasSetEntryProperties'; // index 1FA
+function RasSetEntryPropertiesW(lpszPhoneBook:LPWSTR;
+			                             szEntry:LPWSTR;
+			                             lpEntry:LPRASENTRY;
+			                             dwEntrySize:DWORD;
+			                             lpb:LPBYTE;
+			                             dwSize:DWORD):DWORD; external KernelDLL name 'RasSetEntryProperties'; // index 1FA
+
+function RasValidateEntryName(lpszPhonebook:LPCWSTR;
+			                           lpszEntry:LPCWSTR):DWORD; external KernelDLL name 'RasValidateEntryName'; // index 1FB
+function RasValidateEntryNameW(lpszPhonebook:LPCWSTR;
+			                            lpszEntry:LPCWSTR):DWORD; external KernelDLL name 'RasValidateEntryName'; // index 1FB
+
+function RasDeleteEntry(lpszPhonebook:LPWSTR;
+		                      lpszEntry:LPWSTR):DWORD; external KernelDLL name 'RasDeleteEntry'; // index 1FC
+function RasDeleteEntryW(lpszPhonebook:LPWSTR;
+		                      lpszEntry:LPWSTR):DWORD; external KernelDLL name 'RasDeleteEntry'; // index 1FC
+
+function RasRenameEntry(lpszPhonebook:LPWSTR;
+		                      lpszOldEntry:LPWSTR;
+		                      lpszNewEntry:LPWSTR):DWORD; external KernelDLL name 'RasRenameEntry'; // index 1FD
+function RasRenameEntryW(lpszPhonebook:LPWSTR;
+		                       lpszOldEntry:LPWSTR;
+		                       lpszNewEntry:LPWSTR):DWORD; external KernelDLL name 'RasRenameEntry'; // index 1FD
+
+function RasEnumConnections(lprasconn:LPRASCONN;
+			                         lpcb:LPDWORD;
+			                         lpcConnections:LPDWORD):DWORD; external KernelDLL name 'RasEnumConnections'; // index 1FE
+function RasEnumConnectionsW(lprasconn:LPRASCONN;
+			                          lpcb:LPDWORD;
+			                          lpcConnections:LPDWORD):DWORD; external KernelDLL name 'RasEnumConnections'; // index 1FE
+
+function RasGetConnectStatus(rasconn:HRASCONN;
+			                          lprasconnstatus:LPRASCONNSTATUS):DWORD; external KernelDLL name 'RasGetConnectStatus'; // index 1FF
+function RasGetConnectStatusW(rasconn:HRASCONN;
+			                           lprasconnstatus:LPRASCONNSTATUS):DWORD; external KernelDLL name 'RasGetConnectStatus'; // index 1FF
+
+function RasGetEntryDevConfig(szPhonebook:LPCTSTR;
+			                           szEntry:LPCTSTR;
+			                           pdwDeviceID:LPDWORD;
+			                           pdwSize:LPDWORD;
+			                           pDeviceConfig:LPVARSTRING):DWORD; external KernelDLL name 'RasGetEntryDevConfig'; // index 200
+function RasGetEntryDevConfigW(szPhonebook:LPCTSTR;
+			                            szEntry:LPCTSTR;
+			                            pdwDeviceID:LPDWORD;
+			                            pdwSize:LPDWORD;
+			                            pDeviceConfig:LPVARSTRING):DWORD; external KernelDLL name 'RasGetEntryDevConfig'; // index 200
+
+function RasSetEntryDevConfig(szPhonebook:LPCTSTR;
+			                           szEntry:LPCTSTR;
+			                           dwDeviceID:DWORD;
+				                          lpDeviceConfig:LPVARSTRING):DWORD; external KernelDLL name 'RasSetEntryDevConfig'; // index 201
+function RasSetEntryDevConfigW(szPhonebook:LPCTSTR;
+			                            szEntry:LPCTSTR;
+			                            dwDeviceID:DWORD;
+				                           lpDeviceConfig:LPVARSTRING):DWORD; external KernelDLL name 'RasSetEntryDevConfig'; // index 201
+
+
+function RasEnumDevicesW(lpRasDevinfo:LPRASDEVINFOW;
+                         lpcb:LPDWORD;
+                         lpcDevices:LPDWORD):DWORD; external KernelDLL name 'RasEnumDevicesW'; // index 203
+function RasEnumDevices(lpRasDevinfo:LPRASDEVINFOW;
+                        lpcb:LPDWORD;
+                        lpcDevices:LPDWORD):DWORD; external KernelDLL name 'RasEnumDevicesW'; // index 203
+
+function RasGetProjectionInfoW(hrasconn:HRASCONN;
+                               rasprojection:RASPROJECTION;
+                               lpprojection:LPVOID;
+                               lpcb:LPDWORD):DWORD; external KernelDLL name 'RasGetProjectionInfoW'; // index 204
+function RasGetProjectionInfo(hrasconn:HRASCONN;
+                              rasprojection:RASPROJECTION;
+                              lpprojection:LPVOID;
+                              lpcb:LPDWORD):DWORD; external KernelDLL name 'RasGetProjectionInfoW'; // index 204
+
+function RasGetLinkStatistics(hRasConn:HRASCONN;
+                              dwSubEntry:DWORD;
+                              lpStatistics:PRAS_STATS):DWORD; external KernelDLL name 'RasGetLinkStatistics'; // index 205
+
+function RasGetDispPhoneNumW(szPhonebook:LPCWSTR;
+								                     szEntry:LPCWSTR;
+								                     szPhoneNum:LPWSTR;
+								                     dwPhoneNumLen:DWORD):DWORD; external KernelDLL name 'RasGetDispPhoneNumW'; // index 206
+function RasGetDispPhoneNum(szPhonebook:LPCWSTR;
+								                    szEntry:LPCWSTR;
+								                    szPhoneNum:LPWSTR;
+								                    dwPhoneNumLen:DWORD):DWORD; external KernelDLL name 'RasGetDispPhoneNumW'; // index 206
+
+function RasDevConfigDialogEditW(szDeviceName:LPCWSTR;
+                                 szDeviceType:LPCWSTR;
+										                       hWndOwner:HWND;
+                                 lpDeviceConfigIn:LPVOID;
+										                       dwSize:DWORD;
+                                 lpDeviceConfigOut:LPVARSTRING):DWORD; external KernelDLL name 'RasDevConfigDialogEditW'; // index 207
+function RasDevConfigDialogEdit(szDeviceName:LPCWSTR;
+                                szDeviceType:LPCWSTR;
+										                      hWndOwner:HWND;
+                                lpDeviceConfigIn:LPVOID;
+										                      dwSize:DWORD;
+                                lpDeviceConfigOut:LPVARSTRING):DWORD; external KernelDLL name 'RasDevConfigDialogEditW'; // index 207
+
+function RasIOControl(hRasConn:LPVOID;
+                      dwCode:DWORD;
+                      pBufIn:LPBYTE;
+                      dwLenIn:DWORD;
+                      pBufOut:LPBYTE;
+                      dwLenOut:DWORD;
+                      pdwActualOut:LPDWORD):DWORD; external KernelDLL name 'RasIOControl'; // index 202
+
+function RasGetEapUserData(hToken:HANDLE;           // access token for user
+	                          pszPhonebook:LPCTSTR;     // path to phone book to use
+	                          pszEntry:LPCTSTR;         // name of entry in phone book
+	                          pbEapData:LPBYTE;        // retrieved data for the user
+	                          pdwSizeofEapData:LPDWORD // size of retrieved data
+                          ):DWORD; external KernelDLL name 'RasGetEapUserData'; // index 208
+
+function RasSetEapUserData(hToken:HANDLE;           // access token for user
+	                          pszPhonebook:LPCTSTR;     // path to phone book to use
+	                          pszEntry:LPCTSTR;         // name of entry in phone book
+	                          pbEapData:LPBYTE;        // data to store for the user
+	                          dwSizeofEapData:DWORD   // size of data
+                          ):DWORD; external KernelDLL name 'RasSetEapUserData'; // index 209
+
+function RasGetEapConnectionData(pszPhonebook:LPCTSTR;     // path to phone book to use
+	                                pszEntry:LPCTSTR;         // name of entry in phone book
+	                                pbEapData:LPBYTE;        // retrieved data for the user
+	                                pdwSizeofEapData:LPDWORD // size of retrieved data
+                                ):DWORD; external KernelDLL name 'RasGetEapConnectionData'; // index 20A
+
+function RasSetEapConnectionData(pszPhonebook:LPCTSTR;    // path to phone book to use
+	                                pszEntry:LPCTSTR;        // name of entry in phone book
+	                                pbEapData:LPBYTE;       // data to store for the connection
+	                                dwSizeofEapData:DWORD  // size of data
+                                ):DWORD; external KernelDLL name 'RasSetEapConnectionData'; // index 20B
+
+implementation
+
+end.

+ 210 - 0
packages/winceunits/src/raserror.pp

@@ -0,0 +1,210 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+//
+// Module Name:
+//
+//   raserror.h
+//
+// Abstract:
+//
+//   Remote Access external API
+//   RAS specific error codes
+//
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit RASError;
+
+interface
+
+const
+      RASBASE = 600;
+      SUCCESS = 0;
+
+
+      PENDING                              = RASBASE + 0;
+      ERROR_INVALID_PORT_HANDLE            = RASBASE + 1;
+      ERROR_PORT_ALREADY_OPEN              = RASBASE + 2;
+      ERROR_BUFFER_TOO_SMALL               = RASBASE + 3;
+      ERROR_WRONG_INFO_SPECIFIED           = RASBASE + 4;
+      ERROR_CANNOT_SET_PORT_INFO           = RASBASE + 5;
+      ERROR_PORT_NOT_CONNECTED             = RASBASE + 6;
+      ERROR_EVENT_INVALID                  = RASBASE + 7;
+      ERROR_DEVICE_DOES_NOT_EXIST          = RASBASE + 8;
+      ERROR_DEVICETYPE_DOES_NOT_EXIST      = RASBASE + 9;
+      ERROR_BUFFER_INVALID                 = RASBASE + 10;
+      ERROR_ROUTE_NOT_AVAILABLE            = RASBASE + 11;
+      ERROR_ROUTE_NOT_ALLOCATED            = RASBASE + 12;
+      ERROR_INVALID_COMPRESSION_SPECIFIED  = RASBASE + 13;
+      ERROR_OUT_OF_BUFFERS                 = RASBASE + 14;
+      ERROR_PORT_NOT_FOUND                 = RASBASE + 15;
+      ERROR_ASYNC_REQUEST_PENDING          = RASBASE + 16;
+      ERROR_ALREADY_DISCONNECTING          = RASBASE + 17;
+      ERROR_PORT_NOT_OPEN                  = RASBASE + 18;
+      ERROR_PORT_DISCONNECTED              = RASBASE + 19;
+      ERROR_NO_ENDPOINTS                   = RASBASE + 20;
+      ERROR_CANNOT_OPEN_PHONEBOOK          = RASBASE + 21;
+      ERROR_CANNOT_LOAD_PHONEBOOK          = RASBASE + 22;
+      ERROR_CANNOT_FIND_PHONEBOOK_ENTRY    = RASBASE + 23;
+      ERROR_CANNOT_WRITE_PHONEBOOK         = RASBASE + 24;
+      ERROR_CORRUPT_PHONEBOOK              = RASBASE + 25;
+      ERROR_CANNOT_LOAD_STRING             = RASBASE + 26;
+      ERROR_KEY_NOT_FOUND                  = RASBASE + 27;
+      ERROR_DISCONNECTION                  = RASBASE + 28;
+      ERROR_REMOTE_DISCONNECTION           = RASBASE + 29;
+      ERROR_HARDWARE_FAILURE               = RASBASE + 30;
+      ERROR_USER_DISCONNECTION             = RASBASE + 31;
+      ERROR_INVALID_SIZE                   = RASBASE + 32;
+      ERROR_PORT_NOT_AVAILABLE             = RASBASE + 33;
+      ERROR_CANNOT_PROJECT_CLIENT          = RASBASE + 34;
+      ERROR_UNKNOWN                        = RASBASE + 35;
+      ERROR_WRONG_DEVICE_ATTACHED          = RASBASE + 36;
+      ERROR_BAD_STRING                     = RASBASE + 37;
+      ERROR_REQUEST_TIMEOUT                = RASBASE + 38;
+      ERROR_CANNOT_GET_LANA                = RASBASE + 39;
+      ERROR_NETBIOS_ERROR                  = RASBASE + 40;
+      ERROR_SERVER_OUT_OF_RESOURCES        = RASBASE + 41;
+      ERROR_NAME_EXISTS_ON_NET             = RASBASE + 42;
+      ERROR_SERVER_GENERAL_NET_FAILURE     = RASBASE + 43;
+      WARNING_MSG_ALIAS_NOT_ADDED          = RASBASE + 44;
+      ERROR_AUTH_INTERNAL                  = RASBASE + 45;
+      ERROR_RESTRICTED_LOGON_HOURS         = RASBASE + 46;
+      ERROR_ACCT_DISABLED                  = RASBASE + 47;
+      ERROR_PASSWD_EXPIRED                 = RASBASE + 48;
+      ERROR_NO_DIALIN_PERMISSION           = RASBASE + 49;
+      ERROR_SERVER_NOT_RESPONDING          = RASBASE + 50;
+      ERROR_FROM_DEVICE                    = RASBASE + 51;
+      ERROR_UNRECOGNIZED_RESPONSE          = RASBASE + 52;
+      ERROR_MACRO_NOT_FOUND                = RASBASE + 53;
+      ERROR_MACRO_NOT_DEFINED              = RASBASE + 54;
+      ERROR_MESSAGE_MACRO_NOT_FOUND        = RASBASE + 55;
+      ERROR_DEFAULTOFF_MACRO_NOT_FOUND     = RASBASE + 56;
+      ERROR_FILE_COULD_NOT_BE_OPENED       = RASBASE + 57;
+      ERROR_DEVICENAME_TOO_LONG            = RASBASE + 58;
+      ERROR_DEVICENAME_NOT_FOUND           = RASBASE + 59;
+      ERROR_NO_RESPONSES                   = RASBASE + 60;
+      ERROR_NO_COMMAND_FOUND               = RASBASE + 61;
+      ERROR_WRONG_KEY_SPECIFIED            = RASBASE + 62;
+      ERROR_UNKNOWN_DEVICE_TYPE            = RASBASE + 63;
+      ERROR_ALLOCATING_MEMORY              = RASBASE + 64;
+      ERROR_PORT_NOT_CONFIGURED            = RASBASE + 65;
+      ERROR_DEVICE_NOT_READY               = RASBASE + 66;
+      ERROR_READING_INI_FILE               = RASBASE + 67;
+      ERROR_NO_CONNECTION                  = RASBASE + 68;
+      ERROR_BAD_USAGE_IN_INI_FILE          = RASBASE + 69;
+      ERROR_READING_SECTIONNAME            = RASBASE + 70;
+      ERROR_READING_DEVICETYPE             = RASBASE + 71;
+      ERROR_READING_DEVICENAME             = RASBASE + 72;
+      ERROR_READING_USAGE                  = RASBASE + 73;
+      ERROR_READING_MAXCONNECTBPS          = RASBASE + 74;
+      ERROR_READING_MAXCARRIERBPS          = RASBASE + 75;
+      ERROR_LINE_BUSY                      = RASBASE + 76;
+      ERROR_VOICE_ANSWER                   = RASBASE + 77;
+      ERROR_NO_ANSWER                      = RASBASE + 78;
+      ERROR_NO_CARRIER                     = RASBASE + 79;
+      ERROR_NO_DIALTONE                    = RASBASE + 80;
+      ERROR_IN_COMMAND                     = RASBASE + 81;
+      ERROR_WRITING_SECTIONNAME            = RASBASE + 82;
+      ERROR_WRITING_DEVICETYPE             = RASBASE + 83;
+      ERROR_WRITING_DEVICENAME             = RASBASE + 84;
+      ERROR_WRITING_MAXCONNECTBPS          = RASBASE + 85;
+      ERROR_WRITING_MAXCARRIERBPS          = RASBASE + 86;
+      ERROR_WRITING_USAGE                  = RASBASE + 87;
+      ERROR_WRITING_DEFAULTOFF             = RASBASE + 88;
+      ERROR_READING_DEFAULTOFF             = RASBASE + 89;
+      ERROR_EMPTY_INI_FILE                 = RASBASE + 90;
+      ERROR_AUTHENTICATION_FAILURE         = RASBASE + 91;
+      ERROR_PORT_OR_DEVICE                 = RASBASE + 92;
+      ERROR_NOT_BINARY_MACRO               = RASBASE + 93;
+      ERROR_DCB_NOT_FOUND                  = RASBASE + 94;
+      ERROR_STATE_MACHINES_NOT_STARTED     = RASBASE + 95;
+      ERROR_STATE_MACHINES_ALREADY_STARTED = RASBASE + 96;
+      ERROR_PARTIAL_RESPONSE_LOOPING       = RASBASE + 97;
+      ERROR_UNKNOWN_RESPONSE_KEY           = RASBASE + 98;
+      ERROR_RECV_BUF_FULL                  = RASBASE + 99;
+      ERROR_CMD_TOO_LONG                   = RASBASE + 100;
+      ERROR_UNSUPPORTED_BPS                = RASBASE + 101;
+      ERROR_UNEXPECTED_RESPONSE            = RASBASE + 102;
+      ERROR_INTERACTIVE_MODE               = RASBASE + 103;
+      ERROR_BAD_CALLBACK_NUMBER            = RASBASE + 104;
+      ERROR_INVALID_AUTH_STATE             = RASBASE + 105;
+      ERROR_WRITING_INITBPS                = RASBASE + 106;
+      ERROR_X25_DIAGNOSTIC                 = RASBASE + 107;
+      ERROR_ACCT_EXPIRED                   = RASBASE + 108;
+      ERROR_CHANGING_PASSWORD              = RASBASE + 109;
+      ERROR_OVERRUN                        = RASBASE + 110;
+      ERROR_RASMAN_CANNOT_INITIALIZE	      = RASBASE + 111;
+      ERROR_BIPLEX_PORT_NOT_AVAILABLE      = RASBASE + 112;
+      ERROR_NO_ACTIVE_ISDN_LINES           = RASBASE + 113;
+      ERROR_NO_ISDN_CHANNELS_AVAILABLE     = RASBASE + 114;
+      ERROR_TOO_MANY_LINE_ERRORS           = RASBASE + 115;
+      ERROR_IP_CONFIGURATION               = RASBASE + 116;
+      ERROR_NO_IP_ADDRESSES                = RASBASE + 117;
+      ERROR_PPP_TIMEOUT                    = RASBASE + 118;
+      ERROR_PPP_REMOTE_TERMINATED          = RASBASE + 119;
+      ERROR_PPP_NO_PROTOCOLS_CONFIGURED    = RASBASE + 120;
+      ERROR_PPP_NO_RESPONSE                = RASBASE + 121;
+      ERROR_PPP_INVALID_PACKET             = RASBASE + 122;
+      ERROR_PHONE_NUMBER_TOO_LONG          = RASBASE + 123;
+      ERROR_IPXCP_NO_DIALOUT_CONFIGURED    = RASBASE + 124;
+      ERROR_IPXCP_NO_DIALIN_CONFIGURED     = RASBASE + 125;
+      ERROR_IPXCP_DIALOUT_ALREADY_ACTIVE   = RASBASE + 126;
+      ERROR_ACCESSING_TCPCFGDLL            = RASBASE + 127;
+      ERROR_NO_IP_RAS_ADAPTER              = RASBASE + 128;
+      ERROR_SLIP_REQUIRES_IP               = RASBASE + 129;
+      ERROR_PROJECTION_NOT_COMPLETE        = RASBASE + 130;
+      ERROR_PROTOCOL_NOT_CONFIGURED        = RASBASE + 131;
+      ERROR_PPP_NOT_CONVERGING             = RASBASE + 132;
+      ERROR_PPP_CP_REJECTED                = RASBASE + 133;
+      ERROR_PPP_LCP_TERMINATED             = RASBASE + 134;
+      ERROR_PPP_REQUIRED_ADDRESS_REJECTED  = RASBASE + 135;
+      ERROR_PPP_NCP_TERMINATED             = RASBASE + 136;
+      ERROR_PPP_LOOPBACK_DETECTED          = RASBASE + 137;
+      ERROR_PPP_NO_ADDRESS_ASSIGNED        = RASBASE + 138;
+      ERROR_CANNOT_USE_LOGON_CREDENTIALS   = RASBASE + 139;
+      ERROR_TAPI_CONFIGURATION             = RASBASE + 140;
+      ERROR_NO_LOCAL_ENCRYPTION            = RASBASE + 141;
+      ERROR_NO_REMOTE_ENCRYPTION           = RASBASE + 142;
+      ERROR_REMOTE_REQUIRES_ENCRYPTION     = RASBASE + 143;
+      ERROR_IPXCP_NET_NUMBER_CONFLICT      = RASBASE + 144;
+      ERROR_INVALID_SMM                    = RASBASE + 145;
+      ERROR_SMM_UNINITIALIZED              = RASBASE + 146;
+      ERROR_NO_MAC_FOR_PORT                = RASBASE + 147;
+      ERROR_SMM_TIMEOUT                    = RASBASE + 148;
+      ERROR_BAD_PHONE_NUMBER               = RASBASE + 149;
+      ERROR_WRONG_MODULE                   = RASBASE + 150;
+      ERROR_PPP_MAC						                  = RASBASE + 151;
+      ERROR_PPP_LCP						                  = RASBASE + 152;
+      ERROR_PPP_AUTH						                 = RASBASE + 153;
+      ERROR_PPP_NCP						                  = RASBASE + 154;
+      ERROR_POWER_OFF						                = RASBASE + 155;
+      ERROR_POWER_OFF_CD					              = RASBASE + 156;
+
+
+      ERROR_DIAL_ALREADY_IN_PROGRESS       = RASBASE + 157;
+      ERROR_RASAUTO_CANNOT_INITIALIZE      = RASBASE + 158;
+      ERROR_UNABLE_TO_AUTHENTICATE_SERVER  = RASBASE + 178;
+
+
+      RASBASEEND                           = RASBASE + 158;
+
+      ROUTEBASE                            = 900;
+
+      ERROR_IDLE_DISCONNECTED              = ROUTEBASE + 26;
+// The port has been disconnected due to inactivity.%0
+
+implementation
+
+end.

+ 8735 - 0
packages/winceunits/src/ril.pp

@@ -0,0 +1,8735 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+//-----------------------------------------------------------------------------
+//
+// RIL.H - Radio Interface Layer
+//
+//-----------------------------------------------------------------------------
+
+//
+//  Microsoft Windows Mobile 6.0 Platform Builder.
+//
+
+
+unit RIL;
+
+{$CALLING cdecl}
+{$INLINE ON}
+
+interface
+
+uses Windows;
+
+const
+      RILDLL = 'ril.dll';
+
+const
+      RIL_DRIVER_VERSION                    = $00020000;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Error Class | Each RIL error falls into a general error class bucket
+//
+// @comm In RIL, the low order 16 bits are divided into an 8-bit error class and
+//       an 8-bit error value.  Use the RILERRORCLASS macro to obtain the error
+//       class from a RIL HRESULT.
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_ERRORCLASS_NONE                   = $00; // @constdefine Misc error
+      RIL_ERRORCLASS_PASSWORD               = $01; // @constdefine Unspecified phone failure
+      RIL_ERRORCLASS_SIM                    = $02; // @constdefine Problem with the SIM
+      RIL_ERRORCLASS_NETWORKACCESS          = $03; // @constdefine Can't access the network
+      RIL_ERRORCLASS_NETWORK                = $04; // @constdefine Error in the network
+      RIL_ERRORCLASS_MOBILE                 = $05; // @constdefine Error in the mobile
+      RIL_ERRORCLASS_NETWORKUNSUPPORTED     = $06; // @constdefine Unsupported by the network
+      RIL_ERRORCLASS_MOBILEUNSUPPORTED      = $07; // @constdefine Unsupported by the mobile
+      RIL_ERRORCLASS_BADPARAM               = $08; // @constdefine An invalid parameter was supplied
+      RIL_ERRORCLASS_STORAGE                = $09; // @constdefine Error relating to storage
+      RIL_ERRORCLASS_SMSC                   = $0A; // @constdefine Error relates to the SMSC
+      RIL_ERRORCLASS_DESTINATION            = $0B; // @constdefine Error in the destination mobile
+      RIL_ERRORCLASS_DESTINATIONUNSUPPORTED = $0C; // @constdefine Unsupported by destination mobile
+      RIL_ERRORCLASS_RADIOUNAVAILABLE       = $0D; // @constdefine The Radio Module is Off or a radio module may not be present
+      RIL_ERRORCLASS_GPRS                   = $0E;  // @constdefine GPRS related failures
+
+function MAKE_RILERROR(errclass:byte; code:byte):ULONG; inline;
+
+function RILERRORCLASS(rilerror:ULONG):byte; inline;
+
+function ISRILERROR(rilerror:ULONG):BOOL; inline;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Error | Error codes
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      FACILITY_RIL                    = $0100;
+
+      RIL_E_PHONEFAILURE           = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_MOBILE shl 8) or $01); // @constdefine Unspecified phone failure
+      RIL_E_NOCONNECTION           = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_MOBILE shl 8) or $02); // @constdefine RIL has no connection to the phone
+      RIL_E_LINKRESERVED           = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_MOBILE shl 8) or $03); // @constdefine RIL's link to the phone is reserved
+      RIL_E_OPNOTALLOWED           = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_MOBILEUNSUPPORTED shl 8) or $04); // @constdefine Attempted operation isn't allowed
+      RIL_E_OPNOTSUPPORTED         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_MOBILEUNSUPPORTED shl 8) or $05); // @constdefine Attempted operation isn't supported
+      RIL_E_PHSIMPINREQUIRED       = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $06); // @constdefine PH-SIM PIN is required to perform this operation
+      RIL_E_PHFSIMPINREQUIRED      = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $07); // @constdefine PH-FSIM PIN is required to perform this operation
+      RIL_E_PHFSIMPUKREQUIRED      = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $08); // @constdefine PH-FSIM PUK is required to perform this operation
+      RIL_E_SIMNOTINSERTED         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SIM shl 8) or $09); // @constdefine SIM isn't inserted into the phone
+      RIL_E_SIMPINREQUIRED         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $0A); // @constdefine SIM PIN is required to perform this operation
+      RIL_E_SIMPUKREQUIRED         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $0B); // @constdefine SIM PUK is required to perform this operation
+      RIL_E_SIMFAILURE             = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SIM shl 8) or $0C); // @constdefine SIM failure was detected
+      RIL_E_SIMBUSY                = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SIM shl 8) or $0D); // @constdefine SIM is busy
+      RIL_E_SIMWRONG               = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SIM shl 8) or $0E); // @constdefine Inorrect SIM was inserted
+      RIL_E_INCORRECTPASSWORD      = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $0F); // @constdefine Incorrect password was supplied
+      RIL_E_SIMPIN2REQUIRED        = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $10); // @constdefine SIM PIN2 is required to perform this operation
+      RIL_E_SIMPUK2REQUIRED        = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $11); // @constdefine SIM PUK2 is required to perform this operation
+      RIL_E_MEMORYFULL             = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_STORAGE shl 8) or $12);  // @constdefine Storage memory is full
+      RIL_E_INVALIDINDEX           = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_STORAGE shl 8) or $13);  // @constdefine Invalid storage index was supplied
+      RIL_E_NOTFOUND               = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_STORAGE shl 8) or $14);  // @constdefine A requested storage entry was not found
+      RIL_E_MEMORYFAILURE          = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_STORAGE shl 8) or $15);  // @constdefine Storage memory failure
+      RIL_E_TEXTSTRINGTOOLONG      = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_BADPARAM shl 8) or $16);  // @constdefine Supplied text string is too long
+      RIL_E_INVALIDTEXTSTRING      = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_BADPARAM shl 8) or $17);  // @constdefine Supplied text string contains invalid characters
+      RIL_E_DIALSTRINGTOOLONG      = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_BADPARAM shl 8) or $18);  // @constdefine Supplied dial string is too long
+      RIL_E_INVALIDDIALSTRING      = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_BADPARAM shl 8) or $19);  // @constdefine Supplied dial string contains invalid characters
+      RIL_E_NONETWORKSVC           = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKACCESS shl 8) or $1A);  // @constdefine Network service isn't available
+      RIL_E_NETWORKTIMEOUT         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORK shl 8) or $1B);  // @constdefine Network operation timed out
+      RIL_E_EMERGENCYONLY          = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKACCESS shl 8) or $1C);  // @constdefine Network can only be used for emergency calls
+      RIL_E_NETWKPINREQUIRED       = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $1D);  // @constdefine Network Personalization PIN is required to perform this operation
+      RIL_E_NETWKPUKREQUIRED       = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $1E);  // @constdefine Network Personalization PUK is required to perform this operation
+      RIL_E_SUBSETPINREQUIRED      = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $1F);  // @constdefine Network Subset Personalization PIN is required to perform this operation
+      RIL_E_SUBSETPUKREQUIRED      = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $20);  // @constdefine Network Subset Personalization PUK is required to perform this operation
+      RIL_E_SVCPINREQUIRED         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $21);  // @constdefine Service Provider Personalization PIN is required to perform this operation
+      RIL_E_SVCPUKREQUIRED         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $22);  // @constdefine Service Provider Personalization PUK is required to perform this operation
+      RIL_E_CORPPINREQUIRED        = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $23);  // @constdefine Corporate Personalization PIN is required to perform this operation
+      RIL_E_CORPPUKREQUIRED        = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_PASSWORD shl 8) or $24);  // @constdefine Corporate Personalization PUK is required to perform this operation
+      RIL_E_TELEMATICIWUNSUPPORTED = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKUNSUPPORTED shl 8) or $25);  // @constdefine Telematic interworking isn't supported
+      RIL_E_SMTYPE0UNSUPPORTED     = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $26);  // @constdefine Type 0 messages aren't supported
+      RIL_E_CANTREPLACEMSG         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $27);  // @constdefine Existing message cannot be replaced
+      RIL_E_PROTOCOLIDERROR        = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $28);  // @constdefine Uspecified error related to the message Protocol ID
+      RIL_E_DCSUNSUPPORTED         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $29);  // @constdefine Specified message Data Coding Scheme isn't supported
+      RIL_E_MSGCLASSUNSUPPORTED    = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $2A);  // @constdefine Specified message class isn't supported
+      RIL_E_DCSERROR               = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $2B);  // @constdefine Unspecified error related to the message Data Coding Scheme
+      RIL_E_CMDCANTBEACTIONED      = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $2C);  // @constdefine Specified message Command cannot be executed
+      RIL_E_CMDUNSUPPORTED         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $2D);  // @constdefine Specified message Command isn't supported
+      RIL_E_CMDERROR               = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $2E);  // @constdefine Unspecified error related to the message Command
+      RIL_E_MSGBODYHEADERERROR     = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $2F);  // @constdefine Unspecified error related to the message Body or Header
+      RIL_E_SCBUSY                 = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $30);  // @constdefine Message Service Center is busy
+      RIL_E_NOSCSUBSCRIPTION       = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $31);  // @constdefine No message Service Center subscription
+      RIL_E_SCSYSTEMFAILURE        = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $32);  // @constdefine Message service Center system failure occurred
+      RIL_E_INVALIDADDRESS         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $33);  // @constdefine Specified address is invalid
+      RIL_E_DESTINATIONBARRED      = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $34);  // @constdefine Message destination is barred
+      RIL_E_REJECTEDDUPLICATE      = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $35);  // @constdefine Duplicate message was rejected
+      RIL_E_VPFUNSUPPORTED         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $36);  // @constdefine Specified message Validity Period Format isn't supported
+      RIL_E_VPUNSUPPORTED          = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $37);  // @constdefine Specified message Validity Period isn't supported
+      RIL_E_SIMMSGSTORAGEFULL      = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_STORAGE shl 8) or $38);  // @constdefine Message storage on the SIM is full
+      RIL_E_NOSIMMSGSTORAGE        = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SIM shl 8) or $39);  // @constdefine SIM isn't capable of storing messages
+      RIL_E_SIMTOOLKITBUSY         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SIM shl 8) or $3A);  // @constdefine SIM Application Toolkit is busy
+      RIL_E_SIMDOWNLOADERROR       = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SIM shl 8) or $3B);  // @constdefine SIM data download error
+      RIL_E_MSGSVCRESERVED         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKUNSUPPORTED shl 8) or $3C);  // @constdefine Messaging service is reserved
+      RIL_E_INVALIDMSGPARAM        = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_BADPARAM shl 8) or $3D);  // @constdefine One of the message parameters is invalid
+      RIL_E_UNKNOWNSCADDRESS       = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_SMSC shl 8) or $3E);  // @constdefine Unknown message Service Center address was specified
+      RIL_E_UNASSIGNEDNUMBER       = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_DESTINATION shl 8) or $3F);  // @constdefine Specified message destination address is a currently unassigned phone number
+      RIL_E_MSGBARREDBYOPERATOR    = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKACCESS shl 8) or $40);  // @constdefine Message sending was barred by an operator
+      RIL_E_MSGCALLBARRED          = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKACCESS shl 8) or $41);  // @constdefine Message sending was prevented by outgoing calls barring
+      RIL_E_MSGXFERREJECTED        = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_DESTINATION shl 8) or $42);  // @constdefine Sent message has been rejected by the receiving equipment
+      RIL_E_DESTINATIONOUTOFSVC    = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_DESTINATION shl 8) or $43);  // @constdefine Message could not be delivered because destination equipment is out of service
+      RIL_E_UNIDENTIFIEDSUBCRIBER  = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKACCESS shl 8) or $44);  // @constdefine Sender's mobile ID isn't registered
+      RIL_E_SVCUNSUPPORTED         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKUNSUPPORTED shl 8) or $45);  // @constdefine Requested messaging service isn't supported
+      RIL_E_UNKNOWNSUBSCRIBER      = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKACCESS shl 8) or $46);  // @constdefine Sender isn't recognized by the network
+      RIL_E_NETWKOUTOFORDER        = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORK shl 8) or $47);  // @constdefine Long-term network failure
+      RIL_E_NETWKTEMPFAILURE       = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORK shl 8) or $48);  // @constdefine Short-term network failure
+      RIL_E_CONGESTION             = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORK shl 8) or $49);  // @constdefine Operation failed because of the high network traffic
+      RIL_E_RESOURCESUNAVAILABLE   = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NONE shl 8) or $4A);  // @constdefine Unspecified resources weren't available
+      RIL_E_SVCNOTSUBSCRIBED       = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKUNSUPPORTED shl 8) or $4B);  // @constdefine Sender isn't subscribed for the requested messaging service
+      RIL_E_SVCNOTIMPLEMENTED      = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKUNSUPPORTED shl 8) or $4C);  // @constdefine Requested messaging service isn't implemented on the network
+      RIL_E_INVALIDMSGREFERENCE    = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_BADPARAM shl 8) or $4D);  // @constdefine Imvalid message reference value was used
+      RIL_E_INVALIDMSG             = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_BADPARAM shl 8) or $4E);  // @constdefine Message was determined to be invalid for unspecified reasons
+      RIL_E_INVALIDMANDATORYINFO   = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_BADPARAM shl 8) or $4F);  // @constdefine Mandatory message information is invalid or missing
+      RIL_E_MSGTYPEUNSUPPORTED     = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKUNSUPPORTED shl 8) or $50);  // @constdefine The message type is unsupported
+      RIL_E_ICOMPATIBLEMSG         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKUNSUPPORTED shl 8) or $51);  // @constdefine Sent message isn't compatible with the network
+      RIL_E_INFOELEMENTUNSUPPORTED = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKUNSUPPORTED shl 8) or $52);  // @constdefine An information element specified in the message isn't supported
+      RIL_E_PROTOCOLERROR          = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORK shl 8) or $53);  // @constdefine Unspefied protocol error
+      RIL_E_NETWORKERROR           = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORK shl 8) or $54);  // @constdefine Unspecified network error
+      RIL_E_MESSAGINGERROR         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORK shl 8) or $55);  // @constdefine Unspecified messaging error
+      RIL_E_NOTREADY               = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NONE shl 8) or $56);  // @constdefine RIL isn't yet ready to perform the requested operation
+      RIL_E_TIMEDOUT               = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NONE shl 8) or $57);  // @constdefine Operation timed out
+      RIL_E_CANCELLED              = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NONE shl 8) or $58);  // @constdefine Operation was cancelled
+      RIL_E_NONOTIFYCALLBACK       = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NONE shl 8) or $59);  // @constdefine Requested operation requires an RIL notification callback, which wasn't provided
+      RIL_E_OPFMTUNAVAILABLE       = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKUNSUPPORTED shl 8) or $5A);  // @constdefine Operator format isn't available
+      RIL_E_NORESPONSETODIAL       = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NETWORKACCESS shl 8) or $5B);  // @constdefine Dial operation hasn't received a response for a long time
+      RIL_E_SECURITYFAILURE        = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NONE shl 8) or $5C);  // @constdefine Security failure
+      RIL_E_RADIOFAILEDINIT        = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NONE shl 8) or $5D);  // @constdefine Radio failed to initialize correctly
+      RIL_E_DRIVERINITFAILED       = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_RADIOUNAVAILABLE shl 8) or $5E);  // @constdefine There was a problem initializing the radio driver
+      RIL_E_RADIONOTPRESENT        = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_RADIOUNAVAILABLE shl 8) or $5F);  // @constdefine The Radio is not present
+      RIL_E_RADIOOFF               = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_RADIOUNAVAILABLE shl 8) or $60);  // @constdefine The Radio is in Off mode
+      RIL_E_ILLEGALMS              = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_GPRS shl 8) or $61);  // @constdefine Illegal MS
+      RIL_E_ILLEGALME              = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_GPRS shl 8) or $62);  // @constdefine Illegal ME
+      RIL_E_GPRSSERVICENOTALLOWED  = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_GPRS shl 8) or $63);  // @constdefine GPRS Service not allowed
+      RIL_E_PLMNNOTALLOWED         = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_GPRS shl 8) or $64);  // @constdefine PLMN not allowed
+      RIL_E_LOCATIONAREANOTALLOWED = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_GPRS shl 8) or $65);  // @constdefine Location area not allowed
+      RIL_E_ROAMINGNOTALLOWEDINTHISLOCATIONAREA = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_GPRS shl 8) or $66); // @constdefine Roaming not allowed in this location area
+      RIL_E_SERVICEOPTIONNOTSUPPORTED           = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_GPRS shl 8) or $67); // @constdefine Service option not supported
+      RIL_E_REQUESTEDSERVICEOPTIONNOTSUBSCRIBED = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_GPRS shl 8) or $68); // @constdefine Requested service option not subscribed
+      RIL_E_SERVICEOPTIONTEMPORARILYOUTOFORDER  = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_GPRS shl 8) or $69); // @constdefine Service option temporarily out of order
+      RIL_E_PDPAUTHENTICATIONFAILURE            = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_GPRS shl 8) or $6A); // @constdefine PDP authentication failure
+      RIL_E_INVALIDMOBILECLASS                  = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_GPRS shl 8) or $6B); // @constdefine invalid mobile class
+      RIL_E_UNSPECIFIEDGPRSERROR                = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_GPRS shl 8) or $6C); // @constdefine unspecific GPRS error
+      RIL_E_RADIOREBOOTED                = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NONE shl 8) or $6D); // @constdefine the command failed because the radio reset itself unexpectedly
+      RIL_E_INVALIDCONTEXTSTATE          = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NONE shl 8) or $6E); // @constdefine the command failed because the requested context state is invalid
+      RIL_E_MAXCONTEXTS                  = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NONE shl 8) or $6F); // @constdefine the command failed because there are no more radio contexts.
+      RIL_E_SYNCHRONOUS_DATA_UNAVAILABLE = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NONE shl 8) or $70); // @constdefine the cached notification data is not present
+      RIL_E_INVALIDASYNCCOMMANDRESPONSE  = (SEVERITY_ERROR shl 31) or (FACILITY_RIL shl 16) or ((RIL_ERRORCLASS_NONE shl 8) or $71); // @constdefine The RIL driver has issued an invalid asynchronous command response (hr == 0)
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Notification Class | Notification classes
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_NCLASS_FUNCRESULT  = $00000000;      // @constdefine API call results
+      RIL_NCLASS_CALLCTRL    = $00010000;      // @constdefine Call control notifications
+      RIL_NCLASS_MESSAGE     = $00020000;      // @constdefine Messaging notifications
+      RIL_NCLASS_NETWORK     = $00040000;      // @constdefine Network-related notifications
+      RIL_NCLASS_SUPSERVICE  = $00080000;      // @constdefine Supplementary service notifications
+      RIL_NCLASS_PHONEBOOK   = $00100000;      // @constdefine Phonebook notifications
+      RIL_NCLASS_SIMTOOLKIT  = $00200000;      // @constdefine SIM Toolkit notifications
+      RIL_NCLASS_MISC        = $00400000;      // @constdefine Miscellaneous notifications
+      RIL_NCLASS_RADIOSTATE  = $00800000;      // @constdefine Notifications Pertaining to changes in Radio State
+      RIL_NCLASS_POLLING     = $01000000;      // @constdefine polling related APIs
+      RIL_NCLASS_NDIS        = $40000000;      // @constdefine Nofitifcations that won't be picked up by all.
+      RIL_NCLASS_DEVSPECIFIC = $80000000;      // @constdefine Reserved for device specific notifications
+      RIL_NCLASS_ALL         = $01FF0000;      // @constdefine All notification classes (except DevSpecifc)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants API Result | API call results (RIL_NCLASS_FUNCRESULT)
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_RESULT_OK          = $00000001 or RIL_NCLASS_FUNCRESULT;  // @constdefine RIL API call succeded; lpData is NULL
+      RIL_RESULT_NOCARRIER   = $00000002 or RIL_NCLASS_FUNCRESULT;  // @constdefine RIL API failed because no carrier was detected; lpData is NULL
+      RIL_RESULT_ERROR       = $00000003 or RIL_NCLASS_FUNCRESULT;  // @constdefine RIL API failed; lpData points to RIL_E_* constant
+      RIL_RESULT_NODIALTONE  = $00000004 or RIL_NCLASS_FUNCRESULT;  // @constdefine RIL API failed because no dialtone was detected; lpData is NULL
+      RIL_RESULT_BUSY        = $00000005 or RIL_NCLASS_FUNCRESULT;  // @constdefine RIL API failed because the line was busy; lpData is NULL
+      RIL_RESULT_NOANSWER    = $00000006 or RIL_NCLASS_FUNCRESULT;  // @constdefine RIL API failed because of the lack of answer; lpData is NULL
+      RIL_RESULT_CALLABORTED = $00000007 or RIL_NCLASS_FUNCRESULT;  // @constdefine RIL API failed because it was cancelled prior to completion; lpData is NULL
+      RIL_RESULT_CALLDROPPED = $00000008 or RIL_NCLASS_FUNCRESULT;  // @constdefine RIL API failed because the network dropped the call; lpData is NULL
+      RIL_RESULT_RADIOOFF    = $00000009 or RIL_NCLASS_FUNCRESULT;  // @constdefine RIL API failed because the radio was shut offl; lpData is NULL
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Notification Call Control | Call control notifications (RIL_NCLASS_CALLCTRL)
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_NOTIFY_RING                  = $00000001 or RIL_NCLASS_CALLCTRL;  // @constdefine Incoming call; lpData points to RILRINGINFO
+      RIL_NOTIFY_CONNECT               = $00000002 or RIL_NCLASS_CALLCTRL;  // @constdefine Data/voice connection has been established; lpData points to RILCONNECTINFO
+      RIL_NOTIFY_DISCONNECT            = $00000003 or RIL_NCLASS_CALLCTRL;  // @constdefine Data/voice connection has been terminated; lpData points to RIL_DISCINIT_* constant
+      RIL_NOTIFY_DATASVCNEGOTIATED     = $00000004 or RIL_NCLASS_CALLCTRL;  // @constdefine Data connection service has been negotiated; lpData points to RILSERVICEINFO
+      RIL_NOTIFY_CALLSTATECHANGED      = $00000005 or RIL_NCLASS_CALLCTRL;  // @constdefine RIL has performed an operation that may have changed state of existing calls; lpData is NULL
+      RIL_NOTIFY_EMERGENCYMODEENTERED  = $00000006 or RIL_NCLASS_CALLCTRL;  // @constdefine RIL has enetered emergency mode; lpData is NULL
+      RIL_NOTIFY_EMERGENCYMODEEXITED   = $00000007 or RIL_NCLASS_CALLCTRL;  // @constdefine RIL has exited emergency mode; lpData is NULL
+      RIL_NOTIFY_EMERGENCYHANGUP       = $00000008 or RIL_NCLASS_CALLCTRL;  // @constdefine Existsing calls (if any) were hung up in RIL emergency mode; lpData is NULL
+      RIL_NOTIFY_HSCSDPARAMSNEGOTIATED = $00000009 or RIL_NCLASS_CALLCTRL;  // @constdefine HSCSD parameters for a call has been negotiated; lpData points to RILCALLHSCSDINFO
+      RIL_NOTIFY_DIAL                  = $0000000A or RIL_NCLASS_CALLCTRL;  // @constdefine Outgoing call; lpData points to RILDIALINFO
+      RIL_NOTIFY_CALLPROGRESSINFO      = $0000000B or RIL_NCLASS_CALLCTRL;  // @constdefine CPI notification; lpData points to RILCALLINFO
+      RIL_NOTIFY_CURRENTLINECHANGED    = $0000000C or RIL_NCLASS_CALLCTRL;  // @constdefine Current line has changed notification; lpData points to DWORD with new current address id
+      RIL_NOTIFY_GPRS_DISCONNECT       = $0000000D or RIL_NCLASS_CALLCTRL;  // @constdefine GPRS connection has been terminated; lpData points to RILGPRSCONTEXTACTIVATED sturct
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Notification Messaging | Messaging notifications (RIL_MCLASS_MESSAGE)
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_NOTIFY_MESSAGE              = $00000001 or RIL_NCLASS_MESSAGE;  // @constdefine Incoming message; lpData points to RILMESSAGE
+      RIL_NOTIFY_BCMESSAGE            = $00000002 or RIL_NCLASS_MESSAGE;  // @constdefine Incoming broadcast message; lpData points to RILMESSAGE
+      RIL_NOTIFY_STATUSMESSAGE        = $00000003 or RIL_NCLASS_MESSAGE;  // @constdefine Incoming status-report message; lpData points to RILMESSAGE
+      RIL_NOTIFY_MSGSTORED            = $00000004 or RIL_NCLASS_MESSAGE;  // @constdefine A message has been added to storage; lpData points to the storage index assigned to the new message
+      RIL_NOTIFY_MSGDELETED           = $00000005 or RIL_NCLASS_MESSAGE;  // @constdefine A message has been deleted from storage; lpData points to the storage index occupied by the deleted message
+      RIL_NOTIFY_MSGSTORAGECHANGED    = $00000006 or RIL_NCLASS_MESSAGE;  // @constdefine One of the message storage locations has been changed; lpData points to RILMSGSTORAGEINFO
+      RIL_NOTIFY_MESSAGE_IN_SIM       = $00000007 or RIL_NCLASS_MESSAGE;  // @constdefine Incoming message stored to SIM; lpData points to the storage RILMESSAGE_IN_SIM
+      RIL_NOTIFY_BCMESSAGE_IN_SIM     = $00000008 or RIL_NCLASS_MESSAGE;  // @constdefine Incoming broadcast message stored to SIM; lpData points to RILMESSAGE_IN_SIM
+      RIL_NOTIFY_STATUSMESSAGE_IN_SIM = $00000009 or RIL_NCLASS_MESSAGE;  // @constdefine Incoming status-report message stored to SIM; lpData points to RILMESSAGE_IN_SIM
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Notification Network | Network-related notifications (RIL_NCLASS_NETWORK)
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_NOTIFY_REGSTATUSCHANGED     = $00000001 or RIL_NCLASS_NETWORK;  // @constdefine Network registration status has changed; lpData points to the new status (RIL_REGSTAT_* constant)
+      RIL_NOTIFY_CALLMETER            = $00000002 or RIL_NCLASS_NETWORK;  // @constdefine Call meter has changed; lpData points to a DWORD containing new current call meter value
+      RIL_NOTIFY_CALLMETERMAXREACHED  = $00000003 or RIL_NCLASS_NETWORK;  // @constdefine Call meter maximum has been reached; lpData is NULL
+      RIL_NOTIFY_GPRSREGSTATUSCHANGED = $00000004 or RIL_NCLASS_NETWORK;  // @constdefine Network registration status has changed; lpData points to the new status (RIL_REGSTAT_* constant)
+      RIL_NOTIFY_SYSTEMCHANGED        = $00000005 or RIL_NCLASS_NETWORK;  // @constdefine This indicates that the type of coverage which is available has changed.  Typically one would expect IS-95A or 1xRTT, however CDMA does allow overlay systems; lpData is <t DWORD> of type RIL_SYSTEMTYPE_ flags
+      RIL_NOTIFY_GPRSCONNECTIONSTATUS = $00000006 or RIL_NCLASS_NETWORK;  // @constdefine This indicates the pdp context state has changed. lpData points to RILGPRSCONTEXTACTIVATED
+      RIL_NOTIFY_SYSTEMCAPSCHANGED    = $00000007 or RIL_NCLASS_NETWORK;  // @constdefine This indicates the system capability has changed. lpData points to the new system capability (RIL_SYSTEMCAPS_* constant)
+      RIL_NOTIFY_LOCATIONUPDATE       = $00000008 or RIL_NCLASS_NETWORK;  // @constdefine This indicates the location data has changed. lpData points to RILLOCATIONINFO
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Notification Supplementary Service | Supplementary service notifications (RIL_NCLASS_SUPSERVICE)
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_NOTIFY_CALLERID       = $00000001 or RIL_NCLASS_SUPSERVICE;  // @constdefine Incoming call CallerID information; lpData points to RILREMOTEPARTYINFO
+      RIL_NOTIFY_DIALEDID       = $00000002 or RIL_NCLASS_SUPSERVICE;  // @constdefine Initiated call DialedID information; lpData points to RILREMOTEPARTYINFO
+      RIL_NOTIFY_CALLWAITING    = $00000003 or RIL_NCLASS_SUPSERVICE;  // @constdefine Call Waiting information; lpData points to RILCALLWAITINGINFO
+      RIL_NOTIFY_SUPSERVICEDATA = $00000004 or RIL_NCLASS_SUPSERVICE;  // @constdefine Ustructured supplementary service data; lpData points to RILSUPSERVICEDATA
+      RIL_NOTIFY_INTERMEDIATESS = $00000005 or RIL_NCLASS_SUPSERVICE;  // @constdefine Ustructured supplementary service data; lpData points to RILINTERMEDIATESSINFO
+      RIL_NOTIFY_UNSOLICITEDSS  = $00000006 or RIL_NCLASS_SUPSERVICE;  // @constdefine Ustructured supplementary service data; lpData points to RILUNSOLICITEDSSINFO
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Notification Phonebook | Phonebook notifications (RIL_NCLASS_PHONEBOOK)
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_NOTIFY_PHONEBOOKENTRYSTORED    = $00000001 or RIL_NCLASS_PHONEBOOK;  // @constdefine A phonebook entry has been added to storage; lpData points to the storage
+                                                                               // index assigned to the new entry (ifdwIndex is RIL_PBINDEX_FIRSTAVAILABLE, the new entry was stored in the first available location)
+      RIL_NOTIFY_PHONEBOOKENTRYDELETED   = $00000002 or RIL_NCLASS_PHONEBOOK;  // @constdefine A phonebook entry has been deleted from storage; lpData points to the storage index occupied by the deleted entry
+      RIL_NOTIFY_PHONEBOOKSTORAGECHANGED = $00000003 or RIL_NCLASS_PHONEBOOK;  // @constdefine Phonebook storage location has been changed; lpData points to RIL_PBLOC_* constant
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Notification Toolkit | SIM Toolkit notifications (RIL_NCLASS_SIMTOOLKIT)
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_NOTIFY_SIMTOOLKITCMD        = $00000001 or RIL_NCLASS_SIMTOOLKIT;  // @constdefine A SIM Toolkit command was not handled by the radio; lpData points to array of bytes containing the command
+      RIL_NOTIFY_SIMTOOLKITCALLSETUP  = $00000002 or RIL_NCLASS_SIMTOOLKIT;  // @constdefine SIM Toolkit is trying to set up a call and call conditions were successfully checked by the radio;
+                                                                             // lpData points to a DWORD containing the redial timeout for the call (in milliseconds)
+      RIL_NOTIFY_SIMTOOLKITEVENT      = $00000003 or RIL_NCLASS_SIMTOOLKIT;  // @constdefine A SIM Toolkit command was handled by the radio or the radio sent a SIm Toolkit command response to the SIM;
+                                                                             // lpData points to array of bytes containing the command or response sent
+      RIL_NOTIFY_SIMTOOLKITSESSIONEND = $00000004 or RIL_NCLASS_SIMTOOLKIT;  // @constdefine A SIM Toolkit command session is ending
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Notification Radio State Change | Radio State Change notifications (RIL_NCLASS_RADIOSTATE)
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_NOTIFY_RADIOEQUIPMENTSTATECHANGED = $00000001 or RIL_NCLASS_RADIOSTATE;  // @constdefine Carries a STRUCT (RILEQUIPMENTSTATE) stating The Radio equiptmentstate has changed, also notifies a driver defined Radio ON or OFF state
+      RIL_NOTIFY_RADIOPRESENCECHANGED       = $00000002 or RIL_NCLASS_RADIOSTATE;  // @constdefine Carries a dword (RIL_RADIOPRESENCE_*) stating that a Radio Module/Driver has been changed (removed, inserted, etc)
+      RIL_NOTIFY_RADIORESET                 = $00000003 or RIL_NCLASS_RADIOSTATE;  // @constdefine The driver has detected that the radio reset itself. lpData points to NULL
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Notification Misc | Miscellaneous notifications (RIL_NCLASS_MISC)
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_NOTIFY_SIMNOTACCESSIBLE         = $00000001 or RIL_NCLASS_MISC;  // @constdefine SIM card has been removed or has failed to respond; lpData is NULL
+      RIL_NOTIFY_DTMFSIGNAL               = $00000002 or RIL_NCLASS_MISC;  // @constdefine A DTMF signal has been detected; lpData points to char
+      RIL_NOTIFY_GPRSCLASS_NETWORKCHANGED = $00000003 or RIL_NCLASS_MISC;  // @constdefine Network has indicated a change in GPRS class
+                                                                           // lpData points to a DWORD containing the new RIL_GPRSCLASS_* value
+      RIL_NOTIFY_GPRSCLASS_RADIOCHANGED   = $00000004 or RIL_NCLASS_MISC;  // @constdefine The radio has indicated a change in GPRS class
+                                                                           // lpData points to a DWORD containing the new RIL_GPRSCLASS_* value
+      RIL_NOTIFY_SIGNALQUALITY            = $00000005 or RIL_NCLASS_MISC;  // @constdefine Signal Quality Notification
+                                                                           // lpData points to a RILSIGNALQUALITY structure
+      RIL_NOTIFY_MAINTREQUIRED            = $00000006 or RIL_NCLASS_MISC;  // @constdefine BS notification that MS requires servicing; lpdata is NULL
+      RIL_NOTIFY_PRIVACYCHANGED           = $00000007 or RIL_NCLASS_MISC;  // @constdefine Call Privacy Status; lpData points to DWORD of value RIL_CALLPRIVACY_*
+      RIL_NOTIFY_SIM_DATACHANGE           = $00000008 or RIL_NCLASS_MISC;  // @constdefine data change notification; lpData points to DWORD of value RIL_SIMDATACHANGE_*
+      RIL_NOTIFY_ATLOGGING                = $00000009 or RIL_NCLASS_MISC;  // @constdefine at command log data present
+      RIL_NOTIFY_SIMSTATUSCHANGED         = $0000000A or RIL_NCLASS_MISC;  // @constdefine SIM card state has changed. Carries a DWORD (RIL_SIMSTATUSCHANGED_*) with the current state.
+                                                                           // Notification is sent only when encountering error conditions from the radio.
+      RIL_NOTIFY_EONS                     = $0000000B or RIL_NCLASS_MISC;  // @constdefine EONS information ready or updated; lpData is NULL
+      RIL_NOTIFY_SIMSECURITYSTATUS        = $0000000C or RIL_NCLASS_MISC;  // @constdefine SIM security status change; lpData points to LPRILSIMSECURITYSTATUS
+      RIL_NOTIFY_LINESTATE                = $0000000D or RIL_NCLASS_MISC;  // @constdefine line state; lpData points to a DWORD of value RIL_LINESTAT_*
+      RIL_NOTIFY_BEARERSVCINFO            = $0000000E or RIL_NCLASS_MISC;  // @constdefine bearer service information; lpData points to LPRILBEARERSVCINFO
+      RIL_NOTIFY_DATACOMPINFO             = $0000000F or RIL_NCLASS_MISC;  // @constdefine data compression information; lpData points to LPRILDATACOMPINFO
+      RIL_NOTIFY_EQUIPMENTINFO            = $00000010 or RIL_NCLASS_MISC;  // @constdefine equipment information; lpData points to LPRILEQUIPMENTINFO
+      RIL_NOTIFY_ERRORCORRECTIONINFO      = $00000011 or RIL_NCLASS_MISC;  // @constdefine error correction information; lpData points to LPRILERRORCORRECTIONINFO
+      RIL_NOTIFY_GPRSADDRESS              = $00000012 or RIL_NCLASS_MISC;  // @constdefine GPRS address; lpData points to an array of WCHAR values that indicate the address
+      RIL_NOTIFY_GPRSATTACHED             = $00000013 or RIL_NCLASS_MISC;  // @constdefine GPRS attach state; lpData points to a BOOL that indicates attach state
+      RIL_NOTIFY_GPRSCONTEXT              = $00000014 or RIL_NCLASS_MISC;  // @constdefine GPRS context list; lpData points to LPRILGPRSCONTEXT
+      RIL_NOTIFY_GPRSCONTEXTACTIVATED     = $00000015 or RIL_NCLASS_MISC;  // @constdefine GPRS context activated list; lpData points to LPRILGPRSCONTEXTACTIVATED
+      RIL_NOTIFY_QOSMIN                   = $00000016 or RIL_NCLASS_MISC;  // @constdefine minimum quality of service profile ; lpData points to LPRILGPRSQOSPROFILE
+      RIL_NOTIFY_QOSREQ                   = $00000017 or RIL_NCLASS_MISC;  // @constdefine requested quality of service profile ; lpData points to LPRILGPRSQOSPROFILE
+      RIL_NOTIFY_RLPOPTIONS               = $00000018 or RIL_NCLASS_MISC;  // @constdefine requested quality of service profile ; lpData points to LPRILRLPINFO
+      RIL_NOTIFY_NITZ                     = $00000019 or RIL_NCLASS_MISC;  // @constdefine NITZ Date/Time notification. lpData points to a RILNITZINFO structure.
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Notification Device Specific | Device Specific notifications (RIL_NCLASS_DEVSPECIFIC)
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_NOTIFY_LOCATION   = $00008000 or RIL_NCLASS_DEVSPECIFIC; // @constdefine Location Services; lpData points to DWORD of value RIL_LOCATION_*
+      RIL_NOTIFY_ROAMSTATUS = $00008001 or RIL_NCLASS_DEVSPECIFIC; // @constdefine Roaming Status; lpData points to DWORD of value RIL_ROAMSTATUS_*
+                                                                   // lpData ponts to DWORD of [ RIL_NDIS_XON |RIL_NDIS_XOFF ]
+
+//
+// Macro to extract notification class from notification code
+//
+function NCLASS_FROM_NOTIFICATION(code:ULONG):ULONG; inline;
+
+
+//
+// Structure parameter flags
+//
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILNDISIPCONFIG
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+//
+const
+      RIL_PARAM_NDISIPCONFIG_PROTOCOL_IPV4 = $00000001;  // @paramdefine
+      RIL_PARAM_NDISIPCONFIG_PROTOCOL_IPV6 = $00000002;  // @paramdefine
+//
+// ipv4 defines
+      RIL_PARAM_NDISIPCONFIG_IPADDR         = $00000001;  // @paramdefine
+      RIL_PARAM_NDISIPCONFIG_PRIMARYDNS     = $00000002;  // @paramdefine
+      RIL_PARAM_NDISIPCONFIG_SECONDARYDNS   = $00000004;  // @paramdefine
+      RIL_PARAM_NDISIPCONFIG_DEFAULTGATEWAY = $00000008;  // @paramdefine
+      RIL_PARAM_NDISIPCONFIG_SUBNETMASK     = $00000010;  // @paramdefine
+      RIL_PARAM_NDISIPCONFIG_ALL            = $0000001f;  // @paramdefine
+//
+// ipv6 defines
+      RIL_PARAM_NDISIPCONFIG_IPV6_IPADDR         = $00000001;  // @paramdefine
+      RIL_PARAM_NDISIPCONFIG_IPV6_PRIMARYDNS     = $00000002;  // @paramdefine
+      RIL_PARAM_NDISIPCONFIG_IPV6_SECONDARYDNS   = $00000004;  // @paramdefine
+      RIL_PARAM_NDISIPCONFIG_IPV6_DEFAULTGATEWAY = $00000008;  // @paramdefine
+      RIL_PARAM_NDISIPCONFIG_IPV6_SUBNETMASK     = $00000010;  // @paramdefine
+      RIL_PARAM_NDISIPCONFIG_IPV6_FLOWINFO       = $00000020;  // @paramdefine
+      RIL_PARAM_NDISIPCONFIG_IPV6_SCOPEID        = $00000040;  // @paramdefine
+      RIL_PARAM_NDISIPCONFIG_IPV6_ALL            = $0000007f;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILNDISGPRSCONTEXT
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_RILNDISGPRSCONTEXT_USERNAME = $00000001;  // @paramdefine
+      RIL_PARAM_RILNDISGPRSCONTEXT_PASSWORD = $00000002;  // @paramdefine
+      RIL_PARAM_RILNDISGPRSCONTEXT_DNS1     = $00000004;  // @paramdefine
+      RIL_PARAM_RILNDISGPRSCONTEXT_DNS2     = $00000008;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILNDISGPRSCONTEXTRESPONSE
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_RILNDISGPRSCONTEXTRESPONSE_IPCONFIG  = $00000001;  // @paramdefine
+      RIL_PARAM_RILNDISGPRSCONTEXTRESPONSE_FUNCTIONS = $00000002;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILNDISSTATUS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_RILNDISSTATUS_IPCONFIG    = $00000001;  // @paramdefine
+      RIL_PARAM_RILNDISSTATUS_FLOWCONTROL = $00000002;  // @paramdefine
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILADDRESS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_A_TYPE                          = $00000001; // @paramdefine
+      RIL_PARAM_A_NUMPLAN                       = $00000002; // @paramdefine
+      RIL_PARAM_A_ADDRESS                       = $00000004; // @paramdefine
+      RIL_PARAM_A_ALL                           = $00000007; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILSUBADDRESS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_SA_TYPE                         = $00000001; // @paramdefine
+      RIL_PARAM_SA_SUBADDRESS                   = $00000002; // @paramdefine
+      RIL_PARAM_SA_ALL                          = $00000003; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILSERIALPORTSTATS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_SPS_READBITSPERSECOND           = $00000001; // @paramdefine
+      RIL_PARAM_SPS_WRITTENBITSPERSECOND        = $00000002; // @paramdefine
+      RIL_PARAM_SPS_ALL                         = $00000003; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILSUBSCRIBERINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_SI_ADDRESS                      = $00000001; // @paramdefine
+      RIL_PARAM_SI_DESCRIPTION                  = $00000002; // @paramdefine
+      RIL_PARAM_SI_SPEED                        = $00000004; // @paramdefine
+      RIL_PARAM_SI_SERVICE                      = $00000008; // @paramdefine
+      RIL_PARAM_SI_ITC                          = $00000010; // @paramdefine
+      RIL_PARAM_SI_ADDRESSID                    = $00000020; // @paramdefine
+      RIL_PARAM_SI_ALL                          = $0000003f; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILOPERATORNAMES
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_ON_LONGNAME                     = $00000001; // @paramdefine
+      RIL_PARAM_ON_SHORTNAME                    = $00000002; // @paramdefine
+      RIL_PARAM_ON_NUMNAME                      = $00000004; // @paramdefine
+      RIL_PARAM_ON_COUNTRY_CODE                 = $00000008; // @paramdefine
+      RIL_PARAM_ON_GSM_ACT                      = $00000010; // @paramdefine
+      RIL_PARAM_ON_GSMCOMPACT_ACT               = $00000020; // @paramdefine
+      RIL_PARAM_ON_UMTS_ACT                     = $00000040; // @paramdefine
+      RIL_PARAM_ON_ALL                          = $0000007F; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILOPERATORINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_OI_INDEX                        = $00000001; // @paramdefine
+      RIL_PARAM_OI_STATUS                       = $00000002; // @paramdefine
+      RIL_PARAM_OI_NAMES                        = $00000004; // @paramdefine
+      RIL_PARAM_OI_ALL                          = $00000007; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCALLERIDSETTINGS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CIDS_PROVISIONING               = $00000001; // @paramdefine
+      RIL_PARAM_CIDS_STATUS                     = $00000002; // @paramdefine
+      RIL_PARAM_CIDS_ALL                        = $00000003; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILHIDEIDSETTINGS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_HIDS_STATUS                     = $00000001; // @paramdefine
+      RIL_PARAM_HIDS_PROVISIONING               = $00000002; // @paramdefine
+      RIL_PARAM_HIDS_ALL                        = $00000003; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILDIALEDIDSETTINGS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_DIDS_PROVISIONING               = $00000001; // @paramdefine
+      RIL_PARAM_DIDS_STATUS                     = $00000002; // @paramdefine
+      RIL_PARAM_DIDS_ALL                        = $00000003; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILHIDECONNECTEDIDSETTINGS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_HCIDS_PROVISIONING              = $00000001; // @paramdefine
+      RIL_PARAM_HCIDS_STATUS                    = $00000002; // @paramdefine
+      RIL_PARAM_HCIDS_ALL                       = $00000003; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCLOSEDGROUPSETTINGS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CGS_STATUS                      = $00000001; // @paramdefine
+      RIL_PARAM_CGS_INDEX                       = $00000002; // @paramdefine
+      RIL_PARAM_CGS_INFO                        = $00000004; // @paramdefine
+      RIL_PARAM_CGS_ALL                         = $00000007; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCALLFORWARDINGSETTINGS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CFS_STATUS                      = $00000001; // @paramdefine
+      RIL_PARAM_CFS_INFOCLASSES                 = $00000002; // @paramdefine
+      RIL_PARAM_CFS_ADDRESS                     = $00000004; // @paramdefine
+      RIL_PARAM_CFS_SUBADDRESS                  = $00000008; // @paramdefine
+      RIL_PARAM_CFS_DELAYTIME                   = $00000010; // @paramdefine
+      RIL_PARAM_CFS_ALL                         = $0000001f; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCALLINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CI_ID                           = $00000001; // @paramdefine
+      RIL_PARAM_CI_DIRECTION                    = $00000002; // @paramdefine
+      RIL_PARAM_CI_STATUS                       = $00000004; // @paramdefine
+      RIL_PARAM_CI_TYPE                         = $00000008; // @paramdefine
+      RIL_PARAM_CI_MULTIPARTY                   = $00000010; // @paramdefine
+      RIL_PARAM_CI_ADDRESS                      = $00000020; // @paramdefine
+      RIL_PARAM_CI_DESCRIPTION                  = $00000040; // @paramdefine
+      RIL_PARAM_CI_CPISTATUS                    = $00000080; // @paramdefine
+      RIL_PARAM_CI_DISCONNECTCODE               = $00000100; // @paramdefine
+//Note: RIL_PARAM_CI_STATUS and RIL_PARAM_CI_CPISTATUS are mutually exclusive
+// parameters because they define how the dwStatus variable is used.
+// Therefore, there is no RIL_PARAM_CI_ALL to avoid any ambiguity.
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILGAININFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_GI_TXGAIN                       = $00000001; // @paramdefine
+      RIL_PARAM_GI_RXGAIN                       = $00000002; // @paramdefine
+      RIL_PARAM_GI_ALL                          = $00000003; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILAUDIODEVICEINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_ADI_TXDEVICE                    = $00000001; // @paramdefine
+      RIL_PARAM_ADI_RXDEVICE                    = $00000002; // @paramdefine
+      RIL_PARAM_ADI_ALL                         = $00000003; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILHSCSDINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_HSCSDI_TRANSPRXTIMESLOTS        = $00000001; // @paramdefine
+      RIL_PARAM_HSCSDI_TRANSPCHANNELCODINGS     = $00000002; // @paramdefine
+      RIL_PARAM_HSCSDI_NONTRANSPRXTIMESLOTS     = $00000004; // @paramdefine
+      RIL_PARAM_HSCSDI_NONTRANSPCHANNELCODINGS  = $00000008; // @paramdefine
+      RIL_PARAM_HSCSDI_AIRINTERFACEUSERRATE     = $00000010; // @paramdefine
+      RIL_PARAM_HSCSDI_RXTIMESLOTSLIMIT         = $00000020; // @paramdefine
+      RIL_PARAM_HSCSDI_AUTOSVCLEVELUPGRADING    = $00000040; // @paramdefine
+      RIL_PARAM_HSCSDI_ALL                      = $0000007f; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCALLHSCSDINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CHSCSDI_RXTIMESLOTS             = $00000001; // @paramdefine
+      RIL_PARAM_CHSCSDI_TXTIMESLOTS             = $00000002; // @paramdefine
+      RIL_PARAM_CHSCSDI_AIRINTERFACEUSERRATE    = $00000004; // @paramdefine
+      RIL_PARAM_CHSCSDI_CHANNELCODING           = $00000008; // @paramdefine
+      RIL_PARAM_CHSCSDI_ALL                     = $0000000f; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILDATACOMPINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_DCI_DIRECTION                   = $00000001; // @paramdefine
+      RIL_PARAM_DCI_NEGOTIATION                 = $00000002; // @paramdefine
+      RIL_PARAM_DCI_MAXDICTENTRIES              = $00000004; // @paramdefine
+      RIL_PARAM_DCI_MAXSTRING                   = $00000008; // @paramdefine
+      RIL_PARAM_DCI_ALL                         = $0000000f; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILERRORCORRECTIONINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_ECI_ORIGINALREQUEST             = $00000001; // @paramdefine
+      RIL_PARAM_ECI_ORIGINALFALLBACK            = $00000002; // @paramdefine
+      RIL_PARAM_ECI_ANSWERERFALLBACK            = $00000004; // @paramdefine
+      RIL_PARAM_ECI_ALL                         = $00000007; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILBEARERSVCINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_BSI_SPEED                       = $00000001; // @paramdefine
+      RIL_PARAM_BSI_SERVICENAME                 = $00000002; // @paramdefine
+      RIL_PARAM_BSI_CONNECTIONELEMENT           = $00000004; // @paramdefine
+      RIL_PARAM_BSI_ALL                         = $00000007; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILRLPINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_RLPI_IWS                        = $00000001; // @paramdefine
+      RIL_PARAM_RLPI_MWS                        = $00000002; // @paramdefine
+      RIL_PARAM_RLPI_ACKTIMER                   = $00000004; // @paramdefine
+      RIL_PARAM_RLPI_RETRANSMISSIONATTEMPTS     = $00000008; // @paramdefine
+      RIL_PARAM_RLPI_VERSION                    = $00000010; // @paramdefine
+      RIL_PARAM_RPLI_RESEQUENCINGPERIOD         = $00000020; // @paramdefine
+      RIL_PARAM_RPLI_ALL                        = $0000003f; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILMSGSERVICEINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_MSI_SERVICE                     = $00000001; // @paramdefine
+      RIL_PARAM_MSI_MSGCLASSES                  = $00000002; // @paramdefine
+      RIL_PARAM_MSI_READLOCATION                = $00000004; // @paramdefine
+      RIL_PARAM_MSI_READUSED                    = $00000008; // @paramdefine
+      RIL_PARAM_MSI_READTOTAL                   = $00000010; // @paramdefine
+      RIL_PARAM_MSI_WRITELOCATION               = $00000020; // @paramdefine
+      RIL_PARAM_MSI_WRITEUSED                   = $00000040; // @paramdefine
+      RIL_PARAM_MSI_WRITETOTAL                  = $00000080; // @paramdefine
+      RIL_PARAM_MSI_STORELOCATION               = $00000100; // @paramdefine
+      RIL_PARAM_MSI_STOREUSED                   = $00000200; // @paramdefine
+      RIL_PARAM_MSI_STORETOTAL                  = $00000400; // @paramdefine
+      RIL_PARAM_MSI_ALL                         = $000007ff; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILMSGDCS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_MDCS_TYPE                       = $00000001; // @paramdefine
+      RIL_PARAM_MDCS_FLAGS                      = $00000002; // @paramdefine
+      RIL_PARAM_MDCS_MSGCLASS                   = $00000004; // @paramdefine
+      RIL_PARAM_MDCS_ALPHABET                   = $00000008; // @paramdefine
+      RIL_PARAM_MDCS_INDICATION                 = $00000010; // @paramdefine
+      RIL_PARAM_MDCS_LANGUAGE                   = $00000020; // @paramdefine
+      RIL_PARAM_MDCS_ALL                        = $0000003f; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILMSGCONFIG
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_MC_SVCCTRADDRESS                = $00000001; // @paramdefine
+      RIL_PARAM_MC_ALL                          = $00000001; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCBMSGCONFIG
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CBMC_BROADCASTMSGIDS            = $00000001; // @paramdefine
+      RIL_PARAM_CBMC_BROADCASTMSGLANGS          = $00000002; // @paramdefine
+      RIL_PARAM_CBMC_ACCEPTIDS                  = $00000004; // @paramdefine
+      RIL_PARAM_CBMC_ALL                        = $00000007; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILMESSAGE
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+{ List of Unions Labeled
+GSM
+ID=RIL_MSGTYPE_IN_DELIVER
+ISt=RIL_MSGTYPE_IN_STATUS
+OS=RIL_MSGTYPE_OUT_SUBMIT
+OC=RIL_MSGTYPE_OUT_COMMAND
+OR=RIL_MSGTYPE_OUT_RAW
+BC=RIL_MSGTYPE_BC_GENERAL
+
+CDMA
+ID=RIL_MSGTYPE_IN_IS637DELIVER
+ISt=RIL_MSGTYPE_IN_IS637STATUS
+OS=RIL_MSGTYPE_OUT_IS637SUBMIT
+OSt=RIL_MSGTYPE_OUT_IS637STATUS
+}
+// -------This block is the GSM Params for RILMESSAGE (These values may have been recycled;
+//        U = This value for the field has been reused in CDMA, and if the RILMESSAGE structure
+//            is expanded, developer must careful not to use two recycled fields in the same union.)
+const
+      RIL_PARAM_M_SVCCTRADDRESS                 = $00000001; // @paramdefine GSM=[ID,ISt,OS,OC,OR,BC] CDMA=[ID,ISt,OS,OSt]
+      RIL_PARAM_M_TYPE                          = $00000002; // @paramdefine GSM=[ID,ISt,OS,OC,OR,BC] CDMA=[ID,ISt,OS,OSt]
+      RIL_PARAM_M_FLAGS                         = $00000004; // @paramdefine GSM=[ID,ISt,OS,OC,OR,BC] CDMA=[ID,ISt,OS,OSt]
+      RIL_PARAM_M_ORIGADDRESS                   = $00000008; // @paramdefine GSM=[ID] CDMA=[ID,ISt]
+      RIL_PARAM_M_TGTRECIPADDRESS               = $00000010; // @paramdefine U GSM=[ISt]
+      RIL_PARAM_M_DESTADDRESS                   = $00000020; // @paramdefine GSM=[OS,OC] CDMA=[OSt,OS]
+      RIL_PARAM_M_SCRECEIVETIME                 = $00000040; // @paramdefine GSM=[ID] CDMA=[ID,Ist]
+      RIL_PARAM_M_TGTSCRECEIVETIME              = $00000080; // @paramdefine U GSM=[ISt]
+      RIL_PARAM_M_TGTDISCHARGETIME              = $00000100; // @paramdefine U GSM=[ISt]
+      RIL_PARAM_M_PROTOCOLID                    = $00000200; // @paramdefine U GSM=[ISt]
+      RIL_PARAM_M_DATACODING                    = $00000800; // @paramdefine U GSM=[ID,ISt,OS,BC]
+      RIL_PARAM_M_TGTDLVSTATUS                  = $00001000; // @paramdefine U GSM=[ISt]
+      RIL_PARAM_M_TGTMSGREFERENCE               = $00002000; // @paramdefine U GSM=[OC]
+      RIL_PARAM_M_VPFORMAT                      = $00004000; // @paramdefine U GSM=[OS]
+      RIL_PARAM_M_VP                            = $00008000; // @paramdefine U GSM=[OS]
+      RIL_PARAM_M_COMMANDTYPE                   = $00010000; // @paramdefine U GSM=[OC]
+      RIL_PARAM_M_GEOSCOPE                      = $00020000; // @paramdefine U GSM=[BC]
+      RIL_PARAM_M_MSGCODE                       = $00040000; // @paramdefine U GSM=[BC]
+      RIL_PARAM_M_UPDATENUMBER                  = $00080000; // @paramdefine U GSM=[BC]
+      RIL_PARAM_M_ID                            = $00100000; // @paramdefine U GSM=[BC]
+      RIL_PARAM_M_TOTALPAGES                    = $00200000; // @paramdefine U GSM=[BC]
+      RIL_PARAM_M_PAGENUMBER                    = $00400000; // @paramdefine U GSM=[BC]
+      RIL_PARAM_M_HDRLENGTH                     = $00800000; // @paramdefine U GSM=[ID,ISt,OS]
+      RIL_PARAM_M_MSGLENGTH                     = $01000000; // @paramdefine GSM=[ID,ISt,OS,OR,BC] CDMA=[ID,ISt,OS,OSt]
+      RIL_PARAM_M_CMDLENGTH                     = $02000000; // @paramdefine GSM=[OC]
+      RIL_PARAM_M_HDR                           = $04000000; // @paramdefine GSM=[ID,ISt,OS]
+      RIL_PARAM_M_MSG                           = $08000000; // @paramdefine GSM=[ID,ISt,OS,OR,BC] CDMA=[ID,ISt,OS,OSt]
+      RIL_PARAM_M_CMD                           = $10000000; // @paramdefine U GSM=[OC]
+
+// CDMA Message parameter definitions
+const
+      RIL_PARAM_M_MSGID                         = $20000000; // @paramdefine CDMA=[ID,ISt,OS,OSt]
+
+      RIL_PARAM_M_ORIGSUBADDRESS                = $40000000; // @paramdefine CDMA=[ID,ISt]
+      RIL_PARAM_M_DESTSUBADDRESS                = $80000000; // @paramdefine CDMA=[OS,OSt]
+      RIL_PARAM_M_DIGIT                         = $00010000; // @paramdefine CDMA=[OS,OSt]
+
+      RIL_PARAM_M_PRIVACY                       = $00000100; // @paramdefine CDMA=[ID,OS]
+      RIL_PARAM_M_PRIORITY                      = $00000200; // @paramdefine CDMA=[ID,OS]
+      RIL_PARAM_M_TELESERVICE                   = $00000400; // @paramdefine CDMA=[ID,OS]
+      RIL_PARAM_M_LANG                          = $00000800; // @paramdefine CDMA=[ID,ISt,OS,OSt]
+
+      RIL_PARAM_M_VALIDITYPERIODABS             = $00001000; // @paramdefine CDMA=[ID,OS]
+      RIL_PARAM_M_VALIDITYPERIODREL             = $00002000; // @paramdefine CDMA=[OS]
+      RIL_PARAM_M_DEFERREDDELTIMEABS            = $00004000; // @paramdefine CDMA=[OS]
+      RIL_PARAM_M_DEFERREDDELTIMEREL            = $00008000; // @paramdefine CDMA=[OS]
+
+      RIL_PARAM_M_ENCODING                      = $00020000; // @paramdefine CDMA=[ID,ISt,OS,OSt]
+      RIL_PARAM_M_USERRESPONSECODE              = $00040000; // @paramdefine CDMA=[ISt,OSt]
+      RIL_PARAM_M_DISPLAYMODE                   = $00080000; // @paramdefine CDMA=[ID,OS]
+
+      RIL_PARAM_M_CALLBACKNUM                   = $00000010; // @paramdefine CDMA=[ID,OS]
+      RIL_PARAM_M_NUMMSGS                       = $00000080; // @paramdefine CDMA=[ID]
+
+      RIL_PARAM_M_CAUSECODE                     = $00100000; // @paramdefine CDMA=[ISt]
+      RIL_PARAM_M_REPLYSEQNUMBER                = $00200000; // @paramdefine CDMA=[ISt,OSt]
+
+      RIL_PARAM_M_BEARERREPLYACK                = $00200000; // @paramdefine CDMA=[OS]
+      RIL_PARAM_M_USERACK                       = $00400000; // @paramdefine CDMA=[ID,OS]
+      RIL_PARAM_M_DELIVERYACK                   = $00800000; // @paramdefine CDMA=[OS]
+      RIL_PARAM_M_MSGSTATUSTYPE                 = $10000000; // @paramdefine CDMA=[ISt]
+
+      RIL_PARAM_M_ALL_IN_DELIVER                = RIL_PARAM_M_TYPE or
+                                                  RIL_PARAM_M_FLAGS or
+                                                  RIL_PARAM_M_ORIGADDRESS or
+                                                  RIL_PARAM_M_PROTOCOLID or
+                                                  RIL_PARAM_M_DATACODING or
+                                                  RIL_PARAM_M_SCRECEIVETIME or
+                                                  RIL_PARAM_M_HDRLENGTH or
+                                                  RIL_PARAM_M_MSGLENGTH or
+                                                  RIL_PARAM_M_HDR or
+                                                  RIL_PARAM_M_MSG;            // @paramdefine
+
+      RIL_PARAM_M_ALL_IN_STATUS                 = RIL_PARAM_M_TYPE or
+                                                  RIL_PARAM_M_FLAGS or
+                                                  RIL_PARAM_M_TGTMSGREFERENCE or
+                                                  RIL_PARAM_M_TGTRECIPADDRESS or
+                                                  RIL_PARAM_M_TGTSCRECEIVETIME or
+                                                  RIL_PARAM_M_TGTDISCHARGETIME or
+                                                  RIL_PARAM_M_TGTDLVSTATUS or
+                                                  RIL_PARAM_M_PROTOCOLID or
+                                                  RIL_PARAM_M_DATACODING or
+                                                  RIL_PARAM_M_HDRLENGTH or
+                                                  RIL_PARAM_M_MSGLENGTH or
+                                                  RIL_PARAM_M_HDR or
+                                                  RIL_PARAM_M_MSG;            // @paramdefine
+
+      RIL_PARAM_M_ALL_OUT_SUBMIT                = RIL_PARAM_M_TYPE or
+                                                  RIL_PARAM_M_FLAGS or
+                                                  RIL_PARAM_M_DESTADDRESS or
+                                                  RIL_PARAM_M_PROTOCOLID or
+                                                  RIL_PARAM_M_DATACODING or
+                                                  RIL_PARAM_M_VPFORMAT or
+                                                  RIL_PARAM_M_VP or
+                                                  RIL_PARAM_M_HDRLENGTH or
+                                                  RIL_PARAM_M_MSGLENGTH or
+                                                  RIL_PARAM_M_HDR or
+                                                  RIL_PARAM_M_MSG;             // @paramdefine
+
+      RIL_PARAM_M_ALL_OUT_COMMAND               = RIL_PARAM_M_TYPE or
+                                                  RIL_PARAM_M_FLAGS or
+                                                  RIL_PARAM_M_PROTOCOLID or
+                                                  RIL_PARAM_M_COMMANDTYPE or
+                                                  RIL_PARAM_M_TGTMSGREFERENCE or
+                                                  RIL_PARAM_M_DESTADDRESS or
+                                                  RIL_PARAM_M_CMDLENGTH or
+                                                  RIL_PARAM_M_CMD;  // @paramdefine
+
+      RIL_PARAM_M_ALL_BC_GENERAL                = RIL_PARAM_M_TYPE or
+                                                  RIL_PARAM_M_GEOSCOPE or
+                                                  RIL_PARAM_M_MSGCODE or
+                                                  RIL_PARAM_M_UPDATENUMBER or
+                                                  RIL_PARAM_M_ID or
+                                                  RIL_PARAM_M_DATACODING or
+                                                  RIL_PARAM_M_TOTALPAGES or
+                                                  RIL_PARAM_M_PAGENUMBER or
+                                                  RIL_PARAM_M_MSGLENGTH or
+                                                  RIL_PARAM_M_MSG;             // @paramdefine
+
+      RIL_PARAM_M_ALL_OUT_RAW                   = RIL_PARAM_M_TYPE or
+                                                  RIL_PARAM_M_FLAGS or
+                                                  RIL_PARAM_M_MSGLENGTH or
+                                                  RIL_PARAM_M_MSG;             // @paramdefine
+
+      RIL_PARAM_M_ALL_IN_IS637DELIVER           = RIL_PARAM_M_TYPE or
+                                                  RIL_PARAM_M_MSGID or
+                                                  RIL_PARAM_M_TELESERVICE or
+                                                  RIL_PARAM_M_DISPLAYMODE or
+                                                  RIL_PARAM_M_USERACK or
+                                                  RIL_PARAM_M_ORIGADDRESS or
+                                                  RIL_PARAM_M_ORIGSUBADDRESS or
+                                                  RIL_PARAM_M_SCRECEIVETIME or
+                                                  RIL_PARAM_M_PRIORITY or
+                                                  RIL_PARAM_M_PRIVACY or
+                                                  RIL_PARAM_M_CALLBACKNUM or
+                                                  RIL_PARAM_M_NUMMSGS or
+                                                  RIL_PARAM_M_VALIDITYPERIODABS or
+                                                  RIL_PARAM_M_LANG or
+                                                  RIL_PARAM_M_ENCODING or
+                                                  RIL_PARAM_M_MSGLENGTH or
+                                                  RIL_PARAM_M_MSG;             // @paramdefine
+
+      RIL_PARAM_M_ALL_OUT_IS637SUBMIT           = RIL_PARAM_M_TYPE or
+                                                  RIL_PARAM_M_MSGID or
+                                                  RIL_PARAM_M_TELESERVICE or
+                                                  RIL_PARAM_M_DISPLAYMODE or
+                                                  RIL_PARAM_M_DESTADDRESS or
+                                                  RIL_PARAM_M_DESTSUBADDRESS or
+                                                  RIL_PARAM_M_DIGIT or
+                                                  RIL_PARAM_M_BEARERREPLYACK or
+                                                  RIL_PARAM_M_PRIORITY or
+                                                  RIL_PARAM_M_PRIVACY or
+                                                  RIL_PARAM_M_CALLBACKNUM or
+                                                  RIL_PARAM_M_USERACK or
+                                                  RIL_PARAM_M_DELIVERYACK or
+                                                  RIL_PARAM_M_VALIDITYPERIODABS or
+                                                  RIL_PARAM_M_VALIDITYPERIODREL or
+                                                  RIL_PARAM_M_DEFERREDDELTIMEABS or
+                                                  RIL_PARAM_M_DEFERREDDELTIMEREL or
+                                                  RIL_PARAM_M_LANG or
+                                                  RIL_PARAM_M_ENCODING or
+                                                  RIL_PARAM_M_MSGLENGTH or
+                                                  RIL_PARAM_M_MSG;              // @paramdefine
+
+      RIL_PARAM_M_ALL_IN_IS637STATUS            = RIL_PARAM_M_TYPE or
+                                                  RIL_PARAM_M_MSGID or
+                                                  RIL_PARAM_M_ORIGADDRESS or
+                                                  RIL_PARAM_M_ORIGSUBADDRESS or
+                                                  RIL_PARAM_M_SCRECEIVETIME or
+                                                  RIL_PARAM_M_CAUSECODE or
+                                                  RIL_PARAM_M_REPLYSEQNUMBER or
+                                                  RIL_PARAM_M_LANG or
+                                                  RIL_PARAM_M_ENCODING or
+                                                  RIL_PARAM_M_MSGLENGTH or
+                                                  RIL_PARAM_M_MSG or
+                                                  RIL_PARAM_M_USERRESPONSECODE or
+                                                  RIL_PARAM_M_MSGSTATUSTYPE;    // @paramdefine
+
+      RIL_PARAM_M_ALL_OUT_IS637STATUS           = RIL_PARAM_M_TYPE or
+                                                  RIL_PARAM_M_MSGID or
+                                                  RIL_PARAM_M_DESTADDRESS or
+                                                  RIL_PARAM_M_DESTSUBADDRESS or
+                                                  RIL_PARAM_M_REPLYSEQNUMBER or
+                                                  RIL_PARAM_M_LANG or
+                                                  RIL_PARAM_M_ENCODING or
+                                                  RIL_PARAM_M_MSGLENGTH or
+                                                  RIL_PARAM_M_MSG or
+                                                  RIL_PARAM_M_USERRESPONSECODE or
+                                                  RIL_PARAM_M_DIGIT;            // @paramdefine
+
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILMESSAGE_IN_SIM
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_MIS_LOCATION                      = $00000001; // @paramdefine
+      RIL_PARAM_MIS_INDEX                         = $00000002; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILMESSAGEINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_MI_INDEX                          = $00000001;  // @paramdefine
+      RIL_PARAM_MI_STATUS                         = $00000002;  // @paramdefine
+      RIL_PARAM_MI_MESSAGE                        = $00000004;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILEQUIPMENTINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_EI_MANUFACTURER                   = $00000001;  // @paramdefine
+      RIL_PARAM_EI_MODEL                          = $00000002;  // @paramdefine
+      RIL_PARAM_EI_REVISION                       = $00000004;  // @paramdefine
+      RIL_PARAM_EI_SERIALNUMBER                   = $00000008;  // @paramdefine
+      RIL_PARAM_EI_ALL                            = $0000000f;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILPHONEBOOKINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_PBI_STORELOCATION                 = $00000001;  // @paramdefine
+      RIL_PARAM_PBI_USED                          = $00000002;  // @paramdefine
+      RIL_PARAM_PBI_TOTAL                         = $00000004;  // @paramdefine
+      RIL_PARAM_PBI_ALL                           = $00000007;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILPHONEBOOKENTRY
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_PBE_INDEX                         = $00000001;  // @paramdefine
+      RIL_PARAM_PBE_ADDRESS                       = $00000002;  // @paramdefine
+      RIL_PARAM_PBE_TEXT                          = $00000004;  // @paramdefine
+      RIL_PARAM_PBE_ALL                           = $00000007;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILATRINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_ATR_PHASE                         = $00000001;  // @paramdefine
+      RIL_PARAM_ATR_SIZE                          = $00000002;  // @paramdefine
+      RIL_PARAM_ATR_ATR                           = $00000004;  // @paramdefine
+      RIL_PARAM_ATR_ALL                           = $00000007;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILSIMTOOLKITNOTIFYCAPS
+//
+// @comm Parameters for LPRILSIMTOOLKITNOTIFYCAPS -> dwParams
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_SIMTKN_REFRESH                    = $00000001; // @paramdefine
+      RIL_PARAM_SIMTKN_MORETIME                   = $00000002; // @paramdefine
+      RIL_PARAM_SIMTKN_POLLINTERVAL               = $00000004; // @paramdefine
+      RIL_PARAM_SIMTKN_POLLINGOFF                 = $00000008; // @paramdefine
+      RIL_PARAM_SIMTKN_SETUPCALL                  = $00000010; // @paramdefine
+      RIL_PARAM_SIMTKN_SENDSS                     = $00000020; // @paramdefine
+      RIL_PARAM_SIMTKN_SENDSMS                    = $00000040; // @paramdefine
+      RIL_PARAM_SIMTKN_PLAYTONE                   = $00000080; // @paramdefine
+      RIL_PARAM_SIMTKN_DISPLAYTEXT                = $00000100; // @paramdefine
+      RIL_PARAM_SIMTKN_GETINKEY                   = $00000200; // @paramdefine
+      RIL_PARAM_SIMTKN_GETINPUT                   = $00000400; // @paramdefine
+      RIL_PARAM_SIMTKN_SELECTITEM                 = $00000800; // @paramdefine
+      RIL_PARAM_SIMTKN_SETUPMENU                  = $00001000; // @paramdefine
+      RIL_PARAM_SIMTKN_LOCALINFO                  = $00002000; // @paramdefine
+      RIL_PARAM_SIMTKN_NOTIFYFLAGS                = $00004000; // @paramdefine
+      RIL_PARAM_SIMTKN_SENDUSSD                   = $00008000; // @paramdefine
+      RIL_PARAM_SIMTKN_SETUPIDLEMODETEXT          = $00010000; // @paramdefine
+      RIL_PARAM_SIMTKN_SETUPEVENTLIST             = $00020000; // @paramdefine
+      RIL_PARAM_SIMTKN_SENDDTMF                   = $00040000; // @paramdefine
+      RIL_PARAM_SIMTKN_LAUNCHBROWSER              = $00080000; // @paramdefine
+      RIL_PARAM_SIMTKN_OPENCHANNEL                = $00100000; // @paramdefine
+      RIL_PARAM_SIMTKN_CLOSECHANNEL               = $00200000; // @paramdefine
+      RIL_PARAM_SIMTKN_RECEIVEDATA                = $00400000; // @paramdefine
+      RIL_PARAM_SIMTKN_SENDDATA                   = $00800000; // @paramdefine
+      RIL_PARAM_SIMTKN_TIMERMANAGEMENT            = $01000000; // @paramdefine
+      RIL_PARAM_SIMTKN_EVENTS                     = $02000000; // @paramdefine
+      RIL_PARAM_SIMTKN_RUNATCMD                   = $04000000; // @paramdefine
+      RIL_PARAM_SIMTKN_ALL                        = $07ffffff; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILSIMTOOLKITEVENTCAPS
+//
+// @comm Parameters for LPRILSIMTOOLKITEVENTCAPS -> dwParams
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_SIMTKE_MTCALL                     = $00000001; // @paramdefine
+      RIL_PARAM_SIMTKE_CALLCONNECTED              = $00000002; // @paramdefine
+      RIL_PARAM_SIMTKE_CALLDISCONNECTED           = $00000004; // @paramdefine
+      RIL_PARAM_SIMTKE_LOCATIONSTATUS             = $00000008; // @paramdefine
+      RIL_PARAM_SIMTKE_USERACTIVITY               = $00000010; // @paramdefine
+      RIL_PARAM_SIMTKE_IDLESCREEN                 = $00000020; // @paramdefine
+      RIL_PARAM_SIMTKE_LANGUAGESELECTION          = $00000040; // @paramdefine
+      RIL_PARAM_SIMTKE_BROWSERTERMINATION         = $00000080; // @paramdefine
+      RIL_PARAM_SIMTKE_DATAAVAILABLE              = $00000100; // @paramdefine
+      RIL_PARAM_SIMTKE_CHANNELSTATUS              = $00000200; // @paramdefine
+      RIL_PARAM_SIMTKE_DISPLAYCHANGE              = $00000400; // @paramdefine
+      RIL_PARAM_SIMTKE_ALL                        = $000007FF; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILSIMTOOLKITCMD
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_SIMTKIT_CMD_ID                    = $00000001; // @paramdefine
+      RIL_PARAM_SIMTKIT_CMD_TAG                   = $00000002; // @paramdefine
+      RIL_PARAM_SIMTKIT_CMD_TYPE                  = $00000004; // @paramdefine
+      RIL_PARAM_SIMTKIT_CMD_QUALIFIER             = $00000008; // @paramdefine
+      RIL_PARAM_SIMTKIT_CMD_ERROR                 = $00000010; // @paramdefine
+      RIL_PARAM_SIMTKIT_CMD_DETAILS_OFFSET        = $00000020; // @paramdefine
+      RIL_PARAM_SIMTKIT_CMD_DETAILS_SIZE          = $00000040; // @paramdefine
+      RIL_PARAM_SIMTKIT_CMD_ALL                   = $0000007F; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILSIMTOOLKITRSP
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_SIMTKIT_RSP_ID                    = $00000001; // @paramdefine
+      RIL_PARAM_SIMTKIT_RSP_TAG                   = $00000002; // @paramdefine
+      RIL_PARAM_SIMTKIT_RSP_TYPE                  = $00000004; // @paramdefine
+      RIL_PARAM_SIMTKIT_RSP_QUALIFIER             = $00000008; // @paramdefine
+      RIL_PARAM_SIMTKIT_RSP_RESPONSE              = $00000010; // @paramdefine
+      RIL_PARAM_SIMTKIT_RSP_ADDITIONALINFO        = $00000020; // @paramdefine
+      RIL_PARAM_SIMTKIT_RSP_ALL                   = $0000003F; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILSIMCMDPARAMETERS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_SCP_FILEID                        = $00000001; // @paramdefine
+      RIL_PARAM_SCP_PARAM1                        = $00000002; // @paramdefine
+      RIL_PARAM_SCP_PARAM2                        = $00000004; // @paramdefine
+      RIL_PARAM_SCP_PARAM3                        = $00000008; // @paramdefine
+      RIL_PARAM_SCP_ALL                           = $0000000f; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILSIMRESPONSE
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_SR_STATUSWORD1                    = $00000001; // @paramdefine
+      RIL_PARAM_SR_STATUSWORD2                    = $00000002; // @paramdefine
+      RIL_PARAM_SR_RESPONSE                       = $00000004; // @paramdefine
+      RIL_PARAM_SR_ALL                            = $00000007; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILSIMRECORDSTATUS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_SRS_RECORDTYPE                    = $00000001;     // @paramdefine
+      RIL_PARAM_SRS_ITEMCOUNT                     = $00000002;     // @paramdefine
+      RIL_PARAM_SRS_SIZE                          = $00000004;     // @paramdefine
+      RIL_PARAM_SRS_ALL                           = $00000007;     // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCOSTINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CSTI_CCM                          = $00000001; // @paramdefine
+      RIL_PARAM_CSTI_ACM                          = $00000002; // @paramdefine
+      RIL_PARAM_CSTI_MAXACM                       = $00000004; // @paramdefine
+      RIL_PARAM_CSTI_COSTPERUNIT                  = $00000008; // @paramdefine
+      RIL_PARAM_CSTI_CURRENCY                     = $00000010; // @paramdefine
+      RIL_PARAM_CSTI_ALL                          = $0000001f; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILSIGNALQUALITY
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_SQ_SIGNALSTRENGTH                 = $00000001; // @paramdefine
+      RIL_PARAM_SQ_MINSIGNALSTRENGTH              = $00000002; // @paramdefine
+      RIL_PARAM_SQ_MAXSIGNALSTRENGTH              = $00000004; // @paramdefine
+      RIL_PARAM_SQ_BITERRORRATE                   = $00000008; // @paramdefine
+      RIL_PARAM_SQ_LOWSIGNALSTRENGTH              = $00000010; // @paramdefine
+      RIL_PARAM_SQ_HIGHSIGNALSTRENGTH             = $00000020; // @paramdefine
+      RIL_PARAM_SQ_ALL                            = $0000003f; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCELLTOWERINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CTI_MOBILECOUNTRYCODE             = $00000001; // @paramdefine
+      RIL_PARAM_CTI_MOBILENETWORKCODE             = $00000002; // @paramdefine
+      RIL_PARAM_CTI_LOCATIONAREACODE              = $00000004; // @paramdefine
+      RIL_PARAM_CTI_CELLID                        = $00000008; // @paramdefine
+      RIL_PARAM_CTI_BASESTATIONID                 = $00000010; // @paramdefine
+      RIL_PARAM_CTI_BROADCASTCONTROLCHANNEL       = $00000020; // @paramdefine
+      RIL_PARAM_CTI_RXLEVEL                       = $00000040; // @paramdefine
+      RIL_PARAM_CTI_RXLEVELFULL                   = $00000080; // @paramdefine
+      RIL_PARAM_CTI_RXLEVELSUB                    = $00000100; // @paramdefine
+      RIL_PARAM_CTI_RXQUALITY                     = $00000200; // @paramdefine
+      RIL_PARAM_CTI_RXQUALITYFULL                 = $00000400; // @paramdefine
+      RIL_PARAM_CTI_RXQUALITYSUB                  = $00000800; // @paramdefine
+      RIL_PARAM_CTI_IDLETIMESLOT                  = $00001000; // @paramdefine
+      RIL_PARAM_CTI_TIMINGADVANCE                 = $00002000; // @paramdefine
+      RIL_PARAM_CTI_GPRSCELLID                    = $00004000; // @paramdefine
+      RIL_PARAM_CTI_GPRSBASESTATIONID             = $00008000; // @paramdefine
+      RIL_PARAM_CTI_NUMBCCH                       = $00010000; // @paramdefine
+      RIL_PARAM_CTI_NMR                           = $00020000; // @paramdefine
+      RIL_PARAM_CTI_BCCH                          = $00040000; // @paramdefine
+      RIL_PARAM_CTI_ALL                           = $0007ffff; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILEQUIPMENTSTATE
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_EQUIPMENTSTATE_RADIOSUPPORT        = $00000001;  // @paramdefine
+      RIL_PARAM_EQUIPMENTSTATE_EQSTATE             = $00000002;  // @paramdefine
+      RIL_PARAM_EQUIPMENTSTATE_READYSTATE          = $00000004;  // @paramdefine
+      RIL_PARAM_EQUIPMENTSTATE_ALL                 = $00000007;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILREMOTEPARTYINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_RPI_ADDRESS                       = $00000001;  // @paramdefine
+      RIL_PARAM_RPI_SUBADDRESS                    = $00000002;  // @paramdefine
+      RIL_PARAM_RPI_DESCRIPTION                   = $00000004;  // @paramdefine
+      RIL_PARAM_RPI_VALIDITY                      = $00000008;  // @paramdefine
+      RIL_PARAM_RPI_ALL                           = $0000000f;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCALLWAITINGINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CWI_CALLTYPE                      = $00000001;  // @paramdefine
+      RIL_PARAM_CWI_CALLERINFO                    = $00000002;  // @paramdefine
+      RIL_PARAM_CWI_ADDRESSID                     = $00000004;  // @paramdefine
+      RIL_PARAM_CWI_ALL                           = $00000007;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILINTERMEDIATESSINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_INTSS_NOTIFICATIONCODE            = $00000001; // @paramdefine
+      RIL_PARAM_INTSS_CUGINDEX                    = $00000002; // @paramdefine
+      RIL_PARAM_INTSS_ALL                         = $00000003; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILUNSOLICITEDSSINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_UNSSS_NOTIFICATIONCODE            = $00000001; // @paramdefine
+      RIL_PARAM_UNSSS_CUGINDEX                    = $00000002; // @paramdefine
+      RIL_PARAM_UNSSS_ADDRESS                     = $00000004; // @paramdefine
+      RIL_PARAM_UNSSS_SUBADDR                     = $00000008; // @paramdefine
+      RIL_PARAM_UNSSS_ALL                         = $0000000f; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILRINGINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_RI_CALLTYPE                       = $00000001;  // @paramdefine
+      RIL_PARAM_RI_SERVICEINFO                    = $00000002;  // @paramdefine
+      RIL_PARAM_RI_ADDRESSID                      = $00000004;  // @paramdefine
+      RIL_PARAM_RI_ALL                            = $00000007;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILDIALINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_DI_CMDID                          = $00000001;  // @paramdefine
+      RIL_PARAM_DI_CALLID                         = $00000002;  // @paramdefine
+      RIL_PARAM_DI_ALL                            = $00000003;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCONNECTINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CNI_CALLTYPE                      = $00000001;  // @paramdefine
+      RIL_PARAM_CNI_BAUDRATE                      = $00000002;  // @paramdefine
+      RIL_PARAM_CNI_ALL                           = $00000003;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILSERVICEINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_SVCI_SYNCHRONOUS                  = $00000001;  // @paramdefine
+      RIL_PARAM_SVCI_TRANSPARENT                  = $00000002;  // @paramdefine
+      RIL_PARAM_SVCI_ALL                          = $00000003;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILMSGSTORAGEINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_MSTI_READLOCATION                 = $00000001;  // @paramdefine
+      RIL_PARAM_MSTI_WRITELOCATION                = $00000002;  // @paramdefine
+      RIL_PARAM_MSTI_STORELOCATION                = $00000004;  // @paramdefine
+      RIL_PARAM_MSTI_ALL                          = $00000007;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILSUPSERVICEDATA
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_SSDI_STATUS                       = $00000001;  // @paramdefine
+      RIL_PARAM_SSDI_DATA                         = $00000002;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCAPSDIAL
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CD_CALLTYPES                      = $00000001;  // @paramdefine
+      RIL_PARAM_CD_OPTIONS                        = $00000002;  // @paramdefine
+      RIL_PARAM_CD_ALL                            = $00000003;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCAPSBEARERSVC
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CBS_SPEEDS1                       = $00000001;  // @paramdefine
+      RIL_PARAM_CBS_SPEEDS2                       = $00000002;  // @paramdefine
+      RIL_PARAM_CBS_SERVICENAMES                  = $00000004;  // @paramdefine
+      RIL_PARAM_CBS_CONNECTIONELEMENTS            = $00000008;  // @paramdefine
+      RIL_PARAM_CBS_ALL                           = $0000000f;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCAPSRLP
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CRLP_VERSION                      = $00000001;  // @paramdefine
+      RIL_PARAM_CRLP_IWSRANGE                     = $00000002;  // @paramdefine
+      RIL_PARAM_CRLP_MWSRANGE                     = $00000004;  // @paramdefine
+      RIL_PARAM_CRLP_ACKTIMERRANGE                = $00000008;  // @paramdefine
+      RIL_PARAM_CRLP_RETRANSMISSIONATTSRANGE      = $00000010;  // @paramdefine
+      RIL_PARAM_CRLP_RESEQPERIODRANGE             = $00000020;  // @paramdefine
+      RIL_PARAM_CRLP_ALL                          = $0000003f;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCAPSMSGMEMORYLOCATIONS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CMML_READLOCATIONS                = $00000001;  // @paramdefine
+      RIL_PARAM_CMML_WRITELOCATIONS               = $00000002;  // @paramdefine
+      RIL_PARAM_CMML_STORELOCATIONS               = $00000004;  // @paramdefine
+      RIL_PARAM_CMML_ALL                          = $00000007;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCAPSLOCKINGPWDLENGTH
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CLPL_FACILITY                     = $00000001;  // @paramdefine
+      RIL_PARAM_CLPL_PASSWORDLENGTH               = $00000002;  // @paramdefine
+      RIL_PARAM_CLPL_ALL                          = $00000003;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCAPSBARRINGPWDLENGTH
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CBPL_TYPE                         = $00000001;  // @paramdefine
+      RIL_PARAM_CBPL_PASSWORDLENGTH               = $00000002;  // @paramdefine
+      RIL_PARAM_CBPL_ALL                          = $00000003;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCAPSDATACOMPRESSION
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CDC_DIRECTION                     = $00000001;  // @paramdefine
+      RIL_PARAM_CDC_NEGOTIATION                   = $00000002;  // @paramdefine
+      RIL_PARAM_CDC_MAXDICT                       = $00000004;  // @paramdefine
+      RIL_PARAM_CDC_MAXSTRING                     = $00000008;  // @paramdefine
+      RIL_PARAM_CDC_ALL                           = $0000000f;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCAPSERRORCORRECTION
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CEC_ORIGINALREQUEST               = $00000001;  // @paramdefine
+      RIL_PARAM_CEC_ORIGINALFALLBACK              = $00000002;  // @paramdefine
+      RIL_PARAM_CEC_ANSWERERFALLBACK              = $00000004;  // @paramdefine
+      RIL_PARAM_CEC_ALL                           = $00000007;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCAPSHSCSD
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CHSCSD_MULTISLOTCLASS             = $00000001;  // @paramdefine
+      RIL_PARAM_CHSCSD_MAXRXTIMESLOTS             = $00000002;  // @paramdefine
+      RIL_PARAM_CHSCSD_MAXTXTIMESLOTS             = $00000004;  // @paramdefine
+      RIL_PARAM_CHSCSD_MAXTOTALTIMESLOTS          = $00000008;  // @paramdefine
+      RIL_PARAM_CHSCSD_CHANNELCODINGS             = $00000010;  // @paramdefine
+      RIL_PARAM_CHSCSD_AIRINTERFACEUSERRATES      = $00000020;  // @paramdefine
+      RIL_PARAM_CHSCSD_TOPRXTIMESLOTRANGE         = $00000040;  // @paramdefine
+      RIL_PARAM_CHSCSD_ALL                        = $0000007f;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILCAPSPBENTRYLENGTH
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_CPBEL_MAXADDRESSLENGTH            = $00000001;  // @paramdefine
+      RIL_PARAM_CPBEL_MAXTEXTLENGTH               = $00000002;  // @paramdefine
+      RIL_PARAM_CPBEL_ALL                         = $00000003;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILGPRSCONTEXT
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_GCONT_CONTEXTID                   = $00000001;  // @paramdefine
+      RIL_PARAM_GCONT_PROTOCOLTYPE                = $00000002;  // @paramdefine
+      RIL_PARAM_GCONT_ACCESSPOINTNAME             = $00000004;  // @paramdefine
+      RIL_PARAM_GCONT_ADDRESS                     = $00000008;  // @paramdefine
+      RIL_PARAM_GCONT_DATACOMPRESSION             = $00000010;  // @paramdefine
+      RIL_PARAM_GCONT_HEADERCOMPRESSION           = $00000020;  // @paramdefine
+      RIL_PARAM_GCONT_PARAMETERLENGTH             = $00000040;  // @paramdefine
+      RIL_PARAM_GCONT_PARAMETERS                  = $00000080;  // @paramdefine
+      RIL_PARAM_GCONT_ALL                         = $000000ff;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILGPRSQOSPROFILE
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_GQOSP_CONTEXTID                   = $00000001;  // @paramdefine
+      RIL_PARAM_GQOSP_PRECEDENCECLASS             = $00000002;  // @paramdefine
+      RIL_PARAM_GQOSP_DELAYCLASS                  = $00000004;  // @paramdefine
+      RIL_PARAM_GQOSP_RELIABILITYCLASS            = $00000008;  // @paramdefine
+      RIL_PARAM_GQOSP_PEAKTHRUCLASS               = $00000010;  // @paramdefine
+      RIL_PARAM_GQOSP_MEANTHRUCLASS               = $00000020;  // @paramdefine
+      RIL_PARAM_GQOSP_ALL                         = $0000003F;  // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILNITZINFO
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_NITZ_SYSTEMTIME                    = $00000001; // @paramdefine
+      RIL_PARAM_NITZ_TIMEZONEOFFSET                = $00000002; // @paramdefine
+      RIL_PARAM_NITZ_DAYLIGHTSAVINGOFFSET          = $00000004; // @paramdefine
+
+//
+// Other constants
+//
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants RILNDISSTATUS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_NDIS_XON  = BOOL(true);
+      RIL_NDIS_XOFF = BOOL(false);
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants RILGPRSCONTEXTACTIVATED
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_RILGPRSCONTEXTACTIVATED_NWDEACT           = $00000001;  // @constdefine
+      RIL_RILGPRSCONTEXTACTIVATED_NWDETACH          = $00000002;  // @constdefine
+      RIL_RILGPRSCONTEXTACTIVATED_MEDEACT           = $00000003;  // @constdefine
+      RIL_RILGPRSCONTEXTACTIVATED_MEDETACH          = $00000004;  // @constdefine
+      RIL_RILGPRSCONTEXTACTIVATED_MEACT             = $00000005;  // @constdefine
+      RIL_RILGPRSCONTEXTACTIVATED_RADIOOFF          = $00000006;  // @constdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Address Type | Different phone number representations
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_ADDRTYPE_UNKNOWN                        = $00000000;  // @constdefine Unknown type
+      RIL_ADDRTYPE_INTERNATIONAL                  = $00000001;  // @constdefine International number
+      RIL_ADDRTYPE_NATIONAL                       = $00000002;  // @constdefine National number
+      RIL_ADDRTYPE_NETWKSPECIFIC                  = $00000003;  // @constdefine Network specific number
+      RIL_ADDRTYPE_SUBSCRIBER                     = $00000004;  // @constdefine Subscriber number (protocol-specific)
+      RIL_ADDRTYPE_ALPHANUM                       = $00000005;  // @constdefine Alphanumeric address
+      RIL_ADDRTYPE_ABBREV                         = $00000006;  // @constdefine Abbreviated number
+// additional CDMA ADDRTYPE definitions
+// See IS-2000.5-A-1 page 509 table 2.7.1.3.2.4-2
+      RIL_ADDRTYPE_IP                             = $00000007;      // @constdefine IP Address (RFC 791)
+      RIL_ADDRTYPE_EMAIL                          = $00000008;      // @constdefine Internet Email addresss (RFC 822)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Numbering Plan | Different numbering shcemes
+//
+// @comm Used for <def RIL_ADDRTYPE_UNKNOWN>, <def RIL_ADDRTYPE_INTERNATIONAL>,
+//       and <def RIL_ADDRTYPE_NATIONAL>
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_NUMPLAN_UNKNOWN                         = $00000000;  // @constdefine Unknown numbering plan
+      RIL_NUMPLAN_TELEPHONE                       = $00000001;  // @constdefine ISDN/telephone numbering plan (E.164/E.163)
+      RIL_NUMPLAN_DATA                            = $00000002;  // @constdefine Data numbering plan (X.121)
+      RIL_NUMPLAN_TELEX                           = $00000003;  // @constdefine Telex numbering plan
+      RIL_NUMPLAN_NATIONAL                        = $00000004;  // @constdefine National numbering plan
+      RIL_NUMPLAN_PRIVATE                         = $00000005;  // @constdefine Private numbering plan
+      RIL_NUMPLAN_ERMES                           = $00000006;  // @constdefine ERMES numbering plan (ETSI DE/PS 3 01-3)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Subaddress Type | Different subaddress types
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SUBADDRTYPE_NSAP                        = $00000001;  // @constdefine NSAP subaddress (CCITT Recommendation X.213 or ISO 8348 AD2)
+      RIL_SUBADDRTYPE_USER                        = $00000002;  // @constdefine User defined subaddress
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Data Rate | Defines different protocol dependant data rates
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SPEED_UNKNOWN                           = $00000000;  // @constdefine Unknown speed
+      RIL_SPEED_AUTO                              = $00000001;  // @constdefine Automatic selection of speed
+      RIL_SPEED_300_V21                           = $00000002;  // @constdefine 300 bps (V.21)
+      RIL_SPEED_300_V110                          = $00000003;  // @constdefine 300 bps (V.100)
+      RIL_SPEED_1200_V22                          = $00000004;  // @constdefine 1200 bps (V.22)
+      RIL_SPEED_1200_75_V23                       = $00000005;  // @constdefine 1200/75 bps (V.23)
+      RIL_SPEED_1200_V110                         = $00000006;  // @constdefine 1200 bps (V.100)
+      RIL_SPEED_1200_V120                         = $00000007;  // @constdefine 1200 bps (V.120)
+      RIL_SPEED_2400_V22BIS                       = $00000008;  // @constdefine 2400 bps (V.22bis)
+      RIL_SPEED_2400_V26TER                       = $00000009;  // @constdefine 2400 bps (V.26ter)
+      RIL_SPEED_2400_V110                         = $0000000a;  // @constdefine 2400 bps (V.110 or X.31 flag stuffing)
+      RIL_SPEED_2400_V120                         = $0000000b;  // @constdefine 2400 bps (V.120)
+      RIL_SPEED_4800_V32                          = $0000000c;  // @constdefine 4800 bps (V.32)
+      RIL_SPEED_4800_V110                         = $0000000d;  // @constdefine 4800 bps (V.110 or X.31 flag stuffing)
+      RIL_SPEED_4800_V120                         = $0000000e;  // @constdefine 4800 bps (V.120)
+      RIL_SPEED_9600_V32                          = $0000000f;  // @constdefine 9600 bps (V.32)
+      RIL_SPEED_9600_V34                          = $00000010;  // @constdefine 9600 bps (V.34)
+      RIL_SPEED_9600_V110                         = $00000011;  // @constdefine 9600 bps (V.110 or X.31 flag stuffing)
+      RIL_SPEED_9600_V120                         = $00000012;  // @constdefine 9600 bps (V.120)
+      RIL_SPEED_14400_V34                         = $00000013;  // @constdefine 14400 bps (V.34)
+      RIL_SPEED_14400_V110                        = $00000014;  // @constdefine 14400 bps (V.100 or X.31 flag stuffing)
+      RIL_SPEED_14400_V120                        = $00000015;  // @constdefine 14400 bps (V.120)
+      RIL_SPEED_19200_V34                         = $00000016;  // @constdefine 19200 bps (V.34)
+      RIL_SPEED_19200_V110                        = $00000017;  // @constdefine 19200 bps (V.110 or X.31 flag stuffing)
+      RIL_SPEED_19200_V120                        = $00000018;  // @constdefine 19200 bps (V.120)
+      RIL_SPEED_28800_V34                         = $00000019;  // @constdefine 28800 bps (V.34)
+      RIL_SPEED_28800_V110                        = $0000001a;  // @constdefine 28800 bps (V.110 or X.31 flag stuffing)
+      RIL_SPEED_28800_V120                        = $0000001b;  // @constdefine 28800 bps (V.120)
+      RIL_SPEED_38400_V110                        = $0000001c;  // @constdefine 38400 bps (V.110 or X.31 flag stuffing)
+      RIL_SPEED_38400_V120                        = $0000001d;  // @constdefine 38400 bps (V.120)
+      RIL_SPEED_48000_V110                        = $0000001e;  // @constdefine 48000 bps (V.110 or X.31 flag stuffing)
+      RIL_SPEED_48000_V120                        = $0000001f;  // @constdefine 48000 bps (V.120)
+      RIL_SPEED_56000_V110                        = $00000020;  // @constdefine 56000 bps (V.110 or X.31 flag stuffing)
+      RIL_SPEED_56000_V120                        = $00000021;  // @constdefine 56000 bps (V.120)
+      RIL_SPEED_56000_TRANSP                      = $00000022;  // @constdefine 56000 bps (bit transparent)
+      RIL_SPEED_64000_TRANSP                      = $00000023;  // @constdefine 64000 bps (bit transparent)
+      RIL_SPEED_32000_PIAFS32K                    = $00000024;      // @constdefine 32000 bps (PIAFS32k;
+      RIL_SPEED_64000_PIAFS64K                    = $00000025;      // @constdefine 64000 bps (PIAFS64k;
+      RIL_SPEED_28800_MULTIMEDIA                  = $00000026;      // @constdefine 28800 bps (MultiMedia;
+      RIL_SPEED_32000_MULTIMEDIA                  = $00000027;      // @constdefine 32000 bps (MultiMedia;
+      RIL_SPEED_33600_MULTIMEDIA                  = $00000028;      // @constdefine 33600 bps (MultiMedia;
+      RIL_SPEED_56000_MULTIMEDIA                  = $00000029;      // @constdefine 56000 bps (MultiMedia;
+      RIL_SPEED_64000_MULTIMEDIA                  = $0000002a;      // @constdefine 64000 bps (MultiMedia;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Telephony Service | Telephony service types
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SERVICE_UNKNOWN                         = $00000000;  // @constdefine Unknown service
+      RIL_SERVICE_MODEM_ASYNC                     = $00000001;  // @constdefine Asynchronous modem
+      RIL_SERVICE_MODEM_SYNC                      = $00000002;  // @constdefine Synchronous modem
+      RIL_SERVICE_PADACCESS_ASYNC                 = $00000003;  // @constdefine PAD Access (asynchronous)
+      RIL_SERVICE_PACKETACCESS_SYNC               = $00000004;  // @constdefine Packet Access (synchronous)
+      RIL_SERVICE_VOICE                           = $00000005;  // @constdefine Voice
+      RIL_SERVICE_FAX                             = $00000006;  // @constdefine Fax
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants ITC | Information trasnfer capability types
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_ITC_31KHZ                               = $00000001;  // @constdefine 3.1 kHz
+      RIL_ITC_UDI                                 = $00000002;  // @constdefine Unrestricted Digital Information
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Operator Name | Operator name formats
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_OPFORMAT_LONG                           = $00000001;  // @constdefine Long alphanumeric name
+      RIL_OPFORMAT_SHORT                          = $00000002;  // @constdefine Short alphanumeric name
+      RIL_OPFORMAT_NUM                            = $00000003;  // @constdefine Numeric name
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Operator Status | Operator status values
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_OPSTATUS_UNKNOWN                        = $00000000;  // @constdefine Unknown status
+      RIL_OPSTATUS_AVAILABLE                      = $00000001;  // @constdefine Operator is available
+      RIL_OPSTATUS_CURRENT                        = $00000002;  // @constdefine Operator is current
+      RIL_OPSTATUS_FORBIDDEN                      = $00000003;  // @constdefine Operator is forbidden
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Operator Selection | Operator selection modes
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_OPSELMODE_AUTOMATIC                     = $00000001;  // @constdefine Automatic operator selection
+      RIL_OPSELMODE_MANUAL                        = $00000002;  // @constdefine Manual operator selection
+      RIL_OPSELMODE_MANUALAUTOMATIC               = $00000003;  // @constdefine Manual/automatic operator selection
+                                                                // (if manual selection fails, automatic selection mode is entered)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Operator Special | Special preferred operator index value
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PREFOPINDEX_FIRSTAVAILABLE              = $ffffffff;  // @constdefine Used to specify that a preferred operator is
+                                                                // to be stored at the first available index
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Information Class | Telephony information classes
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_INFOCLASS_NONE                          = $00000000;  // @constdefine None
+      RIL_INFOCLASS_VOICE                         = $00000001;  // @constdefine Voice
+      RIL_INFOCLASS_DATA                          = $00000002;  // @constdefine Data
+      RIL_INFOCLASS_FAX                           = $00000004;  // @constdefine Fax
+      RIL_INFOCLASS_SMS                           = $00000008;  // @constdefine SMS
+      RIL_INFOCLASS_DATACIRCUITSYNC               = $00000010;  // @constdefine Data Circuit synchronous
+      RIL_INFOCLASS_DATACIRCUITASYNC              = $00000020;  // @constdefine Data Circuit asynchronous
+      RIL_INFOCLASS_PACKETACCESS                  = $00000040;  // @constdefine Dedicated Packet Access
+      RIL_INFOCLASS_PADACCESS                     = $00000080;  // @constdefine Dedicated PAD Access
+      RIL_INFOCLASS_ALL                           = $000000ff;  // @constdefine All information classes
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Supplemental Activation | Supplementary service status values
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SVCSTAT_UNKNOWN                         = $00000000;  // @constdefine Unknown status
+      RIL_SVCSTAT_DISABLED                        = $00000001;  // @constdefine Service is disabled
+      RIL_SVCSTAT_ENABLED                         = $00000002;  // @constdefine Service is enabled
+      RIL_SVCSTAT_DEFAULT                         = $00000003;  // @constdefine Default status
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Supplementary Service Provisioning | Supplementary service provisioning values
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SVCPROV_UNKNOWN                         = $00000000;  // @constdefine Unknown provisioning
+      RIL_SVCPROV_NOTPROVISIONED                  = $00000001;  // @constdefine Service isn't provisioned
+      RIL_SVCPROV_PROVISIONED                     = $00000002;  // @constdefine Service is provisioned
+      RIL_SVCPROV_TEMPMODERESTRICTED              = $00000003;  // @constdefine Service temporary mode is restricted
+      RIL_SVCPROV_TEMPMODEALLOWED                 = $00000004;  // @constdefine Service temporary mode is allowed
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants CUG Special | Closed User Group special index value
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CUGINDEX_NONE                           = $ffffffff;  // @constdefine Used to identify the absence of CUG index
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants CUG Info Level | Closed User Group information levels
+//
+// @comm This feature is not used and is untested.
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CUGINFO_NONE                            = $00000000;  // @constdefine TBD
+      RIL_CUGINFO_SUPPRESSOA                      = $00000001;  // @constdefine TBD
+      RIL_CUGINFO_SUPRESSPREF                     = $00000002;  // @constdefine TBD
+      RIL_CUGINFO_SUPPRESSOAANDPREF               = $00000003;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Forwarding Reason | Forwarding reasons
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_FWDREASON_UNCONDITIONAL                 = $00000001;  // @constdefine Always forward
+      RIL_FWDREASON_MOBILEBUSY                    = $00000002;  // @constdefine Forward when device busy
+      RIL_FWDREASON_NOREPLY                       = $00000003;  // @constdefine Forward when no answer
+      RIL_FWDREASON_UNREACHABLE                   = $00000004;  // @constdefine Forward device out of service
+      RIL_FWDREASON_ALLFORWARDING                 = $00000005;  // @constdefine TBD
+      RIL_FWDREASON_ALLCONDITIONAL                = $00000006;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Call Type | Call types
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CALLTYPE_UNKNOWN                        = $00000000;  // @constdefine Unknown
+      RIL_CALLTYPE_VOICE                          = $00000001;  // @constdefine Voice call
+      RIL_CALLTYPE_DATA                           = $00000002;  // @constdefine Data call
+      RIL_CALLTYPE_FAX                            = $00000003;  // @constdefine Fax call
+      RIL_CALLTYPE_PTT                            = $00000004;  // @constdefine Push-To-Talk call
+      RIL_CALLTYPE_VT                             = $00000005;  // @constdefine Video Telephony call
+      RIL_CALLTYPE_LAST                           = RIL_CALLTYPE_VT; // @constdefine last valid call
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Dialing Option | Dialing options
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_DIALOPT_NONE                            = $00000000;  // @constdefine No options
+      RIL_DIALOPT_RESTRICTID                      = $00000001;  // @constdefine Restrict CLI presentation
+      RIL_DIALOPT_PRESENTID                       = $00000002;  // @constdefine Allow CLI presentation
+      RIL_DIALOPT_CLOSEDGROUP                     = $00000004;  // @constdefine Closed User Group dialing
+      RIL_DIALOPT_ALL                             = $00000007;  // @constdefine All options
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Call Option | Call options defaults
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_DIALTONEWAIT_DEFAULT                    = $00000000;  // @constdefine TBD
+      RIL_DIALTIMEOUT_DEFAULT                     = $00000000;  // @constdefine TBD
+      RIL_COMMAPAUSE_DEFAULT                      = $00000000;  // @constdefine TBD
+      RIL_DISCONNECTTIMEOUT_DEFAULT               = $00000000;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants DTMF Duration | DTMF tone duration default
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_DTMFDURATION_DEFAULT                    = $00000000;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Number of Calls to Track | Number of Calls to Track
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MAX_TRACKED_CALL_ID             = 10;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Call Direction | Call direction
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CALLDIR_INCOMING                        = $00000001;  // @constdefine Incoming call
+      RIL_CALLDIR_OUTGOING                        = $00000002;  // @constdefine Outgoing call
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Call Status | Call status values
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CALLSTAT_ACTIVE                         = $00000001;  // @constdefine Active call
+      RIL_CALLSTAT_ONHOLD                         = $00000002;  // @constdefine Call on hold
+      RIL_CALLSTAT_DIALING                        = $00000003;  // @constdefine In the process of dialing
+      RIL_CALLSTAT_ALERTING                       = $00000004;  // @constdefine In the process of ringing
+      RIL_CALLSTAT_INCOMING                       = $00000005;  // @constdefine Incoming (unanswered) call
+      RIL_CALLSTAT_WAITING                        = $00000006;  // @constdefine Incoming call waiting call
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants CPI Status | CPI status values
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CPISTAT_UNKNOWN                         = $00000000;  // @constdefine
+      RIL_CPISTAT_NEW_OUTGOING                    = $00000001;  // @constdefine
+      RIL_CPISTAT_NEW_INCOMING                    = $00000002;  // @constdefine
+      RIL_CPISTAT_CONNECTED                       = $00000003;  // @constdefine
+      RIL_CPISTAT_DISCONNECTED                    = $00000004;  // @constdefine
+      RIL_CPISTAT_ONHOLD                          = $00000005;  // @constdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Intermediate Supplementary Service | Intermediate Supplementary Service Codes
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_INTSSCODE_UNCONDITIONALCFACTIVE         = $00000000;      // @constdefine Unconditional call forwarding is active
+      RIL_INTSSCODE_SOMECONDITIONALCFACTIVE       = $00000001;      // @constdefine Some of the conditional call forwarding settings are active
+      RIL_INTSSCODE_CALLWASFORWARDED              = $00000002;      // @constdefine Call has been forwarded
+      RIL_INTSSCODE_CALLISWAITING                 = $00000003;      // @constdefine Call is waiting
+      RIL_INTSSCODE_CUGCALL                       = $00000004;      // @constdefine This is a CUG call (also <index> present;
+      RIL_INTSSCODE_OUTGOINGCALLSBARRED           = $00000005;      // @constdefine Outgoing calls are barred
+      RIL_INTSSCODE_INCOMINGCALLSBARRED           = $00000006;      // @constdefine Incoming calls are barred
+      RIL_INTSSCODE_CLIRSUPPRESSREJECT            = $00000007;      // @constdefine CLIR suppression rejected
+      RIL_INTSSCODE_CALLWASDEFLECTED              = $00000008;      // @constdefine Call has been deflected
+
+      RIL_INTSSCODE_MAX                           = RIL_INTSSCODE_CALLWASDEFLECTED;    // @constdefine Maximum valid value
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Unsolicited Supplementary Service | Unsolicited Supplementary Service Codes
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_UNSSSCODE_FORWARDEDCALL                 = $00000000;      // @constdefine This is a forwarded call (MT call setup;
+      RIL_UNSSSCODE_CUGCALL                       = $00000001;      // @constdefine This is a CUG call (also <index> present; (MT call setup;
+      RIL_UNSSSCODE_CALLPUTONHOLD                 = $00000002;      // @constdefine Call has been put on hold (during a voice call;
+      RIL_UNSSSCODE_CALLRETRIEVED                 = $00000003;      // @constdefine Call has been retrieved (during a voice call;
+      RIL_UNSSSCODE_ENTEREDMULTIPARTY             = $00000004;      // @constdefine Multiparty call entered (during a voice call;
+      RIL_UNSSSCODE_HELDCALLRELEASED              = $00000005;      // @constdefine Call on hold has been released (this is not a SS notification; (during a voice call;
+      RIL_UNSSSCODE_FORWARDCHECKSS                = $00000006;      // @constdefine Forward check SS message received (can be received whenever;
+      RIL_UNSSSCODE_ALERTINGEXPLICITCALLXFER      = $00000007;      // @constdefine Call is being connected (alerting; with the remote party in alerting state in explicit call transfer operation (during a voice call;
+      RIL_UNSSSCODE_CONNECTEDEXPLICITCALLXFER     = $00000008;      // @constdefine Call has been connected with the other remote party in explicit call transfer operation (also number and subaddress parameters may be present; (during a voice call or MT call setup;
+      RIL_UNSSSCODE_DEFLECTEDCALL                 = $00000009;      // @constdefine This is a deflected call (MT call setup;
+      RIL_UNSSSCODE_ADDITIONALINCOMINGCF          = $0000000a;      // @constdefine Additional incoming call forwarded
+
+      RIL_UNSSSCODE_MAX                           = RIL_UNSSSCODE_ADDITIONALINCOMINGCF; // @constdefine Maximum valid value
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Call Multiparty | Call multiparty status values
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CALL_SINGLEPARTY                        = $00000000;  // @constdefine Not in a conference
+      RIL_CALL_MULTIPARTY                         = $00000001;  // @constdefine Participating in a conference
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Call Management | Call management commands
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CALLCMD_RELEASEHELD                     = $00000001;  // @constdefine Release all held calls, send "busy" to waiting call
+      RIL_CALLCMD_RELEASEACTIVE_ACCEPTHELD        = $00000002;  // @constdefine Release all active calls, accept waiting/held call
+      RIL_CALLCMD_RELEASECALL                     = $00000003;  // @constdefine Release the specified call
+      RIL_CALLCMD_HOLDACTIVE_ACCEPTHELD           = $00000004;  // @constdefine Hold all active calls, accept waiting/held call
+      RIL_CALLCMD_HOLDALLBUTONE                   = $00000005;  // @constdefine Hold all active calls, except for the specified call
+      RIL_CALLCMD_ADDHELDTOCONF                   = $00000006;  // @constdefine Add all held calls to a conference
+      RIL_CALLCMD_ADDHELDTOCONF_DISCONNECT        = $00000007;  // @constdefine Connect held calls to a conference, disconnect the user
+      RIL_CALLCMD_INVOKECCBS                      = $00000008;  // @constdefine Invokes completion of calls to busy subscribers
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Line Status | Line status values
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_LINESTAT_UNKNOWN                        = $00000000;  // @constdefine Unknown
+      RIL_LINESTAT_READY                          = $00000001;  // @constdefine Line is ready
+      RIL_LINESTAT_UNAVAILABLE                    = $00000002;  // @constdefine Line is unavailable
+      RIL_LINESTAT_RINGING                        = $00000003;  // @constdefine Incoming call on the line
+      RIL_LINESTAT_CALLINPROGRESS                 = $00000004;  // @constdefine Call in progress
+      RIL_LINESTAT_ASLEEP                         = $00000005;  // @constdefine Line is asleep
+      RIL_LINESTAT_CONNECTING                     = $00000006;  // @constdefine The phone is connecting to a call, but the call is not in progress yet
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Line Registration | Line registration status values
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_REGSTAT_UNKNOWN                         = $00000000;  // @constdefine Registration unknown
+      RIL_REGSTAT_UNREGISTERED                    = $00000001;  // @constdefine Unregistered
+      RIL_REGSTAT_HOME                            = $00000002;  // @constdefine Registered on home network
+      RIL_REGSTAT_ATTEMPTING                      = $00000003;  // @constdefine Attempting to register
+      RIL_REGSTAT_DENIED                          = $00000004;  // @constdefine Registration denied
+      RIL_REGSTAT_ROAMING                         = $00000005;  // @constdefine Registered on roaming network
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Audio Device | Audio devices
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_AUDIO_NONE                              = $00000000;  // @constdefine No audio devices
+      RIL_AUDIO_HANDSET                           = $00000001;  // @constdefine Handset
+      RIL_AUDIO_SPEAKERPHONE                      = $00000002;  // @constdefine Speakerphone
+      RIL_AUDIO_HEADSET                           = $00000003;  // @constdefine Headset
+      RIL_AUDIO_CARKIT                            = $00000004;  // @constdefine Carkit
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants HSCSD Traffic Channel | HSCSD traffic channel codings
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_HSCSDCODING_UNKNOWN                     = $00000000;  // @constdefine Unknown channel coding
+      RIL_HSCSDCODING_4800_FULLRATE               = $00000001;  // @constdefine 4800 bits per second
+      RIL_HSCSDCODING_9600_FULLRATE               = $00000002;  // @constdefine 9600 bits per second
+      RIL_HSCSDCODING_14400_FULLRATE              = $00000004;  // @constdefine 14400 bits per second
+      RIL_HSCSDCODING_ALL                         = $00000007;  // @constdefine All channel codings valid
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants HSCSD Air Interface | HSCSD air interface user rates
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_HSCSDAIURATE_UNKNOWN                    = $00000000;  // @constdefine Air interface rate
+      RIL_HSCSDAIURATE_9600                       = $00000001;  // @constdefine 9600 bits per second
+      RIL_HSCSDAIURATE_14400                      = $00000002;  // @constdefine 14400 bits per second
+      RIL_HSCSDAIURATE_19200                      = $00000003;  // @constdefine 19200 bits per second
+      RIL_HSCSDAIURATE_28800                      = $00000004;  // @constdefine 28800 bits per second
+      RIL_HSCSDAIURATE_38400                      = $00000005;  // @constdefine 38400 bits per second
+      RIL_HSCSDAIURATE_43200                      = $00000006;  // @constdefine 43200 bits per second
+      RIL_HSCSDAIURATE_57600                      = $00000007;  // @constdefine 57600 bits per second
+      RIL_HSCSDAIURATE_DEFAULT                    = $ffffffff;  // @constdefine A special value that indicates the radio stack
+                                                                    //    should calculate the appropriate number of
+                                                                    //    receive timeslots based on other paramaters
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants HSCSD Special | Special HSCSD receive timeslots value
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_HSCSDTIMESLOTS_DEFAULT                  = $00000000;  // @constdefine Indicates that the radio stack should
+                                                                // calculate apropriate number of timeslots
+      RIL_HSCSDTIMESLOTSLIMIT_NONE                = $00000000;  // @constdefine Indicates that number of receive numeslots will not
+                                                                //    be altered during the next non-transparent HSCSD call
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Data Compression | Data compression directions
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_DATACOMPDIR_NONE                        = $00000001;  // @constdefine No data compression
+      RIL_DATACOMPDIR_TRANSMIT                    = $00000002;  // @constdefine Data compession when sending
+      RIL_DATACOMPDIR_RECEIVE                     = $00000004;  // @constdefine Data compession when receiving
+      RIL_DATACOMPDIR_BOTH                        = $00000008;  // @constdefine Bi-directional data compession
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Data Compression Negotiation | Data compression negotiation options
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_DATACOMP_OPTIONAL                       = $00000001;  // @constdefine Data compression optional
+      RIL_DATACOMP_REQUIRED                       = $00000002;  // @constdefine Terminal will disconnect if no negotiation
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Error Correction | Error correction modes
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_ECMODE_UNKNOWN                          = $00000000;  // @constdefine TBD
+      RIL_ECMODE_DIRECT                           = $00000001;  // @constdefine TBD
+      RIL_ECMODE_BUFFERED                         = $00000002;  // @constdefine TBD
+      RIL_ECMODE_NODETECT                         = $00000004;  // @constdefine TBD
+      RIL_ECMODE_DETECT                           = $00000008;  // @constdefine TBD
+      RIL_ECMODE_ALTERNATIVE                      = $00000010;  // @constdefine TBD
+      RIL_ECMODE_OPTIONAL_USEBUFFERED             = $00000020;  // @constdefine TBD
+      RIL_ECMODE_OPTIONAL_USEDIRECT               = $00000040;  // @constdefine TBD
+      RIL_ECMODE_REQUIRED                         = $00000080;  // @constdefine TBD
+      RIL_ECMODE_REQUIRED_LAPMONLY                = $00000100;  // @constdefine TBD
+      RIL_ECMODE_REQUIRED_ALTERNATIVEONLY         = $00000200;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Bearer Service | Bearer service names
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_BSVCNAME_UNKNOWN                        = $00000000;  // @constdefine TBD
+      RIL_BSVCNAME_DATACIRCUIT_ASYNC_UDI_MODEM    = $00000001;  // @constdefine TBD
+      RIL_BSVCNAME_DATACIRCUIT_SYNC_UDI_MODEM     = $00000002;  // @constdefine TBD
+      RIL_BSVCNAME_PADACCESS_ASYNC_UDI            = $00000003;  // @constdefine TBD
+      RIL_BSVCNAME_PACKETACCESS_SYNC_UDI          = $00000004;  // @constdefine TBD
+      RIL_BSVCNAME_DATACIRCUIT_ASYNC_RDI          = $00000005;  // @constdefine TBD
+      RIL_BSVCNAME_DATACIRCUIT_SYNC_RDI           = $00000006;  // @constdefine TBD
+      RIL_BSVCNAME_PADACCESS_ASYNC_RDI            = $00000007;  // @constdefine TBD
+      RIL_BSVCNAME_PACKETACCESS_SYNC_RDI          = $00000008;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Bearer Service CE | Bearer service connection elements
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_BSVCCE_UNKNOWN                          = $00000000;  // @constdefine Bearer service unknown
+      RIL_BSVCCE_TRANSPARENT                      = $00000001;  // @constdefine Link layer correction enabled
+      RIL_BSVCCE_NONTRANSPARENT                   = $00000002;  // @constdefine No link layer correction present
+      RIL_BSVCCE_BOTH_TRANSPARENT                 = $00000003;  // @constdefine Both available, transparent preferred
+      RIL_BSVCCE_BOTH_NONTRANSPARENT              = $00000004;  // @constdefine Both available, non-transparent preferred
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Service | Messaging service types
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MSGSVCTYPE_UNKNOWN                      = $00000000;  // @constdefine Unknown
+      RIL_MSGSVCTYPE_PHASE2                       = $00000001;  // @constdefine GSM 07.05 Phase 2 ver. 4.7.0 messaging service
+      RIL_MSGSVCTYPE_PHASE2PLUS                   = $00000002;  // @constdefine GSM 07.05 Pahse 2+ messaging service
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Storage | Message storage locations
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MSGLOC_UNKNOWN                          = $00000000;  // @constdefine Unknown
+      RIL_MSGLOC_BROADCAST                        = $00000001;  // @constdefine Broadcast message storage location
+      RIL_MSGLOC_SIM                              = $00000002;  // @constdefine SIM storage location
+      RIL_MSGLOC_STATUSREPORT                     = $00000003;  // @constdefine Status report storage location
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants IS637 Teleservices | Message Teleservice types
+//
+// @comm TIA/EIA-41-D Supported Teleservices
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MSGTELESERVICE_PAGING                   = $00000001;    // @constdefine Wireless Paging Teleservice      CPT-95  //@ Only callback number
+      RIL_MSGTELESERVICE_MESSAGING                = $00000002;    // @constdefine Wireless Messaging Teleservice   CMT-95  //@ Text Message
+      RIL_MSGTELESERVICE_VOICEMAIL                = $00000003;    // @constdefine Voice Mail Notification          VMN-95  //@ Voice Mail
+      RIL_MSGTELESERVICE_WAP                      = $00000004;    // @constdefine Wireless Application Protocol    WAP     //@ To be investigated (Test message??)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Privacy Class | Message Privacy types
+//
+// @comm IS-637 Message Privacy Classes
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MSGPRIVACYCLASS_NOTRESTRICTED           = $00000001; // @constdefine Not restricted (Level 0)
+      RIL_MSGPRIVACYCLASS_RESTRICTED              = $00000002; // @constdefine Restricted (Level 1)
+      RIL_MSGPRIVACYCLASS_CONFIDENTIAL            = $00000003; // @constdefine Confidential (Level 2)
+      RIL_MSGPRIVACYCLASS_SECRET                  = $00000004; // @constdefine Secret (Level 3)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Priority Class | Message Priority types
+//
+// @comm IS-637 Message Priority Classes
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MSGPRIORITY_NORMAL                      = $00000001;    // @constdefine Message Urgency Normal
+      RIL_MSGPRIORITY_HIGH                        = $00000002;    // @constdefine Message Urgency Interactive (S N/A)
+      RIL_MSGPRIORITY_URGENT                      = $00000003;    // @constdefine Message Urgency Urgent
+      RIL_MSGPRIORITY_EMERGENCY                   = $00000004;    // @constdefine Message Urgency Emergency (S N/A)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Status Message Class | Message Statustypes
+//
+// @comm IS-637 Message Priority Classes
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MSGSTATUSTYPE_BEARERACK                 = $00000001;    // @constdefine The Acknowledgement Message is a Bearer Ack
+      RIL_MSGSTATUSTYPE_DELIVERYACK               = $00000002;    // @constdefine The Acknowledgement Message is a Delivery Ack
+      RIL_MSGSTATUSTYPE_USERACK                   = $00000003;    // @constdefine The Acknowledgement Message is a User Ack
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Display Modes | Message Display Modes
+//
+// @comm Message Display Modes - Determines if the message is shown immediately or in the inbox (Ask Carrier if this feature is implemented)
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MSGDISPLAYMODE_IMMEDIATE                = $00000001;    // @constdefine The message must be show immediately.
+//In the UI, Mobile Default and User Default should be treated as the same.
+      RIL_MSGDISPLAYMODE_MOBILEDEFAULT            = $00000002;    // @constdefine The message is to be displayed depending on a predefined mobile setting.
+      RIL_MSGDISPLAYMODE_USERDEFAULT              = $00000003;    // @constdefine The message is to be displayed depending on the user's mode.
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Encoding | Message Encoding types
+//
+// @comm Message Encoding - Determines the format of the incoming message body
+//
+// -----------------------------------------------------------------------------
+const
+//Analog Only -      RIL_MSGCODING_IS91EPP                       = $00000001;    // @constdefine IS-91 Character Format
+      RIL_MSGCODING_7BITASCII                     = $00000002;    // @constdefine This the the verizon default
+      RIL_MSGCODING_UNICODE                       = $00000003;    // @constdefine Unicode (double byte) format
+      RIL_MSGCODING_7BITGSM                       = $00000004;    // @constdefine 7-bit GSM Alphabet
+      RIL_MSGCODING_8BITGSM                       = $00000005;    // @constdefine 8-bit GSM Alphabet
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message DCS | Message data coding scheme types
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_DCSTYPE_GENERAL                         = $00000001;  // @constdefine TBD
+      RIL_DCSTYPE_MSGWAIT                         = $00000002;  // @constdefine TBD
+      RIL_DCSTYPE_MSGCLASS                        = $00000003;  // @constdefine TBD
+      RIL_DCSTYPE_LANGUAGE                        = $00000004;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message DCS Flags | Message data coding scheme flags
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_DCSFLAG_NONE                            = $00000000;  // @constdefine TBD
+      RIL_DCSFLAG_COMPRESSED                      = $00000001;  // @constdefine TBD
+      RIL_DCSFLAG_INDICATIONACTIVE                = $00000002;  // @constdefine TBD
+      RIL_DCSFLAG_DISCARD                         = $00000004;  // @constdefine Only for RIL_DCSTYPE_MSGWAIT
+      RIL_DCSFLAG_ALL                             = $00000007;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message DCS Classes | Message data coding scheme message classes
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_DCSMSGCLASS_0                           = $00000001;  // @constdefine TBD
+      RIL_DCSMSGCLASS_1                           = $00000002;  // @constdefine TBD
+      RIL_DCSMSGCLASS_2                           = $00000003;  // @constdefine TBD
+      RIL_DCSMSGCLASS_3                           = $00000004;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message DCS Alphabets | Message data coding scheme alphabets
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_DCSALPHABET_DEFAULT                     = $00000001;  // @constdefine TBD
+      RIL_DCSALPHABET_8BIT                        = $00000002;  // @constdefine TBD
+      RIL_DCSALPHABET_UCS2                        = $00000003;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message DCS Indication | Message data coding scheme indication types
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_DCSINDICATION_VOICEMAIL                 = $00000001;  // @constdefine Voicemail indication
+      RIL_DCSINDICATION_FAX                       = $00000002;  // @constdefine Fax indication
+      RIL_DCSINDICATION_EMAIL                     = $00000003;  // @constdefine E-Mail indication
+      RIL_DCSINDICATION_OTHER                     = $00000004;  // @constdefine Other indication
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message DCS Broadcast| Message broadcast data coding scheme languages
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_DCSLANG_UNKNOWN                         = $00000001;  // @constdefine TBD
+      RIL_DCSLANG_GERMAN                          = $00000002;  // @constdefine TBD
+      RIL_DCSLANG_ENGLISH                         = $00000004;  // @constdefine TBD
+      RIL_DCSLANG_ITALIAN                         = $00000008;  // @constdefine TBD
+      RIL_DCSLANG_FRENCH                          = $00000010;  // @constdefine TBD
+      RIL_DCSLANG_SPANISH                         = $00000020;  // @constdefine TBD
+      RIL_DCSLANG_DUTCH                           = $00000040;  // @constdefine TBD
+      RIL_DCSLANG_SWEDISH                         = $00000080;  // @constdefine TBD
+      RIL_DCSLANG_DANISH                          = $00000100;  // @constdefine TBD
+      RIL_DCSLANG_PORTUGUESE                      = $00000200;  // @constdefine TBD
+      RIL_DCSLANG_FINNISH                         = $00000400;  // @constdefine TBD
+      RIL_DCSLANG_NORWEGIAN                       = $00000800;  // @constdefine TBD
+      RIL_DCSLANG_GREEK                           = $00001000;  // @constdefine TBD
+      RIL_DCSLANG_TURKISH                         = $00002000;  // @constdefine TBD
+      RIL_DCSLANG_HUNGARIAN                       = $00004000;  // @constdefine TBD
+      RIL_DCSLANG_POLISH                          = $00008000;  // @constdefine TBD
+      RIL_DCSLANG_CZECH                           = $00010000;  // @constdefine TBD
+      RIL_DCSLANG_HEBREW                          = $00020000;  // @constdefine TBD
+      RIL_DCSLANG_ARABIC                          = $00040000;  // @constdefine TBD
+      RIL_DCSLANG_RUSSIAN                         = $00080000;  // @constdefine TBD
+      RIL_DCSLANG_ICELANDIC                       = $00100000;  // @constdefine TBD
+      RIL_DCSLANG_ALL                             = $001fffff;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Class | Message classes
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MSGCLASS_NONE                           = $00000000;  // @constdefine TBD
+      RIL_MSGCLASS_INCOMING                       = $00010000;  // @constdefine TBD
+      RIL_MSGCLASS_OUTGOING                       = $00020000;  // @constdefine TBD
+      RIL_MSGCLASS_BROADCAST                      = $00040000;  // @constdefine TBD
+      RIL_MSGCLASS_ALL                            = $00070000;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Type | Message types
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MSGTYPE_IN_DELIVER                      = $00000001 or RIL_MSGCLASS_INCOMING;  // @constdefine Incoming message
+      RIL_MSGTYPE_IN_STATUS                       = $00000002 or RIL_MSGCLASS_INCOMING;  // @constdefine Incoming status message
+      RIL_MSGTYPE_OUT_SUBMIT                      = $00000001 or RIL_MSGCLASS_OUTGOING;  // @constdefine Outgoing message
+      RIL_MSGTYPE_OUT_COMMAND                     = $00000002 or RIL_MSGCLASS_OUTGOING;  // @constdefine Outgoing command message
+      RIL_MSGTYPE_OUT_RAW                         = $00000004 or RIL_MSGCLASS_OUTGOING;
+      RIL_MSGTYPE_BC_GENERAL                      = $00000001 or RIL_MSGCLASS_BROADCAST;  // @constdefine Broadcast message (incoming only)
+
+// Macro to extract message class from message type
+function MSGCLASS_FROM_MSGTYPE(itype:ULONG):ULONG; inline;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Flag | Message flags
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MSGFLAG_NONE                            = $00000000;  // @constdefine None
+      RIL_MSGFLAG_MORETOSEND                      = $00000001;  // @constdefine More messages to send (valid for <def RIL_MSGTYPE_IN_DELIVER> and <def RIL_MSGTYPE_IN_STATUS>)
+      RIL_MSGFLAG_REPLYPATH                       = $00000002;  // @constdefine Message contains a reply path  (valid for <def RIL_MSGTYPE_IN_DELIVER> and <def RIL_MSGTYPE_OUT_SUBMIT>)
+      RIL_MSGFLAG_HEADER                          = $00000004;  // @constdefine TBD (valid for <def RIL_MSGTYPE_IN_DELIVER>, <def RIL_MSGTYPE_OUT_SUBMIT>,
+                                                                      //    <def RIL_MSGTYPE_IN_STATUS>, and <def RIL_MSGTYPE_OUT_COMMAND>)
+      RIL_MSGFLAG_REJECTDUPS                      = $00000008;  // @constdefine TBD (valid for <def RIL_MSGTYPE_OUT_SUBMIT> only)
+      RIL_MSGFLAG_STATUSREPORTRETURNED            = $00000010;  // @constdefine (valid for <def RIL_MSGTYPE_IN_DELIVER> only)
+      RIL_MSGFLAG_STATUSREPORTREQUESTED           = $00000020;  // @constdefine (valid for <def RIL_MSGTYPE_OUT_SUBMIT> and <def RIL_MSGTYPE_OUT_COMMAND>)
+      RIL_MSGFLAG_CAUSEDBYCOMMAND                 = $00000040;  // @constdefine (valid for <def RIL_MSGTYPE_IN_STATUS> only)
+      RIL_MSGFLAG_ALL                             = $0000007f;  // @constdefine All flags are on
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Protocol | Message protocol IDs
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MSGPROTOCOL_UNKNOWN                     = $00000000;  // @constdefine TBD
+      RIL_MSGPROTOCOL_SMETOSME                    = $00000001;  // @constdefine TBD
+      RIL_MSGPROTOCOL_IMPLICIT                    = $00000002;  // @constdefine TBD
+      RIL_MSGPROTOCOL_TELEX                       = $00000003;  // @constdefine TBD
+      RIL_MSGPROTOCOL_TELEFAX_GROUP3              = $00000004;  // @constdefine TBD
+      RIL_MSGPROTOCOL_TELEFAX_GROUP4              = $00000005;  // @constdefine TBD
+      RIL_MSGPROTOCOL_VOICEPHONE                  = $00000006;  // @constdefine TBD
+      RIL_MSGPROTOCOL_ERMES                       = $00000007;  // @constdefine TBD
+      RIL_MSGPROTOCOL_PAGING                      = $00000008;  // @constdefine TBD
+      RIL_MSGPROTOCOL_VIDEOTEX                    = $00000009;  // @constdefine TBD
+      RIL_MSGPROTOCOL_TELETEX                     = $0000000a;  // @constdefine TBD
+      RIL_MSGPROTOCOL_TELETEX_PSPDN               = $0000000b;  // @constdefine TBD
+      RIL_MSGPROTOCOL_TELETEX_CSPDN               = $0000000c;  // @constdefine TBD
+      RIL_MSGPROTOCOL_TELETEX_PSTN                = $0000000d;  // @constdefine TBD
+      RIL_MSGPROTOCOL_TELETEX_ISDN                = $0000000e;  // @constdefine TBD
+      RIL_MSGPROTOCOL_UCI                         = $0000000f;  // @constdefine TBD
+      RIL_MSGPROTOCOL_MSGHANDLING                 = $00000010;  // @constdefine TBD
+      RIL_MSGPROTOCOL_X400                        = $00000011;  // @constdefine TBD
+      RIL_MSGPROTOCOL_EMAIL                       = $00000012;  // @constdefine TBD
+      RIL_MSGPROTOCOL_SCSPECIFIC1                 = $00000013;     // @constdefine TBD
+      RIL_MSGPROTOCOL_SCSPECIFIC2                 = $00000014;     // @constdefine TBD
+      RIL_MSGPROTOCOL_SCSPECIFIC3                 = $00000015;     // @constdefine TBD
+      RIL_MSGPROTOCOL_SCSPECIFIC4                 = $00000016;     // @constdefine TBD
+      RIL_MSGPROTOCOL_SCSPECIFIC5                 = $00000017;     // @constdefine TBD
+      RIL_MSGPROTOCOL_SCSPECIFIC6                 = $00000018;     // @constdefine TBD
+      RIL_MSGPROTOCOL_SCSPECIFIC7                 = $00000019;     // @constdefine TBD
+      RIL_MSGPROTOCOL_GSMSTATION                  = $0000001a;      // @constdefine TBD
+      RIL_MSGPROTOCOL_SM_TYPE0                    = $0000001b;      // @constdefine TBD
+      RIL_MSGPROTOCOL_RSM_TYPE1                   = $0000001c;      // @constdefine TBD
+      RIL_MSGPROTOCOL_RSM_TYPE2                   = $0000001d;      // @constdefine TBD
+      RIL_MSGPROTOCOL_RSM_TYPE3                   = $0000001e;      // @constdefine TBD
+      RIL_MSGPROTOCOL_RSM_TYPE4                   = $0000001f;      // @constdefine TBD
+      RIL_MSGPROTOCOL_RSM_TYPE5                   = $00000020;      // @constdefine TBD
+      RIL_MSGPROTOCOL_RSM_TYPE6                   = $00000021;      // @constdefine TBD
+      RIL_MSGPROTOCOL_RSM_TYPE7                   = $00000022;      // @constdefine TBD
+      RIL_MSGPROTOCOL_RETURNCALL                  = $00000023;      // @constdefine TBD
+      RIL_MSGPROTOCOL_ME_DOWNLOAD                 = $00000024;      // @constdefine TBD
+      RIL_MSGPROTOCOL_DEPERSONALIZATION           = $00000025;      // @constdefine TBD
+      RIL_MSGPROTOCOL_SIM_DOWNLOAD                = $00000026;      // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Delivery | Message delivery status values
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MSGDLVSTATUS_RECEIVEDBYSME              = $00000001;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_FORWARDEDTOSME             = $00000002;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_REPLACEDBYSC               = $00000003;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_CONGESTION_TRYING          = $00000004;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_SMEBUSY_TRYING             = $00000005;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_SMENOTRESPONDING_TRYING    = $00000006;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_SVCREJECTED_TRYING         = $00000007;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_QUALITYUNAVAIL_TRYING      = $00000008;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_SMEERROR_TRYING            = $00000009;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_CONGESTION                 = $0000000a;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_SMEBUSY                    = $0000000b;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_SMENOTRESPONDING           = $0000000c;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_SVCREJECTED                = $0000000d;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_QUALITYUNAVAIL_TEMP        = $0000000e;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_SMEERROR                   = $0000000f;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_REMOTEPROCERROR            = $00000010;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_INCOMPATIBLEDEST           = $00000011;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_CONNECTIONREJECTED         = $00000012;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_NOTOBTAINABLE              = $00000013;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_NOINTERNETWORKING          = $00000014;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_VPEXPIRED                  = $00000015;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_DELETEDBYORIGSME           = $00000016;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_DELETEDBYSC                = $00000017;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_NOLONGEREXISTS             = $00000018;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_QUALITYUNAVAIL             = $00000019;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_RESERVED_COMPLETED         = $0000001a;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_RESERVED_TRYING            = $0000001b;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_RESERVED_ERROR             = $0000001c;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_RESERVED_TMPERROR          = $0000001d;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_SCSPECIFIC_COMPLETED       = $0000001e;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_SCSPECIFIC_TRYING          = $0000001f;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_SCSPECIFIC_ERROR           = $00000020;  // @constdefine TBD
+      RIL_MSGDLVSTATUS_SCSPECIFIC_TMPERROR        = $00000021;  // @constdefine TBD
+
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Validity | Message validity period formats
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MSGVP_NONE                              = $00000000;  // @constdefine TBD
+      RIL_MSGVP_RELATIVE                          = $00000001;  // @constdefine TBD
+      RIL_MSGVP_ENHANCED                          = $00000002;  // @constdefine TBD
+      RIL_MSGVP_ABSOLUTE                          = $00000003;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Command | Message command types
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MSGCMDTYPE_STATUSREQ                    = $00000001;  // @constdefine TBD
+      RIL_MSGCMDTYPE_CANCELSTATUSREQ              = $00000002;  // @constdefine TBD
+      RIL_MSGCMDTYPE_DELETEMESSAGE                = $00000003;  // @constdefine TBD
+      RIL_MSGCMDTYPE_ENABLESTATUSREQ              = $00000004;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Geographic | Message geographic scopes
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_GEOSCOPE_CELL_IMMEDIATE                 = $00000001;  // @constdefine TBD
+      RIL_GEOSCOPE_CELL                           = $00000002;  // @constdefine TBD
+      RIL_GEOSCOPE_PLMN                           = $00000003;  // @constdefine TBD
+      RIL_GEOSCOPE_LOCATIONAREA                   = $00000004;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Status | Message status values
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MSGSTATUS_UNKNOWN                       = $00000000;  // @constdefine TBD
+      RIL_MSGSTATUS_RECUNREAD                     = $00000001;  // @constdefine TBD
+      RIL_MSGSTATUS_RECREAD                       = $00000002;  // @constdefine TBD
+      RIL_MSGSTATUS_STOUNSENT                     = $00000003;  // @constdefine TBD
+      RIL_MSGSTATUS_STOSENT                       = $00000004;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Message Send | Send message options
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SENDOPT_NONE                            = $00000000;  // @constdefine TBD
+      RIL_SENDOPT_PERSISTLINK                     = $00000001;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Phone Locked | Phone locked states
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_LOCKEDSTATE_UNKNOWN                     = $00000000;  // @constdefine Locking state unknown
+      RIL_LOCKEDSTATE_READY                       = $00000001;  // @constdefine ME not locked
+      RIL_LOCKEDSTATE_SIM_PIN                     = $00000002;  // @constdefine ME awaiting PIN
+      RIL_LOCKEDSTATE_SIM_PUK                     = $00000003;  // @constdefine ME awaiting PUK
+      RIL_LOCKEDSTATE_PH_SIM_PIN                  = $00000004;  // @constdefine ME awaiting phone-to-sim password
+      RIL_LOCKEDSTATE_PH_FSIM_PIN                 = $00000005;  // @constdefine ME awaiting phone-to-first-sim password
+      RIL_LOCKEDSTATE_PH_FSIM_PUK                 = $00000006;  // @constdefine ME awaiting phone-to-first-sim PUK
+      RIL_LOCKEDSTATE_SIM_PIN2                    = $00000007;  // @constdefine ME awaiting PIN2/CHV2
+      RIL_LOCKEDSTATE_SIM_PUK2                    = $00000008;  // @constdefine ME awaiting PUK2
+      RIL_LOCKEDSTATE_PH_NET_PIN                  = $00000009;  // @constdefine ME awaiting network personilzation PIN
+      RIL_LOCKEDSTATE_PH_NET_PUK                  = $0000000a;  // @constdefine ME awaiting network personilzation PUK
+      RIL_LOCKEDSTATE_PH_NETSUB_PIN               = $0000000b;  // @constdefine ME awaiting network subset personilzation PIN
+      RIL_LOCKEDSTATE_PH_NETSUB_PUK               = $0000000c;  // @constdefine ME awaiting network subset personilzation PUK
+      RIL_LOCKEDSTATE_PH_SP_PIN                   = $0000000d;  // @constdefine ME awaiting service provider PIN
+      RIL_LOCKEDSTATE_PH_SP_PUK                   = $0000000e;  // @constdefine ME awaiting service provider PUK
+      RIL_LOCKEDSTATE_PH_CORP_PIN                 = $0000000f;  // @constdefine ME awaiting corporate personilzation PIN
+      RIL_LOCKEDSTATE_PH_CORP_PUK                 = $00000010;  // @constdefine ME awaiting corporate personilzation PUK
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Lock Facility | Facilities for phone locking
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_LOCKFACILITY_CNTRL                      = $00000001;  // @constdefine Lock control curface
+      RIL_LOCKFACILITY_PH_SIM                     = $00000002;  // @constdefine Lock phone to SIM card
+      RIL_LOCKFACILITY_PH_FSIM                    = $00000003;  // @constdefine Lock phone to first SIM card
+      RIL_LOCKFACILITY_SIM                        = $00000004;  // @constdefine Lock SIM card
+      RIL_LOCKFACILITY_SIM_PIN2                   = $00000005;  // @constdefine SIM PIN2 (only for RIL_ChangeLockingPassword())
+      RIL_LOCKFACILITY_SIM_FIXEDIALING            = $00000006;  // @constdefine SIM fixed dialing memory
+      RIL_LOCKFACILITY_NETWORKPERS                = $00000007;  // @constdefine Network personalization
+      RIL_LOCKFACILITY_NETWORKSUBPERS             = $00000008;  // @constdefine Network subset personalization
+      RIL_LOCKFACILITY_SERVICEPROVPERS            = $00000009;  // @constdefine Service provider personalization
+      RIL_LOCKFACILITY_CORPPERS                   = $0000000a;  // @constdefine Corporate personalization
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Lock Status | Locking status values
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_LOCKINGSTATUS_DISABLED                  = $00000001;  // @constdefine Disable
+      RIL_LOCKINGSTATUS_ENABLED                   = $00000002;  // @constdefine Enabled
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants SIM Security | SIM Security states
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SIMSECURITYSTATE_UNKNOWN                = $00000000;      // @constdefine SIM security state unknown
+      RIL_SIMSECURITYSTATE_PINREQUESTED           = $00000001;      // @constdefine SIM security state requested PIN
+      RIL_SIMSECURITYSTATE_PINRECEIVED            = $00000002;      // @constdefine SIM security state received PIN
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Call Barr Facility | Types of call barring
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_BARRTYPE_ALLOUTGOING                    = $00000001;  // @constdefine Barr all outgoing calls
+      RIL_BARRTYPE_OUTGOINGINT                    = $00000002;  // @constdefine Barr outgoing international calls
+      RIL_BARRTYPE_OUTGOINGINTEXTOHOME            = $00000003;  // @constdefine Barr outgoing international calls except to home country
+      RIL_BARRTYPE_ALLINCOMING                    = $00000004;  // @constdefine Barr all incoming calls
+      RIL_BARRTYPE_INCOMINGROAMING                = $00000005;  // @constdefine Barr incoming calls when roaming outside of home country
+      RIL_BARRTYPE_INCOMINGNOTINSIM               = $00000006;  // @constdefine Barr incoming calls from numbers not stored to SIM memory
+      RIL_BARRTYPE_ALLBARRING                     = $00000007;  // @constdefine All barring services
+      RIL_BARRTYPE_ALLOUTGOINGBARRING             = $00000008;  // @constdefine All outgoing barring services
+      RIL_BARRTYPE_ALLINCOMINGBARRING             = $00000009;  // @constdefine All incoming barring services
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Call Barr Status | Status values for call barring
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_BARRINGSTATUS_DISABLED                  = $00000001;  // @constdefine Disable
+      RIL_BARRINGSTATUS_ENABLED                   = $00000002;  // @constdefine Disable
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Equipment State | Equipment states
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_EQSTATE_UNKNOWN                         = $00000000;  // @constdefine Unknown
+      RIL_EQSTATE_MINIMUM                         = $00000001;  // @constdefine Minimum power state
+      RIL_EQSTATE_FULL                            = $00000002;  // @constdefine Full functionality
+      RIL_EQSTATE_DISABLETX                       = $00000003;  // @constdefine Transmitter disabled
+      RIL_EQSTATE_DISABLERX                       = $00000004;  // @constdefine Receiver disabled
+      RIL_EQSTATE_DISABLETXANDRX                  = $00000005;  // @constdefine Transmitter & receiver disabled
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Radio Presence States | Radio Presence States
+//
+// @comm These states are determined by whether the driver is loaded or not
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_RADIOPRESENCE_NOTPRESENT                = $00000000;  // @constdefine There is not radio module present in the device
+      RIL_RADIOPRESENCE_PRESENT                   = $00000001;  // @constdefine There is a radio module present that RIL can use
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Driver defined Radio ON vs OFF State | Radio ON/OFF states
+//
+// @comm These values normally depend on the Equiptment state
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_RADIOSUPPORT_UNKNOWN                    = $00000000;  // @constdefine The Radio Functionality is in an intermediate state
+      RIL_RADIOSUPPORT_OFF                        = $00000001;  // @constdefine The Radio Functionality is OFF (DOES NOT Neccessarily mean safe for flight)
+      RIL_RADIOSUPPORT_ON                         = $00000002;  // @constdefine The Radio Functionality is ON
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Various components of the Radio are ready for external usage
+//
+// @comm This will be a mask of the below values
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_READYSTATE_NONE                         = $00000000;  // @constdefine Nothing is ready yet
+      RIL_READYSTATE_INITIALIZED                  = $00000001;  // @constdefine The Radio has been initialized (but may not be ready)
+      RIL_READYSTATE_SIM                          = $00000002;  // @constdefine The Radio is ready for SIM Access
+      RIL_READYSTATE_SMS                          = $00000004;  // @constdefine The Radio is ready for SMS messages
+      RIL_READYSTATE_UNLOCKED                     = $00000008;  // @constdefine The SIM is unlocked
+      RIL_READYSTATE_SIM_PB                       = $00000010;      // @constdefine The SIM PB has been fully copied to volatile memory and is ready for access
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Various SIM card states.
+//
+// @comm NONE
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SIMSTATUSCHANGED_NONE                   = $00000000;      // @constdefine No status yet
+      RIL_SIMSTATUSCHANGED_FULL                   = $00000001;      // @constdefine SIM card memory is full
+      RIL_SIMSTATUSCHANGED_NO_SIM                 = $00000002;      // @constdefine No SIM card available
+      RIL_SIMSTATUSCHANGED_INVALID                = $00000004;      // @constdefine SIM card is invalid
+      RIL_SIMSTATUSCHANGED_BLOCKED                = $00000008;      // @constdefine SIM card is blocked
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Phonebook Storage | Phonebook storage locations
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PBLOC_UNKNOWN                           = $00000000;  // @constdefine Unknown
+      RIL_PBLOC_SIMEMERGENCY                      = $00000001;  // @constdefine Emergency numbers
+      RIL_PBLOC_SIMFIXDIALING                     = $00000002;  // @constdefine Fixed dialing
+      RIL_PBLOC_SIMLASTDIALING                    = $00000003;  // @constdefine Recent calls list
+      RIL_PBLOC_OWNNUMBERS                        = $00000004;  // @constdefine TBD
+      RIL_PBLOC_SIMPHONEBOOK                      = $00000005;  // @constdefine SIM phonebook
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Special Phonebook | Special phonebook index value
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PBINDEX_FIRSTAVAILABLE                  = $ffffffff;  // @constdefine User first available entry
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants SIM Command | SIM commands
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SIMCMD_READBINARY                       = $00000001;  // @constdefine Read a binary
+      RIL_SIMCMD_READRECORD                       = $00000002;  // @constdefine Read contents of a record
+      RIL_SIMCMD_GETRESPONSE                      = $00000003;  // @constdefine Required to get output data for some commands
+      RIL_SIMCMD_UPDATEBINARY                     = $00000004;  // @constdefine Update a transparent file
+      RIL_SIMCMD_UPDATERECORD                     = $00000005;  // @constdefine Update a linear fixed or cyclic file
+      RIL_SIMCMD_STATUS                           = $00000006;  // @constdefine Get status on a file
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants SIM Record | Different SIM file types
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SIMRECORDTYPE_UNKNOWN          = $00000000;  // @constdefine An unknown file type
+      RIL_SIMRECORDTYPE_TRANSPARENT      = $00000001;  // @constdefine A single veriable lengthed record
+      RIL_SIMRECORDTYPE_CYCLIC           = $00000002;  // @constdefine A cyclic set of records, each of the same length
+      RIL_SIMRECORDTYPE_LINEAR           = $00000003;  // @constdefine A linear set of records, each of the same length
+      RIL_SIMRECORDTYPE_MASTER           = $00000004;  // @constdefine Every SIM has a single master record, effectively the head node
+      RIL_SIMRECORDTYPE_DEDICATED        = $00000005;  // @constdefine Effectively a "directory" file which is a parent of other records
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants SIM Toolkit Terminate | SIM Toolkit session termination causes
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SIMTKITTERMCAUSE_USERSTOPPEDREDIAL      = $00000001;  // @constdefine User stopped redial attempts
+      RIL_SIMTKITTERMCAUSE_ENDOFREDIAL            = $00000002;  // @constdefine End of redial period
+      RIL_SIMTKITTERMCAUSE_USERENDEDSESSION       = $00000003;  // @constdefine Session terminated by user
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILSIMTOOLKITNOTIFYCAPS
+//
+// @constants Unavailable | Detailed reason for support of toolkit functions
+//
+// @comm Values that variables information variables in RILSIMTOOLKITNOTIFYCAPS can take on
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SIMTKN_MEIMPLEMENTS                     = $00000001;  // @constdefine The ME must implement this notification
+      RIL_SIMTKN_RADIOIMPLEMENTS_NONOTIFICATION   = $00000002;  // @constdefine The radio will implement and not give a notification to the ME
+      RIL_SIMTKN_RADIOIMPLEMENTS_NOTIFICATION     = $00000003;  // @constdefine The radio will implement and give a notification to the ME that it was done
+      RIL_SIMTKN_RADIOIMPLEMENTS_REQUESTMEINPUT   = $00000004;  // @constdefine The radio will implement, but requests information from the ME first
+      RIL_SIMTKN_NOSUPPORT                        = $FFFFFFFF;  // @constdefine RIL knows of this type of command but does not support.
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Signal Strength | Special signal strength value
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SIGNALSTRENGTH_UNKNOWN                  = $ffffffff;  // @constdefine Unknown signal strength
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Bit Error Rate | Special bit error rate value
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_BITERRORRATE_UNKNOWN                    = $ffffffff;  // @constdefine Unknown signal strength
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Remote Party | Remote party information validity types
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_REMOTEPARTYINFO_VALID                   = $00000001;  // @constdefine Information valid
+      RIL_REMOTEPARTYINFO_WITHHELD                = $00000002;  // @constdefine Information withheld by other user
+      RIL_REMOTEPARTYINFO_UNAVAILABLE             = $00000003;  // @constdefine Network unable to send info
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Disconnect Initiation | Disconnect initiation values
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_DISCINIT_NULL                           = $00000000;  // @constdefine Nothing
+      RIL_DISCINIT_LOCAL                          = $00000001;  // @constdefine Local party initiated
+      RIL_DISCINIT_REMOTE                         = $00000002;  // @constdefine Remote party initiated
+      RIL_DISCINIT_NETWORKERROR                   = $00000003;  // @constdefine The call was disconnected due to a network error condition
+      RIL_DISCINIT_BUSY                           = $00000004;  // @constdefine Busy
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Subaddress Type | Supplementary service data status values
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SUPSVCDATASTATUS_NOINFOREQUIRED         = $00000001;  // @constdefine TBD
+      RIL_SUPSVCDATASTATUS_FURTHERINFOREQUIRED    = $00000002;  // @constdefine TBD
+      RIL_SUPSVCDATASTATUS_TERMINATED             = $00000003;  // @constdefine TBD
+      RIL_SUPSVCDATASTATUS_OTHERCLIENTRESPONDED   = $00000004;  // @constdefine TBD
+      RIL_SUPSVCDATASTATUS_UNSUPPORTED            = $00000005;  // @constdefine TBD
+      RIL_SUPSVCDATASTATUS_TIMEOUT                = $00000006;  // @constdefine TBD
+      RIL_SUPSVCDATASTATUS_ERROR                  = $00000007;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants GPRS Protocol | GPRS Packet Protocols
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_GPRSPROTOCOL_UNKNOWN                    = $00000000;  // @constdefine Unknown
+      RIL_GPRSPROTOCOL_X25                        = $00000001;  // @constdefine ITU-T/CCITT X.25 Layer 4
+      RIL_GPRSPROTOCOL_IP                         = $00000002;  // @constdefine Internet Protocol (IETF STD 5)
+      RIL_GPRSPROTOCOL_IHOSP                      = $00000004;  // @constdefine Internet Hosted Octet Stream Protocol
+      RIL_GPRSPROTOCOL_PPP                        = $00000008;  // @constdefine Point to Point Protocol
+      RIL_GPRSPROTOCOL_ALL                        = $0000000f;
+      
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants GPRS Protocol | GPRS L2 Protocols
+//
+// @comm None
+//
+// See GSM 07.07 10.1.6 for definitions
+// -----------------------------------------------------------------------------
+const
+      RIL_GPRSL2PROTOCOL_UNKNOWN                  = $00000000;  // @constdefine
+      RIL_GPRSL2PROTOCOL_NULL                     = $00000001;  // @constdefine none, for PDP type OSP:IHOSS
+      RIL_GPRSL2PROTOCOL_PPP                      = $00000002;  // @constdefine Point-to-point protocol for a PDP such as IP
+      RIL_GPRSL2PROTOCOL_PAD                      = $00000004;  // @constdefine character stream for X.25 character (triple X PAD) mode
+      RIL_GPRSL2PROTOCOL_X25                      = $00000008;  // @constdefine X.25 L2 (LAPB) for X.25 packet mode
+      RIL_GPRSL2PROTOCOL_ALL                      = $0000000f;
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants GPRS Data Comp | GPRS Data Compression
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_GPRSDATACOMP_OFF                        = $00000001;  // @constdefine compression off
+      RIL_GPRSDATACOMP_ON                         = $00000002;  // @constdefine compression off
+      RIL_GPRSDATACOMP_ALL                        = $00000003;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants GPRS Header Comp | GPRS Header Compression
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_GPRSHEADERCOMP_OFF                      = $00000001;  // @constdefine compression off
+      RIL_GPRSHEADERCOMP_ON                       = $00000002;  // @constdefine compression off
+      RIL_GPRSHEADERCOMP_ALL                      = $00000003;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants GPRS Precedence Class | GPRS Precedence Class
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_GPRSPRECEDENCECLASS_SUBSCRIBED          = $00000001;  // @constdefine subscribed value stored in network
+      RIL_GPRSPRECEDENCECLASS_HIGH                = $00000002;  // @constdefine high priority
+      RIL_GPRSPRECEDENCECLASS_NORMAL              = $00000004;  // @constdefine normal priority
+      RIL_GPRSPRECEDENCECLASS_LOW                 = $00000008;  // @constdefine low priority
+      RIL_GPRSPRECEDENCECLASS_ALL                 = $0000000f;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants GPRS Delay Class | GPRS Delay Class
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_GPRSDELAYCLASS_SUBSCRIBED              = $00000001;  // @constdefine subscribed value stored in network
+      RIL_GPRSDELAYCLASS_PREDICTIVE1             = $00000002;  // @constdefine see gsm 02.60
+      RIL_GPRSDELAYCLASS_PREDICTIVE2             = $00000004;  // @constdefine see gsm 02.60
+      RIL_GPRSDELAYCLASS_PREDICTIVE3             = $00000008;  // @constdefine see gsm 02.60
+      RIL_GPRSDELAYCLASS_BESTEFFORT              = $00000010;  // @constdefine see gsm 02.60
+      RIL_GPRSDELAYCLASS_ALL                     = $0000001f;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants GPRS Reliability Class | GPRS Reliability Class
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_GPRSRELIABILITYCLASS_SUBSCRIBED        = $00000001;  // @constdefine subscribed value stored in network
+      RIL_GPRSRELIABILITYCLASS_1                 = $00000002;  // @constdefine see gsm 03.60
+      RIL_GPRSRELIABILITYCLASS_2                 = $00000004;  // @constdefine see gsm 03.60
+      RIL_GPRSRELIABILITYCLASS_3                 = $00000008;  // @constdefine see gsm 03.60
+      RIL_GPRSRELIABILITYCLASS_4                 = $00000010;  // @constdefine see gsm 03.60
+      RIL_GPRSRELIABILITYCLASS_5                 = $00000020;  // @constdefine see gsm 03.60
+      RIL_GPRSRELIABILITYCLASS_ALL               = $0000003f;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants GPRS Class | GPRS Class
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_GPRSCLASS_UNKNOWN                       = $00000000;  // @constdefine GPRS class unknown
+      RIL_GPRSCLASS_GSMANDGPRS                    = $00000001;  // @constdefine Simultaneous voice and GPRS data
+      RIL_GPRSCLASS_GSMORGPRS                     = $00000002;  // @constdefine Simultaneous voice and GPRS traffic channel, one or other data
+      RIL_GPRSCLASS_GSMORGPRS_EXCLUSIVE           = $00000004;  // @constdefine Either all voice or all GPRS, both traffic channels unmonitored
+      RIL_GPRSCLASS_GPRSONLY                      = $00000008;  // @constdefine Only GPRS
+      RIL_GPRSCLASS_GSMONLY                       = $00000010;  // @constdefine Only circuit switched voice and data
+      RIL_GPRSCLASS_ALL                           = $0000001f;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants GPRS Peak Throughput Class | GPRS Peak Throughput Class
+//
+// @comm Constants represent bits per second
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PEAKTHRUCLASS_SUBSCRIBED               = $00000001;  // @constdefine subscribed value stored in network
+      RIL_PEAKTHRUCLASS_8000                     = $00000002;  // @constdefine bits per second
+      RIL_PEAKTHRUCLASS_16000                    = $00000004;  // @constdefine bits per second
+      RIL_PEAKTHRUCLASS_32000                    = $00000008;  // @constdefine bits per second
+      RIL_PEAKTHRUCLASS_64000                    = $00000010;  // @constdefine bits per second
+      RIL_PEAKTHRUCLASS_128000                   = $00000020;  // @constdefine bits per second
+      RIL_PEAKTHRUCLASS_256000                   = $00000040;  // @constdefine bits per second
+      RIL_PEAKTHRUCLASS_512000                   = $00000080;  // @constdefine bits per second
+      RIL_PEAKTHRUCLASS_1024000                  = $00000100;  // @constdefine bits per second
+      RIL_PEAKTHRUCLASS_2048000                  = $00000200;  // @constdefine bits per second
+      RIL_PEAKTHRUCLASS_ALL                      = $000003ff;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants GPRS Mean Throughput Class | GPRS Mean Throughput Class
+//
+// @comm Constants represent octets per hour
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MEANTHRUCLASS_SUBSCRIBED               = $00000001;  // @constdefine subscribed value stored in network
+      RIL_MEANTHRUCLASS_100                      = $00000002;  // @constdefine 0.22 bits/second
+      RIL_MEANTHRUCLASS_200                      = $00000004;  // @constdefine 0.44 bits/second
+      RIL_MEANTHRUCLASS_500                      = $00000008;  // @constdefine 1.11 bits/second
+      RIL_MEANTHRUCLASS_1000                     = $00000010;  // @constdefine 2.2 bits/second
+      RIL_MEANTHRUCLASS_2000                     = $00000020;  // @constdefine 4.4 bits/second
+      RIL_MEANTHRUCLASS_5000                     = $00000040;  // @constdefine 11.1 bits/second
+      RIL_MEANTHRUCLASS_10000                    = $00000080;  // @constdefine 22 bits/second
+      RIL_MEANTHRUCLASS_20000                    = $00000100;  // @constdefine 44 bits/second
+      RIL_MEANTHRUCLASS_50000                    = $00000200;  // @constdefine 111 bits/second
+      RIL_MEANTHRUCLASS_100000                   = $00000400;  // @constdefine 220 bits/second
+      RIL_MEANTHRUCLASS_200000                   = $00000800;  // @constdefine 440 bits/second
+      RIL_MEANTHRUCLASS_500000                   = $00001000;  // @constdefine 1,110 bits/second
+      RIL_MEANTHRUCLASS_1000000                  = $00002000;  // @constdefine 2,200 bits/second
+      RIL_MEANTHRUCLASS_2000000                  = $00004000;  // @constdefine 4,400 bits/second
+      RIL_MEANTHRUCLASS_5000000                  = $00008000;  // @constdefine 11,100 bits/second
+      RIL_MEANTHRUCLASS_10000000                 = $00010000;  // @constdefine 22,000 bits/second
+      RIL_MEANTHRUCLASS_20000000                 = $00020000;  // @constdefine 44,000 bits/second
+      RIL_MEANTHRUCLASS_50000000                 = $00040000;  // @constdefine 111,000 bits/second
+      RIL_MEANTHRUCLASS_DONTCARE                 = $80000000;  // @constdefine best effort
+      RIL_MEANTHRUCLASS_ALL                      = $8007ffff;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Complete Call Busy | Special value for all CCBS
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CCBS_ALL                                  = $ffffffff;  // @constdefine All CCBS
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants GPRS SMS | Mobile Originated SMS Service Constants
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_MOSMSSERVICE_CIRCUIT                      = $00000001;  // @constdefine circuit switched
+      RIL_MOSMSSERVICE_GPRS                         = $00000002;  // @constdefine GPRS
+      RIL_MOSMSSERVICE_CIRCUITPREFERRED             = $00000004;  // @constdefine use both, circuit switched preferred
+      RIL_MOSMSSERVICE_GPRSPREFERRED                = $00000008;  // @constdefine use both, GPRS preferred
+      RIL_MOSMSSERVICE_ALL                          = $0000000f;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Password type | PIN or PUK password
+//
+// @comm Used to distiguish between a password that is a PIN vs PUK for RIL_ChangeLockingPassword
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PASSWORDTYPE_PIN                      = $00000001;  //@ The password type is a SIM PIN (editable password)
+      RIL_PASSWORDTYPE_PUK                      = $00000002;  //@ The password type is a SIM PUK (Non-user editable)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants System Capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SYSTEMCAPS_NONE                         = $00000000; // @constdefine The system does not support any special capabilities.
+      RIL_SYSTEMCAPS_VOICEDATA                    = $00000001; // @constdefine The system supports simultaneous voice+Data
+      RIL_SYSTEMCAPS_ALL                          = $00000001; // @constdefine The system supports all special capabilities.
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Type | Capability types
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPSTYPE_DIAL                           = $00000001;  // @constdefine TBD
+      RIL_CAPSTYPE_DTMFDURATIONRANGE              = $00000002;  // @constdefine TBD
+      RIL_CAPSTYPE_CALLMGTCMDS                    = $00000003;  // @constdefine TBD
+      RIL_CAPSTYPE_BEARERSERVICE                  = $00000004;  // @constdefine TBD
+      RIL_CAPSTYPE_RLP                            = $00000005;  // @constdefine TBD
+      RIL_CAPSTYPE_EQUIPMENTSTATES                = $00000006;  // @constdefine TBD
+      RIL_CAPSTYPE_PBSTORELOCATIONS               = $00000007;  // @constdefine TBD
+      RIL_CAPSTYPE_PBINDEXRANGE                   = $00000008;  // @constdefine TBD
+      RIL_CAPSTYPE_PBENTRYLENGTH                  = $00000009;  // @constdefine TBD
+      RIL_CAPSTYPE_MSGSERVICETYPES                = $0000000a;  // @constdefine TBD
+      RIL_CAPSTYPE_MSGMEMORYLOCATIONS             = $0000000b;  // @constdefine TBD
+      RIL_CAPSTYPE_BROADCASTMSGLANGS              = $0000000c;  // @constdefine TBD
+      RIL_CAPSTYPE_MSGCONFIGINDEXRANGE            = $0000000d;  // @constdefine TBD
+      RIL_CAPSTYPE_MSGSTATUSVALUES                = $0000000e;  // @constdefine TBD
+      RIL_CAPSTYPE_PREFOPINDEXRANGE               = $0000000f;  // @constdefine TBD
+      RIL_CAPSTYPE_LOCKFACILITIES                 = $00000010;  // @constdefine TBD
+      RIL_CAPSTYPE_LOCKINGPWDLENGTHS              = $00000011;  // @constdefine TBD
+      RIL_CAPSTYPE_BARRTYPES                      = $00000012;  // @constdefine TBD
+      RIL_CAPSTYPE_BARRINGPWDLENGTHS              = $00000013;  // @constdefine TBD
+      RIL_CAPSTYPE_FORWARDINGREASONS              = $00000014;  // @constdefine TBD
+      RIL_CAPSTYPE_INFOCLASSES                    = $00000015;  // @constdefine TBD
+      RIL_CAPSTYPE_HSCSD                          = $00000016;  // @constdefine TBD
+      RIL_CAPSTYPE_SIMTOOLKITNOTIFICATIONS        = $00000017;  // @constdefine TBD
+      RIL_CAPSTYPE_GPRSCLASS                      = $00000018;  // @constdefine TBD
+      RIL_CAPSTYPE_GPRSCONTEXT                    = $00000019;  // @constdefine TBD
+      RIL_CAPSTYPE_GPRSQOS                        = $0000001a;  // @constdefine TBD
+      RIL_CAPSTYPE_GPRSQOSMIN                     = $0000001b;  // @constdefine TBD
+      RIL_CAPSTYPE_GPRSMOSMS                      = $0000001c;  // @constdefine TBD
+      RIL_CAPSTYPE_DATACOMPRESSION                = $0000001d;  // @constdefine TBD
+      RIL_CAPSTYPE_ERRORCORRECTION                = $0000001e;  // @constdefine TBD
+      RIL_CAPSTYPE_SIGNALQUALITYIMPLEMENTATION    = $0000001f;  // @constdefine TBD
+
+      RIL_CAPSTYPE_SIMSUPPORT                     = $00000020;  // @constdefine TBD
+      RIL_CAPSTYPE_CALLPROGRESSNOTIFICATION       = $00000021;  // @constdefine TBD
+      RIL_CAPSTYPE_NOTIFICATIONIMPLEMENTATION     = $00000022;  // @constdefine TBD
+      RIL_CAPSTYPE_NITZNOTIFICATION               = $00000023;  // @constdefine TBD
+
+      RIL_CAPSTYPE_ARG_SMALLEST                   = RIL_CAPSTYPE_DIAL;
+      RIL_CAPSTYPE_ARG_LARGEST                    = RIL_CAPSTYPE_NITZNOTIFICATION;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Call Type | NITZ type capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_NITZ_DISABLED                 = $00000001;      // @constdefine TBD
+      RIL_CAPS_NITZ_ENABLED                  = $00000002;      // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Call Type | Call type capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_CALLTYPE_VOICE                     = $00000001;  // @constdefine TBD
+      RIL_CAPS_CALLTYPE_DATA                      = $00000002;  // @constdefine TBD
+      RIL_CAPS_CALLTYPE_FAX                       = $00000004;  // @constdefine TBD
+      RIL_CAPS_CALLTYPE_PTT                       = $00000008;  // @constdefine TBD
+      RIL_CAPS_CALLTYPE_VT                        = $00000010;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Dialing Option | Dialing options capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_DIALOPT_RESTRICTID                 = RIL_DIALOPT_RESTRICTID;    // @constdefine TBD
+      RIL_CAPS_DIALOPT_PRESENTID                  = RIL_DIALOPT_PRESENTID;     // @constdefine TBD
+      RIL_CAPS_DIALOPT_CLOSEDGROUP                = RIL_DIALOPT_CLOSEDGROUP;   // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Call Mgmt | Call management command capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_CALLCMD_RELEASEHELD                = $00000001;  // @constdefine TBD
+      RIL_CAPS_CALLCMD_RELEASEACTIVE_ACCEPTHELD   = $00000002;  // @constdefine TBD
+      RIL_CAPS_CALLCMD_RELEASECALL                = $00000004;  // @constdefine TBD
+      RIL_CAPS_CALLCMD_HOLDACTIVE_ACCEPTHELD      = $00000008;  // @constdefine TBD
+      RIL_CAPS_CALLCMD_HOLDALLBUTONE              = $00000010;  // @constdefine TBD
+      RIL_CAPS_CALLCMD_ADDHELDTOCONF              = $00000020;  // @constdefine TBD
+      RIL_CAPS_CALLCMD_ADDHELDTOCONF_DISCONNECT   = $00000040;  // @constdefine TBD
+      RIL_CAPS_CALLCMD_INVOKECCBS                 = $00000080;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Bearer Speed1 | Bearer service speed capabilities (first set)
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_SPEED1_AUTO                        = $00000001;  // @constdefine TBD
+      RIL_CAPS_SPEED1_300_V21                     = $00000002;  // @constdefine TBD
+      RIL_CAPS_SPEED1_300_V110                    = $00000004;  // @constdefine TBD
+      RIL_CAPS_SPEED1_1200_V22                    = $00000008;  // @constdefine TBD
+      RIL_CAPS_SPEED1_1200_75_V23                 = $00000010;  // @constdefine TBD
+      RIL_CAPS_SPEED1_1200_V110                   = $00000020;  // @constdefine TBD
+      RIL_CAPS_SPEED1_1200_V120                   = $00000040;  // @constdefine TBD
+      RIL_CAPS_SPEED1_2400_V22BIS                 = $00000080;  // @constdefine TBD
+      RIL_CAPS_SPEED1_2400_V26TER                 = $00000100;  // @constdefine TBD
+      RIL_CAPS_SPEED1_2400_V110                   = $00000200;  // @constdefine TBD
+      RIL_CAPS_SPEED1_2400_V120                   = $00000400;  // @constdefine TBD
+      RIL_CAPS_SPEED1_4800_V32                    = $00000800;  // @constdefine TBD
+      RIL_CAPS_SPEED1_4800_V110                   = $00001000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_4800_V120                   = $00002000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_9600_V32                    = $00004000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_9600_V34                    = $00008000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_9600_V110                   = $00010000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_9600_V120                   = $00020000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_14400_V34                   = $00040000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_14400_V110                  = $00080000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_14400_V120                  = $00100000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_19200_V34                   = $00200000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_19200_V110                  = $00400000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_19200_V120                  = $00800000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_28800_V34                   = $01000000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_28800_V110                  = $02000000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_28800_V120                  = $04000000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_38400_V110                  = $08000000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_38400_V120                  = $10000000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_48000_V110                  = $20000000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_48000_V120                  = $40000000;  // @constdefine TBD
+      RIL_CAPS_SPEED1_56000_V110                  = $80000000;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Bearer Speed2 | Bearer service speed capabilities (second set)
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_SPEED2_56000_V120                  = $00000001;  // @constdefine TBD
+      RIL_CAPS_SPEED2_56000_TRANSP                = $00000002;  // @constdefine TBD
+      RIL_CAPS_SPEED2_64000_TRANSP                = $00000004;  // @constdefine TBD
+      RIL_CAPS_SPEED2_32000_PIAFS32K              = $00000008;  // @constdefine TBD
+      RIL_CAPS_SPEED2_64000_PIAFS64K              = $00000010;  // @constdefine TBD
+      RIL_CAPS_SPEED2_28800_MULTIMEDIA            = $00000020;  // @constdefine TBD
+      RIL_CAPS_SPEED2_32000_MULTIMEDIA            = $00000040;  // @constdefine TBD
+      RIL_CAPS_SPEED2_33600_MULTIMEDIA            = $00000080;  // @constdefine TBD
+      RIL_CAPS_SPEED2_56000_MULTIMEDIA            = $00000100;  // @constdefine TBD
+      RIL_CAPS_SPEED2_64000_MULTIMEDIA            = $00000200;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Bearer Name | Bearer service name capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_BSVCNAME_DATACIRCUIT_ASYNC_UDI_MODEM   = $00000001;  // @constdefine TBD
+      RIL_CAPS_BSVCNAME_DATACIRCUIT_SYNC_UDI_MODEM    = $00000002;  // @constdefine TBD
+      RIL_CAPS_BSVCNAME_PADACCESS_ASYNC_UDI           = $00000004;  // @constdefine TBD
+      RIL_CAPS_BSVCNAME_PACKETACCESS_SYNC_UDI         = $00000008;  // @constdefine TBD
+      RIL_CAPS_BSVCNAME_DATACIRCUIT_ASYNC_RDI         = $00000010;  // @constdefine TBD
+      RIL_CAPS_BSVCNAME_DATACIRCUIT_SYNC_RDI          = $00000020;  // @constdefine TBD
+      RIL_CAPS_BSVCNAME_PADACCESS_ASYNC_RDI           = $00000040;  // @constdefine TBD
+      RIL_CAPS_BSVCNAME_PACKETACCESS_SYNC_RDI         = $00000080;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Bearer CE | Bearer service connection element capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_BSVCCE_TRANSPARENT                 = $00000001;  // @constdefine TBD
+      RIL_CAPS_BSVCCE_NONTRANSPARENT              = $00000002;  // @constdefine TBD
+      RIL_CAPS_BSVCCE_BOTH_TRANSPARENT            = $00000004;  // @constdefine TBD
+      RIL_CAPS_BSVCCE_BOTH_NONTRANSPARENT         = $00000008;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Equipment | Equipment state capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_EQSTATE_MINIMUM                    = $00000001;  // @constdefine TBD
+      RIL_CAPS_EQSTATE_FULL                       = $00000002;  // @constdefine TBD
+      RIL_CAPS_EQSTATE_DISABLETX                  = $00000004;  // @constdefine TBD
+      RIL_CAPS_EQSTATE_DISABLERX                  = $00000008;  // @constdefine TBD
+      RIL_CAPS_EQSTATE_DISABLETXANDRX             = $00000010;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Phonebook | Phonebook storage location capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_PBLOC_SIMEMERGENCY                 = $00000001;  // @constdefine TBD
+      RIL_CAPS_PBLOC_SIMFIXDIALING                = $00000002;  // @constdefine TBD
+      RIL_CAPS_PBLOC_SIMLASTDIALING               = $00000004;  // @constdefine TBD
+      RIL_CAPS_PBLOC_OWNNUMBERS                   = $00000008;  // @constdefine TBD
+      RIL_CAPS_PBLOC_SIMPHONEBOOK                 = $00000010;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Message Service | Message service type capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_MSGSVCTYPE_PHASE2                  = $00000001;  // @constdefine TBD
+      RIL_CAPS_MSGSVCTYPE_PHASE2PLUS              = $00000002;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Message Storage | Message storage location capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_MSGLOC_BROADCAST                   = $00000001;  // @constdefine TBD
+      RIL_CAPS_MSGLOC_SIM                         = $00000002;  // @constdefine TBD
+      RIL_CAPS_MSGLOC_STATUSREPORT                = $00000004;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps DCS Language | Message broadcast data coding scheme language capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_DCSLANG_GERMAN                     = RIL_DCSLANG_GERMAN;     // @constdefine TBD
+      RIL_CAPS_DCSLANG_ENGLISH                    = RIL_DCSLANG_ENGLISH;    // @constdefine TBD
+      RIL_CAPS_DCSLANG_ITALIAN                    = RIL_DCSLANG_ITALIAN;    // @constdefine TBD
+      RIL_CAPS_DCSLANG_FRENCH                     = RIL_DCSLANG_FRENCH;     // @constdefine TBD
+      RIL_CAPS_DCSLANG_SPANISH                    = RIL_DCSLANG_SPANISH;    // @constdefine TBD
+      RIL_CAPS_DCSLANG_DUTCH                      = RIL_DCSLANG_DUTCH;      // @constdefine TBD
+      RIL_CAPS_DCSLANG_SWEDISH                    = RIL_DCSLANG_SWEDISH;    // @constdefine TBD
+      RIL_CAPS_DCSLANG_DANISH                     = RIL_DCSLANG_DANISH;     // @constdefine TBD
+      RIL_CAPS_DCSLANG_PORTUGUESE                 = RIL_DCSLANG_PORTUGUESE; // @constdefine TBD
+      RIL_CAPS_DCSLANG_FINNISH                    = RIL_DCSLANG_FINNISH;    // @constdefine TBD
+      RIL_CAPS_DCSLANG_NORWEGIAN                  = RIL_DCSLANG_NORWEGIAN;  // @constdefine TBD
+      RIL_CAPS_DCSLANG_GREEK                      = RIL_DCSLANG_GREEK;      // @constdefine TBD
+      RIL_CAPS_DCSLANG_TURKISH                    = RIL_DCSLANG_TURKISH;    // @constdefine TBD
+      RIL_CAPS_DCSLANG_HUNGARIAN                  = RIL_DCSLANG_HUNGARIAN;  // @constdefine TBD
+      RIL_CAPS_DCSLANG_POLISH                     = RIL_DCSLANG_POLISH;     // @constdefine TBD
+      RIL_CAPS_DCSLANG_CZECH                      = RIL_DCSLANG_CZECH;      // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Message Status | Message status capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_MSGSTATUS_RECUNREAD                = $00000001;  // @constdefine TBD
+      RIL_CAPS_MSGSTATUS_RECREAD                  = $00000002;  // @constdefine TBD
+      RIL_CAPS_MSGSTATUS_STOUNSENT                = $00000004;  // @constdefine TBD
+      RIL_CAPS_MSGSTATUS_STOSENT                  = $00000008;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps SIM | SIM capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_SIM_NONE                  = $00000000;      // @constdefine TBD
+      RIL_CAPS_SIM_BASIC                 = $00000001;      // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Phone Lock | Locking faciliy capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_LOCKFACILITY_NONE                  = $00000000;  // @constdefine TBD
+      RIL_CAPS_LOCKFACILITY_CNTRL                 = $00000001;  // @constdefine TBD
+      RIL_CAPS_LOCKFACILITY_PH_SIM                = $00000002;  // @constdefine TBD
+      RIL_CAPS_LOCKFACILITY_PH_FSIM               = $00000004;  // @constdefine TBD
+      RIL_CAPS_LOCKFACILITY_SIM                   = $00000008;  // @constdefine TBD
+      RIL_CAPS_LOCKFACILITY_SIM_PIN2              = $00000010;  // @constdefine TBD
+      RIL_CAPS_LOCKFACILITY_SIM_FIXEDIALING       = $00000020;  // @constdefine TBD
+      RIL_CAPS_LOCKFACILITY_NETWORKPERS           = $00000040;  // @constdefine TBD
+      RIL_CAPS_LOCKFACILITY_NETWORKSUBPERS        = $00000080;  // @constdefine TBD
+      RIL_CAPS_LOCKFACILITY_SERVICEPROVPERS       = $00000100;  // @constdefine TBD
+      RIL_CAPS_LOCKFACILITY_CORPPERS              = $00000200;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Call Barr | Call barring capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_BARRTYPE_ALLOUTGOING               = $00000001;  // @constdefine TBD
+      RIL_CAPS_BARRTYPE_OUTGOINGINT               = $00000002;  // @constdefine TBD
+      RIL_CAPS_BARRTYPE_OUTGOINGINTEXTOHOME       = $00000004;  // @constdefine TBD
+      RIL_CAPS_BARRTYPE_ALLINCOMING               = $00000008;  // @constdefine TBD
+      RIL_CAPS_BARRTYPE_INCOMINGROAMING           = $00000010;  // @constdefine TBD
+      RIL_CAPS_BARRTYPE_INCOMINGNOTINSIM          = $00000020;  // @constdefine TBD
+      RIL_CAPS_BARRTYPE_ALLBARRING                = $00000040;  // @constdefine TBD
+      RIL_CAPS_BARRTYPE_ALLOUTGOINGBARRING        = $00000080;  // @constdefine TBD
+      RIL_CAPS_BARRTYPE_ALLINCOMINGBARRING        = $00000100;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Forwarding | Forwarding reason capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_FWDREASON_UNCONDITIONAL            = $00000001;  // @constdefine TBD
+      RIL_CAPS_FWDREASON_MOBILEBUSY               = $00000002;  // @constdefine TBD
+      RIL_CAPS_FWDREASON_NOREPLY                  = $00000004;  // @constdefine TBD
+      RIL_CAPS_FWDREASON_UNREACHABLE              = $00000008;  // @constdefine TBD
+      RIL_CAPS_FWDREASON_ALLFORWARDING            = $00000010;  // @constdefine TBD
+      RIL_CAPS_FWDREASON_ALLCONDITIONAL           = $00000020;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Info Class | Telephony information class capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_INFOCLASS_VOICE                    = RIL_INFOCLASS_VOICE;     // @constdefine TBD
+      RIL_CAPS_INFOCLASS_DATA                     = RIL_INFOCLASS_DATA;     // @constdefine TBD
+      RIL_CAPS_INFOCLASS_FAX                      = RIL_INFOCLASS_FAX;     // @constdefine TBD
+      RIL_CAPS_INFOCLASS_SMS                      = RIL_INFOCLASS_SMS;     // @constdefine TBD
+      RIL_CAPS_INFOCLASS_DATACIRCUITSYNC          = RIL_INFOCLASS_DATACIRCUITSYNC;     // @constdefine TBD
+      RIL_CAPS_INFOCLASS_DATACIRCUITASYNC         = RIL_INFOCLASS_DATACIRCUITASYNC;     // @constdefine TBD
+      RIL_CAPS_INFOCLASS_PACKETACCESS             = RIL_INFOCLASS_PACKETACCESS;     // @constdefine TBD
+      RIL_CAPS_INFOCLASS_PADACCESS                = RIL_INFOCLASS_PADACCESS;     // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps HSCSD Traffic Channel | HSCSD traffic channel coding capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_HSCSDCODING_4800_FULLRATE          = RIL_HSCSDCODING_4800_FULLRATE;     // @constdefine TBD
+      RIL_CAPS_HSCSDCODING_9600_FULLRATE          = RIL_HSCSDCODING_9600_FULLRATE;     // @constdefine TBD
+      RIL_CAPS_HSCSDCODING_14400_FULLRATE         = RIL_HSCSDCODING_14400_FULLRATE;    // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps HSCSD Air Interface | HSCSD air interface user rate capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_HSCSDAIURATE_9600                  = $00000001;  // @constdefine TBD
+      RIL_CAPS_HSCSDAIURATE_14400                 = $00000002;  // @constdefine TBD
+      RIL_CAPS_HSCSDAIURATE_19200                 = $00000004;  // @constdefine TBD
+      RIL_CAPS_HSCSDAIURATE_28800                 = $00000008;  // @constdefine TBD
+      RIL_CAPS_HSCSDAIURATE_38400                 = $00000010;  // @constdefine TBD
+      RIL_CAPS_HSCSDAIURATE_43200                 = $00000020;  // @constdefine TBD
+      RIL_CAPS_HSCSDAIURATE_57600                 = $00000040;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps SIM Toolkit | SIM Toolkit notification capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_NOTIFY_SIMTOOLKITCMD               = $00000001;  // @constdefine TBD
+      RIL_CAPS_NOTIFY_SIMTOOLKITCALLSETUP         = $00000002;  // @constdefine TBD
+      RIL_CAPS_NOTIFY_SIMTOOLKITEVENT             = $00000004;  // @constdefine TBD
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Signal Implemetation Quality | Signal Quality Implemetation Capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_SIGNALQUALITY_NOTIFICATION         = $00000001;  // @constdefine The Radio Module can deliver unsolicited Signal Quality Notifications
+      RIL_CAPS_SIGNALQUALITY_POLLING              = $00000002;  // @constdefine The Higher layers can poll the radio module in order to get the Signal Quality
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Radio Notificaiton Implemetation | Radio Notificaiton Implemetation Capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_NOTIFICATION_CALLLIST              = $00000001;      // @constdefine The Radio Module can deliver unsolicited notifications of call list information
+      RIL_CAPS_NOTIFICATION_LINESTATUS            = $00000002;      // @constdefine The Radio Module can deliver unsolicited notifications of line status
+      RIL_CAPS_NOTIFICATION_SIGNALQUALITY         = $00000004;      // @constdefine The Radio Module can deliver unsolicited notifications of signal quality
+      RIL_CAPS_NOTIFICATION_BEARERSERVICEOPTIONS  = $00000008;      // @constdefine The Radio Module can deliver unsolicited notifications of bearer service options
+      RIL_CAPS_NOTIFICATION_DATACOMPRESSION       = $00000010;      // @constdefine The Radio Module can deliver unsolicited notifications of data compression
+      RIL_CAPS_NOTIFICATION_EQUIPMENTSTATE        = $00000020;      // @constdefine The Radio Module can deliver unsolicited notifications of equipment state
+      RIL_CAPS_NOTIFICATION_ERRORCORRECTION       = $00000040;      // @constdefine The Radio Module can deliver unsolicited notifications of error correction
+      RIL_CAPS_NOTIFICATION_GPRSADDRESS           = $00000080;      // @constdefine The Radio Module can deliver unsolicited notifications of GPRS address
+      RIL_CAPS_NOTIFICATION_GPRSATTACHED          = $00000100;      // @constdefine The Radio Module can deliver unsolicited notifications of GPRS attached status
+      RIL_CAPS_NOTIFICATION_GPRSCONTEXTLIST       = $00000200;      // @constdefine The Radio Module can deliver unsolicited notifications of GPRS context list
+      RIL_CAPS_NOTIFICATION_GPRSCONTEXTACTIVATEDLIST      = $00000400;     // @constdefine The Radio Module can deliver unsolicited notifications of GPRS context activated list
+      RIL_CAPS_NOTIFICATION_GPRSREGISTRATIONSTATUS        = $00000800;     // @constdefine The Radio Module can deliver unsolicited notifications of GPRS registration status
+      RIL_CAPS_NOTIFICATION_MINIMUMQUALITYOFSERVICELIST   = $00001000;     // @constdefine The Radio Module can deliver unsolicited notifications of minimum QoS list
+      RIL_CAPS_NOTIFICATION_REGISTRATIONSTATUS            = $00002000;     // @constdefine The Radio Module can deliver unsolicited notifications of registration status
+      RIL_CAPS_NOTIFICATION_REQUESTEDQUALITYOFSERVICELIST = $00004000;     // @constdefine The Radio Module can deliver unsolicited notifications of requested QoS list
+      RIL_CAPS_NOTIFICATION_RLPOPTIONS                    = $00008000;     // @constdefine The Radio Module can deliver unsolicited notifications of RLP options
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Caps Radio Notificaiton Implemetation Registry Key | Radio Notificaiton Implemetation Capabilities Registry Key
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CAPS_NOTIFICATION_KEY                    = 'Comm\Cellular\RIL';
+      RIL_CAPS_NOTIFICATION_IMPL_PARAMS            = 'CapsNotificationImplParams';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Maximum size | Maximum size for a call list returned from radio
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CALLLIST_MAXSIZE                         = 10;
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Maximum size | Maximum size for a GPRS context list returned from radio
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_GPRSCONTEXTLIST_MAXSIZE                  = 10;
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Maximum size | Maximum size for a GPRS context activated list returned from radio
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_GPRSCONTEXTACTIVATEDLIST_MAXSIZE         = 10;
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Maximum size | Maximum size for a QoS list returned from radio
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_QOSLIST_MAXSIZE                          = 10;
+
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants Maximum lengths | Maximum lengths for string parameters
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      MAXLENGTH_ADDRESS                           = 256;     // @constdefine 256
+      MAXLENGTH_SUBADDR                           = 256;     // @constdefine 256
+      MAXLENGTH_DESCRIPTION                       = 256;     // @constdefine 256
+      MAXLENGTH_OPERATOR                          = 32;      // @constdefine 32
+      MAXLENGTH_OPERATOR_LONG                     = 32;      // @constdefine 32
+      MAXLENGTH_OPERATOR_SHORT                    = 16;      // @constdefine 16
+      MAXLENGTH_OPERATOR_NUMERIC                  = 16;      // @constdefine 16
+      MAXLENGTH_OPERATOR_COUNTRY_CODE             = 8;       // @constdefine 8
+      MAXLENGTH_SERVCTR                           = 256;     // @constdefine 256
+      MAXLENGTH_PASSWORD                          = 256;     // @constdefine 256
+      MAXLENGTH_ERRSHORT                          = 256;     // @constdefine 256
+      MAXLENGTH_ERRLONG                           = 256;     // @constdefine 256
+      MAXLENGTH_EQUIPINFO                         = 128;     // @constdefine 128
+      MAXLENGTH_PHONEBOOKADDR                     = 256;     // @constdefine 256
+      MAXLENGTH_PHONEBOOKTEXT                     = 256;     // @constdefine 256
+      MAXLENGTH_CURRENCY                          = 256;     // @constdefine 256
+      MAXLENGTH_AREAID                            = 256;     // @constdefine 256
+      MAXLENGTH_CELLID                            = 256;     // @constdefine 256
+      MAXLENGTH_HDR                               = 256;     // @constdefine 256
+      MAXLENGTH_MSG                               = 256;     // @constdefine 256
+      MAXLENGTH_CMD                               = 256;     // @constdefine 256
+      MAXLENGTH_MSGIDS                            = 256;     // @constdefine 256
+      MAXLENGTH_USERID                            = 256;     // @constdefine 256
+      MAXLENGTH_DTMF                              = 256;     // @constdefine 256
+      MAXLENGTH_GPRSADDRESS                       = 64;      // @constdefine 64
+      MAXLENGTH_GPRSACCESSPOINTNAME               = 64;      // @constdefine 64
+      MAXLENGTH_BCCH                              = 48;      // @constdefine 48
+      MAXLENGTH_NMR                               = 16;      // @constdefine 16
+      MAXLENGTH_ATR                               = 33;      // @constdefine 33
+      MAXLENGTH_RADIOLOG                          = 128;     // @constdefine 128
+      MAXLENGTH_CALLTYPEKEY                       = 128;     // @constdefine 128
+      MAXLENGTH_MMISTRING                         = 256;     // @constdefine 256
+
+//
+// Registry path and variable defintions
+//
+const
+      RIL_REGISTRY_ROOT = HKEY_LOCAL_MACHINE;
+      RIL_SECURE_REGISTRY_KEY = 'Comm\Cellular\Ril';
+      RIL_REGISTRY_VALUE_PDPCONTEXTS = 'Contexts';
+      RIL_REGISTRY_VALUE_PACKETIO = 'Packet';
+      RIL_REGISTRY_VALUE_WAITFORGPRSDEACTRESPONSE = 'WaitForDeactRsp';
+      RIL_REGISTRY_VALUE_EONSENABLED = 'EONSEnabled';
+
+//
+// Event logging registry definitions
+//
+const
+      CELLULAR_REGISTRYKEY_EVENTLOGGING = 'Comm\Cellular\EventLogging';
+      CELLULAR_REGISTRYVALUE_EVENTLOGGING_ENABLED = 'Enabled';
+      CELLULAR_REGISTRYVALUE_EVENTLOGGING_SOURCENAME = 'Source';
+
+//
+// Data types
+//
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILADDRESS | Represents a phone number
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     riladdress_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       dwType:DWORD;                           // @field type of number
+       dwNumPlan:DWORD;                        // @field numbering plan
+       wszAddress:array[0..MAXLENGTH_ADDRESS-1] of WCHAR;    // @field address (min 3, max 43)
+     end;
+     RILADDRESS = riladdress_tag;
+     LPRILADDRESS = ^riladdress_tag;
+
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILSUBADDRESS | The subaddress of a called party
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilsubaddress_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       dwType:DWORD;                           // @field type of subaddress
+       wszSubAddress:array[0..MAXLENGTH_SUBADDR-1] of WCHAR; // @field subaddress (min 2, max 23)
+     end;
+     RILSUBADDRESS = rilsubaddress_tag;
+     LPRILSUBADDRESS = ^rilsubaddress_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILSERIALPORTSTATS | Statistics of the virtual serial port
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilserialportstats_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       dwReadBitsPerSecond:DWORD;              // @field bit rate for reading data
+       dwWrittenBitsPerSecond:DWORD;           // @field bit rate for writing data
+     end;
+     RILSERIALPORTSTATS = rilserialportstats_tag;
+     LPRILSERIALPORTSTATS = ^rilserialportstats_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILSUBSCRIBERINFO | A phone number assigned to the user
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilsubscriberinfo_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       raAddress:RILADDRESS;                   // @field the assigned address
+       wszDescription:array[0..MAXLENGTH_DESCRIPTION-1] of WCHAR; // @field text relating to this subscriber
+       dwSpeed:DWORD;                          // @field data rate related to this number
+       dwService:DWORD;                        // @field the service related to this number
+       dwITC:DWORD;                            // @field information transfer capability
+       dwAddressId:DWORD;                      // @field the address ID of this number
+     end;
+     RILSUBSCRIBERINFO = rilsubscriberinfo_tag;
+     LPRILSUBSCRIBERINFO = ^rilsubscriberinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILOPERATORNAMES | The different representations of an operator
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     riloperatornames_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       szLongName:array[0..MAXLENGTH_OPERATOR_LONG-1] of AnsiChar;   // @field long representation (max 16 characters)
+       szShortName:array[0..MAXLENGTH_OPERATOR_SHORT-1] of AnsiChar; // @field short representation (max 8 characters)
+       szNumName:array[0..MAXLENGTH_OPERATOR_NUMERIC-1] of AnsiChar; // @field numeric representation (3 digit country code & 2 digit network code)
+       szCountryCode:array[0..MAXLENGTH_OPERATOR_COUNTRY_CODE-1] of AnsiChar; // @field 2 character ISO 3166 country repesentation of the MCC
+     end;
+     RILOPERATORNAMES = riloperatornames_tag;
+     LPRILOPERATORNAMES = ^riloperatornames_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILOPERATORINFO | Indicates status of a particular operator
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     riloperatorinfo_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       dwIndex:DWORD;                          // @field index, if applicable
+       dwStatus:DWORD;                         // @field registration status, if applicable
+       ronNames:RILOPERATORNAMES;              // @field representations of an operator
+     end;
+     RILOPERATORINFO = riloperatorinfo_tag;
+     LPRILOPERATORINFO = ^riloperatorinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCALLERIDSETTINGS | Caller ID settings
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcalleridsettings_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       dwStatus:DWORD;                         // @field activation status
+       dwProvisioning:DWORD;                   // @field network provisioning status
+     end;
+     RILCALLERIDSETTINGS = rilcalleridsettings_tag;
+     LPRILCALLERIDSETTINGS = ^rilcalleridsettings_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILHIDEIDSETTINGS | Hide ID settings
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilhideidsettings_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       dwStatus:DWORD;                         // @field activation status
+       dwProvisioning:DWORD;                   // @field network provisioning status
+     end;
+     RILHIDEIDSETTINGS = rilhideidsettings_tag;
+     LPRILHIDEIDSETTINGS = ^rilhideidsettings_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILDIALEDIDSETTINGS | Dialed ID settings
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rildialedidsettings_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       dwStatus:DWORD;                         // @field activation status
+       dwProvisioning:DWORD;                   // @field network provisioning status
+     end;
+     RILDIALEDIDSETTINGS = rildialedidsettings_tag;
+     LPRILDIALEDIDSETTINGS = ^rildialedidsettings_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILHIDECONNECTEDIDSETTINGS | Hide Connected ID settings
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilhideconnectedidsettings_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       dwStatus:DWORD;                         // @field activation status
+       dwProvisioning:DWORD;                   // @field network provisioning status
+     end;
+     RILHIDECONNECTEDIDSETTINGS = rilhideconnectedidsettings_tag;
+     LPRILHIDECONNECTEDIDSETTINGS = ^rilhideconnectedidsettings_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCLOSEDGROUPSETTINGS | Close user group settings
+//
+// @comm This feature is not used and is untested.
+//
+// -----------------------------------------------------------------------------
+type
+     rilclosedgroupsettings_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       dwStatus:DWORD;                         // @field activation status
+       dwIndex:DWORD;                          // @field CUG index
+       dwInfo:DWORD;                           // @field additional CUG flags
+     end;
+     RILCLOSEDGROUPSETTINGS = rilclosedgroupsettings_tag;
+     LPRILCLOSEDGROUPSETTINGS = ^rilclosedgroupsettings_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCALLFORWARDINGSETTING | Call forwarding service settings
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcallforwardingsettings_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       dwStatus:DWORD;                         // @field activation status
+       dwInfoClasses:DWORD;                    // @field indicates which classes of calls to forward
+       raAddress:RILADDRESS;                   // @field forwarding address
+       rsaSubAddress:RILSUBADDRESS;            // @field forwarding subaddress
+       dwDelayTime:DWORD;                      // @field seconds to wait in <def RIL_FWDREASON_NOREPLY> case
+     end;
+     RILCALLFORWARDINGSETTINGS = rilcallforwardingsettings_tag;
+     LPRILCALLFORWARDINGSETTINGS = ^rilcallforwardingsettings_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCALLINFO | Information about a specific call
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcallinfo_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       dwID:DWORD;                             // @field identifies each call
+       dwDirection:DWORD;                      // @field incoming or outgoing
+       dwStatus:DWORD;                         // @field properties of the call
+       dwType:DWORD;                           // @field voice or data or fax
+       dwMultiparty:DWORD;                     // @field conference call status
+       raAddress:RILADDRESS;                   // @field call address
+       wszDescription:array[0..MAXLENGTH_DESCRIPTION-1] of WCHAR; // @field any associated text
+       dwDisconnectCode:DWORD;                                       // if dwStatus is disconnected - this contains the reason
+     end;
+     RILCALLINFO = rilcallinfo_tag;
+     LPRILCALLINFO = ^rilcallinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILGAININFO | Audio gain information
+//
+// @comm The minimum and maximum values for both dwTxGain and dwRxGain
+//       are 0 and ULONG_MAX (that is, 0xFFFFFFFFUL; see limits.h).
+//       Values between these extremes scale linearly.
+//
+//       It is the RIL Driver's responsibility to scale these values
+//       to match whatever is appropriate for the corresponding radio.
+//       So for example, if a radio's gain range is from 0 to 0x1F,
+//       the RIL Driver should interpret 0xFFFFFFFF as 0x1F, and map
+//       intermediate values proportionately.
+//
+// -----------------------------------------------------------------------------
+type
+     rilgaininfo_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       dwTxGain:DWORD;                         // @field transmit gain level (128 nominal, 0 automatic)
+       dwRxGain:DWORD;                         // @field receive gain level (128 nominal, 0 automatic)
+     end;
+     RILGAININFO = rilgaininfo_tag;
+     LPRILGAININFO = ^rilgaininfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILAUDIODEVICEINFO | Audio device information
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilaudiodeviceinfo_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       dwTxDevice:DWORD;                       // @field transmit device
+       dwRxDevice:DWORD;                       // @field receive device
+     end;
+     RILAUDIODEVICEINFO = rilaudiodeviceinfo_tag;
+     LPRILAUDIODEVICEINFO = ^rilaudiodeviceinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILHSCSDINFO | High speed circuit switched data settings
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilhscsdinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwTranspRxTimeslots:DWORD;          // @field number of receive timeslots for transparent HSCSD calls
+       dwTranspChannelCodings:DWORD;       // @field accepted channel codings for transparent HSCSD calls
+       dwNonTranspRxTimeslots:DWORD;       // @field number of receive timeslots for non-transparent HSCSD calls
+       dwNonTranspChannelCodings:DWORD;    // @field accepted channel codings for non-transparent HSCSD calls
+       dwAirInterfaceUserRate:DWORD;       // @field air interface user rate for non-transparent HSCSD calls
+       dwRxTimeslotsLimit:DWORD;           // @field maximum number of receive timeslots to be used during the next non-transparent HSCSD call
+       fAutoSvcLevelUpgrading:BOOL;        // @field TRUE if automatic user-initiated service level upgrading for non-transparent HSCSD calls is enabled, FALSE otherwise
+     end;
+     RILHSCSDINFO = rilhscsdinfo_tag;
+     LPRILHSCSDINFO = ^rilhscsdinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCALLHSCSDINFO | High speed circuit switched data information for the current call
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcallhscsdinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwRxTimeslots:DWORD;                // @field number of receive timeslots currently in use
+       dwTxTimeslots:DWORD;                // @field number of transmit timeslots currently in use
+       dwAirInterfaceUserRate:DWORD;       // @field air interface user rate currently in use
+       dwChannelCoding:DWORD;              // @field current channel coding
+     end;
+     RILCALLHSCSDINFO = rilcallhscsdinfo_tag;
+     LPRILCALLHSCSDINFO = ^rilcallhscsdinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILDATACOMPINFO | Data compression settings
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rildatacompinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwDirection:DWORD;                  // @field compression in transmit and/or receive direcitons
+       dwNegotiation:DWORD;                // @field compression is required or optional
+       dwMaxDictEntries:DWORD;             // @field maximum number of dictionary entries
+       dwMaxStringLength:DWORD;            // @field maximum string length
+     end;
+     RILDATACOMPINFO = rildatacompinfo_tag;
+     LPRILDATACOMPINFO = ^rildatacompinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILERRORCORRECTIONINFO | Error correction settings
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilerrorcorrectioninfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwOriginalRequest:DWORD;            // @field TBD
+       dwOriginalFallback:DWORD;           // @field TBD
+       dwAnswererFallback:DWORD;           // @field TBD
+     end;
+     RILERRORCORRECTIONINFO = rilerrorcorrectioninfo_tag;
+     LPRILERRORCORRECTIONINFO = ^rilerrorcorrectioninfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILBEARERSVCINFO | Bearer service settings
+//
+// @comm For <def RIL_BSVCCE_BOTH_> constants, the subsequent text indicates the
+//       preferred connection element.  For instance, <def RIL_BSVCCE_BOTH_TRANSPARENT>
+//       means that both transparent and non transparent are supported, but transparent
+//       is preferred.
+//
+// -----------------------------------------------------------------------------
+type
+     rilbearersvcinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwSpeed:DWORD;                      // @field offered data speed (protocol dependant)
+       dwServiceName:DWORD;                // @field type of data service
+       dwConnectionElement:DWORD;          // @field indicates transparent or non-transparent connection
+     end;
+     RILBEARERSVCINFO = rilbearersvcinfo_tag;
+     LPRILBEARERSVCINFO = ^rilbearersvcinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILRLPINFO | Radio link protocol settings
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+//
+type
+     rilrlpinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwIWS:DWORD;                        // @field IWF-to-MS window size
+       dwMWS:DWORD;                        // @field MS-to-IWF window size
+       dwAckTimer:DWORD;                   // @field acknowledgement timer in 10s of milliseconds (T1)
+       dwRetransmissionAttempts:DWORD;     // @field number of retransmission attempts (N2)
+       dwVersion:DWORD;                    // @field RLP version number
+       dwResequencingPeriod:DWORD;         // @field resequencing period (T4)
+     end;
+     RILRLPINFO = rilrlpinfo_tag;
+     LPRILRLPINFO = ^rilrlpinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILMSGSERVICEINFO | Messaging service settings
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilmsgserviceinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwService:DWORD;                    // @field supported service types
+       dwMsgClasses:DWORD;                 // @field supported message classes
+       dwReadLocation:DWORD;               // @field currect read location
+       dwReadUsed:DWORD;                   // @field number of fields used
+       dwReadTotal:DWORD;                  // @field total number of fields
+       dwWriteLocation:DWORD;              // @field currect read location
+       dwWriteUsed:DWORD;                  // @field number of fields used
+       dwWriteTotal:DWORD;                 // @field total number of fields
+       dwStoreLocation:DWORD;              // @field currect read location
+       dwStoreUsed:DWORD;                  // @field number of fields used
+       dwStoreTotal:DWORD;                 // @field total number of fields
+     end;
+     RILMSGSERVICEINFO = rilmsgserviceinfo_tag;
+     LPRILMSGSERVICEINFO = ^rilmsgserviceinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILMSGDCS | Message data coding scheme
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilmsgdcs_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwType:DWORD;                       // @field DCS type
+       dwFlags:DWORD;                      // @field DCS flags
+       dwMsgClass:DWORD;                   // @field message class (Only for RIL_DCSTYPE_GENERAL and RIL_DCSTYPE_MSGCLASS)
+       dwAlphabet:DWORD;                   // @field DCS alphabet
+       dwIndication:DWORD;                 // @field indication (Only for RIL_DCSTYPE_MSGWAIT)
+       dwLanguage:DWORD;                   // @field indication (Only for RIL_DCSTYPE_LANGUAGE)
+     end;
+     RILMSGDCS = rilmsgdcs_tag;
+     LPRILMSGDCS = ^rilmsgdcs_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILRANGE | Range of values
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilrange_tag = record
+       dwMinValue:DWORD;                   // @field minimum value
+       dwMaxValue:DWORD;                   // @field maximum value
+     end;
+     RILRANGE = rilrange_tag;
+     LPRILRANGE = ^rilrange_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILMSGCONFIG | Messaging configuration
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilmsgconfig_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       raSvcCtrAddress:RILADDRESS;         // @field service center address
+     end;
+     RILMSGCONFIG = rilmsgconfig_tag;
+     LPRILMSGCONFIG = ^rilmsgconfig_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCBMSGCONFIG | Cell broadcast messaging configuration
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+//#pragma warning(disable : 4200) // Disable "C4200: nonstandard extension used : zero-sized array in struct/union"
+type
+     rilcbmsgconfig_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwBroadcastMsgLangs:DWORD;          // @field broadcast message languages
+       fAccept:BOOL;                       // @field TRUE if broadcast message ranges are accepted (vs. rejected)
+       rgrrBroadcastMsgIDs:array[0..0] of RILRANGE;     // @field an array of RILRANGE IDs to set, a same min/max value specifies a single ID
+     end;
+     RILCBMSGCONFIG = rilcbmsgconfig_tag;
+     LPRILCBMSGCONFIG = ^rilcbmsgconfig_tag;
+//#pragma warning(default : 4200)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILMESSAGE | Message data
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+// @field RIL_MSGTYPE_IN_DELIVER
+     TmsgInDeliver = record
+       raOrigAddress:RILADDRESS;   // @field originating address
+       dwProtocolID:DWORD;         // @field message protocol
+       rmdDataCoding:RILMSGDCS;    // @field data coding scheme
+       stSCReceiveTime:SYSTEMTIME; // @field receive time (UTC)
+       cbHdrLength:DWORD;          // @field length of header in bytes
+       cchMsgLength:DWORD;         // @field length of body in bytes
+       rgbHdr:array[0..MAXLENGTH_HDR-1] of byte; // @field header buffer
+       rgbMsg:array[0..MAXLENGTH_MSG-1] of byte; // @field body buffer
+     end;
+
+// @field RIL_MSGTYPE_IN_STATUS
+     TmsgInStatus = record
+       dwTgtMsgReference:DWORD;    // @field target message reference
+       raTgtRecipAddress:RILADDRESS; // @field receipient address
+       stTgtSCReceiveTime:SYSTEMTIME; // @field receipient receive time (UTC)
+       stTgtDischargeTime:SYSTEMTIME; // @field receipient dischage time (UTC)
+       dwTgtDlvStatus:DWORD;       // @field delivery status
+       dwProtocolID:DWORD;         // @field message protocol
+       rmdDataCoding:RILMSGDCS;    // @field data coding scheme
+       cbHdrLength:DWORD;          // @field length of header in bytes
+       cchMsgLength:DWORD;         // @field length of body in bytes
+       rgbHdr:array[0..MAXLENGTH_HDR-1] of byte; // @field header buffer
+       rgbMsg:array[0..MAXLENGTH_MSG-1] of byte; // @field body buffer
+     end;
+
+// @field RIL_MSGTYPE_OUT_SUBMIT
+     TmsgOutSubmit = record
+       raDestAddress:RILADDRESS;   // @field destination address
+       dwProtocolID:DWORD;         // @field message protocol
+       rmdDataCoding:RILMSGDCS;    // @field data coding scheme
+       dwVPFormat:DWORD;           // @field TBD
+       stVP:SYSTEMTIME;            // @field relative validity period (values are expressed relative to the current time)
+       cbHdrLength:DWORD;          // @field length of header in bytes
+       cchMsgLength:DWORD;         // @field length of body in bytes
+       rgbHdr:array[0..MAXLENGTH_HDR-1] of byte; // @field header buffer
+       rgbMsg:array[0..MAXLENGTH_MSG-1] of byte; // @field body buffer
+     end;
+
+// @field RIL_MSGTYPE_OUT_COMMAND
+     TmsgOutCommand = record
+       dwProtocolID:DWORD;         // @field message protocol
+       dwCommandType:DWORD;        // @field command type
+       dwTgtMsgReference:DWORD;    // @field target message reference
+       raDestAddress:RILADDRESS;   // @field destination address
+       cbCmdLength:DWORD;          // @field length of command in bytes
+       rgbCmd:array[0..MAXLENGTH_CMD-1] of byte; // @field command buffer
+     end;
+
+// @field RIL_MSGTYPE_BC_GENERAL
+     TmsgBcGeneral = record
+       dwGeoScope:DWORD;           // @field message protocol
+       dwMsgCode:DWORD;            // @field message code
+       dwUpdateNumber:DWORD;       // @field update number
+       dwID:DWORD;                 // @field identity
+       rmdDataCoding:RILMSGDCS;    // @field data coding scheme
+       dwTotalPages:DWORD;         // @field total number of pages
+       dwPageNumber:DWORD;         // @field current page number
+       cchMsgLength:DWORD;         // @field length of message in bytes
+       rgbMsg:array[0..MAXLENGTH_MSG-1] of byte; // @field message buffer
+     end;
+
+// @field RIL_MSGTYPE_OUT_RAW
+     TmsgOutRaw = record
+       cchMsgLength:DWORD;         // @field length of body in bytes
+       rgbMsg:array[0..MAXLENGTH_MSG-1] of byte; // @field message buffer
+     end;
+
+// @field RIL_MSGTYPE_IN_IS637DELIVER
+     TmsgIS637InDeliver = record
+       raOrigAddress:RILADDRESS;      // @field originating address
+       rsaOrigSubaddr:RILSUBADDRESS;  // @field
+      // There is no digit-mode in incoming message because the driver can convert both of them to ASCII
+
+       stSCReceiveTime:SYSTEMTIME;    // @field (SMSC Timestamp) receive time (UTC)
+
+       stValidityPeriodAbs:SYSTEMTIME;    // @field UTC time
+       stValidityPeriodRel:SYSTEMTIME;    // @field Relative time
+       stDeferredDelTimeAbs:SYSTEMTIME;   // @field UTC time
+       stDeferredDelTimeRel:SYSTEMTIME;   // @field Relative time
+
+       dwNumMsgs:DWORD;              // @field Used for Voicemail only.  Indicates the number of Messages on Vmail
+       raCallBackNumber:RILADDRESS;       // @field (Only paging and Text -s) user can give a callback number in certain messages
+       dwMsgPriority:DWORD;          // @field RIL_MSGPRIORITY_ constant
+       dwMsgPrivacy:DWORD;           // @field RIL_MSGPRIVACYCLASS_ constant
+
+       bUserAckRequest:BOOL;            // @field 0 = Not Requested; 1 = Requested ; This is an ack from the end user
+       dwMsgDisplayMode:DWORD;           // @field RIL_MSGDISPLAYMODE_ constant
+
+       dwTeleservice:DWORD;              // @field RIL_MSGTELESERVICE_* Constant[Mandatory]
+
+       dwMsgID:DWORD;                    // @field [Mandatory] Message ID.  (0-65535) (In the WAP architecture each part of a multipart message share the same MsgID)
+       dwMsgLang:DWORD;                  // @field Under Investigation
+       dwMsgEncoding:DWORD;              // @field RIL_MSGCODING_* constant [5 bits] under Investigation
+       cchMsgLength:DWORD;               // @field length of body in bytes
+       rgbMsg:array[0..MAXLENGTH_MSG-1] of byte;      // @field body buffer
+     end;
+
+// @field RIL_MSGTYPE_OUT_IS637SUBMIT
+     TmsgIS637OutSubmit = record
+       raDestAddress:RILADDRESS;      // @field destination address
+       rsaDestSubaddr:RILSUBADDRESS;     // @field destination subaddress
+       bDigit:BOOL;             // @field specifies if the address in RILADDRESS is 4bit mode (=0) or in 8 bit mode (=1) (should be set to 1 by default)
+
+       stValidityPeriodAbs:SYSTEMTIME;    // @field UTC time
+       stValidityPeriodRel:SYSTEMTIME;    // @field Relative time
+       stDeferredDelTimeAbs:SYSTEMTIME;   // @field UTC time
+       stDeferredDelTimeRel:SYSTEMTIME;   // @field Relative time
+
+       bDeliveryAckRequest:BOOL;        // @field 0 = Not Requested; 1 = Requested ; This is an delivery ack (no user confirmation)
+       bUserAckRequest:BOOL;            // @field 0 = Not Requested; 1 = Requested ; This is an ack from the end user
+       bBearerReplyRequest:BOOL;        // @field specifies the bearer reply field is set (technically this can be set, but it should not be) ; Boolean (0=not set, 1=set)
+       dwReplySeqNumber:DWORD;           // @field the Seuqence number of the message bing replied to; (typically the MSGID)
+       dwMsgDisplayMode:DWORD;           // @field RIL_MSGDISPLAYMODE_* constant
+
+       raCallBackNumber:RILADDRESS;       // @field (Only paging and Text -s) user can give a callback number in certain messages
+
+       dwMsgPriority:DWORD;          // @field RIL_MSGPRIORITY_ constant
+       dwMsgPrivacy:DWORD;           // @field RIL_MSGPRIVACYCLASS_ constant
+
+       dwTeleservice:DWORD;              // @field RIL_MSGTELESERVICE_* Constant[Mandatory]
+
+       dwMsgID:DWORD;                    // @field [Mandatory] Message ID.  (0-65535) (In the WAP architecture each part of a multipart message share the same MsgID)
+       dwMsgLang:DWORD;                  // @field Under Investigation
+       dwMsgEncoding:DWORD;              // @field RIL_MSGCODING_* constant [5 bits] under Investigation
+       cchMsgLength:DWORD;               // @field length of body in bytes
+       rgbMsg:array[0..MAXLENGTH_MSG-1] of byte;      // @field body buffer
+     end;
+
+// @field RIL_MSGTYPE_IN_IS637STATUS
+     TmsgIS637InStatus = record
+       raOrigAddress:RILADDRESS;      // @field originating address
+       rsaOrigSubaddr:RILSUBADDRESS;     // @field
+      // There is no digit-mode in incoming message because the driver can convert both of them to ASCII
+
+       stSCReceiveTime:SYSTEMTIME;    // @field (SMSC Timestamp) receive time (UTC)
+       dwCauseCode:DWORD;        // @field Cause_Codes Under Investigation, most likely these will be implemented as RIL errors
+       dwReplySeqNumber:DWORD;   // @field The Sequence number of the message bing replied to; (typically the MSGID)
+       dwUserResponseCode:DWORD; // @field User Response Code (Carrier Specific Element when responding giving a User Ack)
+       dwMsgStatusType:DWORD;    // @field type of status message RIL_MSGSTATUSTYPE_* constant
+
+       dwMsgID:DWORD;                    // @field [Mandatory] Message ID.  (0-65535) (In the WAP architecture each part of a multipart message share the same MsgID)
+       dwMsgLang:DWORD;                  // @field Under Investigation
+       dwMsgEncoding:DWORD;              // @field RIL_MSGCODING_* constant [5 bits] under Investigation
+       cchMsgLength:DWORD;               // @field length of body in bytes
+       rgbMsg:array[0..MAXLENGTH_MSG-1] of byte;      // @field body buffer
+     end;
+
+// @field RIL_MSGTYPE_OUT_IS637STATUS
+     TmsgIS637OutStatus = record
+       raDestAddress:RILADDRESS;      // @field destination address
+       rsaDestSubaddr:RILSUBADDRESS;     // @field destination subaddress
+       bDigit:BOOL;             // @field specifies if the address in RILADDRESS is 4bit mode (=0) or in 8 bit mode (=1) (should be set to 1 by default)
+
+       dwReplySeqNumber:DWORD;           // @field The Sequence number of the message bing replied to; (typically the MSGID)
+       dwUserResponseCode:DWORD;         // @field User Response Code (Carrier Specific Element when responding giving a User Ack)
+
+       dwMsgID:DWORD;                    // @field [Mandatory] Message ID.  (0-65535) (In the WAP architecture each part of a multipart message share the same MsgID)
+       dwMsgLang:DWORD;                  // @field Under Investigation
+       dwMsgEncoding:DWORD;              // @field RIL_MSGCODING_* constant [5 bits] under Investigation
+       cchMsgLength:DWORD;               // @field length of body in bytes
+       rgbMsg:array[0..MAXLENGTH_MSG-1] of byte;      // @field body buffer
+     end;
+
+
+     rilmessage_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       raSvcCtrAddress:RILADDRESS;         // @field service center address
+       dwType:DWORD;                       // @field type of message
+       dwFlags:DWORD;                      // @field message flags
+       case longint of
+         0: (msgInDeliver:TmsgInDeliver); // @field RIL_MSGTYPE_IN_DELIVER
+         1: (msgInStatus:TmsgInStatus);   // @field RIL_MSGTYPE_IN_STATUS
+         2: (msgOutSubmit:TmsgOutSubmit); // @field RIL_MSGTYPE_OUT_SUBMIT
+         3: (msgOutCommand:TmsgOutCommand); // @field RIL_MSGTYPE_OUT_COMMAND
+         4: (msgBcGeneral:TmsgBcGeneral);   // @field RIL_MSGTYPE_BC_GENERAL
+         5: (msgOutRaw:TmsgOutRaw);         // @field RIL_MSGTYPE_OUT_RAW
+         6: (msgIS637InDeliver:TmsgIS637InDeliver); // @field RIL_MSGTYPE_IN_IS637DELIVER
+         7: (msgIS637OutSubmit:TmsgIS637OutSubmit); // @field RIL_MSGTYPE_OUT_IS637SUBMIT
+         8: (msgIS637InStatus:TmsgIS637InStatus); // @field RIL_MSGTYPE_IN_IS637STATUS
+         9: (msgIS637OutStatus:TmsgIS637OutStatus); // @field End RIL_MSGTYPE_OUT_IS637STATUS
+     end;
+     RILMESSAGE = rilmessage_tag;
+     LPRILMESSAGE = ^rilmessage_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILMESSAGE_IN_SIM | Message data in sim info
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilmessage_in_sim_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;
+       dwLocation:DWORD;                   // @field storage area (one of RIL_MSGLOC_xxxx)
+       dwIndex:DWORD;                      // @field storage index occupied by the message
+     end;
+     RILMESSAGE_IN_SIM = rilmessage_in_sim_tag;
+     LPRILMESSAGE_IN_SIM = ^rilmessage_in_sim_tag;
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILMESSAGEINFO | Message data with additional info
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilmessageinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwIndex:DWORD;                      // @field storage index occupied by the message
+       dwStatus:DWORD;                     // @field message status
+       rmMessage:RILMESSAGE;               // @field the message itself
+     end;
+     RILMESSAGEINFO = rilmessageinfo_tag;
+     LPRILMESSAGEINFO = ^rilmessageinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILEQUIPMENTINFO | Equipment info
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type                               
+     rilequipmentinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       szManufacturer:array[0..MAXLENGTH_EQUIPINFO-1] of AnsiChar; // @field manufacturer of the radio hardware
+       szModel:array[0..MAXLENGTH_EQUIPINFO-1] of AnsiChar;  // @field model of the radio hardware
+       szRevision:array[0..MAXLENGTH_EQUIPINFO-1] of AnsiChar; // @field software version of the radio stack
+       szSerialNumber:array[0..MAXLENGTH_EQUIPINFO-1] of AnsiChar; // @field equipment identity (IMEI)
+     end;
+     RILEQUIPMENTINFO = rilequipmentinfo_tag;
+     LPRILEQUIPMENTINFO = ^rilequipmentinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILEQUIPMENTSTATE | Equipment state
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilequipmentstate_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwRadioSupport:DWORD;               // @field RIL_RADIOSUPPORT_* Parameter
+       dwEqState:DWORD;                    // @field RIL_EQSTATE_* Parameter
+       dwReadyState:DWORD;                 // @field RIL_READYSTATE_* Parameter
+     end;
+     RILEQUIPMENTSTATE = rilequipmentstate_tag;
+     LPRILEQUIPMENTSTATE = ^rilequipmentstate_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILPHONEBOOKINFO | Phonebook settings
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilphonebookinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwStoreLocation:DWORD;              // @field location of phonebook memory
+       dwUsed:DWORD;                       // @field number of locations used
+       dwTotal:DWORD;                      // @field total number of phonebook locations
+     end;
+     RILPHONEBOOKINFO = rilphonebookinfo_tag;
+     LPRILPHONEBOOKINFO = ^rilphonebookinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILPHONEBOOKENTRY | A single phonebook entry
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilphonebookentry_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwIndex:DWORD;                      // @field index of the entry
+       raAddress:RILADDRESS;               // @field the stored address
+       wszText:array[0..MAXLENGTH_PHONEBOOKTEXT-1] of WCHAR; // @field assciated text
+     end;
+     RILPHONEBOOKENTRY = rilphonebookentry_tag;
+     LPRILPHONEBOOKENTRY = ^rilphonebookentry_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILATRINFO | Answer to Reset information
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilatrinfo_tag = record
+       cbSize:DWORD;
+       dwParams:DWORD;
+       dwPhase:DWORD;
+       cbATRSize:DWORD;
+       rgbATR:array[0..MAXLENGTH_ATR-1] of byte;
+     end;
+     RILATRINFO = rilatrinfo_tag;
+     LPRILATRINFO = ^rilatrinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILSIMTOOLKITEVENTCAPS | SIM TOOLKIT EVENT LIST CAPABILITIES
+//
+// @comm This structure indicates who implements the various SIM ToolKit Events
+//
+// -----------------------------------------------------------------------------
+type
+     rilsimtoolkiteventcaps_tag =record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwMTCall:DWORD;                     // @constdefine TBD
+       dwCallConnected:DWORD;              // @constdefine TBD
+       dwCallDisconnected:DWORD;           // @constdefine TBD
+       dwLocationStatus:DWORD;             // @constdefine TBD
+       dwUserActivity:DWORD;               // @constdefine TBD
+       dwIdleScreen:DWORD;                 // @constdefine TBD
+       dwLanguageSelection:DWORD;          // @constdefine TBD
+       dwBrowserTermination:DWORD;         // @constdefine TBD
+       dwDataAvailable:DWORD;              // @constdefine TBD
+       dwChannelStatus:DWORD;              // @constdefine TBD
+       dwDisplayChange:DWORD;              // @constdefine TBD
+     end;
+     RILSIMTOOLKITEVENTCAPS = rilsimtoolkiteventcaps_tag;
+     LPRILSIMTOOLKITEVENTCAPS = ^rilsimtoolkiteventcaps_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILSIMTOOLKITNOTIFYCAPS | SIM TOOLKIT NOTIFY CAPABILITIES
+//
+// @comm This structure indicates who implements the various SIM ToolKit Notifications
+//
+// -----------------------------------------------------------------------------
+type
+     rilsimtoolkitnotifycaps_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwRefresh:DWORD;                    // @constdefine TBD
+       dwMoreTime:DWORD;                   // @constdefine TBD
+       dwPollInterval:DWORD;               // @constdefine TBD
+       dwPollingOff:DWORD;                 // @constdefine TBD
+       dwSetUpCall:DWORD;                  // @constdefine TBD
+       dwSendSS:DWORD;                     // @constdefine TBD
+       dwSendUSSD:DWORD;                   // @constdefine TBD
+       dwSendSMS:DWORD;                    // @constdefine TBD
+       dwPlayTone:DWORD;                   // @constdefine TBD
+       dwDisplayText:DWORD;                // @constdefine TBD
+       dwGetInkey:DWORD;                   // @constdefine TBD
+       dwGetInput:DWORD;                   // @constdefine TBD
+       dwSelectItem:DWORD;                 // @constdefine TBD
+       dwSetupMenu:DWORD;                  // @constdefine TBD
+       dwSetupIdleModeText:DWORD;          // @constdefine TBD
+       dwLocalInfo:DWORD;                  // @constdefine TBD
+       dwNotifyFlags:DWORD;                // @combination of RIL_CAPS_NOTIFY_* flags
+       dwSetupEventList:DWORD;             // @constdefine TBD
+       dwSendDTMF:DWORD;                   // @constdefine TBD
+       dwLaunchBrowser:DWORD;              // @constdefine TBD
+       dwOpenChannel:DWORD;                // @constdefine TBD
+       dwCloseChannel:DWORD;               // @constdefine TBD
+       dwReceiveData:DWORD;                // @constdefine TBD
+       dwSendData:DWORD;                   // @constdefine TBD
+       dwTimerManagement:DWORD;            // @constdefine TBD
+       dwRunAtCmd:DWORD;                   // @constdefine TBD
+       rstecEvents:RILSIMTOOLKITEVENTCAPS; // @constdefine TBD
+     end;
+     RILSIMTOOLKITNOTIFYCAPS = rilsimtoolkitnotifycaps_tag;
+     LPRILSIMTOOLKITNOTIFYCAPS = ^rilsimtoolkitnotifycaps_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILSIMTOOLKITCMD | SIM toolkit command details.
+
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilsimtoolkitcmd_tag = record
+       cbSize:DWORD;
+       dwParams:DWORD;
+       dwId:DWORD;
+       dwTag:DWORD;
+       dwType:DWORD;
+       dwQualifier:DWORD;
+       dwError:DWORD;
+       dwDetailsOffset:DWORD;
+       dwDetailsSize:DWORD;
+     end;
+     RILSIMTOOLKITCMD = rilsimtoolkitcmd_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILSIMTOOLKITRSP | Response to a SIM toolkit command.
+
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilsimtoolkitrsp_tag = record
+       cbSize:DWORD;
+       dwParams:DWORD;
+       dwId:DWORD;
+       dwTag:DWORD;
+       dwType:DWORD;
+       dwQualifier:DWORD;
+       dwResponse:DWORD;
+       dwAdditionalInfo:DWORD;
+     end;
+     RILSIMTOOLKITRSP = rilsimtoolkitrsp_tag;
+     LPRILSIMTOOLKITRSP = rilsimtoolkitrsp_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILSIMCMDPARAMETERS | Parameters for a restricted SIM command
+
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilsimcmdparameters_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwFileID:DWORD;                     // @field SIM file ID
+       dwParameter1:DWORD;                 // @field parameter specific to SIM command
+       dwParameter2:DWORD;                 // @field parameter specific to SIM command
+       dwParameter3:DWORD;                 // @field parameter specific to SIM command
+     end;
+     RILSIMCMDPARAMETERS = rilsimcmdparameters_tag;
+     LPRILSIMCMDPARAMETERS = ^rilsimcmdparameters_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILSIMRESPONSE | Response to a restrcited SIM command
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+//#pragma warning(disable : 4200) // Disable "C4200: nonstandard extension used : zero-sized array in struct/union"
+type
+     rilsimresponse_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwStatusWord1:DWORD;                // @field return parameter specific to SIM command
+       dwStatusWord2:DWORD;                // @field return parameter specific to SIM command
+       pbResponse:array[0..0] of byte;                  // @field additional bytes of response data
+     end;
+     RILSIMRESPONSE = rilsimresponse_tag;
+     LPRILSIMRESPONSE = ^rilsimresponse_tag;
+//#pragma warning(default : 4200)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILSIMRECORDSTATUS | Response to a restrcited SIM command
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilsimrecordstatus_tag = record
+       cbSize:DWORD;                           // @field Size of the structure in bytes
+       dwParams:DWORD;                         // @field Indicates valid parameter values
+       dwRecordType:DWORD;                     // @field RIL_SIMRECORDTYPE_* Constant
+       dwItemCount:DWORD;                      // @field Number of items in the record
+       dwSize:DWORD;                           // @field Size in bytes of each item
+     end;
+     RILSIMRECORDSTATUS = rilsimrecordstatus_tag;
+     LPRILSIMRECORDSTATUS = ^rilsimrecordstatus_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCOSTINFO | Service cost info
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcostinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwCCM:DWORD;                        // @field current call meter
+       dwACM:DWORD;                        // @field accumulated call meter
+       dwMaxACM:DWORD;                     // @field maximum accumulated call meter
+       dwCostPerUnit:DWORD;                // @field cost per unit, in 16.16 fixed point
+       wszCurrency:array[0..MAXLENGTH_CURRENCY-1] of WCHAR; // @field current currency
+     end;
+     RILCOSTINFO = rilcostinfo_tag;
+     LPRILCOSTINFO = ^rilcostinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILSIGNALQUALITY | Signal quality info
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilsignalquality_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       nSignalStrength:longint;            // @field TBD
+       nMinSignalStrength:longint;         // @field TBD
+       nMaxSignalStrength:longint;         // @field TBD
+       dwBitErrorRate:DWORD;               // @field bit error rate in 1/100 of a percent
+       nLowSignalStrength:longint;         // @field TBD
+       nHighSignalStrength:longint;        // @field TBD
+     end;
+     RILSIGNALQUALITY = rilsignalquality_tag;
+     LPRILSIGNALQUALITY = ^rilsignalquality_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCELLTOWERINFO | Cell tower info
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcelltowerinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwMobileCountryCode:DWORD;          // @field TBD
+       dwMobileNetworkCode:DWORD;          // @field TBD
+       dwLocationAreaCode:DWORD;           // @field TBD
+       dwCellID:DWORD;                     // @field TBD
+       dwBaseStationID:DWORD;              // @field TBD
+       dwBroadcastControlChannel:DWORD;    // @field TBD
+       dwRxLevel:DWORD;                    // @field Value from 0-63 (see GSM 05.08, 8.1.4)
+       dwRxLevelFull:DWORD;                // @field Value from 0-63 (see GSM 05.08, 8.1.4)
+       dwRxLevelSub:DWORD;                 // @field Value from 0-63 (see GSM 05.08, 8.1.4)
+       dwRxQuality:DWORD;                  // @field Value from 0-7  (see GSM 05.08, 8.2.4)
+       dwRxQualityFull:DWORD;              // @field Value from 0-7  (see GSM 05.08, 8.2.4)
+       dwRxQualitySub:DWORD;               // @field Value from 0-7  (see GSM 05.08, 8.2.4)
+       dwIdleTimeSlot:DWORD;               // @field TBD
+       dwTimingAdvance:DWORD;              // @field TBD
+       dwGPRSCellID:DWORD;                 // @field TBD
+       dwGPRSBaseStationID:DWORD;          // @field TBD
+       dwNumBCCH:DWORD;                    // @field TBD
+       rgbBCCH:array[0..MAXLENGTH_BCCH-1] of byte;       // @field TBD
+       rgbNMR:array[0..MAXLENGTH_NMR-1] of byte;         // @field TBD
+     end;
+     RILCELLTOWERINFO = rilcelltowerinfo_tag;
+     LPRILCELLTOWERINFO = ^rilcelltowerinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILREMOTEPARTYINFO | Incoming call info
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilremotepartyinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       raAddress:RILADDRESS;               // @field address of caller
+       rsaSubAddress:RILSUBADDRESS;        // @field subaddress of caller
+       wszDescription:array[0..MAXLENGTH_DESCRIPTION-1] of WCHAR; // @field text associated with caller
+       dwValidity:DWORD;                   // @field indicates validity of caller info
+     end;
+     RILREMOTEPARTYINFO = rilremotepartyinfo_tag;
+     LPRILREMOTEPARTYINFO = ^rilremotepartyinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCALLWAITINGINFO | Call waiting info
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcallwaitinginfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwCallType:DWORD;                   // @field type of call
+       dwAddressId:DWORD;                  // @field indicates address ID on which the incoming call arrived (if available)
+       rrpiCallerInfo:RILREMOTEPARTYINFO;  // @field caller information
+     end;
+     RILCALLWAITINGINFO = rilcallwaitinginfo_tag;
+     LPRILCALLWAITINGINFO = ^rilcallwaitinginfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILINTERMEDIATESSINFO | Intermediate Supplemenary Service Info
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilintermediatessinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwNotificationCode:DWORD;           // @field indicates type of notification
+       dwCallUserGroupIndex:DWORD;         // @field indicates the CUG Index
+     end;
+     RILINTERMEDIATESSINFO = rilintermediatessinfo_tag;
+     LPRILINTERMEDIATESSINFO = ^rilintermediatessinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILUNSOLICITEDSSINFO | Unsolicited Supplemenary Service Info
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilunsolicitedssinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwNotificationCode:DWORD;           // @field indicates type of notification
+       dwCallUserGroupIndex:DWORD;         // @field indicates the CUG Index
+       raAddress:RILADDRESS;               // @field call address
+       rsaSubAddress:RILSUBADDRESS;        // @field subaddress
+     end;
+     RILUNSOLICITEDSSINFO = rilunsolicitedssinfo_tag;
+     LPRILUNSOLICITEDSSINFO = ^rilunsolicitedssinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILSERVICEINFO | Connection service information
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilserviceinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       fSynchronous:BOOL;                  // @field TRUE if connection service is synchronous, FALSE if asynchronous
+       fTransparent:BOOL;                  // @field TRUE if connection service is transparent, FALSE if non-transparent
+     end;
+     RILSERVICEINFO = rilserviceinfo_tag;
+     LPRILSERVICEINFO = ^rilserviceinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILRINGINFO | Ring information
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilringinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwCallType:DWORD;                   // @field type of the offered call (<def RIL_CALLTYPE_> constant)
+       dwAddressId:DWORD;                  // @field indicates address ID on which the incoming call arrived (if available)
+       rsiServiceInfo:RILSERVICEINFO;      // @field data connection service information (set only for <def RIL_CALLTYPE_DATA>)
+     end;
+     RILRINGINFO = rilringinfo_tag;
+     LPRILRINGINFO = ^rilringinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILDIALINFO | Ring information
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rildialinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       hrCmdId:HRESULT;                    // @field handle of call being dialed
+       dwCallId:DWORD;                     // @field id of call being dialed
+     end;
+     RILDIALINFO = rildialinfo_tag;
+     LPRILDIALINFO = ^rildialinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCONNECTINFO | Connection info
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilconnectinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwCallType:DWORD;                   // @field type of the established connection (<def RIL_CALLTYPE_> constant)
+       dwBaudRate:DWORD;                   // @field Baud rate of the established connection (set only for <def RIL_CALLTYPE_DATA>)
+     end;
+     RILCONNECTINFO = rilconnectinfo_tag;
+     LPRILCONNECTINFO = ^rilconnectinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILMSGSTORAGEINFO | Message storage locations
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilmsgstorageinfo_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwReadLocation:DWORD;               // @field current read location
+       dwWriteLocation:DWORD;              // @field current write location
+       dwStoreLocation:DWORD;              // @field current store location
+     end;
+     RILMSGSTORAGEINFO = rilmsgstorageinfo_tag;
+     LPRILMSGSTORAGEINFO = ^rilmsgstorageinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILSUPSERVICEDATA | Supplementary service data
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+//#pragma warning(disable : 4200) // Disable "C4200: nonstandard extension used : zero-sized array in struct/union"
+type
+     rilsupservicedata_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwStatus:DWORD;                     // @field additional status for message
+       pbData:array[0..0] of byte;                      // @field message itself
+     end;
+     RILSUPSERVICEDATA = rilmsgstorageinfo_tag;
+     LPRILSUPSERVICEDATA = ^rilmsgstorageinfo_tag;
+//#pragma warning(default : 4200)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCAPSDIAL | Dialing capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcapsdial_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwCallTypes:DWORD;                  // @field type of call being placed
+       dwOptions:DWORD;                    // @field dialing options
+     end;
+     RILCAPSDIAL = rilcapsdial_tag;
+     LPRILCAPSDIAL = ^rilcapsdial_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCAPSBEARERSVC | Bearer service capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcapsbearersvc_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwSpeeds1:DWORD;                    // @field TBD
+       dwSpeeds2:DWORD;                    // @field TBD
+       dwServiceNames:DWORD;               // @field TBD
+       dwConnectionElements:DWORD;         // @field TBD
+     end;
+     RILCAPSBEARERSVC = rilcapsbearersvc_tag;
+     LPRILCAPSBEARERSVC = ^rilcapsbearersvc_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCAPSRLP | Radio Link Protocol capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcapsrlp_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwVersion:DWORD;                    // @field TBD
+       rrIWSRange:RILRANGE;                // @field TBD
+       rrMWSRange:RILRANGE;                // @field TBD
+       rrAckTimerRange:RILRANGE;           // @field TBD
+       rrRetransmissionAttsRange:RILRANGE; // @field TBD
+       rrReseqPeriodRange:RILRANGE;        // @field TBD
+     end;
+     RILCAPSRLP = rilcapsrlp_tag;
+     LPRILCAPSRLP = ^rilcapsrlp_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCAPSMSGMEMORYLOCATIONS | Message memory location capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcapsmsgmemorylocations_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwReadLocations:DWORD;              // @field supported read locations
+       dwWriteLocations:DWORD;             // @field supported write locations
+       dwStoreLocations:DWORD;             // @field supported store locations
+     end;
+     RILCAPSMSGMEMORYLOCATIONS = rilcapsmsgmemorylocations_tag;
+     LPRILCAPSMSGMEMORYLOCATIONS = ^rilcapsmsgmemorylocations_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCAPSLOCKINGPWDLENGTH | Locking password length capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcapslockingpwdlength_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwFacility:DWORD;                   // @field the locking facility
+       dwPasswordLength:DWORD;             // @field maximum password length
+     end;
+     RILCAPSLOCKINGPWDLENGTH = rilcapslockingpwdlength_tag;
+     LPRILCAPSLOCKINGPWDLENGTH = ^rilcapslockingpwdlength_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCAPSBARRINGPWDLENGTH | Call barring password length capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcapsbarringpwdlength_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwType:DWORD;                       // @field type of call barring
+       dwPasswordLength:DWORD;             // @field maximum password length
+     end;
+     RILCAPSBARRINGPWDLENGTH = rilcapsbarringpwdlength_tag;
+     LPRILCAPSBARRINGPWDLENGTH = ^rilcapsbarringpwdlength_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCAPSDATACOMPRESSION | Data compression capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcapsdatacompression_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwDirection:DWORD;                  // @field indicates supported direction values
+       dwNegotiation:DWORD;                // @field indicates supported negotiation values
+       rrMaxDict:RILRANGE;                 // @field range of supported max_dict values
+       rrMaxString:RILRANGE;               // @field range of supported max_string values
+     end;
+     RILCAPSDATACOMPRESSION = rilcapsdatacompression_tag;
+     LPRILCAPSDATACOMPRESSION = ^rilcapsdatacompression_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILERRORCORRECTIONINFO | Error correction settings
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcapserrorcorrection_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwOriginalRequest:DWORD;            // @field indicates supported originator request values
+       dwOriginalFallback:DWORD;           // @field indicates supported originator fallback values
+       dwAnswererFallback:DWORD;           // @field indicates supported answerer fallback values
+     end;
+     RILCAPSERRORCORRECTION = rilcapserrorcorrection_tag;
+     LPRILCAPSERRORCORRECTION = ^rilcapserrorcorrection_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCAPSHSCSD | High Speed Circuit Switched Data capabilities
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcapshscsd_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwMultislotClass:DWORD;             // @field multislot class supported
+       dwMaxRxTimeslots:DWORD;             // @field maximum number of receive timeslots
+       dwMaxTxTimeslots:DWORD;             // @field maximum number of transmit timeslots
+       dwMaxTotalTimeslots:DWORD;          // @field maximum number of total timeslots
+       dwChannelCodings:DWORD;             // @field supported channel codings
+       dwAirInterfaceUserRates:DWORD;      // @field supported air interfacerates
+       rrTopRxTimeslotRange:RILRANGE;      // @field TBD
+     end;
+     RILCAPSHSCSD = rilcapshscsd_tag;
+     LPRILCAPSHSCSD = ^rilcapshscsd_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILCAPSPBENTRYLENGTH | Phone book entry length maximum values
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilcapspbentrylength_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwMaxAddressLength:DWORD;           // @field maximum length of the phone number portion
+       dwMaxTextLength:DWORD;              // @field maximum length of the text portion
+     end;
+     RILCAPSPBENTRYLENGTH = rilcapspbentrylength_tag;
+     LPRILCAPSPBENTRYLENGTH = ^rilcapspbentrylength_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILGPRSPROTOCOLCAPS | General Packet Radio Service capabilities
+//
+// @comm TBDTBD
+//
+// -----------------------------------------------------------------------------
+//#pragma warning(disable : 4200) // Disable "C4200: nonstandard extension used : zero-sized array in struct/union"
+type
+     rilgprscontextcaps_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes (padded to DWORD)
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwProtocolType:DWORD;               // @field a RIL_GPRSPROTOCOL_* constant
+       ContextIDRange:RILRANGE;                 // @field min/max context ids
+       dwDataCompression:DWORD;            // @field valid data compression values
+       dwHeaderCompression:DWORD;          // @field valid header compression values
+       dwParameterLength:DWORD;           // @field length of parameters list in bytes
+       szParameters:array[0..0] of AnsiChar;               // @field valid string parameters of this prococol type, delimited by \0, with final param terminated by \0\0
+     end;
+     RILGPRSCONTEXTCAPS = rilgprscontextcaps_tag;
+     LPRILGPRSCONTEXTCAPS = ^rilgprscontextcaps_tag;
+//#pragma warning(default : 4200)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILGPRSCONTEXT | A PDP Context represents a certain configuration for
+//         packet data communication.
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+//#pragma warning(disable : 4200) // Disable "C4200: nonstandard extension used : zero-sized array in struct/union"
+type
+     rilgprscontext_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwContextID:DWORD;                  // @field the context number
+       dwProtocolType:DWORD;               // @field a RIL_GPRSPROTOCOL_*constant
+       wszAccessPointName:array[0..MAXLENGTH_GPRSACCESSPOINTNAME-1] of WCHAR; // @field a logical name to select the gateway gprs
+                                                                              //  (which defines the external packet data network to use)
+       wszAddress:array[0..MAXLENGTH_GPRSADDRESS-1] of WCHAR; // @field the packet address to use (if null, request dynamic)
+       dwDataCompression:DWORD;             // @field a RIL_GPRSDATACOMP_*
+       dwHeaderCompression:DWORD;           // @field a RIL_GPRSHEADERCOMP_*
+       dwParameterLength:DWORD;            // @field length of parameters list
+       szParameters:array[0..0] of AnsiChar;              // @field parameters specific to the prococol type
+     end;
+     RILGPRSCONTEXT = rilgprscontext_tag;
+     LPRILGPRSCONTEXT = ^rilgprscontext_tag;
+//#pragma warning(default : 4200)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILGPRSPROTOCOLCAPS | General Packet Radio Service capabilities
+//
+// @comm TBDTBD
+//
+// -----------------------------------------------------------------------------
+//#pragma warning(disable : 4200) // Disable "C4200: nonstandard extension used : zero-sized array in struct/union"
+type
+     rilgprsqosprofilecaps_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes (padded to DWORD)
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwProtocolType:DWORD;               // @field a RIL_GPRSPROTOCOL_* constant
+       dwPrecedenceClass:DWORD;            // @field valid RIL_GPRSPRECEDENCECLASS_* constants
+       dwDelayClass:DWORD;                 // @field valid RIL_GPRSDELAYCLASS_* constants
+       dwReliabilityClass:DWORD;           // @field valid RIL_GPRSRELIABILITYCLASS_* constants
+       dwPeakThruClass:DWORD;              // @field valid RIL_GPRSPEAKTHRUCLASS_* constants
+       dwMeanThruClass:DWORD;              // @field valid RIL_GPRSMEANTHRUCLASS_* constants
+     end;
+     RILGPRSQOSPROFILECAPS = rilgprsqosprofilecaps_tag;
+     LPRILGPRSQOSPROFILECAPS = ^rilgprsqosprofilecaps_tag;
+//#pragma warning(default : 4200)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILGPRSQOSPROFILE | A quality of service profile
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilgprsqosprofile_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwParams:DWORD;                     // @field indicates valid parameters
+       dwContextID:DWORD;                  // @field the context number
+       dwPrecedenceClass:DWORD;            // @field a RIL_GPRSPRECEDENCECLASS_* constant
+       dwDelayClass:DWORD;                 // @field a RIL_GPRSDELAYCLASS_* constant
+       dwReliabilityClass:DWORD;           // @field a RIL_GPRSRELIABILITYCLASS_* constant
+       dwPeakThruClass:DWORD;              // @field a RIL_GPRSPEAKTHRUCLASS_* constant
+       dwMeanThruClass:DWORD;              // @field a RIL_GPRSMEANTHRUCLASS_* constant
+     end;
+     RILGPRSQOSPROFILE = rilgprsqosprofile_tag;
+     LPRILGPRSQOSPROFILE = ^rilgprsqosprofile_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILGPRSANSWER | A quality of service profile
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+//#pragma warning(disable : 4200) // Disable "C4200: nonstandard extension used : zero-sized array in struct/union"
+type
+     rilgprsanswer_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       fAnswer:BOOL;                       // @parm TRUE: accept, FALSE: reject
+       dwL2Protocol:DWORD;                 // @parm an optional RILL2PROTOCOL_* constant
+       dwNumContexts:DWORD;                // @parm number of contexts which follow
+       dwContextID:array[0..0] of DWORD;               // @parm identifies the context(s) to enter data state
+     end;
+     RILGPRSANSWER = rilgprsanswer_tag;
+     LPRILGPRSANSWER = ^rilgprsanswer_tag;
+//#pragma warning(default : 4200)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILENTERGPRSDATAMODE | A quality of service profile
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+//#pragma warning(disable : 4200) // Disable "C4200: nonstandard extension used : zero-sized array in struct/union"
+type
+     rilentergprsdatamode_tag = record
+       cbSize:DWORD;                       // @field structure size in bytes
+       dwL2Protocol:DWORD;                 // @parm an optional RILL2PROTOCOL_* constant
+       dwNumContexts:DWORD;                // @parm number of contexts which follow
+       dwContextID:array[0..0] of DWORD;               // @parm identifies the context(s) to enter data state
+     end;
+     RILENTERGPRSDATAMODE = rilentergprsdatamode_tag;
+     LPRILENTERGPRSDATAMODE = ^rilentergprsdatamode_tag;
+//#pragma warning(default : 4200)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILLOCATIONINFO | Contains network location information
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rillocationinfo_tag = record
+       cbSize:DWORD;           // @field structure size in bytes
+       dwLocationAreaCode:DWORD;      // @field the context number
+       dwCellID:DWORD;      // @field the context number
+     end;
+     RILLOCATIONINFO = rillocationinfo_tag;
+     LPRILLOCATIONINFO = ^rillocationinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILGPRSCONTEXTACTIVATED | Shows which contexts are active
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilgprscontextactivated_tag = record
+       cbSize:DWORD;          // @field structure size in bytes
+       dwEvent:DWORD;         // @field the disconnection event type: RIL_PARAM_RILGPRSCONTEXTACTIVATED_ (applies to deactivation)
+       dwContextID:DWORD;     // @field the context number
+       fActivated:BOOL;       // @field whether the context is activated
+     end;
+     RILGPRSCONTEXTACTIVATED = rilgprscontextactivated_tag;
+     LPRILGPRSCONTEXTACTIVATED = ^rilgprscontextactivated_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILLOGATCOMMAND | Contains inbound and outbound AT commands/responses
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rillogatinfo_tag = record
+       cbSize:DWORD;                // @field structure size in bytes
+       cbLength:DWORD;              // @field command buffer length
+       szRsp:array[0..MAXLENGTH_CMD-1] of byte;   // @field command buffer
+       fResponse:BOOL;               // @field TRUE if szRsp contains a response; FALSE if szRsp contains a command
+     end;
+     RILLOGATINFO = rillogatinfo_tag;
+     LPRILLOGATINFO = ^rillogatinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILNDISIPV6ADDR | Encapsulates an IPv6 address.
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      IPV6_ADDRESS_LENGTH             = 16;
+      IPV6_ADDRESS_LENGTH_IN_UCHAR    = IPV6_ADDRESS_LENGTH;
+      IPV6_ADDRESS_LENGTH_IN_USHORT   = IPV6_ADDRESS_LENGTH div 2;
+
+type
+     rilndisipv6addr_tag = record
+       case USHORT of
+         0: (_Byte:array[0..IPV6_ADDRESS_LENGTH_IN_UCHAR-1] of UCHAR);
+         1: (_Word:array[0..IPV6_ADDRESS_LENGTH_IN_USHORT-1] of USHORT);
+     end;
+     RILNDISIPV6ADDR = rilndisipv6addr_tag;
+     LPRILNDISIPV6ADDR = ^rilndisipv6addr_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILNDISIPCONFIG | returned in association with  RIL_NOTIFY_NDIS_IPCONFIG
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     Tipv4 = record
+       dwFlags:DWORD;           // @field bitfield of valid in_addr parameters defined by RIL_PARAM_NDISIPCONFIG_xxx
+       inIPAddress:DWORD;
+       inPrimaryDNS:DWORD;
+       inSecondaryDNS:DWORD;
+       inDefaultGateway:DWORD;
+       inSubnetMask:DWORD;
+     end;
+
+     Tipv6 = record
+       dwFlags:DWORD;           // @field bitfield of valid in_addr parameters defined by RIL_PARAM_NDISIPCONFIG_IPV6_xxx
+       inIPAddress:RILNDISIPV6ADDR;
+       inPrimaryDNS:RILNDISIPV6ADDR;
+       inSecondaryDNS:RILNDISIPV6ADDR;
+       inDefaultGateway:RILNDISIPV6ADDR;
+       inSubnetMask:RILNDISIPV6ADDR;
+       dwFlowInfo:DWORD;
+       dwScopeId:DWORD;
+     end;
+
+     rilndisipconfig_tag = record
+       cbSize:DWORD;                    // @field structure size in bytes
+       dwContextId:DWORD;
+       dwProtocol:DWORD;                // @field discriminator for the union field; defined by RIL_PARAM_NDISIPCONFIG_PROTOCOL_*
+       case DWORD of
+         0: (ipv4:Tipv4);
+         1: (ipv6:Tipv6);
+     end;
+     RILNDISIPCONFIG = rilndisipconfig_tag;
+     LPRILNDISIPCONFIG = ^rilndisipconfig_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILNDISBUFFER | Buffer defintion for use in rildndispacket_tag below.
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilndisbuffer_tag = record
+       pbyBytes:LPBYTE;                            // @field Pointer to the buffer
+       cByteCount:DWORD;                            // @field Number of bytes pointed to by pbyBytes.
+     end;
+     RILNDISBUFFER = rilndisbuffer_tag;
+     LPRILNDISBUFFER = ^rilndisbuffer_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILNDISPACKET |
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilndispacket_tag = record
+       dwContextId:DWORD;
+       dwSize:DWORD;
+       cBufferCount:DWORD;
+       NDISBuffer:array[0..0] of RILNDISBUFFER;
+     end;
+     RILNDISPACKET = rilndispacket_tag;
+     LPRILNDISPACKET = ^rilndispacket_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILNDISSTATUS |
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilndisstatus_tag = record
+       dwContextId:DWORD;    // @parm GPRS context identifier reporting status
+       dwSize:DWORD;         // @parm size of this struct.
+       dwStatusType:DWORD;   // @parm RIL_PARAM_RILNDISSTATUS_ type
+       case longint of
+         0: (pRilNdisIpConfig:LPRILNDISIPCONFIG);  // @parm points to data
+         1: (dwFlowControl:DWORD);                  // @parm flow control RIL_NDIS_XON or RIL_NDIS_XOFF
+     end;
+     RILNDISSTATUS = rilndisstatus_tag;
+     LPRILNDISSTATUS = ^rilndisstatus_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func RIL NDIS receive packet callback
+//
+// @comm This function is called to when an IP packet is received by the
+//       RIL driver.
+//
+// -----------------------------------------------------------------------------
+type
+     RILNDISRECEIVECALLBACK = procedure(pCallbackContext:PVOID;     // @parm parameter passed to <f RIL_NDIS_SetGPRSContextActivated>
+                                        pRilPacket:LPRILNDISPACKET     // @parm ponter to received packet
+                                       ); cdecl;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func RIL NDIS transmit packet callback
+//
+// @comm This function is called to when an IP packet is sent by the
+//       RIL driver.
+//
+// -----------------------------------------------------------------------------
+type
+     RILNDISTRANSMITCALLBACK = procedure(pCallbackContext:PVOID;     // @parm parameter passed to <f RIL_NDIS_SetGPRSContextActivated>
+                                         pRilPacket:LPRILNDISPACKET     // @parm ponter to received packet
+                                        ); cdecl;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func RIL NDIS status callback
+//
+// @comm This function is called to when a NDIS packet IO status change occurred in the
+//       RIL driver.
+//
+// -----------------------------------------------------------------------------
+type
+     RILNDISSTATUSCALLBACK = procedure(pCallbackContext:PVOID;     // @parm parameter passed to <f RIL_NDIS_SetGPRSContextActivated>
+                                       pRilStatus:LPRILNDISSTATUS     // @parm ponter to received packet
+                                      ); cdecl;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func RIL NDIS Receive Packet Done callback
+//
+// @comm This function may optionally be used to release packets from the WWAN interface.
+//
+// -----------------------------------------------------------------------------
+type
+     PFNRILNDISRECEIVEPACKETDONE = procedure(lpPacketReceived:LPRILNDISPACKET); cdecl;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func RIL NDIS Send Packet callback
+//
+// @comm This function may optionally be used to send NDIS packets from the WWAN interface.
+//
+// -----------------------------------------------------------------------------
+type
+     PFNRILNDISSENDPACKET = procedure(lpPacketToSend:LPRILNDISPACKET); cdecl;
+
+const
+      NDIS_GPRS_PASSWORD_MAX_LENGTH = 64;
+      NDIS_GPRS_USERNAME_MAX_LENGTH = 64;
+      NDIS_GRPS_DNS_MAX_LENGTH      = 64;
+      
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILNDISGPRSCONTEXT |
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+
+type
+     rilndisgprscontext_tag = record
+       cbSize:DWORD;             // @field structure size in bytes
+       dwParams:DWORD;           // @field indicates valid parameters
+       dwContextID:DWORD;        // @field identifies the context
+       fContextActivation:BOOL; // @field TRUE: activated, FALSE: deactivated
+       tszUserName:array[0..NDIS_GPRS_USERNAME_MAX_LENGTH-1] of TCHAR;      // @field Context activation user name
+       tszPassword:array[0..NDIS_GPRS_PASSWORD_MAX_LENGTH-1] of TCHAR;      // @field Context activation password
+       tszDNS1:array[0..NDIS_GRPS_DNS_MAX_LENGTH-1] of TCHAR;               // @field Context activation DNS1
+       tszDNS2:array[0..NDIS_GRPS_DNS_MAX_LENGTH-1] of TCHAR;               // @fielf Context activation DNS2
+       pfnNdisReceive:RILNDISRECEIVECALLBACK;   // @parm function NDIS Rx packet callback
+       pfnNdisTransmit:RILNDISTRANSMITCALLBACK;   // @parm function NDIS Tx packet callback
+       pfnNdisStatus:RILNDISSTATUSCALLBACK;     // @parm function NDIS status callback
+       pCallbackContext:PVOID;               // @parm custom parameter passed to NDIS Rx packet callback
+     end;
+     RILNDISGPRSCONTEXT = rilndisgprscontext_tag;
+     LPRILNDISGPRSCONTEXT = ^rilndisgprscontext_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILNDISGPRSCONTEXTRESPONSE |
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+
+type
+     rilndisgprscontextresponse_tag = record
+       cbSize:DWORD;             // @field structure size in bytes
+       dwParams:DWORD;           // @field RIL_PARAM_RILNDISGPRSCONTEXTRESPONSE_
+       dwContextID:DWORD;        // @field identifies the context
+       dwError:DWORD;            // @field error during activation.
+       pfnNdisSendPacket:PFNRILNDISSENDPACKET;        // @parm function NDIS Send Packet
+       pfnNdisReceivePacketDone:PFNRILNDISRECEIVEPACKETDONE;    // @parm function NDIS Receive Packet Done.
+       RilNdisIPConfig:RILNDISIPCONFIG; //@parm IP configuration data obtained during activation.
+     end;
+     RILNDISGPRSCONTEXTRESPONSE = rilndisgprscontextresponse_tag;
+     LPRILNDISGPRSCONTEXTRESPONSE = ^rilndisgprscontextresponse_tag;
+
+type
+     RILNDISSETGPRSCONTEXTACTIVATED = RILNDISGPRSCONTEXT;
+     LPRILNDISSETGPRSCONTEXTACTIVATED = LPRILNDISGPRSCONTEXT;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILNITZINFO |
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilnitzinfo_tag = record
+       cbSize:DWORD;             // size of this struct.
+       dwParams:DWORD;           // valid fields RIL_PARAM_NITZ_
+       dwNotificationCode:DWORD; // type of notifcation RIL_NOTIFY_NITZ
+       TimeZoneOffsetMinutes:longint;// Indicates the time zone offset +/-
+       DaylightSavingOffsetMinutes:longint; // Indicates the daylight saving offset in minutes
+       SysTime:SYSTEMTIME;        // If available from network
+     end;
+     RILNITZINFO = rilnitzinfo_tag;
+     LPRILNITZINFO = ^rilnitzinfo_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILSIMSECURITYSTATUS | SIM security status struct
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilsimsecuritystatus_tag = record
+       cbSize:DWORD;                   // @field structure size in bytes
+       dwLockedState:DWORD;            // @field one of RIL_LOCKEDSTATE_*
+       dwSimSecurityState:DWORD;       // @field one of RIL_SIMSECURITYSTATE_*
+     end;
+     RILSIMSECURITYSTATUS = rilsimsecuritystatus_tag;
+     LPRILSIMSECURITYSTATUS = ^rilsimsecuritystatus_tag;
+
+     
+//
+// RIL handle type
+//
+type
+     HRIL = HANDLE;
+     LPHRIL = ^HRIL;
+
+
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func RIL function result callback
+//
+// @comm This function is called to send a return value after and asynchronous
+//       RIL function call
+//
+// -----------------------------------------------------------------------------
+type
+     RILRESULTCALLBACK = procedure(dwCode:DWORD;           // @parm result code
+                                   hrCmdID:HRESULT;        // @parm ID returned by the command that originated this response
+                                   lpData:pointer;         // @parm data associated with the notification
+                                   cbData:DWORD;           // @parm size of the strcuture pointed to lpData
+                                   dwParam:DWORD           // @parm parameter passed to <f RIL_Initialize>
+                                  ); cdecl;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func RIL notification callback
+//
+// @comm This function is called when the radio sends an unsolicited notifiation
+//
+// -----------------------------------------------------------------------------
+type
+     RILNOTIFYCALLBACK = procedure(dwCode:DWORD;           // @parm notification code
+                                   lpData:pointer;         // @parm data associated with the notification
+                                   cbData:DWORD;           // @parm size of the strcuture pointed to lpData
+                                   dwParam:DWORD           // @parm parameter passed to <f RIL_Initialize>
+                                  ); cdecl;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func RIL call type determination callback
+//
+// @comm This function is called to determine the call type when the
+//       following is present in the registry:
+//       
+//       [HKEY_LOCAL_MACHINE\Comm\Cellular\RIL\RemoteCalltype]
+//           "CalltypeDLL"="<libraryName>.dll"
+//           "CalltypeFunction"="<functionName>"
+//
+// -----------------------------------------------------------------------------
+type
+     RILCALLTYPECALLBACK = function(pRemotePartyInfo:LPRILREMOTEPARTYINFO  // @param remote party info used to determine the call type
+                                   ):DWORD; cdecl;
+
+
+//
+// RIL Functions
+//
+
+// Comment: contains 132 functions.
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Initializes RIL for use by this client
+//
+// @comm Synchronous
+//      RIL only supports single threaded RIL handles.
+//      The RIL validates the application's RIL handle before using it.
+//              No application can use/close a RIL handle that it does not own.
+//
+// -----------------------------------------------------------------------------
+function RIL_Initialize(dwIndex:DWORD;                     // @parm index of the RIL port to use (e.g., 1 for RIL1:)
+                        pfnResult:RILRESULTCALLBACK;       // @parm function result callback
+                        pfnNotify:RILNOTIFYCALLBACK;       // @parm notification callback
+                        dwNotificationClasses:DWORD;       // @parm classes of notifications to be enabled for this client
+                        dwParam:DWORD;                     // @parm custom parameter passed to result and notififcation callbacks
+                        _lphRil:LPHRIL                     // @parm returned handle to RIL instance
+                       ):HRESULT; external RILDLL name 'RIL_Initialize';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Initializes RIL for use by this emergency call module
+//
+// @comm Synchronous
+//
+// -----------------------------------------------------------------------------
+function RIL_InitializeEmergency(dwIndex:DWORD;                      // @parm index of the RIL port to use (e.g., 1 for RIL1:)
+                                 pfnResult:RILRESULTCALLBACK;        // @parm function result callback
+                                 pfnNotify:RILNOTIFYCALLBACK;        // @parm notification callback
+                                 dwNotificationClasses:DWORD;        // @parm classes of notifications to be enabled for this client
+                                 dwParam:DWORD;                      // @parm custom parameter passed to result and notififcation callbacks
+                                 _lphRil:LPHRIL                      // @parm returned handle to RIL instance
+                                ):HRESULT; external RILDLL name 'RIL_InitializeEmergency';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Deinitializes RIL
+//
+// @comm Synchronous
+//
+// -----------------------------------------------------------------------------
+function RIL_Deinitialize(
+                          _hRil:HRIL      // @parm handle to an RIL instance returned by <f RIL_Initialize>
+                         ):HRESULT; external RILDLL name 'RIL_Deinitialize';
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Enables additional classes of notifications for this client
+//
+// @comm Synchronous
+//
+// -----------------------------------------------------------------------------
+
+function RIL_EnableNotifications(
+                                 _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                 dwNotificationClasses:DWORD         // @parm classes of notifications to enable
+                                ):HRESULT; external RILDLL name 'RIL_EnableNotifications';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Disables classes of notifications for this client
+//
+// @comm Synchronous
+//
+// -----------------------------------------------------------------------------
+function RIL_DisableNotifications(
+                                  _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                  dwNotificationClasses:DWORD         // @parm classes of notifications to disable
+                                 ):HRESULT; external RILDLL name 'RIL_DisableNotifications';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Disables classes of notifications for this client
+//
+// @comm Synchronous
+//
+// -----------------------------------------------------------------------------
+function RIL_RegisterATCommandLogging(_hRil:HRIL;           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                      fEnable:BOOL          // @parm flag to turn feature on or off.
+                                     ):HRESULT;  external RILDLL name 'RIL_RegisterATCommandLogging';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Creates a log file of recent AT commands
+//
+// @comm Asynchronous.
+//       For Microsoft Test only. This will not be fully implemented on every
+//       platform. A return response of E_NOTIMPL will be returned in the
+//       default case.
+//
+//       DO NOT IMPLEMENT THIS.
+//
+// -----------------------------------------------------------------------------
+function RIL_ATCommandLogFile(_hRil:HRIL;                          // @parm handle to RIL instance returned by <f RIL_Initialize>
+                              pszFilename:LPCTSTR                  // @parm String containing the filename for the log.
+                             ):HRESULT;  external RILDLL name 'RIL_ATCommandLogFile';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves a serial port handle to be used for data communications
+//
+// @comm Synchronous.  Client is responsible for closing the handle returned in <p lphSerial>.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetSerialPortHandle(
+                                 _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                 lphSerial:LPHANDLE                   // @parm pointer to the serial port handle
+                                ):HRESULT; external RILDLL name 'RIL_GetSerialPortHandle';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves a serial port handle to be used for video telephony
+//
+// @comm Synchronous.  Client is responsible for closing the handle returned in <p lphSerial>.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetVTSerialPortHandle(_hRil:HRIL;                // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                   lphSerial:LPHANDLE                   // @parm pointer to the serial port handle
+                                  ):HRESULT; external RILDLL name 'RIL_GetVTSerialPortHandle';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves a serial port handle to be used for data communications
+//
+// @comm Synchronous.  Client is responsible for closing the handle returned in <p lphSerial>.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetSerialPortHandleFromContextID(_hRil:HRIL;            // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                              dwContextID:DWORD;     // @parm PDP context identifier.
+                                              lphSerial:LPHANDLE                   // @parm pointer to the serial port handle
+                                             ):HRESULT; external RILDLL name 'RIL_GetSerialPortHandleFromContextID';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves a serial port handle statistics
+//
+// @comm Synchronous
+//
+// -----------------------------------------------------------------------------
+function RIL_GetSerialPortStatistics(
+                                     _hRil:HRIL;                              // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                     lpSerialPortStats:LPRILSERIALPORTSTATS   // @parm pointer to the statistics structure
+                                    ):HRESULT; external RILDLL name 'RIL_GetSerialPortStatistics';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Restrieves the driver version
+//
+// @comm Synchronous
+//
+// -----------------------------------------------------------------------------
+function RIL_GetDriverVersion(
+                              _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                              pdwVersion:LPDWORD                   // @parm pointer to version.  HIWORD is major version, LOWORD is minor version
+                             ):HRESULT; external RILDLL name 'RIL_GetDriverVersion';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Restrieves information about subscriber numbers
+//
+// @comm Asynchronous.  <p lpData> points to an array of <t RILSUBSCRIBERINFO> structures.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetSubscriberNumbers(
+                                  _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                 ):HRESULT; external RILDLL name 'RIL_GetSubscriberNumbers';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the list of available operators
+//
+// @comm Asynchronous.  <p lpData> points to an array of <t RILOPERATORINFO> structures.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetOperatorList(
+                             _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                            ):HRESULT; external RILDLL name 'RIL_GetOperatorList';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the built-in list of all known operators.
+//       This is not the list of operators available, for that see RIL_GetOperatorList.
+//
+// @comm Asynchronous.  <p lpData> points to an array of <t RILOPERATORNAMES> structures.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetAllOperatorsList(_hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                ):HRESULT; external RILDLL name 'RIL_GetAllOperatorsList';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the list of preferred operators
+//
+// @comm Asynchronous.  <p lpData> points to an array of <t RILOPERATORINFO> structures.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetPreferredOperatorList(
+                                      _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                      dwFormat:DWORD                      // @parm format to use for the operator names in the list
+                                     ):HRESULT; external RILDLL name 'RIL_GetPreferredOperatorList';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Adds a specified operator to the list of preferred operators
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>
+//
+// -----------------------------------------------------------------------------
+function RIL_AddPreferredOperator(
+                                  _hRil:HRIL;                             // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                  dwIndex:DWORD;                          // @parm storage index to use for the added operator
+                                  lpOperatorNames:LPRILOPERATORNAMES      // @parm operator name
+                                 ):HRESULT; external RILDLL name 'RIL_AddPreferredOperator';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Removes a specified operator from the list of preferred operators
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_RemovePreferredOperator(
+                                     _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                     dwIndex:DWORD                       // @parm storage index of the preferred operator to remove
+                                    ):HRESULT; external RILDLL name 'RIL_RemovePreferredOperator';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the operator the ME is currently registered with
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILOPERATORNAMES> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetCurrentOperator(
+                                _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize()>
+                                dwFormat:DWORD                      // @parm format of the operator name to return (<def RIL_OPFORMAT_> constant)
+                               ):HRESULT; external RILDLL name 'RIL_GetCurrentOperator';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Registers the ME with a network operator
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_RegisterOnNetwork(
+                               _hRil:HRIL;                             // @parm handle to RIL instance returned by <f RIL_Initialize>
+                               dwMode:DWORD;                           // @parm operator selection mode (<def RIL_OPSELMODE_> constant)
+                               lpOperatorNames:LPRILOPERATORNAMES      // @parm operator to be selected (can be <def NULL> if <p dwMode> is <def RIL_OPSELMODE_AUTOMATIC>)
+                              ):HRESULT; external RILDLL name 'RIL_RegisterOnNetwork';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Unregisters the ME from the current newtwork operator
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_UnregisterFromNetwork(
+                                   _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                  ):HRESULT; external RILDLL name 'RIL_UnregisterFromNetwork';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the current phone registration status
+//
+// @comm Asynchronous.  <p lpData> points to a <def RIL_REGSTAT_> constant.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetRegistrationStatus(
+                                   _hRil:HRIL;             // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                   pdwRegStatus:LPDWORD    // @parm points to returned <def RIL_REGSTAT_> constant
+                                  ):HRESULT; external RILDLL name 'RIL_GetRegistrationStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the current CallerID settings
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILCALLERIDSETTINGS> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetCallerIdSettings(
+                                 _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                ):HRESULT; external RILDLL name 'RIL_GetCallerIdSettings';
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets the current CallerID status
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetCallerIdStatus(
+                               _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                               dwStatus:DWORD                      // @parm status to be set (<def RIL_SVCSTAT_> constant)
+                              ):HRESULT; external RILDLL name 'RIL_SetCallerIdStatus';
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the current HideID settings
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILHIDEIDSETTINGS> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetHideIdSettings(
+                               _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                              ):HRESULT; external RILDLL name 'RIL_GetHideIdSettings';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Enables or disables HideID service
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetHideIdStatus(
+                             _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                             dwStatus:DWORD                      // @parm status to be set (<def RIL_SVCSTAT_> constant)
+                            ):HRESULT; external RILDLL name 'RIL_SetHideIdStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the current DialedID settings
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILDIALEDIDSETTINGS> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetDialedIdSettings(
+                                 _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                ):HRESULT; external RILDLL name 'RIL_GetDialedIdSettings';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets the current DialedID settings
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetDialedIdStatus(
+                               _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                               dwStatus:DWORD                      // @parm status to be set (<def RIL_SVCSTAT_> constant)
+                              ):HRESULT; external RILDLL name 'RIL_SetDialedIdStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the current HideConnectedID settings
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILHIDECONNECTEDIDSETTINGS> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetHideConnectedIdSettings(
+                                        _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                       ):HRESULT; external RILDLL name 'RIL_GetHideConnectedIdSettings';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets the current HideConnectedID settings
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetHideConnectedIdStatus(
+                                      _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                      dwStatus:DWORD                      // @parm status to be set (<def RIL_SVCSTAT_> constant)
+                                     ):HRESULT; external RILDLL name 'RIL_SetHideConnectedIdStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the status for a Completion of Call to Busy Subscriber index.
+//
+// @comm Asynchronous.  If active, <p lpData> points to an array of <t char>s
+//       indicating the phone number for which CCBS is active.  If CCBS is not
+//       active for that entry, <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetCCBSStatus(
+                           _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                           dwCCBSIndex:DWORD                   // @parm indicates which entry to query
+                          ):HRESULT; external RILDLL name 'RIL_GetCCBSStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Clears registration for a Completion of Call to Busy Subscriber index.
+//       Activation of CCBS is used by calling RIL_ManageCalls using the
+//       <def RIL_CALLCMD_INVOKECCBS> flag.
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_ClearCCBSRegistration(
+                                   _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                   dwCCBSIndex:DWORD                   // @parm indicates which entry to clear, may be <def RIL_CCBS_ALL>
+                                  ):HRESULT; external RILDLL name 'RIL_ClearCCBSRegistration';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the current Closed User Group settings
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILCLOSEDGROUPSETTINGS> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetClosedGroupSettings(
+                                    _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                   ):HRESULT; external RILDLL name 'RIL_GetClosedGroupSettings';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets the Closed User Group settings
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetClosedGroupSettings(
+                                    _hRil:HRIL;                                 // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                    lpSettings:LPRILCLOSEDGROUPSETTINGS         // @parm settings to be set
+                                   ):HRESULT; external RILDLL name 'RIL_SetClosedGroupSettings';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves current Call Forwarding rules
+//
+// @comm Asynchronous.  <p lpData> points to an array of <t RILCALLFORWARDINGSETTINGS> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetCallForwardingSettings(
+                                       _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                       dwReason:DWORD;                     // @parm forwarding reason to retrieve the settings for (<def RIL_FWDREASON_> constant)
+                                       dwInfoClass:DWORD                   // @parm information class to retrieve barring status for (<def RIL_INFOCLASS_> constant)
+                                      ):HRESULT; external RILDLL name 'RIL_GetCallForwardingSettings';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Adds a Call Forwarding rule
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_AddCallForwarding(
+                               _hRil:HRIL;                                 // @parm handle to RIL instance returned by <f RIL_Initialize>
+                               dwReason:DWORD;                             // @parm forwarding reason to add Call Forwarding for (<def RIL_FWDREASON_> constant)
+                               lpSettings:LPRILCALLFORWARDINGSETTINGS // @parm settings for the new Call Forwarding rule
+                              ):HRESULT; external RILDLL name 'RIL_AddCallForwarding';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Removes a Call Forwarding rule
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_RemoveCallForwarding(
+                                  _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                  dwReason:DWORD;                     // @parm forwarding reason to remove Call Forwarding for (<def RIL_FWDREASON_> constant)
+                                  dwInfoClasses:DWORD                 // @parm information classes to remove Call Forwarding for (combination of <def RIL_INFOCLASS_> constants)
+                                 ):HRESULT; external RILDLL name 'RIL_RemoveCallForwarding';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Enables or disables the specified Call Forwarding rule
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetCallForwardingStatus(
+                                     _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                     dwReason:DWORD;                     // @parm forwarding reason to enable/disable Call Forwarding for (<def RIL_FWDREASON_> constant)
+                                     dwInfoClasses:DWORD;                // @parm information classes to enable/disable Call Forwarding for (combination of <def RIL_INFOCLASS_> constants)
+                                     dwStatus:DWORD                      // @parm status to be set (<def RIL_SVCSTAT_> constant)
+                                    ):HRESULT; external RILDLL name 'RIL_SetCallForwardingStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves info classes that Call Waiting is currently enabled for
+//
+// @comm Asynchronous.  <p lpData> points to DWORD containing a combination
+//       of <def RIL_INFOCLASS_> constants.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetCallWaitingSettings(
+                                    _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                    dwInfoClass:DWORD                   // @parm information class to retrieve barring status for (<def RIL_INFOCLASS_> constant)
+                                   ):HRESULT; external RILDLL name 'RIL_GetCallWaitingSettings';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Enables or disables Call Waiting for the specified info class
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetCallWaitingStatus(
+                                  _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                  dwInfoClasses:DWORD;                // @parm information classes to enable/disable Call Waiting for
+                                  dwStatus:DWORD                      // @parm status to be set (<def RIL_SVCSTAT_> constant)
+                                 ):HRESULT; external RILDLL name 'RIL_SetCallWaitingStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sends supplementary service (USSD) data
+//
+// @comm TBD
+//
+// -----------------------------------------------------------------------------
+function RIL_SendSupServiceData(
+                                _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                pwszData:LPCWSTR                    // @parm data to be sent
+                               ):HRESULT; external RILDLL name 'RIL_SendSupServiceData';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Cancels current supplementary service session
+//
+// @comm TBD
+//
+// -----------------------------------------------------------------------------
+function RIL_CancelSupServiceDataSession(
+                                         _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                        ):HRESULT; external RILDLL name 'RIL_CancelSupServiceDataSession';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the current address identifier (see RILSUBSCRIBERINFO)
+//
+// @comm Asynchronous.  <p lpData> points to a <def DWORD> identifying the current address ID.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetCurrentAddressId(
+                                 _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                ):HRESULT; external RILDLL name 'RIL_GetCurrentAddressId';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets the current address identifier (see RILSUBSCRIBERINFO)
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetCurrentAddressId(
+                                 _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                 dwAddressId:DWORD                   // @parm identifies the new addressID to use
+                                ):HRESULT; external RILDLL name 'RIL_SetCurrentAddressId';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Dials a specified address
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_Dial(
+                  _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                  lpszAddress:PAnsiChar;                 // @parm address to dial (no longer than <def MAXLENGTH_ADDRESS> chars)
+                  dwType:DWORD;                       // @parm type of the call to establish (<def RIL_CALLTYPE_> constant)
+                  dwOptions:DWORD                     // @parm dialing options (any combination of <def RIL_DIALOPT_> constants)
+                 ):HRESULT; external RILDLL name 'RIL_Dial';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Answers an incoming call
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_Answer(
+                    _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                   ):HRESULT; external RILDLL name 'RIL_Answer';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Hangs up all calls currently in progress
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_Hangup(
+                    _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                   ):HRESULT; external RILDLL name 'RIL_Hangup';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sends DTMF tones across an established voice call
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.  Function does not return until
+//       DTMF tone has completed.
+//
+// -----------------------------------------------------------------------------
+function RIL_SendDTMF(
+                      _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                      lpszChars:PAnsiChar;                // @parm alphanumeric string representing DTMF tones to be sent (0-9, A-D, *, #)
+                      dwDuration:DWORD                    // @parm new DTMF tone duration in milliseconds (<def RIL_DTMFDURATION_DEFAULT>
+                                                          // corresponds to the manufacturer's default value)
+                     ):HRESULT; external RILDLL name 'RIL_SendDTMF';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Starts DTMF tone across an established voice call
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_StartDTMF(
+                       _hRil:HRIL;       // @parm handle to RIL instance returned by <f RIL_Initialize>
+                       ch:AnsiChar       // @parm alphanumeric char representing DTMF tones to be sent (0-9, A-D, *, #)
+                      ):HRESULT; external RILDLL name 'RIL_StartDTMF';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Stops DTMF tones across an established voice call
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.  Function does not return until
+//       DTMF tone has completed.
+//
+// -----------------------------------------------------------------------------
+function RIL_StopDTMF(
+                      _hRil:HRIL;       // @parm handle to RIL instance returned by <f RIL_Initialize>
+                      ch:AnsiChar       // @parm alphanumeric char representing DTMF tones to be stopped (0-9, A-D, *, #)
+                     ):HRESULT; external RILDLL name 'RIL_StopDTMF';
+                     
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Detects DTMF tones from an established voice call
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetDTMFMonitoring(
+                               _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                               fEnable:BOOL                        // @parm TRUE to initiate DTMF monitoring; FALSE to cancel
+                              ):HRESULT; external RILDLL name 'RIL_SetDTMFMonitoring';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the list of active, held, and waiting calls
+//
+// @comm Asynchronous.  <p lpData> points to an array of <t RILCALLINFO> structures.
+//
+// -----------------------------------------------------------------------------
+// Function RIL_GetCallList is not declared in ril.h for unknown reason, but
+// is still exported by ril.dll.
+function RIL_GetCallList(
+                         _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                        ):HRESULT; external RILDLL name 'RIL_GetCallList';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Modifies the state of active, held, and waiting calls
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_ManageCalls(
+                         _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                         dwCommand:DWORD;                    // @parm call modification command to be performed (<def RIL_CALLCMD_> constant)
+                         dwID:DWORD                          // @parm ID of the call to be modified (only for <def RIL_CALLCMD_RELEASECALL> and <def RIL_CALLCMD_HOLDALLBUTONE>)
+                        ):HRESULT; external RILDLL name 'RIL_ManageCalls';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Transfers incoming allerting call to the specified number
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_TransferCall(
+                          _hRil:HRIL;                  // @parm handle to RIL instance returned by <f RIL_Initialize>
+                          lpAddress:LPRILADDRESS;      // @parm address to transfer the call to
+                          lpSubAddress:RILSUBADDRESS   // @parm sub-address to transfer the call to (can be <def NULL>)
+                         ):HRESULT; external RILDLL name 'RIL_TransferCall';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the phone line status
+//
+// @comm Asynchronous.  <p lpData> points to <t DWORD> containing <def RIL_LINESTAT_> constant.
+//
+// -----------------------------------------------------------------------------
+// Function RIL_GetLineStatus is not declared in ril.h for unknown reason, but
+// is still exported by ril.dll.
+function RIL_GetLineStatus(
+                           _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                          ):HRESULT; external RILDLL name 'RIL_GetLineStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves audio gain information
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILGAININFO> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetAudioGain(
+                          _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                         ):HRESULT; external RILDLL name 'RIL_GetAudioGain';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets audio gain information
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetAudioGain(
+                          _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                          lpGainInfo:LPRILGAININFO       // @parm audio gain information to be sent
+                         ):HRESULT; external RILDLL name 'RIL_SetAudioGain';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves currently used transmit and receive audio devices
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILAUDIODEVICEINFO> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetAudioDevices(
+                             _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                            ):HRESULT; external RILDLL name 'RIL_GetAudioDevices';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets currently used transmit and receive audio devices
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetAudioDevices(
+                             _hRil:HRIL;                                 // @parm handle to RIL instance returned by <f RIL_Initialize>
+                             lpAudioDeviceInfo:LPRILAUDIODEVICEINFO // @parm audio devices to set
+                            ):HRESULT; external RILDLL name 'RIL_SetAudioDevices';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Determines whether the input audio device is muted
+//
+// @comm Asynchronous.  <p lpData> points to a <t BOOL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetAudioMuting(
+                            _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                           ):HRESULT; external RILDLL name 'RIL_GetAudioMuting';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Mutes or un-mutes the input audio device
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetAudioMuting(
+                            _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                            fEnable:BOOL                        // @parm TRUE if input audio device is to be muted; FALSE otherwise
+                           ):HRESULT; external RILDLL name 'RIL_SetAudioMuting';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves High Speeed Circuit Switched Data options
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILHSCSDINFO> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetHSCSDOptions(
+                             _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                            ):HRESULT; external RILDLL name 'RIL_GetHSCSDOptions';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets High Speeed Circuit Switched Data options
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetHSCSDOptions(
+                             _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                             lpHscsdInfo:LPRILHSCSDINFO     // @parm High Speeed Circuit Switched Data options to set
+                            ):HRESULT; external RILDLL name 'RIL_SetHSCSDOptions';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves High Speeed Circuit Switched Data options
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILCALLHSCSDINFO> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetHSCSDCallSettings(
+                                  _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                 ):HRESULT; external RILDLL name 'RIL_GetHSCSDCallSettings';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves data compression options
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILDATACOMPINFO> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetDataCompression(
+                                _hRil:HRIL;                          // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                pDataCompInfo:LPRILDATACOMPINFO      // @parm data compression options to return
+                               ):HRESULT; external RILDLL name 'RIL_GetDataCompression';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets data compression options
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetDataCompression(
+                                _hRil:HRIL;                             // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                lpDataCompInfo:LPRILDATACOMPINFO   // @parm data compression options to set
+                               ):HRESULT; external RILDLL name 'RIL_SetDataCompression';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves error correction options
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILERRORCORRECTIONINFO> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetErrorCorrection(
+                                _hRil:HRIL;                          // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                lpErrorCorrectionInfo:LPRILERRORCORRECTIONINFO // @parm error correction options to return
+                               ):HRESULT; external RILDLL name 'RIL_GetErrorCorrection';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Set error correction options
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetErrorCorrection(
+                                _hRil:HRIL;                                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                lpErrorCorrectionInfo:LPRILERRORCORRECTIONINFO // @parm error correction options to set
+                               ):HRESULT; external RILDLL name 'RIL_SetErrorCorrection';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves currently set data bearer service options
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILBEARERSVCINFO> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetBearerServiceOptions(
+                                     _hRil:HRIL;                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                     lpBearerServiceInfo:LPRILBEARERSVCINFO // @parm data bearer service options to return
+                                    ):HRESULT; external RILDLL name 'RIL_GetBearerServiceOptions';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets data bearer service options
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetBearerServiceOptions(
+                                     _hRil:HRIL;                                 // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                     lpBearerServiceInfo:LPRILBEARERSVCINFO // @parm data bearer service options to set
+                                    ):HRESULT; external RILDLL name 'RIL_SetBearerServiceOptions';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves currently set Radio Link Protocol options
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILRLPINFO> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetRLPOptions(
+                           _hRil:HRIL;                          // @parm handle to RIL instance returned by <f RIL_Initialize>
+                           lpRlpInfo:LPRILRLPINFO         // @parm Radio Link Protocol options to return
+                          ):HRESULT; external RILDLL name 'RIL_GetRLPOptions';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets Radio Link Protocol options
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetRLPOptions(
+                           _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                           lpRlpInfo:LPRILRLPINFO         // @parm Radio Link Protocol options to set
+                          ):HRESULT; external RILDLL name 'RIL_SetRLPOptions';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Gets currently set messaging service options
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILMSGSERVICEINFO> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetMsgServiceOptions(
+                                  _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                 ):HRESULT; external RILDLL name 'RIL_GetMsgServiceOptions';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets messaging service options
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetMsgServiceOptions(
+                                  _hRil:HRIL;                                 // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                  lpMsgServiceInfo:LPRILMSGSERVICEINFO   // @parm messaging service options to be set
+                                 ):HRESULT; external RILDLL name 'RIL_SetMsgServiceOptions';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Gets currently set messaging configuration
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILMSGCONFIG> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetMsgConfig(
+                          _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                         ):HRESULT; external RILDLL name 'RIL_GetMsgConfig';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets messaging configuration
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetMsgConfig(
+                          _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                          lpMsgConfigInfo:LPRILMSGCONFIG // @parm messaging configuration to be set
+                         ):HRESULT; external RILDLL name 'RIL_SetMsgConfig';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Gets cell broadcast messaging configuration
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILCBMSGCONFIG> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetCellBroadcastMsgConfig(
+                                       _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                      ):HRESULT; external RILDLL name 'RIL_GetCellBroadcastMsgConfig';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets cell broadcast messaging configuration
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetCellBroadcastMsgConfig(
+                                       _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                       lpCbMsgConfigInfo:LPRILCBMSGCONFIG // @parm messaging configuration to be set
+                                      ):HRESULT; external RILDLL name 'RIL_SetCellBroadcastMsgConfig';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Reads a message from the current storage location
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILMESSAGEINFO> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_ReadMsg(
+                     _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                     dwIndex:DWORD                       // @parm index of the message to be read
+                    ):HRESULT; external RILDLL name 'RIL_ReadMsg';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Deletes a message from the current storage location
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_DeleteMsg(
+                       _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                       dwIndex:DWORD                       // @parm index of the message to be deleted
+                      ):HRESULT; external RILDLL name 'RIL_DeleteMsg';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Writes a message to the current storage location
+//
+// @comm Asynchronous.  <p lpData> points to a <t DWORD> conaining the index used.
+//
+// -----------------------------------------------------------------------------
+function RIL_WriteMsg(
+                      _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                      lpMessage:LPRILMESSAGE;        // @parm message to be written (of type <def RIL_MSGTYPE_IN_DELIVER> or <def RIL_MSGTYPE_OUT_SUBMIT>)
+                      dwStatus:DWORD                      // @parm status to assigned to the written message (<def RIL_MSGSTATUS_> constant)
+                     ):HRESULT; external RILDLL name 'RIL_WriteMsg';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sends a message
+//
+// @comm Asynchronous.  <p lpData> points to a <t DWORD> conaining the reference
+//       number of the sent message.
+//
+// -----------------------------------------------------------------------------
+function RIL_SendMsg(
+                     _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                     lpMessage:LPRILMESSAGE;        // @parm message to be sent
+                     dwOptions:DWORD                     // @parm options (any combination of <def RIL_SENDOPT_> constants)
+                    ):HRESULT; external RILDLL name 'RIL_SendMsg';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sends a message from the current storage location
+//
+// @comm Asynchronous.  <p lpData> points to a <t DWORD> conaining the reference
+//       number of the sent message.  This feature is not used and is untested.
+//
+// -----------------------------------------------------------------------------
+function RIL_SendStoredMsg(
+                           _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                           dwIndex:DWORD;                      // @parm index of the message to be sent
+                           dwOptions:DWORD                     // @parm options (any combination of <def RIL_SENDOPT_> constants)
+                          ):HRESULT; external RILDLL name 'RIL_SendStoredMsg';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sends an message ackknowledgement
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.  On Phase 2 mobiles, the radio
+//       automatically sends SMS message ACKs.  But in Phase 2+, the MMI is
+//       responsible for these ACKs, hense this function.
+//
+// -----------------------------------------------------------------------------
+function RIL_SendMsgAcknowledgement(
+                                    _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                    fSuccess:BOOL                       // @parm TRUE if success acknowledgment is to be sent; FALSE otherwise
+                                   ):HRESULT; external RILDLL name 'RIL_SendMsgAcknowledgement';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves International Mobile Subscriber Identity of the phone user
+//
+// @comm Asynchronous.  <p lpData> points to an array of <t char>s
+//
+// -----------------------------------------------------------------------------
+function RIL_GetUserIdentity(
+                             _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                            ):HRESULT; external RILDLL name 'RIL_GetUserIdentity';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves current locked state of the phone
+//
+// @comm Asynchronous.  <p lpData> points to a <t DWORD> containing a <def RIL_LOCKEDSTATE_> constant
+//
+// -----------------------------------------------------------------------------
+function RIL_GetPhoneLockedState(
+                                 _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                ):HRESULT; external RILDLL name 'RIL_GetPhoneLockedState';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Removes current lock applied to the phone
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_UnlockPhone(
+                         _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                         lpszPassword:PAnsiChar;                // @parm password to unlock the phone (no longer than <def MAXLENGTH_PASSWORD> chars)
+                         lpszNewPassword:PAnsiChar              // @parm new password (can be <def NULL>, unless the current locked state is
+                                                                //     one of the <def RIL_LOCKEDSTATE_*_PUK> constants; no longer than
+                                                                //     <def MAXLENGTH_PASSWORD> chars)
+                        ):HRESULT; external RILDLL name 'RIL_UnlockPhone';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves locking status for the specified facility
+//
+// @comm Asynchronous.  <p lpData> points to a <t DWORD> containing a <def RIL_LOCKINGSTATUS_> constant.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetLockingStatus(
+                              _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                              dwFacility:DWORD;                   // @parm facility to retrieve locking status for (<def RIL_LOCKFACILITY_> constant)
+                              lpszPassword:PAnsiChar                 // @parm password to retrieve locking status (can be <def NULL> if password isn't required;
+                                                                     //     no longer than MAXLENGTH_PASSWORD chars)
+                             ):HRESULT; external RILDLL name 'RIL_GetLockingStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Enables or disables locking status for the specified facility
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetLockingStatus(
+                              _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                              dwFacility:DWORD;                   // @parm facility to enable/disable locking for (<def RIL_LOCKFACILITY_> constant)
+                              lpszPassword:PAnsiChar;             // @parm password to enable/disable locking (can be <def NULL> if password isn't required;
+                                                                  //     no longer than <def MAXLENGTH_PASSWORD> chars)
+                              dwStatus:DWORD                      // @parm status to be set (<def RIL_LOCKINGSTATUS_> constant)
+                             ):HRESULT; external RILDLL name 'RIL_SetLockingStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Changes locking password for the specified facility
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_ChangeLockingPassword(
+                                   _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                   dwFacility:DWORD;                   // @parm facility to change locking password for (<def RIL_LOCKFACILITY_> constant)
+                                   dwOldPasswordType:DWORD;            // @parm the type of OLD password (PIN or PUK) RIL_PASSWORDTYPE_* constant
+                                   lpszOldPassword:PAnsiChar;             // @parm current locking password (no longer than <def MAXLENGTH_PASSWORD> chars)
+                                   lpszNewPassword:PAnsiChar              // @parm new locking password (no longer than <def MAXLENGTH_PASSWOR> chars)
+                                  ):HRESULT; external RILDLL name 'RIL_ChangeLockingPassword';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves status of the specified type of call barring
+//
+// @comm Asynchronous.  <p lpData> points to a <t DWORD> containing a <def RIL_BARRINGSTATUS> constant.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetCallBarringStatus(
+                                  _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                  dwType:DWORD;                       // @parm type of call barring to retrieve status for (<def RIL_BARRTYPE_> constant)
+                                  dwInfoClass:DWORD;                  // @parm information class to retrieve barring status for (<def RIL_INFOCLASS_> constant)
+                                  lpszPassword:PAnsiChar                 // @parm password to retrieve barring status (can be <def NULL> if password isn't required;
+                                                                      //     no longer than <def MAXLENGTH_PASSWORD> chars)
+                                 ):HRESULT; external RILDLL name 'RIL_GetCallBarringStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Enables or disables the specified type of call barring
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetCallBarringStatus(
+                                  _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                  dwType:DWORD;                       // @parm type of call barring to enable/disable (<def RIL_BARRTYPE_> constant)
+                                  dwInfoClass:DWORD;                  // @parm information class to enable/disable call barring for (<def RIL_INFOCLASS_> constant)
+                                  lpszPassword:AnsiChar;                // @parm password to enable/disable call barring (can be <def NULL> if password isn't required;
+                                                                      //     no longer than <def MAXLENGTH_PASSWORD> chars)
+                                  dwStatus:DWORD                      // @parm status to be set (<def RIL_BARRINGSTATUS_> constant)
+                                 ):HRESULT; external RILDLL name 'RIL_SetCallBarringStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Changes password for the specified type of call barring
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SendSecureMmiString(_hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                 lpszMmiString:LPCSTR                // @parm MMI string to be sent
+                                ):HRESULT; external RILDLL name 'RIL_SendSecureMmiString';
+
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Changes password for the specified type of call barring
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_ChangeCallBarringPassword(
+                                       _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                       dwType:DWORD;                       // @parm type of call barring to retrieve status for (<def RIL_BARRTYPE_> constant)
+                                       lpwszOldPassword:PAnsiChar;            // @parm current password (no longer than <def MAXLENGTH_PASSWORD> chars)
+                                       lpwszNewPassword:PAnsiChar             // @parm new password (no longer than <def MAXLENGTH_PASSWORD> chars)
+                                      ):HRESULT; external RILDLL name 'RIL_ChangeCallBarringPassword';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves manufacturer equipment information
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILEQUIPMENTINFO> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetEquipmentInfo(
+                              _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                             ):HRESULT; external RILDLL name 'RIL_GetEquipmentInfo';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves currently set equipment state
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILEQUIPMENTSTATE> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetEquipmentState(
+                               _hRil:HRIL;                          // @parm handle to RIL instance returned by <f RIL_Initialize>
+                               pEqState:LPRILEQUIPMENTSTATE         // @parm equipment state to return
+                              ):HRESULT; external RILDLL name 'RIL_GetEquipmentState';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets the equipment to the specified state
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetEquipmentState(
+                               _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                               dwEquipmentState:DWORD              // @parm equipment state to set (<def RIL_EQSTATE_> constant)
+                              ):HRESULT; external RILDLL name 'RIL_SetEquipmentState';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Proxy API to determine if the Radio is present or Not (Is the RIL driver Loaded?)
+//
+// @comm Synchronous
+//
+// -----------------------------------------------------------------------------
+function RIL_GetRadioPresence(
+                              _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                              dwRadioPresence:LPDWORD              // @parm pointer to a DWORD (ouput param contains values from RIL_RADIOPRESENCE_*)
+                             ):HRESULT; external RILDLL name 'RIL_GetRadioPresence';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves currently set phonebook options
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILPHONEBOOKINFO> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetPhonebookOptions(
+                                 _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                ):HRESULT; external RILDLL name 'RIL_GetPhonebookOptions';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets phonebook options
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetPhonebookOptions(
+                                 _hRil:HRIL;                             // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                 lpPhonebookInfo:LPRILPHONEBOOKINFO // @parm phonebook options to set
+                                ):HRESULT; external RILDLL name 'RIL_SetPhonebookOptions';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Reads phonebook entries from the specified range of indices of the current storage location
+//
+// @comm Asynchronous.  <p lpData> points to an array of <t RILPHONEBOOKENTRY> structures.
+//
+// -----------------------------------------------------------------------------
+function RIL_ReadPhonebookEntries(
+                                  _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                  dwStartIndex:DWORD;                 // @parm starting index of the range
+                                  dwEndIndex:DWORD                    // @parm ending index of the range
+                                 ):HRESULT; external RILDLL name 'RIL_ReadPhonebookEntries';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Writes a phonebook entry to the current storage location
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_WritePhonebookEntry(
+                                 _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                 lpEntry:LPRILPHONEBOOKENTRY    // @parm phonebook entry to write out
+                                ):HRESULT; external RILDLL name 'RIL_WritePhonebookEntry';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Deletes a phonebook entry from the current storage location
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_DeletePhonebookEntry(
+                                  _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                  dwIndex:DWORD                       // @parm index of the entry to delete
+                                 ):HRESULT; external RILDLL name 'RIL_DeletePhonebookEntry';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sends a specified command to the SIM
+//
+// @comm Asynchronous.  <p lpData> points to an array of <t BYTE>s.
+//
+// -----------------------------------------------------------------------------
+function RIL_SendSimCmd(
+                        _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                        lpbCommand:LPBYTE;             // @parm command to be sent to the SIM
+                        dwSize:DWORD                        // @parm size of the data pointed to by <p lpbCommand> in bytes
+                       ):HRESULT; external RILDLL name 'RIL_SendSimCmd';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the SIM's answer to reset data.
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILATRINFO> structure.
+// This command is not standardized and may be specific to each radio
+// implementation, if implemented at all.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetATR(
+                    _hRil:HRIL                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                   ):HRESULT; external RILDLL name 'RIL_GetATR';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sends a specified restricted command to the SIM
+//
+// @comm Asynchronous.  <p lpData> points to an <t RILSIMRESPONSE> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_SendRestrictedSimCmd(
+                                  _hRil:HRIL;                                 // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                  dwCommand:DWORD;                            // @parm restricted command to be sent to the SIM (<def RIL_SIMCMD_> constant)
+                                  lpParameters:LPRILSIMCMDPARAMETERS;    // @parm Parameters for the command to be sent (can be <def NULL> if parameters aren't required)
+                                  lpbData:LPBYTE;                        // @parm Data to be written to the SIM (can be <def NULL> if data isn't required)
+                                  dwSize:DWORD                                // @parm Size of the data pointed to by <p lpbData> in bytes
+                                 ):HRESULT; external RILDLL name 'RIL_SendRestrictedSimCmd';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves SIM Record Status
+//
+// @comm Asynchronous.  <p lpData> points to RILSIMRECORDSTATUS
+//
+// -----------------------------------------------------------------------------
+function RIL_GetSimRecordStatus(
+                                _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                dwFileID:DWORD                      // @parm address of the file to read
+                               ):HRESULT; external RILDLL name 'RIL_GetSimRecordStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves SIM Toolkit terminal profile
+//
+// @comm Asynchronous.  <p lpData> points to an array of <t BYTE>s.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetSimToolkitProfile(
+                                  _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                 ):HRESULT; external RILDLL name 'RIL_GetSimToolkitProfile';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets SIM Toolkit terminal profile
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetSimToolkitProfile(
+                                  _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                  lpbProfile:LPBYTE;                  // @parm SIM Toolkit profile to be set
+                                  dwSize:DWORD                        // @parm size of the data pointed to by <p lpbProfile> in bytes
+                                 ):HRESULT; external RILDLL name 'RIL_SetSimToolkitProfile';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sends a SIM Toolkit envelope command
+//
+// @comm Asynchronous.  <p lpData> points to an array of <t BYTE>s containing a
+//       response to the sent command.
+//
+// -----------------------------------------------------------------------------
+function RIL_SendSimToolkitEnvelopeCmd(
+                                       _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                       lpbCommand:LPBYTE;             // @parm SIM Toolkit envelope command to be sent
+                                       dwSize:DWORD                        // @parm size of the data pointed to by <p lpbCommand> in bytes
+                                      ):HRESULT; external RILDLL name 'RIL_SendSimToolkitEnvelopeCmd';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Fetches a SIM Toolkit command from the SIM
+//
+// @comm Asynchronous.  <p lpData> points to an array of <t BYTE>s containing a
+//       fetched command.
+//
+// -----------------------------------------------------------------------------
+function RIL_FetchSimToolkitCmd(
+                                _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                               ):HRESULT; external RILDLL name 'RIL_FetchSimToolkitCmd';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sends a response to an executed SIM Toolkit command
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SendSimToolkitCmdResponse(
+                                       _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                       pRsp:LPRILSIMTOOLKITRSP;       // @parm Command Response to be sent.
+                                       pDetails:LPBYTE;            // @parm Detailed command response to be sent (can be <def NULL> if details aren't required)
+                                       dwDetailSize:DWORD                        // @parm size of the details pointed to by <p pDetails> in bytes
+                                      ):HRESULT; external RILDLL name 'RIL_SendSimToolkitCmdResponse';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Terminates the SIM Toolkit session
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_TerminateSimToolkitSession(
+                                        _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                        dwCause:DWORD                       // @parm cause for session termination (<def RIL_SIMTKITTERMCAUSE_> constant)
+                                       ):HRESULT; external RILDLL name 'RIL_TerminateSimToolkitSession';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sends a requested Event to the SIM.
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SendSimToolkitEventDownload(
+                                         _hRil:HRIL;                   // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                         dwEvent:DWORD;                // @parm Event to be sent.
+                                         pData:LPBYTE;                 // @parm Detailed event info to be sent (can be <def NULL> if details aren't required)
+                                         dwDataSize:DWORD              // @parm size of the details pointed to by <p pDetails> in bytes
+                                        ):HRESULT; external RILDLL name 'RIL_SendSimToolkitEventDownload';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves advice-of-charge settings
+//
+// @comm Asynchronous.  <p lpData> points to a <t RILCOSTINFO> structure.
+//       This feature is not used and is untested.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetCostInfo(
+                         _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                        ):HRESULT; external RILDLL name 'RIL_GetCostInfo';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets advice-of-charge settings
+//
+// @comm Asynchronous.  <p lpData> points to a <t RILCOSTINFO> structure.
+//       This feature is not used and is untested.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetCostInfo(
+                         _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                         lpCostInfo:LPRILCOSTINFO;      // @parm advice-of-charge settings to set
+                         lpszPassword:LPCSTR                 // @parm password requred to set advice-of-charge settings
+                        ):HRESULT; external RILDLL name 'RIL_SetCostInfo';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves information about the received signal quality
+//
+// @comm Asynchronous.  <p lpData> points to a <t RILSIGNALQUALITY> structure.
+//
+// -----------------------------------------------------------------------------
+// Function RIL_GetSignalQuality is not declared in ril.h for unknown reason, but
+// is still exported by ril.dll.
+function RIL_GetSignalQuality(
+                              _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                             ):HRESULT; external RILDLL name 'RIL_GetSignalQuality';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves information about the cell tower currently used by the phone
+//
+// @comm Asynchronous.  <p lpData> points to a <t RILCELLTOWERINFO> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetCellTowerInfo(
+                              _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                             ):HRESULT; external RILDLL name 'RIL_GetCellTowerInfo';
+
+// Initial size of the RILDRVNOTIFICATION structure. The size RIL Application allocates for async results of RIL_DevSpecific
+const
+      RIL_NOTIFYTHREAD_ALLOCSIZE      = 256;
+      RIL_DEVSPECIFIC_ASYNC_RESPONSE_TIMEOUT      = 5000;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Performs an implementation-specific operation
+//
+// @comm Synchronous
+//
+// -----------------------------------------------------------------------------
+function RIL_DevSpecific(_hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                         lpbParams:LPBYTE;              // @parm parameters for the operation to be performed
+                         dwSize:DWORD;                        // @parm size of the data pointed to by <p lpParams> in bytes
+                         pbAsyncResults:LPBYTE;               // @parm points to returned array of <t BYTE>s
+                         dwAsyncResultsSize:DWORD;           // @parm the allocated size of the returned array of <t BYTE>s
+                         pcbAsyncResults:LPDWORD;             // @parm points to the actual length of the returned array of <t BYTE>s
+                         dwTimeOut:DWORD                     // @parm time out value (in milliseconds)
+                        ):HRESULT; external RILDLL name 'RIL_DevSpecific';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves specified device capabilities
+//
+// @comm Asynchronous. <nl><nl><p dwCapsType> (<def RIL_CAPSTYPE_>)           <p lpData><nl>
+//                     <def *_DIAL>                   points to an <t RILCAPSDIAL> structure<nl>
+//                     <def *_DTMFDURATIONRANGE>      points to an <t RILRANGE> structure (values in milliseconds)<nl>
+//                     <def *_CALLMGTCMDS>            points to <t DWORD> containing a combination of <def RIL_CAPS_CALLCMD_> constants<nl>
+//                     <def *_BEARERSERVICE>          points to an  <t RILCAPSBEARERSVC> structure<nl>
+//                     <def *_RLP>                    points to an array of <t RILAPSRLP> structures<nl>
+//                     <def *_EQUIPMENTSTATES>        points to <t DWORD> containing a combination of <def RIL_CAPS_EQSTATE_> constants<nl>
+//                     <def *_PBSTORELOCATIONS>       points to <t DWORD> containing a combination of <def RIL_CAPS_PBLOC_> constants<nl>
+//                     <def *_PBINDEXRANGE>           points to an <t RILRANGE> structure<nl>
+//                     <def *_PBENTRYLENGTH>          points to an <t RILCAPSPBENTRYLENGTH> strcuture<nl>
+//                     <def *_MSGSERVICETYPES>        points to <t DWORD> containing a combination of <def RIL_CAPS_MSGSVCTYPE_> constants<nl>
+//                     <def *_MSGMEMORYLOCATIONS>     points to an <t RILCAPSMSGMEMORYLOCATIONS> structure<nl>
+//                     <def *_BROADCASTMSGLANGS>      points to <t DWORD> containing a combination of <def RIL_CAPS_DCSLANG_> constants<nl>
+//                     <def *_MSGCONFIGINDEXRANGE>    points to an <t RILRANGE> structure<nl>
+//                     <def *_MSGSTATUSVALUES>        points to <t DWORD> containing a combination of <def RIL_CAPS_MSGSTATUS_> constants<nl>
+//                     <def *_PREFOPINDEXRANGE>       points to an <t RILRANGE> structure<nl>
+//                     <def *_LOCKFACILITIES>         points to <t DWORD> containing a combination of <def RIL_CAPS_LOCKFACILITY_> constants<nl>
+//                     <def *_LOCKINGPWDLENGTHS>      points to an array of <t RILCAPSLOCKINGPWDLENGTH> structures<nl>
+//                     <def *_BARRTYPES>              points to <t DWORD> containing a combination of <def RIL_CAPS_BARRTYPE_> constants<nl>
+//                     <def *_BARRINGPWDLENGTHS>      points to an array of <t RILCAPSBARRINGPWDLENGTH> structures<nl>
+//                     <def *_FORWARDINGREASONS>      points to <t DWORD> containing a combination of <def RIL_CAPS_FWDREASON_> constants<nl>
+//                     <def *_SIMTOOLKITNOTIFICATIONS>points to a <t TBD> SIMTOOLKIT structure <nl>
+//                     <def *_INFOCLASSES>            points to <t DWORD> containing a combination of <def RIL_CAPS_INFOCLASS_> constants<nl>
+//                     <def *_HSCSD>                  points to an <t RILCAPSHSCSD> structure<nl>
+//                     <def *_GPRS>                   points to an <t RILCAPSGPRS> structure<nl>
+//                     <def *_RIL_CAPS_NITZ_>         points to <t DWORD> containing one of <def RIL_CAPS_NITZ__> constants<nl>
+
+function RIL_GetDevCaps(
+                        _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                        dwCapsType:DWORD                    // @parm type of caps class to retrieve
+                       ):HRESULT; external RILDLL name 'RIL_GetDevCaps';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the systemtime from the network
+//
+// @comm Asynchronous.  <p lpData> points to a <t SYSTEMTIME> structure (containing the UTC time).
+//       This feature is currently not used and is untested.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetSystemTime(
+                           _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                          ):HRESULT; external RILDLL name 'RIL_GetSystemTime';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves a list GPRS contexts
+//
+// @comm Asynchronous.  <p lpData> points to a <t RILGPRSCONTEXT> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetGPRSContextList(
+                                _hRil:HRIL;                          // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                lpGPRSContext:LPRILGPRSCONTEXT;         // @parm points to the returned <t RILGPRSCONTEXT> structure
+                                pdwDataSize:LPDWORD                    // @parm points to returned data size
+                               ):HRESULT; external RILDLL name 'RIL_GetGPRSContextList';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets a particular GPRS context
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetGPRSContext(
+                            _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                            lpGprsContext:LPRILGPRSCONTEXT      // @parm points to a <t RILGPRSCONTEXT> structure
+                           ):HRESULT; external RILDLL name 'RIL_SetGPRSContext';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Deletes a particular GPRS context
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_DeleteGPRSContext(
+                               _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                               dwContextID:DWORD                   // @parm identifies which context to delete
+                              ):HRESULT; external RILDLL name 'RIL_DeleteGPRSContext';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Gets the requested quality of service profile for all contexts
+//
+// @comm Asynchronous.  <p lpData> points to a <t RILGPRSQOSPROFILE> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetRequestedQualityOfServiceList(
+                                              _hRil:HRIL;                          // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                              lpGprsQosProfile:LPRILGPRSQOSPROFILE;          // @parm points to returned <t RILGPRSQOSPROFILE> structure
+                                              pdwDataSize:LPDWORD          // @parm points to returned data size
+                                             ):HRESULT; external RILDLL name 'RIL_GetRequestedQualityOfServiceList';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets the requested quality of service profile for a context
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetRequestedQualityOfService(
+                                          _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                          lpGprsQosProfile:LPRILGPRSQOSPROFILE // @parm points to a <t RILGPRSQOSPROFILE> structure
+                                         ):HRESULT; external RILDLL name 'RIL_SetRequestedQualityOfService';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Deletes the requested quality of service profile for a context
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_DeleteRequestedQualityOfService(
+                                             _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                             dwContextID:DWORD                   // @parm identifies which profile to delete
+                                            ):HRESULT; external RILDLL name 'RIL_DeleteRequestedQualityOfService';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Gets the minimum quality of service profile for all contexts
+//
+// @comm Asynchronous.  <p lpData> points to a <t RILGPRSQOSPROFILE> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetMinimumQualityOfServiceList(
+                                            _hRil:HRIL;                          // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                            lpGprsQosProfile:LPRILGPRSQOSPROFILE;          // @parm points to returned <t RILGPRSQOSPROFILE> structure
+                                            pdwDataSize:LPDWORD          // @parm points to returned data size
+                                           ):HRESULT; external RILDLL name 'RIL_GetMinimumQualityOfServiceList';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets the minimum quality of service profile for a context
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetMinimumQualityOfService(
+                                        _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                        lpGprsQosProfile:LPRILGPRSQOSPROFILE // @parm points to a <t RILGPRSQOSPROFILE> structure
+                                       ):HRESULT; external RILDLL name 'RIL_SetMinimumQualityOfService';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Deletes the minimum quality of service profile for a context
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_DeleteMinimumQualityOfService(
+                                           _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                           dwContextID:DWORD                   // @parm identifies which profile to delete
+                                          ):HRESULT; external RILDLL name 'RIL_DeleteMinimumQualityOfService';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets the GPRS attach state
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetGPRSAttached(
+                             _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                             fAttached:BOOL                      // @parm TRUE: attached, FALSE: detached
+                            ):HRESULT; external RILDLL name 'RIL_SetGPRSAttached';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Gets the GPRS attach state
+//
+// @comm Asynchronous.  <p lpData> points to a <t BOOL> indicating attach state.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetGPRSAttached(
+                             _hRil:HRIL;                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                             pfGPRSAttached:LPBOOL             // @parm indicates attach state
+                            ):HRESULT; external RILDLL name 'RIL_GetGPRSAttached';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets the GPRS activation state for a context
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetGPRSContextActivated(
+                                     _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                     dwContextID:DWORD;                  // @parm identifies the context
+                                     fContextActivation:BOOL             // @parm TRUE: activated, FALSE: deactivated
+                                    ):HRESULT; external RILDLL name 'RIL_SetGPRSContextActivated';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Gets the GPRS activation state for all contexts
+//
+// @comm Asynchronous.  <p lpData> points to a <t RILGPRSCONTEXTACTIVATED> indicating activation state.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetGPRSContextActivatedList(
+                                         _hRil:HRIL;                          // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                         lpGPRSContextActivated:LPRILGPRSCONTEXTACTIVATED;        // @parm points to returned <t RILGPRSCONTEXTACTIVATED> indicating activation state
+                                         pdwDataSize:LPDWORD                                     // @parm points to returned data size
+                                        ):HRESULT; external RILDLL name 'RIL_GetGPRSContextActivatedList';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Enters into GPRS data state
+//
+// @comm Asynchronous.  <p lpData> if <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_EnterGPRSDataMode(
+                               _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                               lpEnterGprsDataMode:LPRILENTERGPRSDATAMODE // @parm points to a <t RILENTERGPRSDATAMODE> structure
+                              ):HRESULT; external RILDLL name 'RIL_EnterGPRSDataMode';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Gets the PDP address for a particular context
+//
+// @comm Asynchronous.  <p lpData> points to an array of <t WCHAR> values indicating the address.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetGPRSAddress(
+                            _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                            dwContextID:DWORD;                   // @parm identifies the context
+                            pwszGPRSAddress:PWCHAR;             // @parm returns the GPRS Address
+                            pGprsAddrCch:LPDWORD     // @parm IN:  The dereferenced specifies the character count of the buffer pointed to by pwszGPRSAddress
+                                                     //       OUT: The dereferenced specifies the number of characters copied including terminating null character
+                                                     //            or the required character count of the buffer including terminating null character to succeed
+                           ):HRESULT; external RILDLL name 'RIL_GetGPRSAddress';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Answers an incoming GPRS activation request
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_GPRSAnswer(
+                        _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                        lpGprsAnswer:LPRILGPRSANSWER   // @param points to a <t RILGPRSANSWER> structure
+                       ):HRESULT; external RILDLL name 'RIL_GPRSAnswer';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the current GPRS registration status
+//
+// @comm Asynchronous.  <p lpData> points to a <def RIL_REGSTAT_> constant.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetGPRSRegistrationStatus(
+                                       _hRil:HRIL;                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                       pdwGPRSRegStatus:DWORD         // @parm points to returned <def RIL_REGSTAT_> constant
+                                      ):HRESULT; external RILDLL name 'RIL_GetGPRSRegistrationStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the current GPRS class
+//
+// @comm Asynchronous.  <p lpData> points to a <def RIL_GPRSCLASS_> constant.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetGPRSClass(
+                          _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                         ):HRESULT; external RILDLL name 'RIL_GetGPRSClass';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets the current GPRS class
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>
+//
+// -----------------------------------------------------------------------------
+function RIL_SetGPRSClass(
+                          _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                          dwClass:DWORD                       // @parm a RIL_GPRSCLASS_* constant
+                         ):HRESULT; external RILDLL name 'RIL_SetGPRSClass';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the preferred SMS service option for mobile originated messages
+//
+// @comm Asynchronous.  <p lpData> points to a <def RIL_MOSMSSERVICE_> constant.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetMOSMSService(
+                             _hRil:HRIL                           // @parm handle to RIL instance returned by <f RIL_Initialize>
+                            ):HRESULT; external RILDLL name 'RIL_GetMOSMSService';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets the preferred SMS service option for mobile originated messages
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>
+//
+// -----------------------------------------------------------------------------
+function RIL_SetMOSMSService(
+                             _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                             dwMoSmsService:DWORD                // @parm a RIL_MOSMSSERVICE_* constant
+                            ):HRESULT; external RILDLL name 'RIL_SetMOSMSService';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @params RILBYTECOUNTER
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_PARAM_BC_RXBYTECOUNT                    = $00000001; // @paramdefine
+      RIL_PARAM_BC_TXBYTECOUNT                    = $00000002; // @paramdefine
+      RIL_PARAM_BC_TOTALBYTECOUNT                 = $00000004; // @paramdefine
+      RIL_PARAM_BC_ALL                            = $00000007; // @paramdefine
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @struct RILBYTECOUNTER | Represents the cumulative number of bytes transferred by the radio (packet).
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+type
+     rilbytecounter_tag = record
+       cbSize:DWORD;                           // @field structure size in bytes
+       dwParams:DWORD;                         // @field indicates valid parameters
+       dwRxByte:DWORD;                         // @field Number of received bytes
+       dwTxByte:DWORD;                         // @field Number of transmitted bytes
+       dwTotalByte:DWORD;                      // @field Total Number of bytes transferred (This comes from the radio, not RxByte+TxByte)
+     end;
+     RILBYTECOUNTER = rilbytecounter_tag;
+     LPRILBYTECOUNTER = ^rilbytecounter_tag;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Retrieves the cumulative count of data bytes transferred by the radio (packet)
+//
+// @comm Asynchronous.  <p lpData> points to a <t RILBYTECOUNTER> structure.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetPacketByteCount(
+                                _hRil:HRIL                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                               ):HRESULT; external RILDLL name 'RIL_GetPacketByteCount';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Resets the cumulative count of data bytes transferred by the radio (packet) to zero.
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_ResetPacketByteCount(
+                                  _hRil:HRIL                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                 ):HRESULT; external RILDLL name 'RIL_ResetPacketByteCount';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants System Coverage | Current System Coverage
+//
+// @comm Various Levels of CDMA and GSM Coverage
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SYSTEMTYPE_NONE         = $00000000;      // @constdegine No Networks in Coverage
+      RIL_SYSTEMTYPE_IS95A        = $00000001;      // @constdefine IS-95A network support (Low Packet, or Circuit Switched Service)
+      RIL_SYSTEMTYPE_IS95B        = $00000002;      // @constdefine IS-95B network support
+      RIL_SYSTEMTYPE_1XRTTPACKET  = $00000004;      // @constdefine CDMA-2000 Rev A (1xRTT) network support
+      RIL_SYSTEMTYPE_GSM          = $00000008;      // @constdefine GSM network support
+      RIL_SYSTEMTYPE_GPRS         = $00000010;      // @constdefine GPRS support
+      RIL_SYSTEMTYPE_EDGE         = $00000020;      // @constdefine GSM EDGE network support
+      RIL_SYSTEMTYPE_1XEVDOPACKET = $00000040;      // @constdefine CDMA (1xEVDO) network support
+      RIL_SYSTEMTYPE_1XEVDVPACKET = $00000080;      // @constdefine CDMA (1xEVDV) network support
+      RIL_SYSTEMTYPE_UMTS         = $00000100;      // @constdefine UMTS network support
+      RIL_SYSTEMTYPE_HSDPA        = $00000200;      // @constdefine HSDPA support
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Gets the Current System Coverage
+//
+// @comm Gets the Current type of System/Cellular connection that is available.
+//       Asynchronous.  <p lpData> is <t DWORD> of type RIL_SYSTEMTYPE_ flags)
+//
+// -----------------------------------------------------------------------------
+function RIL_GetCurrentSystemType(
+                                  _hRil:HRIL                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                 ):HRESULT; external RILDLL name 'RIL_GetCurrentSystemType';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Modifies the state of active, held, and waiting calls
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SendFlash(
+                       _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                       lpraRilAddress:LPRILADDRESS         // @parm flash address
+                      ):HRESULT; external RILDLL name 'RIL_SendFlash';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants CDMA Roaming Types | CDMA Roaming Types
+//
+// @comm The meaning of AUTOMATICA and AUTOMATICB is up to network specific interpretations
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_ROAMMODE_HOMEONLY           = $00000001;            // @constdefine The User will never go off the home network
+      RIL_ROAMMODE_AUTOMATICA         = $00000002;            // @constdefine Network define Roaming A (The effect of this setting is carrier dependent)
+      RIL_ROAMMODE_AUTOMATICB         = $00000003;            // @constdefine Network define Roaming B (The effect of this setting is carrier dependent)
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Gets the Roaming Mode in CDMA
+//
+// @comm Asynchronous.  <p lpData> points to a <t DWORD> of type RIL_ROAMMODE_*.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetRoamingMode(
+                            _hRil:HRIL                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                           ):HRESULT; external RILDLL name 'RIL_GetRoamingMode';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Modifies the state of active, held, and waiting calls in CDMA and AMPS systems
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetRoamingMode(
+                            _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                            dwRoamingMode:DWORD                 // @parm RIL_ROAMMODE_* constant
+                           ):HRESULT; external RILDLL name 'RIL_SetRoamingMode';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants CDMA Privacy Mode | CDMA Privacy Mode
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_CALLPRIVACY_STANDARD                       = $00000001; // @constdefine Enhanced Call Privacy is OFF
+      RIL_CALLPRIVACY_ENHANCED                       = $00000002; // @constdefine Enhanced Call Privacy is ON
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Gets the user's preferred privacy settings
+//
+// @comm Asynchronous.  <p lpData> points to a RIL_CALLPRIVACY_* constant.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetPreferredPrivacyMode(
+                                     _hRil:HRIL                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                    ):HRESULT; external RILDLL name 'RIL_GetPreferredPrivacyMode';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets the user's preferred privacy settings
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_SetPreferredPrivacyMode(
+                                     _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                     dwPreferredPrivacyMode:DWORD        // @parm user's preferred privacy setting, uses RIL_CALLPRIVACY_* constant
+                                    ):HRESULT; external RILDLL name 'RIL_SetPreferredPrivacyMode';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Gets the privacy status of the current system
+//
+// @comm Asynchronous.  <p lpData> points to a <t DWORD> RIL_CALLPRIVACY_* constant.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetCurrentPrivacyStatus(
+                                     _hRil:HRIL                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                    ):HRESULT; external RILDLL name 'RIL_GetCurrentPrivacyStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sends the User string to the device for Akey verificaiton
+//
+// @comm Asynchronous. <p lpData> is <def NULL>. (Either it fails or succeeds)
+// According to TSB-50 (up to 26 digits)
+//
+// -----------------------------------------------------------------------------
+
+function RIL_SendAKey(
+                      _hRil:HRIL;                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                      lpszChars:LPCSTR // @parm numeric string representing akey digits (0-9, *, #)
+                     ):HRESULT; external RILDLL name 'RIL_SendAKey';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants CDMA Location Serivces Status | Location Services
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_LOCATION_OFF                             = 0;
+      RIL_LOCATION_ON                              = 1;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Gets the current location status of the current system
+//
+// @comm Asynchronous.  <p lpData> points to a <t DWORD> RIL_LOCATION_* constant.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetCurrentLocationStatus(
+                                      _hRil:HRIL                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                     ):HRESULT; external RILDLL name 'RIL_GetCurrentLocationStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants CDMA Roaming Status | CDMA Roaming Status
+//
+// @comm None
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_ROAMSTATUS_NONE                          = 0;
+      RIL_ROAMSTATUS_ANALOG                        = 1;
+      RIL_ROAMSTATUS_DIGITAL                       = 2;
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Gets the current roaming status of the current system
+//
+// @comm Asynchronous.  <p lpData> points to a <t DWORD> RIL_ROAMSTATUS_* constant.
+//
+// -----------------------------------------------------------------------------
+function RIL_GetCurrentRoamingStatus(
+                                     _hRil:HRIL                         // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                    ):HRESULT; external RILDLL name 'RIL_GetCurrentRoamingStatus';
+
+// -----------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @constants SIM Refresh Constants | Constants which indicate which cached SIM regions to refresh.
+//
+// @comm The notification contains a DWORD value which contains the SIM record to refresh,
+//       or one of the special values below
+//
+// -----------------------------------------------------------------------------
+const
+      RIL_SIM_DATACHANGE_MSISDNS                        = $ffffffff;
+      RIL_SIM_DATACHANGE_ALL_SIMRECORDS                 = $fffffffe;
+      RIL_SIM_DATACHANGE_ALL_SIMPB                      = $fffffffd;
+      RIL_SIM_DATACHANGE_ALL                            = $fffffffc;
+
+// ---------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Sets the GPRS activation state for a context for an NDIS connection.
+//
+// @comm Asynchronous.  <p lpData> points to a <t DWORD> containing the error
+//						detail on failure or the context ID on success.
+//
+// -----------------------------------------------------------------------------
+function RIL_NDIS_SetGPRSContextActivated(
+                                          _hRil:HRIL;                 // @parm handle to RIL instance returned by <f RIL_Initialize>
+                                          lpNdisSetGprsContextActivated:LPRILNDISGPRSCONTEXT // @parm
+                                         ):HRESULT; external RILDLL name 'RIL_NDIS_SetGPRSContextActivated';
+
+// ---------------------------------------------------------------------------
+//
+// @doc EXTERNAL
+//
+// @func Send an arbitrary string to the radio for logging purposes
+//
+// @comm Asynchronous.  <p lpData> is <def NULL>.
+//
+// -----------------------------------------------------------------------------
+function RIL_LogEventToRadio(
+                             _hRil:HRIL;          // @parm handle to RIL instance returned by <f RIL_Initialize>
+                             lpszChars:LPCSTR     // @parm
+                            ):HRESULT; external RILDLL name 'RIL_LogEventToRadio';
+
+
+implementation
+
+function MAKE_RILERROR(errclass:byte; code:byte):ULONG; inline;
+begin
+  MAKE_RILERROR:=(ULONG(errclass) shl 8) or ULONG(code);
+end;
+
+function RILERRORCLASS(rilerror:ULONG):byte; inline;
+begin
+  RILERRORCLASS:=byte(ULONG((rilerror shr 8) and $FF));
+end;
+
+function ISRILERROR(rilerror:ULONG):BOOL; inline;
+begin
+  ISRILERROR:=(word(rilerror shr 16) and FACILITY_RIL)<>0;
+end;
+
+//
+// Macro to extract notification class from notification code
+//
+function NCLASS_FROM_NOTIFICATION(code:ULONG):ULONG; inline;
+begin
+  NCLASS_FROM_NOTIFICATION:=code and $FFFF0000;
+end;
+
+//
+// Macro to extract message class from message type
+//
+function MSGCLASS_FROM_MSGTYPE(itype:ULONG):ULONG; inline;
+begin
+  MSGCLASS_FROM_MSGTYPE:=itype and $FFFF0000;
+end;
+
+end.

+ 582 - 0
packages/winceunits/src/sms.pp

@@ -0,0 +1,582 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+//
+// Module: sms.h
+//
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit sms;
+
+{$CALLING cdecl}
+
+interface
+
+uses Windows;
+
+//
+// Errors
+//
+const
+      FACILITY_SMS                           = $0200;
+
+// MAKE_HRESULT rules OK!      
+// Specific registration errors (for SmsSetMessageNotification, SmsClearMessageNotification)
+const
+      SMS_E_INVALIDPROTOCOL                  = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0001;
+      SMS_E_REGISTRATIONEXISTS               = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0002;
+      SMS_S_NOSUCHREGISTRATION               = (SEVERITY_SUCCESS shl 31) or (FACILITY_SMS shl 16) or $0003;
+
+// Specific messaging errors (for SmsOpen, SmsSendMessage, SmsGetSMSC, etc.)
+      SMS_E_TOOMUCHDATA                      = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0100;
+      SMS_E_INVALIDDATA                      = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0101;
+      SMS_E_BUFFERTOOSMALL                   = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0102;
+      SMS_E_PROVIDERSPECIFICBUFFERWRONGSIZE  = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0103;
+      SMS_E_TIMEUNAVAILABLE                  = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0104;
+      SMS_E_RECEIVEHANDLEALREADYOPEN         = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0105;
+      SMS_E_DESTINATIONOUTOFSVC              = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0106;
+      SMS_E_INVALIDADDRESS                   = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0107;
+      SMS_E_MSGBARREDBYOPERATOR              = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0108;
+      SMS_E_MSGCALLBARRED                    = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0109;
+      SMS_E_NOSCSUBSCRIPTION                 = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010a;
+      SMS_E_SCBUSY                           = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010b;
+      SMS_E_SVCNOTSUBSCRIBED                 = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010c;
+      SMS_E_UNASSIGNEDNUMBER                 = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010d;
+      SMS_E_UNKNOWNSCADDRESS                 = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010e;
+      SMS_E_UNIDENTIFIEDSUBCRIBER            = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010f;
+      SMS_E_FDNRESTRICT                      = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0110;
+
+// General SMS messaging errors
+      SMS_E_MISC                             = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0200;
+      SMS_E_PASSWORD                         = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0201;
+      SMS_E_SIM                              = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0202;
+      SMS_E_NETWORKACCESS                    = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0203;
+      SMS_E_NETWORK                          = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0204;
+      SMS_E_MOBILE                           = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0205;
+      SMS_E_NETWORKUNSUPPORTED               = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0206;
+      SMS_E_MOBILEUNSUPPORTED                = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0207;
+      SMS_E_BADPARAM                         = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0208;
+      SMS_E_STORAGE                          = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0209;
+      SMS_E_SMSC                             = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $020a;
+      SMS_E_DESTINATION                      = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $020b;
+      SMS_E_DESTINATIONUNSUPPORTED           = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $020c;
+      SMS_E_RADIOUNAVAILABLE                 = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $020d;
+
+
+//
+// Constants
+//
+const
+      SMS_DATAGRAM_SIZE            = 140;
+      SMS_BROADCAST_DATAGRAM_SIZE  = 82;
+      SMS_MAX_APPNAME_LENGTH       = MAX_PATH;
+      SMS_MAX_PARAMS_LENGTH        = MAX_PATH;
+      SMS_MAX_PROTOCOLNAME_LENGTH  = MAX_PATH;
+      SMS_MAX_MESSAGEUID_SIZE      = 1024;
+      SMS_MAX_ADDRESS_LENGTH       = 256;
+      SMS_MAX_SUBADDRESS_SIZE      = 256;
+// dwMessageModes for SmsOpen
+      SMS_MODE_RECEIVE              = $00000001;
+      SMS_MODE_SEND                 = $00000002;
+// dwOptions for SmsSendMessage
+      SMS_OPTION_DELIVERY_NONE      = $00000000;
+      SMS_OPTION_DELIVERY_NO_RETRY  = $00000001;
+// dwMessageOptions for TEXT_PROVIDER_SPECIFIC_DATA
+      PS_MESSAGE_OPTION_NONE          = $00000000;
+      PS_MESSAGE_OPTION_REPLYPATH     = $00000001;
+      PS_MESSAGE_OPTION_STATUSREPORT  = $00000002;
+      PS_MESSAGE_OPTION_DISCARD       = $00000004;
+// dwMessageStatus0 and dwMessageStatus1 for SmsGetMessageStatus and the SMS status-message provider (SMS_MSGTYPE_STATUS)
+// Message status is unknown iff dwMessageStatus0 and dwMessageStatus1 are both set to MESSAGE_STATUS_UNKNOWN
+      MESSAGE_STATUS_UNKNOWN                  = $00000000;
+// Valid bits for dwMessageStatus0
+      MESSAGE_STATUS_0_RECEIVEDBYSME            = $00000001;
+      MESSAGE_STATUS_0_FORWARDEDTOSME           = $00000002;
+      MESSAGE_STATUS_0_REPLACEDBYSC             = $00000004;
+      MESSAGE_STATUS_0_CONGESTION_TRYING        = $00000008;
+      MESSAGE_STATUS_0_SMEBUSY_TRYING           = $00000010;
+      MESSAGE_STATUS_0_SMENOTRESPONDING_TRYING  = $00000020;
+      MESSAGE_STATUS_0_SVCREJECTED_TRYING       = $00000040;
+      MESSAGE_STATUS_0_QUALITYUNAVAIL_TRYING    = $00000080;
+      MESSAGE_STATUS_0_SMEERROR_TRYING          = $00000100;
+      MESSAGE_STATUS_0_CONGESTION               = $00000200;
+      MESSAGE_STATUS_0_SMEBUSY                  = $00000400;
+      MESSAGE_STATUS_0_SMENOTRESPONDING         = $00000800;
+      MESSAGE_STATUS_0_SVCREJECTED              = $00001000;
+      MESSAGE_STATUS_0_QUALITYUNAVAIL_TEMP      = $00002000;
+      MESSAGE_STATUS_0_SMEERROR                 = $00004000;
+      MESSAGE_STATUS_0_REMOTEPROCERROR          = $00008000;
+      MESSAGE_STATUS_0_INCOMPATIBLEDEST         = $00010000;
+      MESSAGE_STATUS_0_CONNECTIONREJECTED       = $00020000;
+      MESSAGE_STATUS_0_NOTOBTAINABLE            = $00040000;
+      MESSAGE_STATUS_0_NOINTERNETWORKING        = $00080000;
+      MESSAGE_STATUS_0_VPEXPIRED                = $00100000;
+      MESSAGE_STATUS_0_DELETEDBYORIGSME         = $00200000;
+      MESSAGE_STATUS_0_DELETEDBYSC              = $00400000;
+      MESSAGE_STATUS_0_NOLONGEREXISTS           = $00800000;
+      MESSAGE_STATUS_0_QUALITYUNAVAIL           = $01000000;
+      MESSAGE_STATUS_0_RESERVED_COMPLETED       = $02000000;
+      MESSAGE_STATUS_0_RESERVED_TRYING          = $04000000;
+      MESSAGE_STATUS_0_RESERVED_ERROR           = $08000000;
+      MESSAGE_STATUS_0_RESERVED_TMPERROR        = $10000000;
+      MESSAGE_STATUS_0_SCSPECIFIC_COMPLETED     = $20000000;
+      MESSAGE_STATUS_0_SCSPECIFIC_TRYING        = $40000000;
+      MESSAGE_STATUS_0_SCSPECIFIC_ERROR         = $80000000;
+// Valid bits for dwMessageStatus1
+      MESSAGE_STATUS_1_SCSPECIFIC_TMPERROR      = $00000001;
+// Language identifiers for SMS_BROADCAST_RANGES.dwBroadcastMsgLangs
+      SMS_DCSLANG_UNKNOWN                       = $00000001;
+      SMS_DCSLANG_GERMAN                        = $00000002;
+      SMS_DCSLANG_ENGLISH                       = $00000004;
+      SMS_DCSLANG_ITALIAN                       = $00000008;
+      SMS_DCSLANG_FRENCH                        = $00000010;
+      SMS_DCSLANG_SPANISH                       = $00000020;
+      SMS_DCSLANG_DUTCH                         = $00000040;
+      SMS_DCSLANG_SWEDISH                       = $00000080;
+      SMS_DCSLANG_DANISH                        = $00000100;
+      SMS_DCSLANG_PORTUGUESE                    = $00000200;
+      SMS_DCSLANG_FINNISH                       = $00000400;
+      SMS_DCSLANG_NORWEGIAN                     = $00000800;
+      SMS_DCSLANG_GREEK                         = $00001000;
+      SMS_DCSLANG_TURKISH                       = $00002000;
+      SMS_DCSLANG_HUNGARIAN                     = $00004000;
+      SMS_DCSLANG_POLISH                        = $00008000;
+      SMS_DCSLANG_CZECH                         = $00010000;
+      SMS_DCSLANG_HEBREW                        = $00020000;
+      SMS_DCSLANG_ARABIC                        = $00040000;
+      SMS_DCSLANG_RUSSIAN                       = $00080000;
+      SMS_DCSLANG_ICELANDIC                     = $00100000;
+      SMS_DCSLANG_ALL                           = $001fffff;
+
+// Valid flags for SMS_BROADCAST_RANGES.dwParams
+      SMS_PARAM_SBR_BROADCASTMSGIDS             = $00000001;
+      SMS_PARAM_SBR_BROADCASTMSGLANGS           = $00000002;
+      SMS_PARAM_SBR_ACCEPTIDS                   = $00000004;
+//Valid values for ProtocolID
+      SMS_MSGPROTOCOL_UNKNOWN                     = $00000000;
+      SMS_MSGPROTOCOL_SMETOSME                    = $00000001;
+      SMS_MSGPROTOCOL_IMPLICIT                    = $00000002;
+      SMS_MSGPROTOCOL_TELEX                       = $00000003;
+      SMS_MSGPROTOCOL_TELEFAX_GROUP3              = $00000004;
+      SMS_MSGPROTOCOL_TELEFAX_GROUP4              = $00000005;
+      SMS_MSGPROTOCOL_VOICEPHONE                  = $00000006;
+      SMS_MSGPROTOCOL_ERMES                       = $00000007;
+      SMS_MSGPROTOCOL_PAGING                      = $00000008;
+      SMS_MSGPROTOCOL_VIDEOTEX                    = $00000009;
+      SMS_MSGPROTOCOL_TELETEX                     = $0000000a;
+      SMS_MSGPROTOCOL_TELETEX_PSPDN               = $0000000b;
+      SMS_MSGPROTOCOL_TELETEX_CSPDN               = $0000000c;
+      SMS_MSGPROTOCOL_TELETEX_PSTN                = $0000000d;
+      SMS_MSGPROTOCOL_TELETEX_ISDN                = $0000000e;
+      SMS_MSGPROTOCOL_UCI                         = $0000000f;
+      SMS_MSGPROTOCOL_MSGHANDLING                 = $00000010;
+      SMS_MSGPROTOCOL_X400                        = $00000011;
+      SMS_MSGPROTOCOL_EMAIL                       = $00000012;
+      SMS_MSGPROTOCOL_SCSPECIFIC1             = $00000013;
+      SMS_MSGPROTOCOL_SCSPECIFIC2             = $00000014;
+      SMS_MSGPROTOCOL_SCSPECIFIC3             = $00000015;
+      SMS_MSGPROTOCOL_SCSPECIFIC4             = $00000016;
+      SMS_MSGPROTOCOL_SCSPECIFIC5             = $00000017;
+      SMS_MSGPROTOCOL_SCSPECIFIC6             = $00000018;
+      SMS_MSGPROTOCOL_SCSPECIFIC7             = $00000019;
+      SMS_MSGPROTOCOL_GSMSTATION                  = $0000001a;
+      SMS_MSGPROTOCOL_SM_TYPE0                    = $0000001b;
+      SMS_MSGPROTOCOL_RSM_TYPE1                   = $0000001c;
+      SMS_MSGPROTOCOL_RSM_TYPE2                   = $0000001d;
+      SMS_MSGPROTOCOL_RSM_TYPE3                   = $0000001e;
+      SMS_MSGPROTOCOL_RSM_TYPE4                   = $0000001f;
+      SMS_MSGPROTOCOL_RSM_TYPE5                   = $00000020;
+      SMS_MSGPROTOCOL_RSM_TYPE6                   = $00000021;
+      SMS_MSGPROTOCOL_RSM_TYPE7                   = $00000022;
+      SMS_MSGPROTOCOL_RETURNCALL                  = $00000023;
+      SMS_MSGPROTOCOL_ME_DOWNLOAD                 = $00000024;
+      SMS_MSGPROTOCOL_DEPERSONALIZATION           = $00000025;
+      SMS_MSGPROTOCOL_SIM_DOWNLOAD                = $00000026;
+
+//
+// Enumerations
+//
+type
+     SMS_ADDRESS_TYPE = (SMSAT_UNKNOWN := 0,
+                         SMSAT_INTERNATIONAL,
+                         SMSAT_NATIONAL,
+                         SMSAT_NETWORKSPECIFIC,
+                         SMSAT_SUBSCRIBER,
+                         SMSAT_ALPHANUMERIC,
+                         SMSAT_ABBREVIATED);
+
+     SMS_DATA_ENCODING  = (SMSDE_OPTIMAL := 0,
+                           SMSDE_GSM,
+                           SMSDE_UCS2);
+
+     PROVIDER_SPECIFIC_MESSAGE_CLASS = (PS_MESSAGE_CLASS0 := 0,
+                                        PS_MESSAGE_CLASS1,
+                                        PS_MESSAGE_CLASS2,
+                                        PS_MESSAGE_CLASS3,
+                                        PS_MESSAGE_CLASSUNSPECIFIED);
+
+     PROVIDER_SPECIFIC_REPLACE_OPTION = (PSRO_NONE := 0,
+                                         PSRO_REPLACE_TYPE1,
+                                         PSRO_REPLACE_TYPE2,
+                                         PSRO_REPLACE_TYPE3,
+                                         PSRO_REPLACE_TYPE4,
+                                         PSRO_REPLACE_TYPE5,
+                                         PSRO_REPLACE_TYPE6,
+                                         PSRO_REPLACE_TYPE7,
+                                         PSRO_RETURN_CALL,
+                                         PSRO_DEPERSONALIZATION);
+
+//
+// Types
+//
+type
+     SMS_HANDLE = DWORD;
+     LPSMS_HANDLE = ^SMS_HANDLE;
+
+     SMS_MESSAGE_ID = DWORD;
+     LPSMS_MESSAGE_ID = ^SMS_MESSAGE_ID;
+
+const
+      INVALID_MESSAGE_ID = SMS_MESSAGE_ID($ffffffff);
+
+// Registration structure used by SmsSetMessageNotification and SmsClearMessageNotification
+type
+     smsregistrationdata_tag = record
+       cbSize:DWORD;
+       tszAppName:array[0..SMS_MAX_APPNAME_LENGTH-1] of TCHAR;
+       tszParams:array[0..SMS_MAX_PARAMS_LENGTH-1] of TCHAR;
+       tszProtocolName:array[0..SMS_MAX_PROTOCOLNAME_LENGTH-1] of TCHAR;
+     end;
+
+     SMSREGISTRATIONDATA = smsregistrationdata_tag;
+     LPSMSREGISTRATIONDATA = ^smsregistrationdata_tag;
+
+// SMS addressing information
+type
+     sms_address_tag = record
+       smsatAddressType:SMS_ADDRESS_TYPE;
+       ptsAddress:array[0..SMS_MAX_ADDRESS_LENGTH-1] of TCHAR;
+     end;
+     SMS_ADDRESS = sms_address_tag;
+     LPSMS_ADDRESS = ^sms_address_tag;
+
+// SMS status message information
+type
+     sms_status_information_tag = record
+       smsmidMessageID:SMS_MESSAGE_ID;
+       dwMessageStatus0:DWORD;
+       dwMessageStatus1:DWORD;
+       smsaRecipientAddress:SMS_ADDRESS;
+       stServiceCenterTimeStamp:SYSTEMTIME;  // (UTC time)
+       stDischargeTime:SYSTEMTIME;  // (UTC time)
+     end;
+     SMS_STATUS_INFORMATION = sms_status_information_tag;
+     LPSMS_STATUS_INFORMATION = ^sms_status_information_tag;
+
+// SMS broadcast message range information
+type
+     sms_range_tag = record
+       dwMinimum:DWORD;
+       dwMaximum:DWORD;
+     end;
+     SMS_RANGE = sms_range_tag;
+     LPSMS_RANGE = ^sms_range_tag;
+     
+// SMS broadcast message ranges information
+// Use #pragma to avoid "warning C4200: nonstandard extension used : zero-sized array in struct/union
+type
+     sms_broadcast_ranges_tag = record
+       cbSize:DWORD;
+       dwParams:DWORD;
+       dwNumRanges:DWORD;
+       dwBroadcastMsgLangs:DWORD;
+       bAccept:BOOL;
+       smsrBroadcastRanges:array[0..0] of SMS_RANGE;
+     end;
+     SMS_BROADCAST_RANGES = sms_broadcast_ranges_tag;
+     LPSMS_BROADCAST_RANGES = ^sms_broadcast_ranges_tag;
+     
+//
+// SMS message types (for use with SmsOpen)
+//
+
+// Text message type
+const
+      SMS_MSGTYPE_TEXT = 'Microsoft Text SMS Protocol';
+      
+// Provider-specific data for use with SmsSendMessage and SmsReadMessage
+
+// Bitfield values for the extended parameters of the text provider structure.
+const
+      TEXTPSEXTPARM_NONE         = $00000000;
+      TEXTPSEXTPARM_CALLBACK     = $00000001;
+      TEXTPSEXTPARM_PRIORITY     = $00000002;
+      TEXTPSEXTPARM_ALL          = $00000003;
+
+// The priority enum should match up with the RIL_MSGPRIORITY_* defines.
+// If any new values are added, the Priority mapping functions of sms_txtshared_cdma.cpp
+// should also be adjusted.
+type
+     TEXT_PROVIDER_SPECIFIC_PRIORITY_TYPE = (TEXTPSPRI_NONE := 0,
+                                             TEXTPSPRI_NORMAL := 1,
+                                             TEXTPSPRI_INTERACTIVE,
+                                             TEXTPSPRI_URGENT,
+                                             TEXTPSPRI_EMERGENCY);
+
+type
+     text_provider_specific_data_tag = record
+       dwMessageOptions:DWORD;
+       psMessageClass:PROVIDER_SPECIFIC_MESSAGE_CLASS;
+       psReplaceOption:PROVIDER_SPECIFIC_REPLACE_OPTION;
+       dwHeaderDataSize:DWORD;
+       pbHeaderData:array[0..SMS_DATAGRAM_SIZE-1] of byte;   // For concatenated messages, only the header from the first segment is returned.
+       fMessageContainsEMSHeaders:BOOL;     // At least one segment of this message contains EMS headers.
+                                            // Only set if EMS handler installed.
+       dwProtocolID:DWORD;                  // PID of incoming message, or desired PID of outgoing message.
+                                            // Applies only to GSM.  Set to SMS_MSGPROTOCOL_UNKNOWN if psReplaceOption
+                                            // is not PSRO_NONE.
+       dwExtParams:DWORD;                   // Bitfield of valid additional structure parameters (all structure
+                                            // values above are considered always valid).
+       tpsPriority:TEXT_PROVIDER_SPECIFIC_PRIORITY_TYPE; // Applies only to CDMA IS637. Priority indicator.
+       smsaCallback:SMS_ADDRESS;                         // Applies only to CDMA IS637. Callback number
+     end;
+     TEXT_PROVIDER_SPECIFIC_DATA = text_provider_specific_data_tag;
+
+// Class 2 Text message type
+const
+      SMS_MSGTYPE_CLASS2 = 'Microsoft Class2 SMS Protocol';
+
+type
+     class2_provider_specific_data_tag = record
+       dwMessageOptions:DWORD;
+       psMessageClass:PROVIDER_SPECIFIC_MESSAGE_CLASS;
+       psReplaceOption:PROVIDER_SPECIFIC_REPLACE_OPTION;
+       dwHeaderDataSize:DWORD;
+       pbHeaderData:array[0..SMS_DATAGRAM_SIZE-1] of byte;   // For concatenated messages, only the header from the first segment is returned.
+       fMessageContainsEMSHeaders:BOOL;     // At least one segment of this message contains EMS headers.
+                                            // Only set if EMS handler installed.
+       dwProtocolID:DWORD;                  // PID of incoming message, or desired PID of outgoing message.
+                                            // Applies only to GSM.  Set to SMS_MSGPROTOCOL_UNKNOWN if psReplaceOption
+                                            // is not PSRO_NONE.
+       dwLocation:DWORD;
+       dwIndex:DWORD;
+     end;
+     CLASS2_PROVIDER_SPECIFIC_DATA = class2_provider_specific_data_tag;
+
+// Notification message type
+const
+      SMS_MSGTYPE_NOTIFICATION = 'Microsoft Notification SMS Protocol (Receive Only)';
+
+// Provider-specific data for use with SmsReadMessage
+type
+     NOTIFICATION_PROVIDER_SPECIFIC_MSG_WAITING_TYPE = (NOTIFICATIONPSMWT_NONE := 0,
+                                                        NOTIFICATIONPSMWT_GENERIC,
+                                                        NOTIFICATIONPSMWT_VOICEMAIL,
+                                                        NOTIFICATIONPSMWT_FAX,
+                                                        NOTIFICATIONPSMWT_EMAIL,
+                                                        NOTIFICATIONPSMWT_OTHER);
+
+const
+      NOTIFICATIONPS_NUM_MSG_WAITING_UNKNOWN  = -1;
+      NOTIFICATIONPS_NUM_MSG_WAITING_NONZERO  = -2;
+
+type
+     NOTIFICATION_PROVIDER_SPECIFIC_INDICATOR_TYPE = (NOTIFICATIONPSIT_NONE := 0,
+                                                      NOTIFICATIONPSIT_LINE1 := 1,
+                                                      NOTIFICATIONPSIT_LINE2 := 2);
+
+type
+     notification_provider_specific_data_tag = record
+       dwMessageOptions:DWORD;
+       psMessageClass:PROVIDER_SPECIFIC_MESSAGE_CLASS;
+       psReplaceOption:PROVIDER_SPECIFIC_REPLACE_OPTION;
+       npsMsgWaitingType:NOTIFICATION_PROVIDER_SPECIFIC_MSG_WAITING_TYPE;
+       iNumberOfMessagesWaiting:longint;
+       npsIndicatorType:NOTIFICATION_PROVIDER_SPECIFIC_INDICATOR_TYPE;
+     end;
+     NOTIFICATION_PROVIDER_SPECIFIC_DATA = notification_provider_specific_data_tag;
+
+// WDP message type
+const
+      SMS_MSGTYPE_WDP = 'Microsoft WDP SMS Protocol';
+
+// Provider-specific data for use with SmsSendMessage and SmsReadMessage
+type
+     WDP_PROVIDER_SPECIFIC_PORT_ADDRESSING = (WDPPSPA_8_BIT_PORT_NUMBERS := 0,
+                                              WDPPSPA_16_BIT_PORT_NUMBERS);
+
+type
+     wdp_provider_specific_data_tag = record
+       wdppsPortAddressing:WDP_PROVIDER_SPECIFIC_PORT_ADDRESSING;
+       wDestinationPort:word;
+       wOriginatorPort:word;
+     end;
+     WDP_PROVIDER_SPECIFIC_DATA = wdp_provider_specific_data_tag;
+
+// WCMP message type
+const
+      SMS_MSGTYPE_WCMP = 'Microsoft WCMP SMS Protocol';
+      
+// Provider-specific data for use with SmsSendMessage and SmsReadMessage
+type
+     WCMP_PROVIDER_SPECIFIC_MESSAGE_TYPE = (WCMPPSMT_UNSUPPORTED := 0,
+                                            WCMPPSMT_PORT_UNREACHABLE,
+                                            WCMPPSMT_MESSAGE_TOO_BIG,
+                                            WCMPPSMT_ECHO_REQUEST,
+                                            WCMPPSMT_ECHO_REPLY);
+
+type
+     wcmp_provider_specific_data_tag = record
+       wcmppsMessageType:WCMP_PROVIDER_SPECIFIC_MESSAGE_TYPE;
+       wParam1:word;
+       wParam2:word;
+       wParam3:word;
+       smsaAddress:SMS_ADDRESS;
+     end;
+     WCMP_PROVIDER_SPECIFIC_DATA = wcmp_provider_specific_data_tag;
+
+// Status message type
+const
+      SMS_MSGTYPE_STATUS = 'Microsoft Status Message SMS Protocol (Receive Only)';
+
+// Provider-specific data for use with SmsReadMessage
+type
+     status_provider_specific_data_tag = record
+       smssiStatusInformation:SMS_STATUS_INFORMATION;
+     end;
+     STATUS_PROVIDER_SPECIFIC_DATA = status_provider_specific_data_tag;
+
+// Broadcast message type
+const
+      SMS_MSGTYPE_BROADCAST = 'Microsoft Broadcast Message SMS Protocol (Receive Only)';
+
+type
+     BROADCAST_PROVIDER_SPECIFIC_GEOGRAPHICAL_SCOPE = (BPSGS_UNKNOWN := 0,
+                                                       BPSGS_CELL_DISPLAY_IMMEDIATE,
+                                                       BPSGS_CELL,
+                                                       BPSGS_PLMN,
+                                                       BPSGS_LOCATION_AREA);
+
+// Provider-specific data for use with SmsReadMessage
+type
+     broadcast_provider_specific_data_tag = record
+       wMessageID:word;
+       wMessageCode:word;
+       bpsgsGeographicalScope:BROADCAST_PROVIDER_SPECIFIC_GEOGRAPHICAL_SCOPE;
+       wUpdateNumber:word;
+     end;
+     BROADCAST_PROVIDER_SPECIFIC_DATA = broadcast_provider_specific_data_tag;
+
+// Raw message type
+const
+      SMS_MSGTYPE_RAW = 'Microsoft Raw SMS Protocol (Receive Only)';
+      
+// Provider-specific data for use with SmsReadMessage
+type
+     raw_provider_specific_data_tag  = record
+       dwHeaderDataSize:DWORD;
+       pbHeaderData:array[0..SMS_DATAGRAM_SIZE-1] of byte;
+     end;
+     RAW_PROVIDER_SPECIFIC_DATA = raw_provider_specific_data_tag;
+
+
+//
+// APIs for SMS.dll
+//
+
+const
+      SmsDLL = 'sms.dll';
+
+function SmsSetMessageNotification(psmsrd:LPSMSREGISTRATIONDATA):HRESULT; external SmsDLL name 'SmsSetMessageNotification';
+
+function SmsClearMessageNotification(tszProtocolName:LPCTSTR):HRESULT; external SmsDLL name 'SmsClearMessageNotification';
+
+// Open the SMS Messaging component for read and/or write access
+//
+// Each protocol may only have one handle open with SMS_MODE_RECEIVE.
+// Additional attempts to get RECEIVE mode on a given protocol will result in
+// SMS_E_RECEIVEHANDLEALREADYOPEN.
+//
+// Currently all protocols have applications whith open RECEIVE handles.  As a
+// result, using the SMS API to receive SMS messages is not supported.  Attempts
+// to do so may interfere with the proper operation of Inbox, WAP, or other SMS
+// applications.
+//
+// The IMailRuleClient interface in cemapi.h may be used to access received
+// text SMS messages.
+function SmsOpen(ptsMessageProtocol:LPCTSTR;
+                 dwMessageModes:DWORD;
+                 psmshHandle:LPSMS_HANDLE;
+                 phMessageAvailableEvent:LPHANDLE):HRESULT; external SmsDLL name 'SmsOpen';
+
+// Close a handle to the SMS messaging component
+function SmsClose(smshHandle:SMS_HANDLE):HRESULT; external SmsDLL name 'SmsClose';
+
+// Send an SMS message
+function SmsSendMessage(smshHandle:SMS_HANDLE;
+                        psmsaSMSCAddress:LPSMS_ADDRESS;
+                        psmsaDestinationAddress:SMS_ADDRESS;
+                        pstValidityPeriod:LPSYSTEMTIME;  // (Values in this structure are expressed relative to the current time)
+                        pbData:LPBYTE;
+                        dwDataSize:DWORD;
+                        pbProviderSpecificData:LPBYTE;
+                        dwProviderSpecificDataSize:DWORD;
+                        smsdeDataEncoding:SMS_DATA_ENCODING;
+                        dwOptions:DWORD;
+                        psmsmidMessageID:LPSMS_MESSAGE_ID):HRESULT; external SmsDLL name 'SmsSendMessage';
+
+// Determine an upper-bound for the size of the buffer needed by the next call to SmsReadMessage
+function SmsGetMessageSize(smshHandle:SMS_HANDLE;
+                           pdwDataSize:LPDWORD):HRESULT; external SmsDLL name 'SmsGetMessageSize';
+
+// Read an SMS message (the appropriate size of the buffer can be found via a call to SmsGetMessageSize)
+function SmsReadMessage(smshHandle:SMS_HANDLE;
+                        psmsaSMSCAddress:LPSMS_ADDRESS;
+                        psmsaSourceAddress:LPSMS_ADDRESS;
+                        pstReceiveTime:LPSYSTEMTIME;  // (UTC time)
+                        pbBuffer:LPBYTE;
+                        dwBufferSize:DWORD;
+                        pbProviderSpecificBuffer:LPBYTE;
+                        dwProviderSpecificDataBuffer:DWORD;
+                        pdwBytesRead:LPDWORD):HRESULT; external SmsDLL name 'SmsReadMessage';
+
+// Waits to receive a status-report for an SMS message
+function SmsGetMessageStatus(smshHandle:SMS_HANDLE;
+                             smsmidMessageID:SMS_MESSAGE_ID;
+                             psmssiStatusInformation:LPSMS_STATUS_INFORMATION;
+                             dwTimeout:DWORD):HRESULT; external SmsDLL name 'SmsGetMessageStatus';
+
+// Get the default SMS Service Center address
+function SmsGetSMSC(psmsaSMSCAddress:LPSMS_ADDRESS):HRESULT; external SmsDLL name 'SmsGetSMSC';
+
+// Set the default SMS Service Center address
+function SmsSetSMSC(psmsaSMSCAddress:LPSMS_ADDRESS):HRESULT; external SmsDLL name 'SmsSetSMSC';
+
+// Get the range of broadcast messages to listen for
+function SmsGetBroadcastMsgRanges(psmsbrBroadcastRanges:LPSMS_BROADCAST_RANGES):HRESULT; external SmsDLL name 'SmsGetBroadcastMsgRanges';
+
+// Set the range of broadcast messages to listen for
+function SmsSetBroadcastMsgRanges(psmsbrBroadcastRanges:LPSMS_BROADCAST_RANGES):HRESULT; external SmsDLL name 'SmsSetBroadcastMsgRanges';
+
+// Get the device's phone number for SMS
+function SmsGetPhoneNumber(psmsaAddress:LPSMS_ADDRESS):HRESULT; external SmsDLL name 'SmsGetPhoneNumber';
+
+// Approximate the system time based on the time indicated by the SMSC in the last status-report message
+function SmsGetTime(ptsCurrentTime:LPSYSTEMTIME;  // (UTC time)
+                    pdwErrorMargin:LPDWORD):HRESULT; external SmsDLL name 'SmsGetTime';
+
+implementation
+
+end.

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

@@ -0,0 +1,4362 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+
+//
+// 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.

+ 320 - 0
packages/winceunits/src/ws2bth.pp

@@ -0,0 +1,320 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+//
+// Module Name:
+//
+//        ws2bth.h
+//
+// Abstract:
+//
+//        Winsock 2 Bluetooth Annex definitions.
+//
+
+//
+//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
+//
+
+unit ws2bth;
+
+{$CALLING cdecl}
+
+interface
+
+uses Windows;
+
+const
+      BTH_MAX_NAME_SIZE          = 248;    // max length of device friendly name.
+
+// Some explanations of the BT_ADDR structure.
+// Taken from module bt_ddi.h which is a part of MS WinCE 6.0 Platform Builder
+// and defines interfaces between layers of Bluetooth device driver.
+
+//  ------------------------------------ BD_ADDR------------------------------------
+//
+{$PACKRECORDS 1} // #pragma pack(push, 1)
+type
+     __bd_addr = record
+       SAP:Cardinal; // Significant address part.
+                     // The lower 24 bits are the 'Lower address part' and
+                     // the higher 8 bits are the 'Upper address part'.
+       NAP:word;     // Non-significant address part.
+     end;
+     BD_ADDR = __bd_addr;
+(* Declared as:
+typedef struct  __bd_addr {
+    union {
+        struct {
+            unsigned int LAP : 24;  // Lower address part
+            unsigned int UAP : 8;   // Upper address part
+        };
+        unsigned int SAP;           // Significant address part
+    };
+
+    unsigned short NAP;             // Non-significant address part
+} BD_ADDR;
+*)
+{$PACKRECORDS DEFAULT} // #pragma pack(pop)
+
+const
+      BLUETOOTH_TRANSPORT_NAME = 'MSBT';
+
+// End of BT_ADDR explanation.
+
+type
+     BT_ADDR = ULONGLONG;
+     PBT_ADDR = ^BT_ADDR;
+     TBtAddr = BT_ADDR;
+     PBtAddr = ^TBtAddr;
+
+type
+     BT_COD = ULONG;
+     TBtCod = BT_COD;
+
+type
+     BT_LAP = ULONG;
+     TBtLap = BT_LAP;
+
+const
+      NAP_MASK                = ULONGLONG($FFFF00000000);
+      SAP_MASK                = ULONGLONG($0000FFFFFFFF);
+
+      NAP_BIT_OFFSET          = 8 * 4;
+      SAP_BIT_OFFSET          = 0;
+
+// Macro functions.      
+function GET_NAP(const _bt_addr:BT_ADDR):USHORT;
+
+function GET_SAP(const _bt_addr:BT_ADDR):ULONG;
+
+function SET_NAP(const _nap:USHORT):ULONGLONG;
+
+function SET_SAP(const _sap:ULONG):ULONGLONG;
+
+function SET_NAP_SAP(const _nap:USHORT; const _sap:ULONG):ULONGLONG; 
+
+
+// Turn 1 byte packing of structures on
+const
+      L2CAP_MAX_MTU  = 65535;
+
+const
+      BT_ADDR_NULL       = $000000000000;
+      BT_ADDR_IAC_FIRST  = $9E8B00;
+      BT_ADDR_IAC_LAST   = $9E8B3f;
+      BT_ADDR_LIAC       = $9E8B00;
+      BT_ADDR_GIAC       = $9E8B33;
+
+      BT_PORT_NULL       = 0;
+      BT_PORT_WILDCARD   = 0;
+      BT_PORT_ANY        = -1;
+      BT_PORT_MIN        = $1;
+      BT_PORT_MAX        = $ffff;
+      BT_PORT_DYN_FIRST  = $1001;
+      BT_PORT_EXCL_BIT   = $0100;
+
+const
+      AF_BTH        = 32;
+      AF_BT         = AF_BTH;
+      WINDOWS_AF_BT = AF_BTH;
+      AF_MAX        = 33;
+
+      PF_BTH        = AF_BTH;
+      PF_MAX        = AF_BTH;
+
+
+      NS_BTH  = 16;
+
+const
+      SVCID_BTH_PROVIDER:GUID = (D1: $06AA63E0; D2: $7D60; D3: $41FF; D4: ($AF, $B2, $3E, $E6, $D2, $D9, $39, $2D));
+//      SVCID_BTH_PROVIDER:GUID = '{06AA63E0-7D60-41FF-AFB2-3EE6D2D9392D}';
+
+
+// Bluetooth protocol #s are assigned according to the Bluetooth
+// Assigned Numbers portion of the Bluetooth Specification
+const
+      BTHPROTO_RFCOMM     = $0003;
+      BTHPROTO_L2CAP      = $0100;
+
+      SDP_ENUMDEVICES     = $00000010;
+      SDP_SET             = $00000011;
+      SDP_QUERY           = $00000012;
+
+      RFCOMM_FLOW_CONTROL = $00000013;
+
+      SOL_RFCOMM          = $03;
+      SOL_BTHTDI          = $100;
+      SOL_SDP             = $0101;
+
+type
+     _BTH_SOCKOPT_SECURITY = record
+       iLength:longint;  // == 0 or 16 for link key, 0<=..<=16 for PIN. 0 = revoke
+       btAddr:BT_ADDR;
+       caData:array[0..15] of byte;
+     end;
+     BTH_SOCKOPT_SECURITY = _BTH_SOCKOPT_SECURITY;
+     PBTH_SOCKOPT_SECURITY = ^_BTH_SOCKOPT_SECURITY;
+
+type
+     _BTH_LOCAL_VERSION = record
+       hci_version:byte;
+       hci_revision:word;
+       lmp_version:byte;
+       lmp_subversion:word;
+       manufacturer:word;
+       lmp_features:array[0..7] of byte;
+     end;
+     BTH_LOCAL_VERSION = _BTH_LOCAL_VERSION;
+     PBTH_LOCAL_VERSION = ^_BTH_LOCAL_VERSION;
+
+type
+     _BTH_REMOTE_VERSION = record
+       lmp_version:byte;
+       lmp_subversion:word;
+       manufacturer:word;
+       lmp_features:array[0..7] of byte;
+     end;
+     BTH_REMOTE_VERSION = _BTH_REMOTE_VERSION;
+     PBTH_REMOTE_VERSION = ^_BTH_REMOTE_VERSION;
+
+type
+     _BTH_REMOTE_NAME = record
+       bt:BT_ADDR;
+       szNameBuffer:array[0..BTH_MAX_NAME_SIZE-1] of WideChar;
+     end;
+     BTH_REMOTE_NAME = _BTH_REMOTE_NAME;
+     PBTH_REMOTE_NAME = ^_BTH_REMOTE_NAME;
+
+type
+     _BTH_HOLD_MODE = record
+       hold_mode_max:word;
+       hold_mode_min:word;
+       interval:word;    // out
+     end;
+     BTH_HOLD_MODE = _BTH_HOLD_MODE;
+     PBTH_HOLD_MODE = ^_BTH_HOLD_MODE;
+
+type
+     _BTH_SNIFF_MODE = record
+       sniff_mode_max:word;
+       sniff_mode_min:word;
+       sniff_attempt:word;
+       sniff_timeout:word;
+       interval:word;    // out
+     end;
+     BTH_SNIFF_MODE = _BTH_SNIFF_MODE;
+     PBTH_SNIFF_MODE = ^_BTH_SNIFF_MODE;
+
+type
+     _BTH_PARK_MODE = record
+       beacon_max:word;
+       beacon_min:word;
+       interval:word;    // out
+     end;
+     BTH_PARK_MODE = _BTH_PARK_MODE;
+     PBTH_PARK_MODE = ^_BTH_PARK_MODE;
+
+const
+      SO_BTH_AUTHENTICATE             = $00000001;  // optlen=0, optval ignored
+      SO_BTH_ENCRYPT                      = $00000002;  // optlen=sizeof(unsigned int), optval = &(unsigned int)TRUE/FALSE
+      SO_BTH_SET_PIN                      = $00000003;  // bound only! survives socket! optlen=sizeof(BTH_SOCKOPT_SECURITY), optval=&BTH_SOCKOPT_SECURITY
+      SO_BTH_SET_LINK                    = $00000004;   // bound only! survives socket! optlen=sizeof(BTH_SOCKOPT_SECURITY), optval=&BTH_SOCKOPT_SECURITY
+      SO_BTH_GET_LINK                    = $00000005;   // bound only! optlen=sizeof(BTH_SOCKOPT_SECURITY), optval=&BTH_SOCKOPT_SECURITY
+      SO_BTH_SET_MTU                      = $00000006;  // unconnected only! optlen=sizeof(unsigned int), optval = &mtu
+      SO_BTH_GET_MTU                      = $00000007;  // optlen=sizeof(unsigned int), optval = &mtu
+      SO_BTH_SET_MTU_MAX               = $00000008; // unconnected only! optlen=sizeof(unsigned int), optval = &max. mtu
+      SO_BTH_GET_MTU_MAX               = $00000009; // bound only! optlen=sizeof(unsigned int), optval = &max. mtu
+      SO_BTH_SET_MTU_MIN               = $0000000a; // unconnected only! optlen=sizeof(unsigned int), optval = &min. mtu
+      SO_BTH_GET_MTU_MIN               = $0000000b; // bound only! optlen=sizeof(unsigned int), optval = &min. mtu
+      SO_BTH_SET_XON_LIM               = $0000000c; // optlen=sizeof(unsigned int), optval = &xon limit (set flow off)
+      SO_BTH_GET_XON_LIM               = $0000000d; // optlen=sizeof(unsigned int), optval = &xon
+      SO_BTH_SET_XOFF_LIM             = $0000000e;  // optlen=sizeof(unsigned int), optval = &xoff limit (set flow on)
+      SO_BTH_GET_XOFF_LIM             = $0000000f;  // optlen=sizeof(unsigned int), optval = &xoff
+      SO_BTH_SET_SEND_BUFFER        = $00000010;    // optlen=sizeof(unsigned int), optval = &max buffered size for send
+      SO_BTH_GET_SEND_BUFFER        = $00000011;    // optlen=sizeof(unsigned int), optval = &max buffered size for send
+      SO_BTH_SET_RECV_BUFFER        = $00000012;    // optlen=sizeof(unsigned int), optval = &max buffered size for recv
+      SO_BTH_GET_RECV_BUFFER        = $00000013;    // optlen=sizeof(unsigned int), optval = &max buffered size for recv
+      SO_BTH_GET_V24_BR             = $00000014;    // connected only! optlen=2*sizeof(unsigned int), optval = &{v24 , br}
+      SO_BTH_GET_RLS                      = $00000015;  // connected only! optlen=sizeof(unsigned int), optval = &rls
+      SO_BTH_SEND_MSC                    = $00000016;   // connected only! optlen=2*sizeof(unsigned int), optval = &{v24, br}
+      SO_BTH_SEND_RLS                    = $00000017;   // connected only! optlen=sizeof(unsigned int), optval = &rls
+      SO_BTH_GET_FLOW_TYPE        = $00000018;  // connected only! optlen=sizeof(unsigned int), optval=&1=credit-based, 0=legacy
+      SO_BTH_SET_PAGE_TO               = $00000019; // no restrictions. optlen=sizeof(unsigned int), optval = &page timeout
+      SO_BTH_GET_PAGE_TO               = $0000001a; // no restrictions. optlen=sizeof(unsigned int), optval = &page timeout
+      SO_BTH_SET_SCAN                    = $0000001b;   // no restrictions. optlen=sizeof(unsigned int), optval = &scan mode
+      SO_BTH_GET_SCAN                    = $0000001c;   // no restrictions. optlen=sizeof(unsigned int), optval = &scan mode
+      SO_BTH_SET_COD                      = $0000001d;  // no restrictions. optlen=sizeof(unsigned int), optval = &cod
+      SO_BTH_GET_COD                      = $0000001e;  // no restrictions. optlen=sizeof(unsigned int), optval = &cod
+      SO_BTH_GET_LOCAL_VER        = $0000001f;  // no restrictions. optlen=sizeof(BTH_LOCAL_VERSION), optval = &BTH_LOCAL_VERSION
+      SO_BTH_GET_REMOTE_VER      = $00000020;   // connected only! optlen=sizeof(BTH_REMOTE_VERSION), optval = &BTH_REMOTE_VERSION
+      SO_BTH_GET_AUTHN_ENABLE   = $00000021;    // no restrictions. optlen=sizeof(unsigned int), optval = &authentication enable
+      SO_BTH_SET_AUTHN_ENABLE   = $00000022;    // no restrictions. optlen=sizeof(unsigned int), optval = &authentication enable
+      SO_BTH_SET_READ_REMOTE_NAME   = $00000023;    // no restrictions. optlen=sizeof(BTH_REMOTE_NAME), optval=&BTH_REMOTE_NAME
+      SO_BTH_GET_LINK_POLICY            = $00000024;    // connected only! optlen=sizeof(unsigned int), optval = &link policy
+      SO_BTH_SET_LINK_POLICY            = $00000025;    // connected only! optlen=sizeof(unsigned int), optval = &link policy
+      SO_BTH_ENTER_HOLD_MODE            = $00000026; // connected only! optlen=sizeof(BTH_HOLD_MODE), optval = &BTH_HOLD_MODE
+      SO_BTH_ENTER_SNIFF_MODE          = $00000027; // connected only! optlen=sizeof(BTH_SNIFF_MODE), optval = &BTH_SNIFF_MODE
+      SO_BTH_EXIT_SNIFF_MODE            = $00000028; // connected only! optlen=0, optval - ignored
+      SO_BTH_ENTER_PARK_MODE            = $00000029; // connected only! optlen=sizeof(BTH_PARK_MODE), optval = &BTH_PARK_MODE
+      SO_BTH_EXIT_PARK_MODE          = $0000002a; // connected only! optlen=0, optval - ignored
+      SO_BTH_GET_MODE                        = $0000002b;   // connected only! optlen=sizeof(int), optval = &mode
+
+type
+     _SOCKADDR_BTH = record
+       addressFamily:USHORT;
+       btAddr:BT_ADDR;
+       serviceClassId:GUID;
+       port:ULONG;
+     end;
+     SOCKADDR_BTH = _SOCKADDR_BTH;
+     PSOCKADDR_BTH = ^_SOCKADDR_BTH;
+
+type
+     __bth_inquiry_result = record
+       ba:BT_ADDR;
+       cod:LongWord;
+       clock_offset:word;
+       page_scan_mode:byte;
+       page_scan_period_mode:byte;
+       page_scan_repetition_mode:byte;
+     end;
+     BthInquiryResult = __bth_inquiry_result;
+     PBthInquiryResult = ^BthInquiryResult;
+
+implementation
+
+function GET_NAP(const _bt_addr:BT_ADDR):USHORT; inline;
+begin
+  GET_NAP:=USHORT((_bt_addr and NAP_MASK) shr NAP_BIT_OFFSET);
+end;
+
+function GET_SAP(const _bt_addr:BT_ADDR):ULONG; inline;
+begin
+  GET_SAP:=ULONG((_bt_addr and SAP_MASK) shr SAP_BIT_OFFSET);
+end;
+
+function SET_NAP(const _nap:USHORT):ULONGLONG; inline;
+begin
+  SET_NAP:=ULONGLONG(_nap shl NAP_BIT_OFFSET);
+end;
+
+function SET_SAP(const _sap:ULONG):ULONGLONG; inline;
+begin
+  SET_SAP:=ULONGLONG(_sap shr SAP_BIT_OFFSET);
+end;
+
+function SET_NAP_SAP(const _nap:USHORT; const _sap:ULONG):ULONGLONG; inline;
+begin
+  SET_NAP_SAP:=SET_NAP(_nap) or SET_SAP(_sap);
+end;
+
+end.

+ 45 - 0
rtl/wince/wininc/base.inc

@@ -297,6 +297,50 @@
      WCTYPE_T = WCHAR_T;    //+stdlib
      TIME_T=ULONG;          //+stdlib
      WPARAM = Longint;      //windef UINT_PTR
+
+// The left side of these typedefs are machine and compiler dependent.
+// From types.h
+type
+     INT8   = ShortInt;
+     UINT8  = byte;
+     INT16  = SmallInt;
+     UINT16 = word;
+     INT32  = longint;
+     UINT32 = LongWord;
+// INT64
+     UINT64 = QWord;
+
+type
+     _INT128 = packed record
+       u0,u1,u2:UINT32;
+       u3:INT32;
+     end;
+     INT128 = _INT128;
+
+     _UINT128 = packed record
+       u0,u1,u2,u3:UINT32;
+     end;
+     UINT128 = _UINT128;
+
+type
+     PINT8 = ^INT8;
+     PUINT8 = ^UINT8;
+     PINT16 = ^INT16;
+     PUINT16 = ^UINT16;
+     PINT32 = ^INT32;
+     PUINT32 = ^UINT32;
+//     PINT64
+     PUINT64 = ^UINT64;
+     PINT128 = ^INT128;
+     PUINT128 = ^UINT128;
+
+type
+     PPVOID = ^pointer;
+
+type
+     WIN32_ERROR_CODE = DWORD;
+
+
 {
   Enumerations
 }
@@ -1000,3 +1044,4 @@ type
 {$endif read_implementation}
 
 
+

+ 42 - 132
rtl/wince/wininc/coredll.inc

@@ -215,10 +215,8 @@
       30C DumpKCallProfile
       3DB EnableCaretSystemWide
       553 EnableEUDC
-       BF EnumDevices
       50E EnumDisplayDevices
       666 EnumDisplayMonitors
-       BE EnumPnpIds
       14D EnumUILanguagesW
       374 ExtractResource
       17F FileSystemPowerFunction
@@ -239,7 +237,6 @@
        29 GetCurrentFT
       39F GetCurrentPermissions
       186 GetDeviceByIndex
-       C0 GetDeviceKeys
       2FA GetEventData
       394 GetFSHeapInfo
       407 GetForegroundInfo
@@ -263,8 +260,6 @@
       377 GetRomFileBytes
       376 GetRomFileInfo
       102 GetStoreInformation
--      40E GetSystemPowerStatusEx -> power.inc
--      40F GetSystemPowerStatusEx2 -> power.inc
       2D0 GetUserDirectory
       1B7 GetWindowTextWDirect
       37E GiveKPhys
@@ -377,11 +372,8 @@
       33C NKDbgPrintfW
       3A7 NKTerminateThread
       36F NKvDbgPrintfW
-      49F NLedGetDeviceInfo
-      4A0 NLedSetDevice
       30F NotifyForceCleanboot
       410 NotifyWinUserSystem
-       C1 OpenDeviceKey
       395 OtherThreadsRunning
       3BB PPSHRestart
         C PSLNotify
@@ -405,7 +397,6 @@
       2D4 PegSetUserNotification
       1CE PegWriteRecordProps
       2F1 PerformCallBack4
-      267 PlaySoundW
       3A3 PowerOffSystem
       37C PrintTrackedItem
       373 ProcessDetachAllDLLs
@@ -418,31 +409,6 @@
       485 QAUnhookWindowsJournalHook
       2F2 QueryAPISetID
        91 Random
-      1FC RasDeleteEntry
-      207 RasDevConfigDialogEditW
-      1F3 RasDial
-      1FE RasEnumConnections
-      203 RasEnumDevicesW
-      1F6 RasEnumEntries
-      1FF RasGetConnectStatus
-      206 RasGetDispPhoneNumW
-      20A RasGetEapConnectionData
-      208 RasGetEapUserData
-      200 RasGetEntryDevConfig
-      1F7 RasGetEntryDialParams
-      1F9 RasGetEntryProperties
-      205 RasGetLinkStatistics
-      204 RasGetProjectionInfoW
-      1F5 RasHangUp
-      1F4 RasHangup
-      202 RasIOControl
-      1FD RasRenameEntry
-      20B RasSetEapConnectionData
-      209 RasSetEapUserData
-      201 RasSetEntryDevConfig
-      1F8 RasSetEntryDialParams
-      1FA RasSetEntryProperties
-      1FB RasValidateEntryName
       181 ReadFileWithSeek
       3C0 ReadRegistryFromOEM
       1BE RectangleAnimation
@@ -1811,8 +1777,6 @@
       58C _ltoa
       58D _ltow
       602 _mbmemset
-      590 _memccpy
-      593 _memicmp
       597 _msize
       598 _nextafter
       5C1 _purecall
@@ -1826,27 +1790,10 @@
       60A _snprintf
       605 _snwprintf
       5A4 _statusfp
-       71 _strdup
-       77 _stricmp
-       75 _strlwr
-       78 _strnicmp
-       72 _strnset
-       73 _strrev
-       74 _strset
-       76 _strupr
-      5B0 _swab
       5B3 _ultoa
       5B4 _ultow
       60B _vsnprintf
       606 _vsnwprintf
-       64 _wcsdup
-      146 _wcsicmp
-      147 _wcslwr
-      145 _wcsnicmp
-       5D _wcsnset
-       60 _wcsrev
-       61 _wcsset
-      148 _wcsupr
       61E _wfdopen
       63D _wfopen
       61F _wfreopen
@@ -1856,36 +1803,6 @@
       5B9 _y1
       5BA _yn
       559 abs
-      28B acmDriverAdd
-      28C acmDriverClose
-      28D acmDriverDetails
-      28E acmDriverEnum
-      28F acmDriverID
-      290 acmDriverMessage
-      291 acmDriverOpen
-      292 acmDriverPriority
-      293 acmDriverRemove
-      2A8 acmFilterChoose
-      294 acmFilterDetails
-      295 acmFilterEnum
-      296 acmFilterTagDetails
-      297 acmFilterTagEnum
-      2A7 acmFormatChoose
-      298 acmFormatDetails
-      299 acmFormatEnum
-      29A acmFormatSuggest
-      29B acmFormatTagDetails
-      29C acmFormatTagEnum
-      2A5 acmGetVersion
-      2A6 acmMetrics
-      29D acmStreamClose
-      29E acmStreamConvert
-      29F acmStreamMessage
-      2A0 acmStreamOpen
-      2A1 acmStreamPrepareHeader
-      2A2 acmStreamReset
-      2A3 acmStreamSize
-      2A4 acmStreamUnprepareHeader
       55A acos
       55B asin
       55C atan
@@ -1893,7 +1810,6 @@
       560 atof
       55E atoi
       55F atol
-      58F calloc
       564 ceil
       68A ceilf
       629 clearerr
@@ -1924,7 +1840,6 @@
       639 fputwc
       63C fputws
       622 fread
-      577 free
       579 frexp
       619 fscanf
       62C fseek
@@ -1941,16 +1856,6 @@
       584 ldexp
       585 ldiv
       589 longjmp
-      2B2 mixerClose
-      2A9 mixerGetControlDetails
-      2AA mixerGetDevCaps
-      2AB mixerGetID
-      2AC mixerGetLineControls
-      2AD mixerGetLineInfo
-      2AE mixerGetNumDevs
-      2AF mixerMessage
-      2B0 mixerOpen
-      2B1 mixerSetControlDetails
       596 modf
       599 pow
       60D printf
@@ -1959,13 +1864,11 @@
       635 putwchar
       59A qsort
       59B rand
-      59C realloc
       60C scanf
       601 setjmp
       62F setvbuf
       5A0 sin
       5A1 sinh
-      266 sndPlaySoundW
       608 sprintf
       5A2 sqrt
       68E sqrtf
@@ -2004,41 +1907,6 @@
       609 vsprintf
       604 vswprintf
       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
       631 wscanf
 
@@ -2097,6 +1965,9 @@ function BeginDeferWindowPos(nNumWindows:longint):HDWP; external KernelDLL name
 function BeginPaint(hWnd:HWND; lpPaint:LPPAINTSTRUCT):HDC; external KernelDLL name 'BeginPaint';
 function BitBlt(_para1:HDC; _para2:longint; _para3:longint; _para4:longint; _para5:longint;_para6:HDC; _para7:longint; _para8:longint; _para9:DWORD):WINBOOL; external KernelDLL name 'BitBlt';
 function BringWindowToTop(hWnd:HWND):WINBOOL; external KernelDLL name 'BringWindowToTop';
+
+// Allocates an array in memory with elements initialized to 0.
+function calloc(num:SIZE_T; _size:SIZE_T):pointer; external KernelDLL name 'calloc'; // index 58F
 function CallNextHookEx(hhk:HHOOK; nCode:longint; wParam:WPARAM; lParam:LPARAM):LRESULT; external KernelDLL name 'CallNextHookEx';
 function CallWindowProc(lpPrevWndFunc:WNDPROC; hWnd:HWND; Msg:UINT; wParam:WPARAM; lParam:LPARAM):LRESULT; external KernelDLL name 'CallWindowProcW';
 function CallWindowProcW(lpPrevWndFunc:WNDPROC; hWnd:HWND; Msg:UINT; wParam:WPARAM; lParam:LPARAM):LRESULT; external KernelDLL name 'CallWindowProcW';
@@ -2300,6 +2171,7 @@ function FoldString(dwMapFlags:DWORD; lpSrcStr:LPCWSTR; cchSrc:longint; lpDestSt
 function FoldStringW(dwMapFlags:DWORD; lpSrcStr:LPCWSTR; cchSrc:longint; lpDestStr:LPWSTR; cchDest:longint):longint; external KernelDLL name 'FoldStringW';
 function FormatMessage(dwFlags:DWORD; lpSource:LPCVOID; dwMessageId:DWORD; dwLanguageId:DWORD; lpBuffer:LPWSTR;nSize:DWORD; Arguments:va_list):DWORD; external KernelDLL name 'FormatMessageW';
 function FormatMessageW(dwFlags:DWORD; lpSource:LPCVOID; dwMessageId:DWORD; dwLanguageId:DWORD; lpBuffer:LPWSTR;nSize:DWORD; Arguments:va_list):DWORD; external KernelDLL name 'FormatMessageW';
+procedure free(memblock:pointer); external KernelDLL name 'free'; // index 577
 function FreeLibrary(hLibModule:HMODULE):WINBOOL; external KernelDLL name 'FreeLibrary';
 procedure FreeLibraryAndExitThread(hLibModule:HMODULE; dwExitCode:DWORD); external KernelDLL name 'FreeLibraryAndExitThread';
 function GetActiveWindow:HWND; external KernelDLL name 'GetActiveWindow';
@@ -2771,6 +2643,7 @@ procedure RaiseException(dwExceptionCode:DWORD; dwExceptionFlags:DWORD; nNumberO
 function ReadFile(hFile:HANDLE; lpBuffer:LPVOID; nNumberOfBytesToRead:DWORD; lpNumberOfBytesRead:LPDWORD; lpOverlapped:LPOVERLAPPED):BOOL; external KernelDLL name 'ReadFile'; // index F4
 function ReadProcessMemory(hProcess:HANDLE; lpBaseAddress:LPCVOID; lpBuffer:LPVOID; nSize:DWORD; lpNumberOfBytesRead:LPDWORD):WINBOOL; external KernelDLL name 'ReadProcessMemory';
 function RealizePalette(_para1:HDC):UINT; external KernelDLL name 'RealizePalette'; // index 52F
+function realloc(memblock:pointer; _size:SIZE_T):pointer; external KernelDLL name 'realloc'; // index 59C
 function RectInRegion(_para1:HRGN; const _para2:RECT):WINBOOL; external KernelDLL name 'RectInRegion';
 function RectVisible(_para1:HDC; const _para2:RECT):WINBOOL; external KernelDLL name 'RectVisible';
 function Rectangle(_para1:HDC; _para2:longint; _para3:longint; _para4:longint; _para5:longint):WINBOOL; external KernelDLL name 'Rectangle';
@@ -3086,6 +2959,42 @@ function wvsprintf(_para1:LPWSTR; _para2:LPCWSTR; arglist:va_list):longint; exte
 function wvsprintfW(_para1:LPWSTR; _para2:LPCWSTR; arglist:va_list):longint; external KernelDLL name 'wvsprintfW';
 procedure ZeroMemory(Destination:PVOID; Length:DWORD);
 
+// dest - pointer to destination.
+// src - pointer to source.
+// c - last character to copy.
+// count - number of characters.
+// Returns: if the character c is copied, _memccpy returns a pointer to the
+// byte in dest that immediately follows the character. If c is not copied, it
+// returns NULL.
+function _memccpy(dest:pointer; src:pointer; c:longint; _count:Cardinal):pointer; external KernelDLL name '_memccpy'; // index 590
+function _memicmp(buf1:pointer; buf2:pointer; _count:Cardinal):longint; external KernelDLL name '_memicmp'; // index 593
+
+// _strdup function calls malloc to allocate storage space for a copy of
+// strSource and then copies strSource to the allocated space.
+function _strdup(strSource:PAnsiChar):PAnsiChar; external KernelDLL name '_strdup'; // index 71
+function _stricmp(string1:PAnsiChar; string2:PAnsiChar):longint; external KernelDLL name '_stricmp'; // index 77
+function _strlwr(_string:PAnsiChar):PAnsiChar; external KernelDLL name '_strlwr'; // index 75
+function _strnicmp(string1:PAnsiChar; string2:PAnsiChar; _count:SIZE_T):longint; external KernelDLL name '_strnicmp'; // index 78
+function _strnset(_string:PAnsiChar; c:longint; _count:SIZE_T):PAnsiChar; external KernelDLL name '_strnset'; // index 72
+function _strrev(_string:PAnsiChar):PAnsiChar; external KernelDLL name '_strrev'; // index 73
+function _strset(_string:PAnsiChar; c:longint):PAnsiChar; external KernelDLL name '_strset'; // index 74
+function _strupr(_string:PAnsiChar):PAnsiChar; external KernelDLL name '_strupr'; // index 76
+
+// The _swab function copies n bytes from src, swaps each pair of adjacent bytes,
+// and stores the result at dest. The integer n should be an even number to allow
+// for swapping. _swab is typically used to prepare binary data for transfer to
+// a machine that uses a different byte order.
+procedure _swab(src:PAnsiChar; dest:PAnsiChar; n:longint); external KernelDLL name '_swab'; // index 5B0
+
+function _wcsdup(strSource:PWideChar):PWideChar; external KernelDLL name '_wcsdup'; // index 64
+function _wcsicmp(string1:PWideChar; string2:PWideChar):longint; external KernelDLL name '_wcsicmp'; // index 146
+function _wcslwr(_string:PWideChar):PWideChar; external KernelDLL name '_wcslwr'; // index 147
+function _wcsnicmp(string1:PWideChar; string2:PWideChar; _count:SIZE_T):longint; external KernelDLL name '_wcsnicmp'; // index 145
+function _wcsnset(_string:PWideChar; c:WCHAR; _count:SIZE_T):PWideChar; external KernelDLL name '_wcsnset'; // index 5D
+function _wcsrev(_string:PWideChar):PWideChar; external KernelDLL name '_wcsrev'; // index 60
+function _wcsset(_string:PWideChar; c:WCHAR):PWideChar; external KernelDLL name '_wcsset'; // index 61
+function _wcsupr(_string:PWideChar):PWideChar; external KernelDLL name '_wcsupr'; // index 148
+
 {$endif read_interface}
 
 
@@ -4180,3 +4089,4 @@ end;
 
 
 
+

+ 123 - 84
rtl/wince/wininc/defines.inc

@@ -667,7 +667,7 @@
      WS_BORDER = $800000;
      WS_CAPTION = $c00000;
      WS_CHILD = $40000000;
-     WS_CHILDWINDOW = $40000000;
+{     WS_CHILDWINDOW = $40000000; // Not declared in WinCE }
      WS_CLIPCHILDREN = $2000000;
      WS_CLIPSIBLINGS = $4000000;
      WS_DISABLED = $8000000;
@@ -684,6 +684,7 @@
      WS_THICKFRAME = $40000;
      WS_VISIBLE = $10000000;
      WS_VSCROLL = $200000;
+
      BS_3STATE = $5;
      BS_AUTO3STATE = $6;
      BS_AUTOCHECKBOX = $3;
@@ -704,12 +705,13 @@
      BS_PUSHLIKE = $1000;
      BS_RADIOBUTTON = $4;
      BS_RIGHT = $200;
-     BS_RIGHTBUTTON = $20;
+     BS_RIGHTBUTTON = BS_LEFTTEXT;
      BS_TEXT = 0;
      BS_TOP = $400;
-     BS_USERBUTTON = $8;
+{     BS_USERBUTTON = $8; // Unsupported under WinCE. }
      BS_VCENTER = $c00;
-     BS_FLAT = $8000;
+{     BS_FLAT = $8000; // Unsupported under WinCE. }
+
      CBS_AUTOHSCROLL = $40;
      CBS_DISABLENOSCROLL = $800;
      CBS_DROPDOWN = $2;
@@ -718,11 +720,23 @@
      CBS_LOWERCASE = $4000;
      CBS_NOINTEGRALHEIGHT = $400;
      CBS_OEMCONVERT = $80;
-     CBS_OWNERDRAWFIXED = $10;
-     CBS_OWNERDRAWVARIABLE = $20;
-     CBS_SIMPLE = $1;
+{     CBS_OWNERDRAWFIXED = $10; // Unsupported under WinCE. }
+{     CBS_OWNERDRAWVARIABLE = $20; // Unsupported under WinCE. }
+{     CBS_SIMPLE = $1; // Unsupported under WinCE. }
      CBS_SORT = $100;
      CBS_UPPERCASE = $2000;
+
+{ Extended combo box styles }
+    CBS_EX_CONSTSTRINGDATA  = $00000002;
+{ If you specify the CBS_EX_CONSTSTRINGDATA style when the application 
+  inserts a string into the list part of a combo box, the combo box 
+  stores the pointer passed to it by the application rather than copying 
+  the string. This saves RAM resources when you have a large table of 
+  strings in ROM that you want to insert into a combo box. }
+
+
+
+{ Edit Control Styles }
      ES_AUTOHSCROLL = $80;
      ES_AUTOVSCROLL = $40;
      ES_CENTER = $1;
@@ -737,6 +751,9 @@
      ES_RIGHT = $2;
      ES_UPPERCASE = $8;
      ES_WANTRETURN = $1000;
+     ES_COMBOBOX   = $0200; { Indicates that the edit control is part of a combo box. }
+
+{ List box styles }
      LBS_DISABLENOSCROLL = $1000;
      LBS_EXTENDEDSEL = $800;
      LBS_HASSTRINGS = $40;
@@ -750,90 +767,106 @@
      LBS_OWNERDRAWFIXED = $10;
      LBS_OWNERDRAWVARIABLE = $20;
      LBS_SORT = $2;
-     LBS_STANDARD = $a00003;
+//     LBS_STANDARD = $a00003;
      LBS_USETABSTOPS = $80;
      LBS_WANTKEYBOARDINPUT = $400;
-     SBS_BOTTOMALIGN = $4;
+     LBS_STANDARD = LBS_NOTIFY or LBS_SORT or WS_VSCROLL or WS_BORDER;
+
+{ Extended list box styles }
+     LBS_EX_CONSTSTRINGDATA   = $00000002;
+{ Windows CE supports the LBS_EX_CONSTSTRINGDATA style that saves RAM 
+  resources when you have a large table of strings in ROM that you want 
+  to insert into a list box. }
+
+{ Scroll bar styles }
+{     SBS_BOTTOMALIGN = $4; // Unsupported under WinCE. }
      SBS_HORZ = 0;
-     SBS_LEFTALIGN = $2;
-     SBS_RIGHTALIGN = $4;
-     SBS_SIZEBOX = $8;
-     SBS_SIZEBOXBOTTOMRIGHTALIGN = $4;
-     SBS_SIZEBOXTOPLEFTALIGN = $2;
-     SBS_SIZEGRIP = $10;
-     SBS_TOPALIGN = $2;
+{     SBS_LEFTALIGN = $2; // Unsupported under WinCE. }
+{     SBS_RIGHTALIGN = $4; // Unsupported under WinCE. }
+{     SBS_SIZEBOX = $8; // Unsupported under WinCE. }
+{     SBS_SIZEBOXBOTTOMRIGHTALIGN = $4; // Unsupported under WinCE. }
+{     SBS_SIZEBOXTOPLEFTALIGN = $2; // Unsupported under WinCE. }
+{     SBS_SIZEGRIP = $10; // Unsupported under WinCE. }
+{     SBS_TOPALIGN = $2; // Unsupported under WinCE. }
      SBS_VERT = $1;
+
+{ Static control styles }
      SS_BITMAP = $e;
-     SS_BLACKFRAME = $7;
-     SS_BLACKRECT = $4;
+{     SS_BLACKFRAME = $7; // Unsupported under WinCE. }
+{     SS_BLACKRECT = $4; // Unsupported under WinCE. }
      SS_CENTER = $1;
      SS_CENTERIMAGE = $200;
-     SS_ENHMETAFILE = $f;
-     SS_ETCHEDFRAME = $12;
-     SS_ETCHEDHORZ = $10;
-     SS_ETCHEDVERT = $11;
-     SS_GRAYFRAME = $8;
-     SS_GRAYRECT = $5;
+{     SS_ENHMETAFILE = $f; // Unsupported under WinCE. }
+{     SS_ETCHEDFRAME = $12; // Unsupported under WinCE. }
+{     SS_ETCHEDHORZ = $10; // Unsupported under WinCE. }
+{     SS_ETCHEDVERT = $11; // Unsupported under WinCE. }
+{     SS_GRAYFRAME = $8; // Unsupported under WinCE. }
+{     SS_GRAYRECT = $5; // Unsupported under WinCE. }
      SS_ICON = $3;
      SS_LEFT = 0;
      SS_LEFTNOWORDWRAP = $c;
      SS_NOPREFIX = $80;
      SS_NOTIFY = $100;
-     SS_OWNERDRAW = $d;
-     SS_REALSIZEIMAGE = $800;
+{     SS_OWNERDRAW = $d; // Unsupported under WinCE. }
+{     SS_REALSIZEIMAGE = $800; // Unsupported under WinCE. }
      SS_RIGHT = $2;
-     SS_RIGHTJUST = $400;
-     SS_SIMPLE = $b;
-     SS_SUNKEN = $1000;
-     SS_USERITEM = $a;
-     SS_WHITEFRAME = $9;
-     SS_WHITERECT = $6;
+{     SS_RIGHTJUST = $400; // Unsupported under WinCE. }
+{     SS_SIMPLE = $b; // Unsupported under WinCE. }
+{     SS_SUNKEN = $1000; // Unsupported under WinCE. }
+{     SS_USERITEM = $a; // Unsupported under WinCE. }
+{     SS_WHITEFRAME = $9; // Unsupported under WinCE. }
+{     SS_WHITERECT = $6; // Unsupported under WinCE. }
+
     { Dialog styles }
-     DS_ABSALIGN      = $1;
-     DS_SYSMODAL      = $2;
+{     DS_ABSALIGN      = $1; // Unsupported under WinCE. }
+{     DS_SYSMODAL      = $2; // Unsupported under WinCE. }
      DS_3DLOOK        = $4;
-     DS_FIXEDSYS      = $8;
-     DS_NOFAILCREATE  = $10;
-     DS_LOCALEDIT     = $20;
-     DS_SETFONT       = $40;
-     DS_MODALFRAME    = $80;
-     DS_NOIDLEMSG     = $100;
-     DS_SETFOREGROUND = $200;
+{     DS_FIXEDSYS      = $8; // Unsupported under WinCE. }
+{     DS_NOFAILCREATE  = $10; // Unsupported under WinCE. }
+     DS_LOCALEDIT     = $20; { Edit items get Local storage. }
+     DS_SETFONT       = $40; { User specified font for Dlg controls. }
+     DS_MODALFRAME    = $80; { Can be combined with WS_CAPTION. }
+{     DS_NOIDLEMSG     = $100; // Unsupported under WinCE. }
+     DS_SETFOREGROUND = $200; { not in Windows 3.1 }
      DS_CONTROL       = $400;
      DS_CENTER        = $800;
-     DS_CENTERMOUSE   = $1000;
-     DS_CONTEXTHELP   = $2000;
-     DS_NOCLOSEBTN    =	$4000;
+{     DS_CENTERMOUSE   = $1000; // Unsupported under WinCE. }
+{     DS_CONTEXTHELP   = $2000; // Unsupported under WinCE. }
+     DS_NOCLOSEBTN    = $4000;
 
   { CreateWindowEx  }
-     WS_EX_LEFT             = 0;
-     WS_EX_LTRREADING       = 0;
-     WS_EX_RIGHTSCROLLBAR   = 0;
+{     WS_EX_LEFT             = 0; // Not declared. }
+{     WS_EX_LTRREADING       = 0; // Not declared. }
+{     WS_EX_RIGHTSCROLLBAR   = 0; // Not declared. }
      WS_EX_DLGMODALFRAME    = $1;
-     WS_EX_NOPARENTNOTIFY   = $4;
+{     WS_EX_NOPARENTNOTIFY   = $4; // Unsupported under WinCE. }
      WS_EX_TOPMOST          = $8;
-     WS_EX_ACCEPTFILES      = $10;
-     WS_EX_TRANSPARENT      = $20;
-     WS_EX_MDICHILD         = $40;
+{     WS_EX_ACCEPTFILES      = $10; // Unsupported under WinCE. }
+{     WS_EX_TRANSPARENT      = $20; // Unsupported under WinCE. }
+{     WS_EX_MDICHILD         = $40; // Unsupported under WinCE. }
      WS_EX_TOOLWINDOW       = $80;
-     WS_EX_PALETTEWINDOW    = $188;
+{     WS_EX_PALETTEWINDOW    = $188; // Unsupported under WinCE. }
      WS_EX_WINDOWEDGE       = $100;
      WS_EX_CLIENTEDGE       = $200;
-     WS_EX_OVERLAPPEDWINDOW = $300;
+     WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE or WS_EX_CLIENTEDGE;
      WS_EX_CONTEXTHELP      = $400;
      WS_EX_RIGHT            = $1000;
      WS_EX_RTLREADING       = $2000;
      WS_EX_LEFTSCROLLBAR    = $4000;
-     WS_EX_CONTROLPARENT    = $10000;
+{     WS_EX_CONTROLPARENT    = $10000; // Unsupported under WinCE. }
      WS_EX_STATICEDGE       = $20000;
-     WS_EX_APPWINDOW        = $40000;
-     WS_EX_NOANIMATION	    = $4000000;
+{     WS_EX_APPWINDOW        = $40000; // Unsupported under WinCE. }
+     WS_EX_NOANIMATION      = $4000000;
      WS_EX_NOACTIVATE       = $8000000;
-     WS_EX_INK		    = $10000000;
-     WS_EX_ABOVESTARTUP	    = $20000000;
+     WS_EX_INK              = $10000000;
+     WS_EX_ABOVESTARTUP     = $20000000;
      WS_EX_NODRAG           = $40000000;
      WS_EX_CAPTIONOKBTN     = $80000000;
 
+     WS_EX_NOINHERITLAYOUT  = $00100000; // Disable inheritence of mirroring by children
+     WS_EX_LAYOUTRTL        = $00400000; // Right to left mirroring
+     
+
   { CreateWindowStation  }
      WINSTA_ACCESSCLIPBOARD = $4;
      WINSTA_ACCESSGLOBALATOMS = $20;
@@ -1191,13 +1224,13 @@
      {STARTDOC = 10; conflicts with AbortDoc function }
      cSTARTDOC = 10;
   { EscapeCommFunction  }
-     CLRDTR = 6;				  //winbase
-     CLRRTS = 4;				  //winbase
-     SETDTR = 5;				  //winbase
-     SETRTS = 3;				  //winbase	
-     SETXOFF = 1;				  //winbase
-     SETXON = 2;				  //winbase
-     SETBREAK = 8;				  //winbase
+     CLRDTR = 6;          //winbase
+     CLRRTS = 4;          //winbase
+     SETDTR = 5;          //winbase
+     SETRTS = 3;          //winbase 
+     SETXOFF = 1;         //winbase
+     SETXON = 2;          //winbase
+     SETBREAK = 8;          //winbase
      CLRBREAK = 9;                                //winbase
      // Some CE devices share a UART between an IRDA port and a serial port.
      // These escape functions allow control over the mode.
@@ -1323,6 +1356,10 @@
      CP_ACP = 0;
      CP_MACCP = 2;
      CP_OEMCP = 1;
+     { WinCE 5.0+}
+     CP_UTF7 = 65000;
+     CP_UTF8 = 65001;
+     
   { GetDateFormat  }
   { already defined above !!
   #define DATE_SHORTDATE        (1)
@@ -1563,12 +1600,13 @@
      QS_SENDMESSAGE = 64;
      QS_TIMER = 16;
   { GetScrollInfo, SetScrollInfo  }
-     SIF_ALL = 23;
+{     SIF_ALL = 23; }
      SIF_PAGE = 2;
      SIF_POS = 4;
      SIF_RANGE = 1;
      SIF_DISABLENOSCROLL = 8;
      SIF_TRACKPOS = $10;
+     SIF_ALL = SIF_RANGE or SIF_PAGE or SIF_POS or SIF_TRACKPOS;
   { GetStdHandle  }
 
 
@@ -1673,7 +1711,7 @@
      COLOR_STATICTEXT              =26 or SYS_COLOR_INDEX_FLAG;
      COLOR_GRADIENTACTIVECAPTION   =27 or SYS_COLOR_INDEX_FLAG;
      COLOR_GRADIENTINACTIVECAPTION =28 or SYS_COLOR_INDEX_FLAG;
-     C_SYS_COLOR_TYPES		   =29;
+     C_SYS_COLOR_TYPES       =29;
 
      COLOR_DESKTOP           =COLOR_BACKGROUND;
      COLOR_3DFACE            =COLOR_BTNFACE;
@@ -1831,11 +1869,11 @@
      LMEM_DISCARDABLE    = $0F00;      //**** Ignored ****/
      LMEM_VALID_FLAGS    = $0F72;
      LMEM_INVALID_HANDLE = $8000;
-     LMEM_DDESHARE       = $0000;	 //**** Ignored ****/
-     LMEM_LOWER          = $0000;	 //**** Ignored ****/
-     LMEM_NOT_BANKED     = $0000;	 //**** Ignored ****/
-     LMEM_NOTIFY         = $0000;	 //**** Ignored ****/
-     LMEM_SHARE          = $0000;	 //**** Ignored ****/
+     LMEM_DDESHARE       = $0000;  //**** Ignored ****/
+     LMEM_LOWER          = $0000;  //**** Ignored ****/
+     LMEM_NOT_BANKED     = $0000;  //**** Ignored ****/
+     LMEM_NOTIFY         = $0000;  //**** Ignored ****/
+     LMEM_SHARE          = $0000;  //**** Ignored ****/
      LPTR                = LMEM_FIXED or LMEM_ZEROINIT;
      LHND                = LMEM_MOVEABLE or LMEM_ZEROINIT;
      NONZEROLHND         = LMEM_MOVEABLE;
@@ -2695,13 +2733,13 @@
      SH_LAST_NOTIFY   = 16; // Last set notified on Thread/Process Termination
      SH_GDI           = 16;
      SH_WMGR          = 17;
-     SH_WNET	      = 18; // WNet APIs for network redirector
+     SH_WNET        = 18; // WNet APIs for network redirector
      SH_COMM          = 19; // Communications not "COM"
      SH_FILESYS_APIS  = 20; // File system APIS
      SH_SHELL         = 21;
      SH_DEVMGR_APIS   = 22; // File system device manager
-     SH_TAPI	      = 23;
-     SH_PATCHER	      = 24;
+     SH_TAPI        = 23;
+     SH_PATCHER       = 24;
      SH_SERVICES      = 26;
      SH_LASTRESERVED  = 26;
 
@@ -3637,20 +3675,20 @@
      LPSTR_TEXTCALLBACKA = LPSTR(-(1));
 
 
-	{$ifdef UNICODE}
+  {$ifdef UNICODE}
 
      {const this is a function in fact !!
               LPSTR_TEXTCALLBACK = LPSTR_TEXTCALLBACKW;}
      LPSTR_TEXTCALLBACK          = LPWSTR(-(1));
 
-	{$else}
+  {$else}
 
-	 {const
-	 LPSTR_TEXTCALLBACK = LPSTR_TEXTCALLBACKA; }
+   {const
+   LPSTR_TEXTCALLBACK = LPSTR_TEXTCALLBACKA; }
      LPSTR_TEXTCALLBACK          =LPSTR(-(1));
-	{$endif}
+  {$endif}
 
-	 { LV_ITEM structure  }
+   { LV_ITEM structure  }
 
   const
      LVIF_TEXT = 1;
@@ -5073,6 +5111,7 @@ PROCESSOR_ARM_V4TFP_INSTRUCTION        PROCESSOR_ARM_V4TFP_INSTRUCTION
      LB_ERRSPACE = -(2);
      LB_OKAY = 0;
   { CB_DIR message  }
+     CB_OKAY = 0;
      CB_ERR = -(1);
      CB_ERRSPACE = -(2);
   { WM_IME_CONTROL message  }
@@ -5607,7 +5646,7 @@ PROCESSOR_ARM_V4TFP_INSTRUCTION        PROCESSOR_ARM_V4TFP_INSTRUCTION
 // The following flags control the contents of the CONTEXT structure.
 //
      CONTEXT_SH3 = $00000040;
-     CONTEXT_SH4	= $000000c0;	// CONTEXT_SH3 | 0x80 - must contain the SH3 bits
+     CONTEXT_SH4  = $000000c0;  // CONTEXT_SH3 | 0x80 - must contain the SH3 bits
 
 {$ifdef SH3}
      CONTEXT_CONTROL = CONTEXT_SH3 or $00000001;
@@ -5615,7 +5654,7 @@ PROCESSOR_ARM_V4TFP_INSTRUCTION        PROCESSOR_ARM_V4TFP_INSTRUCTION
      CONTEXT_DEBUG_REGISTERS = CONTEXT_SH3 or $00000008;
      CONTEXT_DSP_REGISTERS = CONTEXT_SH3 or $00000010;
      CONTEXT_FULL = CONTEXT_CONTROL or CONTEXT_INTEGER or CONTEXT_DEBUG_REGISTERS or CONTEXT_DSP_REGISTERS;
-{$else}	// SH4
+{$else} // SH4
      CONTEXT_CONTROL = CONTEXT_SH4 or $00000001;
      CONTEXT_INTEGER = CONTEXT_SH4 or $00000002;
      CONTEXT_DEBUG_REGISTERS = CONTEXT_SH4 or $00000008;
@@ -5655,7 +5694,7 @@ PROCESSOR_ARM_V4TFP_INSTRUCTION        PROCESSOR_ARM_V4TFP_INSTRUCTION
 
 
 // Specific OEM extentions
-     PF_ARM_INTEL_XSCALE				     = $80010001;
+     PF_ARM_INTEL_XSCALE             = $80010001;
      PF_ARM_INTEL_PMU                = $80010002;
      PF_ARM_INTEL_WMMX               = $80010003;
 

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

@@ -126,6 +126,7 @@
      CB_SETLOCALE = 345;
      CB_SETTOPINDEX = 348;
      CB_SHOWDROPDOWN = 335;
+     CB_GETCOMBOBOXINFO = $0162;
   { Combo Box notifications  }
      CBN_CLOSEUP = 8;
      CBN_DBLCLK = 2;
@@ -227,7 +228,8 @@
      EM_STREAMIN = 1097;
      EM_STREAMOUT = 1098;
      EM_UNDO = 199;
-  { Edit control  }
+
+  { Edit control notifications  }
      EN_SETFOCUS     =$0100;
      EN_KILLFOCUS    =$0200;
      EN_CHANGE       =$0300;
@@ -236,6 +238,9 @@
      EN_MAXTEXT      =$0501;
      EN_HSCROLL      =$0601;
      EN_VSCROLL      =$0602;
+     EN_ALIGN_LTR_EC = $0700;
+     EN_ALIGN_RTL_EC = $0701;
+
 
      EN_CORRECTTEXT = 1797;
      EN_DROPFILES = 1795;

+ 37 - 2
rtl/wince/wininc/struct.inc

@@ -849,6 +849,22 @@
      TCOLORMAP = COLORMAP;
      PCOLORMAP = ^COLORMAP;
 
+{*
+ * Combo Box Structures
+ *}
+     tagCOMBOBOXINFO = record
+       cbSize:DWORD;
+       rcItem:RECT;
+       rcButton:RECT;
+       stateButton:DWORD; // Currently unsupported on CE
+       hwndCombo:HWND;
+       hwndItem:HWND;
+       hwndList:HWND;
+     end;
+     COMBOBOXINFO = tagCOMBOBOXINFO;
+     PCOMBOBOXINFO = ^tagCOMBOBOXINFO;
+     LPCOMBOBOXINFO = ^tagCOMBOBOXINFO;
+
      DCB = record
           DCBlength : DWORD;
           BaudRate : DWORD;
@@ -7120,6 +7136,25 @@
      TVSFIXEDFILEINFO = 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
           dwFileAttributes : DWORD;
           ftCreationTime : FILETIME;
@@ -7128,7 +7163,7 @@
           nFileSizeHigh : DWORD;
           nFileSizeLow : DWORD;
           dwOID: DWORD;
-          cFileName : array[0..MAX_PATH] of WCHAR;
+          cFileName : array[0..MAX_PATH-1] of WCHAR;
        end;
 
      LPWIN32_FIND_DATAW = ^WIN32_FIND_DATAW;
@@ -7625,7 +7660,7 @@ type
 
   tagBSTRBLOB = record
     cbsize : ULONG;
-	  pdata  : pbyte;
+    pdata  : pbyte;
   end;
   BSTRBLOB=TagBSTRBlob;
   TBSTRBLOB=BSTRBLOB;

+ 34 - 0
rtl/wince/winsock2.pp

@@ -386,6 +386,40 @@ type
   PSockAddr = ^TSockAddr;
   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. }
   PSockProto = ^TSockProto;
   TSockProto = record