mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[ws2_32]
merge startup version checks from ws2_32_new/src/startup.c [ws2_32_new] fix typo svn path=/trunk/; revision=62204
This commit is contained in:
parent
6e36352b9a
commit
27d91ad7f2
2 changed files with 47 additions and 38 deletions
|
@ -55,7 +55,8 @@ EXPORT
|
|||
WSAStartup(IN WORD wVersionRequested,
|
||||
OUT LPWSADATA lpWSAData)
|
||||
{
|
||||
BYTE Low, High;
|
||||
WORD VersionReturned = 0;
|
||||
DWORD ErrorCode = ERROR_SUCCESS;
|
||||
|
||||
WS_DbgPrint(MAX_TRACE, ("WSAStartup of ws2_32.dll\n"));
|
||||
|
||||
|
@ -65,48 +66,56 @@ WSAStartup(IN WORD wVersionRequested,
|
|||
if (lpWSAData == NULL)
|
||||
return WSAEFAULT;
|
||||
|
||||
Low = LOBYTE(wVersionRequested);
|
||||
High = HIBYTE(wVersionRequested);
|
||||
|
||||
if (Low < 1)
|
||||
/* Check which version is being requested */
|
||||
switch (LOBYTE(wVersionRequested))
|
||||
{
|
||||
WS_DbgPrint(MAX_TRACE, ("Bad winsock version requested, %d,%d", Low, High));
|
||||
return WSAVERNOTSUPPORTED;
|
||||
case 0:
|
||||
|
||||
/* We don't support this unknown version */
|
||||
ErrorCode = WSAVERNOTSUPPORTED;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/* We support only 1.0 and 1.1 */
|
||||
if (HIBYTE(wVersionRequested) == 0)
|
||||
{
|
||||
/* Caller wants 1.0, return it */
|
||||
VersionReturned = wVersionRequested;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The only other version we support is 1.1 */
|
||||
VersionReturned = MAKEWORD(1, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/* We support only 2.0, 2.1 and 2.2 */
|
||||
if (HIBYTE(wVersionRequested) <= 2)
|
||||
{
|
||||
/* Caller wants 2.0-2.2, return it */
|
||||
VersionReturned = MAKEWORD(2, HIBYTE(wVersionRequested));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The highest version we support is 2.2 */
|
||||
VersionReturned = MAKEWORD(2, 2);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* Return 2.2 */
|
||||
VersionReturned = MAKEWORD(2, 2);;
|
||||
break;
|
||||
}
|
||||
|
||||
if (Low == 1)
|
||||
{
|
||||
if (High == 0)
|
||||
{
|
||||
lpWSAData->wVersion = wVersionRequested;
|
||||
}
|
||||
else
|
||||
{
|
||||
lpWSAData->wVersion = MAKEWORD(1, 1);
|
||||
}
|
||||
}
|
||||
else if (Low == 2)
|
||||
{
|
||||
if (High <= 2)
|
||||
{
|
||||
lpWSAData->wVersion = MAKEWORD(2, High);
|
||||
}
|
||||
else
|
||||
{
|
||||
lpWSAData->wVersion = MAKEWORD(2, 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lpWSAData->wVersion = MAKEWORD(2, 2);
|
||||
}
|
||||
/* Return the Version Requested, unless error */
|
||||
lpWSAData->wVersion = VersionReturned;
|
||||
|
||||
lpWSAData->wVersion = wVersionRequested;
|
||||
lpWSAData->wHighVersion = MAKEWORD(2,2);
|
||||
lstrcpyA(lpWSAData->szDescription, "WinSock 2.0");
|
||||
lstrcpyA(lpWSAData->szSystemStatus, "Running");
|
||||
lpWSAData->iMaxSockets = 0;
|
||||
lpWSAData->iMaxUdpDg = 0;
|
||||
lpWSAData->lpVendorInfo = NULL;
|
||||
|
||||
if (LOBYTE(wVersionRequested) == 1)
|
||||
|
@ -124,7 +133,7 @@ WSAStartup(IN WORD wVersionRequested,
|
|||
|
||||
WSASETINITIALIZED;
|
||||
|
||||
return NO_ERROR;
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ WSAStartup(IN WORD wVersionRequested,
|
|||
break;
|
||||
}
|
||||
|
||||
/* Return the Version Requsted, unless error */
|
||||
/* Return the Version Requested, unless error */
|
||||
lpWSAData->wVersion = VersionReturned;
|
||||
|
||||
/* We support Winsock 2.2 */
|
||||
|
|
Loading…
Reference in a new issue