IN PNSQUERY_PROVIDER QueryProvider,
IN LPWSAQUERYSETW QuerySet,
IN LPWSASERVICECLASSINFOW ServiceClassInfo,
- IN DWORD
+ IN DWORD
);
VOID
INT ErrorCode;
PWSSOCKET Socket;
DPRINT("WSAHtonl: %p, %lx, %p\n", s, hostlong, lpnetlong);
-
+
/* Check for WSAStartup */
if ((ErrorCode = WsQuickProlog()) == ERROR_SUCCESS)
{
INT ErrorCode;
PWSSOCKET Socket;
DPRINT("WSAHtons: %p, %lx, %p\n", s, hostshort, lpnetshort);
-
+
/* Check for WSAStartup */
if ((ErrorCode = WsQuickProlog()) == ERROR_SUCCESS)
{
INT ErrorCode;
PWSSOCKET Socket;
DPRINT("WSANtohl: %p, %lx, %p\n", s, netlong, lphostlong);
-
+
/* Check for WSAStartup */
if ((ErrorCode = WsQuickProlog()) == ERROR_SUCCESS)
{
INT ErrorCode;
PWSSOCKET Socket;
DPRINT("WSANtohs: %p, %lx, %p\n", s, netshort, lphostshort);
-
+
/* Check for WSAStartup */
if ((ErrorCode = WsQuickProlog()) == ERROR_SUCCESS)
{
{
/* Get the name */
UnicodeName = &Addrinfo->ai_canonname;
-
+
/* Check if it exists */
if (*UnicodeName)
{
{
/* Free the old one */
HeapFree(WsSockHeap, 0, *UnicodeName);
-
+
/* Set the new one */
*UnicodeName = (LPWSTR)AnsiName;
}
return FALSE;
WideCharToMultiByte(CP_ACP,
0,
- AddressString,
- -1,
- AnsiAddressString,
+ AddressString,
+ -1,
+ AnsiAddressString,
sizeof(AnsiAddressString),
NULL,
0);
/* Check if we ran out of memory */
if (Next) return EAI_MEMORY;
-
+
/* Return success */
return 0;
}
/* Copy the canonical name */
strcpy(Alias, Hostent->h_name);
-
+
/* Return success */
return 0;
}
-
+
/* Find out what the error was */
switch (GetLastError())
{
/* Get the reverse name */
Dns_Ip4AddressToReverseName_W(ReverseBuffer, *Ip4Addr);
}
- /* FIXME: Not implemented for now
+ /* FIXME: Not implemented for now
else if ( */
/* By this point we have the Reverse Name, so prepare for lookup */
/* Make a copy of the name */
strcpy(Name, NodeName);
-
+
/* Loop */
while (TRUE)
{
{
/* Allocate memory for a copy */
(*pptResult)->ai_canonname = HeapAlloc(WsSockHeap, 0, 512);
-
+
/* Check if we had enough memory */
if (!(*pptResult)->ai_canonname)
{
else
{
/* Convert the alias to UNICODE */
- MultiByteToWideChar(CP_ACP,
- 0,
- Alias,
- -1,
- (*pptResult)->ai_canonname,
+ MultiByteToWideChar(CP_ACP,
+ 0,
+ Alias,
+ -1,
+ (*pptResult)->ai_canonname,
256);
}
}
SetLastError(EAI_FAIL);
return EAI_FAIL;
}
-
+
/* Save the flags and validate them */
iFlags = ptHints->ai_flags;
if ((iFlags & AI_CANONNAME) && !pszNodeName)
/* We need to convert it to ANSI */
WideCharToMultiByte(CP_ACP,
0,
- pszServiceName,
- -1,
- AnsiServiceName,
+ pszServiceName,
+ -1,
+ AnsiServiceName,
sizeof(AnsiServiceName),
NULL,
0);
/* Return the port from the servent */
if (ptService) wPort = wTcpPort = ptService->s_port;
}
-
+
/* If we got 0, then fail */
if (wPort == 0)
{
iSocketType = SOCK_STREAM;
if (!wTcpPort && wUdpPort)
iSocketType = SOCK_DGRAM;
- //bClone = (wTcpPort && wUdpPort);
+ //bClone = (wTcpPort && wUdpPort);
}
}
}
dwAddress = htonl((iFlags & AI_PASSIVE) ?
INADDR_ANY : INADDR_LOOPBACK);
}
-
+
/* Create the Addr Info */
*pptResult = NewAddrInfo(iSocketType, iProtocol, wPort, dwAddress);
/* If we didn't get one back, assume out of memory */
if (!(*pptResult)) iError = EAI_MEMORY;
-
+
/* Check if we have success and a nodename */
if (!iError && pszNodeName)
{
/* Set AI_NUMERICHOST since this is a numeric string */
(*pptResult)->ai_flags |= AI_NUMERICHOST;
-
+
/* Check if the canonical name was requested */
if (iFlags & AI_CANONNAME)
{
(*pptResult)->ai_canonname = HeapAlloc(WsSockHeap,
0,
wcslen(CanonicalName));
-
+
if (!(*pptResult)->ai_canonname)
{
/* No memory for the copy */
/* We need to convert it to ANSI */
WideCharToMultiByte(CP_ACP,
0,
- pszNodeName,
- -1,
- AnsiNodeName,
+ pszNodeName,
+ -1,
+ AnsiNodeName,
sizeof(AnsiNodeName),
NULL,
0);
{
/* Free the address info and return nothing */
FreeAddrInfoW(*pptResult);
- *pptResult = NULL;
+ *pptResult = NULL;
}
/* Return to caller */
/* Free it */
HeapFree(WsSockHeap, 0, NextInfo->ai_canonname);
}
-
+
/* Check if there is an address */
if (NextInfo->ai_addr)
{
{
INT ErrorCode;
LPWSTR UnicodeNodeName = NULL;
- LPWSTR UnicodeServName = NULL;
+ LPWSTR UnicodeServName = NULL;
DPRINT("getaddrinfo: %s, %s, %p, %p\n", nodename, servname, hints, res);
/* Check for WSAStartup */
goto Quickie;
}
}
-
+
/* Now call the unicode function */
ErrorCode = GetAddrInfoW(UnicodeNodeName,
UnicodeServName,
/* Unsupported family */
SetLastError(EAI_FAMILY);
return EAI_FAMILY;
- }
+ }
/* Check for valid socket address length */
if ((DWORD)SockaddrLength < AddressLength)
/* Check if we have a node name */
if (pNodeBuffer)
- {
+ {
/* Check if only the numeric host is wanted */
if (!(Flags & NI_NUMERICHOST))
{
ServiceString = ServiceBuffer;
ServLength = sizeof(ServiceBuffer) / sizeof(WCHAR);
}
-
+
/* Now call the unicode function */
ErrorCode = GetNameInfoW(sa,
salen,
WsAsyncFreeBlock(AsyncBlock);
return NO_ERROR;
}
-
+
/* Move to the next entry */
Entry = Entry->Flink;
}
WsTcAllocate(VOID)
{
PTCATALOG Catalog;
-
+
/* Allocate the object */
Catalog = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*Catalog));
ErrorCode = WSASYSCALLFAILURE;
break;
}
-
+
/* Get the next entry */
ErrorCode = RegQueryValueEx(Catalog->CatalogKey,
"Next_Catalog_Entry_ID",
}
/* Initialize them all */
- for (i = 1; i <= CatalogEntries; i++)
+ for (i = 1; i <= CatalogEntries; i++)
{
/* Allocate a Catalog Entry Structure */
CatalogEntry = WsTcEntryAllocate();
/* Check if Address Family Matches or if it's wildcard */
if ((Entry->ProtocolInfo.iAddressFamily == af) || (af == AF_UNSPEC))
- {
+ {
/* Check if Socket Type Matches or if it's wildcard */
if ((Entry->ProtocolInfo.iSocketType == type) || (type == 0))
{
/* Check if Protocol is In Range or if it's wildcard */
- if (((Entry->ProtocolInfo.iProtocol <= protocol) &&
- ((Entry->ProtocolInfo.iProtocol +
+ if (((Entry->ProtocolInfo.iProtocol <= protocol) &&
+ ((Entry->ProtocolInfo.iProtocol +
Entry->ProtocolInfo.iProtocolMaxOffset) >= protocol)) ||
(protocol == 0))
{
*CatalogEntry = Entry;
ErrorCode = ERROR_SUCCESS;
break;
- }
- else
+ }
+ else
{
ErrorCode = WSAEPROTONOSUPPORT;
}
- }
- else
+ }
+ else
{
ErrorCode = WSAESOCKTNOSUPPORT;
}
- }
- else
+ }
+ else
{
ErrorCode = WSAEAFNOSUPPORT;
}
{
/* Load it */
ErrorCode = WsTcLoadProvider(Catalog, CatalogEntry);
-
+
/* Skip it if we failed to load it */
if (ErrorCode != ERROR_SUCCESS) continue;
NewHandle = WPUModifyIFSHandle(ProtocolInfo.dwCatalogEntryId,
Handle,
&Error);
-
+
/* Check if the socket is invalid */
if (NewHandle == INVALID_SOCKET) return WSAENOTSOCK;
&EntryKey);
/* Get Size of Catalog Entry Structure */
- Return = RegQueryValueEx(EntryKey,
+ Return = RegQueryValueEx(EntryKey,
"PackedCatalogItem",
0,
NULL,
NULL,
&RegSize);
-
- if(!(Buf = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, RegSize)))
+
+ if (!(Buf = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, RegSize)))
return ERROR_NOT_ENOUGH_MEMORY;
/* Read the Whole Catalog Entry Structure */
- Return = RegQueryValueEx(EntryKey,
+ Return = RegQueryValueEx(EntryKey,
"PackedCatalogItem",
0,
&RegType,
memcpy(CatalogEntry->DllPath, Buf, sizeof(CatalogEntry->DllPath));
index = sizeof(CatalogEntry->DllPath);
- if(index < RegSize)
+ if (index < RegSize)
{
memcpy(&CatalogEntry->ProtocolInfo, &Buf[index], sizeof(WSAPROTOCOL_INFOW));
index += sizeof(WSAPROTOCOL_INFOW);
PWSPROCESS WsProcess;
/* Main Entrypoint */
- switch (dwReason)
+ switch (dwReason)
{
case DLL_PROCESS_ATTACH:
/* Save DLL Handle */
WsTpAllocate(VOID)
{
PTPROVIDER Provider;
-
+
DPRINT("WsTpAllocate: WsSockHeap %d\n", WsSockHeap);
/* Allocate the object */
Provider = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*Provider));
/* Setup non-zero data */
Provider->RefCount = 1;
-
+
/* Return it */
return Provider;
}
CHAR ExpandedDllPath[MAX_PATH];
DWORD ErrorCode;
DPRINT("WsTpInitialize: %p, %p, %p\n", Provider, DllName, ProtocolInfo);
-
+
/* Clear the tables */
RtlZeroMemory(&Provider->UpcallTable, sizeof(Provider->UpcallTable));
RtlZeroMemory(&Provider->Service, sizeof(Provider->Service));
/* Load the DLL */
Provider->DllHandle = LoadLibrary(ExpandedDllPath);
- if(!Provider->DllHandle)
+ if (!Provider->DllHandle)
{
return SOCKET_ERROR;
}
/* Get the pointer to WSPStartup */
WSPStartupProc = (LPWSPSTARTUP)GetProcAddress(Provider->DllHandle, "WSPStartup");
- if(!WSPStartupProc)
+ if (!WSPStartupProc)
{
return SOCKET_ERROR;
}
{
LPWSPCLEANUP WSPCleanup = NULL;
INT ErrorCode = ERROR_SUCCESS;
-
+
/* Make sure we have a loaded handle */
if (Provider->DllHandle)
{
WsTpDelete(IN PTPROVIDER Provider)
{
INT ErrorCode;
-
+
/* Make sure we have a loaded handle */
if (Provider->DllHandle)
{
{
MSG Message;
BOOL GotMessage = FALSE;
-
+
/* Get the message */
GotMessage = PeekMessage(&Message, NULL, 0, 0, PM_REMOVE);
Thread->Cancelled = FALSE;
/* Call the blocking hook */
- while(Thread->BlockingHook());
+ while (Thread->BlockingHook());
/* We're not blocking anymore */
Thread->Blocking = FALSE;
WsThreadAllocate(VOID)
{
PWSTHREAD Thread;
-
+
/* Allocate the object */
Thread = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*Thread));
WsThreadStartup(VOID)
{
INT ErrorCode = WSASYSCALLFAILURE;
-
+
/* Check if we have a valid TLS */
if (TlsIndex != TLS_OUT_OF_INDEXES)
{
IN PWSPROCESS Process)
{
INT ErrorCode = WSASYSCALLFAILURE;
-
+
/* Set the process */
Thread->Process = Process;
{
PWSTHREAD Thread = NULL;
INT ErrorCode = WSASYSCALLFAILURE;
-
+
/* Make sure we have TLS */
if (TlsIndex != TLS_OUT_OF_INDEXES)
{
WSAPROTOCOL_INFOW ProtocolInfoW;
INT ErrorCode;
DPRINT("WSADuplicateSocketA: %lx, %lx, %p\n", s, dwProcessId, lpProtocolInfo);
-
+
/* Call the Unicode Function */
ErrorCode = WSADuplicateSocketW(s, dwProcessId, &ProtocolInfoW);
/* Check for success */
if (ErrorCode == ERROR_SUCCESS)
- {
+ {
/* Convert Protocol Info to Ansi */
- if (lpProtocolInfo)
- {
+ if (lpProtocolInfo)
+ {
/* Convert the information to ANSI */
ErrorCode = MapUnicodeProtocolInfoToAnsi(&ProtocolInfoW,
lpProtocolInfo);
IN BOOL fAlertable)
{
/* Call Win32 */
- return WaitForMultipleObjectsEx(cEvents,
- lphEvents,
- fWaitAll,
- dwTimeout,
+ return WaitForMultipleObjectsEx(cEvents,
+ lphEvents,
+ fWaitAll,
+ dwTimeout,
fAlertable);
}
/* DATA **********************************************************************/
AFPROTOCOLS afp[2] = {{AF_INET, IPPROTO_UDP}, {AF_INET, IPPROTO_TCP}};
-
+
/* FUNCTIONS *****************************************************************/
VOID
WSAAPI
-FixList(PCHAR **List,
+FixList(PCHAR **List,
ULONG_PTR Base)
{
/* Make sure it's valid */
- if(*List)
+ if (*List)
{
PCHAR *Addr;
Addr = *List = (PCHAR*)(((ULONG_PTR)*List + Base));
/* Loop the pointers */
- while(*Addr)
+ while (*Addr)
{
/* Rebase them too */
*Addr = (PCHAR)(((ULONG_PTR)*Addr + Base));
ULONG_PTR HostentPtr = (ULONG_PTR)Hostent;
/* Convert the Name Offset to a Pointer */
- if(Hostent->h_name) Hostent->h_name = (PCHAR)(Hostent->h_name + HostentPtr);
+ if (Hostent->h_name) Hostent->h_name = (PCHAR)(Hostent->h_name + HostentPtr);
/* Convert all the List Offsets to Pointers */
FixList(&Hostent->h_aliases, HostentPtr);
WsaQuery->dwNumberOfProtocols = sizeof(afp)/sizeof(afp[0]);
WsaQuery->lpafpProtocols = afp;
- if(!IsEqualGUID(Type, &HostnameGuid))
+ if (!IsEqualGUID(Type, &HostnameGuid))
dwControlFlags |= LUP_RETURN_BLOB;
/* Send the Query Request to find a Service */
dwControlFlags,
&RnRHandle);
- if(ErrorCode == ERROR_SUCCESS)
+ if (ErrorCode == ERROR_SUCCESS)
{
while (TRUE)
{
WsaQuery);
/* Return the information requested */
- if(ErrorCode == ERROR_SUCCESS)
+ if (ErrorCode == ERROR_SUCCESS)
{
/* Get the Blob and check if we have one */
Blob = WsaQuery->lpBlob;
- if(Blob)
+ if (Blob)
{
/* Did they want the name back? */
- if(NewName) *NewName = WsaQuery->lpszServiceInstanceName;
- }
- else
+ if (NewName) *NewName = WsaQuery->lpszServiceInstanceName;
+ }
+ else
{
/* Check if this was a Hostname lookup */
if (IsEqualGUID(Type, &HostnameGuid))
{
/* Return the name anyways */
- if(NewName) *NewName = WsaQuery->lpszServiceInstanceName;
+ if (NewName) *NewName = WsaQuery->lpszServiceInstanceName;
}
else
{
ErrorCode = WSANO_DATA;
}
}
- }
- else
+ }
+ else
{
/* WSALookupServiceEnd will set its own error, so save ours */
ErrorCode = GetLastError();
}
}
}
-
+
/* Finish the Query Request */
WSALookupServiceEnd(RnRHandle);
/* Now set the Last Error */
- if(ErrorCode != ERROR_SUCCESS) SetLastError(ErrorCode);
+ if (ErrorCode != ERROR_SUCCESS) SetLastError(ErrorCode);
/* Leave the loop */
break;
}
/* Check if no name was given */
- if(!name || !*name)
+ if (!name || !*name)
{
/* This means we should do a local lookup first */
- if(gethostname(szLocalName, MAX_HOSTNAME_LEN) != NO_ERROR) return(NULL);
+ if (gethostname(szLocalName, MAX_HOSTNAME_LEN) != NO_ERROR) return(NULL);
pszName = szLocalName;
- }
- else
+ }
+ else
{
/* Use the name tha twas given to us */
pszName = (PCHAR)name;
pszName,
&HostAddrByNameGuid,
0);
-
+
/* Check if we didn't get a blob, or if we got an empty name */
if (!(Blob) && (!(name) || !(*name)))
{
}
/* Check if we got a blob */
- if(Blob)
+ if (Blob)
{
/* Copy the blob to our buffer and convert it */
Hostent = WsThreadBlobToHostent(Thread, Blob);
/* Unpack the hostent */
- if(Hostent) UnpackHostEnt(Hostent);
- }
- else
+ if (Hostent) UnpackHostEnt(Hostent);
+ }
+ else
{
/* We failed, so zero it out */
Hostent = NULL;
/* Normalize the error message */
- if(GetLastError() == WSASERVICE_NOT_FOUND)
+ if (GetLastError() == WSASERVICE_NOT_FOUND)
{
SetLastError(WSAHOST_NOT_FOUND);
}
AddressBuffer,
&AddressGuid,
0);
-
+
/* Check if we got a blob */
- if(Blob)
+ if (Blob)
{
/* Copy the blob to our buffer and convert it */
Hostent = WsThreadBlobToHostent(Thread, Blob);
/* Unpack the hostent */
- if(Hostent) UnpackHostEnt(Hostent);
- }
- else
+ if (Hostent) UnpackHostEnt(Hostent);
+ }
+ else
{
/* We failed, so zero it out */
Hostent = NULL;
/* Normalize the error message */
- if(GetLastError() == WSASERVICE_NOT_FOUND)
+ if (GetLastError() == WSASERVICE_NOT_FOUND)
{
SetLastError(WSAHOST_NOT_FOUND);
}
/* Get the Hostname in a String */
/* getxyDataEnt does not return blob for HostnameGuid */
getxyDataEnt(&Results, RNR_BUFFER_SIZE, NULL, &HostnameGuid, &Name);
- if(Name)
+ if (Name)
{
/* Copy it */
strncpy(name, Name, namelen-1);
}
/* No protocol specified */
- if(!proto) proto = "";
+ if (!proto) proto = "";
/* Allocate memory for the port name */
PortName = HeapAlloc(WsSockHeap, 0, strlen(proto) + 1 + 1 + 5);
HeapFree(WsSockHeap, 0, PortName);
/* Check if we got a blob */
- if(Blob)
+ if (Blob)
{
/* Copy the blob to our buffer and convert it */
Servent = WsThreadBlobToServent(Thread, Blob);
/* Unpack the hostent */
- if(Servent) UnpackServEnt(Servent);
- }
- else
+ if (Servent) UnpackServEnt(Servent);
+ }
+ else
{
/* We failed, so zero it out */
Servent = 0;
}
/* No protocol specified */
- if(!proto) proto = "";
+ if (!proto) proto = "";
/* Allocate buffer for it */
PortName = HeapAlloc(WsSockHeap, 0, strlen(proto) + 1 + strlen(name) + 1);
HeapFree(WsSockHeap, 0, PortName);
/* Check if we got a blob */
- if(Blob)
+ if (Blob)
{
/* Copy the blob to our buffer and convert it */
Servent = WsThreadBlobToServent(Thread, Blob);
/* Unpack the hostent */
- if(Servent) UnpackServEnt(Servent);
- }
- else
+ if (Servent) UnpackServEnt(Servent);
+ }
+ else
{
/* We failed, so zero it out */
Servent = 0;
WSAAPI
WSAAsyncGetHostByAddr(IN HWND hWnd,
IN UINT wMsg,
- IN CONST CHAR FAR *Address,
+ IN CONST CHAR FAR *Address,
IN INT Length,
- IN INT Type,
- OUT CHAR FAR *Buffer,
+ IN INT Type,
+ OUT CHAR FAR *Buffer,
IN INT BufferLength)
{
HANDLE TaskHandle;
*/
HANDLE
WSAAPI
-WSAAsyncGetHostByName(IN HWND hWnd,
- IN UINT wMsg,
- IN CONST CHAR FAR *Name,
- OUT CHAR FAR *Buffer,
+WSAAsyncGetHostByName(IN HWND hWnd,
+ IN UINT wMsg,
+ IN CONST CHAR FAR *Name,
+ OUT CHAR FAR *Buffer,
IN INT BufferLength)
{
HANDLE TaskHandle;
PWSASYNCBLOCK AsyncBlock;
INT ErrorCode;
DPRINT("WSAAsyncGetProtoByNumber: %lx, %lx, %lx\n", hWnd, wMsg, Number);
-
+
/* Enter prolog */
if ((ErrorCode = WsApiProlog(&Process, &Thread)) != ERROR_SUCCESS)
{
INT ErrorCode;
PVOID NameCopy;
DPRINT("WSAAsyncGetProtoByNumber: %lx, %lx, %s\n", hWnd, wMsg, Name);
-
+
/* Enter prolog */
if ((ErrorCode = WsApiProlog(&Process, &Thread)) != ERROR_SUCCESS)
{
PWSASYNCBLOCK AsyncBlock;
INT ErrorCode;
DPRINT("WSAAsyncGetProtoByNumber: %lx, %lx, %lx\n", hWnd, wMsg, Port);
-
+
/* Enter prolog */
if ((ErrorCode = WsApiProlog(&Process, &Thread)) != ERROR_SUCCESS)
{
PWSTHREAD Thread;
INT ErrorCode;
DPRINT("WSACancelAsyncRequest: %lx\n", hAsyncTaskHandle);
-
+
/* Enter prolog */
if ((ErrorCode = WsApiProlog(&Process, &Thread)) == ERROR_SUCCESS)
{
/* Return */
if (ErrorCode == ERROR_SUCCESS) return ERROR_SUCCESS;
}
-
+
/* Fail */
SetLastError(ErrorCode);
return SOCKET_ERROR;
}
/* Initialize them all */
- for (i = 1; i <= CatalogEntries; i++)
+ for (i = 1; i <= CatalogEntries; i++)
{
/* Allocate a Catalog Entry Structure */
CatalogEntry = WsNcEntryAllocate();
CatalogEntry->DllPath,
&CatalogEntry->ProviderId);
- /* Ensure success */
- if (ErrorCode == ERROR_SUCCESS)
- {
- /* Set the provider */
- WsNcEntrySetProvider(CatalogEntry, Provider);
- }
+ /* Ensure success */
+ if (ErrorCode == ERROR_SUCCESS)
+ {
+ /* Set the provider */
+ WsNcEntrySetProvider(CatalogEntry, Provider);
+ }
/* Dereference it */
WsNpDereference(Provider);
WsNqProvAllocate(VOID)
{
PNSQUERY_PROVIDER Provider;
-
+
/* Allocate the object */
Provider = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*Provider));
WsNpAllocate(VOID)
{
PNS_PROVIDER Provider;
-
+
/* Allocate the object */
Provider = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*Provider));
INT ErrorCode = ERROR_SUCCESS;
LPNSPSTARTUP NSPStartupProc;
CHAR AnsiPath[MAX_PATH], ExpandedDllPath[MAX_PATH];
-
+
/* Convert the path to ANSI */
WideCharToMultiByte(CP_ACP,
0,
{
INT ErrorCode = ERROR_SUCCESS;
LPNSPCLEANUP lpNSPCleanup = NULL;
-
+
/* Make sure we have a loaded handle */
if (Provider->DllHandle)
{
WsNqAllocate(VOID)
{
PNSQUERY NsQuery;
-
+
/* Allocate the object */
NsQuery = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*NsQuery));
NsQuery->Signature = ~0xBEADFACE;
InitializeListHead(&NsQuery->ProviderList);
NsQuery->TryAgain = TRUE;
-
+
/* Return it */
return NsQuery;
}
{
PNSQUERY_PROVIDER Provider;
PLIST_ENTRY Entry;
-
+
/* Make sure that we got initialized */
if (!NsQuery->ProviderList.Flink) return;
{
PNSQUERY_PROVIDER Provider;
PLIST_ENTRY Entry;
-
+
/* Protect us from closure */
WsNqLock();
NsQuery->ShuttingDown = TRUE;
/* Save the current active provider */
Provider = NsQuery->ActiveProvider;
-
+
/* Check if one exists */
if (Provider)
{
/* Reset it */
WsNqProvLookupServiceEnd(Provider);
WsNqProvDelete(Provider);
- }
+ }
/* Start a new query */
if (!WsNqLookupServiceBegin(NsQuery,
NsQuery->Catalog))
{
/* New query succeeded, set active provider now */
- NsQuery->ActiveProvider =
+ NsQuery->ActiveProvider =
WsNqNextProvider(NsQuery,
NsQuery->ActiveProvider);
}
WsNqUnlock();
/* Keep looping as long as there is a provider */
- } while (NextProvider);
+ } while (NextProvider);
}
}
else
NsQuery->ControlFlags = ControlFlags;
NsQuery->Catalog = Catalog;
}
-
+
/* Check if we have a specific ID */
if (Restrictions->lpNSProviderId)
{
WsNqBeginEnumerationProc,
&EnumContext);
ErrorCode = EnumContext.ErrorCode;
-
+
/* Check for success */
if (ErrorCode != ERROR_SUCCESS)
{
{
PNSQUERY_PROVIDER NextProvider = NULL;
PLIST_ENTRY Entry;
-
+
/* Get the first entry and get its provider */
Entry = Provider->QueryLink.Flink;
if (Entry != &Query->ProviderList)
{
PNSQUERY_PROVIDER NextProvider = NULL;
PLIST_ENTRY Entry;
-
+
/* Get the first entry and get its provider */
Entry = Provider->QueryLink.Blink;
if (Entry != &Query->ProviderList)
{
PNSQUERY_PROVIDER QueryProvider;
DWORD Return = TRUE;
-
+
/* Allocate a new Query Provider */
if ((QueryProvider = WsNqProvAllocate()))
{
*/
BOOL
WSAAPI
-WSAGetQOSByName(IN SOCKET s,
- IN OUT LPWSABUF lpQOSName,
+WSAGetQOSByName(IN SOCKET s,
+ IN OUT LPWSABUF lpQOSName,
OUT LPQOS lpQOS)
{
PWSSOCKET Socket;
if (AnsiSet->lpcsaBuffer[i].LocalAddr.lpSockaddr)
{
/* Align the current size and add the sockaddr's length */
- Size = (Size + 3) & ~3;
+ Size = (Size + 3) & ~3;
Size += AnsiSet->lpcsaBuffer[i].LocalAddr.iSockaddrLength;
}
/* Check for remote sockaddr */
if (AnsiSet->lpcsaBuffer[i].RemoteAddr.lpSockaddr)
{
/* Align the current size and add the sockaddr's length */
- Size = (Size + 3) & ~3;
+ Size = (Size + 3) & ~3;
Size += AnsiSet->lpcsaBuffer[i].RemoteAddr.iSockaddrLength;
}
ErrorCode = WSA_NOT_ENOUGH_MEMORY;
goto error;
}
-
+
/* Build the relative buffer version */
ErrorCode = WSABuildQuerySetBufferA(AnsiSet, AnsiSize, AnsiCopy);
if (ErrorCode != ERROR_SUCCESS) goto error;
-
+
/* Re-use the ANSI version since the fields match */
UnicodeCopy = (LPWSAQUERYSETW)AnsiCopy;
ErrorCode = WSA_NOT_ENOUGH_MEMORY;
goto error;
}
-
+
/* Build the relative buffer version */
ErrorCode = WSABuildQuerySetBufferW(UnicodeSet, UnicodeSize, UnicodeCopy);
if (ErrorCode != ERROR_SUCCESS) goto error;
-
+
/* Re-use the Unicode version since the fields match */
AnsiCopy = (LPWSAQUERYSETA)UnicodeCopy;
if (WsRasDllHandle)
{
/* Get function pointers */
- lpfnWSAttemptAutodialAddr =
+ lpfnWSAttemptAutodialAddr =
(PVOID)GetProcAddress(WsRasDllHandle,
"WSAttemptAutodialAddr");
- lpfnWSAttemptAutodialName =
+ lpfnWSAttemptAutodialName =
(PVOID)GetProcAddress(WsRasDllHandle,
"WSAttemptAutodialName");
- lpfnWSNoteSuccessfulHostentLookup =
+ lpfnWSNoteSuccessfulHostentLookup =
(PVOID)GetProcAddress(WsRasDllHandle,
"WSNoteSuccessfulHostentLookup");
}
/* Make the call */
Status = Socket->Provider->Service.lpWSPRecv(s,
- &Buffers,
+ &Buffers,
1,
- &BytesReceived,
- (LPDWORD)&flags,
+ &BytesReceived,
+ (LPDWORD)&flags,
NULL,
- NULL,
- ThreadId,
+ NULL,
+ ThreadId,
&ErrorCode);
/* Deference the Socket Context */
WsSockDereference(Socket);
/* Make the call */
Status = Socket->Provider->Service.lpWSPRecvFrom(s,
- &Buffers,
+ &Buffers,
1,
- &BytesReceived,
+ &BytesReceived,
(LPDWORD)&flags,
from,
fromlen,
NULL,
- NULL,
- ThreadId,
+ NULL,
+ ThreadId,
&ErrorCode);
/* Deference the Socket Context */
WsSockDereference(Socket);
{
/* Make the call */
Status = Socket->Provider->Service.lpWSPRecv(s,
- lpBuffers,
+ lpBuffers,
dwBufferCount,
- lpNumberOfBytesRecvd,
- lpFlags,
+ lpNumberOfBytesRecvd,
+ lpFlags,
lpOverlapped,
- lpCompletionRoutine,
- ThreadId,
+ lpCompletionRoutine,
+ ThreadId,
&ErrorCode);
/* Deference the Socket Context */
WsSockDereference(Socket);
{
/* Make the call */
Status = Socket->Provider->Service.lpWSPRecvFrom(s,
- lpBuffers,
+ lpBuffers,
dwBufferCount,
- lpNumberOfBytesRecvd,
- lpFlags,
+ lpNumberOfBytesRecvd,
+ lpFlags,
lpFrom,
lpFromlen,
lpOverlapped,
lpCompletionRoutine,
- ThreadId,
+ ThreadId,
&ErrorCode);
/* Deference the Socket Context */
WsSockDereference(Socket);
lpsaAddress->sa_family,
&CatalogEntry);
}
-
+
/* Check for success */
if (ErrorCode == ERROR_SUCCESS)
{
lpsaAddress->sa_family,
&CatalogEntry);
}
-
+
/* Check for success */
if (ErrorCode == ERROR_SUCCESS)
{
DPRINT("WSALookupServiceBeginA: %p\n", lpqsRestrictions);
/* Verify pointer */
- if (IsBadReadPtr(lpqsRestrictions, sizeof(*lpqsRestrictions)) ||
+ if (IsBadReadPtr(lpqsRestrictions, sizeof(*lpqsRestrictions)) ||
IsBadReadPtr(lpqsRestrictions->lpServiceClassId, sizeof(*lpqsRestrictions->lpServiceClassId)))
{
/* Invalid */
/*
* @implemented
*/
-INT
+INT
WINAPI
WSALookupServiceBeginW(IN LPWSAQUERYSETW lpqsRestrictions,
IN DWORD dwControlFlags,
ErrorCode = SOCKET_ERROR;
SetLastError(WSAENOBUFS);
}
-
+
/* Return */
return ErrorCode;
}
/* Get it from the address family */
ErrorCode = WsTcGetEntryFromAf(Catalog, AddressFamily, &CatalogEntry);
}
-
+
/* Check for success */
if (ErrorCode == ERROR_SUCCESS)
{
/* Get it from the address family */
ErrorCode = WsTcGetEntryFromAf(Catalog, AddressFamily, &CatalogEntry);
}
-
+
/* Check for success */
if (ErrorCode == ERROR_SUCCESS)
{
*/
INT
WSAAPI
-select(IN INT s,
- IN OUT LPFD_SET readfds,
- IN OUT LPFD_SET writefds,
- IN OUT LPFD_SET exceptfds,
+select(IN INT s,
+ IN OUT LPFD_SET readfds,
+ IN OUT LPFD_SET writefds,
+ IN OUT LPFD_SET exceptfds,
IN CONST struct timeval *timeout)
{
PWSSOCKET Socket;
{
/* Make the call */
Status = Socket->Provider->Service.lpWSPAsyncSelect(s,
- hWnd,
+ hWnd,
wMsg,
- lEvent,
+ lEvent,
&ErrorCode);
/* Deference the Socket Context */
WsSockDereference(Socket);
*/
INT
WSAAPI
-send(IN SOCKET s,
- IN CONST CHAR FAR* buf,
- IN INT len,
+send(IN SOCKET s,
+ IN CONST CHAR FAR* buf,
+ IN INT len,
IN INT flags)
{
PWSSOCKET Socket;
/* Make the call */
Status = Socket->Provider->Service.lpWSPSend(s,
- &Buffers,
+ &Buffers,
1,
- &BytesSent,
- (DWORD)flags,
+ &BytesSent,
+ (DWORD)flags,
NULL,
- NULL,
- ThreadId,
+ NULL,
+ ThreadId,
&ErrorCode);
/* Deference the Socket Context */
WsSockDereference(Socket);
IN CONST CHAR FAR* buf,
IN INT len,
IN INT flags,
- IN CONST struct sockaddr *to,
+ IN CONST struct sockaddr *to,
IN INT tolen)
{
PWSSOCKET Socket;
/* Make the call */
Status = Socket->Provider->Service.lpWSPSendTo(s,
- &Buffers,
+ &Buffers,
1,
- &BytesSent,
+ &BytesSent,
(DWORD)flags,
to,
tolen,
NULL,
- NULL,
- ThreadId,
+ NULL,
+ ThreadId,
&ErrorCode);
/* Deference the Socket Context */
WsSockDereference(Socket);
{
/* Make the call */
Status = Socket->Provider->Service.lpWSPSend(s,
- lpBuffers,
+ lpBuffers,
dwBufferCount,
- lpNumberOfBytesSent,
- dwFlags,
+ lpNumberOfBytesSent,
+ dwFlags,
lpOverlapped,
- lpCompletionRoutine,
- ThreadId,
+ lpCompletionRoutine,
+ ThreadId,
&ErrorCode);
/* Deference the Socket Context */
WsSockDereference(Socket);
{
/* Make the call */
Status = Socket->Provider->Service.lpWSPSendTo(s,
- lpBuffers,
+ lpBuffers,
dwBufferCount,
- lpNumberOfBytesSent,
- dwFlags,
+ lpNumberOfBytesSent,
+ dwFlags,
lpTo,
iToLen,
lpOverlapped,
- lpCompletionRoutine,
- ThreadId,
+ lpCompletionRoutine,
+ ThreadId,
&ErrorCode);
/* Deference the Socket Context */
WsSockDereference(Socket);
{
/* Make the call */
Status = Socket->Provider->Service.lpWSPBind(s,
- name,
+ name,
namelen,
&ErrorCode);
/* Deference the Socket Context */
LPWSAPROTOCOL_INFOW p = &ProtocolInfoW;
/* Convert Protocol Info to Wide */
- if (lpProtocolInfo)
- {
+ if (lpProtocolInfo)
+ {
/* Copy the Data */
memcpy(&ProtocolInfoW,
lpProtocolInfo,
-1,
ProtocolInfoW.szProtocol,
sizeof(ProtocolInfoW.szProtocol) / sizeof(WCHAR));
- }
- else
+ }
+ else
{
/* No Protocol Info Specified */
p = NULL;
* @implemented
*/
SOCKET
-WSAAPI
+WSAAPI
WSASocketW(IN INT af,
IN INT type,
IN INT protocol,
Catalog = WsProcGetTCatalog(Process);
/* Find a Provider for the Catalog ID */
- if (lpProtocolInfo)
- {
+ if (lpProtocolInfo)
+ {
/* Get the catalog ID */
CatalogId = lpProtocolInfo->dwCatalogEntryId;
CatalogId,
&CatalogEntry);
}
- else
- {
+ else
+ {
/* No ID */
CatalogId = 0;
WsTcEntryDereference(CatalogEntry);
/* Did we fail with WSAEINPROGRESS and had no specific provider? */
- if ((Status == INVALID_SOCKET) &&
- (ErrorCode == WSAEINPROGRESS) &&
+ if ((Status == INVALID_SOCKET) &&
+ (ErrorCode == WSAEINPROGRESS) &&
!(lpProtocolInfo))
{
/* In that case, restart the lookup from this ID */
/*
* @implemented
*/
-BOOL
-WSAAPI
+BOOL
+WSAAPI
WSApSetPostRoutine(PVOID Routine)
{
/* Set the post routine */
lstrcpy(lpWSAData->szDescription, "WinSock 2.0");
lstrcpy(lpWSAData->szSystemStatus, "Running");
- /*
+ /*
* On Winsock 1, the following values are returned.
* Taken straight from a Winsock Test app on Windows.
*/
{
lpWSAData->iMaxSockets = 32767;
lpWSAData->iMaxUdpDg = 65467;
- }
+ }
else
{
lpWSAData->iMaxSockets = 0;
lpWSAData->iMaxUdpDg = 0;
}
-
+
/* Requested invalid version (0) */
if (ErrorCode != ERROR_SUCCESS)
{
0,
MAXIMUM_ALLOWED,
&WinsockRootKey);
-
+
/* Check if it wasn't found */
if (ErrorCode == ERROR_FILE_NOT_FOUND)
{