ReactOS  0.4.14-dev-77-gd9e7c48
ipconfig.c File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <winreg.h>
#include <stdio.h>
#include <tchar.h>
#include <time.h>
#include <iphlpapi.h>
#include "resource.h"
Include dependency graph for ipconfig.c:

Go to the source code of this file.

Macros

#define GUID_LEN   40
 

Functions

int LoadStringAndOem (HINSTANCE hInst, UINT uID, LPTSTR szNode, int byteSize)
 
LPTSTR GetNodeTypeName (UINT NodeType)
 
LPTSTR GetInterfaceTypeName (UINT InterfaceType)
 
PTCHAR PrintMacAddr (PBYTE Mac)
 
VOID DoFormatMessage (LONG ErrorCode)
 
LPTSTR GetConnectionType (LPTSTR lpClass)
 
LPTSTR GetConnectionDescription (LPTSTR lpClass)
 
VOID ShowInfo (BOOL bAll)
 
VOID Release (LPTSTR Index)
 
VOID Renew (LPTSTR Index)
 
VOID Usage (VOID)
 
int main (int argc, char *argv[])
 

Variables

HINSTANCE hInstance
 
HANDLE ProcessHeap
 

Macro Definition Documentation

◆ GUID_LEN

#define GUID_LEN   40

Definition at line 27 of file ipconfig.c.

Function Documentation

◆ DoFormatMessage()

VOID DoFormatMessage ( LONG  ErrorCode)

Definition at line 151 of file ipconfig.c.

152 {
153  LPVOID lpMsgBuf;
154  //DWORD ErrorCode;
155 
156  if (ErrorCode == 0)
158 
162  NULL,
163  ErrorCode,
164  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
165  (LPTSTR) &lpMsgBuf,
166  0,
167  NULL))
168  {
169  _tprintf(_T("%s"), (LPTSTR)lpMsgBuf);
170  LocalFree(lpMsgBuf);
171  }
172 }
#define _tprintf
Definition: tchar.h:506
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define LANG_NEUTRAL
Definition: nls.h:22
#define SUBLANG_DEFAULT
Definition: nls.h:168
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
smooth NULL
Definition: ftsmooth.c:416
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
#define _T(x)
Definition: vfdio.h:22
#define FormatMessage
Definition: winbase.h:3612
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:401
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define MAKELANGID(p, s)
Definition: nls.h:15

Referenced by GetConnectionDescription(), Release(), Renew(), and ShowInfo().

◆ GetConnectionDescription()

LPTSTR GetConnectionDescription ( LPTSTR  lpClass)

Definition at line 251 of file ipconfig.c.

252 {
253  HKEY hBaseKey = NULL;
254  HKEY hClassKey = NULL;
255  LPTSTR lpKeyClass = NULL;
256  LPTSTR lpConDesc = NULL;
257  LPTSTR lpPath = NULL;
258  TCHAR szPrePath[] = _T("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\");
259  DWORD dwType;
260  DWORD dwDataSize;
261  INT i;
262 
264  szPrePath,
265  0,
266  KEY_READ,
267  &hBaseKey) != ERROR_SUCCESS)
268  {
269  return NULL;
270  }
271 
272  for (i = 0; ; i++)
273  {
274  DWORD PathSize;
275  LONG Status;
276  TCHAR szName[10];
277  DWORD NameLen = 9;
278 
279  if ((Status = RegEnumKeyEx(hBaseKey,
280  i,
281  szName,
282  &NameLen,
283  NULL,
284  NULL,
285  NULL,
286  NULL)) != ERROR_SUCCESS)
287  {
289  {
291  lpConDesc = NULL;
292  goto CLEANUP;
293  }
294  else
295  continue;
296  }
297 
298  PathSize = lstrlen(szPrePath) + lstrlen(szName) + 1;
299  lpPath = (LPTSTR)HeapAlloc(ProcessHeap,
300  0,
301  PathSize * sizeof(TCHAR));
302  if (lpPath == NULL)
303  goto CLEANUP;
304 
305  wsprintf(lpPath, _T("%s%s"), szPrePath, szName);
306 
307  //MessageBox(NULL, lpPath, NULL, 0);
308 
310  lpPath,
311  0,
312  KEY_READ,
314  {
315  goto CLEANUP;
316  }
317 
318  HeapFree(ProcessHeap, 0, lpPath);
319  lpPath = NULL;
320 
322  _T("NetCfgInstanceId"),
323  NULL,
324  &dwType,
325  NULL,
326  &dwDataSize) == ERROR_SUCCESS)
327  {
328  lpKeyClass = (LPTSTR)HeapAlloc(ProcessHeap,
329  0,
330  dwDataSize);
331  if (lpKeyClass == NULL)
332  goto CLEANUP;
333 
335  _T("NetCfgInstanceId"),
336  NULL,
337  &dwType,
338  (PBYTE)lpKeyClass,
339  &dwDataSize) != ERROR_SUCCESS)
340  {
341  HeapFree(ProcessHeap, 0, lpKeyClass);
342  lpKeyClass = NULL;
343  continue;
344  }
345  }
346  else
347  continue;
348 
349  if (!lstrcmp(lpClass, lpKeyClass))
350  {
351  HeapFree(ProcessHeap, 0, lpKeyClass);
352  lpKeyClass = NULL;
353 
355  _T("DriverDesc"),
356  NULL,
357  &dwType,
358  NULL,
359  &dwDataSize) == ERROR_SUCCESS)
360  {
361  lpConDesc = (LPTSTR)HeapAlloc(ProcessHeap,
362  0,
363  dwDataSize);
364  if (lpConDesc == NULL)
365  goto CLEANUP;
366 
368  _T("DriverDesc"),
369  NULL,
370  &dwType,
371  (PBYTE)lpConDesc,
372  &dwDataSize) != ERROR_SUCCESS)
373  {
374  HeapFree(ProcessHeap, 0, lpConDesc);
375  lpConDesc = NULL;
376  goto CLEANUP;
377  }
378  }
379  else
380  {
381  lpConDesc = NULL;
382  }
383 
384  break;
385  }
386  }
387 
388 CLEANUP:
389  if (hBaseKey != NULL)
390  RegCloseKey(hBaseKey);
391  if (hClassKey != NULL)
393  if (lpPath != NULL)
394  HeapFree(ProcessHeap, 0, lpPath);
395  if (lpKeyClass != NULL)
396  HeapFree(ProcessHeap, 0, lpKeyClass);
397 
398  return lpConDesc;
399 }
#define RegQueryValueEx
Definition: winreg.h:524
#define CLEANUP
Definition: ntuser.h:5
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
#define KEY_READ
Definition: nt_native.h:1023
int32_t INT
Definition: typedefs.h:56
CHAR * LPTSTR
Definition: xmlstorage.h:192
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
HKEY hClassKey
Definition: umpnpmgr.c:45
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HANDLE ProcessHeap
Definition: ipconfig.c:30
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RegEnumKeyEx
Definition: winreg.h:510
#define lstrcmp
Definition: winbase.h:3689
Status
Definition: gdiplustypes.h:24
#define RegOpenKeyEx
Definition: winreg.h:520
#define lstrlen
Definition: winbase.h:3693
static const WCHAR szName[]
Definition: msipriv.h:1194
#define wsprintf
Definition: winuser.h:5766
BYTE * PBYTE
Definition: pedump.c:66
#define HeapFree(x, y, z)
Definition: compat.h:394
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
VOID DoFormatMessage(LONG ErrorCode)
Definition: ipconfig.c:151

Referenced by ShowInfo().

◆ GetConnectionType()

LPTSTR GetConnectionType ( LPTSTR  lpClass)

Definition at line 175 of file ipconfig.c.

176 {
177  HKEY hKey = NULL;
178  LPTSTR ConType = NULL;
179  LPTSTR ConTypeTmp = NULL;
180  TCHAR Path[256];
181  LPTSTR PrePath = _T("SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\");
182  LPTSTR PostPath = _T("\\Connection");
183  DWORD PathSize;
184  DWORD dwType;
185  DWORD dwDataSize;
186 
187  /* don't overflow the buffer */
188  PathSize = lstrlen(PrePath) + lstrlen(lpClass) + lstrlen(PostPath) + 1;
189  if (PathSize >= 255)
190  return NULL;
191 
192  wsprintf(Path, _T("%s%s%s"), PrePath, lpClass, PostPath);
193 
195  Path,
196  0,
197  KEY_READ,
198  &hKey) == ERROR_SUCCESS)
199  {
200  if (RegQueryValueEx(hKey,
201  _T("Name"),
202  NULL,
203  &dwType,
204  NULL,
205  &dwDataSize) == ERROR_SUCCESS)
206  {
207  ConTypeTmp = (LPTSTR)HeapAlloc(ProcessHeap,
208  0,
209  dwDataSize);
210 
211  if (ConTypeTmp == NULL)
212  return NULL;
213 
214  ConType = (LPTSTR)HeapAlloc(ProcessHeap,
215  0,
216  dwDataSize);
217 
218  if (ConType == NULL)
219  {
220  HeapFree(ProcessHeap, 0, ConTypeTmp);
221  return NULL;
222  }
223 
224  if (RegQueryValueEx(hKey,
225  _T("Name"),
226  NULL,
227  &dwType,
228  (PBYTE)ConTypeTmp,
229  &dwDataSize) != ERROR_SUCCESS)
230  {
232  0,
233  ConType);
234 
235  ConType = NULL;
236  }
237 
238  if (ConType)
239  CharToOem(ConTypeTmp, ConType);
240  HeapFree(ProcessHeap, 0, ConTypeTmp);
241  }
242  }
243 
244  if (hKey != NULL)
245  RegCloseKey(hKey);
246 
247  return ConType;
248 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
CHAR * LPTSTR
Definition: xmlstorage.h:192
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:416
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HANDLE ProcessHeap
Definition: ipconfig.c:30
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RegOpenKeyEx
Definition: winreg.h:520
#define lstrlen
Definition: winbase.h:3693
PRTL_UNICODE_STRING_BUFFER Path
#define CharToOem
Definition: winuser.h:5644
#define wsprintf
Definition: winuser.h:5766
BYTE * PBYTE
Definition: pedump.c:66
#define HeapFree(x, y, z)
Definition: compat.h:394
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by ShowInfo().

◆ GetInterfaceTypeName()

LPTSTR GetInterfaceTypeName ( UINT  InterfaceType)

Definition at line 88 of file ipconfig.c.

89 {
90  static TCHAR szIntType[25];
91 
92  switch (InterfaceType)
93  {
94  case MIB_IF_TYPE_OTHER:
95  if (!LoadStringAndOem(hInstance, IDS_OTHER, szIntType, sizeof(szIntType)))
96  return NULL;
97  break;
98 
100  if (!LoadStringAndOem(hInstance, IDS_ETH, szIntType, sizeof(szIntType)))
101  return NULL;
102  break;
103 
105  if (!LoadStringAndOem(hInstance, IDS_TOKEN, szIntType, sizeof(szIntType)))
106  return NULL;
107  break;
108 
109  case MIB_IF_TYPE_FDDI:
110  if (!LoadStringAndOem(hInstance, IDS_FDDI, szIntType, sizeof(szIntType)))
111  return NULL;
112  break;
113 
114  case MIB_IF_TYPE_PPP:
115  if (!LoadStringAndOem(hInstance, IDS_PPP, szIntType, sizeof(szIntType)))
116  return NULL;
117  break;
118 
120  if (!LoadStringAndOem(hInstance, IDS_LOOP, szIntType, sizeof(szIntType)))
121  return NULL;
122  break;
123 
124  case MIB_IF_TYPE_SLIP:
125  if (!LoadStringAndOem(hInstance, IDS_SLIP, szIntType, sizeof(szIntType)))
126  return NULL;
127  break;
128 
129  default:
130  if (!LoadStringAndOem(hInstance, IDS_UNKNOWN, szIntType, sizeof(szIntType)))
131  return NULL;
132  break;
133  }
134 
135  return szIntType;
136 }
#define IDS_PPP
Definition: resource.h:17
#define MIB_IF_TYPE_OTHER
Definition: ipifcons.h:222
#define IDS_FDDI
Definition: resource.h:16
#define IDS_TOKEN
Definition: resource.h:15
#define MIB_IF_TYPE_SLIP
Definition: ipifcons.h:228
#define MIB_IF_TYPE_LOOPBACK
Definition: ipifcons.h:227
#define MIB_IF_TYPE_FDDI
Definition: ipifcons.h:225
smooth NULL
Definition: ftsmooth.c:416
#define IDS_UNKNOWN
Definition: resource.h:7
#define IDS_OTHER
Definition: resource.h:13
char TCHAR
Definition: xmlstorage.h:189
#define MIB_IF_TYPE_PPP
Definition: ipifcons.h:226
#define MIB_IF_TYPE_ETHERNET
Definition: ipifcons.h:223
#define MIB_IF_TYPE_TOKENRING
Definition: ipifcons.h:224
HINSTANCE hInstance
Definition: ipconfig.c:29
#define IDS_SLIP
Definition: resource.h:19
#define IDS_LOOP
Definition: resource.h:18
int LoadStringAndOem(HINSTANCE hInst, UINT uID, LPTSTR szNode, int byteSize)
Definition: ipconfig.c:32
#define IDS_ETH
Definition: resource.h:14

Referenced by ShowInfo().

◆ GetNodeTypeName()

LPTSTR GetNodeTypeName ( UINT  NodeType)

Definition at line 52 of file ipconfig.c.

53 {
54  static TCHAR szNode[14];
55 
56  switch (NodeType)
57  {
58  case 1:
59  if (!LoadStringAndOem(hInstance, IDS_BCAST, szNode, sizeof(szNode)))
60  return NULL;
61  break;
62 
63  case 2:
64  if (!LoadStringAndOem(hInstance, IDS_P2P, szNode, sizeof(szNode)))
65  return NULL;
66  break;
67 
68  case 4:
69  if (!LoadStringAndOem(hInstance, IDS_MIXED, szNode, sizeof(szNode)))
70  return NULL;
71  break;
72 
73  case 8:
74  if (!LoadStringAndOem(hInstance, IDS_HYBRID, szNode, sizeof(szNode)))
75  return NULL;
76  break;
77 
78  default :
79  if (!LoadStringAndOem(hInstance, IDS_UNKNOWN, szNode, sizeof(szNode)))
80  return NULL;
81  break;
82  }
83 
84  return szNode;
85 }
#define IDS_P2P
Definition: resource.h:8
#define IDS_HYBRID
Definition: resource.h:10
#define IDS_BCAST
Definition: resource.h:7
smooth NULL
Definition: ftsmooth.c:416
NodeType
Definition: Node.h:5
#define IDS_UNKNOWN
Definition: resource.h:7
char TCHAR
Definition: xmlstorage.h:189
HINSTANCE hInstance
Definition: ipconfig.c:29
#define IDS_MIXED
Definition: resource.h:9
int LoadStringAndOem(HINSTANCE hInst, UINT uID, LPTSTR szNode, int byteSize)
Definition: ipconfig.c:32

Referenced by ShowInfo().

◆ LoadStringAndOem()

int LoadStringAndOem ( HINSTANCE  hInst,
UINT  uID,
LPTSTR  szNode,
int  byteSize 
)

Definition at line 32 of file ipconfig.c.

36 {
37  TCHAR *szTmp;
38  int res;
39 
40  szTmp = (LPTSTR)HeapAlloc(ProcessHeap, 0, byteSize);
41  if (szTmp == NULL)
42  {
43  return 0;
44  }
45 
46  res = LoadString(hInst, uID, szTmp, byteSize);
47  CharToOem(szTmp, szNode);
49  return res;
50 }
char szTmp[518]
CHAR * LPTSTR
Definition: xmlstorage.h:192
smooth NULL
Definition: ftsmooth.c:416
char TCHAR
Definition: xmlstorage.h:189
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HANDLE ProcessHeap
Definition: ipconfig.c:30
HINSTANCE hInst
Definition: dxdiag.c:13
#define CharToOem
Definition: winuser.h:5644
GLuint res
Definition: glext.h:9613
#define HeapFree(x, y, z)
Definition: compat.h:394
#define LoadString
Definition: winuser.h:5720

Referenced by GetInterfaceTypeName(), GetNodeTypeName(), and Usage().

◆ main()

int main ( int argc  ,
char argv[] 
)

Definition at line 767 of file ipconfig.c.

768 {
769  BOOL DoUsage=FALSE;
770  BOOL DoAll=FALSE;
771  BOOL DoRelease=FALSE;
772  BOOL DoRenew=FALSE;
773  BOOL DoFlushdns=FALSE;
774  BOOL DoRegisterdns=FALSE;
775  BOOL DoDisplaydns=FALSE;
776  BOOL DoShowclassid=FALSE;
777  BOOL DoSetclassid=FALSE;
778 
781 
782  /* Parse command line for options we have been given. */
783  if ((argc > 1) && (argv[1][0]=='/' || argv[1][0]=='-'))
784  {
785  if (!_tcsicmp(&argv[1][1], _T("?")))
786  {
787  DoUsage = TRUE;
788  }
789  else if (!_tcsnicmp(&argv[1][1], _T("ALL"), _tcslen(&argv[1][1])))
790  {
791  DoAll = TRUE;
792  }
793  else if (!_tcsnicmp(&argv[1][1], _T("RELEASE"), _tcslen(&argv[1][1])))
794  {
795  DoRelease = TRUE;
796  }
797  else if (!_tcsnicmp(&argv[1][1], _T("RENEW"), _tcslen(&argv[1][1])))
798  {
799  DoRenew = TRUE;
800  }
801  else if (!_tcsnicmp(&argv[1][1], _T("FLUSHDNS"), _tcslen(&argv[1][1])))
802  {
803  DoFlushdns = TRUE;
804  }
805  else if (!_tcsnicmp(&argv[1][1], _T("FLUSHREGISTERDNS"), _tcslen(&argv[1][1])))
806  {
807  DoRegisterdns = TRUE;
808  }
809  else if (!_tcsnicmp(&argv[1][1], _T("DISPLAYDNS"), _tcslen(&argv[1][1])))
810  {
811  DoDisplaydns = TRUE;
812  }
813  else if (!_tcsnicmp(&argv[1][1], _T("SHOWCLASSID"), _tcslen(&argv[1][1])))
814  {
815  DoShowclassid = TRUE;
816  }
817  else if (!_tcsnicmp(&argv[1][1], _T("SETCLASSID"), _tcslen(&argv[1][1])))
818  {
819  DoSetclassid = TRUE;
820  }
821  }
822 
823  switch (argc)
824  {
825  case 1: /* Default behaviour if no options are given*/
826  ShowInfo(FALSE);
827  break;
828  case 2: /* Process all the options that take no parameters */
829  if (DoUsage)
830  Usage();
831  else if (DoAll)
832  ShowInfo(TRUE);
833  else if (DoRelease)
834  Release(NULL);
835  else if (DoRenew)
836  Renew(NULL);
837  else if (DoFlushdns)
838  _tprintf(_T("\nSorry /flushdns is not implemented yet\n"));
839  else if (DoRegisterdns)
840  _tprintf(_T("\nSorry /registerdns is not implemented yet\n"));
841  else if (DoDisplaydns)
842  _tprintf(_T("\nSorry /displaydns is not implemented yet\n"));
843  else
844  Usage();
845  break;
846  case 3: /* Process all the options that can have 1 parameter */
847  if (DoRelease)
848  _tprintf(_T("\nSorry /release [adapter] is not implemented yet\n"));
849  //Release(argv[2]);
850  else if (DoRenew)
851  _tprintf(_T("\nSorry /renew [adapter] is not implemented yet\n"));
852  else if (DoShowclassid)
853  _tprintf(_T("\nSorry /showclassid adapter is not implemented yet\n"));
854  else if (DoSetclassid)
855  _tprintf(_T("\nSorry /setclassid adapter is not implemented yet\n"));
856  else
857  Usage();
858  break;
859  case 4: /* Process all the options that can have 2 parameters */
860  if (DoSetclassid)
861  _tprintf(_T("\nSorry /setclassid adapter [classid]is not implemented yet\n"));
862  else
863  Usage();
864  break;
865  default:
866  Usage();
867  }
868 
869  return 0;
870 }
static int argc
Definition: ServiceArgs.c:12
#define _tprintf
Definition: tchar.h:506
#define TRUE
Definition: types.h:120
VOID Usage(VOID)
Definition: ipconfig.c:730
#define _tcsicmp
Definition: xmlstorage.h:205
#define argv
Definition: mplay32.c:18
unsigned int BOOL
Definition: ntddk_ex.h:94
#define _tcsnicmp
Definition: xmlstorage.h:207
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:416
VOID Release(LPTSTR Index)
Definition: ipconfig.c:600
#define _T(x)
Definition: vfdio.h:22
#define GetProcessHeap()
Definition: compat.h:395
HANDLE ProcessHeap
Definition: ipconfig.c:30
#define GetModuleHandle
Definition: winbase.h:3644
HINSTANCE hInstance
Definition: ipconfig.c:29
VOID ShowInfo(BOOL bAll)
Definition: ipconfig.c:402
VOID Renew(LPTSTR Index)
Definition: ipconfig.c:662

◆ PrintMacAddr()

PTCHAR PrintMacAddr ( PBYTE  Mac)

Definition at line 140 of file ipconfig.c.

141 {
142  static TCHAR MacAddr[20];
143 
144  _stprintf(MacAddr, _T("%02x-%02x-%02x-%02x-%02x-%02x"),
145  Mac[0], Mac[1], Mac[2], Mac[3], Mac[4], Mac[5]);
146 
147  return MacAddr;
148 }
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define _stprintf
Definition: utility.h:124

Referenced by ShowInfo().

◆ Release()

VOID Release ( LPTSTR  Index)

Definition at line 600 of file ipconfig.c.

601 {
602  IP_ADAPTER_INDEX_MAP AdapterInfo;
603  DWORD ret;
604  DWORD i;
605 
606  /* if interface is not given, query GetInterfaceInfo */
607  if (Index == NULL)
608  {
609  PIP_INTERFACE_INFO pInfo = NULL;
610  ULONG ulOutBufLen = 0;
611 
612  if (GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER)
613  {
614  pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, ulOutBufLen);
615  if (pInfo == NULL)
616  return;
617 
618  if (GetInterfaceInfo(pInfo, &ulOutBufLen) == NO_ERROR )
619  {
620  for (i = 0; i < pInfo->NumAdapters; i++)
621  {
622  CopyMemory(&AdapterInfo, &pInfo->Adapter[i], sizeof(IP_ADAPTER_INDEX_MAP));
623  _tprintf(_T("name - %ls\n"), pInfo->Adapter[i].Name);
624 
625  /* Call IpReleaseAddress to release the IP address on the specified adapter. */
626  if ((ret = IpReleaseAddress(&AdapterInfo)) != NO_ERROR)
627  {
628  _tprintf(_T("\nAn error occured while releasing interface %ls : \n"), AdapterInfo.Name);
630  }
631  }
632 
633  HeapFree(ProcessHeap, 0, pInfo);
634  }
635  else
636  {
637  DoFormatMessage(0);
638  HeapFree(ProcessHeap, 0, pInfo);
639  return;
640  }
641  }
642  else
643  {
644  DoFormatMessage(0);
645  return;
646  }
647  }
648  else
649  {
650  ;
651  /* FIXME:
652  * we need to be able to release connections by name with support for globbing
653  * i.e. ipconfig /release Eth* will release all cards starting with Eth...
654  * ipconfig /release *con* will release all cards with 'con' in their name
655  */
656  }
657 }
DWORD WINAPI IpReleaseAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo)
#define _tprintf
Definition: tchar.h:506
IP_ADAPTER_INDEX_MAP Adapter[1]
Definition: ipexport.h:141
DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen)
#define NO_ERROR
Definition: dderror.h:5
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
WCHAR Name[MAX_ADAPTER_NAME]
Definition: ipexport.h:136
#define _T(x)
Definition: vfdio.h:22
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HANDLE ProcessHeap
Definition: ipconfig.c:30
#define CopyMemory
Definition: winbase.h:1633
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
VOID DoFormatMessage(LONG ErrorCode)
Definition: ipconfig.c:151

Referenced by main().

◆ Renew()

VOID Renew ( LPTSTR  Index)

Definition at line 662 of file ipconfig.c.

663 {
664  IP_ADAPTER_INDEX_MAP AdapterInfo;
665  DWORD i;
666 
667  /* if interface is not given, query GetInterfaceInfo */
668  if (Index == NULL)
669  {
670  PIP_INTERFACE_INFO pInfo;
671  ULONG ulOutBufLen = 0;
672 
674  if (pInfo == NULL)
675  {
676  _tprintf(_T("memory allocation error"));
677  return;
678  }
679 
680  /* Make an initial call to GetInterfaceInfo to get
681  * the necessary size into the ulOutBufLen variable */
682  if (GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER)
683  {
684  HeapFree(ProcessHeap, 0, pInfo);
685  pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, ulOutBufLen);
686  if (pInfo == NULL)
687  {
688  _tprintf(_T("memory allocation error"));
689  return;
690  }
691  }
692 
693  /* Make a second call to GetInterfaceInfo to get the actual data we want */
694  if (GetInterfaceInfo(pInfo, &ulOutBufLen) == NO_ERROR)
695  {
696  for (i = 0; i < pInfo->NumAdapters; i++)
697  {
698  CopyMemory(&AdapterInfo, &pInfo->Adapter[i], sizeof(IP_ADAPTER_INDEX_MAP));
699  _tprintf(_T("name - %ls\n"), pInfo->Adapter[i].Name);
700 
701  /* Call IpRenewAddress to renew the IP address on the specified adapter. */
702  if (IpRenewAddress(&AdapterInfo) != NO_ERROR)
703  {
704  _tprintf(_T("\nAn error occured while renew interface %s : "), _T("*name*"));
705  DoFormatMessage(0);
706  }
707  }
708  }
709  else
710  {
711  _tprintf(_T("\nGetInterfaceInfo failed : "));
712  DoFormatMessage(0);
713  }
714 
715  HeapFree(ProcessHeap, 0, pInfo);
716  }
717  else
718  {
719  ;
720  /* FIXME:
721  * we need to be able to renew connections by name with support for globbing
722  * i.e. ipconfig /renew Eth* will renew all cards starting with Eth...
723  * ipconfig /renew *con* will renew all cards with 'con' in their name
724  */
725  }
726 }
#define _tprintf
Definition: tchar.h:506
IP_ADAPTER_INDEX_MAP Adapter[1]
Definition: ipexport.h:141
DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen)
#define NO_ERROR
Definition: dderror.h:5
DWORD WINAPI IpRenewAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
WCHAR Name[MAX_ADAPTER_NAME]
Definition: ipexport.h:136
#define _T(x)
Definition: vfdio.h:22
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HANDLE ProcessHeap
Definition: ipconfig.c:30
#define CopyMemory
Definition: winbase.h:1633
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
VOID DoFormatMessage(LONG ErrorCode)
Definition: ipconfig.c:151

Referenced by main().

◆ ShowInfo()

VOID ShowInfo ( BOOL  bAll)

Definition at line 402 of file ipconfig.c.

403 {
404  MIB_IFROW mibEntry;
405  PIP_ADAPTER_INFO pAdapterInfo = NULL;
406  PIP_ADAPTER_INFO pAdapter = NULL;
407  ULONG adaptOutBufLen = 0;
408  PFIXED_INFO pFixedInfo = NULL;
409  ULONG netOutBufLen = 0;
410  PIP_PER_ADAPTER_INFO pPerAdapterInfo = NULL;
411  ULONG ulPerAdapterInfoLength = 0;
412  ULONG ret = 0;
413 
414  /* call GetAdaptersInfo to obtain the adapter info */
415  ret = GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen);
416  if (ret == ERROR_BUFFER_OVERFLOW)
417  {
418  pAdapterInfo = (IP_ADAPTER_INFO *)HeapAlloc(ProcessHeap, 0, adaptOutBufLen);
419  if (pAdapterInfo == NULL)
420  return;
421 
422  ret = GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen);
423  if (ret != NO_ERROR)
424  {
425  DoFormatMessage(0);
426  HeapFree(ProcessHeap, 0, pAdapterInfo);
427  return;
428  }
429  }
430  else
431  {
432  if (ret != ERROR_NO_DATA)
433  {
434  DoFormatMessage(0);
435  return;
436  }
437  }
438 
439  /* call GetNetworkParams to obtain the network info */
440  if (GetNetworkParams(pFixedInfo, &netOutBufLen) == ERROR_BUFFER_OVERFLOW)
441  {
442  pFixedInfo = (FIXED_INFO *)HeapAlloc(ProcessHeap, 0, netOutBufLen);
443  if (pFixedInfo == NULL)
444  {
445  if (pAdapterInfo)
446  HeapFree(ProcessHeap, 0, pAdapterInfo);
447  return;
448  }
449  if (GetNetworkParams(pFixedInfo, &netOutBufLen) != NO_ERROR)
450  {
451  DoFormatMessage(0);
452  if (pAdapterInfo)
453  HeapFree(ProcessHeap, 0, pAdapterInfo);
454  HeapFree(ProcessHeap, 0, pFixedInfo);
455  return;
456  }
457  }
458  else
459  {
460  if (pAdapterInfo)
461  HeapFree(ProcessHeap, 0, pAdapterInfo);
462  DoFormatMessage(0);
463  return;
464  }
465 
466  pAdapter = pAdapterInfo;
467 
468  _tprintf(_T("\nReactOS IP Configuration\n\n"));
469  if (bAll)
470  {
471  _tprintf(_T("\tHost Name . . . . . . . . . . . . : %s\n"), pFixedInfo->HostName);
472  _tprintf(_T("\tPrimary DNS Suffix. . . . . . . . : \n"));
473  _tprintf(_T("\tNode Type . . . . . . . . . . . . : %s\n"), GetNodeTypeName(pFixedInfo->NodeType));
474  if (pFixedInfo->EnableRouting)
475  _tprintf(_T("\tIP Routing Enabled. . . . . . . . : Yes\n"));
476  else
477  _tprintf(_T("\tIP Routing Enabled. . . . . . . . : No\n"));
478  if (pAdapter && pAdapter->HaveWins)
479  _tprintf(_T("\tWINS Proxy enabled. . . . . . . . : Yes\n"));
480  else
481  _tprintf(_T("\tWINS Proxy enabled. . . . . . . . : No\n"));
482  _tprintf(_T("\tDNS Suffix Search List. . . . . . : %s\n"), pFixedInfo->DomainName);
483  }
484 
485  while (pAdapter)
486  {
487  LPTSTR IntType, myConType;
489 
490  mibEntry.dwIndex = pAdapter->Index;
491  GetIfEntry(&mibEntry);
492 
493  IntType = GetInterfaceTypeName(pAdapter->Type);
494  myConType = GetConnectionType(pAdapter->AdapterName);
495 
496  _tprintf(_T("\n%s %s: \n\n"), IntType , myConType);
497 
498  if (myConType != NULL) HeapFree(ProcessHeap, 0, myConType);
499 
500  if (GetPerAdapterInfo(pAdapter->Index, pPerAdapterInfo, &ulPerAdapterInfoLength) == ERROR_BUFFER_OVERFLOW)
501  {
502  pPerAdapterInfo = (PIP_PER_ADAPTER_INFO)HeapAlloc(ProcessHeap, 0, ulPerAdapterInfoLength);
503  if (pPerAdapterInfo != NULL)
504  {
505  GetPerAdapterInfo(pAdapter->Index, pPerAdapterInfo, &ulPerAdapterInfoLength);
506  }
507  }
508 
509  /* check if the adapter is connected to the media */
511  {
512  bConnected = FALSE;
513  _tprintf(_T("\tMedia State . . . . . . . . . . . : Media disconnected\n"));
514  }
515  else
516  {
517  _tprintf(_T("\tConnection-specific DNS Suffix. . : %s\n"), pFixedInfo->DomainName);
518  }
519 
520  if (bAll)
521  {
522  LPTSTR lpDesc = GetConnectionDescription(pAdapter->AdapterName);
523  _tprintf(_T("\tDescription . . . . . . . . . . . : %s\n"), lpDesc);
524  HeapFree(ProcessHeap, 0, lpDesc);
525  _tprintf(_T("\tPhysical Address. . . . . . . . . : %s\n"), PrintMacAddr(pAdapter->Address));
526  if (bConnected)
527  {
528  if (pAdapter->DhcpEnabled)
529  {
530  _tprintf(_T("\tDHCP Enabled. . . . . . . . . . . : Yes\n"));
531  if (pPerAdapterInfo != NULL)
532  {
533  if (pPerAdapterInfo->AutoconfigEnabled)
534  _tprintf(_T("\tAutoconfiguration Enabled . . . . : Yes\n"));
535  else
536  _tprintf(_T("\tAutoconfiguration Enabled . . . . : No\n"));
537  }
538  }
539  else
540  {
541  _tprintf(_T("\tDHCP Enabled. . . . . . . . . . . : No\n"));
542  }
543  }
544  }
545 
546  if (!bConnected)
547  {
548  pAdapter = pAdapter->Next;
549  continue;
550  }
551 
552  _tprintf(_T("\tIP Address. . . . . . . . . . . . : %s\n"), pAdapter->IpAddressList.IpAddress.String);
553  _tprintf(_T("\tSubnet Mask . . . . . . . . . . . : %s\n"), pAdapter->IpAddressList.IpMask.String);
554  if (pAdapter->GatewayList.IpAddress.String[0] != '0')
555  _tprintf(_T("\tDefault Gateway . . . . . . . . . : %s\n"), pAdapter->GatewayList.IpAddress.String);
556  else
557  _tprintf(_T("\tDefault Gateway . . . . . . . . . :\n"));
558 
559  if (bAll)
560  {
561  PIP_ADDR_STRING pIPAddr;
562 
563  if (pAdapter->DhcpEnabled)
564  _tprintf(_T("\tDHCP Server . . . . . . . . . . . : %s\n"), pAdapter->DhcpServer.IpAddress.String);
565 
566  _tprintf(_T("\tDNS Servers . . . . . . . . . . . : "));
567  _tprintf(_T("%s\n"), pFixedInfo->DnsServerList.IpAddress.String);
568  pIPAddr = pFixedInfo->DnsServerList.Next;
569  while (pIPAddr)
570  {
571  _tprintf(_T("\t\t\t\t\t %s\n"), pIPAddr ->IpAddress.String );
572  pIPAddr = pIPAddr->Next;
573  }
574 
575  if (pAdapter->HaveWins)
576  {
577  _tprintf(_T("\tPrimary WINS Server . . . . . . . : %s\n"), pAdapter->PrimaryWinsServer.IpAddress.String);
578  _tprintf(_T("\tSecondary WINS Server . . . . . . : %s\n"), pAdapter->SecondaryWinsServer.IpAddress.String);
579  }
580 
581  if (pAdapter->DhcpEnabled && _tcscmp(pAdapter->DhcpServer.IpAddress.String, _T("255.255.255.255")))
582  {
583  _tprintf(_T("\tLease Obtained. . . . . . . . . . : %s"), _tasctime(localtime(&pAdapter->LeaseObtained)));
584  _tprintf(_T("\tLease Expires . . . . . . . . . . : %s"), _tasctime(localtime(&pAdapter->LeaseExpires)));
585  }
586  }
587  _tprintf(_T("\n"));
588 
589  HeapFree(ProcessHeap, 0, pPerAdapterInfo);
590  pPerAdapterInfo = NULL;
591 
592  pAdapter = pAdapter->Next;
593  }
594 
595  HeapFree(ProcessHeap, 0, pFixedInfo);
596  if (pAdapterInfo)
597  HeapFree(ProcessHeap, 0, pAdapterInfo);
598 }
#define _tprintf
Definition: tchar.h:506
#define TRUE
Definition: types.h:120
UINT AutoconfigEnabled
Definition: iptypes.h:74
IP_ADDR_STRING DhcpServer
Definition: iptypes.h:65
UINT EnableRouting
Definition: iptypes.h:87
LPTSTR GetConnectionType(LPTSTR lpClass)
Definition: ipconfig.c:175
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
UINT DhcpEnabled
Definition: iptypes.h:61
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
IP_ADDRESS_STRING IpAddress
Definition: iptypes.h:47
struct _IP_ADDR_STRING * Next
Definition: iptypes.h:46
IP_ADDR_STRING SecondaryWinsServer
Definition: iptypes.h:68
LPTSTR GetInterfaceTypeName(UINT InterfaceType)
Definition: ipconfig.c:88
char String[4 *4]
Definition: iptypes.h:42
_TCHAR * _tasctime(const struct tm *ptm)
Definition: asctime.c:150
#define NO_ERROR
Definition: dderror.h:5
CHAR * LPTSTR
Definition: xmlstorage.h:192
char AdapterName[MAX_ADAPTER_NAME_LENGTH+4]
Definition: iptypes.h:55
LPTSTR GetConnectionDescription(LPTSTR lpClass)
Definition: ipconfig.c:251
DWORD WINAPI GetNetworkParams(PFIXED_INFO pFixedInfo, PULONG pOutBufLen)
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
char DomainName[MAX_DOMAIN_NAME_LEN+4]
Definition: iptypes.h:82
BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH]
Definition: iptypes.h:58
time_t LeaseObtained
Definition: iptypes.h:69
#define _T(x)
Definition: vfdio.h:22
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HANDLE ProcessHeap
Definition: ipconfig.c:30
#define ERROR_NO_DATA
Definition: winerror.h:284
DWORD WINAPI GetPerAdapterInfo(ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterInfo, PULONG pOutBufLen)
UINT NodeType
Definition: iptypes.h:85
BOOL bConnected
Definition: fdebug.c:27
struct _IP_PER_ADAPTER_INFO * PIP_PER_ADAPTER_INFO
PTCHAR PrintMacAddr(PBYTE Mac)
Definition: ipconfig.c:140
int ret
char HostName[MAX_HOSTNAME_LEN+4]
Definition: iptypes.h:81
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
Definition: time.h:424
LPTSTR GetNodeTypeName(UINT NodeType)
Definition: ipconfig.c:52
IP_MASK_STRING IpMask
Definition: iptypes.h:48
IP_ADDR_STRING GatewayList
Definition: iptypes.h:64
DWORD WINAPI GetIfEntry(PMIB_IFROW pIfRow)
#define MIB_IF_OPER_STATUS_CONNECTED
Definition: ipifcons.h:250
IP_ADDR_STRING PrimaryWinsServer
Definition: iptypes.h:67
DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
unsigned int ULONG
Definition: retypes.h:1
DWORD dwIndex
Definition: ifmib.h:38
INTERNAL_IF_OPER_STATUS dwOperStatus
Definition: ifmib.h:45
IP_ADDR_STRING DnsServerList
Definition: iptypes.h:84
#define MIB_IF_OPER_STATUS_OPERATIONAL
Definition: ipifcons.h:251
#define HeapFree(x, y, z)
Definition: compat.h:394
time_t LeaseExpires
Definition: iptypes.h:70
struct _IP_ADAPTER_INFO * Next
Definition: iptypes.h:53
IP_ADDR_STRING IpAddressList
Definition: iptypes.h:63
VOID DoFormatMessage(LONG ErrorCode)
Definition: ipconfig.c:151

Referenced by main().

◆ Usage()

VOID Usage ( VOID  )

Definition at line 730 of file ipconfig.c.

731 {
732  HRSRC hRes;
733  LPTSTR lpUsage;
734  DWORD Size;
735 
737 
738  hRes = FindResource(hInstance,
739  lpName,
740  RT_STRING);
741  if (hRes != NULL)
742  {
744  hRes)))
745  {
746  lpUsage = (LPTSTR)HeapAlloc(ProcessHeap,
747  0,
748  Size);
749  if (lpUsage == NULL)
750  return;
751 
753  IDS_USAGE,
754  lpUsage,
755  Size))
756  {
757  _tprintf(_T("%s"), lpUsage);
758  }
759 
760  HeapFree(ProcessHeap, 0, lpUsage);
761  }
762  }
763 
764 
765 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define _tprintf
Definition: tchar.h:506
#define FindResource
Definition: winbase.h:3610
_In_ LPCSTR lpName
Definition: winbase.h:2729
#define IDS_USAGE
Definition: resource.h:3
CHAR * LPTSTR
Definition: xmlstorage.h:192
smooth NULL
Definition: ftsmooth.c:416
#define _T(x)
Definition: vfdio.h:22
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HANDLE ProcessHeap
Definition: ipconfig.c:30
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RT_STRING
Definition: pedump.c:368
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
HINSTANCE hInstance
Definition: ipconfig.c:29
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
#define HeapFree(x, y, z)
Definition: compat.h:394
int LoadStringAndOem(HINSTANCE hInst, UINT uID, LPTSTR szNode, int byteSize)
Definition: ipconfig.c:32

Referenced by main().

Variable Documentation

◆ hInstance

HINSTANCE hInstance

Definition at line 29 of file ipconfig.c.

Referenced by GetInterfaceTypeName(), GetNodeTypeName(), main(), and Usage().

◆ ProcessHeap

HANDLE ProcessHeap
  • Internal Headers */

Definition at line 30 of file ipconfig.c.

Referenced by GetConnectionDescription(), GetConnectionType(), LoadStringAndOem(), main(), Release(), Renew(), ShowInfo(), and Usage().