Properly return status in iphplapi, and don't close the file handle
before we use it in getNumInterfacesInt.
Modified: trunk/reactos/lib/iphlpapi/ifenum_reactos.c
_____
Modified: trunk/reactos/lib/iphlpapi/ifenum_reactos.c
--- trunk/reactos/lib/iphlpapi/ifenum_reactos.c 2005-09-23 00:05:38 UTC
(rev 17993)
+++ trunk/reactos/lib/iphlpapi/ifenum_reactos.c 2005-09-23 03:50:03 UTC
(rev 17994)
@@ -166,8 +166,10 @@
&allocationSizeForEntityArray,
NULL );
- if( !NT_SUCCESS(status) ) {
- return status;
+ if(!status)
+ {
+ DPRINT("IOCTL Failed\n");
+ return STATUS_UNSUCCESSFUL;
}
arraySize = allocationSizeForEntityArray;
@@ -195,9 +197,10 @@
HeapFree( GetProcessHeap(), 0, entitySet );
entitySet = 0;
- if( !NT_SUCCESS(status) ) {
- DPRINT("TdiGetSetOfThings() => %08x\n", (int)status);
- return status;
+ if(!status)
+ {
+ DPRINT("IOCTL Failed\n");
+ return STATUS_UNSUCCESSFUL;
}
DPRINT("TdiGetSetOfThings(): Array changed size: %d -> %d.\n",
@@ -241,10 +244,11 @@
&returnSize,
NULL );
- if( !NT_SUCCESS(status) ) {
- TRACE("failure: %08x\n", status);
- return status;
- } else TRACE("Success.\n");
+ if(!status)
+ {
+ DPRINT("IOCTL Failed\n");
+ return STATUS_UNSUCCESSFUL;
+ }
DPRINT("TdiGetMibForIfEntity() => {\n"
" if_index ....................... %x\n"
@@ -339,7 +343,7 @@
DPRINT("TdiGetEntityType() => %08x %08x\n", *type, status);
- return status;
+ return (status ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
}
static NTSTATUS getInterfaceInfoSet( HANDLE tcpFile,
@@ -425,8 +429,6 @@
return 0;
}
- closeTcpFile( tcpFile );
-
for( i = 0; i < numEntities; i++ ) {
if( isInterface( &entitySet[i] ) &&
(!onlyNonLoopback ||
@@ -437,6 +439,8 @@
DPRINT("getNumInterfaces: success: %d %d %08x\n",
onlyNonLoopback, numInterfaces, status );
+ closeTcpFile( tcpFile );
+
tdiFreeThingSet( entitySet );
return numInterfaces;