/*
* PROJECT: ReactOS ipconfig utility
* LICENSE: GPL - See COPYING in the top level directory
- * FILE: apps/utils/net/ipconfig/ipconfig.c
+ * FILE: base/applications/network/ipconfig/ipconfig.c
* PURPOSE: Display IP info for net adapters
* PROGRAMMERS: Copyright 2005 - 2006 Ged Murphy (gedmurphy@gmail.com)
*/
0,
dwDataSize);
+ if (ConTypeTmp == NULL)
+ return NULL;
+
ConType = (LPTSTR)HeapAlloc(ProcessHeap,
0,
dwDataSize);
- if (ConType && ConTypeTmp)
- {
- if(RegQueryValueEx(hKey,
- _T("Name"),
- NULL,
- &dwType,
- (PBYTE)ConTypeTmp,
- &dwDataSize) != ERROR_SUCCESS)
- {
- HeapFree(ProcessHeap,
- 0,
- ConType);
-
- HeapFree(ProcessHeap,
- 0,
- ConTypeTmp);
- ConType = NULL;
- }
+ if (ConType == NULL)
+ {
+ HeapFree(ProcessHeap, 0, ConTypeTmp);
+ return NULL;
+ }
+
+ if(RegQueryValueEx(hKey,
+ _T("Name"),
+ NULL,
+ &dwType,
+ (PBYTE)ConTypeTmp,
+ &dwDataSize) != ERROR_SUCCESS)
+ {
+ HeapFree(ProcessHeap,
+ 0,
+ ConType);
- if (ConType) CharToOem(ConTypeTmp, ConType);
+ ConType = NULL;
}
+
+ if (ConType) CharToOem(ConTypeTmp, ConType);
+ HeapFree(ProcessHeap, 0, ConTypeTmp);
}
}
(PBYTE)lpConDesc,
&dwDataSize) != ERROR_SUCCESS)
{
+ HeapFree(ProcessHeap, 0, lpConDesc);
lpConDesc = NULL;
goto CLEANUP;
}
RegCloseKey(hBaseKey);
if (hClassKey != NULL)
RegCloseKey(hClassKey);
- if (lpConDesc != NULL)
+ if (lpPath != NULL)
HeapFree(ProcessHeap, 0, lpPath);
- if (lpConDesc != NULL)
+ if (lpKeyClass != NULL)
HeapFree(ProcessHeap, 0, lpKeyClass);
return lpConDesc;
if (pAdapter->HaveWins)
{
_tprintf(_T("\tPrimary WINS Server . . . . . . . : %s\n"), pAdapter->PrimaryWinsServer.IpAddress.String);
- _tprintf(_T("\tSecondard WINS Server . . . . . . : %s\n"), pAdapter->SecondaryWinsServer.IpAddress.String);
+ _tprintf(_T("\tSecondary WINS Server . . . . . . : %s\n"), pAdapter->SecondaryWinsServer.IpAddress.String);
}
- if (pAdapter->DhcpEnabled)
+ if (pAdapter->DhcpEnabled && _tcscmp(pAdapter->DhcpServer.IpAddress.String, _T("255.255.255.255")))
{
_tprintf(_T("\tLease Obtained. . . . . . . . . . : %s"), _tasctime(localtime(&pAdapter->LeaseObtained)));
_tprintf(_T("\tLease Expires . . . . . . . . . . : %s"), _tasctime(localtime(&pAdapter->LeaseExpires)));
for (i = 0; i < pInfo->NumAdapters; i++)
{
CopyMemory(&AdapterInfo, &pInfo->Adapter[i], sizeof(IP_ADAPTER_INDEX_MAP));
- _tprintf(_T("name - %S\n"), pInfo->Adapter[i].Name);
+ _tprintf(_T("name - %ls\n"), pInfo->Adapter[i].Name);
/* Call IpReleaseAddress to release the IP address on the specified adapter. */
if ((ret = IpReleaseAddress(&AdapterInfo)) != NO_ERROR)
{
- _tprintf(_T("\nAn error occured while releasing interface %S : \n"), AdapterInfo.Name);
+ _tprintf(_T("\nAn error occured while releasing interface %ls : \n"), AdapterInfo.Name);
DoFormatMessage(ret);
}
}
for (i = 0; i < pInfo->NumAdapters; i++)
{
CopyMemory(&AdapterInfo, &pInfo->Adapter[i], sizeof(IP_ADAPTER_INDEX_MAP));
- _tprintf(_T("name - %S\n"), pInfo->Adapter[i].Name);
+ _tprintf(_T("name - %ls\n"), pInfo->Adapter[i].Name);
/* Call IpRenewAddress to renew the IP address on the specified adapter. */
Size))
{
_tprintf(_T("%s"), lpUsage);
- }
+ }
+
+ HeapFree(ProcessHeap, 0, lpUsage);
}
}