#define _UNICODE
-PTCHAR GetNodeTypeName(UINT NodeType)
+
+LPCTSTR GetNodeTypeName(UINT NodeType)
{
switch (NodeType) {
case 1: return _T("Broadcast");
}
}
-PTCHAR GetInterfaceTypeName(UINT InterfaceType)
+LPCTSTR GetInterfaceTypeName(UINT InterfaceType)
{
switch (InterfaceType) {
case MIB_IF_TYPE_OTHER: return _T("Other Type Of Adapter");
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);
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;
}
_tprintf(_T("\nReactOS IP Configuration\n\n"));
+
+ if (bAll)
+ {
+ _tprintf(_T("\tHost Name . . . . . . . . . . . . : %s\n"), pFixedInfo->HostName);
+ _tprintf(_T("\tPrimary DNS Suffix. . . . . . . . : \n"));
+ _tprintf(_T("\tNode Type . . . . . . . . . . . . : %s\n"), GetNodeTypeName(pFixedInfo->NodeType));
+ if (pFixedInfo->EnableRouting)
+ _tprintf(_T("\tIP Routing Enabled. . . . . . . . : Yes\n"));
+ else
+ _tprintf(_T("\tIP Routing Enabled. . . . . . . . : No\n"));
+ if (pAdapter->HaveWins)
+ _tprintf(_T("\tWINS Proxy enabled. . . . . . . . : Yes\n"));
+ else
+ _tprintf(_T("\tWINS Proxy enabled. . . . . . . . : No\n"));
+ _tprintf(_T("\tDNS Suffix Search List. . . . . . : %s\n"), pFixedInfo->DomainName);
+ }
+
while (pAdapter)
{
- if (bAll)
- {
- _tprintf(_T("\tHost Name . . . . . . . . . . . . : %s\n"), pFixedInfo->HostName);
- _tprintf(_T("\tPrimary DNS Suffix. . . . . . . . : \n"));
- _tprintf(_T("\tNode Type . . . . . . . . . . . . : %s\n"), GetNodeTypeName(pFixedInfo->NodeType));
- if (pFixedInfo->EnableRouting)
- _tprintf(_T("\tIP Routing Enabled. . . . . . . . : Yes\n"));
- else
- _tprintf(_T("\tIP Routing Enabled. . . . . . . . : No\n"));
- if (pAdapter->HaveWins)
- _tprintf(_T("\tWINS Proxy enabled. . . . . . . . : Yes\n"));
- else
- _tprintf(_T("\tWINS Proxy enabled. . . . . . . . : No\n"));
- _tprintf(_T("\tDNS Suffix Search List. . . . . . : %s\n"), pFixedInfo->DomainName);
- }
_tprintf(_T("\n%s ...... : \n\n"), GetInterfaceTypeName(pAdapter->Type));
if (Index == (TCHAR)NULL)
{
PIP_INTERFACE_INFO pInfo;
+ ULONG ulOutBufLen;
pInfo = (IP_INTERFACE_INFO *) malloc(sizeof(IP_INTERFACE_INFO));
- ULONG ulOutBufLen = 0;
+ ulOutBufLen = 0;
/* Make an initial call to GetInterfaceInfo to get
* the necessary size into the ulOutBufLen variable */
if (Index == (TCHAR)NULL)
{
PIP_INTERFACE_INFO pInfo;
+ ULONG ulOutBufLen;
pInfo = (IP_INTERFACE_INFO *) malloc(sizeof(IP_INTERFACE_INFO));
- ULONG ulOutBufLen = 0;
+ ulOutBufLen = 0;
/* Make an initial call to GetInterfaceInfo to get
* the necessary size into the ulOutBufLen variable */
{
// Declare and initialize variables
PIP_INTERFACE_INFO pInfo;
+ ULONG ulOutBufLen;
+ DWORD dwRetVal;
+
pInfo = (IP_INTERFACE_INFO *) malloc( sizeof(IP_INTERFACE_INFO) );
- ULONG ulOutBufLen = sizeof(IP_INTERFACE_INFO);
- DWORD dwRetVal = 0;
+ ulOutBufLen = sizeof(IP_INTERFACE_INFO);
+ dwRetVal = 0;
// Make an initial call to GetInterfaceInfo to get