Add more debug info and better error control, from Elrond. A few minor changes by me. Modified: trunk/reactos/lib/iphlpapi/ifenum_reactos.c Modified: trunk/reactos/lib/iphlpapi/iphlpapi_main.c _____
Modified: trunk/reactos/lib/iphlpapi/ifenum_reactos.c --- trunk/reactos/lib/iphlpapi/ifenum_reactos.c 2005-11-27 06:48:34 UTC (rev 19675) +++ trunk/reactos/lib/iphlpapi/ifenum_reactos.c 2005-11-27 11:29:07 UTC (rev 19676) @@ -40,7 +40,7 @@
#include "ifenum.h" #include <assert.h>
-#define NDEBUG +#define DEBUG #include "debug.h"
/* Globals */ @@ -95,7 +95,9 @@ /* String does not need to be freed: it points to the constant * string we provided */
- TRACE("returning %08x\n", (int)status); + if (!NT_SUCCESS(status)) { + DPRINT1("openTcpFile for <%wZ> failed: 0x%lx\n", &fileName, status); + }
return status; } @@ -356,9 +358,13 @@ BOOL interfaceInfoComplete; int curInterf = 0, i;
- if( NT_SUCCESS(status) ) - infoSetInt = HeapAlloc( GetProcessHeap(), 0, - sizeof(IFInfo) * numEntities ); + if (!NT_SUCCESS(status)) { + DPRINT1("getInterfaceInfoSet: tdiGetEntityIDSet() failed: 0x%lx\n", status); + return status; + } + + infoSetInt = HeapAlloc( GetProcessHeap(), 0, + sizeof(IFInfo) * numEntities );
if( infoSetInt ) { for( i = 0; i < numEntities; i++ ) { @@ -643,6 +649,11 @@ name ? getInterfaceInfoByName( tcpFile, name, ifInfo ) : getInterfaceInfoByIndex( tcpFile, index, ifInfo ); + + if (!NT_SUCCESS(status)) { + DPRINT1("getIPAddrEntryForIf returning %lx\n", status); + } + return status; }
@@ -848,10 +859,14 @@ *NteInstance = Data.NewAddress; }
+ if (!NT_SUCCESS(status)) { + DPRINT1("addIPAddress for if %d returning 0x%lx\n", IfIndex, status); + } + switch( status ) { - case STATUS_SUCCESS: return ERROR_SUCCESS; - case STATUS_DEVICE_DOES_NOT_EXIST: return ERROR_DEV_NOT_EXIST; - default: return status; + case STATUS_SUCCESS: return ERROR_SUCCESS; + case STATUS_DEVICE_DOES_NOT_EXIST: return ERROR_DEV_NOT_EXIST; + default: return status; } }
@@ -878,6 +893,13 @@
closeTcpFile( tcpFile );
- if( NT_SUCCESS(status) ) return ERROR_SUCCESS; - else return ERROR_GEN_FAILURE; + if (!NT_SUCCESS(status)) { + DPRINT1("deleteIpAddress(%lu) returning 0x%lx\n", NteContext, status); + } + + + if( NT_SUCCESS(status) ) + return ERROR_SUCCESS; + else + return ERROR_GEN_FAILURE; } _____
Modified: trunk/reactos/lib/iphlpapi/iphlpapi_main.c --- trunk/reactos/lib/iphlpapi/iphlpapi_main.c 2005-11-27 06:48:34 UTC (rev 19675) +++ trunk/reactos/lib/iphlpapi/iphlpapi_main.c 2005-11-27 11:29:07 UTC (rev 19676) @@ -37,7 +37,7 @@
# include <resolv.h> #endif
- +#define DEBUG #include "windef.h" #include "winbase.h" #include "winreg.h" @@ -84,7 +84,7 @@ */ DWORD WINAPI AddIPAddress(IPAddr Address, IPMask Netmask, DWORD IfIndex, PULONG NteContext, PULONG NteInstance) { - return addIPAddress( Address, Netmask, IfIndex, NteContext, NteInstance ); + return RtlNtStatusToDosError(addIPAddress(Address, Netmask, IfIndex, NteContext, NteInstance)); }
@@ -402,7 +402,7 @@ DWORD WINAPI DeleteIPAddress(ULONG NTEContext) { TRACE("NTEContext %ld\n", NTEContext); - return deleteIpAddress( NTEContext ); + return RtlNtStatusToDosError(deleteIpAddress(NTEContext)); }
@@ -613,7 +613,7 @@ winsEnabled = TRUE; RegCloseKey(hKey); } - + TRACE("num of index is %lu\n", table->numIndexes); for (ndx = 0; ndx < table->numIndexes; ndx++) { PIP_ADAPTER_INFO ptr = &pAdapterInfo[ndx]; DWORD addrLen = sizeof(ptr->Address), type;