- Current WIP ws2_32 that was tested on the ML, with some new changes to fully support GetNameInfoW. Tested working with over 30 applications. Uncompilable/unusable in ROS yet, only commiting for progress status.

Full changelog:

Revision: 43
Author: 
Date: 12:05:25 AM, November 9, 2005
Message:
- Update headers with my name, and fix some other typos.
----

Revision: 41
Author: 
Date: 9:13:43 PM, November 4, 2005
Message:
- Cleanup bug list to make it clearer
- Implement WSAAddressToSrringA
----


Revision: 40
Author: 
Date: 9:06:17 PM, November 4, 2005
Message:
- Fix a bug in LookupNodeByAddr
- Fix some PREfast warnings.
----

Revision: 39
Author: 
Date: 8:17:00 PM, November 4, 2005
Message:
- Get the reverse name correctly. This fixes GetNameInfoW for most usages (tracert works perfectly)
----

Revision: 38
Author: 
Date: 7:54:56 PM, November 4, 2005
Message:
- Implement LookupNodeByAddr for GetNameInfoW.
- Fix a bug in GetNameInfoW when passing a parameter to LookupNodeByAddr.
- Remove GetNameInfoW from unimplemented bug-list, since it's 99% working.
----

Revision: 37
Author: 
Date: 4:07:51 AM, November 4, 2005
Message:
- Fix a bug in GetNameInfoW: zero the port, not the address. Ping now shows the right numeric address.
----

Revision: 36
Author: 
Date: 4:05:02 AM, November 4, 2005
Message:
- Fix some bugs in previous two patches. ping now shows "0.0.0.0"
----

Revision: 35
Author: 
Date: 3:54:37 AM, November 4, 2005
Message:
- Implemented WSAAddressToStringW.
----

Revision: 34
Author: 
Date: 3:52:51 AM, November 4, 2005
Message:
- Implemented GetNameInfoW (not its helper functions! doesn't work yet!)
----

Revision: 33
Author: 
Date: 1:46:59 AM, November 4, 2005
Message:
- Implement getnameinfo (NOT GetNameInfoW, just the stub calling it)
----

Revision: 32
Author: 
Date: 9:50:05 PM, November 3, 2005
Message:
- Simply getaddrinfo to make use of ansi/unicode duplication functions already present in qshelpr.c
- Implement ConvertAddrinfoFromUnicodeToAnsi to cleanly convert ADDRINFOW to ADDRINFOA, also fixes the bug where only the first canonical name was converted.
- Remove the disabled code which actually did the work for NSPStartup and WSPStartup.
- Update buglist accordingly.
----

Revision: 30
Author: 
Date: 12:30:29 AM, November 1, 2005
Message:
- Add UNIMPLEMENTED wherever it was missing.
----

Revision: 29
Author: 
Date: 12:27:26 AM, November 1, 2005
Message:
- Implement WSANtohl, WSANtohs, WSAHtonl, WSAHtons. Opera now works.
- Fix some GetNameInfoW to return correct failure.
----

Revision: 28
Author: 
Date: 4:25:38 PM, October 30, 2005
Message:
- Implement WSAStringToAddressA/W. This makes SmartFTP work with IP lookups, but hostname lookup still fail?
----

Revision: 27
Author: 
Date: 1:23:52 PM, October 30, 2005
Message:
- Fix regressions/bugs in last patch:
  * Fix Query validation checks
  * Fix Query signature not being set anywhere
- Fix DLL_THREAD_DETACH leaking into DLL_PROCESS_DETACH due to missing break; statement.
----

Revision: 26
Author: 
Date: 1:35:21 AM, October 30, 2005
Message:
- Major refactoring of NS Query Object:
  * Remove active calls field and operations
  * Add RefCount member and provide referencing/dereferencing mechanisms
  * Implement WsNqValidateAndReference for validation and referencing
  * Add preliminary special support for providers supporting NSPIoctl
  * Rewrite most of WsNqLookupServiceNext to work with more optimized semantics and NSPIoctl support.
  * Fixed some potential locking/race issues.

- UNTESTED!
----

Revision: 25
Author: 
Date: 11:03:00 PM, October 29, 2005
Message:
- Fix WsRasLoadHelperDll:
  * Do proper check for initialization
  * Actually save the loaded DLL handle after loading the DLL, instead of failing
- Make the NS Query object initalizer set TryAgain to TRUE so that RAS Auto-Dial will function normally.
----

Revision: 24
Author: 
Date: 10:20:46 PM, October 29, 2005
Message:
- Fix regression in getxyent which made all requests get overwritten and fail.
- Re-export getaddrinfo/getnameinfo, since many XP apps have them hard-coded and removing them actually causes more problems.
----

Revision: 23
Author: 
Date: 10:08:12 PM, October 29, 2005
Message:
- Don't enter the startup lock in a loop. Fixes regressions with all apps.
- Don't export getnameinfo/getaddrinfo, since they contain bugs: this way, the apps will use their internal replacement code.
----

Revision: 22
Author: 
Date: 8:38:40 PM, October 29, 2005
Message:
- Major fixes in getxbyxx.c:
  * Allocate bigger buffer in case our estimate RNR_BUFFER_SIZE is not big enough.
  * Update and fix GUID names and usage
  * Rename some variables and reformat a bit
  * Add RAS Auto-dial call in gethostbyname
  * Use WsSockHeap instead of LocalAlloc/Free
  * Update gethostbyname to try the call again in case the first time failed, but this time without supplying a name.
----

Revision: 21
Author: 
Date: 8:11:32 PM, October 29, 2005
Message:
- Enable full debugging for now
- Fix typo in WSNoteSuccessfulHostentLookup
- Support RAS-Autodial in gethostbyname
----

Revision: 19
Author: 
Date: 5:25:18 PM, October 29, 2005
Message:
- Support RAS-Autodial restart in connect()
----

Revision: 18
Author: 
Date: 3:15:58 PM, October 29, 2005
Message:
- Implement CopyQuerySetW helper to create a copy of a Query Set by using the existing convesion functions.
- Actually implement caching in LookupServiceBegin in case of RAS Auto-dial
- Simplify LookupServiceBegin to use a goto error instead of repetitive errorcode checks.
----

Revision: 17
Author: 
Date: 3:06:22 PM, October 29, 2005
Message:
- Update NSQUERY to support restarting.
- Add RAS Auto-dial call to LookupServiceNext to support restart.
----

Revision: 16
Author: 
Date: 4:08:28 AM, October 29, 2005
Message:
- Modularize the async/startup locks better by having their init functions into their own modules.
- Use startup lock/unlock macros just like for the other locks.
----

Revision: 15
Author: 
Date: 4:01:20 AM, October 29, 2005
Message:
- Get RAS Autodial function helper pointers
- Call init/uninit during dllmain
----

Revision: 14
Author: 
Date: 1:45:36 PM, October 28, 2005
Message:
- Implement RAS Autodial Helper stubs.
----

Revision: 13
Author: 
Date: 1:33:07 PM, October 28, 2005
Message:
- Add RAS Autodial module and basic support functions.
----

Revision: 12
Author: 
Date: 1:11:38 PM, October 28, 2005
Message:
- Implement IPv4 and IPv6 Address->String helprs
- Have gethostbyaddr detect the address type and choose the right conversion function.
- Fix gethostbyaddr so that it fails if no address pointer was given or if the address type is unsupported.
- Fix bug list accordingly.
----

Revision: 11
Author: 
Date: 3:55:44 AM, October 28, 2005
Message:
- Implement MapUnicodeProtocolInfoToAnsi
- Make WSADuplicateSocketA use it.
- Fix getsockopt so that the SO_PROTOCOL_INFOA can work by having it use MapUnicodeProtocolInfoToAnsi as well in order to convert the data back.
- Update bug list accordingly.
----

Revision: 10
Author: 
Date: 3:45:09 AM, October 28, 2005
Message:
- Enhance WsTcGetEntryFromTriplet to allow for resuming from a specific ID
- Use this enhancement to add support for a special failure path in WSASocketW
- Update buglist accordingly.
----

Revision: 9
Author: 
Date: 3:36:53 AM, October 28, 2005
Message:
- lResult (old naming from old code) -> ErrorCode (new naming in rewrite)
- Update one more registry field in case it's missing, and update bug list accordingly.
----

Revision: 8
Author: 
Date: 3:28:35 AM, October 28, 2005
Message:
- Update buglist
- Add support for writing catalog data if it's not found.
----

Revision: 7
Author: 
Date: 12:49:08 AM, October 28, 2005
Message:
- Fix top-level headers
----

Revision: 6
Author: 
Date: 11:36:39 PM, October 27, 2005
Message:
- Implement WsSetupCatalogProtection
----

Revision: 5
Author: 
Date: 10:57:30 PM, October 27, 2005
Message:
- Add more error case handling for refreshing catalog data from registry.
----

Revision: 4
Author: 
Date: 9:38:39 PM, October 27, 2005
Message:
- Add more debug prints to newly implemented functions.
----

Revision: 3
Author: 
Date: 9:11:38 PM, October 27, 2005
Message:
- Only free addresses from heap if they've been allocated. Fixes non-existent heap freeing error.
----

Revision: 2
Author: 
Date: 9:08:36 PM, October 27, 2005
Message:
- Allocate space for a BLOB, not a GUID. Fixes heap corruption.
----

Revision: 1
Author: Administrator
Date: 5:53:12 PM, October 27, 2005
Message:
Initial import
----
Added: branches/alex-network-branch/reactos/lib/ws2_32/inc/
Added: branches/alex-network-branch/reactos/lib/ws2_32/inc/ws2_32.h
Added: branches/alex-network-branch/reactos/lib/ws2_32/inc/ws2_32p.h
Deleted: branches/alex-network-branch/reactos/lib/ws2_32/include/
Deleted: branches/alex-network-branch/reactos/lib/ws2_32/misc/
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/addrconv.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/addrinfo.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/async.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/bhook.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/dcatalog.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/dcatitem.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/dllmain.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/dprocess.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/dprovide.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/dsocket.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/dthread.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/dupsock.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/enumprot.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/event.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/getproto.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/getxbyxx.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/ioctl.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/nscatalo.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/nscatent.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/nspinstl.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/nsprovid.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/nsquery.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/qos.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/qshelpr.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/rasdial.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/recv.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/rnr.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/scihlpr.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/select.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/send.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/sockctrl.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/socklife.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/spinstal.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/sputil.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/startup.c
Added: branches/alex-network-branch/reactos/lib/ws2_32/src/wsautil.c
Deleted: branches/alex-network-branch/reactos/lib/ws2_32/tests/
Modified: branches/alex-network-branch/reactos/lib/ws2_32/ws2_32.def
Modified: branches/alex-network-branch/reactos/lib/ws2_32/ws2_32.rc
Deleted: branches/alex-network-branch/reactos/lib/ws2_32/ws2_32.xml
Deleted: branches/alex-network-branch/reactos/lib/ws2_32/ws2_32_specs

Added: branches/alex-network-branch/reactos/lib/ws2_32/inc/ws2_32.h
--- branches/alex-network-branch/reactos/lib/ws2_32/inc/ws2_32.h	2005-11-09 05:06:30 UTC (rev 19090)
+++ branches/alex-network-branch/reactos/lib/ws2_32/inc/ws2_32.h	2005-11-09 05:14:12 UTC (rev 19091)
@@ -0,0 +1,43 @@
+/*
+ * COPYRIGHT:   See COPYING in the top level directory
+ * PROJECT:     ReactOS WinSock 2.2 Library
+ * FILE:        lib/ws2_32.h
+ * PURPOSE:     WinSock 2.2 Main Header
+ */
+
+#ifndef __WS2_32_H
+#define __WS2_32_H
+
+/* Definitions for NDK Usage */
+#define WIN32_NO_STATUS
+#define _WIN32_WINNT 0x502
+#define NTOS_MODE_USER
+#define _CRT_SECURE_NO_DEPRECATE
+#define WINSOCK_API_LINKAGE
+#define DBG 1
+
+/* C Header */
+#include <stdio.h>
+
+/* PSDK and NDK Headers */
+#include <winsock2.h>
+#include <Ws2tcpip.h>
+#include <Ws2spi.h>
+#include <ndk/umtypes.h>
+#include <ndk/rtlfuncs.h>
+
+/* Shared NSP Headers */
+#include <nsp_dns.h>
+
+/* Winsock Helper Header */
+#include <ws2help.h>
+
+/* Missing definitions */
+#define SO_OPENTYPE                 0x7008
+#define SO_SYNCHRONOUS_NONALERT     0x20
+
+/* Internal headers */
+#include "ws2_32p.h"
+
+#endif
+

Added: branches/alex-network-branch/reactos/lib/ws2_32/inc/ws2_32p.h
--- branches/alex-network-branch/reactos/lib/ws2_32/inc/ws2_32p.h	2005-11-09 05:06:30 UTC (rev 19090)
+++ branches/alex-network-branch/reactos/lib/ws2_32/inc/ws2_32p.h	2005-11-09 05:14:12 UTC (rev 19091)
@@ -0,0 +1,891 @@
+/*
+ * COPYRIGHT:   See COPYING in the top level directory
+ * PROJECT:     ReactOS WinSock 2.2 Library
+ * FILE:        lib/ws2_32.h
+ * PURPOSE:     WinSock 2.2 Main Header
+ */
+
+#ifndef __WS2_32P_H
+#define __WS2_32P_H
+
+#define WINSOCK_ROOT "System\\CurrentControlSet\\Services\\WinSock2\\Parameters"
+#define MAXALIASES 35
+
+typedef enum _WSASYNCOPS
+{
+    WsAsyncGetHostByAddr,
+    WsAsyncGetHostByName,
+    WsAsyncGetProtoByName,
+    WsAsyncGetProtoByNumber,
+    WsAsyncGetServByName,
+    WsAsyncGetServByPort,
+    WsAsyncTerminate,
+} WSASYNCOPS;
+
+typedef struct _WSASYNCBLOCK
+{
+    LIST_ENTRY AsyncQueue;
+    HANDLE TaskHandle;
+    WSASYNCOPS Operation;
+    union
+    {
+        struct
+        {
+            HWND hWnd;
+            UINT wMsg;
+            PCHAR ByWhat;
+            DWORD Length;
+            DWORD Type;
+            PVOID Buffer;
+            DWORD BufferLength;
+        } GetHost;
+        struct
+        {
+            HWND hWnd;
+            UINT wMsg;
+            PCHAR ByWhat;
+            DWORD Length;
+            PVOID Buffer;
+            DWORD BufferLength;
+        } GetProto;
+        struct
+        {
+            HWND hWnd;
+            UINT wMsg;
+            PCHAR ByWhat;
+            DWORD Length;
+            PCHAR Protocol;
+            PVOID Buffer;
+            DWORD BufferLength;
+        } GetServ;
+    };
+} WSASYNCBLOCK, *PWSASYNCBLOCK;
+
+typedef struct _WSASYNCCONTEXT
+{
+    LIST_ENTRY AsyncQueue;
+    HANDLE AsyncEvent;
+    LIST_ENTRY SocketList;
+} WSASYNCCONTEXT, *PWSASYNCCONTEXT;
+
+typedef struct _WSPROTO_BUFFER
+{
+    PROTOENT Protoent;
+    PCHAR Aliases[MAXALIASES];
+    CHAR LineBuffer[512];
+} WSPROTO_BUFFER, *PWSPROTO_BUFFER;
+
+typedef struct _TPROVIDER
+{
+    LONG RefCount;
+    WSPPROC_TABLE;
+    HINSTANCE DllHandle;
+} TPROVIDER, *PTPROVIDER;
+
+typedef struct _TCATALOG_ENTRY
+{
+    LIST_ENTRY CatalogLink;
+    LONG RefCount;
+    PTPROVIDER Provider;
+    CHAR DllPath[MAX_PATH];
+    WSAPROTOCOL_INFOW ProtocolInfo;
+} TCATALOG_ENTRY, *PTCATALOG_ENTRY;
+
+typedef struct _TCATALOG
+{
+    LIST_ENTRY ProtocolList;
+    DWORD ItemCount;
+    DWORD UniqueId;
+    DWORD NextId;
+    HKEY CatalogKey;
+    RTL_CRITICAL_SECTION Lock;
+    BOOLEAN Initialized;
+} TCATALOG, *PTCATALOG;
+
+typedef struct _NSPROVIDER
+{
+    LONG RefCount;
+    DWORD NamespaceId;
+    HINSTANCE DllHandle;
+    GUID ProviderId;
+    NSP_ROUTINE;
+} NSPROVIDER, *PNS_PROVIDER;
+
+typedef struct _NSQUERY_PROVIDER
+{
+    LIST_ENTRY QueryLink;
+    PNS_PROVIDER Provider;
+    HANDLE LookupHandle;
+} NSQUERY_PROVIDER, *PNSQUERY_PROVIDER;
+
+typedef struct _NSCATALOG_ENTRY
+{
+    LIST_ENTRY CatalogLink;
+    LONG RefCount;
+    PNS_PROVIDER Provider;
+    LONG AddressFamily;
+    DWORD NamespaceId;
+    DWORD Version;
+    LPWSTR ProviderName;
+    BOOLEAN Enabled;
+    BOOLEAN StoresServiceClassInfo;
+    GUID ProviderId;
+    WCHAR DllPath[MAX_PATH];
+} NSCATALOG_ENTRY, *PNSCATALOG_ENTRY;
+
+typedef struct _NSCATALOG
+{
+    LIST_ENTRY CatalogList;
+    DWORD ItemCount;
+    DWORD UniqueId;
+    HKEY CatalogKey;
+    RTL_CRITICAL_SECTION Lock;
+} NSCATALOG, *PNSCATALOG;
+
+typedef struct _NSQUERY
+{
+    DWORD Signature;
+    LONG RefCount;
+    BOOLEAN ShuttingDown;
+    LIST_ENTRY ProviderList;
+    PNSQUERY_PROVIDER ActiveProvider;
+    RTL_CRITICAL_SECTION Lock;
+    PNSQUERY_PROVIDER CurrentProvider;
+    LPWSAQUERYSETW QuerySet;
+    DWORD ControlFlags;
+    PNSCATALOG Catalog;
+    DWORD TryAgain;
+} NSQUERY, *PNSQUERY;
+
+typedef struct _WSPROCESS
+{
+    LONG RefCount;
+    HANDLE ApcHelper;
+    HANDLE HandleHelper;
+    HANDLE NotificationHelper;
+    PTCATALOG ProtocolCatalog;
+    PNSCATALOG NamespaceCatalog;
+    HANDLE ProtocolCatalogEvent;
+    HANDLE NamespaceCatalogEvent;
+    DWORD Version;
+    BOOLEAN LockReady;
+    RTL_CRITICAL_SECTION ThreadLock;
+} WSPROCESS, *PWSPROCESS;
+
+typedef struct _WSTHREAD
+{
+    PWSPROCESS Process;
+    WSATHREADID WahThreadId;
+    HANDLE AsyncHelper;
+    LPWSPCANCELBLOCKINGCALL CancelBlockingCall;
+    LPBLOCKINGCALLBACK BlockingCallback;
+    FARPROC BlockingHook;
+    BOOLEAN Blocking;
+    BOOLEAN Cancelled;
+    CHAR Buffer[32];
+    PCHAR Hostent;
+    PCHAR Servent;
+    DWORD HostentSize;
+    DWORD ServentSize;
+    DWORD OpenType;
+    PVOID ProtocolInfo;
+} WSTHREAD, *PWSTHREAD;
+
+typedef struct _WSSOCKET
+{
+   LONG RefCount;
+   HANDLE Handle;
+   PWSPROCESS Process;
+   PTPROVIDER Provider;
+   PTCATALOG_ENTRY CatalogEntry;
+   BOOLEAN Overlapped;
+   BOOLEAN ApiSocket;
+   BOOLEAN IsProvider;
+} WSSOCKET, *PWSSOCKET;
+
+typedef struct _ENUM_CONTEXT
+{
+   LPWSAQUERYSETW lpqsRestrictions;
+   INT ErrorCode;
+   PNSQUERY NsQuery;
+   PNSCATALOG Catalog;
+} ENUM_CONTEXT, *PENUM_CONTEXT;
+
+typedef struct _PROTOCOL_ENUM_CONTEXT
+{
+    LPINT Protocols;
+    LPWSAPROTOCOL_INFOW ProtocolBuffer;
+    DWORD BufferLength;
+    DWORD BufferUsed;
+    DWORD Count;
+    INT ErrorCode;
+} PROTOCOL_ENUM_CONTEXT, *PPROTOCOL_ENUM_CONTEXT;
+
+typedef struct _WS_BUFFER
+{
+    ULONG_PTR Position;
+    SIZE_T MaxSize;
+    SIZE_T BytesUsed;
+} WS_BUFFER, *PWS_BUFFER;
+
+typedef BOOL
+(WINAPI *PNSCATALOG_ENUMERATE_PROC)(
+    IN PVOID Context,
+    IN PNSCATALOG_ENTRY Entry
+);
+
+typedef BOOL
+(WINAPI *PTCATALOG_ENUMERATE_PROC)(
+    IN PVOID Context,
+    IN PTCATALOG_ENTRY Entry
+);
+
+typedef BOOL
+(WINAPI *PWS_SOCK_POST_ROUTINE)(
+    IN HWND hWnd,
+    IN UINT wMsg,
+    IN WPARAM wParam,
+    IN LPARAM lParam
+);
+
+extern HINSTANCE WsDllHandle;
+extern HANDLE WsSockHeap;
+extern PWAH_HANDLE_TABLE WsSockHandleTable;
+extern DWORD TlsIndex;
+extern PWSPROCESS CurrentWsProcess;
+extern DWORD GlobalTlsIndex;
+extern BOOLEAN WsAsyncThreadInitialized;
+extern PWS_SOCK_POST_ROUTINE WsSockPostRoutine;
+
+LPSTR
+WSAAPI
+AnsiDupFromUnicode(IN LPWSTR UnicodeString);
+
+LPWSTR
+WSAAPI
+UnicodeDupFromAnsi(IN LPSTR AnsiString);
+
+VOID
+WSAAPI
+WsRasInitializeAutodial(VOID);
+
+VOID
+WSAAPI
+WsRasUninitializeAutodial(VOID);
+
+BOOL
+WSAAPI
+WSAttemptAutodialName(IN CONST LPWSAQUERYSETW lpqsRestrictions);
+
+BOOL
+WSAAPI
+WSAttemptAutodialAddr(
+    IN CONST SOCKADDR FAR *Name,
+    IN INT NameLength
+);
+
+VOID
+WSAAPI
+WSNoteSuccessfulHostentLookup(
+    IN CONST CHAR FAR *Name,
+    IN CONST ULONG Address
+);
+
+INT
+WSAAPI
+MapUnicodeProtocolInfoToAnsi(IN LPWSAPROTOCOL_INFOW UnicodeInfo,
+                             OUT LPWSAPROTOCOL_INFOA AnsiInfo);
+
+INT
+WSAAPI
+MapAnsiQuerySetToUnicode(IN LPWSAQUERYSETA AnsiSet,
+                         IN OUT PSIZE_T SetSize,
+                         OUT LPWSAQUERYSETW UnicodeSet);
+
+INT
+WSAAPI
+MapUnicodeQuerySetToAnsi(OUT LPWSAQUERYSETW UnicodeSet,
+                         IN OUT PSIZE_T SetSize,
+                         IN LPWSAQUERYSETA AnsiSet);
+
+INT
+WSAAPI
+CopyQuerySetW(IN LPWSAQUERYSETW UnicodeSet,
+              OUT LPWSAQUERYSETW *UnicodeCopy);
+
+INT
+WSAAPI
+WsSlowProlog(VOID);
+
+INT
+WSAAPI
+WsSlowPrologTid(OUT LPWSATHREADID *ThreadId);
+
+PWSSOCKET
+WSAAPI
+WsSockGetSocket(IN SOCKET Handle);
+
+INT
+WSAAPI
+WsApiProlog(OUT PWSPROCESS *Process,
+            OUT PWSTHREAD *Thread);
+
+HKEY
+WSAAPI
+WsOpenRegistryRoot(VOID);
+
+VOID
+WSAAPI
+WsCreateStartupSynchronization(VOID);
+
+VOID
+WSAAPI
+WsDestroyStartupSynchronization(VOID);
+
+INT
+WSAAPI
+WsSetupCatalogProtection(IN HKEY CatalogKey,
+                         IN HANDLE CatalogEvent,
+                         OUT LPDWORD UniqueId);
+
+BOOL
+WSAAPI
+WsCheckCatalogState(IN HANDLE Event);
+
+PNSCATALOG
+WSAAPI
+WsNcAllocate(VOID);
+
+VOID
+WSAAPI
+WsNcDelete(IN PNSCATALOG Catalog);
+
+INT
+WSAAPI
+WsNcInitializeFromRegistry(IN PNSCATALOG Catalog,
+                           IN HKEY ParentKey,
+                           IN HANDLE CatalogEvent);
+
+INT
+WSAAPI
+WsNcRefreshFromRegistry(IN PNSCATALOG Catalog,
+                        IN HANDLE CatalogEvent);
+
+VOID
+WSAAPI
+WsNcUpdateNamespaceList(IN PNSCATALOG Catalog,
+                        IN PLIST_ENTRY List);
+
+BOOL
+WSAAPI
+WsNcMatchProtocols(IN DWORD NameSpace,
+                   IN LONG AddressFamily,
+                   IN LPWSAQUERYSETW QuerySet);
+
+INT
+WSAAPI
+WsNcLoadProvider(IN PNSCATALOG Catalog,
+                 IN PNSCATALOG_ENTRY CatalogEntry);
+
+INT
+WSAAPI
+WsNcGetCatalogFromProviderId(IN PNSCATALOG Catalog,
+                             IN LPGUID ProviderId,
+                             OUT PNSCATALOG_ENTRY *CatalogEntry);
+
+VOID
+WSAAPI
+WsNcEnumerateCatalogItems(IN PNSCATALOG Catalog,
+                          IN PNSCATALOG_ENUMERATE_PROC Callback,
+                          IN PVOID Context);
+
+INT
+WSAAPI
+WsNcGetServiceClassInfo(IN PNSCATALOG Catalog,
+                        IN OUT LPDWORD BugSize,
+                        IN OUT LPWSASERVICECLASSINFOW lpServiceClassInfo);
+
+PNSCATALOG_ENTRY
+WSAAPI
+WsNcEntryAllocate(VOID);
+
+INT
+WSAAPI
+WsNcEntryInitializeFromRegistry(IN PNSCATALOG_ENTRY CatalogEntry,
+                                IN HKEY ParentKey,
+                                IN ULONG UniqueId);
+
+VOID
+WSAAPI
+WsNcEntryDereference(IN PNSCATALOG_ENTRY CatalogEntry);
+
+VOID
+WSAAPI
+WsNcEntrySetProvider(IN PNSCATALOG_ENTRY Entry,
+                     IN PNS_PROVIDER Provider);
+
+DWORD
+WSAAPI
+WsNqAddProvider(
+    IN PNSQUERY NsQuery,
+    IN PNS_PROVIDER Provider
+);
+
+PNSQUERY
+WSAAPI
+WsNqAllocate(VOID);
+
+BOOL
+WSAAPI
+WsNqBeginEnumerationProc(
+    PVOID Context,
+    PNSCATALOG_ENTRY CatalogEntry
+);
+
+VOID
+WSAAPI
+WsNqDelete(IN PNSQUERY NsQuery);
+
+DWORD
+WSAAPI
+WsNqInitialize(IN PNSQUERY NsQuery);
+
+DWORD
+WSAAPI
+WsNqLookupServiceBegin(
+    IN PNSQUERY NsQuery,
+    IN LPWSAQUERYSETW QuerySet,
+    IN DWORD ControlFlags,
+    IN PNSCATALOG Catalog
+);
+
+DWORD
+WSAAPI
+WsNqLookupServiceEnd(IN PNSQUERY NsQuery);
+
+DWORD
+WSAAPI
+WsNqLookupServiceNext(
+    PNSQUERY NsQuery,
+    DWORD,
+    PDWORD,
+    OUT LPWSAQUERYSETW QuerySet
+);
+
+PNSQUERY_PROVIDER
+WSAAPI
+WsNqNextProvider(
+    PNSQUERY NsQuery,
+    IN PNSQUERY_PROVIDER Provider
+);
+
+VOID
+WSAAPI
+WsNqDereference(IN PNSQUERY Query);
+
+BOOL
+WSAAPI
+WsNqValidateAndReference(IN PNSQUERY Query);
+
+PNSQUERY_PROVIDER
+WSAAPI
+WsNqPreviousProvider(IN PNSQUERY Query,
+                     IN PNSQUERY_PROVIDER Provider);
+
+DWORD
+WSAAPI
+WsNqProvLookupServiceNext(
+    IN PNSQUERY_PROVIDER QueryProvider,
+    DWORD,
+    PDWORD ,
+    LPWSAQUERYSETW QuerySet
+);
+
+DWORD
+WSAAPI
+WsNqProvLookupServiceEnd(IN PNSQUERY_PROVIDER QueryProvider);
+
+DWORD
+WSAAPI
+WsNqProvInitialize(
+    IN PNSQUERY_PROVIDER QueryProvider,
+    IN PNS_PROVIDER Provider
+);
+
+PNSQUERY_PROVIDER
+WSAAPI
+WsNqProvAllocate(VOID);
+
+VOID
+WSAAPI
+WsNqProvDelete(IN PNSQUERY_PROVIDER QueryProvider);
+
+DWORD
+WSAAPI
+WsNqProvLookupServiceBegin(
+    IN PNSQUERY_PROVIDER QueryProvider,
+    IN LPWSAQUERYSETW QuerySet,
+    IN LPWSASERVICECLASSINFOW ServiceClassInfo,
+    IN DWORD 
+);
+
+VOID
+WSAAPI
+WsNpDelete(IN PNS_PROVIDER Provider);
+
+DWORD
+WSAAPI
+WsNpLookupServiceBegin (
+    IN PNS_PROVIDER Provider,
+    IN LPWSAQUERYSETW Restrictions,
+    struct _WSAServiceClassInfoW *,
+    IN DWORD ControlFlags,
+    OUT PHANDLE LookupHandle
+);
+
+DWORD
+WSAAPI
+WsNpNSPCleanup(IN PNS_PROVIDER Provider);
+
+DWORD
+WSAAPI
+WsNpLookupServiceEnd(
+    IN PNS_PROVIDER Provider,
+    IN HANDLE LookupHandle
+);
+
+DWORD
+WSAAPI
+WsNpInitialize(
+    IN PNS_PROVIDER Provider,
+    IN LPWSTR DllPath,
+    IN LPGUID ProviderGuid
+);
+
+PNS_PROVIDER
+WSAAPI
+WsNpAllocate(VOID);
+
+VOID
+WSAAPI
+WsNpDereference(IN PNS_PROVIDER Provider);
+
+DWORD
+WSAAPI
+WsNpLookupServiceNext(
+    IN PNS_PROVIDER Provider,
+    IN HANDLE LookupHandle,
+    IN DWORD ControlFlags,
+    OUT PDWORD BufferLength,
+    OUT LPWSAQUERYSETW Results
+);
+
+VOID
+WSAAPI
+WsTpDelete(IN PTPROVIDER Provider);
+
+DWORD
+WSAAPI
+WsTpWSPCleanup(
+    IN PTPROVIDER Provider,
+    int *
+);
+
+PTPROVIDER
+WSAAPI
+WsTpAllocate(VOID);
+
+DWORD
+WSAAPI
+WsTpInitialize(
+    IN PTPROVIDER Provider,
+    IN LPSTR DllName,
+    LPWSAPROTOCOL_INFOW ProtocolInfo
+);
+
+VOID
+WSAAPI
+WsTpDereference(IN PTPROVIDER Provider);
+
+VOID
+WSAAPI
+WsThreadDelete(IN PWSTHREAD Thread);
+
+VOID
+WSAAPI
+WsThreadDestroyCurrentThread(VOID);
+
+DWORD
+WSAAPI
+WsThreadCreate(
+    IN PWSPROCESS Process,
+    IN PWSTHREAD *Thread
+);
+
+DWORD
+WSAAPI
+WsThreadGetCurrentThread(
+    IN PWSPROCESS Process,
+    IN PWSTHREAD *Thread
+);
+
+LPWSATHREADID
+WSAAPI
+WsThreadGetThreadId(IN PWSPROCESS Process);
+
+DWORD
+WSAAPI
+WsThreadStartup(VOID);
+
+VOID
+WSAAPI
+WsThreadCleanup(VOID);
+
+DWORD
+WSAAPI
+WsThreadCancelBlockingCall(IN PWSTHREAD Thread);
+
+DWORD
+WSAAPI
+WsThreadUnhookBlockingHook(IN PWSTHREAD Thread);
+
+FARPROC
+WSAAPI
+WsThreadSetBlockingHook(IN PWSTHREAD Thread,
+                        IN FARPROC BlockingHook);
+
+
+PHOSTENT
+WSAAPI
+WsThreadBlobToHostent(IN PWSTHREAD Thread,
+                      IN LPBLOB Blob);
+
+PSERVENT
+WSAAPI
+WsThreadBlobToServent(IN PWSTHREAD Thread,
+                      IN LPBLOB Blob);
+
+PWSPROTO_BUFFER
+WSAAPI
+WsThreadGetProtoBuffer(IN PWSTHREAD Thread);
+
+PWSTHREAD
+WSAAPI
+WsThreadAllocate(VOID);
+
+DWORD
+WSAAPI
+WsThreadDefaultBlockingHook(VOID);
+
+DWORD
+WSAAPI
+WsThreadInitialize(
+    IN PWSTHREAD Thread,
+    IN PWSPROCESS Process
+);
+
+DWORD
+WSAAPI
+WsTcFindIfsProviderForSocket(IN PTCATALOG TCatalog, SOCKET Socket);
+
+DWORD
+WSAAPI
+WsTcEntryInitializeFromRegistry(IN PTCATALOG_ENTRY CatalogEntry, IN HKEY, unsigned long);
+
+DWORD
+WSAAPI
+WsTcGetEntryFromAf(IN PTCATALOG TCatalog, IN INT AddressFamily, IN PTCATALOG_ENTRY *CatalogEntry);
+
+PTCATALOG_ENTRY
+WSAAPI
+WsTcEntryAllocate(VOID);
+
+VOID
+WSAAPI
+WsTcEntrySetProvider(IN PTCATALOG_ENTRY CatalogEntry, IN PTPROVIDER Provider);
+
+DWORD
+WSAAPI
+WsTcRefreshFromRegistry(IN PTCATALOG TCatalog, PVOID);
+
+BOOL
+WSAAPI
+WsTcOpen(IN PTCATALOG TCatalog, IN HKEY);
+
+PTPROVIDER
+WSAAPI
+WsTcFindProvider(IN PTCATALOG TCatalog, IN LPGUID ProviderId);
+
+VOID
+WSAAPI
+WsTcEnumerateCatalogItems(IN PTCATALOG Catalog,
+                          IN PTCATALOG_ENUMERATE_PROC Callback,
+                          IN PVOID Context);
+
+VOID
+WSAAPI
+WsTcEntryDereference(IN PTCATALOG_ENTRY CatalogEntry);
+
+PTCATALOG
+WSAAPI
+WsTcAllocate(VOID);
+
+VOID
+WSAAPI
+WsTcDelete(IN PTCATALOG Catalog);
+
+DWORD
+WSAAPI
+WsTcGetEntryFromTriplet(IN PTCATALOG TCatalog, IN INT AddressFamily, IN INT SocketType, IN INT Protocol, IN DWORD StartId, IN PTCATALOG_ENTRY *CatalogEntry);
+
+VOID
+WSAAPI
+WsTcUpdateProtocolList(IN PTCATALOG TCatalog, PLIST_ENTRY ProtocolList);
+
+VOID
+WSAAPI
+WsTcEntryDelete(IN PTCATALOG_ENTRY CatalogEntry);
+
+DWORD
+WSAAPI
+WsTcGetEntryFromCatalogEntryId(IN PTCATALOG TCatalog, IN DWORD CatalogEntryId, IN PTCATALOG_ENTRY *CatalogEntry);
+
+DWORD
+WSAAPI
+WsTcLoadProvider(IN PTCATALOG TCatalog, IN PTCATALOG_ENTRY CatalogEntry);
+
+DWORD
+WSAAPI
+WsTcInitializeFromRegistry(IN PTCATALOG TCatalog, HKEY, PVOID);
+
+INT
+WSAAPI
+WsSockStartup(VOID);
+
+VOID
+WSAAPI
+WsSockCleanup(VOID);
+
+BOOL
+WSAAPI
+WsSockDeleteSockets(IN LPVOID Context,
+                    IN PWAH_HANDLE Handle);
+
+VOID
+WSAAPI
+WsSockDereference(IN PWSSOCKET Socket);
+
+PWSSOCKET
+WSAAPI
+WsSockAllocate(VOID);
+
+INT
+WSAAPI
+WsSockInitialize(IN PWSSOCKET Socket,
+                 IN PTCATALOG_ENTRY CatalogEntry);
+
+INT
+WSAAPI
+WsSockAssociateHandle(IN PWSSOCKET Socket,
+                      IN SOCKET Handle,
+                      IN BOOLEAN IsProvider);
+
+INT
+WSAAPI
+WsSockDisassociateHandle(IN PWSSOCKET Socket);
+
+INT
+WSAAPI
+WsSockAddApiReference(IN SOCKET Handle);
+
+PTCATALOG
+WSAAPI
+WsProcGetTCatalog(IN PWSPROCESS Process);
+
+BOOL
+WSAAPI
+WsProcDetachSocket(IN PWSPROCESS Process,
+                   IN PWAH_HANDLE Handle);
+
+INT
+WSAAPI
+WsProcGetAsyncHelper(IN PWSPROCESS Process,
+                     OUT PHANDLE Handle);
+
+VOID
+WSAAPI
+WsProcDelete(IN PWSPROCESS Process);
+
+INT
+WSAAPI
+WsProcStartup(VOID);
+
+PNSCATALOG
+WSAAPI
+WsProcGetNsCatalog(IN PWSPROCESS Process);
+
+VOID
+WSAAPI
+WsProcSetVersion(IN PWSPROCESS Process,
+                 IN WORD VersionRequested);
+
+VOID
+WSAAPI
+WsAsyncQueueRequest(IN PWSASYNCBLOCK AsyncBlock);
+
+BOOL
+WSAAPI
+WsAsyncCheckAndInitThread(VOID);
+
+INT
+WSAAPI
+WsAsyncCancelRequest(IN HANDLE TaskHandle);
+
+PWSASYNCBLOCK
+WSAAPI
+WsAsyncAllocateBlock(IN SIZE_T ExtraLength);
+
+VOID
+WSAAPI
+WsAsyncTerminateThread(VOID);
+
+VOID
+WSAAPI
+WsAsyncGlobalTerminate(VOID);
+
+VOID
+WSAAPI
+WsAsyncGlobalInitialize(VOID);
+
+PWSPROCESS
+STATIC __inline
+WsGetProcess()
+{
+    return CurrentWsProcess;
+}
+
+DWORD
+STATIC __inline
+WsQuickProlog()
+{
+    /* Try to see if we're initialized. If not, do the full prolog */
+    return WsGetProcess() ? ERROR_SUCCESS : WsSlowProlog();
+}
+
+DWORD
+STATIC __inline
+WsQuickPrologTid(LPWSATHREADID *Tid)
+{
+    /* Try to see if we're initialized. If not, do the full prolog */
+    if ((WsGetProcess()) && (*Tid = WsThreadGetThreadId(WsGetProcess())))
+    {
+        return ERROR_SUCCESS;
+    }
+    else
+    {
+        return WsSlowPrologTid(Tid);
+    }
+}
+
+#endif
+

Added: branches/alex-network-branch/reactos/lib/ws2_32/src/addrconv.c
--- branches/alex-network-branch/reactos/lib/ws2_32/src/addrconv.c	2005-11-09 05:06:30 UTC (rev 19090)
+++ branches/alex-network-branch/reactos/lib/ws2_32/src/addrconv.c	2005-11-09 05:14:12 UTC (rev 19091)
@@ -0,0 +1,491 @@
+/*
+ * COPYRIGHT:   See COPYING in the top level directory
+ * PROJECT:     ReactOS WinSock 2 API
+ * FILE:        addrconv.c
+ * PURPOSE:     Address and Port Conversion Support
+ * PROGRAMMER:  Alex Ionescu (alex@relsoft.net)
+ */
+
+/* INCLUDES ******************************************************************/
+#include "ws2_32.h"
+
+//#define NDEBUG
+#include <debug.h>
+     
+/* DEFINES *******************************************************************/
+
+#ifndef BE
+
+/* DWORD network to host byte order conversion for little endian machines */
+#define DN2H(dw) \
+  ((((dw) & 0xFF000000L) >> 24) | \
+   (((dw) & 0x00FF0000L) >> 8) | \
+     (((dw) & 0x0000FF00L) << 8) | \
+     (((dw) & 0x000000FFL) << 24))
+
+/* DWORD host to network byte order conversion for little endian machines */
+#define DH2N(dw) \
+    ((((dw) & 0xFF000000L) >> 24) | \
+     (((dw) & 0x00FF0000L) >> 8) | \
+     (((dw) & 0x0000FF00L) << 8) | \
+     (((dw) & 0x000000FFL) << 24))
+
+/* WORD network to host order conversion for little endian machines */
+#define WN2H(w) \
+    ((((w) & 0xFF00) >> 8) | \
+     (((w) & 0x00FF) << 8))
+
+/* WORD host to network byte order conversion for little endian machines */
+#define WH2N(w) \
+    ((((w) & 0xFF00) >> 8) | \
+     (((w) & 0x00FF) << 8))
+
+#else /* BE */
+
+/* DWORD network to host byte order conversion for big endian machines */
+#define DN2H(dw) \
+    (dw)
+
+/* DWORD host to network byte order conversion big endian machines */
+#define DH2N(dw) \
+    (dw)
[truncated at 1000 lines; 13801 more skipped]