ReactOS  0.4.14-dev-554-g2f8d847
ipconfig.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS ipconfig utility
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: base/applications/network/ipconfig/ipconfig.c
5  * PURPOSE: Display IP info for net adapters
6  * PROGRAMMERS: Copyright 2005 - 2006 Ged Murphy (gedmurphy@gmail.com)
7  */
8 /*
9  * TODO:
10  * fix renew / release
11  * implement registerdns, showclassid, setclassid
12  * allow globbing on adapter names
13  */
14 
15 #define WIN32_NO_STATUS
16 #include <stdarg.h>
17 #include <windef.h>
18 #include <winbase.h>
19 #include <winuser.h>
20 #include <winreg.h>
21 #include <stdio.h>
22 #include <tchar.h>
23 #include <time.h>
24 #include <iphlpapi.h>
25 #include <ndk/rtlfuncs.h>
26 #include <inaddr.h>
27 #include <windns.h>
28 #include <windns_undoc.h>
29 
30 #include "resource.h"
31 
32 typedef struct _RECORDTYPE
33 {
37 
38 #define GUID_LEN 40
39 
42 
44 {
45  {DNS_TYPE_ZERO, _T("ZERO")},
46  {DNS_TYPE_A, _T("A")},
47  {DNS_TYPE_NS, _T("NS")},
48  {DNS_TYPE_MD, _T("MD")},
49  {DNS_TYPE_MF, _T("MF")},
50  {DNS_TYPE_CNAME, _T("CNAME")},
51  {DNS_TYPE_SOA, _T("SOA")},
52  {DNS_TYPE_MB, _T("MB")},
53  {DNS_TYPE_MG, _T("MG")},
54  {DNS_TYPE_MR, _T("MR")},
55  {DNS_TYPE_NULL, _T("NULL")},
56  {DNS_TYPE_WKS, _T("WKS")},
57  {DNS_TYPE_PTR, _T("PTR")},
58  {DNS_TYPE_HINFO, _T("HINFO")},
59  {DNS_TYPE_MINFO, _T("MINFO")},
60  {DNS_TYPE_MX, _T("MX")},
61  {DNS_TYPE_TEXT, _T("TXT")},
62  {DNS_TYPE_RP, _T("RP")},
63  {DNS_TYPE_AFSDB, _T("AFSDB")},
64  {DNS_TYPE_X25, _T("X25")},
65  {DNS_TYPE_ISDN, _T("ISDN")},
66  {DNS_TYPE_RT, _T("RT")},
67  {DNS_TYPE_NSAP, _T("NSAP")},
68  {DNS_TYPE_NSAPPTR, _T("NSAPPTR")},
69  {DNS_TYPE_SIG, _T("SIG")},
70  {DNS_TYPE_KEY, _T("KEY")},
71  {DNS_TYPE_PX, _T("PX")},
72  {DNS_TYPE_GPOS, _T("GPOS")},
73  {DNS_TYPE_AAAA, _T("AAAA")},
74  {DNS_TYPE_LOC, _T("LOC")},
75  {DNS_TYPE_NXT, _T("NXT")},
76  {DNS_TYPE_EID, _T("EID")},
77  {DNS_TYPE_NIMLOC, _T("NIMLOC")},
78  {DNS_TYPE_SRV, _T("SRV")},
79  {DNS_TYPE_ATMA, _T("ATMA")},
80  {DNS_TYPE_NAPTR, _T("NAPTR")},
81  {DNS_TYPE_KX, _T("KX")},
82  {DNS_TYPE_CERT, _T("CERT")},
83  {DNS_TYPE_A6, _T("A6")},
84  {DNS_TYPE_DNAME, _T("DNAME")},
85  {DNS_TYPE_SINK, _T("SINK")},
86  {DNS_TYPE_OPT, _T("OPT")},
87  {DNS_TYPE_UINFO, _T("UINFO")},
88  {DNS_TYPE_UID, _T("UID")},
89  {DNS_TYPE_GID, _T("GID")},
90  {DNS_TYPE_UNSPEC, _T("UNSPEC")},
91  {DNS_TYPE_ADDRS, _T("ADDRS")},
92  {DNS_TYPE_TKEY, _T("TKEY")},
93  {DNS_TYPE_TSIG, _T("TSIG")},
94  {DNS_TYPE_IXFR, _T("IXFR")},
95  {DNS_TYPE_AXFR, _T("AXFR")},
96  {DNS_TYPE_MAILB, _T("MAILB")},
97  {DNS_TYPE_MAILA, _T("MAILA")},
98  {DNS_TYPE_ALL, _T("ALL")},
99  {0, NULL}
100 };
101 
102 LPTSTR
104 {
105  static TCHAR szType[8];
106  INT i;
107 
108  for (i = 0; ; i++)
109  {
110  if (TypeArray[i].pszRecordName == NULL)
111  break;
112 
113  if (TypeArray[i].wRecordType == wType)
114  return TypeArray[i].pszRecordName;
115  }
116 
117  _stprintf(szType, _T("%hu"), wType);
118 
119  return szType;
120 }
121 
123  UINT uID,
124  LPTSTR szNode,
125  int byteSize)
126 {
127  TCHAR *szTmp;
128  int res;
129 
130  szTmp = (LPTSTR)HeapAlloc(ProcessHeap, 0, byteSize);
131  if (szTmp == NULL)
132  {
133  return 0;
134  }
135 
136  res = LoadString(hInst, uID, szTmp, byteSize);
137  CharToOem(szTmp, szNode);
139  return res;
140 }
141 
143 {
144  static TCHAR szNode[14];
145 
146  switch (NodeType)
147  {
148  case 1:
149  if (!LoadStringAndOem(hInstance, IDS_BCAST, szNode, sizeof(szNode)))
150  return NULL;
151  break;
152 
153  case 2:
154  if (!LoadStringAndOem(hInstance, IDS_P2P, szNode, sizeof(szNode)))
155  return NULL;
156  break;
157 
158  case 4:
159  if (!LoadStringAndOem(hInstance, IDS_MIXED, szNode, sizeof(szNode)))
160  return NULL;
161  break;
162 
163  case 8:
164  if (!LoadStringAndOem(hInstance, IDS_HYBRID, szNode, sizeof(szNode)))
165  return NULL;
166  break;
167 
168  default :
169  if (!LoadStringAndOem(hInstance, IDS_UNKNOWN, szNode, sizeof(szNode)))
170  return NULL;
171  break;
172  }
173 
174  return szNode;
175 }
176 
177 
179 {
180  static TCHAR szIntType[25];
181 
182  switch (InterfaceType)
183  {
184  case MIB_IF_TYPE_OTHER:
185  if (!LoadStringAndOem(hInstance, IDS_OTHER, szIntType, sizeof(szIntType)))
186  return NULL;
187  break;
188 
190  if (!LoadStringAndOem(hInstance, IDS_ETH, szIntType, sizeof(szIntType)))
191  return NULL;
192  break;
193 
195  if (!LoadStringAndOem(hInstance, IDS_TOKEN, szIntType, sizeof(szIntType)))
196  return NULL;
197  break;
198 
199  case MIB_IF_TYPE_FDDI:
200  if (!LoadStringAndOem(hInstance, IDS_FDDI, szIntType, sizeof(szIntType)))
201  return NULL;
202  break;
203 
204  case MIB_IF_TYPE_PPP:
205  if (!LoadStringAndOem(hInstance, IDS_PPP, szIntType, sizeof(szIntType)))
206  return NULL;
207  break;
208 
210  if (!LoadStringAndOem(hInstance, IDS_LOOP, szIntType, sizeof(szIntType)))
211  return NULL;
212  break;
213 
214  case MIB_IF_TYPE_SLIP:
215  if (!LoadStringAndOem(hInstance, IDS_SLIP, szIntType, sizeof(szIntType)))
216  return NULL;
217  break;
218 
219  default:
220  if (!LoadStringAndOem(hInstance, IDS_UNKNOWN, szIntType, sizeof(szIntType)))
221  return NULL;
222  break;
223  }
224 
225  return szIntType;
226 }
227 
228 
229 /* print MAC address */
231 {
232  static TCHAR MacAddr[20];
233 
234  _stprintf(MacAddr, _T("%02x-%02x-%02x-%02x-%02x-%02x"),
235  Mac[0], Mac[1], Mac[2], Mac[3], Mac[4], Mac[5]);
236 
237  return MacAddr;
238 }
239 
240 
242 {
243  LPVOID lpMsgBuf;
244  //DWORD ErrorCode;
245 
246  if (ErrorCode == 0)
248 
252  NULL,
253  ErrorCode,
254  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
255  (LPTSTR) &lpMsgBuf,
256  0,
257  NULL))
258  {
259  _tprintf(_T("%s"), (LPTSTR)lpMsgBuf);
260  LocalFree(lpMsgBuf);
261  }
262 }
263 
264 
266 {
267  HKEY hKey = NULL;
268  LPTSTR ConType = NULL;
269  LPTSTR ConTypeTmp = NULL;
270  TCHAR Path[256];
271  LPTSTR PrePath = _T("SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\");
272  LPTSTR PostPath = _T("\\Connection");
273  DWORD PathSize;
274  DWORD dwType;
275  DWORD dwDataSize;
276 
277  /* don't overflow the buffer */
278  PathSize = lstrlen(PrePath) + lstrlen(lpClass) + lstrlen(PostPath) + 1;
279  if (PathSize >= 255)
280  return NULL;
281 
282  wsprintf(Path, _T("%s%s%s"), PrePath, lpClass, PostPath);
283 
285  Path,
286  0,
287  KEY_READ,
288  &hKey) == ERROR_SUCCESS)
289  {
290  if (RegQueryValueEx(hKey,
291  _T("Name"),
292  NULL,
293  &dwType,
294  NULL,
295  &dwDataSize) == ERROR_SUCCESS)
296  {
297  ConTypeTmp = (LPTSTR)HeapAlloc(ProcessHeap,
298  0,
299  dwDataSize);
300 
301  if (ConTypeTmp == NULL)
302  return NULL;
303 
304  ConType = (LPTSTR)HeapAlloc(ProcessHeap,
305  0,
306  dwDataSize);
307 
308  if (ConType == NULL)
309  {
310  HeapFree(ProcessHeap, 0, ConTypeTmp);
311  return NULL;
312  }
313 
314  if (RegQueryValueEx(hKey,
315  _T("Name"),
316  NULL,
317  &dwType,
318  (PBYTE)ConTypeTmp,
319  &dwDataSize) != ERROR_SUCCESS)
320  {
322  0,
323  ConType);
324 
325  ConType = NULL;
326  }
327 
328  if (ConType)
329  CharToOem(ConTypeTmp, ConType);
330  HeapFree(ProcessHeap, 0, ConTypeTmp);
331  }
332  }
333 
334  if (hKey != NULL)
335  RegCloseKey(hKey);
336 
337  return ConType;
338 }
339 
340 
342 {
343  HKEY hBaseKey = NULL;
344  HKEY hClassKey = NULL;
345  LPTSTR lpKeyClass = NULL;
346  LPTSTR lpConDesc = NULL;
347  LPTSTR lpPath = NULL;
348  TCHAR szPrePath[] = _T("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\");
349  DWORD dwType;
350  DWORD dwDataSize;
351  INT i;
352 
354  szPrePath,
355  0,
356  KEY_READ,
357  &hBaseKey) != ERROR_SUCCESS)
358  {
359  return NULL;
360  }
361 
362  for (i = 0; ; i++)
363  {
364  DWORD PathSize;
365  LONG Status;
366  TCHAR szName[10];
367  DWORD NameLen = 9;
368 
369  if ((Status = RegEnumKeyEx(hBaseKey,
370  i,
371  szName,
372  &NameLen,
373  NULL,
374  NULL,
375  NULL,
376  NULL)) != ERROR_SUCCESS)
377  {
379  {
381  lpConDesc = NULL;
382  goto CLEANUP;
383  }
384  else
385  continue;
386  }
387 
388  PathSize = lstrlen(szPrePath) + lstrlen(szName) + 1;
389  lpPath = (LPTSTR)HeapAlloc(ProcessHeap,
390  0,
391  PathSize * sizeof(TCHAR));
392  if (lpPath == NULL)
393  goto CLEANUP;
394 
395  wsprintf(lpPath, _T("%s%s"), szPrePath, szName);
396 
397  //MessageBox(NULL, lpPath, NULL, 0);
398 
400  lpPath,
401  0,
402  KEY_READ,
404  {
405  goto CLEANUP;
406  }
407 
408  HeapFree(ProcessHeap, 0, lpPath);
409  lpPath = NULL;
410 
412  _T("NetCfgInstanceId"),
413  NULL,
414  &dwType,
415  NULL,
416  &dwDataSize) == ERROR_SUCCESS)
417  {
418  lpKeyClass = (LPTSTR)HeapAlloc(ProcessHeap,
419  0,
420  dwDataSize);
421  if (lpKeyClass == NULL)
422  goto CLEANUP;
423 
425  _T("NetCfgInstanceId"),
426  NULL,
427  &dwType,
428  (PBYTE)lpKeyClass,
429  &dwDataSize) != ERROR_SUCCESS)
430  {
431  HeapFree(ProcessHeap, 0, lpKeyClass);
432  lpKeyClass = NULL;
433  continue;
434  }
435  }
436  else
437  continue;
438 
439  if (!lstrcmp(lpClass, lpKeyClass))
440  {
441  HeapFree(ProcessHeap, 0, lpKeyClass);
442  lpKeyClass = NULL;
443 
445  _T("DriverDesc"),
446  NULL,
447  &dwType,
448  NULL,
449  &dwDataSize) == ERROR_SUCCESS)
450  {
451  lpConDesc = (LPTSTR)HeapAlloc(ProcessHeap,
452  0,
453  dwDataSize);
454  if (lpConDesc == NULL)
455  goto CLEANUP;
456 
458  _T("DriverDesc"),
459  NULL,
460  &dwType,
461  (PBYTE)lpConDesc,
462  &dwDataSize) != ERROR_SUCCESS)
463  {
464  HeapFree(ProcessHeap, 0, lpConDesc);
465  lpConDesc = NULL;
466  goto CLEANUP;
467  }
468  }
469  else
470  {
471  lpConDesc = NULL;
472  }
473 
474  break;
475  }
476  }
477 
478 CLEANUP:
479  if (hBaseKey != NULL)
480  RegCloseKey(hBaseKey);
481  if (hClassKey != NULL)
483  if (lpPath != NULL)
484  HeapFree(ProcessHeap, 0, lpPath);
485  if (lpKeyClass != NULL)
486  HeapFree(ProcessHeap, 0, lpKeyClass);
487 
488  return lpConDesc;
489 }
490 
491 
493 {
494  MIB_IFROW mibEntry;
495  PIP_ADAPTER_INFO pAdapterInfo = NULL;
496  PIP_ADAPTER_INFO pAdapter = NULL;
497  ULONG adaptOutBufLen = 0;
498  PFIXED_INFO pFixedInfo = NULL;
499  ULONG netOutBufLen = 0;
500  PIP_PER_ADAPTER_INFO pPerAdapterInfo = NULL;
501  ULONG ulPerAdapterInfoLength = 0;
502  ULONG ret = 0;
503 
504  /* call GetAdaptersInfo to obtain the adapter info */
505  ret = GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen);
506  if (ret == ERROR_BUFFER_OVERFLOW)
507  {
508  pAdapterInfo = (IP_ADAPTER_INFO *)HeapAlloc(ProcessHeap, 0, adaptOutBufLen);
509  if (pAdapterInfo == NULL)
510  return;
511 
512  ret = GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen);
513  if (ret != NO_ERROR)
514  {
515  DoFormatMessage(0);
516  HeapFree(ProcessHeap, 0, pAdapterInfo);
517  return;
518  }
519  }
520  else
521  {
522  if (ret != ERROR_NO_DATA)
523  {
524  DoFormatMessage(0);
525  return;
526  }
527  }
528 
529  /* call GetNetworkParams to obtain the network info */
530  if (GetNetworkParams(pFixedInfo, &netOutBufLen) == ERROR_BUFFER_OVERFLOW)
531  {
532  pFixedInfo = (FIXED_INFO *)HeapAlloc(ProcessHeap, 0, netOutBufLen);
533  if (pFixedInfo == NULL)
534  {
535  if (pAdapterInfo)
536  HeapFree(ProcessHeap, 0, pAdapterInfo);
537  return;
538  }
539  if (GetNetworkParams(pFixedInfo, &netOutBufLen) != NO_ERROR)
540  {
541  DoFormatMessage(0);
542  if (pAdapterInfo)
543  HeapFree(ProcessHeap, 0, pAdapterInfo);
544  HeapFree(ProcessHeap, 0, pFixedInfo);
545  return;
546  }
547  }
548  else
549  {
550  if (pAdapterInfo)
551  HeapFree(ProcessHeap, 0, pAdapterInfo);
552  DoFormatMessage(0);
553  return;
554  }
555 
556  pAdapter = pAdapterInfo;
557 
558  _tprintf(_T("\nReactOS IP Configuration\n\n"));
559  if (bAll)
560  {
561  _tprintf(_T("\tHost Name . . . . . . . . . . . . : %s\n"), pFixedInfo->HostName);
562  _tprintf(_T("\tPrimary DNS Suffix. . . . . . . . : \n"));
563  _tprintf(_T("\tNode Type . . . . . . . . . . . . : %s\n"), GetNodeTypeName(pFixedInfo->NodeType));
564  if (pFixedInfo->EnableRouting)
565  _tprintf(_T("\tIP Routing Enabled. . . . . . . . : Yes\n"));
566  else
567  _tprintf(_T("\tIP Routing Enabled. . . . . . . . : No\n"));
568  if (pAdapter && pAdapter->HaveWins)
569  _tprintf(_T("\tWINS Proxy enabled. . . . . . . . : Yes\n"));
570  else
571  _tprintf(_T("\tWINS Proxy enabled. . . . . . . . : No\n"));
572  _tprintf(_T("\tDNS Suffix Search List. . . . . . : %s\n"), pFixedInfo->DomainName);
573  }
574 
575  while (pAdapter)
576  {
577  LPTSTR IntType, myConType;
579 
580  mibEntry.dwIndex = pAdapter->Index;
581  GetIfEntry(&mibEntry);
582 
583  IntType = GetInterfaceTypeName(pAdapter->Type);
584  myConType = GetConnectionType(pAdapter->AdapterName);
585 
586  _tprintf(_T("\n%s %s: \n\n"), IntType , myConType);
587 
588  if (myConType != NULL) HeapFree(ProcessHeap, 0, myConType);
589 
590  if (GetPerAdapterInfo(pAdapter->Index, pPerAdapterInfo, &ulPerAdapterInfoLength) == ERROR_BUFFER_OVERFLOW)
591  {
592  pPerAdapterInfo = (PIP_PER_ADAPTER_INFO)HeapAlloc(ProcessHeap, 0, ulPerAdapterInfoLength);
593  if (pPerAdapterInfo != NULL)
594  {
595  GetPerAdapterInfo(pAdapter->Index, pPerAdapterInfo, &ulPerAdapterInfoLength);
596  }
597  }
598 
599  /* check if the adapter is connected to the media */
601  {
602  bConnected = FALSE;
603  _tprintf(_T("\tMedia State . . . . . . . . . . . : Media disconnected\n"));
604  }
605  else
606  {
607  _tprintf(_T("\tConnection-specific DNS Suffix. . : %s\n"), pFixedInfo->DomainName);
608  }
609 
610  if (bAll)
611  {
612  LPTSTR lpDesc = GetConnectionDescription(pAdapter->AdapterName);
613  _tprintf(_T("\tDescription . . . . . . . . . . . : %s\n"), lpDesc);
614  HeapFree(ProcessHeap, 0, lpDesc);
615  _tprintf(_T("\tPhysical Address. . . . . . . . . : %s\n"), PrintMacAddr(pAdapter->Address));
616  if (bConnected)
617  {
618  if (pAdapter->DhcpEnabled)
619  {
620  _tprintf(_T("\tDHCP Enabled. . . . . . . . . . . : Yes\n"));
621  if (pPerAdapterInfo != NULL)
622  {
623  if (pPerAdapterInfo->AutoconfigEnabled)
624  _tprintf(_T("\tAutoconfiguration Enabled . . . . : Yes\n"));
625  else
626  _tprintf(_T("\tAutoconfiguration Enabled . . . . : No\n"));
627  }
628  }
629  else
630  {
631  _tprintf(_T("\tDHCP Enabled. . . . . . . . . . . : No\n"));
632  }
633  }
634  }
635 
636  if (!bConnected)
637  {
638  pAdapter = pAdapter->Next;
639  continue;
640  }
641 
642  _tprintf(_T("\tIP Address. . . . . . . . . . . . : %s\n"), pAdapter->IpAddressList.IpAddress.String);
643  _tprintf(_T("\tSubnet Mask . . . . . . . . . . . : %s\n"), pAdapter->IpAddressList.IpMask.String);
644  if (pAdapter->GatewayList.IpAddress.String[0] != '0')
645  _tprintf(_T("\tDefault Gateway . . . . . . . . . : %s\n"), pAdapter->GatewayList.IpAddress.String);
646  else
647  _tprintf(_T("\tDefault Gateway . . . . . . . . . :\n"));
648 
649  if (bAll)
650  {
651  PIP_ADDR_STRING pIPAddr;
652 
653  if (pAdapter->DhcpEnabled)
654  _tprintf(_T("\tDHCP Server . . . . . . . . . . . : %s\n"), pAdapter->DhcpServer.IpAddress.String);
655 
656  _tprintf(_T("\tDNS Servers . . . . . . . . . . . : "));
657  _tprintf(_T("%s\n"), pFixedInfo->DnsServerList.IpAddress.String);
658  pIPAddr = pFixedInfo->DnsServerList.Next;
659  while (pIPAddr)
660  {
661  _tprintf(_T("\t\t\t\t\t %s\n"), pIPAddr ->IpAddress.String );
662  pIPAddr = pIPAddr->Next;
663  }
664 
665  if (pAdapter->HaveWins)
666  {
667  _tprintf(_T("\tPrimary WINS Server . . . . . . . : %s\n"), pAdapter->PrimaryWinsServer.IpAddress.String);
668  _tprintf(_T("\tSecondary WINS Server . . . . . . : %s\n"), pAdapter->SecondaryWinsServer.IpAddress.String);
669  }
670 
671  if (pAdapter->DhcpEnabled && _tcscmp(pAdapter->DhcpServer.IpAddress.String, _T("255.255.255.255")))
672  {
673  _tprintf(_T("\tLease Obtained. . . . . . . . . . : %s"), _tasctime(localtime(&pAdapter->LeaseObtained)));
674  _tprintf(_T("\tLease Expires . . . . . . . . . . : %s"), _tasctime(localtime(&pAdapter->LeaseExpires)));
675  }
676  }
677  _tprintf(_T("\n"));
678 
679  HeapFree(ProcessHeap, 0, pPerAdapterInfo);
680  pPerAdapterInfo = NULL;
681 
682  pAdapter = pAdapter->Next;
683  }
684 
685  HeapFree(ProcessHeap, 0, pFixedInfo);
686  if (pAdapterInfo)
687  HeapFree(ProcessHeap, 0, pAdapterInfo);
688 }
689 
691 {
692  IP_ADAPTER_INDEX_MAP AdapterInfo;
693  DWORD ret;
694  DWORD i;
695 
696  /* if interface is not given, query GetInterfaceInfo */
697  if (Index == NULL)
698  {
699  PIP_INTERFACE_INFO pInfo = NULL;
700  ULONG ulOutBufLen = 0;
701 
702  if (GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER)
703  {
704  pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, ulOutBufLen);
705  if (pInfo == NULL)
706  return;
707 
708  if (GetInterfaceInfo(pInfo, &ulOutBufLen) == NO_ERROR )
709  {
710  for (i = 0; i < pInfo->NumAdapters; i++)
711  {
712  CopyMemory(&AdapterInfo, &pInfo->Adapter[i], sizeof(IP_ADAPTER_INDEX_MAP));
713  _tprintf(_T("name - %ls\n"), pInfo->Adapter[i].Name);
714 
715  /* Call IpReleaseAddress to release the IP address on the specified adapter. */
716  if ((ret = IpReleaseAddress(&AdapterInfo)) != NO_ERROR)
717  {
718  _tprintf(_T("\nAn error occured while releasing interface %ls : \n"), AdapterInfo.Name);
720  }
721  }
722 
723  HeapFree(ProcessHeap, 0, pInfo);
724  }
725  else
726  {
727  DoFormatMessage(0);
728  HeapFree(ProcessHeap, 0, pInfo);
729  return;
730  }
731  }
732  else
733  {
734  DoFormatMessage(0);
735  return;
736  }
737  }
738  else
739  {
740  ;
741  /* FIXME:
742  * we need to be able to release connections by name with support for globbing
743  * i.e. ipconfig /release Eth* will release all cards starting with Eth...
744  * ipconfig /release *con* will release all cards with 'con' in their name
745  */
746  }
747 }
748 
749 
750 
751 
753 {
754  IP_ADAPTER_INDEX_MAP AdapterInfo;
755  DWORD i;
756 
757  /* if interface is not given, query GetInterfaceInfo */
758  if (Index == NULL)
759  {
760  PIP_INTERFACE_INFO pInfo;
761  ULONG ulOutBufLen = 0;
762 
764  if (pInfo == NULL)
765  {
766  _tprintf(_T("memory allocation error"));
767  return;
768  }
769 
770  /* Make an initial call to GetInterfaceInfo to get
771  * the necessary size into the ulOutBufLen variable */
772  if (GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER)
773  {
774  HeapFree(ProcessHeap, 0, pInfo);
775  pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, ulOutBufLen);
776  if (pInfo == NULL)
777  {
778  _tprintf(_T("memory allocation error"));
779  return;
780  }
781  }
782 
783  /* Make a second call to GetInterfaceInfo to get the actual data we want */
784  if (GetInterfaceInfo(pInfo, &ulOutBufLen) == NO_ERROR)
785  {
786  for (i = 0; i < pInfo->NumAdapters; i++)
787  {
788  CopyMemory(&AdapterInfo, &pInfo->Adapter[i], sizeof(IP_ADAPTER_INDEX_MAP));
789  _tprintf(_T("name - %ls\n"), pInfo->Adapter[i].Name);
790 
791  /* Call IpRenewAddress to renew the IP address on the specified adapter. */
792  if (IpRenewAddress(&AdapterInfo) != NO_ERROR)
793  {
794  _tprintf(_T("\nAn error occured while renew interface %s : "), _T("*name*"));
795  DoFormatMessage(0);
796  }
797  }
798  }
799  else
800  {
801  _tprintf(_T("\nGetInterfaceInfo failed : "));
802  DoFormatMessage(0);
803  }
804 
805  HeapFree(ProcessHeap, 0, pInfo);
806  }
807  else
808  {
809  ;
810  /* FIXME:
811  * we need to be able to renew connections by name with support for globbing
812  * i.e. ipconfig /renew Eth* will renew all cards starting with Eth...
813  * ipconfig /renew *con* will renew all cards with 'con' in their name
814  */
815  }
816 }
817 
818 VOID
820 {
821  _tprintf(_T("\nReactOS IP Configuration\n\n"));
822 
823  if (DnsFlushResolverCache())
824  _tprintf(_T("The DNS Resolver Cache has been deleted.\n"));
825  else
827 }
828 
829 
830 static
831 VOID
833  PWSTR pszName,
834  WORD wType)
835 {
836  PDNS_RECORDW pQueryResults = NULL, pThisRecord, pNextRecord;
837  WCHAR szBuffer[48];
838  IN_ADDR Addr4;
839  IN6_ADDR Addr6;
840  DNS_STATUS Status;
841 
842  pQueryResults = NULL;
843  Status = DnsQuery_W(pszName,
844  wType,
846  NULL,
847  (PDNS_RECORD *)&pQueryResults,
848  NULL);
849  if (Status != ERROR_SUCCESS)
850  {
852  {
853  _tprintf(_T("\t%S\n"), pszName);
854  _tprintf(_T("\t----------------------------------------\n"));
855  _tprintf(_T("\tName does not exist\n\n"));
856  }
857  else if (Status == DNS_INFO_NO_RECORDS)
858  {
859  _tprintf(_T("\t%S\n"), pszName);
860  _tprintf(_T("\t----------------------------------------\n"));
861  _tprintf(_T("\tNo records of type %s\n\n"), GetRecordTypeName(wType));
862  }
863  return;
864  }
865 
866  _tprintf(_T("\t%S\n"), pszName);
867  _tprintf(_T("\t----------------------------------------\n"));
868 
869  pThisRecord = pQueryResults;
870  while (pThisRecord != NULL)
871  {
872  pNextRecord = pThisRecord->pNext;
873 
874  _tprintf(_T("\tRecord Name . . . . . : %S\n"), pThisRecord->pName);
875  _tprintf(_T("\tRecord Type . . . . . : %hu\n"), pThisRecord->wType);
876  _tprintf(_T("\tTime To Live. . . . . : %lu\n"), pThisRecord->dwTtl);
877  _tprintf(_T("\tData Length . . . . . : %hu\n"), pThisRecord->wDataLength);
878 
879  switch (pThisRecord->Flags.S.Section)
880  {
881  case DnsSectionQuestion:
882  _tprintf(_T("\tSection . . . . . . . : Question\n"));
883  break;
884 
885  case DnsSectionAnswer:
886  _tprintf(_T("\tSection . . . . . . . : Answer\n"));
887  break;
888 
889  case DnsSectionAuthority:
890  _tprintf(_T("\tSection . . . . . . . : Authority\n"));
891  break;
892 
894  _tprintf(_T("\tSection . . . . . . . : Additional\n"));
895  break;
896  }
897 
898  switch (pThisRecord->wType)
899  {
900  case DNS_TYPE_A:
901  Addr4.S_un.S_addr = pThisRecord->Data.A.IpAddress;
902  RtlIpv4AddressToStringW(&Addr4, szBuffer);
903  _tprintf(_T("\tA (Host) Record . . . : %S\n"), szBuffer);
904  break;
905 
906  case DNS_TYPE_NS:
907  _tprintf(_T("\tNS Record . . . . . . : %S\n"), pThisRecord->Data.NS.pNameHost);
908  break;
909 
910  case DNS_TYPE_CNAME:
911  _tprintf(_T("\tCNAME Record. . . . . : %S\n"), pThisRecord->Data.CNAME.pNameHost);
912  break;
913 
914  case DNS_TYPE_SOA:
915  _tprintf(_T("\tSOA Record. . . . . . : \n"));
916  break;
917 
918  case DNS_TYPE_PTR:
919  _tprintf(_T("\tPTR Record. . . . . . : %S\n"), pThisRecord->Data.PTR.pNameHost);
920  break;
921 
922  case DNS_TYPE_MX:
923  _tprintf(_T("\tMX Record . . . . . . : \n"));
924  break;
925 
926  case DNS_TYPE_AAAA:
927  RtlCopyMemory(&Addr6, &pThisRecord->Data.AAAA.Ip6Address, sizeof(IN6_ADDR));
928  RtlIpv6AddressToStringW(&Addr6, szBuffer);
929  _tprintf(_T("\tAAAA Record . . . . . : %S\n"), szBuffer);
930  break;
931 
932  case DNS_TYPE_ATMA:
933  _tprintf(_T("\tATMA Record . . . . . : \n"));
934  break;
935 
936  case DNS_TYPE_SRV:
937  _tprintf(_T("\tSRV Record. . . . . . : \n"));
938  break;
939  }
940  _tprintf(_T("\n\n"));
941 
942  pThisRecord = pNextRecord;
943  }
944 
946 }
947 
948 
949 VOID
951 {
952  PDNS_CACHE_ENTRY DnsEntry = NULL, pThisEntry, pNextEntry;
953 
954  _tprintf(_T("\nReactOS IP Configuration\n\n"));
955 
956  if (!DnsGetCacheDataTable(&DnsEntry))
957  {
959  return;
960  }
961 
962  if (DnsEntry == NULL)
963  return;
964 
965  pThisEntry = DnsEntry;
966  while (pThisEntry != NULL)
967  {
968  pNextEntry = pThisEntry->pNext;
969 
970  if (pThisEntry->wType1 != 0)
971  DisplayDnsRecord(pThisEntry->pszName, pThisEntry->wType1);
972 
973  if (pThisEntry->wType2 != 0)
974  DisplayDnsRecord(pThisEntry->pszName, pThisEntry->wType2);
975 
976  if (pThisEntry->pszName)
977  LocalFree(pThisEntry->pszName);
978  LocalFree(pThisEntry);
979 
980  pThisEntry = pNextEntry;
981  }
982 }
983 
985 {
986  HRSRC hRes;
987  LPTSTR lpUsage;
988  DWORD Size;
989 
991 
992  hRes = FindResource(hInstance,
993  lpName,
994  RT_STRING);
995  if (hRes != NULL)
996  {
998  hRes)))
999  {
1000  lpUsage = (LPTSTR)HeapAlloc(ProcessHeap,
1001  0,
1002  Size);
1003  if (lpUsage == NULL)
1004  return;
1005 
1007  IDS_USAGE,
1008  lpUsage,
1009  Size))
1010  {
1011  _tprintf(_T("%s"), lpUsage);
1012  }
1013 
1014  HeapFree(ProcessHeap, 0, lpUsage);
1015  }
1016  }
1017 }
1018 
1019 int main(int argc, char *argv[])
1020 {
1021  BOOL DoUsage=FALSE;
1022  BOOL DoAll=FALSE;
1023  BOOL DoRelease=FALSE;
1024  BOOL DoRenew=FALSE;
1025  BOOL DoFlushdns=FALSE;
1026  BOOL DoRegisterdns=FALSE;
1027  BOOL DoDisplaydns=FALSE;
1028  BOOL DoShowclassid=FALSE;
1029  BOOL DoSetclassid=FALSE;
1030 
1033 
1034  /* Parse command line for options we have been given. */
1035  if ((argc > 1) && (argv[1][0]=='/' || argv[1][0]=='-'))
1036  {
1037  if (!_tcsicmp(&argv[1][1], _T("?")))
1038  {
1039  DoUsage = TRUE;
1040  }
1041  else if (!_tcsnicmp(&argv[1][1], _T("ALL"), _tcslen(&argv[1][1])))
1042  {
1043  DoAll = TRUE;
1044  }
1045  else if (!_tcsnicmp(&argv[1][1], _T("RELEASE"), _tcslen(&argv[1][1])))
1046  {
1047  DoRelease = TRUE;
1048  }
1049  else if (!_tcsnicmp(&argv[1][1], _T("RENEW"), _tcslen(&argv[1][1])))
1050  {
1051  DoRenew = TRUE;
1052  }
1053  else if (!_tcsnicmp(&argv[1][1], _T("FLUSHDNS"), _tcslen(&argv[1][1])))
1054  {
1055  DoFlushdns = TRUE;
1056  }
1057  else if (!_tcsnicmp(&argv[1][1], _T("FLUSHREGISTERDNS"), _tcslen(&argv[1][1])))
1058  {
1059  DoRegisterdns = TRUE;
1060  }
1061  else if (!_tcsnicmp(&argv[1][1], _T("DISPLAYDNS"), _tcslen(&argv[1][1])))
1062  {
1063  DoDisplaydns = TRUE;
1064  }
1065  else if (!_tcsnicmp(&argv[1][1], _T("SHOWCLASSID"), _tcslen(&argv[1][1])))
1066  {
1067  DoShowclassid = TRUE;
1068  }
1069  else if (!_tcsnicmp(&argv[1][1], _T("SETCLASSID"), _tcslen(&argv[1][1])))
1070  {
1071  DoSetclassid = TRUE;
1072  }
1073  }
1074 
1075  switch (argc)
1076  {
1077  case 1: /* Default behaviour if no options are given*/
1078  ShowInfo(FALSE);
1079  break;
1080  case 2: /* Process all the options that take no parameters */
1081  if (DoUsage)
1082  Usage();
1083  else if (DoAll)
1084  ShowInfo(TRUE);
1085  else if (DoRelease)
1086  Release(NULL);
1087  else if (DoRenew)
1088  Renew(NULL);
1089  else if (DoFlushdns)
1090  FlushDns();
1091  else if (DoRegisterdns)
1092  _tprintf(_T("\nSorry /registerdns is not implemented yet\n"));
1093  else if (DoDisplaydns)
1094  DisplayDns();
1095  else
1096  Usage();
1097  break;
1098  case 3: /* Process all the options that can have 1 parameter */
1099  if (DoRelease)
1100  _tprintf(_T("\nSorry /release [adapter] is not implemented yet\n"));
1101  //Release(argv[2]);
1102  else if (DoRenew)
1103  _tprintf(_T("\nSorry /renew [adapter] is not implemented yet\n"));
1104  else if (DoShowclassid)
1105  _tprintf(_T("\nSorry /showclassid adapter is not implemented yet\n"));
1106  else if (DoSetclassid)
1107  _tprintf(_T("\nSorry /setclassid adapter is not implemented yet\n"));
1108  else
1109  Usage();
1110  break;
1111  case 4: /* Process all the options that can have 2 parameters */
1112  if (DoSetclassid)
1113  _tprintf(_T("\nSorry /setclassid adapter [classid]is not implemented yet\n"));
1114  else
1115  Usage();
1116  break;
1117  default:
1118  Usage();
1119  }
1120 
1121  return 0;
1122 }
BOOL WINAPI DnsGetCacheDataTable(_Out_ PDNS_CACHE_ENTRY *DnsCache)
Definition: stubs.c:271
#define RegQueryValueEx
Definition: winreg.h:524
DWORD WINAPI IpReleaseAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo)
#define DNS_TYPE_ATMA
Definition: windns.h:74
static int argc
Definition: ServiceArgs.c:12
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define _tprintf
Definition: tchar.h:506
IP_ADAPTER_INDEX_MAP Adapter[1]
Definition: ipexport.h:141
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
VOID Usage(VOID)
Definition: ipconfig.c:984
UINT AutoconfigEnabled
Definition: iptypes.h:74
IP_ADDR_STRING DhcpServer
Definition: iptypes.h:65
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define CLEANUP
Definition: ntuser.h:5
#define FindResource
Definition: winbase.h:3627
union in_addr::@1005 S_un
UINT EnableRouting
Definition: iptypes.h:87
#define ERROR_SUCCESS
Definition: deptool.c:10
#define DNS_TYPE_X25
Definition: windns.h:59
NTSYSAPI PWSTR NTAPI RtlIpv4AddressToStringW(_In_ const struct in_addr *Addr, _Out_writes_(16) PWCHAR S)
struct _RECORDTYPE * PRECORDTYPE
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
LPTSTR GetConnectionType(LPTSTR lpClass)
Definition: ipconfig.c:265
#define _tcsicmp
Definition: xmlstorage.h:205
#define KEY_READ
Definition: nt_native.h:1023
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
#define DNS_TYPE_AAAA
Definition: windns.h:68
#define DNS_TYPE_A
Definition: windns.h:41
uint16_t * PWSTR
Definition: typedefs.h:54
#define IDS_PPP
Definition: resource.h:17
#define LANG_NEUTRAL
Definition: nls.h:22
#define IDS_P2P
Definition: resource.h:8
#define DNS_TYPE_GPOS
Definition: windns.h:67
DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen)
IP_ADDRESS_STRING IpAddress
Definition: iptypes.h:47
#define DNS_TYPE_MG
Definition: windns.h:48
struct _IP_ADDR_STRING * Next
Definition: iptypes.h:46
#define DNS_TYPE_CERT
Definition: windns.h:77
#define DNS_TYPE_SINK
Definition: windns.h:80
#define DNS_TYPE_AXFR
Definition: windns.h:90
#define SUBLANG_DEFAULT
Definition: nls.h:168
_In_ LPCSTR lpName
Definition: winbase.h:2746
#define MIB_IF_TYPE_OTHER
Definition: ipifcons.h:222
#define IDS_HYBRID
Definition: resource.h:10
IP_ADDR_STRING SecondaryWinsServer
Definition: iptypes.h:68
#define IDS_BCAST
Definition: resource.h:7
LPTSTR GetInterfaceTypeName(UINT InterfaceType)
Definition: ipconfig.c:178
char String[4 *4]
Definition: iptypes.h:42
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define DNS_TYPE_KEY
Definition: windns.h:65
_TCHAR * _tasctime(const struct tm *ptm)
Definition: asctime.c:150
#define DNS_TYPE_AFSDB
Definition: windns.h:58
#define DNS_INFO_NO_RECORDS
Definition: winerror.h:1861
#define IDS_USAGE
Definition: resource.h:3
#define DNS_TYPE_HINFO
Definition: windns.h:53
LPTSTR pszRecordName
Definition: ipconfig.c:35
#define IDS_FDDI
Definition: resource.h:16
#define IDS_TOKEN
Definition: resource.h:15
#define MIB_IF_TYPE_SLIP
Definition: ipifcons.h:228
#define DNS_TYPE_UID
Definition: windns.h:83
#define argv
Definition: mplay32.c:18
#define DNS_TYPE_TKEY
Definition: windns.h:87
VOID WINAPI DnsRecordListFree(PDNS_RECORD list, DNS_FREE_TYPE type)
Definition: record.c:526
#define DNS_TYPE_CNAME
Definition: windns.h:45
#define NO_ERROR
Definition: dderror.h:5
char szTmp[518]
#define DNS_TYPE_SOA
Definition: windns.h:46
#define DNS_TYPE_TEXT
Definition: windns.h:56
int32_t INT
Definition: typedefs.h:56
#define DNS_TYPE_ISDN
Definition: windns.h:60
#define DNS_TYPE_NXT
Definition: windns.h:70
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define MIB_IF_TYPE_LOOPBACK
Definition: ipifcons.h:227
#define DNS_TYPE_MF
Definition: windns.h:44
char AdapterName[MAX_ADAPTER_NAME_LENGTH+4]
Definition: iptypes.h:55
struct _DNS_CACHE_ENTRY * pNext
Definition: windns_undoc.h:10
#define DNS_ERROR_RCODE_NAME_ERROR
Definition: winerror.h:1850
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
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
LPTSTR GetConnectionDescription(LPTSTR lpClass)
Definition: ipconfig.c:341
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define DNS_TYPE_NSAPPTR
Definition: windns.h:63
#define _tcsnicmp
Definition: xmlstorage.h:207
VOID FlushDns(VOID)
Definition: ipconfig.c:819
#define DNS_TYPE_ZERO
Definition: windns.h:40
#define DNS_TYPE_UNSPEC
Definition: windns.h:85
int main(int argc, char *argv[])
Definition: ipconfig.c:1019
#define MIB_IF_TYPE_FDDI
Definition: ipifcons.h:225
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
DWORD WINAPI GetNetworkParams(PFIXED_INFO pFixedInfo, PULONG pOutBufLen)
#define DNS_TYPE_EID
Definition: windns.h:71
#define DNS_TYPE_SIG
Definition: windns.h:64
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
unsigned char BOOLEAN
Definition: windns_undoc.h:8
DNS_STATUS WINAPI DnsQuery_W(LPCWSTR Name, WORD Type, DWORD Options, PVOID Extra, PDNS_RECORD *QueryResultSet, PVOID *Reserved)
Definition: query.c:523
smooth NULL
Definition: ftsmooth.c:416
VOID Release(LPTSTR Index)
Definition: ipconfig.c:690
char DomainName[MAX_DOMAIN_NAME_LEN+4]
Definition: iptypes.h:82
BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH]
Definition: iptypes.h:58
HKEY hClassKey
Definition: umpnpmgr.c:45
#define DNS_TYPE_RT
Definition: windns.h:61
NodeType
Definition: Node.h:5
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
WCHAR Name[MAX_ADAPTER_NAME]
Definition: ipexport.h:136
#define DNS_TYPE_MD
Definition: windns.h:43
#define DNS_TYPE_LOC
Definition: windns.h:69
#define IDS_UNKNOWN
Definition: resource.h:7
#define IDS_OTHER
Definition: resource.h:13
time_t LeaseObtained
Definition: iptypes.h:69
char TCHAR
Definition: xmlstorage.h:189
#define DNS_TYPE_MINFO
Definition: windns.h:54
LPTSTR GetRecordTypeName(WORD wType)
Definition: ipconfig.c:103
#define _T(x)
Definition: vfdio.h:22
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HANDLE ProcessHeap
Definition: ipconfig.c:41
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define DNS_TYPE_PTR
Definition: windns.h:52
#define DNS_TYPE_GID
Definition: windns.h:84
#define MIB_IF_TYPE_PPP
Definition: ipifcons.h:226
#define ERROR_NO_DATA
Definition: winerror.h:284
#define DNS_TYPE_TSIG
Definition: windns.h:88
DWORD WINAPI GetPerAdapterInfo(ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterInfo, PULONG pOutBufLen)
#define DNS_TYPE_NAPTR
Definition: windns.h:75
Definition: tcpip.h:125
#define MIB_IF_TYPE_ETHERNET
Definition: ipifcons.h:223
#define DNS_TYPE_UINFO
Definition: windns.h:82
struct _RECORDTYPE RECORDTYPE
#define CopyMemory
Definition: winbase.h:1640
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned short WORD
Definition: ntddk_ex.h:93
UINT NodeType
Definition: iptypes.h:85
#define DNS_TYPE_OPT
Definition: windns.h:81
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL bConnected
Definition: fdebug.c:27
struct _IP_PER_ADAPTER_INFO * PIP_PER_ADAPTER_INFO
#define DNS_TYPE_MX
Definition: windns.h:55
PTCHAR PrintMacAddr(PBYTE Mac)
Definition: ipconfig.c:230
VOID DisplayDns(VOID)
Definition: ipconfig.c:950
#define DNS_TYPE_ALL
Definition: windns.h:93
#define MIB_IF_TYPE_TOKENRING
Definition: ipifcons.h:224
#define FormatMessage
Definition: winbase.h:3629
int ret
#define DNS_TYPE_MB
Definition: windns.h:47
#define DNS_TYPE_PX
Definition: windns.h:66
#define RT_STRING
Definition: pedump.c:368
char HostName[MAX_HOSTNAME_LEN+4]
Definition: iptypes.h:81
#define DNS_TYPE_MAILB
Definition: windns.h:91
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
Definition: time.h:424
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define RegEnumKeyEx
Definition: winreg.h:510
#define DNS_TYPE_ADDRS
Definition: windns.h:86
#define lstrcmp
Definition: winbase.h:3706
#define DNS_TYPE_MR
Definition: windns.h:49
#define DNS_TYPE_MAILA
Definition: windns.h:92
Status
Definition: gdiplustypes.h:24
u_long S_addr
Definition: tcpip.h:131
#define DNS_TYPE_RP
Definition: windns.h:57
#define _stprintf
Definition: utility.h:124
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:401
LPTSTR GetNodeTypeName(UINT NodeType)
Definition: ipconfig.c:142
#define RegOpenKeyEx
Definition: winreg.h:520
#define lstrlen
Definition: winbase.h:3710
#define DNS_TYPE_WKS
Definition: windns.h:51
HINSTANCE hInst
Definition: dxdiag.c:13
PRTL_UNICODE_STRING_BUFFER Path
#define DNS_TYPE_A6
Definition: windns.h:78
#define GetModuleHandle
Definition: winbase.h:3661
#define DNS_TYPE_NIMLOC
Definition: windns.h:72
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
IP_MASK_STRING IpMask
Definition: iptypes.h:48
IP_ADDR_STRING GatewayList
Definition: iptypes.h:64
HINSTANCE hInstance
Definition: ipconfig.c:40
#define IDS_SLIP
Definition: resource.h:19
DWORD WINAPI GetIfEntry(PMIB_IFROW pIfRow)
#define DNS_TYPE_SRV
Definition: windns.h:73
unsigned int UINT
Definition: ndis.h:50
#define DNS_QUERY_NO_WIRE_QUERY
Definition: windns.h:13
#define CharToOem
Definition: winuser.h:5718
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
#define DNS_TYPE_NS
Definition: windns.h:42
#define DNS_TYPE_DNAME
Definition: windns.h:79
VOID ShowInfo(BOOL bAll)
Definition: ipconfig.c:492
#define MIB_IF_OPER_STATUS_CONNECTED
Definition: ipifcons.h:250
IP_ADDR_STRING PrimaryWinsServer
Definition: iptypes.h:67
#define DNS_TYPE_NULL
Definition: windns.h:50
DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
static const WCHAR szName[]
Definition: msipriv.h:1194
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
#define MAKELANGID(p, s)
Definition: nls.h:15
VOID Renew(LPTSTR Index)
Definition: ipconfig.c:752
DWORD dwIndex
Definition: ifmib.h:38
WORD wRecordType
Definition: ipconfig.c:34
#define DNS_TYPE_IXFR
Definition: windns.h:89
#define DNS_TYPE_KX
Definition: windns.h:76
INTERNAL_IF_OPER_STATUS dwOperStatus
Definition: ifmib.h:45
#define wsprintf
Definition: winuser.h:5840
IP_ADDR_STRING DnsServerList
Definition: iptypes.h:84
#define IDS_LOOP
Definition: resource.h:18
#define PDNS_RECORD
Definition: windns.h:636
#define MIB_IF_OPER_STATUS_OPERATIONAL
Definition: ipifcons.h:251
#define IDS_MIXED
Definition: resource.h:9
BYTE * PBYTE
Definition: pedump.c:66
BOOL WINAPI DnsFlushResolverCache(VOID)
Definition: query.c:878
#define HeapFree(x, y, z)
Definition: compat.h:402
#define LoadString
Definition: winuser.h:5794
static const WCHAR szType[]
Definition: table.c:81
time_t LeaseExpires
Definition: iptypes.h:70
struct _IP_ADAPTER_INFO * Next
Definition: iptypes.h:53
static VOID DisplayDnsRecord(PWSTR pszName, WORD wType)
Definition: ipconfig.c:832
int LoadStringAndOem(HINSTANCE hInst, UINT uID, LPTSTR szNode, int byteSize)
Definition: ipconfig.c:122
NTSYSAPI PWSTR NTAPI RtlIpv6AddressToStringW(_In_ const struct in6_addr *Addr, _Out_writes_(46) PWSTR S)
char * PTCHAR
Definition: ntbasedef.h:483
IP_ADDR_STRING IpAddressList
Definition: iptypes.h:63
#define DNS_TYPE_NSAP
Definition: windns.h:62
#define IDS_ETH
Definition: resource.h:14
RECORDTYPE TypeArray[]
Definition: ipconfig.c:43
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
VOID DoFormatMessage(LONG ErrorCode)
Definition: ipconfig.c:241