wsock32: Check return value rather than returned size for error.

oldstable
Juan Lang 2007-11-05 10:25:11 -08:00 committed by Alexandre Julliard
parent 2593ee873d
commit 182ec0a50d
1 changed files with 9 additions and 15 deletions

View File

@ -441,11 +441,9 @@ DWORD WINAPI WsControl(DWORD protocol,
if (!pcbResponseInfoLen)
return ERROR_BAD_ENVIRONMENT;
GetIpForwardTable(NULL, &routeTableSize, FALSE);
if (!routeTableSize) {
*pcbResponseInfoLen = 0;
return WSCTL_SUCCESS;
}
ret = GetIpForwardTable(NULL, &routeTableSize, FALSE);
if (ret != ERROR_INSUFFICIENT_BUFFER)
return ret;
numRoutes = (routeTableSize - sizeof(MIB_IPFORWARDTABLE))
/ sizeof(MIB_IPFORWARDROW) + 1;
if (*pcbResponseInfoLen < sizeof(IPRouteEntry) * numRoutes)
@ -494,11 +492,9 @@ DWORD WINAPI WsControl(DWORD protocol,
if (!pcbResponseInfoLen)
return ERROR_BAD_ENVIRONMENT;
GetIpNetTable(NULL, &arpTableSize, FALSE);
if (!arpTableSize) {
*pcbResponseInfoLen = 0;
return WSCTL_SUCCESS;
}
ret = GetIpNetTable(NULL, &arpTableSize, FALSE);
if (ret != ERROR_INSUFFICIENT_BUFFER)
return ret;
numEntries = (arpTableSize - sizeof(MIB_IPNETTABLE))
/ sizeof(MIB_IPNETROW) + 1;
if (*pcbResponseInfoLen < sizeof(MIB_IPNETROW) * numEntries)
@ -536,11 +532,9 @@ DWORD WINAPI WsControl(DWORD protocol,
if (!pcbResponseInfoLen)
return ERROR_BAD_ENVIRONMENT;
GetTcpTable(NULL, &tcpTableSize, FALSE);
if (!tcpTableSize) {
*pcbResponseInfoLen = 0;
return WSCTL_SUCCESS;
}
ret = GetTcpTable(NULL, &tcpTableSize, FALSE);
if (ret != ERROR_INSUFFICIENT_BUFFER)
return ret;
numEntries = (tcpTableSize - sizeof(MIB_TCPTABLE))
/ sizeof(MIB_TCPROW) + 1;
if (*pcbResponseInfoLen < sizeof(MIB_TCPROW) * numEntries)