[WS2_32] The current ws2_32 served us well, but it's time for ws2_32_new to shine...
authorAmine Khaldi <amine.khaldi@reactos.org>
Tue, 20 Sep 2016 16:51:28 +0000 (16:51 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Tue, 20 Sep 2016 16:51:28 +0000 (16:51 +0000)
svn path=/trunk/; revision=72750

45 files changed:
reactos/dll/win32/CMakeLists.txt
reactos/dll/win32/ws2_32/CMakeLists.txt
reactos/dll/win32/ws2_32/inc/ws2_32.h [moved from reactos/dll/win32/ws2_32_new/inc/ws2_32.h with 100% similarity]
reactos/dll/win32/ws2_32/inc/ws2_32p.h [moved from reactos/dll/win32/ws2_32_new/inc/ws2_32p.h with 98% similarity]
reactos/dll/win32/ws2_32/src/addrconv.c [moved from reactos/dll/win32/ws2_32_new/src/addrconv.c with 99% similarity]
reactos/dll/win32/ws2_32/src/addrinfo.c [moved from reactos/dll/win32/ws2_32_new/src/addrinfo.c with 91% similarity]
reactos/dll/win32/ws2_32/src/async.c [moved from reactos/dll/win32/ws2_32_new/src/async.c with 100% similarity]
reactos/dll/win32/ws2_32/src/bhook.c [moved from reactos/dll/win32/ws2_32_new/src/bhook.c with 100% similarity]
reactos/dll/win32/ws2_32/src/dcatalog.c [moved from reactos/dll/win32/ws2_32_new/src/dcatalog.c with 95% similarity]
reactos/dll/win32/ws2_32/src/dcatitem.c [moved from reactos/dll/win32/ws2_32_new/src/dcatitem.c with 79% similarity]
reactos/dll/win32/ws2_32/src/dllmain.c [moved from reactos/dll/win32/ws2_32_new/src/dllmain.c with 100% similarity]
reactos/dll/win32/ws2_32/src/dprocess.c [moved from reactos/dll/win32/ws2_32_new/src/dprocess.c with 100% similarity]
reactos/dll/win32/ws2_32/src/dprovide.c [moved from reactos/dll/win32/ws2_32_new/src/dprovide.c with 65% similarity]
reactos/dll/win32/ws2_32/src/dsocket.c [moved from reactos/dll/win32/ws2_32_new/src/dsocket.c with 100% similarity]
reactos/dll/win32/ws2_32/src/dthread.c [moved from reactos/dll/win32/ws2_32_new/src/dthread.c with 100% similarity]
reactos/dll/win32/ws2_32/src/dupsock.c [moved from reactos/dll/win32/ws2_32_new/src/dupsock.c with 100% similarity]
reactos/dll/win32/ws2_32/src/enumprot.c [moved from reactos/dll/win32/ws2_32_new/src/enumprot.c with 73% similarity]
reactos/dll/win32/ws2_32/src/event.c [moved from reactos/dll/win32/ws2_32_new/src/event.c with 100% similarity]
reactos/dll/win32/ws2_32/src/getproto.c [moved from reactos/dll/win32/ws2_32_new/src/getproto.c with 86% similarity]
reactos/dll/win32/ws2_32/src/getxbyxx.c [moved from reactos/dll/win32/ws2_32_new/src/getxbyxx.c with 96% similarity]
reactos/dll/win32/ws2_32/src/ioctl.c [moved from reactos/dll/win32/ws2_32_new/src/ioctl.c with 100% similarity]
reactos/dll/win32/ws2_32/src/nscatalo.c [moved from reactos/dll/win32/ws2_32_new/src/nscatalo.c with 94% similarity]
reactos/dll/win32/ws2_32/src/nscatent.c [new file with mode: 0644]
reactos/dll/win32/ws2_32/src/nspinstl.c [moved from reactos/dll/win32/ws2_32_new/src/nspinstl.c with 100% similarity]
reactos/dll/win32/ws2_32/src/nsprovid.c [moved from reactos/dll/win32/ws2_32_new/src/nsprovid.c with 100% similarity]
reactos/dll/win32/ws2_32/src/nsquery.c [moved from reactos/dll/win32/ws2_32_new/src/nsquery.c with 99% similarity]
reactos/dll/win32/ws2_32/src/qos.c [moved from reactos/dll/win32/ws2_32_new/src/qos.c with 100% similarity]
reactos/dll/win32/ws2_32/src/qshelpr.c [moved from reactos/dll/win32/ws2_32_new/src/qshelpr.c with 100% similarity]
reactos/dll/win32/ws2_32/src/rasdial.c [moved from reactos/dll/win32/ws2_32_new/src/rasdial.c with 100% similarity]
reactos/dll/win32/ws2_32/src/recv.c [moved from reactos/dll/win32/ws2_32_new/src/recv.c with 100% similarity]
reactos/dll/win32/ws2_32/src/rnr.c [moved from reactos/dll/win32/ws2_32_new/src/rnr.c with 81% similarity]
reactos/dll/win32/ws2_32/src/scihlpr.c [moved from reactos/dll/win32/ws2_32_new/src/scihlpr.c with 100% similarity]
reactos/dll/win32/ws2_32/src/select.c [moved from reactos/dll/win32/ws2_32_new/src/select.c with 100% similarity]
reactos/dll/win32/ws2_32/src/send.c [moved from reactos/dll/win32/ws2_32_new/src/send.c with 99% similarity]
reactos/dll/win32/ws2_32/src/sockctrl.c [moved from reactos/dll/win32/ws2_32_new/src/sockctrl.c with 99% similarity]
reactos/dll/win32/ws2_32/src/socklife.c [moved from reactos/dll/win32/ws2_32_new/src/socklife.c with 97% similarity]
reactos/dll/win32/ws2_32/src/spinstal.c [moved from reactos/dll/win32/ws2_32_new/src/spinstal.c with 100% similarity]
reactos/dll/win32/ws2_32/src/sputil.c [moved from reactos/dll/win32/ws2_32_new/src/sputil.c with 100% similarity]
reactos/dll/win32/ws2_32/src/startup.c [moved from reactos/dll/win32/ws2_32_new/src/startup.c with 85% similarity]
reactos/dll/win32/ws2_32/src/wsautil.c [moved from reactos/dll/win32/ws2_32_new/src/wsautil.c with 100% similarity]
reactos/dll/win32/ws2_32/ws2_32.spec
reactos/dll/win32/ws2_32_new/CMakeLists.txt [deleted file]
reactos/dll/win32/ws2_32_new/src/nscatent.c [deleted file]
reactos/dll/win32/ws2_32_new/ws2_32.rc [deleted file]
reactos/dll/win32/ws2_32_new/ws2_32.spec [deleted file]

index 1dc7f51..307ad89 100644 (file)
@@ -247,7 +247,6 @@ add_subdirectory(wmi)
 add_subdirectory(wmiutils)
 add_subdirectory(wmvcore)
 add_subdirectory(ws2_32)
-add_subdirectory(ws2_32_new)
 add_subdirectory(ws2help)
 add_subdirectory(wshirda)
 add_subdirectory(wshom.ocx)
index d306479..476ed6d 100644 (file)
@@ -1,32 +1,57 @@
 
 add_definitions(-DLE)
-add_definitions(-DWINSOCK_API_LINKAGE=DECLSPEC_EXPORT)
-include_directories(BEFORE include)
-include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
 spec2def(ws2_32.dll ws2_32.spec ADD_IMPORTLIB)
 
+include_directories(
+    inc
+    ${REACTOS_SOURCE_DIR}/sdk/include/reactos/winsock)
+
 list(APPEND SOURCE
-    misc/bsd.c
-    misc/catalog.c
-    misc/dllmain.c
-    misc/event.c
-    misc/handle.c
-    misc/ns.c
-    misc/sndrcv.c
-    misc/stubs.c
-    misc/upcall.c
-    include/ws2_32.h)
+    src/addrconv.c
+    src/addrinfo.c
+    src/async.c
+    src/bhook.c
+    src/dcatalog.c
+    src/dcatitem.c
+    src/dllmain.c
+    src/dprocess.c
+    src/dprovide.c
+    src/dsocket.c
+    src/dthread.c
+    src/dupsock.c
+    src/enumprot.c
+    src/event.c
+    src/getproto.c
+    src/getxbyxx.c
+    src/ioctl.c
+    src/nscatalo.c
+    src/nscatent.c
+    src/nspinstl.c
+    src/nsprovid.c
+    src/nsquery.c
+    src/qos.c
+    src/qshelpr.c
+    src/rasdial.c
+    src/recv.c
+    src/rnr.c
+    #src/scihlpr.c
+    src/select.c
+    src/send.c
+    src/sockctrl.c
+    src/socklife.c
+    src/spinstal.c
+    src/sputil.c
+    src/startup.c
+    src/wsautil.c
+    inc/ws2_32.h)
 
 add_library(ws2_32 SHARED
     ${SOURCE}
-    wine/async.c
-    wine/socket.c
     ws2_32.rc
     ${CMAKE_CURRENT_BINARY_DIR}/ws2_32.def)
 
-set_module_type(ws2_32 win32dll UNICODE)
-target_link_libraries(ws2_32 wine ${PSEH_LIB})
-add_delay_importlibs(ws2_32 user32)
-add_importlibs(ws2_32 advapi32 dnsapi ws2help msvcrt kernel32 ntdll)
-add_pch(ws2_32 include/ws2_32.h SOURCE)
+set_module_type(ws2_32 win32dll)
+target_link_libraries(ws2_32 ${PSEH_LIB})
+add_importlibs(ws2_32 user32 advapi32 ws2help msvcrt kernel32 ntdll)
+add_pch(ws2_32 inc/ws2_32.h SOURCE)
 add_cd_file(TARGET ws2_32 DESTINATION reactos/system32 FOR all)
similarity index 98%
rename from reactos/dll/win32/ws2_32_new/inc/ws2_32p.h
rename to reactos/dll/win32/ws2_32/inc/ws2_32p.h
index 004cb6b..0908bc7 100644 (file)
@@ -79,6 +79,7 @@ typedef struct _TPROVIDER
     LONG RefCount;
     WSPPROC_TABLE Service;
     HINSTANCE DllHandle;
+    WSPUPCALLTABLE UpcallTable;
 } TPROVIDER, *PTPROVIDER;
 
 typedef struct _TCATALOG_ENTRY
@@ -210,6 +211,17 @@ typedef struct _ENUM_CONTEXT
    PNSCATALOG Catalog;
 } ENUM_CONTEXT, *PENUM_CONTEXT;
 
+typedef struct _NSPROVIDER_ENUM_CONTEXT
+{
+    LPINT Protocols;
+    LPVOID ProtocolBuffer;
+    DWORD BufferLength;
+    DWORD BufferUsed;
+    DWORD Count;
+    BOOLEAN Unicode;
+    INT ErrorCode;
+} NSPROVIDER_ENUM_CONTEXT, *PNSPROVIDER_ENUM_CONTEXT;
+
 typedef struct _PROTOCOL_ENUM_CONTEXT
 {
     LPINT Protocols;
similarity index 99%
rename from reactos/dll/win32/ws2_32_new/src/addrconv.c
rename to reactos/dll/win32/ws2_32/src/addrconv.c
index 15fda1f..633dfb9 100644 (file)
@@ -73,6 +73,8 @@ inet_addr(IN  CONST CHAR FAR* cp)
     register u_long val, base, n;
     register unsigned char c;
     u_long parts[4], *pp = parts;
+    if (!cp) return INADDR_ANY;
+    if (!isdigit(*cp)) return INADDR_NONE;
 
 again:
     /*
@@ -144,7 +146,7 @@ again:
         break;
 
     default:
-        return (-1);
+        return (INADDR_NONE);
     }
     val = htonl(val);
     return (val);
similarity index 91%
rename from reactos/dll/win32/ws2_32_new/src/addrinfo.c
rename to reactos/dll/win32/ws2_32/src/addrinfo.c
index c714213..39a6f55 100644 (file)
@@ -90,17 +90,76 @@ WINAPI
 ParseV4Address(IN PCWSTR AddressString,
                OUT PDWORD pAddress)
 {
-    IN_ADDR Address;
-    PCWSTR Terminator;
-    NTSTATUS Status;
-
-    *pAddress = 0;
-    Status = RtlIpv4StringToAddressW(AddressString, FALSE, &Terminator, &Address);
-
-    if (!NT_SUCCESS(Status))
+    CHAR AnsiAddressString[MAX_HOSTNAME_LEN];
+    CHAR * cp = AnsiAddressString;
+    DWORD val, base;
+    unsigned char c;
+    DWORD parts[4], *pp = parts;
+    if (!AddressString)
         return FALSE;
+    WideCharToMultiByte(CP_ACP,
+                        0,
+                        AddressString, 
+                        -1, 
+                        AnsiAddressString, 
+                        sizeof(AnsiAddressString),
+                        NULL,
+                        0);
+    if (!isdigit(*cp)) return FALSE;
+
+again:
+    /*
+    * Collect number up to ``.''.
+    * Values are specified as for C:
+    * 0x=hex, 0=octal, other=decimal.
+    */
+    val = 0; base = 10;
+    if (*cp == '0') {
+        if (*++cp == 'x' || *cp == 'X')
+            base = 16, cp++;
+        else
+            base = 8;
+    }
+    while ((c = *cp)) {
+        if (isdigit(c)) {
+            val = (val * base) + (c - '0');
+            cp++;
+            continue;
+        }
+        if (base == 16 && isxdigit(c)) {
+            val = (val << 4) + (c + 10 - (islower(c) ? 'a' : 'A'));
+            cp++;
+            continue;
+        }
+        break;
+    }
+    if (*cp == '.') {
+        /*
+        * Internet format:
+        *    a.b.c.d
+        */
+        if (pp >= parts + 4) return FALSE;
+        *pp++ = val;
+        cp++;
+        goto again;
+    }
+    /*
+    * Check for trailing characters.
+    */
+    if (*cp) return FALSE;
+
+    *pp++ = val;
+    /*
+    * Concoct the address according to
+    * the number of parts specified.
+    */
+    if ((DWORD)(pp - parts) != 4) return FALSE;
+    if (parts[0] > 0xff || parts[1] > 0xff || parts[2] > 0xff || parts[3] > 0xff) return FALSE;
+    val = (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3];
+
+    if (pAddress)
+        *pAddress = htonl(val);
 
-    *pAddress = Address.S_un.S_addr;
     return TRUE;
 }
 
@@ -530,7 +589,7 @@ GetAddrInfoW(IN PCWSTR pszNodeName,
                             pszServiceName, 
                             -1, 
                             AnsiServiceName, 
-                            256,
+                            sizeof(AnsiServiceName),
                             NULL,
                             0);
 
@@ -543,6 +602,7 @@ GetAddrInfoW(IN PCWSTR pszNodeName,
             /* Get the port directly */
             wPort = wTcpPort = wUdpPort = htons(wPort);
 
+#if 0
             /* Check if this is both TCP and UDP */
             if (iSocketType == 0)
             {
@@ -550,9 +610,11 @@ GetAddrInfoW(IN PCWSTR pszNodeName,
                 bClone = TRUE;
                 iSocketType = SOCK_STREAM;
             }
+#endif
         }
         else
         {
+            wPort = 0;
             /* The port name was a string. Check if this is a UDP socket */
             if ((iSocketType == 0) || (iSocketType == SOCK_DGRAM))
             {
@@ -576,15 +638,18 @@ GetAddrInfoW(IN PCWSTR pszNodeName,
             /* If we got 0, then fail */
             if (wPort == 0)
             {
-                return iSocketType ? EAI_SERVICE : EAI_NONAME;
+                return EAI_SERVICE;
             }
 
             /* Check if this was for both */
             if (iSocketType == 0)
             {
                 /* Do the TCP case right now */
-                iSocketType = (wTcpPort) ? SOCK_STREAM : SOCK_DGRAM;
-                bClone = (wTcpPort && wUdpPort); 
+                if (wTcpPort && !wUdpPort)
+                    iSocketType = SOCK_STREAM;
+                if (!wTcpPort && wUdpPort)
+                    iSocketType = SOCK_DGRAM;
+                //bClone = (wTcpPort && wUdpPort); 
             }
         }
     }
@@ -612,7 +677,7 @@ GetAddrInfoW(IN PCWSTR pszNodeName,
             /* Set AI_NUMERICHOST since this is a numeric string */
             (*pptResult)->ai_flags |= AI_NUMERICHOST;
             
-            /* Check if the canonical name was requestd */
+            /* Check if the canonical name was requested */
             if (iFlags & AI_CANONNAME)
             {
                 /* Get the canonical name */
@@ -657,7 +722,7 @@ GetAddrInfoW(IN PCWSTR pszNodeName,
                             pszNodeName, 
                             -1, 
                             AnsiNodeName, 
-                            256,
+                            sizeof(AnsiNodeName),
                             NULL,
                             0);
 
@@ -736,23 +801,23 @@ getaddrinfo(const char FAR *nodename,
             struct addrinfo FAR * FAR *res)
 {
     INT ErrorCode;
-    LPWSTR UnicodeNodeName;
+    LPWSTR UnicodeNodeName = NULL;
     LPWSTR UnicodeServName = NULL; 
     DPRINT("getaddrinfo: %s, %s, %p, %p\n", nodename, servname, hints, res);
 
     /* Check for WSAStartup */
     if ((ErrorCode = WsQuickProlog()) != ERROR_SUCCESS) return ErrorCode;
 
-    /* Assume NULL */
-    *res = NULL;
-
     /* Convert the node name */
-    UnicodeNodeName = UnicodeDupFromAnsi((LPSTR)nodename);
-    if (!UnicodeNodeName)
+    if (nodename)
     {
-        /* Prepare to fail */
-        ErrorCode = GetLastError();
-        goto Quickie;
+        UnicodeNodeName = UnicodeDupFromAnsi((LPSTR)nodename);
+        if (!UnicodeNodeName)
+        {
+            /* Prepare to fail */
+            ErrorCode = GetLastError();
+            goto Quickie;
+        }
     }
 
     /* Convert the servname too, if we have one */
@@ -937,7 +1002,7 @@ getnameinfo(const struct sockaddr FAR *sa,
     {
         /* Setup the data for it */
         ServiceString = ServiceBuffer;
-        ServLength = sizeof(ServiceBuffer) / sizeof(WCHAR);
+        ServLength = sizeof(ServiceBuffer) - 1;
     }
   
     /* Now call the unicode function */
similarity index 95%
rename from reactos/dll/win32/ws2_32_new/src/dcatalog.c
rename to reactos/dll/win32/ws2_32/src/dcatalog.c
index 8e0e2e2..a2a9e0b 100644 (file)
 
 #include <ws2_32.h>
 
-/* DATA **********************************************************************/
+#define NDEBUG
+#include <debug.h>
 
-#define TCCATALOG_NAME "Protocol_Catalog9"
+/* DATA **********************************************************************/
 
 #define WsTcLock()          EnterCriticalSection((LPCRITICAL_SECTION)&Catalog->Lock);
 #define WsTcUnlock()        LeaveCriticalSection((LPCRITICAL_SECTION)&Catalog->Lock);
@@ -45,14 +46,33 @@ WsTcOpen(IN PTCATALOG Catalog,
     DWORD RegSize = sizeof(DWORD);
     DWORD UniqueId = 0;
     DWORD NewData = 0;
+    CHAR* CatalogKeyName;
 
     /* Initialize the catalog lock and namespace list */
     InitializeCriticalSection((LPCRITICAL_SECTION)&Catalog->Lock);
     InitializeListHead(&Catalog->ProtocolList);
 
+    /* Read the catalog name */
+    ErrorCode = RegQueryValueEx(ParentKey,
+                                "Current_Protocol_Catalog",
+                                0,
+                                &RegType,
+                                NULL,
+                                &RegSize);
+
+    CatalogKeyName = HeapAlloc(WsSockHeap, 0, RegSize);
+
+    /* Read the catalog name */
+    ErrorCode = RegQueryValueEx(ParentKey,
+                                "Current_Protocol_Catalog",
+                                0,
+                                &RegType,
+                                (LPBYTE)CatalogKeyName,
+                                &RegSize);
+
     /* Open the Catalog Key */
     ErrorCode = RegOpenKeyEx(ParentKey,
-                             TCCATALOG_NAME,
+                             CatalogKeyName,
                              0,
                              MAXIMUM_ALLOWED,
                              &CatalogKey);
@@ -67,7 +87,7 @@ WsTcOpen(IN PTCATALOG Catalog,
     {
         /* Create the Catalog Name */
         ErrorCode = RegCreateKeyEx(ParentKey,
-                                   TCCATALOG_NAME,
+                                   CatalogKeyName,
                                    0,
                                    NULL,
                                    REG_OPTION_NON_VOLATILE,
@@ -77,6 +97,10 @@ WsTcOpen(IN PTCATALOG Catalog,
                                    &CreateDisposition);
     }
 
+    HeapFree(WsSockHeap, 0, CatalogKeyName);
+    RegType = REG_DWORD;
+    RegSize = sizeof(DWORD);
+
     /* Fail if that didn't work */
     if (ErrorCode != ERROR_SUCCESS) return FALSE;
 
@@ -149,6 +173,7 @@ WsTcOpen(IN PTCATALOG Catalog,
     }
     else
     {
+        RegSize = sizeof(DWORD);
         /* Read the serial number */
         ErrorCode = RegQueryValueEx(CatalogKey,
                                     "Serial_Access_Num",
@@ -409,6 +434,7 @@ WsTcGetEntryFromCatalogEntryId(IN PTCATALOG Catalog,
                                IN DWORD CatalogEntryId,
                                IN PTCATALOG_ENTRY *CatalogEntry)
 {
+    INT ErrorCode = WSAEINVAL;
     PLIST_ENTRY NextEntry = Catalog->ProtocolList.Flink;
     PTCATALOG_ENTRY Entry;
 
@@ -435,6 +461,7 @@ WsTcGetEntryFromCatalogEntryId(IN PTCATALOG Catalog,
             /* Reference the entry and return it */
             InterlockedIncrement(&Entry->RefCount);
             *CatalogEntry = Entry;
+            ErrorCode = ERROR_SUCCESS;
             break;
         }
     }
@@ -443,7 +470,7 @@ WsTcGetEntryFromCatalogEntryId(IN PTCATALOG Catalog,
     WsTcUnlock();
 
     /* Return */
-    return ERROR_SUCCESS;
+    return ErrorCode;
 }
 
 DWORD
@@ -458,6 +485,7 @@ WsTcGetEntryFromTriplet(IN PTCATALOG Catalog,
     INT ErrorCode = WSAEINVAL;
     PLIST_ENTRY NextEntry = Catalog->ProtocolList.Flink;
     PTCATALOG_ENTRY Entry;
+    DPRINT("WsTcGetEntryFromTriplet: %lx, %lx, %lx, %lx\n", af, type, protocol, StartId);
 
     /* Assume failure */
     *CatalogEntry = NULL;
@@ -494,9 +522,9 @@ WsTcGetEntryFromTriplet(IN PTCATALOG Catalog,
             if ((Entry->ProtocolInfo.iSocketType == type) || (type == 0))
             {
                 /* Check if Protocol is In Range or if it's wildcard */
-                if (((Entry->ProtocolInfo.iProtocol >= protocol) && 
+                if (((Entry->ProtocolInfo.iProtocol <= protocol) && 
                     ((Entry->ProtocolInfo.iProtocol + 
-                      Entry->ProtocolInfo.iProtocolMaxOffset) <= protocol)) ||
+                      Entry->ProtocolInfo.iProtocolMaxOffset) >= protocol)) ||
                     (protocol == 0))
                 {
                     /* Check if it doesn't already have a provider */
@@ -580,6 +608,7 @@ WsTcLoadProvider(IN PTCATALOG Catalog,
 {
     INT ErrorCode = ERROR_SUCCESS;
     PTPROVIDER Provider;
+    DPRINT("WsTcLoadProvider: %p, %p\n", Catalog, CatalogEntry);
 
     /* Lock the catalog */
     WsTcLock();
similarity index 79%
rename from reactos/dll/win32/ws2_32_new/src/dcatitem.c
rename to reactos/dll/win32/ws2_32/src/dcatitem.c
index abd9c41..511cbf4 100644 (file)
@@ -67,6 +67,8 @@ WsTcEntryInitializeFromRegistry(IN PTCATALOG_ENTRY CatalogEntry,
     DWORD RegType = REG_BINARY;
     HKEY EntryKey;
     DWORD Return;
+    LPBYTE Buf;
+    DWORD index;
 
     /* Convert to a 00000xxx string */
     sprintf(CatalogEntryName, "%0""12""lu", UniqueId);
@@ -79,21 +81,34 @@ WsTcEntryInitializeFromRegistry(IN PTCATALOG_ENTRY CatalogEntry,
                           &EntryKey);
 
     /* Get Size of Catalog Entry Structure */
-    Return = RegQueryValueExW(EntryKey, 
-                              L"PackedCatalogItem",
+    Return = RegQueryValueEx(EntryKey, 
+                              "PackedCatalogItem",
                               0,
                               NULL,
                               NULL,
                               &RegSize);
     
+    if(!(Buf = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, RegSize)))
+        return ERROR_NOT_ENOUGH_MEMORY;
+
     /* Read the Whole Catalog Entry Structure */
-    Return = RegQueryValueExW(EntryKey, 
-                              L"PackedCatalogItem",
+    Return = RegQueryValueEx(EntryKey, 
+                              "PackedCatalogItem",
                               0,
                               &RegType,
-                              (LPBYTE)&CatalogEntry->DllPath,
+                              Buf,
                               &RegSize);
 
+
+    memcpy(CatalogEntry->DllPath, (LPCSTR)Buf, sizeof(CatalogEntry->DllPath));
+    index = sizeof(CatalogEntry->DllPath);
+    if(index < RegSize)
+    {
+        memcpy(&CatalogEntry->ProtocolInfo, &Buf[index], sizeof(WSAPROTOCOL_INFOW));
+        index += sizeof(WSAPROTOCOL_INFOW);
+    }
+    HeapFree(WsSockHeap, 0, Buf);
+
     /* Done */
     RegCloseKey(EntryKey);
     return Return;
similarity index 65%
rename from reactos/dll/win32/ws2_32_new/src/dprovide.c
rename to reactos/dll/win32/ws2_32/src/dprovide.c
index f5079b0..afd334e 100644 (file)
@@ -10,6 +10,9 @@
 
 #include <ws2_32.h>
 
+#define NDEBUG
+#include <debug.h>
+
 /* FUNCTIONS *****************************************************************/
 
 PTPROVIDER
@@ -18,6 +21,7 @@ WsTpAllocate(VOID)
 {
     PTPROVIDER Provider;
     
+    DPRINT("WsTpAllocate: WsSockHeap %d\n", WsSockHeap);
     /* Allocate the object */
     Provider = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*Provider));
 
@@ -35,31 +39,32 @@ WsTpInitialize(IN PTPROVIDER Provider,
                IN LPWSAPROTOCOL_INFOW ProtocolInfo)
 {
     WORD VersionRequested = MAKEWORD(2,2);
-    WSPUPCALLTABLE UpcallTable;
     LPWSPSTARTUP WSPStartupProc;
     WSPDATA WspData;
     CHAR ExpandedDllPath[MAX_PATH];
+    DWORD ErrorCode;
+    DPRINT("WsTpInitialize: %p, %p, %p\n", Provider, DllName, ProtocolInfo);
     
     /* Clear the tables */
-    RtlZeroMemory(&UpcallTable, sizeof(UpcallTable));
+    RtlZeroMemory(&Provider->UpcallTable, sizeof(WSPUPCALLTABLE));
     RtlZeroMemory(&Provider->Service.lpWSPAccept, sizeof(WSPPROC_TABLE));
 
     /* Set up the Upcall Table */
-    UpcallTable.lpWPUCloseEvent = WPUCloseEvent;
-    UpcallTable.lpWPUCloseSocketHandle = WPUCloseSocketHandle;
-    UpcallTable.lpWPUCreateEvent = WPUCreateEvent;
-    UpcallTable.lpWPUCreateSocketHandle = WPUCreateSocketHandle;
-    UpcallTable.lpWPUFDIsSet = WPUFDIsSet;
-    UpcallTable.lpWPUGetProviderPath = WPUGetProviderPath;
-    UpcallTable.lpWPUModifyIFSHandle = WPUModifyIFSHandle;
-    UpcallTable.lpWPUPostMessage = WPUPostMessage;
-    UpcallTable.lpWPUQueryBlockingCallback = WPUQueryBlockingCallback;
-    UpcallTable.lpWPUQuerySocketHandleContext = WPUQuerySocketHandleContext;
-    UpcallTable.lpWPUQueueApc = WPUQueueApc;
-    UpcallTable.lpWPUResetEvent = WPUResetEvent;
-    UpcallTable.lpWPUSetEvent = WPUSetEvent;
-    UpcallTable.lpWPUOpenCurrentThread = WPUOpenCurrentThread;
-    UpcallTable.lpWPUCloseThread = WPUCloseThread;
+    Provider->UpcallTable.lpWPUCloseEvent = WPUCloseEvent;
+    Provider->UpcallTable.lpWPUCloseSocketHandle = WPUCloseSocketHandle;
+    Provider->UpcallTable.lpWPUCreateEvent = WPUCreateEvent;
+    Provider->UpcallTable.lpWPUCreateSocketHandle = WPUCreateSocketHandle;
+    Provider->UpcallTable.lpWPUFDIsSet = WPUFDIsSet;
+    Provider->UpcallTable.lpWPUGetProviderPath = WPUGetProviderPath;
+    Provider->UpcallTable.lpWPUModifyIFSHandle = WPUModifyIFSHandle;
+    Provider->UpcallTable.lpWPUPostMessage = WPUPostMessage;
+    Provider->UpcallTable.lpWPUQueryBlockingCallback = WPUQueryBlockingCallback;
+    Provider->UpcallTable.lpWPUQuerySocketHandleContext = WPUQuerySocketHandleContext;
+    Provider->UpcallTable.lpWPUQueueApc = WPUQueueApc;
+    Provider->UpcallTable.lpWPUResetEvent = WPUResetEvent;
+    Provider->UpcallTable.lpWPUSetEvent = WPUSetEvent;
+    Provider->UpcallTable.lpWPUOpenCurrentThread = WPUOpenCurrentThread;
+    Provider->UpcallTable.lpWPUCloseThread = WPUCloseThread;
 
     /* Expand the DLL Path */
     ExpandEnvironmentStrings(DllName, ExpandedDllPath, MAX_PATH);
@@ -67,18 +72,26 @@ WsTpInitialize(IN PTPROVIDER Provider,
     /* Load the DLL */
     Provider->DllHandle = LoadLibrary(ExpandedDllPath);
 
+    if(!Provider->DllHandle)
+    {
+        return SOCKET_ERROR;
+    }
     /* Get the pointer to WSPStartup */
     WSPStartupProc = (LPWSPSTARTUP)GetProcAddress(Provider->DllHandle, "WSPStartup");
 
+    if(!WSPStartupProc)
+    {
+        return SOCKET_ERROR;
+    }
     /* Call it */
-    (*WSPStartupProc)(VersionRequested,
+    ErrorCode = (*WSPStartupProc)(VersionRequested,
                       &WspData,
                       ProtocolInfo,
-                      UpcallTable,
+                      Provider->UpcallTable,
                       (LPWSPPROC_TABLE)&Provider->Service.lpWSPAccept);
 
     /* Return */
-    return ERROR_SUCCESS;
+    return ErrorCode;
 }
 
 DWORD
similarity index 73%
rename from reactos/dll/win32/ws2_32_new/src/enumprot.c
rename to reactos/dll/win32/ws2_32/src/enumprot.c
index 6f4aa33..4d04ea3 100644 (file)
@@ -31,7 +31,7 @@ CheckProtocolMatch(IN LPINT ProtocolSet,
         ProtocolId = ProtocolSet[i];
 
         /* Loop the list */
-        while (ProtocolId != 0)
+        while (ProtocolId != 0 && ProtocolInfo->iProtocol != 0)
         {
             /* Check if it's within ranges */
             if ((ProtocolId >= ProtocolInfo->iProtocol) &&
@@ -188,7 +188,7 @@ WSCEnumProtocols(IN LPINT lpiProtocols,
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 INT
 WSAAPI
@@ -196,14 +196,46 @@ WSAEnumProtocolsA(IN LPINT lpiProtocols,
                   OUT LPWSAPROTOCOL_INFOA lpProtocolBuffer,
                   IN OUT LPDWORD lpdwBufferLength)
 {
-    DPRINT("WSAEnumProtocolsA: %p\n", lpiProtocols);
-    UNIMPLEMENTED;
-    SetLastError(WSAEINVAL);
-    return SOCKET_ERROR;
+    INT error, i, count;
+    LPWSAPROTOCOL_INFOW protocolInfoW;
+    DWORD size;
+    DPRINT("WSAEnumProtocolsA: %p %p %p\n", lpiProtocols, lpProtocolBuffer, lpdwBufferLength);
+    if (!lpdwBufferLength)
+    {
+        SetLastError(WSAENOBUFS);
+        return SOCKET_ERROR;
+    }
+    count = WSCEnumProtocols(lpiProtocols, NULL, &size, &error);
+    if (!lpProtocolBuffer || *lpdwBufferLength < (size/sizeof(WSAPROTOCOL_INFOW))*sizeof(WSAPROTOCOL_INFOA))
+    {
+        *lpdwBufferLength = (size/sizeof(WSAPROTOCOL_INFOW))*sizeof(WSAPROTOCOL_INFOA);
+        SetLastError(WSAENOBUFS);
+        return SOCKET_ERROR;
+    }
+    protocolInfoW = HeapAlloc(WsSockHeap, 0, size);
+    count = WSCEnumProtocols(lpiProtocols, protocolInfoW, &size, &error);
+    if (SOCKET_ERROR == count)
+    {
+        HeapFree(WsSockHeap, 0, protocolInfoW);
+        SetLastError(error);
+        return SOCKET_ERROR;
+    }
+    *lpdwBufferLength = 0;
+    for (i = 0; i < count; i++)
+    {
+        /* Copy the data */
+        RtlMoveMemory(&lpProtocolBuffer[i],
+                      &protocolInfoW[i],
+                      sizeof(lpProtocolBuffer[0])-sizeof(lpProtocolBuffer[0].szProtocol));
+        wcstombs(lpProtocolBuffer[i].szProtocol, protocolInfoW[i].szProtocol, sizeof(lpProtocolBuffer[0].szProtocol));
+        *lpdwBufferLength += sizeof(WSAPROTOCOL_INFOA);
+    }
+    HeapFree(WsSockHeap, 0, protocolInfoW);
+    return i;
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 INT
 WSAAPI
@@ -211,14 +243,20 @@ WSAEnumProtocolsW(IN LPINT lpiProtocols,
                   OUT LPWSAPROTOCOL_INFOW lpProtocolBuffer,
                   IN OUT  LPDWORD lpdwBufferLength)
 {
-    DPRINT("WSAEnumProtocolsW: %p\n", lpiProtocols);
-    UNIMPLEMENTED;
-    SetLastError(WSAEINVAL);
-    return SOCKET_ERROR;
+    INT error, count;
+    DPRINT("WSAEnumProtocolsW: %p %p %p\n", lpiProtocols, lpProtocolBuffer, lpdwBufferLength);
+    count = WSCEnumProtocols(lpiProtocols, lpProtocolBuffer, lpdwBufferLength, &error);
+    if (SOCKET_ERROR == count)
+    {
+        SetLastError(error);
+        return SOCKET_ERROR;
+    }
+    return count;
 }
 
+
 /*
- * @unimplemented
+ * @implemented
  */
 INT
 WSPAPI
@@ -227,13 +265,11 @@ WPUGetProviderPath(IN LPGUID lpProviderId,
                    IN OUT LPINT lpProviderDllPathLen,
                    OUT LPINT lpErrno)
 {
-    DPRINT("WPUGetProviderPath: %p\n", lpProviderId);
-    UNIMPLEMENTED;
-    return 0;
+    return WSCGetProviderPath(lpProviderId, lpszProviderDllPath, lpProviderDllPathLen, lpErrno);
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 INT
 WSAAPI
@@ -257,7 +293,7 @@ WSCGetProviderPath(IN LPGUID lpProviderId,
                    IN OUT LPINT lpProviderDllPathLen,
                    OUT LPINT lpErrno)
 {
-    DPRINT("WSCGetProviderPath: %p\n", lpProviderId);
+    DPRINT("WSCGetProviderPath: %p %p %p %p\n", lpProviderId, lpszProviderDllPath, lpProviderDllPathLen, lpErrno);
     UNIMPLEMENTED;
     SetLastError(WSAEINVAL);
     return SOCKET_ERROR;
similarity index 86%
rename from reactos/dll/win32/ws2_32_new/src/getproto.c
rename to reactos/dll/win32/ws2_32/src/getproto.c
index 5cfca6e..825a1eb 100644 (file)
@@ -19,12 +19,17 @@ HANDLE
 WSAAPI
 GetProtoOpenNetworkDatabase(PCHAR Name)
 {
-    CHAR ExpandedPath[MAX_PATH];
-    CHAR DatabasePath[MAX_PATH];
+    PCHAR ExpandedPath;
+    PCHAR DatabasePath;
     INT ErrorCode;
     HKEY DatabaseKey;
     DWORD RegType;
-    DWORD RegSize = sizeof(DatabasePath);
+    DWORD RegSize = 0;
+    HANDLE ret;
+
+    ExpandedPath = HeapAlloc(WsSockHeap, 0, MAX_PATH);
+    if (!ExpandedPath)
+        return INVALID_HANDLE_VALUE;
 
     /* Open the database path key */
     ErrorCode = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
@@ -34,6 +39,21 @@ GetProtoOpenNetworkDatabase(PCHAR Name)
                              &DatabaseKey);
     if (ErrorCode == NO_ERROR)
     {
+        /* Read the actual path */
+        ErrorCode = RegQueryValueEx(DatabaseKey,
+                                    "DatabasePath",
+                                    NULL,
+                                    &RegType,
+                                    NULL,
+                                    &RegSize);
+
+        DatabasePath = HeapAlloc(WsSockHeap, 0, RegSize);
+        if (!DatabasePath)
+        {
+            HeapFree(WsSockHeap, 0, ExpandedPath);
+            return INVALID_HANDLE_VALUE;
+        }
+
         /* Read the actual path */
         ErrorCode = RegQueryValueEx(DatabaseKey,
                                     "DatabasePath",
@@ -42,37 +62,48 @@ GetProtoOpenNetworkDatabase(PCHAR Name)
                                     (LPBYTE)DatabasePath,
                                     &RegSize);
 
+
         /* Close the key */
         RegCloseKey(DatabaseKey);
 
         /* Expand the name */
         ExpandEnvironmentStrings(DatabasePath, ExpandedPath, MAX_PATH);
+
+        HeapFree(WsSockHeap, 0, DatabasePath);
     }
     else
     {
         /* Use defalt path */
         GetSystemDirectory(ExpandedPath, MAX_PATH);
-        strcat(ExpandedPath, "DRIVERS\\ETC\\");
+        if (ExpandedPath[strlen(ExpandedPath) - 1] != '\\')
+        {
+            /* It isn't, so add it ourselves */
+            strncat(ExpandedPath, "\\", MAX_PATH);
+        }
+        strncat(ExpandedPath, "DRIVERS\\ETC\\", MAX_PATH);
     }
 
     /* Make sure that the path is backslash-terminated */
     if (ExpandedPath[strlen(ExpandedPath) - 1] != '\\')
     {
         /* It isn't, so add it ourselves */
-        strcat(ExpandedPath, "\\");
+        strncat(ExpandedPath, "\\", MAX_PATH);
     }
 
     /* Add the database name */
-    strcat(ExpandedPath, Name);
+    strncat(ExpandedPath, Name, MAX_PATH);
 
     /* Return a handle to the file */
-    return CreateFile(ExpandedPath,
+    ret = CreateFile(ExpandedPath,
                       FILE_READ_ACCESS,
                       0,
                       NULL,
                       OPEN_EXISTING,
                       FILE_ATTRIBUTE_NORMAL,
                       NULL);
+
+    HeapFree(WsSockHeap, 0, ExpandedPath);
+    return ret;
 }
 
 PCHAR
@@ -118,9 +149,6 @@ GetProtoGetNextEnt(IN HANDLE DbHandle,
                       &Read,
                       NULL)) return NULL;
 
-        /* Null terminate LineBuffer */
-        Buffer->LineBuffer[Read] = ANSI_NULL;
-
         /* Find out where the line ends */
         p1 = Buffer->LineBuffer;
         p = strchr(Buffer->LineBuffer, '\n');
@@ -215,7 +243,7 @@ getprotobynumber(IN INT number)
     PWSTHREAD Thread;
     INT ErrorCode;
     PPROTOENT Protoent;
-    PVOID GetProtoBuffer;
+    PVOID GetProtoBuffer; 
     HANDLE DbHandle;
     DPRINT("getprotobynumber: %lx\n", number);
 
@@ -279,7 +307,7 @@ getprotobyname(IN CONST CHAR FAR *name)
     PWSTHREAD Thread;
     INT ErrorCode;
     PPROTOENT Protoent;
-    PVOID GetProtoBuffer;
+    PVOID GetProtoBuffer; 
     HANDLE DbHandle;
     DPRINT("getprotobyname: %s\n", name);
 
similarity index 96%
rename from reactos/dll/win32/ws2_32_new/src/getxbyxx.c
rename to reactos/dll/win32/ws2_32/src/getxbyxx.c
index f0642a3..aff4fc5 100644 (file)
@@ -108,9 +108,11 @@ getxyDataEnt(IN OUT PCHAR *Results,
 {
     PWSAQUERYSETA WsaQuery = (PWSAQUERYSETA)*Results;
     INT ErrorCode;
+    DWORD NewLength = Length;
     HANDLE RnRHandle;
     LPBLOB Blob = NULL;
-    PVOID NewResults;
+    PVOID NewResults = NULL;
+    DWORD dwControlFlags = LUP_RETURN_NAME;
 
     /* Assume empty return name */
     if (NewName) *NewName = NULL;
@@ -121,12 +123,15 @@ getxyDataEnt(IN OUT PCHAR *Results,
     WsaQuery->lpszServiceInstanceName = Name;
     WsaQuery->lpServiceClassId = (LPGUID)Type;
     WsaQuery->dwNameSpace = NS_ALL;
-    WsaQuery->dwNumberOfProtocols = 2;
-    WsaQuery->lpafpProtocols = &afp[0];
+    WsaQuery->dwNumberOfProtocols = sizeof(afp)/sizeof(afp[0]);
+    WsaQuery->lpafpProtocols = afp;
+
+    if(!IsEqualGUID(Type, &HostnameGuid))
+        dwControlFlags |= LUP_RETURN_BLOB;
 
     /* Send the Query Request to find a Service */
     ErrorCode = WSALookupServiceBeginA(WsaQuery,
-                                       LUP_RETURN_BLOB | LUP_RETURN_NAME,
+                                       dwControlFlags,
                                        &RnRHandle);
 
     if(ErrorCode == ERROR_SUCCESS) 
@@ -136,7 +141,7 @@ getxyDataEnt(IN OUT PCHAR *Results,
             /* Service was found, send the real query */
             ErrorCode = WSALookupServiceNextA(RnRHandle,
                                               0,
-                                              &Length,
+                                              &NewLength,
                                               WsaQuery);
 
             /* Return the information requested */
@@ -152,7 +157,7 @@ getxyDataEnt(IN OUT PCHAR *Results,
                 else 
                 {
                     /* Check if this was a Hostname lookup */
-                    if (Type == &HostnameGuid)
+                    if (IsEqualGUID(Type, &HostnameGuid))
                     {
                         /* Return the name anyways */
                         if(NewName) *NewName = WsaQuery->lpszServiceInstanceName;
@@ -368,7 +373,7 @@ gethostbyaddr(IN const char FAR * addr,
     else 
     {
         /* We failed, so zero it out */
-        Hostent = 0;
+        Hostent = NULL;
 
         /* Normalize the error message */
         if(GetLastError() == WSASERVICE_NOT_FOUND) 
@@ -390,18 +395,25 @@ gethostbyaddr(IN const char FAR * addr,
 INT
 WSAAPI
 gethostname(OUT char FAR * name,
-            IN int namelen)
+            IN INT namelen)
 {
-    PCHAR Name;
+    PCHAR Name = NULL;
     CHAR ResultsBuffer[RNR_BUFFER_SIZE];
     PCHAR Results = ResultsBuffer;
     DPRINT("gethostname: %p\n", name);
 
+    if (!name || namelen < 1)
+    {
+        SetLastError(WSAEFAULT);
+        return SOCKET_ERROR;
+    }
     /* Get the Hostname in a String */
-    if(getxyDataEnt(&Results, RNR_BUFFER_SIZE, NULL, &HostnameGuid, &Name))
+    /* getxyDataEnt does not return blob for HostnameGuid */
+    getxyDataEnt(&Results, RNR_BUFFER_SIZE, NULL, &HostnameGuid, &Name);
+    if(Name)
     {
         /* Copy it */
-        strcpy((LPSTR)name, Name);
+        strncpy((LPSTR)name, Name, namelen-1);
     }
 
     /* Check if we received a newly allocated buffer; free it. */
@@ -450,7 +462,7 @@ getservbyport(IN int port,
     }
 
     /* Put it into the right syntax */
-    sprintf(PortName, "%d/%s", (port & 0xffff), proto);
+    sprintf(PortName, "%d/%s", (ntohs(port) & 0xffff), proto);
 
     /* Get the Service in a Blob */
     Blob = getxyDataEnt(&Results, RNR_BUFFER_SIZE, PortName, &IANAGuid, 0);
@@ -471,9 +483,6 @@ getservbyport(IN int port,
     {
         /* We failed, so zero it out */
         Servent = 0;
-
-        /* Normalize the error message */
-        if(GetLastError() == WSATYPE_NOT_FOUND) SetLastError(WSANO_DATA);
     }
 
     /* Check if we received a newly allocated buffer; free it. */
@@ -543,9 +552,6 @@ getservbyname(IN const char FAR * name,
     {
         /* We failed, so zero it out */
         Servent = 0;
-
-        /* Normalize the error message */
-        if(GetLastError() == WSATYPE_NOT_FOUND) SetLastError(WSANO_DATA);
     }
 
     /* Check if we received a newly allocated buffer; free it. */
similarity index 94%
rename from reactos/dll/win32/ws2_32_new/src/nscatalo.c
rename to reactos/dll/win32/ws2_32/src/nscatalo.c
index 3c1f873..57dd8f1 100644 (file)
 
 #include <ws2_32.h>
 
+#define NDEBUG
+#include <debug.h>
+
 /* DATA **********************************************************************/
 
-#define NSCATALOG_NAME      "NameSpace_Catalog5"
 #define WsNcLock()          EnterCriticalSection((LPCRITICAL_SECTION)&Catalog->Lock);
 #define WsNcUnlock()        LeaveCriticalSection((LPCRITICAL_SECTION)&Catalog->Lock);
 
@@ -39,19 +41,37 @@ WsNcOpen(IN PNSCATALOG Catalog,
     LONG ErrorCode;
     DWORD CreateDisposition;
     HKEY CatalogKey, NewKey;
-    //DWORD CatalogEntries = 0;
     DWORD RegType = REG_DWORD;
     DWORD RegSize = sizeof(DWORD);
     DWORD UniqueId = 0;
     DWORD NewData = 0;
+    CHAR* CatalogKeyName;
 
     /* Initialize the catalog lock and namespace list */
     InitializeCriticalSection((LPCRITICAL_SECTION)&Catalog->Lock);
     InitializeListHead(&Catalog->CatalogList);
 
+    /* Read the catalog name */
+    ErrorCode = RegQueryValueEx(ParentKey,
+                                "Current_NameSpace_Catalog",
+                                0,
+                                &RegType,
+                                NULL,
+                                &RegSize);
+
+    CatalogKeyName = HeapAlloc(WsSockHeap, 0, RegSize);
+
+    /* Read the catalog name */
+    ErrorCode = RegQueryValueEx(ParentKey,
+                                "Current_NameSpace_Catalog",
+                                0,
+                                &RegType,
+                                (LPBYTE)CatalogKeyName,
+                                &RegSize);
+
     /* Open the Catalog Key */
     ErrorCode = RegOpenKeyEx(ParentKey,
-                             NSCATALOG_NAME,
+                             CatalogKeyName,
                              0,
                              MAXIMUM_ALLOWED,
                              &CatalogKey);
@@ -66,7 +86,7 @@ WsNcOpen(IN PNSCATALOG Catalog,
     {
         /* Create the Catalog Name */
         ErrorCode = RegCreateKeyEx(ParentKey,
-                                   NSCATALOG_NAME,
+                                   CatalogKeyName,
                                    0,
                                    NULL,
                                    REG_OPTION_NON_VOLATILE,
@@ -76,6 +96,10 @@ WsNcOpen(IN PNSCATALOG Catalog,
                                    &CreateDisposition);
     }
 
+    HeapFree(WsSockHeap, 0, CatalogKeyName);
+    RegType = REG_DWORD;
+    RegSize = sizeof(DWORD);
+
     /* Fail if that didn't work */
     if (ErrorCode != ERROR_SUCCESS) return FALSE;
 
@@ -133,6 +157,7 @@ WsNcOpen(IN PNSCATALOG Catalog,
     }
     else
     {
+        RegSize = sizeof(UniqueId);
         /* Read the serial number */
         ErrorCode = RegQueryValueEx(CatalogKey,
                                     "Serial_Access_Num",
diff --git a/reactos/dll/win32/ws2_32/src/nscatent.c b/reactos/dll/win32/ws2_32/src/nscatent.c
new file mode 100644 (file)
index 0000000..2131b7c
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * COPYRIGHT:   See COPYING in the top level directory
+ * PROJECT:     ReactOS WinSock 2 API
+ * FILE:        dll/win32/ws2_32_new/src/nscatent.c
+ * PURPOSE:     Namespace Catalog Entry Object
+ * PROGRAMMER:  Alex Ionescu (alex@relsoft.net)
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <ws2_32.h>
+
+/* FUNCTIONS *****************************************************************/
+
+PNSCATALOG_ENTRY
+WSAAPI
+WsNcEntryAllocate(VOID)
+{
+    PNSCATALOG_ENTRY CatalogEntry;
+
+    /* Allocate the catalog */
+    CatalogEntry = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*CatalogEntry));
+
+    /* Set the default non-null members */
+    CatalogEntry->RefCount = 1;
+    CatalogEntry->Enabled = TRUE;
+    CatalogEntry->AddressFamily = -1;
+
+    /* Return it */
+    return CatalogEntry;
+}
+
+VOID
+WSAAPI
+WsNcEntryDelete(IN PNSCATALOG_ENTRY CatalogEntry)
+{
+    /* Check if a provider is loaded */
+    if (CatalogEntry->Provider)
+    {
+        /* Dereference it too */
+        WsNpDereference(CatalogEntry->Provider);
+        CatalogEntry->Provider = NULL;
+    }
+
+    /* Delete us */
+    HeapFree(WsSockHeap, 0, CatalogEntry);
+}
+
+VOID
+WSAAPI
+WsNcEntryDereference(IN PNSCATALOG_ENTRY CatalogEntry)
+{
+    /* Dereference and check if it's now 0 */
+    if (!(InterlockedDecrement(&CatalogEntry->RefCount)))
+    {
+        /* We can delete the Provider now */
+        WsNcEntryDelete(CatalogEntry);
+    }
+}
+
+INT
+WSAAPI
+WsNcEntryInitializeFromRegistry(IN PNSCATALOG_ENTRY CatalogEntry,
+                                IN HKEY ParentKey,
+                                IN ULONG UniqueId)
+{
+    INT ErrorCode;
+    CHAR CatalogEntryName[13];
+    HKEY EntryKey;
+    ULONG RegType = REG_SZ;
+    ULONG RegSize = MAX_PATH;
+    ULONG RegValue;
+
+    /* Convert to a 00000xxx string */
+    sprintf(CatalogEntryName, "%0""12""i", (int)UniqueId);
+
+    /* Open the Entry */
+    ErrorCode = RegOpenKeyEx(ParentKey,
+                             CatalogEntryName,
+                             0,
+                             KEY_READ,
+                             &EntryKey);
+    if (ErrorCode != ERROR_SUCCESS) return ErrorCode;
+    /* Read the Library Path */
+    ErrorCode = RegQueryValueExW(EntryKey,
+                                 L"LibraryPath",
+                                 0,
+                                 &RegType,
+                                 (LPBYTE)&CatalogEntry->DllPath,
+                                 &RegSize);
+    if (ErrorCode != ERROR_SUCCESS) goto out;
+    /* Query Display String Size*/
+    ErrorCode = RegQueryValueExW(EntryKey,
+                                 L"DisplayString",
+                                 0,
+                                 NULL,
+                                 NULL,
+                                 &RegSize);
+    if (ErrorCode != ERROR_SUCCESS) goto out;
+    /* Allocate it */
+    CatalogEntry->ProviderName = (LPWSTR)HeapAlloc(WsSockHeap, 0, RegSize);
+
+    /* Read it */
+    ErrorCode = RegQueryValueExW(EntryKey,
+                                 L"DisplayString",
+                                 0,
+                                 &RegType,
+                                 (LPBYTE)CatalogEntry->ProviderName,
+                                 &RegSize);
+    if (ErrorCode != ERROR_SUCCESS) goto out;
+    /* Read the Provider Id */
+    RegType = REG_BINARY;
+    RegSize = sizeof(GUID);
+    ErrorCode = RegQueryValueEx(EntryKey,
+                                "ProviderId",
+                                0,
+                                &RegType,
+                                (LPBYTE)&CatalogEntry->ProviderId,
+                                &RegSize);
+    if (ErrorCode != ERROR_SUCCESS) goto out;
+    /* Read the Address Family */
+    RegType = REG_DWORD;
+    RegSize = sizeof(DWORD);
+    ErrorCode = RegQueryValueEx(EntryKey,
+                                "AddressFamily",
+                                0,
+                                &RegType,
+                                (LPBYTE)&CatalogEntry->AddressFamily,
+                                &RegSize);
+    if (ErrorCode != ERROR_SUCCESS) goto out;
+    /* Read the Namespace Id */
+    ErrorCode = RegQueryValueEx(EntryKey,
+                                "SupportedNamespace",
+                                0,
+                                &RegType,
+                                (LPBYTE)&CatalogEntry->NamespaceId,
+                                &RegSize);
+    if (ErrorCode != ERROR_SUCCESS) goto out;
+    /* Read the Enabled Flag */
+    ErrorCode = RegQueryValueEx(EntryKey,
+                                "Enabled",
+                                0,
+                                &RegType,
+                                (LPBYTE)&RegValue,
+                                &RegSize);
+    if (ErrorCode != ERROR_SUCCESS) goto out;
+    CatalogEntry->Enabled = RegValue != 0;
+
+    /* Read the Version */
+    ErrorCode = RegQueryValueEx(EntryKey,
+                                "Version",
+                                0,
+                                &RegType,
+                                (LPBYTE)&CatalogEntry->Version,
+                                &RegSize);
+    if (ErrorCode != ERROR_SUCCESS) goto out;
+    /* Read the Support Service Class Info Flag */
+    ErrorCode = RegQueryValueEx(EntryKey,
+                                "StoresServiceClassInfo",
+                                0,
+                                &RegType,
+                                (LPBYTE)&RegValue,
+                                &RegSize);
+    CatalogEntry->StoresServiceClassInfo = RegValue != 0;
+out:
+    /* Done */
+    RegCloseKey(EntryKey);
+    return ErrorCode;
+}
+
+VOID
+WSAAPI
+WsNcEntrySetProvider(IN PNSCATALOG_ENTRY Entry,
+                     IN PNS_PROVIDER Provider)
+{
+    /* Reference the provider */
+    InterlockedIncrement(&Provider->RefCount);
+
+    /* Set it */
+    Entry->Provider = Provider;
+}
similarity index 99%
rename from reactos/dll/win32/ws2_32_new/src/nsquery.c
rename to reactos/dll/win32/ws2_32/src/nsquery.c
index a9e6d92..5c22bfd 100644 (file)
@@ -360,7 +360,7 @@ WsNqLookupServiceBegin(IN PNSQUERY NsQuery,
 {
     WSASERVICECLASSINFOW ClassInfo;
     PNSQUERY_PROVIDER Provider;
-    LPWSASERVICECLASSINFOW pClassInfo = NULL;
+    LPWSASERVICECLASSINFOW pClassInfo = &ClassInfo;
     PNSQUERY_PROVIDER NextProvider;
     PLIST_ENTRY Entry;
     INT ErrorCode;
@@ -438,7 +438,7 @@ WsNqLookupServiceBegin(IN PNSQUERY NsQuery,
 
     /* Get the class information */
     ClassInfo.lpServiceClassId = Restrictions->lpServiceClassId;
-    ErrorCode = WsNcGetServiceClassInfo(Catalog, &ClassInfoSize, &ClassInfo);
+    ErrorCode = WsNcGetServiceClassInfo(Catalog, &ClassInfoSize, pClassInfo);
 
     /* Check if more buffer space is needed */
     if ((ErrorCode == SOCKET_ERROR) && (GetLastError() == WSAEFAULT))
similarity index 81%
rename from reactos/dll/win32/ws2_32_new/src/rnr.c
rename to reactos/dll/win32/ws2_32/src/rnr.c
index 7d6f5b3..518541c 100644 (file)
@@ -214,7 +214,7 @@ WSALookupServiceEnd(IN HANDLE hLookup)
     }
 
     /* Check for a valid handle, then validate and reference it */
-    if (!(Query) || !(WsNqValidateAndReference(Query)))
+    if (IsBadReadPtr(Query, sizeof(*Query)) || !WsNqValidateAndReference(Query))
     {
         /* Fail */
         SetLastError(WSA_INVALID_HANDLE);
@@ -249,7 +249,8 @@ WSALookupServiceBeginA(IN LPWSAQUERYSETA lpqsRestrictions,
     DPRINT("WSALookupServiceBeginA: %p\n", lpqsRestrictions);
 
     /* Verifiy pointer */
-    if (IsBadReadPtr(lpqsRestrictions, sizeof(*lpqsRestrictions)))
+    if (IsBadReadPtr(lpqsRestrictions, sizeof(*lpqsRestrictions)) || 
+        IsBadReadPtr(lpqsRestrictions->lpServiceClassId, sizeof(*lpqsRestrictions->lpServiceClassId)))
     {
         /* Invalid */
         SetLastError(WSAEFAULT);
@@ -334,7 +335,8 @@ WSALookupServiceBeginW(IN LPWSAQUERYSETW lpqsRestrictions,
 
     /* Verify pointers */
     if (IsBadWritePtr(lphLookup, sizeof(*lphLookup)) ||
-        IsBadReadPtr(lpqsRestrictions, sizeof(*lpqsRestrictions)))
+        IsBadReadPtr(lpqsRestrictions, sizeof(*lpqsRestrictions)) ||
+        IsBadReadPtr(lpqsRestrictions->lpServiceClassId, sizeof(*lpqsRestrictions->lpServiceClassId)))
     {
         /* They are invalid; fail */
         SetLastError(WSAEFAULT);
@@ -401,8 +403,16 @@ WSALookupServiceNextW(IN HANDLE hLookup,
         return SOCKET_ERROR;
     }
 
+    /* Verify pointer */
+    if (IsBadWritePtr(lpqsResults, sizeof(*lpqsResults)))
+    {
+        /* It is invalid; fail */
+        SetLastError(WSAEFAULT);
+        return SOCKET_ERROR;
+    }
+
     /* Check for a valid handle, then validate and reference it */
-    if (!(Query) || !(WsNqValidateAndReference(Query)))
+    if (IsBadReadPtr(Query, sizeof(*Query)) || !WsNqValidateAndReference(Query))
     {
         /* Fail */
         SetLastError(WSA_INVALID_HANDLE);
@@ -611,41 +621,187 @@ WSAInstallServiceClassA(IN LPWSASERVICECLASSINFOA lpServiceClassInfo)
 }
 
 /*
- * @unimplemented
- */
+* @unimplemented
+*/
 INT
 WSAAPI
-WSAEnumNameSpaceProvidersA(IN OUT LPDWORD lpdwBufferLength,
-                           OUT LPWSANAMESPACE_INFOA lpnspBuffer)
+WSAInstallServiceClassW(IN LPWSASERVICECLASSINFOW lpServiceClassInfo)
 {
-    DPRINT("WSAEnumNameSpaceProvidersA: %lx\n", lpnspBuffer);
+    DPRINT("WSAInstallServiceClassW: %lx\n", lpServiceClassInfo);
     SetLastError(WSAEINVAL);
     return SOCKET_ERROR;
 }
 
+VOID
+WSAAPI
+NSProviderInfoFromContext(IN PNSCATALOG_ENTRY Entry,
+    IN PNSPROVIDER_ENUM_CONTEXT Context)
+{
+    INT size = Context->Unicode ? sizeof(WSANAMESPACE_INFOW) : sizeof(WSANAMESPACE_INFOA);
+    /* Calculate ProviderName string size */
+    INT size1 = Entry->ProviderName ? wcslen(Entry->ProviderName) + 1 : 0;
+    INT size2 = Context->Unicode ? size1 * sizeof(WCHAR) : size1 * sizeof(CHAR);
+    WSANAMESPACE_INFOW infoW;
+    /* Fill NS Provider data */
+    infoW.dwNameSpace = Entry->NamespaceId;
+    infoW.dwVersion = Entry->Version;
+    infoW.fActive = Entry->Enabled;
+    RtlMoveMemory(&infoW.NSProviderId,
+        &Entry->ProviderId,
+        sizeof(infoW.NSProviderId));
+    if (size2)
+    {
+        /* Calculate ProviderName string pointer */
+        infoW.lpszIdentifier = (LPWSTR)((ULONG_PTR)Context->ProtocolBuffer +
+            Context->BufferUsed + size);
+    }
+    else
+    {
+        infoW.lpszIdentifier = NULL;
+    }
+
+    /* Check if we'll have space */
+    if ((Context->BufferUsed + size + size2) <=
+        (Context->BufferLength))
+    {
+        /* Copy the data */
+        RtlMoveMemory((PVOID)((ULONG_PTR)Context->ProtocolBuffer +
+            Context->BufferUsed),
+            &infoW,
+            size);
+        if (size2)
+        {
+            /* Entry->ProviderName is LPWSTR */
+            if (Context->Unicode)
+            {
+                RtlMoveMemory((PVOID)((ULONG_PTR)Context->ProtocolBuffer +
+                    Context->BufferUsed + size),
+                    Entry->ProviderName,
+                    size2);
+            }
+            else
+            {
+                /* Call the conversion function */
+                WideCharToMultiByte(CP_ACP,
+                    0,
+                    Entry->ProviderName,
+                    -1,
+                    (LPSTR)((ULONG_PTR)Context->ProtocolBuffer +
+                        Context->BufferUsed + size),
+                    size2,
+                    NULL,
+                    NULL);
+
+            }
+        }
+
+        /* Increase the count */
+        Context->Count++;
+    }
+}
+
+BOOL
+WSAAPI
+NSProvidersEnumerationProc(PVOID EnumContext,
+    PNSCATALOG_ENTRY Entry)
+{
+    PNSPROVIDER_ENUM_CONTEXT Context = (PNSPROVIDER_ENUM_CONTEXT)EnumContext;
+
+    /* Calculate ProviderName string size */
+    INT size1 = Entry->ProviderName ? wcslen(Entry->ProviderName) + 1 : 0;
+    INT size2 = Context->Unicode ? size1 * sizeof(WCHAR) : size1 * sizeof(CHAR);
+
+    /* Copy the information */
+    NSProviderInfoFromContext(Entry, Context);
+    Context->BufferUsed += Context->Unicode ? (sizeof(WSANAMESPACE_INFOW)+size2) : (sizeof(WSANAMESPACE_INFOA)+size2);
+
+    /* Continue enumeration */
+    return TRUE;
+}
+
+INT
+WSAAPI
+WSAEnumNameSpaceProvidersInternal(IN OUT LPDWORD lpdwBufferLength,
+    OUT LPWSANAMESPACE_INFOA lpnspBuffer, BOOLEAN Unicode)
+{
+    INT Status;
+    PWSPROCESS WsProcess;
+    PNSCATALOG Catalog;
+    NSPROVIDER_ENUM_CONTEXT Context;
+    DPRINT("WSAEnumNameSpaceProvidersInternal: %lx\n", lpnspBuffer);
+
+    if (!lpdwBufferLength)
+    {
+        WSASetLastError(WSAEFAULT);
+        return SOCKET_ERROR;
+    }
+    WsProcess = WsGetProcess();
+    /* Create a catalog object from the current one */
+    Catalog = WsProcGetNsCatalog(WsProcess);
+    if (!Catalog)
+    {
+        /* Fail if we couldn't */
+        WSASetLastError(WSA_NOT_ENOUGH_MEMORY);
+        return SOCKET_ERROR;
+    }
+
+    Context.ProtocolBuffer = lpnspBuffer;
+    Context.BufferLength = lpnspBuffer ? *lpdwBufferLength : 0;
+    Context.BufferUsed = 0;
+    Context.Count = 0;
+    Context.Unicode = Unicode;
+    Context.ErrorCode = ERROR_SUCCESS;
+
+    WsNcEnumerateCatalogItems(Catalog, NSProvidersEnumerationProc, &Context);
+
+    /* Get status */
+    Status = Context.Count;
+
+    /* Check the error code */
+    if (Context.ErrorCode == ERROR_SUCCESS)
+    {
+        /* Check if enough space was available */
+        if (Context.BufferLength < Context.BufferUsed)
+        {
+            /* Fail and tell them how much we need */
+            *lpdwBufferLength = Context.BufferUsed;
+            WSASetLastError(WSAEFAULT);
+            Status = SOCKET_ERROR;
+        }
+    }
+    else
+    {
+        /* Failure, normalize error */
+        Status = SOCKET_ERROR;
+        WSASetLastError(Context.ErrorCode);
+    }
+
+    /* Return */
+    return Status;
+}
+
 /*
- * @unimplemented
+ * @implemented
  */
 INT
 WSAAPI
-WSAEnumNameSpaceProvidersW(IN OUT LPDWORD lpdwBufferLength,
-                           OUT LPWSANAMESPACE_INFOW lpnspBuffer)
+WSAEnumNameSpaceProvidersA(IN OUT LPDWORD lpdwBufferLength,
+                           OUT LPWSANAMESPACE_INFOA lpnspBuffer)
 {
-    DPRINT("WSAEnumNameSpaceProvidersW: %lx\n", lpnspBuffer);
-    SetLastError(WSAEINVAL);
-    return SOCKET_ERROR;
+    DPRINT("WSAEnumNameSpaceProvidersA: %lx\n", lpnspBuffer);
+    return WSAEnumNameSpaceProvidersInternal(lpdwBufferLength, (LPWSANAMESPACE_INFOA)lpnspBuffer, FALSE);
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 INT
 WSAAPI
-WSAInstallServiceClassW(IN LPWSASERVICECLASSINFOW lpServiceClassInfo)
+WSAEnumNameSpaceProvidersW(IN OUT LPDWORD lpdwBufferLength,
+                           OUT LPWSANAMESPACE_INFOW lpnspBuffer)
 {
-    DPRINT("WSAInstallServiceClassW: %lx\n", lpServiceClassInfo);
-    SetLastError(WSAEINVAL);
-    return SOCKET_ERROR;
+    DPRINT("WSAEnumNameSpaceProvidersW: %lx\n", lpnspBuffer);
+    return WSAEnumNameSpaceProvidersInternal(lpdwBufferLength, (LPWSANAMESPACE_INFOA)lpnspBuffer, TRUE);
 }
 
 /*
similarity index 99%
rename from reactos/dll/win32/ws2_32_new/src/send.c
rename to reactos/dll/win32/ws2_32/src/send.c
index 0158d7d..ce47866 100644 (file)
@@ -31,7 +31,7 @@ send(IN SOCKET s,
     LPWSATHREADID ThreadId;
     WSABUF Buffers;
     DWORD BytesSent;
-    DPRINT("send: %lx, %lx, %lx, %p\n", s, flags, len, buf);
+    DPRINT("sendto: %lx, %lx, %lx, %p\n", s, flags, len, buf);
 
     /* Check for WSAStartup */
     if ((ErrorCode = WsQuickPrologTid(&ThreadId)) == ERROR_SUCCESS)
similarity index 99%
rename from reactos/dll/win32/ws2_32_new/src/sockctrl.c
rename to reactos/dll/win32/ws2_32/src/sockctrl.c
index c399b1a..0aa512a 100644 (file)
@@ -441,6 +441,11 @@ setsockopt(IN SOCKET s,
 
             return Status;
         }
+        if (!optval && optlen > 0)
+        {
+            SetLastError(WSAEFAULT);
+            return SOCKET_ERROR;
+        }
 
         /* Get the Socket Context */
         if ((Socket = WsSockGetSocket(s)))
similarity index 97%
rename from reactos/dll/win32/ws2_32_new/src/socklife.c
rename to reactos/dll/win32/ws2_32/src/socklife.c
index e698dac..f532a27 100644 (file)
@@ -566,6 +566,20 @@ DoLookup:
             goto DoLookup;
         }
 
+        /* Check if we got a valid socket */
+        if (Status == WSAEINVAL)
+        {
+            Status = INVALID_SOCKET;
+            ErrorCode = WSAEINVAL;
+        }
+
+        /* Check if we got a valid socket */
+        if (Status == WSAEINVAL)
+        {
+            Status = INVALID_SOCKET;
+            ErrorCode = WSAEINVAL;
+        }
+
         /* Check if we got a valid socket */
         if (Status != INVALID_SOCKET)
         {
similarity index 85%
rename from reactos/dll/win32/ws2_32_new/src/startup.c
rename to reactos/dll/win32/ws2_32/src/startup.c
index fb7c868..c63b581 100644 (file)
@@ -83,11 +83,16 @@ WSACleanup(VOID)
             WsAsyncTerminateThread();
         }
 
+        DPRINT("WSACleanup RefCount = %ld\n", RefCount);
         /* Return success */
         ErrorCode = ERROR_SUCCESS;
+
+        /* Clear last error */
+        SetLastError(ERROR_SUCCESS);
     }
     else
     {
+        DPRINT("WSACleanup unintialized\n");
         /* Weren't initialized */
         SetLastError(ErrorCode);
         ErrorCode = SOCKET_ERROR;
@@ -111,7 +116,7 @@ WSAStartup(IN WORD wVersionRequested,
     WORD VersionReturned = 0;
     DWORD ErrorCode = ERROR_SUCCESS;
     PWSPROCESS CurrentProcess;
-    DPRINT("WSAStartup: %wx\n", wVersionRequested);
+    DPRINT("WSAStartup: %wx %d.%d\n", wVersionRequested, LOBYTE(wVersionRequested), HIBYTE(wVersionRequested));
 
     /* Make sure that we went through DLL Init */
     if (!WsDllHandle) return WSASYSNOTREADY;
@@ -123,14 +128,15 @@ WSAStartup(IN WORD wVersionRequested,
 
             /* We don't support this unknown version */
             ErrorCode = WSAVERNOTSUPPORTED;
+            VersionReturned = MAKEWORD(2, 2);
             break;
 
         case 1:
             /* We support only 1.0 and 1.1 */
-            if (HIBYTE(wVersionRequested) == 0)
+            if (HIBYTE(wVersionRequested) <= 1)
             {
                 /* Caller wants 1.0, return it */
-                VersionReturned = wVersionRequested;
+                VersionReturned = MAKEWORD(1, HIBYTE(wVersionRequested));
             }
             else
             {
@@ -160,6 +166,12 @@ WSAStartup(IN WORD wVersionRequested,
             break;
     }
 
+    if (lpWSAData == NULL)
+    {
+        SetLastError(WSANOTINITIALISED);
+        return ErrorCode == ERROR_SUCCESS ? WSAEFAULT : ErrorCode;
+    }
+
     /* Return the Version Requested, unless error */
     lpWSAData->wVersion = VersionReturned;
 
@@ -182,6 +194,13 @@ WSAStartup(IN WORD wVersionRequested,
         lpWSAData->iMaxSockets = 0;
         lpWSAData->iMaxUdpDg = 0;
     }
+    /* Requested invalid version (0) */
+    if (ErrorCode != ERROR_SUCCESS)
+    {
+        SetLastError(WSANOTINITIALISED);
+        return ErrorCode;
+    }
 
     /* Enter the startup synchronization lock */
     WsStartupLock();
@@ -223,6 +242,14 @@ WSAStartup(IN WORD wVersionRequested,
 
         /* Increase the reference count */
         InterlockedIncrement(&CurrentProcess->RefCount);
+        DPRINT("WSAStartup RefCount = %ld\n", CurrentProcess->RefCount);
+
+        /* Clear last error */
+        SetLastError(ERROR_SUCCESS);
+    }
+    else
+    {
+        SetLastError(WSANOTINITIALISED);
     }
 
     /* Leave the startup lock */
index a30ac5d..e0e14b7 100644 (file)
-1 stdcall accept(long ptr ptr)
-2 stdcall bind(long ptr long)
-3 stdcall closesocket(long)
-4 stdcall connect(long ptr long)
-5 stdcall getpeername(long ptr ptr)
-6 stdcall getsockname(long ptr ptr)
-7 stdcall getsockopt(long long long ptr ptr)
-8 stdcall htonl(long)
-9 stdcall htons(long)
-10 stdcall ioctlsocket(long long ptr)
-11 stdcall inet_addr(str)
-12 stdcall inet_ntoa(ptr)
-13 stdcall listen(long long)
-14 stdcall ntohl(long)
-15 stdcall ntohs(long)
-16 stdcall recv(long ptr long long)
-17 stdcall recvfrom(long ptr long long ptr ptr)
-18 stdcall select(long ptr ptr ptr ptr)
-19 stdcall send(long ptr long long)
-20 stdcall sendto(long ptr long long ptr long)
-21 stdcall setsockopt(long long long ptr long)
-22 stdcall shutdown(long long)
-23 stdcall socket(long long long)
-24 stdcall WSApSetPostRoutine(ptr)
-25 stdcall FreeAddrInfoW(ptr) freeaddrinfo
-26 stdcall GetAddrInfoW(wstr wstr ptr ptr)
-27 stdcall GetNameInfoW(ptr long wstr long wstr long long)
-28 stdcall WPUCompleteOverlappedRequest(long ptr long long ptr)
-29 stdcall WSAAccept(long ptr ptr ptr long)
-30 stdcall WSAAddressToStringA(ptr long ptr ptr ptr)
-31 stdcall WSAAddressToStringW(ptr long ptr ptr ptr)
-32 stdcall WSACloseEvent(long)
-33 stdcall WSAConnect(long ptr long ptr ptr ptr ptr)
-34 stdcall WSACreateEvent ()
-35 stdcall WSADuplicateSocketA(long long ptr)
-36 stdcall WSADuplicateSocketW(long long ptr)
-37 stdcall WSAEnumNameSpaceProvidersA(ptr ptr)
-38 stdcall WSAEnumNameSpaceProvidersW(ptr ptr)
-39 stdcall WSAEnumNetworkEvents(long long ptr)
-40 stdcall WSAEnumProtocolsA(ptr ptr ptr)
-41 stdcall WSAEnumProtocolsW(ptr ptr ptr)
-42 stdcall WSAEventSelect(long long long)
-43 stdcall WSAGetOverlappedResult(long ptr ptr long ptr)
-44 stdcall WSAGetQOSByName(long ptr ptr)
-45 stdcall WSAGetServiceClassInfoA(ptr ptr ptr ptr)
-46 stdcall WSAGetServiceClassInfoW(ptr ptr ptr ptr)
-47 stdcall WSAGetServiceClassNameByClassIdA(ptr ptr ptr)
-48 stdcall WSAGetServiceClassNameByClassIdW(ptr ptr ptr)
-49 stdcall WSAHtonl(long long ptr)
-50 stdcall WSAHtons(long long ptr)
-51 stdcall gethostbyaddr(ptr long long)
-52 stdcall gethostbyname(str)
-53 stdcall getprotobyname(str)
-54 stdcall getprotobynumber(long)
-55 stdcall getservbyname(str str)
-56 stdcall getservbyport(long str)
-57 stdcall gethostname(ptr long)
-58 stdcall WSAInstallServiceClassA(ptr)
-59 stdcall WSAInstallServiceClassW(ptr)
-60 stdcall WSAIoctl(long long ptr long ptr long ptr ptr ptr)
-61 stdcall WSAJoinLeaf(long ptr long ptr ptr ptr ptr long)
-62 stdcall WSALookupServiceBeginA(ptr long ptr)
-63 stdcall WSALookupServiceBeginW(ptr long ptr)
-64 stdcall WSALookupServiceEnd(long)
-65 stdcall WSALookupServiceNextA(long long ptr ptr)
-66 stdcall WSALookupServiceNextW(long long ptr ptr)
-67 stdcall WSANSPIoctl(ptr long ptr long ptr long ptr ptr)
-68 stdcall WSANtohl(long long ptr)
-69 stdcall WSANtohs(long long ptr)
-70 stdcall WSAProviderConfigChange(ptr ptr ptr)
-71 stdcall WSARecv(long ptr long ptr ptr ptr ptr)
-72 stdcall WSARecvDisconnect(long ptr)
-73 stdcall WSARecvFrom(long ptr long ptr ptr ptr ptr ptr ptr )
-74 stdcall WSARemoveServiceClass(ptr)
-75 stdcall WSAResetEvent(long) kernel32.ResetEvent
-76 stdcall WSASend(long ptr long ptr long ptr ptr)
-77 stdcall WSASendDisconnect(long ptr)
-78 stdcall WSASendTo(long ptr long ptr long ptr long ptr ptr)
-79 stdcall WSASetEvent(long) kernel32.SetEvent
-80 stdcall WSASetServiceA(ptr long long)
-81 stdcall WSASetServiceW(ptr long long)
-82 stdcall WSASocketA(long long long ptr long long)
-83 stdcall WSASocketW(long long long ptr long long)
-84 stdcall WSAStringToAddressA(str long ptr ptr ptr)
-85 stdcall WSAStringToAddressW(wstr long ptr ptr ptr)
-86 stdcall WSAWaitForMultipleEvents(long ptr long long long) kernel32.WaitForMultipleObjectsEx
-87 stdcall WSCDeinstallProvider(ptr ptr)
-88 stdcall WSCEnableNSProvider(ptr long)
-89 stdcall WSCEnumProtocols(ptr ptr ptr ptr)
-90 stdcall WSCGetProviderPath(ptr ptr ptr ptr)
-91 stdcall WSCInstallNameSpace(wstr wstr long long ptr)
-92 stdcall WSCInstallProvider(ptr wstr ptr long ptr)
-93 stdcall WSCUnInstallNameSpace(ptr)
-94 stdcall WSCUpdateProvider(ptr ptr ptr long ptr)
-95 stdcall WSCWriteNameSpaceOrder(ptr long)
-96 stdcall WSCWriteProviderOrder(ptr long)
-97 stdcall freeaddrinfo(ptr)
-98 stdcall getaddrinfo(str str ptr ptr)
-99 stdcall getnameinfo(ptr long ptr long ptr long long)
-101 stdcall WSAAsyncSelect(long long long long)
+500 stdcall WEP()
+@ stdcall WPUCompleteOverlappedRequest(long ptr long long ptr)
+@ stdcall WSAAccept(long ptr ptr ptr long)
+@ stdcall WSAAddressToStringA(ptr long ptr ptr ptr)
+@ stdcall WSAAddressToStringW(ptr long ptr ptr ptr)
 102 stdcall WSAAsyncGetHostByAddr(long long ptr long long ptr long)
 103 stdcall WSAAsyncGetHostByName(long long str ptr long)
-104 stdcall WSAAsyncGetProtoByNumber(long long long ptr long)
 105 stdcall WSAAsyncGetProtoByName(long long str ptr long)
-106 stdcall WSAAsyncGetServByPort(long long long str ptr long)
+104 stdcall WSAAsyncGetProtoByNumber(long long long ptr long)
 107 stdcall WSAAsyncGetServByName(long long str str ptr long)
+106 stdcall WSAAsyncGetServByPort(long long long str ptr long)
+101 stdcall WSAAsyncSelect(long long long long)
 108 stdcall WSACancelAsyncRequest(long)
-109 stdcall WSASetBlockingHook(ptr)
-110 stdcall WSAUnhookBlockingHook()
-111 stdcall WSAGetLastError()
-112 stdcall WSASetLastError(long)
 113 stdcall WSACancelBlockingCall()
+116 stdcall WSACleanup()
+@ stdcall WSACloseEvent(long)
+@ stdcall WSAConnect(long ptr long ptr ptr ptr ptr)
+@ stdcall WSACreateEvent ()
+@ stdcall WSADuplicateSocketA(long long ptr)
+@ stdcall WSADuplicateSocketW(long long ptr)
+@ stdcall WSAEnumNameSpaceProvidersA(ptr ptr)
+@ stdcall WSAEnumNameSpaceProvidersW(ptr ptr)
+@ stdcall WSAEnumNetworkEvents(long long ptr)
+@ stdcall WSAEnumProtocolsA(ptr ptr ptr)
+@ stdcall WSAEnumProtocolsW(ptr ptr ptr)
+@ stdcall WSAEventSelect(long long long)
+111 stdcall WSAGetLastError()
+@ stdcall WSAGetOverlappedResult(long ptr ptr long ptr)
+@ stdcall WSAGetQOSByName(long ptr ptr)
+@ stdcall WSAGetServiceClassInfoA(ptr ptr ptr ptr)
+@ stdcall WSAGetServiceClassInfoW(ptr ptr ptr ptr)
+@ stdcall WSAGetServiceClassNameByClassIdA(ptr ptr ptr)
+@ stdcall WSAGetServiceClassNameByClassIdW(ptr ptr ptr)
+@ stdcall WSAHtonl(long long ptr)
+@ stdcall WSAHtons(long long ptr)
+@ stdcall WSAInstallServiceClassA(ptr)
+@ stdcall WSAInstallServiceClassW(ptr)
+@ stdcall WSAIoctl(long long ptr long ptr long ptr ptr ptr)
 114 stdcall WSAIsBlocking()
+@ stdcall WSAJoinLeaf(long ptr long ptr ptr ptr ptr long)
+@ stdcall WSALookupServiceBeginA(ptr long ptr)
+@ stdcall WSALookupServiceBeginW(ptr long ptr)
+@ stdcall WSALookupServiceEnd(long)
+@ stdcall WSALookupServiceNextA(long long ptr ptr)
+@ stdcall WSALookupServiceNextW(long long ptr ptr)
+@ stdcall WSANSPIoctl(long long ptr long ptr long ptr ptr)
+@ stdcall WSANtohl(long long ptr)
+@ stdcall WSANtohs(long long ptr)
+@ stdcall WSAProviderConfigChange(ptr ptr ptr)
+@ stdcall WSARecv(long ptr long ptr ptr ptr ptr)
+@ stdcall WSARecvDisconnect(long ptr)
+@ stdcall WSARecvFrom(long ptr long ptr ptr ptr ptr ptr ptr)
+@ stdcall WSARemoveServiceClass(ptr)
+@ stdcall WSAResetEvent(long)
+@ stdcall WSASend(long ptr long ptr long ptr ptr)
+@ stdcall WSASendDisconnect(long ptr)
+@ stdcall WSASendTo(long ptr long ptr long ptr long ptr ptr)
+109 stdcall WSASetBlockingHook(ptr)
+@ stdcall WSASetEvent(long)
+112 stdcall WSASetLastError(long)
+@ stdcall WSASetServiceA(ptr long long)
+@ stdcall WSASetServiceW(ptr long long)
+@ stdcall WSASocketA(long long long ptr long long)
+@ stdcall WSASocketW(long long long ptr long long)
 115 stdcall WSAStartup(long ptr)
-116 stdcall WSACleanup()
-151 stdcall __WSAFDIsSet(long ptr)
-500 stdcall WEP()
+@ stdcall WSAStringToAddressA(str long ptr ptr ptr)
+@ stdcall WSAStringToAddressW(wstr long ptr ptr ptr)
+110 stdcall WSAUnhookBlockingHook()
+@ stdcall WSAWaitForMultipleEvents(long ptr long long long)
+@ stdcall WSApSetPostRoutine(ptr)
+@ stdcall FreeAddrInfoW(ptr) freeaddrinfo
+@ stdcall WSCDeinstallProvider(ptr ptr)
+@ stdcall WSCEnableNSProvider(ptr long)
+@ stdcall WSCEnumProtocols(ptr ptr ptr ptr)
+@ stdcall WSCGetProviderPath(ptr ptr ptr ptr)
+@ stdcall WSCInstallNameSpace(wstr wstr long long ptr)
+@ stdcall WSCInstallProvider(ptr wstr ptr long ptr)
+@ stdcall WSCUnInstallNameSpace(ptr)
+@ stdcall WSCUpdateProvider(ptr ptr ptr long ptr)
+@ stdcall WSCWriteNameSpaceOrder(ptr long)
+@ stdcall WSCWriteProviderOrder(ptr long)
+151 stdcall  __WSAFDIsSet(long ptr)
+1   stdcall  accept(long ptr ptr)
+2   stdcall  bind(long ptr long)
+3   stdcall  closesocket(long)
+4   stdcall  connect(long ptr long)
+@ stdcall freeaddrinfo(ptr)
+@ stdcall getaddrinfo(str str ptr ptr)
+51  stdcall  gethostbyaddr(ptr long long)
+52  stdcall  gethostbyname(str)
+57  stdcall  gethostname(ptr long)
+@ stdcall getnameinfo(ptr long ptr long ptr long long)
+5   stdcall  getpeername(long ptr ptr)
+53  stdcall  getprotobyname(str)
+54  stdcall  getprotobynumber(long)
+55  stdcall  getservbyname(str str)
+56  stdcall  getservbyport(long str)
+6   stdcall  getsockname(long ptr ptr)
+7   stdcall  getsockopt(long long long ptr ptr)
+8   stdcall  htonl(long)
+9   stdcall  htons(long)
+11  stdcall  inet_addr(str)
+12  stdcall  inet_ntoa(ptr)
+10  stdcall  ioctlsocket(long long ptr)
+13  stdcall  listen(long long)
+14  stdcall  ntohl(long)
+15  stdcall  ntohs(long)
+16  stdcall  recv(long ptr long long)
+17  stdcall  recvfrom(long ptr long long ptr ptr)
+18  stdcall  select(long ptr ptr ptr ptr)
+19  stdcall  send(long ptr long long)
+20  stdcall  sendto(long ptr long long ptr long)
+21  stdcall  setsockopt(long long long ptr long)
+22  stdcall  shutdown(long long)
+23  stdcall  socket(long long long)
+@ stdcall GetAddrInfoW(wstr wstr ptr ptr)
+@ stdcall GetNameInfoW(ptr long wstr long wstr long long)
diff --git a/reactos/dll/win32/ws2_32_new/CMakeLists.txt b/reactos/dll/win32/ws2_32_new/CMakeLists.txt
deleted file mode 100644 (file)
index 0271283..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-
-add_definitions(-DLE)
-spec2def(ws2_32_new.dll ws2_32.spec)
-
-include_directories(
-    inc
-    ${REACTOS_SOURCE_DIR}/sdk/include/reactos/winsock)
-
-list(APPEND SOURCE
-    src/addrconv.c
-    src/addrinfo.c
-    src/async.c
-    src/bhook.c
-    src/dcatalog.c
-    src/dcatitem.c
-    src/dllmain.c
-    src/dprocess.c
-    src/dprovide.c
-    src/dsocket.c
-    src/dthread.c
-    src/dupsock.c
-    src/enumprot.c
-    src/event.c
-    src/getproto.c
-    src/getxbyxx.c
-    src/ioctl.c
-    src/nscatalo.c
-    src/nscatent.c
-    src/nspinstl.c
-    src/nsprovid.c
-    src/nsquery.c
-    src/qos.c
-    src/qshelpr.c
-    src/rasdial.c
-    src/recv.c
-    src/rnr.c
-    #src/scihlpr.c
-    src/select.c
-    src/send.c
-    src/sockctrl.c
-    src/socklife.c
-    src/spinstal.c
-    src/sputil.c
-    src/startup.c
-    src/wsautil.c
-    inc/ws2_32.h)
-
-add_library(ws2_32_new SHARED
-    ${SOURCE}
-    ws2_32.rc
-    ${CMAKE_CURRENT_BINARY_DIR}/ws2_32_new.def)
-
-set_module_type(ws2_32_new win32dll)
-target_link_libraries(ws2_32_new ${PSEH_LIB})
-add_importlibs(ws2_32_new user32 advapi32 ws2help msvcrt kernel32 ntdll)
-add_pch(ws2_32_new inc/ws2_32.h SOURCE)
-add_cd_file(TARGET ws2_32_new DESTINATION reactos/system32 FOR all)
diff --git a/reactos/dll/win32/ws2_32_new/src/nscatent.c b/reactos/dll/win32/ws2_32_new/src/nscatent.c
deleted file mode 100644 (file)
index 31b869e..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS WinSock 2 API
- * FILE:        dll/win32/ws2_32_new/src/nscatent.c
- * PURPOSE:     Namespace Catalog Entry Object
- * PROGRAMMER:  Alex Ionescu (alex@relsoft.net)
- */
-
-/* INCLUDES ******************************************************************/
-
-#include <ws2_32.h>
-
-/* FUNCTIONS *****************************************************************/
-
-PNSCATALOG_ENTRY
-WSAAPI
-WsNcEntryAllocate(VOID)
-{
-    PNSCATALOG_ENTRY CatalogEntry;
-
-    /* Allocate the catalog */
-    CatalogEntry = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*CatalogEntry));
-
-    /* Set the default non-null members */
-    CatalogEntry->RefCount = 1;
-    CatalogEntry->Enabled = TRUE;
-    CatalogEntry->AddressFamily = -1;
-
-    /* Return it */
-    return CatalogEntry;
-}
-
-VOID
-WSAAPI
-WsNcEntryDelete(IN PNSCATALOG_ENTRY CatalogEntry)
-{
-    /* Check if a provider is loaded */
-    if (CatalogEntry->Provider)
-    {
-        /* Dereference it too */
-        WsNpDereference(CatalogEntry->Provider);
-        CatalogEntry->Provider = NULL;
-    }
-
-    /* Delete us */
-    HeapFree(WsSockHeap, 0, CatalogEntry);
-}
-
-VOID
-WSAAPI
-WsNcEntryDereference(IN PNSCATALOG_ENTRY CatalogEntry)
-{
-    /* Dereference and check if it's now 0 */
-    if (!(InterlockedDecrement(&CatalogEntry->RefCount)))
-    {
-        /* We can delete the Provider now */
-        WsNcEntryDelete(CatalogEntry);
-    }
-}
-
-INT
-WSAAPI
-WsNcEntryInitializeFromRegistry(IN PNSCATALOG_ENTRY CatalogEntry,
-                                IN HKEY ParentKey,
-                                IN ULONG UniqueId)
-{
-    CHAR CatalogEntryName[13];
-    HKEY EntryKey;
-    ULONG RegType = REG_SZ;
-    ULONG RegSize = MAX_PATH;
-
-    /* Convert to a 00000xxx string */
-    sprintf(CatalogEntryName, "%0""12""i", (int)UniqueId);
-
-    /* Open the Entry */
-    RegOpenKeyEx(ParentKey,
-                 CatalogEntryName,
-                 0,
-                 KEY_READ,
-                 &EntryKey);
-
-    /* Read the Library Path */
-    RegQueryValueExW(EntryKey,
-                     L"LibraryPath",
-                     0,
-                     &RegType,
-                     (LPBYTE)&CatalogEntry->DllPath,
-                     &RegSize);
-
-    /* Query Display String Size*/
-    RegQueryValueExW(EntryKey,
-                     L"DisplayString",
-                     0,
-                     NULL,
-                     NULL,
-                     &RegSize);
-
-    /* Allocate it */
-    CatalogEntry->ProviderName = (LPWSTR)HeapAlloc(WsSockHeap, 0, RegSize);
-
-    /* Read it */
-    RegQueryValueExW(EntryKey,
-                     L"DisplayString",
-                     0,
-                     &RegType,
-                     (LPBYTE)CatalogEntry->ProviderName,
-                     &RegSize);
-
-    /* Read the Provider Id */
-    RegType = REG_BINARY;
-    RegSize = sizeof(GUID);
-    RegQueryValueEx(EntryKey,
-                    "ProviderId",
-                    0,
-                    &RegType,
-                    (LPBYTE)&CatalogEntry->ProviderId,
-                    &RegSize);
-
-    /* Read the Address Family */
-    RegType = REG_DWORD;
-    RegSize = sizeof(DWORD);
-    RegQueryValueEx(EntryKey,
-                    "AddressFamily",
-                    0,
-                    &RegType,
-                    (LPBYTE)&CatalogEntry->AddressFamily,
-                    &RegSize);
-
-    /* Read the Namespace Id */
-    RegQueryValueEx(EntryKey,
-                    "SupportedNamespace",
-                    0,
-                    &RegType,
-                    (LPBYTE)&CatalogEntry->NamespaceId,
-                    &RegSize);
-
-    /* Read the Enabled Flag */
-    RegQueryValueEx(EntryKey,
-                    "Enabled",
-                    0,
-                    &RegType,
-                    (LPBYTE)&CatalogEntry->Enabled,
-                    &RegSize);
-
-    /* Read the Version */
-    RegQueryValueEx(EntryKey,
-                    "Version",
-                    0,
-                    &RegType,
-                    (LPBYTE)&CatalogEntry->Version,
-                    &RegSize);
-
-    /* Read the Support Service Class Info Flag */
-    RegQueryValueEx(EntryKey,
-                    "Version",
-                    0,
-                    &RegType,
-                    (LPBYTE)&CatalogEntry->StoresServiceClassInfo,
-                    &RegSize);
-
-    /* Done */
-    RegCloseKey(EntryKey);
-    return ERROR_SUCCESS;
-}
-
-VOID
-WSAAPI
-WsNcEntrySetProvider(IN PNSCATALOG_ENTRY Entry,
-                     IN PNS_PROVIDER Provider)
-{
-    /* Reference the provider */
-    InterlockedIncrement(&Provider->RefCount);
-
-    /* Set it */
-    Entry->Provider = Provider;
-}
diff --git a/reactos/dll/win32/ws2_32_new/ws2_32.rc b/reactos/dll/win32/ws2_32_new/ws2_32.rc
deleted file mode 100644 (file)
index b4f5424..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#define REACTOS_VERSION_DLL
-#define REACTOS_STR_FILE_DESCRIPTION  "Windows Sockets 2 DLL"
-#define REACTOS_STR_INTERNAL_NAME     "ws2_32"
-#define REACTOS_STR_ORIGINAL_FILENAME "ws2_32.dll"
-#include <reactos/version.rc>
diff --git a/reactos/dll/win32/ws2_32_new/ws2_32.spec b/reactos/dll/win32/ws2_32_new/ws2_32.spec
deleted file mode 100644 (file)
index e0e14b7..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-500 stdcall WEP()
-@ stdcall WPUCompleteOverlappedRequest(long ptr long long ptr)
-@ stdcall WSAAccept(long ptr ptr ptr long)
-@ stdcall WSAAddressToStringA(ptr long ptr ptr ptr)
-@ stdcall WSAAddressToStringW(ptr long ptr ptr ptr)
-102 stdcall WSAAsyncGetHostByAddr(long long ptr long long ptr long)
-103 stdcall WSAAsyncGetHostByName(long long str ptr long)
-105 stdcall WSAAsyncGetProtoByName(long long str ptr long)
-104 stdcall WSAAsyncGetProtoByNumber(long long long ptr long)
-107 stdcall WSAAsyncGetServByName(long long str str ptr long)
-106 stdcall WSAAsyncGetServByPort(long long long str ptr long)
-101 stdcall WSAAsyncSelect(long long long long)
-108 stdcall WSACancelAsyncRequest(long)
-113 stdcall WSACancelBlockingCall()
-116 stdcall WSACleanup()
-@ stdcall WSACloseEvent(long)
-@ stdcall WSAConnect(long ptr long ptr ptr ptr ptr)
-@ stdcall WSACreateEvent ()
-@ stdcall WSADuplicateSocketA(long long ptr)
-@ stdcall WSADuplicateSocketW(long long ptr)
-@ stdcall WSAEnumNameSpaceProvidersA(ptr ptr)
-@ stdcall WSAEnumNameSpaceProvidersW(ptr ptr)
-@ stdcall WSAEnumNetworkEvents(long long ptr)
-@ stdcall WSAEnumProtocolsA(ptr ptr ptr)
-@ stdcall WSAEnumProtocolsW(ptr ptr ptr)
-@ stdcall WSAEventSelect(long long long)
-111 stdcall WSAGetLastError()
-@ stdcall WSAGetOverlappedResult(long ptr ptr long ptr)
-@ stdcall WSAGetQOSByName(long ptr ptr)
-@ stdcall WSAGetServiceClassInfoA(ptr ptr ptr ptr)
-@ stdcall WSAGetServiceClassInfoW(ptr ptr ptr ptr)
-@ stdcall WSAGetServiceClassNameByClassIdA(ptr ptr ptr)
-@ stdcall WSAGetServiceClassNameByClassIdW(ptr ptr ptr)
-@ stdcall WSAHtonl(long long ptr)
-@ stdcall WSAHtons(long long ptr)
-@ stdcall WSAInstallServiceClassA(ptr)
-@ stdcall WSAInstallServiceClassW(ptr)
-@ stdcall WSAIoctl(long long ptr long ptr long ptr ptr ptr)
-114 stdcall WSAIsBlocking()
-@ stdcall WSAJoinLeaf(long ptr long ptr ptr ptr ptr long)
-@ stdcall WSALookupServiceBeginA(ptr long ptr)
-@ stdcall WSALookupServiceBeginW(ptr long ptr)
-@ stdcall WSALookupServiceEnd(long)
-@ stdcall WSALookupServiceNextA(long long ptr ptr)
-@ stdcall WSALookupServiceNextW(long long ptr ptr)
-@ stdcall WSANSPIoctl(long long ptr long ptr long ptr ptr)
-@ stdcall WSANtohl(long long ptr)
-@ stdcall WSANtohs(long long ptr)
-@ stdcall WSAProviderConfigChange(ptr ptr ptr)
-@ stdcall WSARecv(long ptr long ptr ptr ptr ptr)
-@ stdcall WSARecvDisconnect(long ptr)
-@ stdcall WSARecvFrom(long ptr long ptr ptr ptr ptr ptr ptr)
-@ stdcall WSARemoveServiceClass(ptr)
-@ stdcall WSAResetEvent(long)
-@ stdcall WSASend(long ptr long ptr long ptr ptr)
-@ stdcall WSASendDisconnect(long ptr)
-@ stdcall WSASendTo(long ptr long ptr long ptr long ptr ptr)
-109 stdcall WSASetBlockingHook(ptr)
-@ stdcall WSASetEvent(long)
-112 stdcall WSASetLastError(long)
-@ stdcall WSASetServiceA(ptr long long)
-@ stdcall WSASetServiceW(ptr long long)
-@ stdcall WSASocketA(long long long ptr long long)
-@ stdcall WSASocketW(long long long ptr long long)
-115 stdcall WSAStartup(long ptr)
-@ stdcall WSAStringToAddressA(str long ptr ptr ptr)
-@ stdcall WSAStringToAddressW(wstr long ptr ptr ptr)
-110 stdcall WSAUnhookBlockingHook()
-@ stdcall WSAWaitForMultipleEvents(long ptr long long long)
-@ stdcall WSApSetPostRoutine(ptr)
-@ stdcall FreeAddrInfoW(ptr) freeaddrinfo
-@ stdcall WSCDeinstallProvider(ptr ptr)
-@ stdcall WSCEnableNSProvider(ptr long)
-@ stdcall WSCEnumProtocols(ptr ptr ptr ptr)
-@ stdcall WSCGetProviderPath(ptr ptr ptr ptr)
-@ stdcall WSCInstallNameSpace(wstr wstr long long ptr)
-@ stdcall WSCInstallProvider(ptr wstr ptr long ptr)
-@ stdcall WSCUnInstallNameSpace(ptr)
-@ stdcall WSCUpdateProvider(ptr ptr ptr long ptr)
-@ stdcall WSCWriteNameSpaceOrder(ptr long)
-@ stdcall WSCWriteProviderOrder(ptr long)
-151 stdcall  __WSAFDIsSet(long ptr)
-1   stdcall  accept(long ptr ptr)
-2   stdcall  bind(long ptr long)
-3   stdcall  closesocket(long)
-4   stdcall  connect(long ptr long)
-@ stdcall freeaddrinfo(ptr)
-@ stdcall getaddrinfo(str str ptr ptr)
-51  stdcall  gethostbyaddr(ptr long long)
-52  stdcall  gethostbyname(str)
-57  stdcall  gethostname(ptr long)
-@ stdcall getnameinfo(ptr long ptr long ptr long long)
-5   stdcall  getpeername(long ptr ptr)
-53  stdcall  getprotobyname(str)
-54  stdcall  getprotobynumber(long)
-55  stdcall  getservbyname(str str)
-56  stdcall  getservbyport(long str)
-6   stdcall  getsockname(long ptr ptr)
-7   stdcall  getsockopt(long long long ptr ptr)
-8   stdcall  htonl(long)
-9   stdcall  htons(long)
-11  stdcall  inet_addr(str)
-12  stdcall  inet_ntoa(ptr)
-10  stdcall  ioctlsocket(long long ptr)
-13  stdcall  listen(long long)
-14  stdcall  ntohl(long)
-15  stdcall  ntohs(long)
-16  stdcall  recv(long ptr long long)
-17  stdcall  recvfrom(long ptr long long ptr ptr)
-18  stdcall  select(long ptr ptr ptr ptr)
-19  stdcall  send(long ptr long long)
-20  stdcall  sendto(long ptr long long ptr long)
-21  stdcall  setsockopt(long long long ptr long)
-22  stdcall  shutdown(long long)
-23  stdcall  socket(long long long)
-@ stdcall GetAddrInfoW(wstr wstr ptr ptr)
-@ stdcall GetNameInfoW(ptr long wstr long wstr long long)