{
TCP_REQUEST_QUERY_INFORMATION_EX inTcpReq;
ULONG BufLenNeeded;
-
+
RtlZeroMemory(&inTcpReq, sizeof(inTcpReq));
inTcpReq.ID.toi_entity = *pEntityID;
inTcpReq.ID.toi_class = INFO_CLASS_PROTOCOL;
{
DPRINT("DeviceIoControl (IPSNMPInfo) failed, Status %li!\n", GetLastError());
return WSAEFAULT;
- }
-
+ }
+
return NO_ERROR;
}
{
TCP_REQUEST_QUERY_INFORMATION_EX inTcpReq;
ULONG BufLenNeeded;
-
+
RtlZeroMemory(&inTcpReq, sizeof(inTcpReq));
inTcpReq.ID.toi_entity = *pEntityID;
inTcpReq.ID.toi_class = INFO_CLASS_GENERIC;
{
DPRINT("DeviceIoControl (TdiEntityType) failed, Status %li!\n", GetLastError());
return WSAEFAULT;
- }
-
+ }
+
return NO_ERROR;
}
{
TCP_REQUEST_QUERY_INFORMATION_EX inTcpReq;
ULONG BufLenNeeded;
-
+
RtlZeroMemory(&inTcpReq, sizeof(inTcpReq));
inTcpReq.ID.toi_entity = *pEntityID;
inTcpReq.ID.toi_class = INFO_CLASS_PROTOCOL;
{
DPRINT("DeviceIoControl (IFEntry) failed, Status %li!\n", GetLastError());
return WSAEFAULT;
- }
-
+ }
+
return NO_ERROR;
}
LPINTERFACE_INFO pIntfInfo;
DWORD outIDCount, i1, iAddr;
DWORD bCastAddr, outNumberOfBytes;
- ULONG BufLenNeeded, BufLen, IFEntryLen, TdiType;
+ ULONG BufLenNeeded, BufLen, IFEntryLen, TdiType;
HANDLE TcpFile = 0;
HANDLE hHeap = GetProcessHeap();
DWORD LastErr;
DPRINT("ERROR\n");
res = ERROR_OUTOFMEMORY;
goto cleanup;
- }
-
+ }
+
/* get addresses */
pEntityID = outEntityID;
for (i1 = 0; i1 < outIDCount; i1++)
res = GetIPSNMPInfo(TcpFile, pEntityID, &outIPSNMPInfo);
if (res != NO_ERROR)
goto cleanup;
-
+
/* add to array */
pIntfIDItem = (IntfIDItem*)HeapAlloc(hHeap, 0, sizeof(IntfIDItem));
list_add_head(&IntfIDList->entry, &pIntfIDItem->entry);
pEntityID++;
}
-
+
/* Calculate needed size */
outNumberOfBytes = 0;
LIST_FOR_EACH_ENTRY(pIntfIDItem, &IntfIDList->entry, struct _IntfIDItem, entry)
{
outNumberOfBytes += (pIntfIDItem->numaddr * sizeof(INTERFACE_INFO));
- }
+ }
DPRINT("Buffer size needed: %lu\n", outNumberOfBytes);
if (outNumberOfBytes > OutputBufferLength)
{
res = WSAEFAULT;
goto cleanup;
}
-
+
/* Get address info */
RtlZeroMemory(&inTcpReq1,sizeof(inTcpReq1));
inTcpReq1.ID.toi_class = INFO_CLASS_PROTOCOL;
BufLen = sizeof(IPAddrEntry) * pIntfIDItem->numaddr;
pIntfIDItem->pIPAddrEntry0 = HeapAlloc(hHeap, 0, BufLen);
-
+
if (!DeviceIoControl(
TcpFile,
IOCTL_TCP_QUERY_INFORMATION_EX,
pIntfInfo->iiFlags = IFF_BROADCAST | IFF_MULTICAST;
if (pIPAddrEntry->iae_addr == ntohl(INADDR_LOOPBACK))
pIntfInfo->iiFlags |= IFF_LOOPBACK;
-
+
pIPAddrEntry++;
pIntfInfo++;
}
res = NO_ERROR;
}
-
+
/* Get Interface up/down-state and patch pIntfInfo->iiFlags */
pEntityID = outEntityID;
- for (i1 = 0; i1 < outIDCount; i1++)
- {
+ for (i1 = 0; i1 < outIDCount; i1++)
+ {
res = GetTdiEntityType(TcpFile, pEntityID, &TdiType);
if (res != NO_ERROR)
goto cleanup;
-
+
if (TdiType != IF_MIB)
{
pEntityID++;
res = GetIFEntry(TcpFile, pEntityID, pIFEntry, IFEntryLen);
if (res != NO_ERROR)
goto cleanup;
-
+
/* if network isn't up -> no patch needed */
if (pIFEntry->if_operstatus < IF_OPER_STATUS_CONNECTING)
{
LIST_FOR_EACH_ENTRY(pIntfIDItem, &IntfIDList->entry, struct _IntfIDItem, entry)
{
pIPAddrEntry = pIntfIDItem->pIPAddrEntry0;
- for (iAddr = 0; iAddr < pIntfIDItem->numaddr; iAddr++)
+ for (iAddr = 0; iAddr < pIntfIDItem->numaddr; iAddr++)
{
if (pIPAddrEntry->iae_index == pIFEntry->if_index)
pIntfInfo->iiFlags |= IFF_UP;
pIntfInfo++;
}
}
-
+
pEntityID++;
}