Changelog:
MSAFD: Add PCH support, PSDK fixes
MISC: Fix everything to build with PSDK changes
PSDK Fixes:
w32api/include/ssdl.h - reimplement based on Wine header which was more correct
w32api/include/ntsecapi.h - Remove duplicate structures and add typedef
w32api/include/winnt.h - add constant and missing structure
w32api/include/winioctl.h - add missing IOCTL code
w32api/include/winbase.h - add missing function declariation
w32api/include/aclui.h - remove duplicate structure
Modified: trunk/reactos/lib/aclui/precomp.h
Modified: trunk/reactos/lib/advapi32/advapi32.h
Modified: trunk/reactos/lib/msafd/include/helpers.h
Deleted: trunk/reactos/lib/msafd/include/msafd.h
Modified: trunk/reactos/lib/msafd/misc/dllmain.c
Modified: trunk/reactos/lib/msafd/misc/event.c
Modified: trunk/reactos/lib/msafd/misc/helpers.c
Modified: trunk/reactos/lib/msafd/misc/sndrcv.c
Modified: trunk/reactos/lib/msafd/misc/stubs.c
Added: trunk/reactos/lib/msafd/msafd.h
Modified: trunk/reactos/lib/msafd/msafd.xml
Modified: trunk/reactos/lib/netapi32/wksta.c
Modified: trunk/reactos/lib/secur32/lsa.c
Modified: trunk/reactos/lib/snmpapi/snmpapi.c
Modified: trunk/reactos/lib/ws2_32/include/ws2_32.h
Modified: trunk/reactos/lib/ws2help/ws2help.c
Modified: trunk/reactos/lib/ws2help/ws2help.h
Modified: trunk/reactos/lib/wshirda/wshirda.c
Modified: trunk/reactos/lib/wshirda/wshirda.h
Modified: trunk/reactos/subsys/system/lsass/lsass.c
Modified: trunk/reactos/subsys/system/winlogon/setup.c
Modified: trunk/reactos/subsys/system/winlogon/winlogon.h
Modified: trunk/reactos/w32api/include/aclui.h
Modified: trunk/reactos/w32api/include/ntsecapi.h
Modified: trunk/reactos/w32api/include/sddl.h
Modified: trunk/reactos/w32api/include/winbase.h
Modified: trunk/reactos/w32api/include/winioctl.h
Modified: trunk/reactos/w32api/include/winnt.h

Modified: trunk/reactos/lib/aclui/precomp.h
--- trunk/reactos/lib/aclui/precomp.h	2005-08-15 01:41:24 UTC (rev 17393)
+++ trunk/reactos/lib/aclui/precomp.h	2005-08-15 02:24:48 UTC (rev 17394)
@@ -4,6 +4,7 @@
 #include <prsht.h>
 #include <aclui.h>
 #include <sddl.h>
+#include <winternl.h>
 #include <ntsecapi.h>
 #if SUPPORT_UXTHEME
 #include <uxtheme.h>

Modified: trunk/reactos/lib/advapi32/advapi32.h
--- trunk/reactos/lib/advapi32/advapi32.h	2005-08-15 01:41:24 UTC (rev 17393)
+++ trunk/reactos/lib/advapi32/advapi32.h	2005-08-15 02:24:48 UTC (rev 17394)
@@ -13,11 +13,13 @@
 
 /* PSDK/NDK Headers */
 #include <windows.h>
-#include <ntsecapi.h>
 #include <accctrl.h>
 #define NTOS_MODE_USER
 #include <ndk/ntndk.h>
 
+/* this has to go after the NDK when being used with the NDK */
+#include <ntsecapi.h>
+
 #ifndef HAS_FN_PROGRESSW
 #define FN_PROGRESSW FN_PROGRESS
 #endif

Modified: trunk/reactos/lib/msafd/include/helpers.h
--- trunk/reactos/lib/msafd/include/helpers.h	2005-08-15 01:41:24 UTC (rev 17393)
+++ trunk/reactos/lib/msafd/include/helpers.h	2005-08-15 02:24:48 UTC (rev 17394)
@@ -7,7 +7,7 @@
 #ifndef __HELPERS_H
 #define __HELPERS_H
 
-#include <msafd.h>
+//#include <msafd.h>
 
 typedef struct _HELPER_DATA {
     LIST_ENTRY						Helpers;

Deleted: trunk/reactos/lib/msafd/include/msafd.h
--- trunk/reactos/lib/msafd/include/msafd.h	2005-08-15 01:41:24 UTC (rev 17393)
+++ trunk/reactos/lib/msafd/include/msafd.h	2005-08-15 02:24:48 UTC (rev 17394)
@@ -1,472 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS Ancillary Function Driver DLL
- * FILE:        include/msafd.h
- * PURPOSE:     Ancillary Function Driver DLL header
- */
-#ifndef __MSAFD_H
-#define __MSAFD_H
-
-#include <roscfg.h>
-#include <stdlib.h>
-#include <windows.h>
-#include <wsahelp.h>
-#include <winsock2.h>
-#include <ws2spi.h>
-#include <ddk/tdi.h>
-#include <afd/shared.h>
-#include <helpers.h>
-#define NTOS_MODE_USER
-#include <ndk/ntndk.h>
-#include <debug.h>
-
-extern HANDLE GlobalHeap;
-extern WSPUPCALLTABLE Upcalls;
-extern LPWPUCOMPLETEOVERLAPPEDREQUEST lpWPUCompleteOverlappedRequest;
-extern LIST_ENTRY SockHelpersListHead;
-extern HANDLE SockEvent;
-extern HANDLE SockAsyncCompletionPort;
-extern BOOLEAN SockAsyncSelectCalled;
-
-typedef enum _SOCKET_STATE {
-    SocketOpen,
-    SocketBound,
-    SocketBoundUdp,
-    SocketConnected,
-    SocketClosed
-} SOCKET_STATE, *PSOCKET_STATE;
-
-typedef struct _SOCK_SHARED_INFO {
-    SOCKET_STATE				State;
-    INT							AddressFamily;
-    INT							SocketType;
-    INT							Protocol;
-    INT							SizeOfLocalAddress;
-    INT							SizeOfRemoteAddress;
-    struct linger				LingerData;
-    ULONG						SendTimeout;
-    ULONG						RecvTimeout;
-    ULONG						SizeOfRecvBuffer;
-    ULONG						SizeOfSendBuffer;
-    struct {
-        BOOLEAN					Listening:1;
-        BOOLEAN					Broadcast:1;
-        BOOLEAN					Debug:1;
-        BOOLEAN					OobInline:1;
-        BOOLEAN					ReuseAddresses:1;
-        BOOLEAN					ExclusiveAddressUse:1;
-        BOOLEAN					NonBlocking:1;
-        BOOLEAN					DontUseWildcard:1;
-        BOOLEAN					ReceiveShutdown:1;
-        BOOLEAN					SendShutdown:1;
-        BOOLEAN					UseDelayedAcceptance:1;
-		BOOLEAN					UseSAN:1;
-    }; // Flags
-    DWORD						CreateFlags;
-    DWORD						CatalogEntryId;
-    DWORD						ServiceFlags1;
-    DWORD						ProviderFlags;
-    GROUP						GroupID;
-    DWORD						GroupType;
-    INT							GroupPriority;
-    INT							SocketLastError;
-    HWND						hWnd;
-    LONG						Unknown;
-    DWORD						SequenceNumber;
-    UINT						wMsg;
-    LONG						AsyncEvents;
-    LONG						AsyncDisabledEvents;
-} SOCK_SHARED_INFO, *PSOCK_SHARED_INFO;
-
-typedef struct _SOCKET_INFORMATION {
-	ULONG RefCount;
-	SOCKET Handle;
-	SOCK_SHARED_INFO SharedData;
-	DWORD HelperEvents;
-	PHELPER_DATA HelperData;
-	PVOID HelperContext;
-	PSOCKADDR LocalAddress;
-	PSOCKADDR RemoteAddress;
-	HANDLE TdiAddressHandle;
-	HANDLE TdiConnectionHandle;
-	PVOID AsyncData;
-	HANDLE EventObject;
-	LONG NetworkEvents;
-	CRITICAL_SECTION Lock;
-	PVOID SanData;
-	BOOL TrySAN;
-	SOCKADDR WSLocalAddress;
-	SOCKADDR WSRemoteAddress;
-} SOCKET_INFORMATION, *PSOCKET_INFORMATION;
-
-
-typedef struct _SOCKET_CONTEXT {
-	SOCK_SHARED_INFO SharedData;
-	ULONG SizeOfHelperData;
-	ULONG Padding;
-	SOCKADDR LocalAddress;
-	SOCKADDR RemoteAddress;
-	/* Plus Helper Data */
-} SOCKET_CONTEXT, *PSOCKET_CONTEXT;
-
-typedef struct _ASYNC_DATA {
-	PSOCKET_INFORMATION ParentSocket;
-	DWORD SequenceNumber;
-	IO_STATUS_BLOCK IoStatusBlock;
-	AFD_POLL_INFO AsyncSelectInfo;
-} ASYNC_DATA, *PASYNC_DATA;
-
-SOCKET
-WSPAPI
-WSPAccept(
-    IN      SOCKET s,
-    OUT     LPSOCKADDR addr,
-    IN OUT  LPINT addrlen,
-    IN      LPCONDITIONPROC lpfnCondition,
-    IN      DWORD dwCallbackData,
-    OUT     LPINT lpErrno);
-
-INT
-WSPAPI
-WSPAddressToString(
-    IN      LPSOCKADDR lpsaAddress,
-    IN      DWORD dwAddressLength,
-    IN      LPWSAPROTOCOL_INFOW lpProtocolInfo,
-    OUT     LPWSTR lpszAddressString,
-    IN OUT  LPDWORD lpdwAddressStringLength,
-    OUT     LPINT lpErrno);
-
-INT
-WSPAPI
-WSPAsyncSelect(
-    IN  SOCKET s, 
-    IN  HWND hWnd, 
-    IN  UINT wMsg, 
-    IN  LONG lEvent, 
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI WSPBind(
-    IN  SOCKET s,
-    IN  CONST SOCKADDR *name, 
-    IN  INT namelen, 
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WSPCancelBlockingCall(
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WSPCleanup(
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WSPCloseSocket(
-    IN	SOCKET s,
-    OUT	LPINT lpErrno);
-
-INT
-WSPAPI
-WSPConnect(
-    IN  SOCKET s,
-    IN  CONST SOCKADDR *name,
-    IN  INT namelen,
-    IN  LPWSABUF lpCallerData,
-    OUT LPWSABUF lpCalleeData,
-    IN  LPQOS lpSQOS,
-    IN  LPQOS lpGQOS,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WSPDuplicateSocket(
-    IN  SOCKET s,
-    IN  DWORD dwProcessId,
-    OUT LPWSAPROTOCOL_INFOW lpProtocolInfo,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WSPEnumNetworkEvents(
-    IN  SOCKET s, 
-    IN  WSAEVENT hEventObject, 
-    OUT LPWSANETWORKEVENTS lpNetworkEvents, 
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WSPEventSelect(
-    IN  SOCKET s,
-    IN  WSAEVENT hEventObject,
-    IN  LONG lNetworkEvents,
-    OUT LPINT lpErrno);
-
-BOOL
-WSPAPI
-WSPGetOverlappedResult(
-    IN  SOCKET s,
-    IN  LPWSAOVERLAPPED lpOverlapped,
-    OUT LPDWORD lpcbTransfer,
-    IN  BOOL fWait,
-    OUT LPDWORD lpdwFlags,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WSPGetPeerName(
-    IN      SOCKET s, 
-    OUT     LPSOCKADDR name, 
-    IN OUT  LPINT namelen, 
-    OUT     LPINT lpErrno);
-
-BOOL
-WSPAPI
-WSPGetQOSByName(
-    IN      SOCKET s, 
-    IN OUT  LPWSABUF lpQOSName, 
-    OUT     LPQOS lpQOS, 
-    OUT     LPINT lpErrno);
-
-INT
-WSPAPI
-WSPGetSockName(
-    IN      SOCKET s,
-    OUT     LPSOCKADDR name,
-    IN OUT  LPINT namelen,
-    OUT     LPINT lpErrno);
-
-INT
-WSPAPI
-WSPGetSockOpt(
-    IN      SOCKET s,
-    IN      INT level,
-    IN      INT optname,
-    OUT	    CHAR FAR* optval,
-    IN OUT  LPINT optlen,
-    OUT     LPINT lpErrno);
-
-INT
-WSPAPI
-WSPIoctl(
-    IN  SOCKET s,
-    IN  DWORD dwIoControlCode,
-    IN  LPVOID lpvInBuffer,
-    IN  DWORD cbInBuffer,
-    OUT LPVOID lpvOutBuffer,
-    IN  DWORD cbOutBuffer,
-    OUT LPDWORD lpcbBytesReturned,
-    IN  LPWSAOVERLAPPED lpOverlapped,
-    IN  LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
-    IN  LPWSATHREADID lpThreadId,
-    OUT LPINT lpErrno);
-
-SOCKET
-WSPAPI
-WSPJoinLeaf(
-    IN  SOCKET s,
-    IN  CONST SOCKADDR *name,
-    IN  INT namelen,
-    IN  LPWSABUF lpCallerData,
-    OUT LPWSABUF lpCalleeData,
-    IN  LPQOS lpSQOS,
-    IN  LPQOS lpGQOS,
-    IN  DWORD dwFlags,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WSPListen(
-    IN  SOCKET s,
-    IN  INT backlog,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WSPRecv(
-    IN      SOCKET s,
-    IN OUT  LPWSABUF lpBuffers,
-    IN      DWORD dwBufferCount,
-    OUT     LPDWORD lpNumberOfBytesRecvd,
-    IN OUT  LPDWORD lpFlags,
-    IN      LPWSAOVERLAPPED lpOverlapped,
-    IN      LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
-    IN      LPWSATHREADID lpThreadId,
-    OUT     LPINT lpErrno);
-
-INT
-WSPAPI
-WSPRecvDisconnect(
-    IN  SOCKET s,
-    OUT LPWSABUF lpInboundDisconnectData,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WSPRecvFrom(
-    IN      SOCKET s,
-    IN OUT  LPWSABUF lpBuffers,
-    IN      DWORD dwBufferCount,
-    OUT     LPDWORD lpNumberOfBytesRecvd,
-    IN OUT  LPDWORD lpFlags,
-    OUT     LPSOCKADDR lpFrom,
-    IN OUT  LPINT lpFromlen,
-    IN      LPWSAOVERLAPPED lpOverlapped,
-    IN      LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
-    IN      LPWSATHREADID lpThreadId,
-    OUT     LPINT lpErrno);
-
-INT
-WSPAPI
-WSPSelect(
-    IN      INT nfds,
-    IN OUT  LPFD_SET readfds,
-    IN OUT  LPFD_SET writefds,
-    IN OUT  LPFD_SET exceptfds,
-    IN      CONST LPTIMEVAL timeout,
-    OUT     LPINT lpErrno);
-
-INT
-WSPAPI
-WSPSend(
-    IN  SOCKET s,
-    IN  LPWSABUF lpBuffers,
-    IN  DWORD dwBufferCount,
-    OUT LPDWORD lpNumberOfBytesSent,
-    IN  DWORD dwFlags,
-    IN  LPWSAOVERLAPPED lpOverlapped,
-    IN  LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
-    IN  LPWSATHREADID lpThreadId,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WSPSendDisconnect(
-    IN  SOCKET s,
-    IN  LPWSABUF lpOutboundDisconnectData,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WSPSendTo(
-    IN  SOCKET s,
-    IN  LPWSABUF lpBuffers,
-    IN  DWORD dwBufferCount,
-    OUT LPDWORD lpNumberOfBytesSent,
-    IN  DWORD dwFlags,
-    IN  CONST SOCKADDR *lpTo,
-    IN  INT iTolen,
-    IN  LPWSAOVERLAPPED lpOverlapped,
-    IN  LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
-    IN  LPWSATHREADID lpThreadId,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WSPSetSockOpt(
-    IN  SOCKET s,
-    IN  INT level,
-    IN  INT optname,
-    IN  CONST CHAR FAR* optval,
-    IN  INT optlen,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WSPShutdown(
-    IN  SOCKET s,
-    IN  INT how,
-    OUT LPINT lpErrno);
-
-SOCKET
-WSPAPI
-WSPSocket(
-    IN  INT af,
-    IN  INT type,
-    IN  INT protocol,
-    IN  LPWSAPROTOCOL_INFOW lpProtocolInfo,
-    IN  GROUP g,
-    IN  DWORD dwFlags,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WSPStringToAddress(
-    IN      LPWSTR AddressString,
-    IN      INT AddressFamily,
-    IN      LPWSAPROTOCOL_INFOW lpProtocolInfo,
-    OUT     LPSOCKADDR lpAddress,
-    IN OUT  LPINT lpAddressLength,
-    OUT     LPINT lpErrno);
-
-
-PSOCKET_INFORMATION GetSocketStructure(
-	SOCKET Handle
-);
-
-VOID DeleteSocketStructure( SOCKET Handle );
-
-int GetSocketInformation(
-	PSOCKET_INFORMATION Socket,
-	ULONG				AfdInformationClass,
-	PULONG Ulong		OPTIONAL,
-	PLARGE_INTEGER		LargeInteger OPTIONAL
-);
-
-int SetSocketInformation(
-	PSOCKET_INFORMATION Socket,
-	ULONG				AfdInformationClass,
-	PULONG				Ulong		OPTIONAL,
-	PLARGE_INTEGER		LargeInteger OPTIONAL
-);
-
-int CreateContext(
-	PSOCKET_INFORMATION Socket
-);
-
-int SockAsyncThread(
-	PVOID ThreadParam
-);
-
-VOID 
-SockProcessAsyncSelect(
-	PSOCKET_INFORMATION Socket,
-	PASYNC_DATA AsyncData
-);
-
-VOID
-SockAsyncSelectCompletionRoutine(
-	PVOID Context,
-	PIO_STATUS_BLOCK IoStatusBlock
-);
-
-BOOLEAN
-SockCreateOrReferenceAsyncThread(
-	VOID
-);
-
-BOOLEAN SockGetAsyncSelectHelperAfdHandle(
-	VOID
-);
-
-VOID SockProcessQueuedAsyncSelect(
-	PVOID Context,
-	PIO_STATUS_BLOCK IoStatusBlock
-);
-
-VOID
-SockReenableAsyncSelectEvent (
-    IN PSOCKET_INFORMATION Socket,
-    IN ULONG Event
-    );
-    
-DWORD MsafdReturnWithErrno( NTSTATUS Status, LPINT Errno, DWORD Received,
-			    LPDWORD ReturnedBytes );
-
-typedef VOID (*PASYNC_COMPLETION_ROUTINE)(PVOID Context, PIO_STATUS_BLOCK IoStatusBlock);
-
-#endif /* __MSAFD_H */
-
-/* EOF */

Modified: trunk/reactos/lib/msafd/misc/dllmain.c
--- trunk/reactos/lib/msafd/misc/dllmain.c	2005-08-15 01:41:24 UTC (rev 17393)
+++ trunk/reactos/lib/msafd/misc/dllmain.c	2005-08-15 02:24:48 UTC (rev 17394)
@@ -10,11 +10,10 @@
  *   CSH 01/09-2000 Created
  *	 Alex 16/07/2004 - Complete Rewrite
  */
-#include <roscfg.h>
-#include <string.h>
 #include <msafd.h>
-#include <helpers.h>
 
+#include <debug.h>
+
 #ifdef DBG
 //DWORD DebugTraceLevel = DEBUG_ULTRA;
 DWORD DebugTraceLevel = 0;

Modified: trunk/reactos/lib/msafd/misc/event.c
--- trunk/reactos/lib/msafd/misc/event.c	2005-08-15 01:41:24 UTC (rev 17393)
+++ trunk/reactos/lib/msafd/misc/event.c	2005-08-15 02:24:48 UTC (rev 17394)
@@ -10,9 +10,10 @@
  *	 Alex 16/07/2004 - Complete Rewrite
  */
 
-#include <roscfg.h>
 #include <msafd.h>
 
+#include <debug.h>
+
 int 
 WSPAPI 
 WSPEventSelect(

Modified: trunk/reactos/lib/msafd/misc/helpers.c
--- trunk/reactos/lib/msafd/misc/helpers.c	2005-08-15 01:41:24 UTC (rev 17393)
+++ trunk/reactos/lib/msafd/misc/helpers.c	2005-08-15 02:24:48 UTC (rev 17394)
@@ -10,8 +10,9 @@
  *	 Alex 16/07/2004 - Complete Rewrite
  */
 #include <msafd.h>
-#include <helpers.h>
 
+#include <debug.h>
+
 CRITICAL_SECTION HelperDLLDatabaseLock;
 LIST_ENTRY HelperDLLDatabaseListHead;
 

Modified: trunk/reactos/lib/msafd/misc/sndrcv.c
--- trunk/reactos/lib/msafd/misc/sndrcv.c	2005-08-15 01:41:24 UTC (rev 17393)
+++ trunk/reactos/lib/msafd/misc/sndrcv.c	2005-08-15 02:24:48 UTC (rev 17394)
@@ -10,9 +10,8 @@
  *	 Alex 16/07/2004 - Complete Rewrite
  */
 
-#include <roscfg.h>
-#include <string.h>
 #include <msafd.h>
+
 #include <debug.h>
 
 INT

Modified: trunk/reactos/lib/msafd/misc/stubs.c
--- trunk/reactos/lib/msafd/misc/stubs.c	2005-08-15 01:41:24 UTC (rev 17393)
+++ trunk/reactos/lib/msafd/misc/stubs.c	2005-08-15 02:24:48 UTC (rev 17394)
@@ -9,6 +9,7 @@
  */
 #include <msafd.h>
 
+#include <debug.h>
 
 INT
 WSPAPI

Added: trunk/reactos/lib/msafd/msafd.h
--- trunk/reactos/lib/msafd/msafd.h	2005-08-15 01:41:24 UTC (rev 17393)
+++ trunk/reactos/lib/msafd/msafd.h	2005-08-15 02:24:48 UTC (rev 17394)
@@ -0,0 +1,474 @@
+/*
+ * COPYRIGHT:   See COPYING in the top level directory
+ * PROJECT:     ReactOS Ancillary Function Driver DLL
+ * FILE:        include/msafd.h
+ * PURPOSE:     Ancillary Function Driver DLL header
+ */
+#ifndef __MSAFD_H
+#define __MSAFD_H
+
+#include <stdio.h>
+
+#include <stdlib.h>
+#include <windows.h>
+#include <winsock2.h>
+#include <ws2spi.h>
+#define NTOS_MODE_USER
+#include <ndk/ntndk.h>
+
+/* This includes ntsecapi.h so it needs to come after the NDK */
+#include <wsahelp.h>
+#include <ddk/tdi.h>
+#include <afd/shared.h>
+#include <helpers.h>
+
+extern HANDLE GlobalHeap;
+extern WSPUPCALLTABLE Upcalls;
+extern LPWPUCOMPLETEOVERLAPPEDREQUEST lpWPUCompleteOverlappedRequest;
+extern LIST_ENTRY SockHelpersListHead;
+extern HANDLE SockEvent;
+extern HANDLE SockAsyncCompletionPort;
+extern BOOLEAN SockAsyncSelectCalled;
+
+typedef enum _SOCKET_STATE {
+    SocketOpen,
+    SocketBound,
+    SocketBoundUdp,
+    SocketConnected,
+    SocketClosed
+} SOCKET_STATE, *PSOCKET_STATE;
+
+typedef struct _SOCK_SHARED_INFO {
+    SOCKET_STATE				State;
+    INT							AddressFamily;
+    INT							SocketType;
+    INT							Protocol;
+    INT							SizeOfLocalAddress;
+    INT							SizeOfRemoteAddress;
+    struct linger				LingerData;
+    ULONG						SendTimeout;
+    ULONG						RecvTimeout;
+    ULONG						SizeOfRecvBuffer;
+    ULONG						SizeOfSendBuffer;
+    struct {
+        BOOLEAN					Listening:1;
+        BOOLEAN					Broadcast:1;
+        BOOLEAN					Debug:1;
+        BOOLEAN					OobInline:1;
+        BOOLEAN					ReuseAddresses:1;
+        BOOLEAN					ExclusiveAddressUse:1;
+        BOOLEAN					NonBlocking:1;
+        BOOLEAN					DontUseWildcard:1;
+        BOOLEAN					ReceiveShutdown:1;
+        BOOLEAN					SendShutdown:1;
+        BOOLEAN					UseDelayedAcceptance:1;
+		BOOLEAN					UseSAN:1;
+    }; // Flags
+    DWORD						CreateFlags;
+    DWORD						CatalogEntryId;
+    DWORD						ServiceFlags1;
+    DWORD						ProviderFlags;
+    GROUP						GroupID;
+    DWORD						GroupType;
+    INT							GroupPriority;
+    INT							SocketLastError;
+    HWND						hWnd;
+    LONG						Unknown;
+    DWORD						SequenceNumber;
+    UINT						wMsg;
+    LONG						AsyncEvents;
+    LONG						AsyncDisabledEvents;
+} SOCK_SHARED_INFO, *PSOCK_SHARED_INFO;
+
+typedef struct _SOCKET_INFORMATION {
+	ULONG RefCount;
+	SOCKET Handle;
+	SOCK_SHARED_INFO SharedData;
+	DWORD HelperEvents;
+	PHELPER_DATA HelperData;
+	PVOID HelperContext;
+	PSOCKADDR LocalAddress;
+	PSOCKADDR RemoteAddress;
+	HANDLE TdiAddressHandle;
+	HANDLE TdiConnectionHandle;
+	PVOID AsyncData;
+	HANDLE EventObject;
+	LONG NetworkEvents;
+	CRITICAL_SECTION Lock;
+	PVOID SanData;
+	BOOL TrySAN;
+	SOCKADDR WSLocalAddress;
+	SOCKADDR WSRemoteAddress;
+} SOCKET_INFORMATION, *PSOCKET_INFORMATION;
+
+
+typedef struct _SOCKET_CONTEXT {
+	SOCK_SHARED_INFO SharedData;
+	ULONG SizeOfHelperData;
+	ULONG Padding;
+	SOCKADDR LocalAddress;
+	SOCKADDR RemoteAddress;
+	/* Plus Helper Data */
+} SOCKET_CONTEXT, *PSOCKET_CONTEXT;
+
+typedef struct _ASYNC_DATA {
+	PSOCKET_INFORMATION ParentSocket;
+	DWORD SequenceNumber;
+	IO_STATUS_BLOCK IoStatusBlock;
+	AFD_POLL_INFO AsyncSelectInfo;
+} ASYNC_DATA, *PASYNC_DATA;
+
+SOCKET
+WSPAPI
+WSPAccept(
+    IN      SOCKET s,
+    OUT     LPSOCKADDR addr,
+    IN OUT  LPINT addrlen,
+    IN      LPCONDITIONPROC lpfnCondition,
+    IN      DWORD dwCallbackData,
+    OUT     LPINT lpErrno);
+
+INT
+WSPAPI
+WSPAddressToString(
+    IN      LPSOCKADDR lpsaAddress,
+    IN      DWORD dwAddressLength,
+    IN      LPWSAPROTOCOL_INFOW lpProtocolInfo,
+    OUT     LPWSTR lpszAddressString,
+    IN OUT  LPDWORD lpdwAddressStringLength,
+    OUT     LPINT lpErrno);
+
+INT
+WSPAPI
+WSPAsyncSelect(
+    IN  SOCKET s, 
+    IN  HWND hWnd, 
+    IN  UINT wMsg, 
+    IN  LONG lEvent, 
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI WSPBind(
+    IN  SOCKET s,
+    IN  CONST SOCKADDR *name, 
+    IN  INT namelen, 
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI
+WSPCancelBlockingCall(
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI
+WSPCleanup(
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI
+WSPCloseSocket(
+    IN	SOCKET s,
+    OUT	LPINT lpErrno);
+
+INT
+WSPAPI
+WSPConnect(
+    IN  SOCKET s,
+    IN  CONST SOCKADDR *name,
+    IN  INT namelen,
+    IN  LPWSABUF lpCallerData,
+    OUT LPWSABUF lpCalleeData,
+    IN  LPQOS lpSQOS,
+    IN  LPQOS lpGQOS,
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI
+WSPDuplicateSocket(
+    IN  SOCKET s,
+    IN  DWORD dwProcessId,
+    OUT LPWSAPROTOCOL_INFOW lpProtocolInfo,
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI
+WSPEnumNetworkEvents(
+    IN  SOCKET s, 
+    IN  WSAEVENT hEventObject, 
+    OUT LPWSANETWORKEVENTS lpNetworkEvents, 
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI
+WSPEventSelect(
+    IN  SOCKET s,
+    IN  WSAEVENT hEventObject,
+    IN  LONG lNetworkEvents,
+    OUT LPINT lpErrno);
+
+BOOL
+WSPAPI
+WSPGetOverlappedResult(
+    IN  SOCKET s,
+    IN  LPWSAOVERLAPPED lpOverlapped,
+    OUT LPDWORD lpcbTransfer,
+    IN  BOOL fWait,
+    OUT LPDWORD lpdwFlags,
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI
+WSPGetPeerName(
+    IN      SOCKET s, 
+    OUT     LPSOCKADDR name, 
+    IN OUT  LPINT namelen, 
+    OUT     LPINT lpErrno);
+
+BOOL
+WSPAPI
+WSPGetQOSByName(
+    IN      SOCKET s, 
+    IN OUT  LPWSABUF lpQOSName, 
+    OUT     LPQOS lpQOS, 
+    OUT     LPINT lpErrno);
+
+INT
+WSPAPI
+WSPGetSockName(
+    IN      SOCKET s,
+    OUT     LPSOCKADDR name,
+    IN OUT  LPINT namelen,
+    OUT     LPINT lpErrno);
+
+INT
+WSPAPI
+WSPGetSockOpt(
+    IN      SOCKET s,
+    IN      INT level,
+    IN      INT optname,
+    OUT	    CHAR FAR* optval,
+    IN OUT  LPINT optlen,
+    OUT     LPINT lpErrno);
+
+INT
+WSPAPI
+WSPIoctl(
+    IN  SOCKET s,
+    IN  DWORD dwIoControlCode,
+    IN  LPVOID lpvInBuffer,
+    IN  DWORD cbInBuffer,
+    OUT LPVOID lpvOutBuffer,
+    IN  DWORD cbOutBuffer,
+    OUT LPDWORD lpcbBytesReturned,
+    IN  LPWSAOVERLAPPED lpOverlapped,
+    IN  LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
+    IN  LPWSATHREADID lpThreadId,
+    OUT LPINT lpErrno);
+
+SOCKET
+WSPAPI
+WSPJoinLeaf(
+    IN  SOCKET s,
+    IN  CONST SOCKADDR *name,
+    IN  INT namelen,
+    IN  LPWSABUF lpCallerData,
+    OUT LPWSABUF lpCalleeData,
+    IN  LPQOS lpSQOS,
+    IN  LPQOS lpGQOS,
+    IN  DWORD dwFlags,
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI
+WSPListen(
+    IN  SOCKET s,
+    IN  INT backlog,
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI
+WSPRecv(
+    IN      SOCKET s,
+    IN OUT  LPWSABUF lpBuffers,
+    IN      DWORD dwBufferCount,
+    OUT     LPDWORD lpNumberOfBytesRecvd,
+    IN OUT  LPDWORD lpFlags,
+    IN      LPWSAOVERLAPPED lpOverlapped,
+    IN      LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
+    IN      LPWSATHREADID lpThreadId,
+    OUT     LPINT lpErrno);
+
+INT
+WSPAPI
+WSPRecvDisconnect(
+    IN  SOCKET s,
+    OUT LPWSABUF lpInboundDisconnectData,
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI
+WSPRecvFrom(
+    IN      SOCKET s,
+    IN OUT  LPWSABUF lpBuffers,
+    IN      DWORD dwBufferCount,
+    OUT     LPDWORD lpNumberOfBytesRecvd,
+    IN OUT  LPDWORD lpFlags,
+    OUT     LPSOCKADDR lpFrom,
+    IN OUT  LPINT lpFromlen,
+    IN      LPWSAOVERLAPPED lpOverlapped,
+    IN      LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
+    IN      LPWSATHREADID lpThreadId,
+    OUT     LPINT lpErrno);
+
+INT
+WSPAPI
+WSPSelect(
+    IN      INT nfds,
+    IN OUT  LPFD_SET readfds,
+    IN OUT  LPFD_SET writefds,
+    IN OUT  LPFD_SET exceptfds,
+    IN      CONST LPTIMEVAL timeout,
+    OUT     LPINT lpErrno);
+
+INT
+WSPAPI
+WSPSend(
+    IN  SOCKET s,
+    IN  LPWSABUF lpBuffers,
+    IN  DWORD dwBufferCount,
+    OUT LPDWORD lpNumberOfBytesSent,
+    IN  DWORD dwFlags,
+    IN  LPWSAOVERLAPPED lpOverlapped,
+    IN  LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
+    IN  LPWSATHREADID lpThreadId,
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI
+WSPSendDisconnect(
+    IN  SOCKET s,
+    IN  LPWSABUF lpOutboundDisconnectData,
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI
+WSPSendTo(
+    IN  SOCKET s,
+    IN  LPWSABUF lpBuffers,
+    IN  DWORD dwBufferCount,
+    OUT LPDWORD lpNumberOfBytesSent,
+    IN  DWORD dwFlags,
+    IN  CONST SOCKADDR *lpTo,
+    IN  INT iTolen,
+    IN  LPWSAOVERLAPPED lpOverlapped,
+    IN  LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
+    IN  LPWSATHREADID lpThreadId,
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI
+WSPSetSockOpt(
+    IN  SOCKET s,
+    IN  INT level,
+    IN  INT optname,
+    IN  CONST CHAR FAR* optval,
+    IN  INT optlen,
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI
+WSPShutdown(
+    IN  SOCKET s,
+    IN  INT how,
+    OUT LPINT lpErrno);
+
+SOCKET
+WSPAPI
+WSPSocket(
+    IN  INT af,
+    IN  INT type,
+    IN  INT protocol,
+    IN  LPWSAPROTOCOL_INFOW lpProtocolInfo,
+    IN  GROUP g,
+    IN  DWORD dwFlags,
+    OUT LPINT lpErrno);
+
+INT
+WSPAPI
+WSPStringToAddress(
[truncated at 1000 lines; 457 more skipped]