Display more meaningful failure messages
Modified: trunk/reactos/apps/utils/net/ipconfig/ipconfig.c
_____
Modified: trunk/reactos/apps/utils/net/ipconfig/ipconfig.c
--- trunk/reactos/apps/utils/net/ipconfig/ipconfig.c 2005-11-15
22:35:15 UTC (rev 19256)
+++ trunk/reactos/apps/utils/net/ipconfig/ipconfig.c 2005-11-15
22:44:46 UTC (rev 19257)
@@ -32,6 +32,7 @@
#define _UNICODE
+
LPCTSTR GetNodeTypeName(UINT NodeType)
{
switch (NodeType) {
@@ -104,6 +105,8 @@
ULONG netOutBufLen;
PIP_ADDR_STRING pIPAddr = NULL;
+ DWORD ErrRet = 0;
+
/* assign memory for call to GetNetworkParams */
pFixedInfo = (FIXED_INFO *) GlobalAlloc( GPTR, sizeof( FIXED_INFO )
);
netOutBufLen = sizeof(FIXED_INFO);
@@ -126,15 +129,17 @@
pAdapterInfo = (IP_ADAPTER_INFO *) malloc (adaptOutBufLen);
}
- if (! GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen) == NO_ERROR)
+ if ((ErrRet = GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen)) !=
NO_ERROR)
{
- _tprintf(_T("GetAdaptersInfo failed %lu\n"),
GetLastError());
+ _tprintf(_T("GetAdaptersInfo failed : "));
+ DoFormatMessage(ErrRet);
return EXIT_FAILURE;
}
- if (! GetNetworkParams(pFixedInfo, &netOutBufLen) == NO_ERROR)
+ if ((ErrRet = GetNetworkParams(pFixedInfo, &netOutBufLen)) !=
NO_ERROR)
{
- _tprintf(_T("GetNetworkParams failed %lu\n"), GetLastError());
+ _tprintf(_T("GetNetworkParams failed : "));
+ DoFormatMessage(ErrRet);
return EXIT_FAILURE;
}