Browse Source

+arm/wince more rtl units : winsock, sockets
+arm/wince more fcl units : resolve, ssockets

git-svn-id: trunk@2065 -

oro06 19 years ago
parent
commit
19b6be7d8e

+ 3 - 0
.gitattributes

@@ -1044,6 +1044,7 @@ fcl/wince/ezcgi.inc svneol=native#text/plain
 fcl/wince/fileinfo.pp svneol=native#text/plain
 fcl/wince/pipes.inc svneol=native#text/plain
 fcl/wince/process.inc svneol=native#text/plain
+fcl/wince/resolve.inc svneol=native#text/plain
 fcl/wince/simpleipc.inc svneol=native#text/plain
 fcl/wince/syncobjs.pp svneol=native#text/plain
 fcl/xml/Makefile svneol=native#text/plain
@@ -4556,6 +4557,7 @@ rtl/wince/i386/wprt0.as svneol=native#text/plain
 rtl/wince/messages.pp -text
 rtl/wince/readme-winceapi-port -text
 rtl/wince/readme.txt -text
+rtl/wince/sockets.pp svneol=native#text/plain
 rtl/wince/system.pp svneol=native#text/plain
 rtl/wince/sysutils.pp -text
 rtl/wince/tthread.inc -text
@@ -4573,6 +4575,7 @@ rtl/wince/wininc/redef.inc -text
 rtl/wince/wininc/struct.inc -text
 rtl/wince/wininc/unidef.inc -text
 rtl/wince/winres.inc -text
+rtl/wince/winsock.pp svneol=native#text/plain
 rtl/x86_64/int64p.inc svneol=native#text/plain
 rtl/x86_64/makefile.cpu -text
 rtl/x86_64/math.inc svneol=native#text/plain

+ 2 - 2
fcl/Makefile

@@ -392,7 +392,7 @@ ifeq ($(FULL_TARGET),i386-netwlibc)
 override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex  resolve ssockets syncobjs
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex  process fileinfo syncobjs simpleipc msgintf dbugintf
+override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex  process fileinfo resolve ssockets syncobjs simpleipc msgintf dbugintf
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex  process resolve ssockets fpasync syncobjs simpleipc msgintf dbugintf
@@ -452,7 +452,7 @@ ifeq ($(FULL_TARGET),arm-linux)
 override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex  process resolve ssockets fpasync syncobjs simpleipc msgintf dbugintf
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex  process fileinfo syncobjs simpleipc msgintf dbugintf
+override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex  process fileinfo resolve ssockets syncobjs simpleipc msgintf dbugintf
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex  process resolve ssockets fpasync syncobjs simpleipc msgintf dbugintf

+ 1 - 1
fcl/Makefile.fpc

@@ -33,7 +33,7 @@ units_netbsd=process ssockets resolve fpasync simpleipc msgintf dbugintf
 units_openbsd=process ssockets resolve fpasync simpleipc msgintf dbugintf
 units_linux=process resolve ssockets fpasync syncobjs simpleipc msgintf dbugintf
 units_win32=process fileinfo resolve ssockets syncobjs simpleipc msgintf dbugintf
-units_wince=process fileinfo syncobjs simpleipc msgintf dbugintf
+units_wince=process fileinfo resolve ssockets syncobjs simpleipc msgintf dbugintf
 units_os2=resolve ssockets
 units_emx=resolve ssockets
 units_netware=resolve ssockets

+ 51 - 0
fcl/wince/resolve.inc

@@ -0,0 +1,51 @@
+
+uses winsock;
+
+Type
+  PHostEntry = PHostEnt;
+  PNetEntry = PNetEnt;
+  PServEntry = PServEnt;
+
+Const
+  DNSErr : Integer = 0;
+
+function getnetbyname ( Name : pchar) : PNetEntry;
+
+begin
+  DNSErr:=-1;
+  Result:=Nil;
+end;
+
+function getnetbyaddr ( Net : Longint; nettype : Longint) : PNetEntry;
+
+begin
+  DNSErr:=-2;
+  Result:=Nil;
+end;
+
+Function GetDNSError : Longint;
+
+begin
+  If DNSErr<>0 then
+    begin
+    GetDNSError:=-DNSErr;
+    DNSErr:=0;
+    end
+  else
+    GetDNSError:=0; // Must get win32 error ?
+end;
+
+Function InitResolve : Boolean;
+
+var
+   wsaData : TWsaData;
+
+begin
+  Result:=WSAStartup(1,wsaData)=0;
+end;
+
+Function FinalResolve : Boolean;
+
+begin
+  Result:=True;
+end;

+ 38 - 38
rtl/wince/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/12/10]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/12/26]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-wince powerpc64-linux
@@ -249,115 +249,115 @@ GRAPHDIR=$(INC)/graph
 include $(WININC)/makefile.inc
 WINDOWS_SOURCE_FILES=$(addprefix $(WININC)/,$(addsuffix .inc,$(WINDOWS_FILES)))
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts
+override TARGET_UNITS+=$(SYSTEMUNIT) ctypes objpas macpas strings lineinfo heaptrc windows messages dynlibs dos objects rtlconsts sysconst sysutils typinfo types classes strutils convutils math dateutils varutils variants matrix ucomplex charset getopts winsock sockets
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_LOADERS+=wprt0 #wdllprt0

+ 3 - 4
rtl/wince/Makefile.fpc

@@ -16,11 +16,10 @@ units=$(SYSTEMUNIT) ctypes objpas macpas strings \
       strutils convutils math dateutils \
       varutils variants \
       matrix ucomplex \
-      charset getopts
-
-# winsock initc cmem signals \
+      charset getopts winsock sockets
+# initc cmem signals \
 #    crt graph \
-#    wincrt winmouse winevent sockets printer \
+#    wincrt winmouse winevent  printer \
 #    video mouse keyboard \
 #    winsysut fpmkunit
 

+ 380 - 0
rtl/wince/sockets.pp

@@ -0,0 +1,380 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by the 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.
+
+ **********************************************************************}
+{$mode objfpc}
+unit Sockets;
+
+Interface
+
+{$macro on}
+{$define maybelibc:=}
+
+  Uses
+     windows,winsock,ctypes;
+
+Type
+  size_t  = cuint32;
+  ssize_t = cint32;
+  tsocklen= cint;
+  psocklen= ^tsocklen;
+
+
+  Const
+     AF_MAX          = WinSock.AF_MAX;
+     PF_MAX          = AF_MAX;
+
+{$i socketsh.inc}
+
+Implementation
+
+{ Include filerec and textrec structures }
+{$i filerec.inc}
+{$i textrec.inc}
+
+{******************************************************************************
+                          Basic Socket Functions
+******************************************************************************}
+
+//function fprecvmsg     (s:cint; msg: pmsghdr; flags:cint):ssize_t;
+//function fpsendmsg    (s:cint; hdr: pmsghdr; flags:cint):ssize;
+
+//function fpsocket     (domain:cint; xtype:cint; protocol: cint):cint;
+
+
+function fpsocket       (domain:cint; xtype:cint; protocol: cint):cint;
+begin
+  fpSocket:=WinSock.Socket(Domain,xtype,ProtoCol);
+  if fpSocket<0 then
+    SocketError:=WSAGetLastError
+  else
+    SocketError:=0;
+end;
+
+function fpsend (s:cint; msg:pointer; len:size_t; flags:cint):ssize_t;
+begin
+  fpSend:=WinSock.Send(S,msg,len,flags);
+  if fpSend<0 then
+    SocketError:=WSAGetLastError
+  else
+    SocketError:=0;
+end;
+
+function fpsendto (s:cint; msg:pointer; len:size_t; flags:cint; tox :psockaddr; tolen: tsocklen):ssize_t;
+begin
+  // Dubious construct, this should be checked. (IPV6 fails ?)
+  fpSendTo:=WinSock.SendTo(S,msg,Len,Flags,Winsock.TSockAddr(tox^),toLen);
+  if fpSendTo<0 then
+    SocketError:=WSAGetLastError
+  else
+    SocketError:=0;
+end;
+
+function fprecv         (s:cint; buf: pointer; len: size_t; flags: cint):ssize_t;
+begin
+  fpRecv:=WinSock.Recv(S,Buf,Len,Flags);
+  if fpRecv<0 then
+    SocketError:=WSAGetLastError
+  else
+    SocketError:=0;
+end;
+
+function fprecvfrom    (s:cint; buf: pointer; len: size_t; flags: cint; from : psockaddr; fromlen : psocklen):ssize_t;
+
+begin
+  fpRecvFrom:=WinSock.RecvFrom(S,Buf,Len,Flags,Winsock.TSockAddr(from^),FromLen^);
+  if fpRecvFrom<0 then
+    SocketError:=WSAGetLastError
+  else
+    SocketError:=0;
+end;
+
+function fpconnect     (s:cint; name  : psockaddr; namelen : tsocklen):cint;
+
+begin
+  fpConnect:=WinSock.Connect(S,WinSock.TSockAddr(name^),nameLen);
+  if fpConnect<0 then
+    SocketError:=WSAGetLastError
+  else
+    SocketError:=0;
+end;
+
+function fpshutdown     (s:cint; how:cint):cint;
+begin
+  fpShutDown:=WinSock.ShutDown(S,How);
+  if fpShutDown<0 then
+    SocketError:=WSAGetLastError
+  else
+    SocketError:=0;
+end;
+
+Function socket(Domain,SocketType,Protocol:Longint):Longint;
+begin
+  socket:=fpsocket(Domain,sockettype,protocol);
+end;
+
+Function Send(Sock:Longint;Const Buf;BufLen,Flags:Longint):Longint;
+
+begin
+  send:=fpsend(sock,@buf,buflen,flags);
+end;
+
+Function SendTo(Sock:Longint;Const Buf;BufLen,Flags:Longint;Var Addr; AddrLen : Longint):Longint;
+
+begin
+  sendto:=fpsendto(sock,@buf,buflen,flags,@addr,addrlen);
+end;
+
+Function Recv(Sock:Longint;Var Buf;BufLen,Flags:Longint):Longint;
+begin
+  Recv:=fpRecv(Sock,@Buf,BufLen,Flags);
+end;
+
+Function RecvFrom(Sock : Longint; Var Buf; Buflen,Flags : Longint; Var Addr; var AddrLen : longint) : longint;
+begin
+  RecvFrom:=fpRecvFrom(Sock,@Buf,BufLen,Flags,@Addr,@AddrLen);
+end;
+
+function fpbind (s:cint; addrx : psockaddr; addrlen : tsocklen):cint;
+
+begin
+  fpbind:=WinSock.Bind(S,WinSock.PSockAddr(Addrx),AddrLen);
+  if fpbind<0 then
+       SocketError:=WSAGetLastError
+  else
+       SocketError:=0;
+end;
+
+function fplisten      (s:cint; backlog : cint):cint;
+
+begin
+  fplisten:=WinSock.Listen(S,backlog);
+  if fplisten<0 then
+       SocketError:=WSAGetLastError
+  else
+       SocketError:=0;
+end;
+
+function fpaccept      (s:cint; addrx : psockaddr; addrlen : psocklen):cint;
+begin
+  fpAccept:=WinSock.Accept(S,WinSock.PSockAddr(Addrx),plongint(@AddrLen));
+  if fpAccept<0 then
+    SocketError:=WSAGetLastError
+  else
+    SocketError:=0;
+end;
+
+function fpgetsockname (s:cint; name  : psockaddr; namelen : psocklen):cint;
+
+begin
+  fpGetSockName:=WinSock.GetSockName(S,WinSock.TSockAddr(name^),nameLen^);
+  if fpGetSockName<0 then
+    SocketError:=WSAGetLastError
+  else
+    SocketError:=0;
+end;
+
+function fpgetpeername (s:cint; name  : psockaddr; namelen : psocklen):cint;
+begin
+  fpGetPeerName:=WinSock.GetPeerName(S,WinSock.TSockAddr(name^),NameLen^);
+  if fpGetPeerName<0 then
+    SocketError:=WSAGetLastError
+  else
+    SocketError:=0;
+end;
+
+function fpgetsockopt  (s:cint; level:cint; optname:cint; optval:pointer; optlen : psocklen):cint;
+begin
+  fpGetSockOpt:=WinSock.GetSockOpt(S,Level,OptName,OptVal,OptLen^);
+  if fpGetSockOpt<0 then
+    SocketError:=WSAGetLastError
+  else
+    SocketError:=0;
+end;
+
+function fpsetsockopt  (s:cint; level:cint; optname:cint; optval:pointer; optlen :tsocklen):cint;
+
+begin
+  fpSetSockOpt:=WinSock.SetSockOpt(S,Level,OptName,OptVal,OptLen);
+  if fpSetSockOpt<0 then
+    SocketError:=WSAGetLastError
+  else
+    SocketError:=0;
+end;
+
+function fpsocketpair  (d:cint; xtype:cint; protocol:cint; sv:pcint):cint;
+begin
+end;
+
+Function CloseSocket(Sock:Longint):Longint;
+var i : longint;
+begin
+  i := Winsock.CloseSocket (Sock);
+  if i <> 0 then
+  begin
+    SocketError:=WSAGetLastError;
+    CloseSocket := i;
+  end else
+  begin
+    CloseSocket := 0;
+    SocketError := 0;
+  end;
+end;
+
+Function Bind(Sock:Longint;Const Addr;AddrLen:Longint):Boolean;
+
+begin
+  bind:=fpBind(Sock,@Addr,AddrLen)=0;
+end;
+
+Function Listen(Sock,MaxConnect:Longint):Boolean;
+
+begin
+  Listen:=fplisten(Sock,MaxConnect)=0;
+end;
+
+Function Accept(Sock:Longint;Var Addr;Var Addrlen:Longint):Longint;
+
+begin
+  Accept:=FPAccept(sock,@addr,@addrlen);
+end;
+
+Function Shutdown(Sock:Longint;How:Longint):Longint;
+
+begin
+ shutdown:=fpshutdown(sock,how);
+end;
+
+Function Connect(Sock:Longint;Const Addr;Addrlen:Longint):Boolean;
+
+begin
+ connect:=fpconnect(sock,@addr,addrlen)=0;
+end;
+
+Function GetSocketName(Sock:Longint;Var Addr;Var Addrlen:Longint):Longint;
+begin
+ GetSocketName:=fpGetSockName(sock,@addr,@addrlen);
+end;
+
+Function GetPeerName(Sock:Longint;Var Addr;Var Addrlen:Longint):Longint;
+begin
+ GetPeerName:=fpGetPeerName(Sock,@addr,@addrlen);
+end;
+
+Function GetSocketOptions(Sock,Level,OptName:Longint;Var OptVal;Var optlen:longint):Longint;
+begin
+ GetSocketOptions:=fpGetSockOpt(sock,level,optname,@optval,@optlen);
+end;
+
+Function SetSocketOptions(Sock,Level,OptName:Longint;Const OptVal;optlen:longint):Longint;
+
+begin
+ SetSocketOptions:=fpsetsockopt(sock,level,optname,@optval,optlen);
+end;
+
+Function SocketPair(Domain,SocketType,Protocol:Longint;var Pair:TSockArray):Longint;
+begin
+  // SocketPair:=SocketCall(Socket_Sys_SocketPair,Domain,SocketType,Protocol,longint(@Pair),0,0);a
+end;
+
+{$ifdef unix}
+{ mimic the linux fpWrite/fpRead calls for the file/text socket wrapper }
+function fpWrite(handle : longint;Const bufptr;size : dword) : dword;
+begin
+  fpWrite := dword(WinSock.send(handle, bufptr, size, 0));
+  if fpWrite = dword(SOCKET_ERROR) then
+  begin
+    SocketError := WSAGetLastError;
+    fpWrite := 0;
+  end
+  else
+    SocketError := 0;
+end;
+
+function fpRead(handle : longint;var bufptr;size : dword) : dword;
+  var
+     d : dword;
+
+  begin
+     if ioctlsocket(handle,FIONREAD,@d) = SOCKET_ERROR then
+       begin
+         SocketError:=WSAGetLastError;
+         fpRead:=0;
+         exit;
+       end;
+     if d>0 then
+       begin
+         if size>d then
+           size:=d;
+         fpRead := dword(WinSock.recv(handle, bufptr, size, 0));
+         if fpRead = dword(SOCKET_ERROR) then
+         begin
+           SocketError:= WSAGetLastError;
+           fpRead := 0;
+         end else
+           SocketError:=0;
+       end
+     else
+       SocketError:=0;
+  end;
+{$else}
+{ mimic the linux fdWrite/fdRead calls for the file/text socket wrapper }
+function fdWrite(handle : longint;Const bufptr;size : dword) : dword;
+begin
+  fdWrite := dword(WinSock.send(handle, bufptr, size, 0));
+  if fdWrite = dword(SOCKET_ERROR) then
+  begin
+    SocketError := WSAGetLastError;
+    fdWrite := 0;
+  end
+  else
+    SocketError := 0;
+end;
+
+function fdRead(handle : longint;var bufptr;size : dword) : dword;
+  var
+     d : dword;
+
+  begin
+     if ioctlsocket(handle,FIONREAD,@d) = SOCKET_ERROR then
+       begin
+         SocketError:=WSAGetLastError;
+         fdRead:=0;
+         exit;
+       end;
+     if d>0 then
+       begin
+         if size>d then
+           size:=d;
+         fdRead := dword(WinSock.recv(handle, bufptr, size, 0));
+         if fdRead = dword(SOCKET_ERROR) then
+         begin
+           SocketError:= WSAGetLastError;
+           fdRead := 0;
+         end else
+           SocketError:=0;
+       end
+     else
+       SocketError:=0;
+  end;
+{$endif}
+
+{$i sockets.inc}
+
+{ winsocket stack needs an init. and cleanup code }
+var
+  wsadata : twsadata;
+
+initialization
+  WSAStartUp($2,wsadata);
+finalization
+  WSACleanUp;
+end.

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

@@ -45,8 +45,10 @@
   Changes :
 
   08/15/2005 update for wince4.2 port,ORO06
+  12/27/2005 update
 }
 
+
 {$ifdef read_interface}
 
 {$ifdef WINCE}
@@ -64,6 +66,7 @@
     MprDLLCore    = KernelDLL;
     ShellDLLCore  = KernelDLL;
     ShellDLL      = 'CEShell';
+    winsockdll    = 'ws2.dll';
 {$endif WINCE}
 
 {$ifdef WIN32}
@@ -81,7 +84,8 @@
     MprDLLCore    = 'mpr';
     ShellDLLCore  = 'shell32';
     ShellDLL      = ShellDLLCore;
-    
+    winsockdll    = 'winsock.dll';
+
 {$endif WIN32}
 
 {$PACKRECORDS C}

+ 55 - 53
rtl/wince/wininc/redef.inc

@@ -23,6 +23,61 @@
 
 //begin common win32 & wince
 
+
+type
+  PIID = PGUID;
+  TIID = TGUID;
+  THANDLE = HANDLE;
+
+  PSmallRect = ^TSmallRect;
+  TSmallRect = SMALL_RECT;
+
+  PCharInfo = ^TCharInfo;
+  TCharInfo = _CHAR_INFO;
+
+  TFarProc = FARPROC;
+  TFNDlgProc = FARPROC;
+  TFNThreadStartRoutine = FARPROC;
+  TFNTimerAPCRoutine    = FARPROC;
+  TFNFiberStartRoutine  = FARPROC;
+
+  PObjectTypeList = ^TObjectTypeList;
+  _OBJECT_TYPE_LIST = record
+     Level: WORD;
+     Sbz: WORD;
+     ObjectType: PGUID;
+  end;
+  TObjectTypeList = _OBJECT_TYPE_LIST;
+  OBJECT_TYPE_LIST = _OBJECT_TYPE_LIST;
+
+  AUDIT_EVENT_TYPE = DWORD;
+
+  PBlendFunction = ^TBlendFunction;
+  _BLENDFUNCTION = packed record
+    BlendOp: BYTE;
+    BlendFlags: BYTE;
+    SourceConstantAlpha: BYTE;
+    AlphaFormat: BYTE;
+  end;
+  TBlendFunction = _BLENDFUNCTION;
+  BLENDFUNCTION = _BLENDFUNCTION;
+
+  _WIN_CERTIFICATE =  Packed Record
+                       dwLength         : DWord;
+                       wRevision        : Word;
+                       wCertificateType : Word;
+                       bCertificate     : Array[0..0] of Byte;
+                      End;
+  TWinCertificate = _WIN_CERTIFICATE;
+  PWinCertificate = ^TWinCertificate;
+
+  TMaxLogPalette = Packed Record
+     palVersion    : Word;
+     palNumEntries : Word;
+     palPalEntry   : array[Byte] of TPaletteEntry;
+  end;
+  PMaxLogPalette = ^TMaxLogPalette;
+
 //
 //  A language ID is a 16 bit value which is the combination of a
 //  primary language ID and a secondary language ID.  The bits are
@@ -127,59 +182,6 @@ function CreateProcessA(lpApplicationName: LPCSTR; lpCommandLine: LPCSTR; lpProc
 
 {$ifdef WIN32}
 //begin win32 or wince not checked
-type
-  PIID = PGUID;
-  TIID = TGUID;
-  THANDLE = HANDLE;
-
-  PSmallRect = ^TSmallRect;
-  TSmallRect = SMALL_RECT;
-
-  PCharInfo = ^TCharInfo;
-  TCharInfo = _CHAR_INFO;
-
-  TFarProc = FARPROC;
-  TFNDlgProc = FARPROC;
-  TFNThreadStartRoutine = FARPROC;
-  TFNTimerAPCRoutine    = FARPROC;
-  TFNFiberStartRoutine  = FARPROC;
-
-  PObjectTypeList = ^TObjectTypeList;
-  _OBJECT_TYPE_LIST = record
-     Level: WORD;
-     Sbz: WORD;
-     ObjectType: PGUID;
-  end;
-  TObjectTypeList = _OBJECT_TYPE_LIST;
-  OBJECT_TYPE_LIST = _OBJECT_TYPE_LIST;
-
-  AUDIT_EVENT_TYPE = DWORD;
-
-  PBlendFunction = ^TBlendFunction;
-  _BLENDFUNCTION = packed record
-    BlendOp: BYTE;
-    BlendFlags: BYTE;
-    SourceConstantAlpha: BYTE;
-    AlphaFormat: BYTE;
-  end;
-  TBlendFunction = _BLENDFUNCTION;
-  BLENDFUNCTION = _BLENDFUNCTION;
-
-  _WIN_CERTIFICATE =  Packed Record
-                       dwLength         : DWord;
-                       wRevision        : Word;
-                       wCertificateType : Word;
-                       bCertificate     : Array[0..0] of Byte;
-                      End;
-  TWinCertificate = _WIN_CERTIFICATE;
-  PWinCertificate = ^TWinCertificate;
-
-  TMaxLogPalette = Packed Record
-     palVersion    : Word;
-     palNumEntries : Word;
-     palPalEntry   : array[Byte] of TPaletteEntry;
-  end;
-  PMaxLogPalette = ^TMaxLogPalette;
 
 
 const

+ 1134 - 0
rtl/wince/winsock.pp

@@ -0,0 +1,1134 @@
+{
+    This file is part of the Free Pascal run time library.
+    This unit contains the declarations for the Wince Socket Library
+
+    Copyright (c) 1999-2000 by Florian Klaempfl
+    member of the 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.
+
+ **********************************************************************}
+
+{$PACKRECORDS 1}
+unit winsock;
+{$ifndef VER0_99_14}
+{$ifndef NO_SMART_LINK}
+{$define support_smartlink}
+{$endif}
+{$endif}
+
+
+{$ifdef support_smartlink}
+{$smartlink on}
+{$endif}
+
+
+{remaining functions exported from ws2.dll and not used yet = to do,
+
+ * please remove functions done *
+
+                  WSAAccept
+                  WSAAddressToStringW
+                  WSAAsyncGetAddrInfo
+                  WSACloseEvent
+                  WSAConnect
+                  WSACreateEvent
+                  WSAEnumNameSpaceProvidersW
+                  WSAEnumNetworkEvents
+                  WSAEnumProtocolsW
+                  WSAEventSelect
+                  WSAGetOverlappedResult
+                  WSAHtonl
+                  WSAHtons
+                  WSAIoctl
+                  WSAJoinLeaf
+                  WSALookupServiceBeginW
+                  WSALookupServiceEnd
+                  WSALookupServiceNextW
+                  WSANtohl
+                  WSANtohs
+                  WSARecv
+                  WSARecvFrom
+                  WSAResetEvent
+                  WSASend
+                  WSASendTo
+                  WSASetEvent
+                  WSASetServiceW
+                  WSASocketW
+                  WSAStringToAddressW
+                  WSAWaitForMultipleEvents
+                  WSCDeinstallProvider
+                  WSCEnumProtocols
+                  WSCInstallNameSpace
+                  WSCInstallProvider
+                  WSCUnInstallNameSpace
+                  freeaddrinfo
+                  getaddrinfo
+                  getnameinfo
+                  in6addr_any
+                  in6addr_loopback
+                  sethostname
+}
+
+  interface
+
+    uses
+       windows;
+
+//begin common win32 & wince
+
+    const
+       {
+         Default maximium number of sockets.
+         this does not
+         mean that the underlying Windows Sockets implementation has to
+         support that many!
+       }
+       FD_SETSIZE = 64;
+
+    type
+       tOS_INT  = LongInt;
+       tOS_UINT = DWord;
+       ptOS_INT = ^tOS_INT;
+       ptOS_UINT = ^tOS_UINT;
+       u_char = char;
+       u_short = word;
+       u_int = tOS_UINT;
+       u_long = dword;
+       pu_long = ^u_long;
+       plongint = ^longint;
+       TSocket = u_long;
+
+       { there is already a procedure called FD_SET, so this
+         record was renamed (FK) }
+       fdset = record
+          fd_count : u_int;
+          fd_array : array[0..(FD_SETSIZE)-1] of TSocket;
+       end;
+
+       TFDSet = fdset;
+       PFDSet = ^fdset;
+
+       timeval = record
+          tv_sec : longint;
+          tv_usec : longint;
+       end;
+
+       TTimeVal = timeval;
+       PTimeVal = ^TTimeVal;
+
+       { found no reference to this type in c header files and here. AlexS }
+       { minutes west of Greenwich  }
+       { type of dst correction  }
+       timezone = record
+          tz_minuteswest : longint;
+          tz_dsttime : longint;
+       end;
+       TTimeZone = timezone;
+       PTimeZone = ^TTimeZone;
+
+       { ioctlsocket(),  taken from the BSD file fcntl.h.
+
+         Ioctl's have the command encoded in the lower word,
+         and the size of any in or out parameters in the upper
+         word.  The high 2 bits of the upper word are used
+         to encode the in/out status of the parameter; for now
+         restrict parameters to at most 128 bytes.}
+
+    const
+       IOCPARM_MASK = $7f;                 {parameters must be < 128 bytes}
+       IOC_VOID  = $20000000;              {no parameters}
+       IOC_OUT   = $40000000;              {copy out parameters}
+       IOC_IN    = $80000000;              {copy in parameters}
+       IOC_INOUT = IOC_IN or IOC_OUT;
+
+       FIONREAD =cardinal( IOC_OUT or      { get # bytes to read }
+         ((4 and IOCPARM_MASK) shl 16) or
+         (102 shl 8) or 127);
+       FIONBIO = cardinal(IOC_IN or        { set/clear non-blocking i/o }
+         ((4 and IOCPARM_MASK) shl 16) or
+         (102 shl 8) or 126);
+       FIOASYNC     = cardinal(IOC_IN or   { set/clear async i/o = }
+         ((4 and IOCPARM_MASK) shl 16) or
+         (102 shl 8) or 125);
+
+       { Socket I/O Controls }
+       SIOCSHIWAT   = cardinal(IOC_IN or   { set high watermark }
+         ((4 and IOCPARM_MASK) shl 16) or
+         (115 shl 8));
+
+       SIOCGHIWAT   = cardinal(IOC_OUT or { get high watermark }
+         ((4 and IOCPARM_MASK) shl 16) or
+         (115 shl 8) or 1);
+
+       SIOCSLOWAT   = cardinal(IOC_IN or   { set low watermark }
+         ((4 and IOCPARM_MASK) shl 16) or
+         (115 shl 8) or 2);
+       SIOCGLOWAT   = cardinal(IOC_OUT or  { get low watermark }
+         ((4 and IOCPARM_MASK) shl 16) or
+         (115 shl 8) or 3);
+
+       SIOCATMARK   = cardinal(IOC_OUT or  { at oob mark? }
+         ((4 and IOCPARM_MASK) shl 16) or
+         (115 shl 8) or 7);
+
+
+       {
+         Structures returned by network data base library, taken from the
+         BSD file netdb.h.  All addresses are supplied in host order, and
+         returned in network order (suitable for use in system calls).
+         Slight modifications for differences between Linux and winsock.h
+      }
+    type
+       hostent = record
+          { official name of host  }
+          h_name: pchar;
+          { alias list  }
+          h_aliases: ^pchar;
+          { host address type  }
+          h_addrtype: SmallInt;
+          { length of address  }
+          h_length: SmallInt;
+          { list of addresses  }
+          case byte of
+             0: (h_addr_list: ^pchar);
+             1: (h_addr: ^pchar)
+       end;
+       THostEnt = hostent;
+       PHostEnt = ^THostEnt;
+
+       {
+         Assumption here is that a network number
+         fits in an unsigned long -- someday that won't be true!
+       }
+       netent = record
+          { official name of net  }
+          n_name : ^char;
+          { alias list  }
+          n_aliases : ^pchar;
+          { net address type  }
+          n_addrtype : SmallInt;
+          n_pad1 : SmallInt;    { ensure right packaging }
+          { network #  }
+          n_net : u_long;
+       end;
+       TNetEnt = netent;
+       PNetEnt = ^TNetEnt;
+
+       servent = record
+          { official service name  }
+          s_name : ^char;
+          { alias list  }
+          s_aliases : ^pchar;
+          { port #  }
+          s_port : SmallInt;
+          n_pad1 : SmallInt;    { ensure right packaging }
+          { protocol to use  }
+          s_proto : ^char;
+       end;
+       TServEnt = servent;
+       PServEnt = ^TServEnt;
+
+       protoent = record
+          { official protocol name  }
+          p_name : ^char;
+          { alias list  }
+          p_aliases : ^pchar;
+          { protocol #  }
+          p_proto : SmallInt;
+          p_pad1 : SmallInt;    { ensure packaging }
+       end;
+       TProtoEnt = protoent;
+       PProtoEnt = ^TProtoEnt;
+
+    const
+       {
+         Standard well-known IP protocols.
+         For some reason there are differences between Linx and winsock.h
+       }
+       IPPROTO_IP       = 0;
+       IPPROTO_ICMP     = 1;
+       IPPROTO_IGMP     = 2;
+       IPPROTO_GGP      = 3;
+       IPPROTO_TCP      = 6;
+       IPPROTO_PUP      = 12;
+       IPPROTO_UDP      = 17;
+       IPPROTO_IDP      = 22;
+       IPPROTO_IPV6     = 41;              { IPv6 }
+       IPPROTO_ND       = 77;
+       IPPROTO_ICLFXBM  = 78;
+       IPPROTO_RAW      = 255;
+       IPPROTO_MAX      = 256;
+
+       IPPORT_ECHO        = 7;
+       IPPORT_DISCARD     = 9;
+       IPPORT_SYSTAT      = 11;
+       IPPORT_DAYTIME     = 13;
+       IPPORT_NETSTAT     = 15;
+       IPPORT_FTP         = 21;
+       IPPORT_TELNET      = 23;
+       IPPORT_SMTP        = 25;
+       IPPORT_TIMESERVER  = 37;
+       IPPORT_NAMESERVER  = 42;
+       IPPORT_WHOIS       = 43;
+       IPPORT_MTP         = 57;
+       IPPORT_TFTP        = 69;
+       IPPORT_RJE         = 77;
+       IPPORT_FINGER      = 79;
+       IPPORT_TTYLINK     = 87;
+       IPPORT_SUPDUP      = 95;
+       IPPORT_EXECSERVER  = 512;
+       IPPORT_LOGINSERVER = 513;
+       IPPORT_CMDSERVER   = 514;
+       IPPORT_EFSSERVER   = 520;
+       IPPORT_BIFFUDP     = 512;
+       IPPORT_WHOSERVER   = 513;
+       IPPORT_ROUTESERVER = 520;
+       IPPORT_RESERVED    = 1024;
+
+    const
+       IMPLINK_IP = 155;
+       IMPLINK_LOWEXPER = 156;
+       IMPLINK_HIGHEXPER = 158;
+
+    type
+       SunB = packed record
+          s_b1,s_b2,s_b3,s_b4 : u_char;
+       end;
+
+       SunW = packed record
+         s_w1,s_w2 : u_short;
+       end;
+
+       in_addr = record
+          case integer of
+             0 : (S_un_b : SunB);
+             1 : (S_un_w : SunW);
+             2 : (S_addr : u_long);
+       end;
+       TInAddr = in_addr;
+       PInAddr = ^TInAddr;
+
+       sockaddr_in = record
+          case integer of
+             0 : ( (* equals to sockaddr_in, size is 16 byte *)
+                  sin_family : SmallInt;                (* 2 byte *)
+                  sin_port : u_short;                   (* 2 byte *)
+                  sin_addr : TInAddr;                   (* 4 byte *)
+                  sin_zero : array[0..8-1] of char;     (* 8 byte *)
+                 );
+             1 : ((* equals to sockaddr, size is 16 byte *)
+                  sa_family : Smallint; (* 2 byte *)
+                  sa_data : array[0..14-1] of char;    (* 14 byte *)
+                 );
+       end;
+       TSockAddrIn = sockaddr_in;
+       PSockAddrIn = ^TSockAddrIn;
+       TSockAddr = sockaddr_in;
+       PSockAddr = ^TSockAddr;
+
+    const
+       INADDR_ANY = $00000000;
+       INADDR_LOOPBACK = $7F000001;
+       INADDR_BROADCAST = $FFFFFFFF;
+
+       IN_CLASSA_NET = $ff000000;
+       IN_CLASSA_NSHIFT = 24;
+       IN_CLASSA_HOST = $00ffffff;
+       IN_CLASSA_MAX = 128;
+       IN_CLASSB_NET = $ffff0000;
+       IN_CLASSB_NSHIFT = 16;
+       IN_CLASSB_HOST = $0000ffff;
+       IN_CLASSB_MAX = 65536;
+       IN_CLASSC_NET = $ffffff00;
+       IN_CLASSC_NSHIFT = 8;
+       IN_CLASSC_HOST = $000000ff;
+
+       WSADESCRIPTION_LEN = 256;
+       WSASYS_STATUS_LEN = 128;
+
+    type
+       WSADATA = record
+          wVersion : WORD;              { 2 byte, ofs 0 }
+          wHighVersion : WORD;          { 2 byte, ofs 2 }
+          szDescription : array[0..(WSADESCRIPTION_LEN+1)-1] of char; { 257 byte, ofs 4 }
+          szSystemStatus : array[0..(WSASYS_STATUS_LEN+1)-1] of char; { 129 byte, ofs 261 }
+          iMaxSockets : word;           { 2 byte, ofs 390 }
+          iMaxUdpDg : word;             { 2 byte, ofs 392 }
+          pad1 : SmallInt;              { 2 byte, ofs 394 } { ensure right packaging }
+          lpVendorInfo : pchar;         { 4 byte, ofs 396 }
+       end;                             { total size 400 }
+       TWSAData = WSADATA;
+       PWSAData = ^TWSAData;
+
+    const
+       IP_OPTIONS = 1;
+       IP_MULTICAST_IF = 2;
+       IP_MULTICAST_TTL = 3;
+       IP_MULTICAST_LOOP = 4;
+       IP_ADD_MEMBERSHIP = 5;
+       IP_DROP_MEMBERSHIP = 6;
+       IP_DEFAULT_MULTICAST_TTL = 1;
+       IP_DEFAULT_MULTICAST_LOOP = 1;
+       IP_MAX_MEMBERSHIPS = 20;
+
+    type
+       ip_mreq = record
+            imr_multiaddr : in_addr;
+            imr_interface : in_addr;
+         end;
+
+    {
+       Definitions related to sockets: types, address families, options,
+       taken from the BSD file sys/socket.h.
+    }
+    const
+       INVALID_SOCKET = TSocket(not(0));
+       SOCKET_ERROR = -1;
+       SOCK_STREAM = 1;
+       SOCK_DGRAM = 2;
+       SOCK_RAW = 3;
+       SOCK_RDM = 4;
+       SOCK_SEQPACKET = 5;
+
+      { For setsockoptions(2)  }
+       SO_DEBUG = $0001;
+       SO_ACCEPTCONN = $0002;
+       SO_REUSEADDR = $0004;
+       SO_KEEPALIVE = $0008;
+       SO_DONTROUTE = $0010;
+       SO_BROADCAST = $0020;
+       SO_USELOOPBACK = $0040;
+       SO_LINGER = $0080;
+       SO_OOBINLINE = $0100;
+       {
+         Additional options.
+       }
+       { send buffer size  }
+       SO_SNDBUF = $1001;
+       { receive buffer size  }
+       SO_RCVBUF = $1002;
+       { send low-water mark  }
+       SO_SNDLOWAT = $1003;
+       { receive low-water mark  }
+       SO_RCVLOWAT = $1004;
+       { send timeout  }
+       SO_SNDTIMEO = $1005;
+       { receive timeout  }
+       SO_RCVTIMEO = $1006;
+       { get error status and clear  }
+       SO_ERROR = $1007;
+       { get socket type  }
+       SO_TYPE = $1008;
+
+       { WinSock 2 extension -- new options }
+       SO_GROUP_ID            = $2001;  { ID of a socket group }
+       SO_GROUP_PRIORITY      = $2002;  { the relative priority within a group}
+       SO_MAX_MSG_SIZE        = $2003;  { maximum message size }
+       SO_PROTOCOL_INFOA      = $2004;  { WSAPROTOCOL_INFOA structure }
+       SO_PROTOCOL_INFOW      = $2005;  { WSAPROTOCOL_INFOW structure }
+       {$ifdef UNICODE}
+        SO_PROTOCOL_INFO = SO_PROTOCOL_INFOW;
+       {$else}
+        SO_PROTOCOL_INFO = SO_PROTOCOL_INFOA;
+       {$endif UNICODE}
+       PVD_CONFIG             = $3001;   { configuration info for service provider }
+       SO_CONDITIONAL_ACCEPT  = $3002;   { enable true conditional accept: }
+                                         {  connection is not ack-ed to the }
+                                         {  other side until conditional }
+                                         {  function returns CF_ACCEPT }
+
+       {
+         Options for connect and disconnect data and options.  Used only by
+         non-TCP/IP transports such as DECNet, OSI TP4, etc.
+       }
+       SO_CONNDATA = $7000;
+       SO_CONNOPT = $7001;
+       SO_DISCDATA = $7002;
+       SO_DISCOPT = $7003;
+       SO_CONNDATALEN = $7004;
+       SO_CONNOPTLEN = $7005;
+       SO_DISCDATALEN = $7006;
+       SO_DISCOPTLEN = $7007;
+
+       {
+         Option for opening sockets for synchronous access.
+       }
+       SO_OPENTYPE = $7008;
+       SO_SYNCHRONOUS_ALERT = $10;
+       SO_SYNCHRONOUS_NONALERT = $20;
+
+       {
+         Other NT-specific options.
+       }
+       SO_MAXDG = $7009;
+       SO_MAXPATHDG = $700A;
+       SO_UPDATE_ACCEPT_CONTEXT = $700B;
+       SO_CONNECT_TIME = $700C;
+
+       {
+         TCP options.
+       }
+       TCP_NODELAY = $0001;
+       TCP_BSDURGENT = $7000;
+
+       {
+         Address families.
+       }
+       { unspecified  }
+       AF_UNSPEC = 0;
+       { local to host (pipes, portals)  }
+       AF_UNIX = 1;
+       { internetwork: UDP, TCP, etc.  }
+       AF_INET = 2;
+       { arpanet imp addresses  }
+       AF_IMPLINK = 3;
+       { pup protocols: e.g. BSP  }
+       AF_PUP = 4;
+       { mit CHAOS protocols  }
+       AF_CHAOS = 5;
+       { IPX and SPX  }
+       AF_IPX = 6;
+       { XEROX NS protocols  }
+       AF_NS = 6;
+       { ISO protocols  }
+       AF_ISO = 7;
+       { OSI is ISO  }
+       AF_OSI = AF_ISO;
+       { european computer manufacturers  }
+       AF_ECMA = 8;
+       { datakit protocols  }
+       AF_DATAKIT = 9;
+       { CCITT protocols, X.25 etc  }
+       AF_CCITT = 10;
+       { IBM SNA  }
+       AF_SNA = 11;
+       { DECnet  }
+       AF_DECnet = 12;
+       { Direct data link interface  }
+       AF_DLI = 13;
+       { LAT  }
+       AF_LAT = 14;
+       { NSC Hyperchannel  }
+       AF_HYLINK = 15;
+       { AppleTalk  }
+       AF_APPLETALK = 16;
+       { NetBios-style addresses  }
+       AF_NETBIOS = 17;
+       { VoiceView }
+       AF_VOICEVIEW = 18;
+       { FireFox }
+       AF_FIREFOX = 19;
+       { Somebody is using this! }
+       AF_UNKNOWN1 = 20;
+       { Banyan }
+       AF_BAN = 21;
+       {$ifdef UNDER_CE}
+        {IrDA}
+        AF_IRDA = 22;
+       {$else UNDER_CE}
+        {Native ATM Services}
+        AF_ATM =  22;
+       {$endif UNDER_CE}
+       {Internetwork Version 6}
+       AF_INET6 = 23;
+       {Microsoft Wolfpack}
+       AF_CLUSTER = 24;
+       {IEEE 1284.4 WG AF}
+       AF_12844 = 25;
+       {$ifdef UNDER_CE}
+        {Native ATM Services}
+        AF_ATM = 26;
+       {$else UNDER_CE}
+        {IrDA}
+        AF_IRDA = 26;
+       {$endif UNDER_CE}
+       {Network Designers OSI & gateway enabled protocols.}
+       AF_NETDES = 28;
+       AF_TCNPROCESS = 29;
+       AF_TCNMESSAGE = 30;
+       AF_ICLFXBM = 31;
+       AF_MAX = 32;
+
+    type
+
+
+       { Structure used by kernel to pass protocol information in raw sockets.}
+       sockproto = record
+          sp_family : u_short;
+          sp_protocol : u_short;
+       end;
+       TSockProto = sockproto;
+       PSockProto = ^TSockProto;
+
+    const
+       {Protocol families, same as address families for now.}
+       PF_UNSPEC = AF_UNSPEC;
+       PF_UNIX = AF_UNIX;
+       PF_INET = AF_INET;
+       PF_IMPLINK = AF_IMPLINK;
+       PF_PUP = AF_PUP;
+       PF_CHAOS = AF_CHAOS;
+       PF_NS = AF_NS;
+       PF_IPX = AF_IPX;
+       PF_ISO = AF_ISO;
+       PF_OSI = AF_OSI;
+       PF_ECMA = AF_ECMA;
+       PF_DATAKIT = AF_DATAKIT;
+       PF_CCITT = AF_CCITT;
+       PF_SNA = AF_SNA;
+       PF_DECnet = AF_DECnet;
+       PF_DLI = AF_DLI;
+       PF_LAT = AF_LAT;
+       PF_HYLINK = AF_HYLINK;
+       PF_APPLETALK = AF_APPLETALK;
+       PF_VOICEVIEW = AF_VOICEVIEW;
+       PF_FIREFOX = AF_FIREFOX;
+       PF_UNKNOWN1 = AF_UNKNOWN1;
+       PF_BAN = AF_BAN;
+       PF_ATM = AF_ATM;
+       PF_INET6 = AF_INET6;
+       PF_MAX = AF_MAX;
+
+    type
+       {
+         Structure used for manipulating linger option.
+       }
+       linger = record
+          l_onoff : u_short;
+          l_linger : u_short;
+       end;
+       TLinger = linger;
+       PLinger = ^TLinger;
+
+    const
+       {
+         Level number for (get/set)sockopt() to apply to socket itself.
+       }
+       { options for socket level  }
+       SOL_SOCKET = $ffff;
+       {
+         Maximum queue length specifiable by listen.
+       }
+       SOMAXCONN = $7fffffff;
+       { process out-of-band data  }
+       MSG_OOB = $1;
+       { peek at incoming message  }
+       MSG_PEEK = $2;
+       { send without using routing tables  }
+       MSG_DONTROUTE = $4;
+       MSG_MAXIOVLEN = 16;
+       { partial send or recv for message xport  }
+       MSG_PARTIAL = $8000;
+       {WinSock 2 extension -- new flags for WSASend(), WSASendTo(), WSARecv()
+        and WSARecvFrom()}
+       MSG_INTERRUPT = $10; { send/recv in the interrupt context }
+
+       {
+         Define constant based on rfc883, used by gethostbyxxxx() calls.
+       }
+       MAXGETHOSTSTRUCT = 1024;
+       MAXHOSTNAMELEN = MAXGETHOSTSTRUCT;
+
+       {Define flags to be used with the WSAAsyncSelect() call.}
+       FD_READ = $01;
+       FD_WRITE = $02;
+       FD_OOB = $04;
+       FD_ACCEPT = $08;
+       FD_CONNECT = $10;
+       FD_CLOSE = $20;
+       FD_QOS = $40;
+       FD_GROUP_QOS = $80;
+       FD_ROUTING_INTERFACE_CHANGE = $100;
+       FD_ADDRESS_LIST_CHANGE = $200;
+       FD_MAX_EVENTS = 10;
+       FD_ALL_EVENTS = $3FF;
+
+       {
+         All Windows Sockets error constants are biased by WSABASEERR from
+         the "normal"
+       }
+       WSABASEERR = 10000;
+
+       {
+         Windows Sockets definitions of regular Microsoft C error constants
+       }
+       WSAEINTR = WSABASEERR + 4;
+       WSAEBADF = WSABASEERR + 9;
+       WSAEACCES = WSABASEERR + 13;
+       WSAEFAULT = WSABASEERR + 14;
+       WSAEINVAL = WSABASEERR + 22;
+       WSAEMFILE = WSABASEERR + 24;
+
+       {
+         Windows Sockets definitions of regular Berkeley error constants
+       }
+       WSAEWOULDBLOCK = WSABASEERR + 35;
+       WSAEINPROGRESS = WSABASEERR + 36;
+       WSAEALREADY = WSABASEERR + 37;
+       WSAENOTSOCK = WSABASEERR + 38;
+       WSAEDESTADDRREQ = WSABASEERR + 39;
+       WSAEMSGSIZE = WSABASEERR + 40;
+       WSAEPROTOTYPE = WSABASEERR + 41;
+       WSAENOPROTOOPT = WSABASEERR + 42;
+       WSAEPROTONOSUPPORT = WSABASEERR + 43;
+       WSAESOCKTNOSUPPORT = WSABASEERR + 44;
+       WSAEOPNOTSUPP = WSABASEERR + 45;
+       WSAEPFNOSUPPORT = WSABASEERR + 46;
+       WSAEAFNOSUPPORT = WSABASEERR + 47;
+       WSAEADDRINUSE = WSABASEERR + 48;
+       WSAEADDRNOTAVAIL = WSABASEERR + 49;
+       WSAENETDOWN = WSABASEERR + 50;
+       WSAENETUNREACH = WSABASEERR + 51;
+       WSAENETRESET = WSABASEERR + 52;
+       WSAECONNABORTED = WSABASEERR + 53;
+       WSAECONNRESET = WSABASEERR + 54;
+       WSAENOBUFS = WSABASEERR + 55;
+       WSAEISCONN = WSABASEERR + 56;
+       WSAENOTCONN = WSABASEERR + 57;
+       WSAESHUTDOWN = WSABASEERR + 58;
+       WSAETOOMANYREFS = WSABASEERR + 59;
+       WSAETIMEDOUT = WSABASEERR + 60;
+       WSAECONNREFUSED = WSABASEERR + 61;
+       WSAELOOP = WSABASEERR + 62;
+       WSAENAMETOOLONG = WSABASEERR + 63;
+       WSAEHOSTDOWN = WSABASEERR + 64;
+       WSAEHOSTUNREACH = WSABASEERR + 65;
+       WSAENOTEMPTY = WSABASEERR + 66;
+       WSAEPROCLIM = WSABASEERR + 67;
+       WSAEUSERS = WSABASEERR + 68;
+       WSAEDQUOT = WSABASEERR + 69;
+       WSAESTALE = WSABASEERR + 70;
+       WSAEREMOTE = WSABASEERR + 71;
+
+       {
+         Extended Windows Sockets error constant definitions
+       }
+       WSASYSNOTREADY = WSABASEERR + 91;
+       WSAVERNOTSUPPORTED = WSABASEERR + 92;
+       WSANOTINITIALISED = WSABASEERR + 93;
+       WSAEDISCON = WSABASEERR + 101;
+       WSAENOMORE = WSABASEERR+102;
+       WSAECANCELLED = WSABASEERR+103;
+       WSAEINVALIDPROCTABLE = WSABASEERR+104;
+       WSAEINVALIDPROVIDER = WSABASEERR+105;
+       WSAEPROVIDERFAILEDINIT = WSABASEERR+106;
+       WSASYSCALLFAILURE = WSABASEERR+107;
+       WSASERVICE_NOT_FOUND = WSABASEERR+108;
+       WSATYPE_NOT_FOUND = WSABASEERR+109;
+       WSA_E_NO_MORE = WSABASEERR+110;
+       WSA_E_CANCELLED = WSABASEERR+111;
+       WSAEREFUSED = WSABASEERR+112;
+       {$ifdef UNDER_CE}
+        WSAEDUPLICATE_NAME = WSABASEERR+900;
+       {$endif UNDER_CE}
+       {
+         Error return codes from gethostbyname() and gethostbyaddr()
+         (when using the resolver). Note that these errors are
+         retrieved via WSAGetLastError() and must therefore follow
+         the rules for avoiding clashes with error numbers from
+         specific implementations or language run-time systems.
+         For this reason the codes are based at WSABASEERR+1001.
+         Note also that [WSA]NO_ADDRESS is defined only for
+         compatibility purposes.
+        }
+       WSAHOST_NOT_FOUND = WSABASEERR + 1001;
+       HOST_NOT_FOUND = WSAHOST_NOT_FOUND;
+       { Non-Authoritative: Host not found, or SERVERFAIL  }
+       WSATRY_AGAIN = WSABASEERR + 1002;
+       TRY_AGAIN = WSATRY_AGAIN;
+
+       { Non recoverable errors, FORMERR, REFUSED, NOTIMP  }
+       WSANO_RECOVERY = WSABASEERR + 1003;
+       NO_RECOVERY = WSANO_RECOVERY;
+
+       { Valid name, no data record of requested type  }
+       WSANO_DATA = WSABASEERR + 1004;
+       NO_DATA = WSANO_DATA;
+       { no address, look for MX record  }
+       WSANO_ADDRESS = WSANO_DATA;
+       NO_ADDRESS = WSANO_ADDRESS;
+
+       { Define QOS related error return codes }
+       WSA_QOS_RECEIVERS = WSABASEERR + 1005;
+       { at least one Reserve has arrived }
+       WSA_QOS_SENDERS = WSABASEERR + 1006;
+         { at least one Path has arrived }
+       WSA_QOS_NO_SENDERS = WSABASEERR + 1007;
+         { there are no senders }
+       WSA_QOS_NO_RECEIVERS = WSABASEERR + 1008;
+         { there are no receivers }
+       WSA_QOS_REQUEST_CONFIRMED = WSABASEERR + 1009;
+         { Reserve has been confirmed }
+       WSA_QOS_ADMISSION_FAILURE = WSABASEERR + 1010;
+         { error due to lack of resources }
+       WSA_QOS_POLICY_FAILURE = WSABASEERR + 1011;
+         { rejected for administrative reasons - bad credentials }
+       WSA_QOS_BAD_STYLE = WSABASEERR + 1012;
+         { unknown or conflicting style }
+       WSA_QOS_BAD_OBJECT = WSABASEERR + 1013;
+         { problem with some part of the filterspec or providerspecific buffer }
+       WSA_QOS_TRAFFIC_CTRL_ERROR = WSABASEERR + 1014;
+         { problem with some part of the flowspec }
+       WSA_QOS_GENERIC_ERROR = WSABASEERR + 1015;
+         { general error }
+       WSA_QOS_ESERVICETYPE = WSABASEERR + 1016;
+         { invalid service type in flowspec }
+       WSA_QOS_EFLOWSPEC = WSABASEERR + 1017;
+         { invalid flowspec }
+       WSA_QOS_EPROVSPECBUF = WSABASEERR + 1018;
+         { invalid provider specific buffer }
+       WSA_QOS_EFILTERSTYLE = WSABASEERR + 1019;
+         { invalid filter style }
+       WSA_QOS_EFILTERTYPE  = WSABASEERR + 1020;
+         { invalid filter type }
+       WSA_QOS_EFILTERCOUNT = WSABASEERR + 1021;
+         { incorrect number of filters }
+       WSA_QOS_EOBJLENGTH   = WSABASEERR + 1022;
+         { invalid object length }
+       WSA_QOS_EFLOWCOUNT   = WSABASEERR + 1023;
+         { incorrect number of flows }
+       WSA_QOS_EUNKOWNPSOBJ = WSABASEERR + 1024;
+         { unknown object in provider specific buffer }
+       WSA_QOS_EPOLICYOBJ = WSABASEERR + 1025;
+         { invalid policy object in provider specific buffer }
+       WSA_QOS_EFLOWDESC = WSABASEERR + 1026;
+         { invalid flow descriptor in the list }
+       WSA_QOS_EPSFLOWSPEC = WSABASEERR + 1027;
+         { inconsistent flow spec in provider specific buffer }
+       WSA_QOS_EPSFILTERSPEC = WSABASEERR + 1028;
+         { invalid filter spec in provider specific buffer }
+       WSA_QOS_ESDMODEOBJ = WSABASEERR + 1029;
+         { invalid shape discard mode object in provider specific buffer }
+       WSA_QOS_ESHAPERATEOBJ = WSABASEERR + 1030;
+         { invalid shaping rate object in provider specific buffer }
+       WSA_QOS_RESERVED_PETYPE = WSABASEERR + 1031;
+         { reserved policy element in provider specific buffer }
+
+
+    const
+       {
+         Windows Sockets errors redefined as regular Berkeley error constants.
+       }
+       EWOULDBLOCK = WSAEWOULDBLOCK;
+       EINPROGRESS = WSAEINPROGRESS;
+       EALREADY = WSAEALREADY;
+       ENOTSOCK = WSAENOTSOCK;
+       EDESTADDRREQ = WSAEDESTADDRREQ;
+       EMSGSIZE = WSAEMSGSIZE;
+       EPROTOTYPE = WSAEPROTOTYPE;
+       ENOPROTOOPT = WSAENOPROTOOPT;
+       EPROTONOSUPPORT = WSAEPROTONOSUPPORT;
+       ESOCKTNOSUPPORT = WSAESOCKTNOSUPPORT;
+       EOPNOTSUPP = WSAEOPNOTSUPP;
+       EPFNOSUPPORT = WSAEPFNOSUPPORT;
+       EAFNOSUPPORT = WSAEAFNOSUPPORT;
+       EADDRINUSE = WSAEADDRINUSE;
+       EADDRNOTAVAIL = WSAEADDRNOTAVAIL;
+       ENETDOWN = WSAENETDOWN;
+       ENETUNREACH = WSAENETUNREACH;
+       ENETRESET = WSAENETRESET;
+       ECONNABORTED = WSAECONNABORTED;
+       ECONNRESET = WSAECONNRESET;
+       ENOBUFS = WSAENOBUFS;
+       EISCONN = WSAEISCONN;
+       ENOTCONN = WSAENOTCONN;
+       ESHUTDOWN = WSAESHUTDOWN;
+       ETOOMANYREFS = WSAETOOMANYREFS;
+       ETIMEDOUT = WSAETIMEDOUT;
+       ECONNREFUSED = WSAECONNREFUSED;
+       ELOOP = WSAELOOP;
+       ENAMETOOLONG = WSAENAMETOOLONG;
+       EHOSTDOWN = WSAEHOSTDOWN;
+       EHOSTUNREACH = WSAEHOSTUNREACH;
+       ENOTEMPTY = WSAENOTEMPTY;
+       EPROCLIM = WSAEPROCLIM;
+       EUSERS = WSAEUSERS;
+       EDQUOT = WSAEDQUOT;
+       ESTALE = WSAESTALE;
+       EREMOTE = WSAEREMOTE;
+
+       TF_DISCONNECT = $01;
+       TF_REUSE_SOCKET = $02;
+       TF_WRITE_BEHIND = $04;
+
+       {
+         Options for use with [gs]etsockopt at the IP level.
+       }
+       IP_TTL = 7;
+       IP_TOS = 8;
+       IP_DONTFRAGMENT = 9;
+
+    type
+       _TRANSMIT_FILE_BUFFERS = record
+          Head : Pointer;
+          HeadLength : dword;
+          Tail : Pointer;
+          TailLength : dword;
+       end;
+       TRANSMIT_FILE_BUFFERS = _TRANSMIT_FILE_BUFFERS;
+       TTransmitFileBuffers = _TRANSMIT_FILE_BUFFERS;
+       PTransmitFileBuffers = ^TTransmitFileBuffers;
+
+
+{
+Winsock types all buffers as pchar (char *), modern POSIX does it the ANSI
+C way with pointer (void *). If the pointer overloaded version doesn't exist,
+a "pointer" will be passed to the "var" version. (bug 3142).
+So if there are var/const versions:
+- To keep ported unix code working, there must be "pointer" variants (ANSI)
+- To keep Delphi/ported C Winsock code working there must be pchar variants
+        (K&R)
+IOW, there _must_ be 3 versions then: var/const, pchar and pointer}
+
+    function accept(s:TSocket; addr: PSockAddr; addrlen : ptOS_INT) : TSocket;external winsockdll name 'accept';
+    function accept(s:TSocket; addr: PSockAddr; var addrlen : tOS_INT) : TSocket;external winsockdll name 'accept';
+    function bind(s:TSocket; addr: PSockaddr;namelen:tOS_INT):tOS_INT; external winsockdll name 'bind';
+    function bind(s:TSocket; const addr: TSockaddr;namelen:tOS_INT):tOS_INT; external winsockdll name 'bind';
+    function closesocket(s:TSocket):tOS_INT;external winsockdll name 'closesocket';
+    function connect(s:TSocket; addr:PSockAddr; namelen:tOS_INT):tOS_INT;external winsockdll name 'connect';
+    function connect(s:TSocket; Const name:TSockAddr; namelen:tOS_INT):tOS_INT;external winsockdll name 'connect';
+    function ioctlsocket(s:TSocket; cmd:longint; var arg:u_long):tOS_INT;external winsockdll name 'ioctlsocket'; { really a c-long }
+    function ioctlsocket(s:TSocket; cmd:longint; var arg:longint):tOS_INT;external winsockdll name 'ioctlsocket'; { really a c-long }
+    function ioctlsocket(s:TSocket; cmd:longint; argp:pu_long):tOS_INT;external winsockdll name 'ioctlsocket'; { really a c-long }
+    function getpeername(s:TSocket; var name:TSockAddr;var namelen:tOS_INT):tOS_INT;
+      external winsockdll name 'getpeername';
+    function getsockname(s:TSocket; var name:TSockAddr;var namelen:tOS_INT):tOS_INT;
+      external winsockdll name 'getsockname';
+    function getsockopt(s:TSocket; level:tOS_INT; optname:tOS_INT;optval:pchar;var optlen:tOS_INT):tOS_INT;
+      external winsockdll name 'getsockopt';
+    function getsockopt(s:TSocket; level:tOS_INT; optname:tOS_INT;optval:pointer;var optlen:tOS_INT):tOS_INT;
+      external winsockdll name 'getsockopt';
+    function getsockopt(s:TSocket; level:tOS_INT; optname:tOS_INT;var optval;var optlen:tOS_INT):tOS_INT;
+      external winsockdll name 'getsockopt';
+    function htonl(hostlong:u_long):u_long;external winsockdll name 'htonl';
+    function htons(hostshort:u_short):u_short;external winsockdll name 'htons';
+    function inet_addr(cp:pchar):cardinal;external winsockdll name 'inet_addr';
+    function inet_ntoa(i : TInAddr):pchar;external winsockdll name 'inet_ntoa';
+    function listen(s:TSocket; backlog:tOS_INT):tOS_INT;external winsockdll name 'listen';
+    function ntohl(netlong:u_long):u_long;external winsockdll name 'ntohl';
+    function ntohs(netshort:u_short):u_short;external winsockdll name 'ntohs';
+    function recv(s:TSocket;buf:pchar; len:tOS_INT; flags:tOS_INT):tOS_INT;external winsockdll name 'recv';
+    function recv(s:TSocket;buf:pointer; len:tOS_INT; flags:tOS_INT):tOS_INT;external winsockdll name 'recv';
+    function recv(s:TSocket;var buf; len:tOS_INT; flags:tOS_INT):tOS_INT;external winsockdll name 'recv';
+    function recvfrom(s:TSocket;buf:pchar; len:tOS_INT; flags:tOS_INT;from:PSockAddr; fromlen:ptOS_INT):tOS_INT;
+      external winsockdll name 'recvfrom';
+    function recvfrom(s:TSocket;buf:pointer; len:tOS_INT; flags:tOS_INT;from:PSockAddr; fromlen:ptOS_INT):tOS_INT;
+      external winsockdll name 'recvfrom';
+    function recvfrom(s:TSocket;var buf; len:tOS_INT; flags:tOS_INT;Const from:TSockAddr; var fromlen:tOS_INT):tOS_INT;
+      external winsockdll name 'recvfrom';
+    function select(nfds:tOS_INT; readfds,writefds,exceptfds : PFDSet;timeout: PTimeVal):tOS_INT;
+      external winsockdll name 'select';
+    function send(s:TSocket;Const buf; len:tOS_INT; flags:tOS_INT):tOS_INT;
+      external winsockdll name 'send';
+    function send(s:TSocket; buf:pchar; len:tOS_INT; flags:tOS_INT):tOS_INT;
+      external winsockdll name 'send';
+    function send(s:TSocket;buf:pointer; len:tOS_INT; flags:tOS_INT):tOS_INT;
+      external winsockdll name 'send';
+    function sendto(s:TSocket; buf:pchar; len:tOS_INT; flags:tOS_INT;toaddr:PSockAddr; tolen:tOS_INT):tOS_INT;
+      external winsockdll name 'sendto';
+    function sendto(s:TSocket; buf:pointer; len:tOS_INT; flags:tOS_INT;toaddr:PSockAddr; tolen:tOS_INT):tOS_INT;
+      external winsockdll name 'sendto';
+    function sendto(s:TSocket; Const buf; len:tOS_INT; flags:tOS_INT;Const toaddr:TSockAddr; tolen:tOS_INT):tOS_INT;
+      external winsockdll name 'sendto';
+    function setsockopt(s:TSocket; level:tOS_INT; optname:tOS_INT; optval:pchar; optlen:tOS_INT):tOS_INT;
+      external winsockdll name 'setsockopt';
+    function setsockopt(s:TSocket; level:tOS_INT; optname:tOS_INT;optval:pointer; optlen:tOS_INT):tOS_INT;
+      external winsockdll name 'setsockopt';
+    function setsockopt(s:TSocket; level:tOS_INT; optname:tOS_INT; Const optval; optlen:tOS_INT):tOS_INT;
+      external winsockdll name 'setsockopt';
+    function shutdown(s:TSocket; how:tOS_INT):tOS_INT;
+      external winsockdll name 'shutdown';
+    function socket(af:tOS_INT; t:tOS_INT; protocol:tOS_INT):TSocket;
+      external winsockdll name 'socket';
+
+    { Database function prototypes  }
+    function gethostbyaddr(addr:pchar; len:tOS_INT; t:tOS_INT): PHostEnt;external winsockdll name 'gethostbyaddr';
+    function gethostbyname(name:pchar):PHostEnt;external winsockdll name 'gethostbyname';
+    function gethostname(name:pchar; namelen:tOS_INT):tOS_INT;external winsockdll name 'gethostname';
+    function getservbyport(port:tOS_INT; proto:pchar):PServEnt;external winsockdll name 'getservbyport';
+    function getservbyname(name:pchar; proto:pchar):PServEnt;external winsockdll name 'getservbyname';
+    function getprotobynumber(proto:tOS_INT):PProtoEnt;external winsockdll name 'getprotobynumber';
+    function getprotobyname(name:pchar):PProtoEnt;external winsockdll name 'getprotobyname';
+
+    { Microsoft Windows Extension function prototypes  }
+    function WSAStartup(wVersionRequired:word;var WSAData:TWSADATA):tOS_INT;
+      external winsockdll name 'WSAStartup';
+    function WSACleanup:tOS_INT;external winsockdll name 'WSACleanup';
+    procedure WSASetLastError(iError:tOS_INT);external winsockdll name 'WSASetLastError';
+    function WSAGetLastError:tOS_INT;external winsockdll name 'WSAGetLastError';
+    function WSAAsyncGetHostByName(hWnd:HWND; wMsg:u_int; name:pchar; buf:pchar; buflen:tOS_INT):THandle;
+      external winsockdll name 'WSAAsyncGetHostByName';
+    function WSACancelAsyncRequest(hAsyncTaskHandle:THandle):tOS_INT;
+      external winsockdll name 'WSACancelAsyncRequest';
+    function WSAAsyncSelect(s:TSocket; hWnd:HWND; wMsg:u_int; lEvent:longint):tOS_INT; { really a c-long }
+      external winsockdll name 'WSAAsyncSelect';
+    function __WSAFDIsSet(s:TSocket; var FDSet:TFDSet):Bool;
+      external winsockdll name '__WSAFDIsSet';
+
+    function WSAMakeSyncReply(Buflen,Error:Word):dword;
+    function WSAMakeSelectReply(Event,Error:Word):dword;
+    function WSAGetAsyncBuflen(Param:dword):Word;
+    function WSAGetAsyncError(Param:dword):Word;
+    function WSAGetSelectEvent(Param:dword):Word;
+    function WSAGetSelectError(Param:dword):Word;
+    procedure FD_CLR(Socket:TSocket; var FDSet:TFDSet);
+    function FD_ISSET(Socket:TSocket; var FDSet:TFDSet):Boolean;
+    procedure FD_SET(Socket:TSocket; var FDSet:TFDSet);
+    procedure FD_ZERO(var FDSet:TFDSet);
+
+//end common win32 & wince
+
+{$ifdef WIN32}
+//begin win32 only
+    function WSAIsBlocking:BOOL;external winsockdll name 'WSAIsBlocking';
+    function WSAUnhookBlockingHook:tOS_INT;external winsockdll name 'WSAUnhookBlockingHook';
+    function WSASetBlockingHook(lpBlockFunc:TFarProc):TFarProc;external winsockdll name 'WSASetBlockingHook';
+    function WSACancelBlockingCall:tOS_INT;external winsockdll name 'WSACancelBlockingCall';
+    function WSAAsyncGetServByName(hWnd:HWND; wMsg:u_int; name:pchar; proto:pchar; buf:pchar;
+                                   buflen:tOS_INT):THandle;external winsockdll name 'WSAAsyncGetServByName';
+    function WSAAsyncGetServByPort(hWnd:HWND; wMsg:u_int; port:tOS_INT; proto:pchar; buf:pchar;
+                                   buflen:tOS_INT):THandle;external winsockdll name 'WSAAsyncGetServByPort';
+    function WSAAsyncGetProtoByName(hWnd:HWND; wMsg:u_int; name:pchar; buf:pchar; buflen:tOS_INT):THandle;
+      external winsockdll name 'WSAAsyncGetProtoByName';
+    function WSAAsyncGetProtoByNumber(hWnd:HWND; wMsg:u_int; number:tOS_INT; buf:pchar; buflen:tOS_INT):THandle;
+      external winsockdll name 'WSAAsyncGetProtoByNumber';
+    function WSAAsyncGetHostByAddr(hWnd:HWND; wMsg:u_int; addr:pchar; len:tOS_INT; t:tOS_INT;
+                                   buf:pchar; buflen:tOS_INT):THandle;
+                                   external winsockdll name 'WSAAsyncGetHostByAddr';
+    function WSARecvEx(s:TSocket;var buf; len:tOS_INT; flags:ptOS_INT):tOS_INT;
+      external winsockdll name 'WSARecvEx';
+    function TransmitFile(hSocket:TSocket; hFile:THandle; nNumberOfBytesToWrite:dword;
+                          nNumberOfBytesPerSend:DWORD; lpOverlapped:POverlapped;
+                          lpTransmitBuffers:PTransmitFileBuffers; dwReserved:dword):Bool;
+                          external winsockdll name 'TransmitFile';
+    function AcceptEx(sListenSocket,sAcceptSocket:TSocket;
+                      lpOutputBuffer:Pointer; dwReceiveDataLength,dwLocalAddressLength,
+                      dwRemoteAddressLength:dword; var lpdwBytesReceived:dword;
+                      lpOverlapped:POverlapped):Bool;
+                      external winsockdll name 'AcceptEx';
+
+    procedure GetAcceptExSockaddrs(lpOutputBuffer:Pointer;
+                                   dwReceiveDataLength,dwLocalAddressLength,dwRemoteAddressLength:dword;
+                                   var LocalSockaddr:PSockAddr; var LocalSockaddrLength:tOS_INT;
+                                   var RemoteSockaddr:PSockAddr; var RemoteSockaddrLength:tOS_INT);
+                                   external winsockdll name 'GetAcceptExSockaddrs';
+//end win32 only
+{$endif WIN32}
+
+{$ifdef WINCE}
+//begin wince only
+
+//end wince only
+{$endif WINCE}
+
+  implementation
+
+
+//begin common win32 & wince
+
+    {
+      Implementation of the helper routines
+    }
+    function WSAMakeSyncReply(Buflen,Error:Word):dword;
+
+      begin
+         WSAMakeSyncReply:=MakeLong(Buflen, Error);
+      end;
+
+    function WSAMakeSelectReply(Event,Error:Word):dword;
+
+      begin
+         WSAMakeSelectReply:=MakeLong(Event,Error);
+      end;
+
+    function WSAGetAsyncBuflen(Param:dword):Word;
+
+      begin
+         WSAGetAsyncBuflen:=lo(Param);
+      end;
+
+    function WSAGetAsyncError(Param:dword):Word;
+
+      begin
+         WSAGetAsyncError:=hi(Param);
+      end;
+
+    function WSAGetSelectEvent(Param:dword):Word;
+
+      begin
+         WSAGetSelectEvent:=lo(Param);
+      end;
+
+    function WSAGetSelectError(Param:dword):Word;
+
+      begin
+         WSAGetSelectError:=hi(Param);
+      end;
+
+    procedure FD_CLR(Socket:TSocket; var FDSet:TFDSet);
+
+      var
+         i : u_int;
+
+      begin
+         i:=0;
+         while i<FDSet.fd_count do
+           begin
+              if FDSet.fd_array[i]=Socket then
+                begin
+                   while i<FDSet.fd_count-1 do
+                     begin
+                        FDSet.fd_array[i]:=FDSet.fd_array[i+1];
+                        inc(i);
+                     end;
+                   dec(FDSet.fd_count);
+                   break;
+                end;
+              inc(i);
+           end;
+      end;
+
+    function FD_ISSET(Socket:TSocket; var FDSet:TFDSet):Boolean;
+
+      begin
+         FD_ISSET:=__WSAFDIsSet(Socket,FDSet);
+      end;
+
+    procedure FD_SET(Socket:TSocket; var FDSet:TFDSet);
+
+      begin
+         if FDSet.fd_count<FD_SETSIZE then
+           begin
+              FDSet.fd_array[FDSet.fd_count]:=Socket;
+              Inc(FDSet.fd_count);
+           end;
+      end;
+
+    procedure FD_ZERO(var FDSet:TFDSet);
+
+      begin
+         FDSet.fd_count:=0;
+      end;
+
+//end common win32 & wince
+
+{$ifdef WIN32}
+//begin win32 only
+
+//end win32 only
+{$endif WIN32}
+
+{$ifdef WINCE}
+//begin wince only
+
+//end wince only
+{$endif WINCE}
+
+
+end.