Add more debug info and better error control, from Elrond.

A few minor changes by me.

svn path=/trunk/; revision=19676
This commit is contained in:
Ged Murphy 2005-11-27 11:29:07 +00:00
parent 9741e018d3
commit cb203ac20a
2 changed files with 36 additions and 14 deletions

View file

@ -40,7 +40,7 @@
#include "ifenum.h" #include "ifenum.h"
#include <assert.h> #include <assert.h>
#define NDEBUG #define DEBUG
#include "debug.h" #include "debug.h"
/* Globals */ /* Globals */
@ -95,7 +95,9 @@ NTSTATUS openTcpFile(PHANDLE tcpFile) {
/* String does not need to be freed: it points to the constant /* String does not need to be freed: it points to the constant
* string we provided */ * 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; return status;
} }
@ -356,7 +358,11 @@ static NTSTATUS getInterfaceInfoSet( HANDLE tcpFile,
BOOL interfaceInfoComplete; BOOL interfaceInfoComplete;
int curInterf = 0, i; int curInterf = 0, i;
if( NT_SUCCESS(status) ) if (!NT_SUCCESS(status)) {
DPRINT1("getInterfaceInfoSet: tdiGetEntityIDSet() failed: 0x%lx\n", status);
return status;
}
infoSetInt = HeapAlloc( GetProcessHeap(), 0, infoSetInt = HeapAlloc( GetProcessHeap(), 0,
sizeof(IFInfo) * numEntities ); sizeof(IFInfo) * numEntities );
@ -643,6 +649,11 @@ NTSTATUS getIPAddrEntryForIf(HANDLE tcpFile,
name ? name ?
getInterfaceInfoByName( tcpFile, name, ifInfo ) : getInterfaceInfoByName( tcpFile, name, ifInfo ) :
getInterfaceInfoByIndex( tcpFile, index, ifInfo ); getInterfaceInfoByIndex( tcpFile, index, ifInfo );
if (!NT_SUCCESS(status)) {
DPRINT1("getIPAddrEntryForIf returning %lx\n", status);
}
return status; return status;
} }
@ -848,6 +859,10 @@ NTSTATUS addIPAddress( IPAddr Address, IPMask Mask, DWORD IfIndex,
*NteInstance = Data.NewAddress; *NteInstance = Data.NewAddress;
} }
if (!NT_SUCCESS(status)) {
DPRINT1("addIPAddress for if %d returning 0x%lx\n", IfIndex, status);
}
switch( status ) { switch( status ) {
case STATUS_SUCCESS: return ERROR_SUCCESS; case STATUS_SUCCESS: return ERROR_SUCCESS;
case STATUS_DEVICE_DOES_NOT_EXIST: return ERROR_DEV_NOT_EXIST; case STATUS_DEVICE_DOES_NOT_EXIST: return ERROR_DEV_NOT_EXIST;
@ -878,6 +893,13 @@ NTSTATUS deleteIpAddress( ULONG NteContext )
closeTcpFile( tcpFile ); closeTcpFile( tcpFile );
if( NT_SUCCESS(status) ) return ERROR_SUCCESS; if (!NT_SUCCESS(status)) {
else return ERROR_GEN_FAILURE; DPRINT1("deleteIpAddress(%lu) returning 0x%lx\n", NteContext, status);
}
if( NT_SUCCESS(status) )
return ERROR_SUCCESS;
else
return ERROR_GEN_FAILURE;
} }

View file

@ -37,7 +37,7 @@
# include <resolv.h> # include <resolv.h>
#endif #endif
#define DEBUG
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winreg.h" #include "winreg.h"
@ -84,7 +84,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
*/ */
DWORD WINAPI AddIPAddress(IPAddr Address, IPMask Netmask, DWORD IfIndex, PULONG NteContext, PULONG NteInstance) 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 CreateProxyArpEntry(DWORD dwAddress, DWORD dwMask, DWORD dwIfIndex)
DWORD WINAPI DeleteIPAddress(ULONG NTEContext) DWORD WINAPI DeleteIPAddress(ULONG NTEContext)
{ {
TRACE("NTEContext %ld\n", NTEContext); TRACE("NTEContext %ld\n", NTEContext);
return deleteIpAddress( NTEContext ); return RtlNtStatusToDosError(deleteIpAddress(NTEContext));
} }
@ -613,7 +613,7 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
winsEnabled = TRUE; winsEnabled = TRUE;
RegCloseKey(hKey); RegCloseKey(hKey);
} }
TRACE("num of index is %lu\n", table->numIndexes);
for (ndx = 0; ndx < table->numIndexes; ndx++) { for (ndx = 0; ndx < table->numIndexes; ndx++) {
PIP_ADAPTER_INFO ptr = &pAdapterInfo[ndx]; PIP_ADAPTER_INFO ptr = &pAdapterInfo[ndx];
DWORD addrLen = sizeof(ptr->Address), type; DWORD addrLen = sizeof(ptr->Address), type;