13#define WIN32_NO_STATUS
107 static TCHAR szType[8];
127 static CHAR MacAddr[20];
129 sprintf(MacAddr,
"%02X-%02X-%02X-%02X-%02X-%02X",
130 Mac[0], Mac[1], Mac[2], Mac[3], Mac[4], Mac[5]);
141 INT DateCchSize, TimeCchSize, TotalCchSize,
i;
142 PTSTR DateTimeString, psz;
170 TotalCchSize = DateCchSize + TimeCchSize;
184 DateTimeString[
i - 1] =
_T(
' ');
185 psz = DateTimeString +
i;
191 return DateTimeString;
231 LPSTR PrePath =
"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\";
232 LPSTR PostPath =
"\\Connection";
242 sprintf(
Path,
"%s%s%s", PrePath, lpClass, PostPath);
250 dwDataSize = cchFriendlyNameLength *
sizeof(
WCHAR);
255 (
PBYTE)pszFriendlyName,
271 LPWSTR PrePath =
L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\";
272 LPWSTR PostPath =
L"\\Connection";
273 LPWSTR DevicePrefix =
L"\\DEVICE\\TCPIP_";
281 PathSize =
wcslen(PrePath) +
wcslen(lpDeviceName) - dwPrefixLength +
wcslen(PostPath) + 1;
285 swprintf(
Path,
L"%s%s%s", PrePath, &lpDeviceName[dwPrefixLength], PostPath);
293 dwDataSize = cchFriendlyNameLength *
sizeof(
WCHAR);
298 (
PBYTE)pszFriendlyName,
315 TCHAR szPrePath[] =
_T(
"SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\");
358 PathSize *
sizeof(
TCHAR));
388 if (lpKeyClass ==
NULL)
406 if (!
strcmp(lpClass, lpKeyClass))
421 if (lpConDesc !=
NULL)
443 if (hBaseKey !=
NULL)
449 if (lpKeyClass !=
NULL)
491 switch (pAdapterInfo->
Type)
539 ULONG adaptOutBufLen = 0;
541 ULONG netOutBufLen = 0;
543 ULONG ulPerAdapterInfoLength = 0;
545 DWORD dwDomainNameSize = 0;
551 if (dwDomainNameSize > 0)
555 dwDomainNameSize *
sizeof(
TCHAR));
556 if (pszDomainName !=
NULL)
567 if (pAdapterInfo ==
NULL)
590 if (pFixedInfo ==
NULL)
606 pAdapter = pAdapterInfo;
628 if (pszDomainName !=
NULL && pszDomainName[0] != 0)
651 if (pPerAdapterInfo !=
NULL)
682 if (pPerAdapterInfo !=
NULL)
699 pAdapter = pAdapter->
Next;
723 pIPAddr = pIPAddr->
Next;
734 PTSTR DateTimeString;
751 pPerAdapterInfo =
NULL;
753 pAdapter = pAdapter->
Next;
771 WCHAR *pCharE, *pCharN, charE, charN;
773 if (pszExpression ==
NULL)
779 pCharE = pszExpression;
788 if (*(pCharE + 1) != charN)
793 else if (charE ==
L'?')
798 else if (charE == charN)
825 for (
i = 0;
i < l2;
i++)
836 ULONG adaptOutBufLen = 0;
854 if (pAdapterInfo ==
NULL)
867 pAdapter = pAdapterInfo;
913 pAdapter = pAdapter->
Next;
936 ULONG adaptOutBufLen = 0;
954 if (pAdapterInfo ==
NULL)
967 pAdapter = pAdapterInfo;
1006 pAdapter = pAdapter->
Next;
1043 _tprintf(
_T(
"\nSorry /registerdns is not implemented yet\n"));
1061 pQueryResults =
NULL;
1081 pThisRecord = pQueryResults;
1082 while (pThisRecord !=
NULL)
1084 pNextRecord = pThisRecord->
pNext;
1091 switch (pThisRecord->Flags.S.Section)
1110 switch (pThisRecord->wType)
1113 Addr4.
S_un.
S_addr = pThisRecord->Data.A.IpAddress;
1128 pThisRecord->Data.SOA.pNamePrimaryServer,
1129 pThisRecord->Data.SOA.pNameAdministrator,
1130 pThisRecord->Data.SOA.dwSerialNo);
1132 pThisRecord->Data.SOA.dwRefresh,
1133 pThisRecord->Data.SOA.dwRetry,
1134 pThisRecord->Data.SOA.dwExpire,
1135 pThisRecord->Data.SOA.dwDefaultTtl);
1144 pThisRecord->Data.MX.pNameExchange,
1145 pThisRecord->Data.MX.wPreference,
1146 pThisRecord->Data.MX.Pad);
1161 pThisRecord->Data.SRV.pNameTarget,
1162 pThisRecord->Data.SRV.wPriority,
1163 pThisRecord->Data.SRV.wWeight,
1164 pThisRecord->Data.SRV.wPort);
1169 pThisRecord = pNextRecord;
1188 if (DnsEntry ==
NULL)
1191 pThisEntry = DnsEntry;
1192 while (pThisEntry !=
NULL)
1194 pNextEntry = pThisEntry->
pNext;
1202 if (pThisEntry->pszName)
1206 pThisEntry = pNextEntry;
1234 if ((
argc > 1) && (
argv[1][0]==
'/' ||
argv[1][0]==
'-'))
1258 DoRegisterdns =
TRUE;
1262 DoDisplaydns =
TRUE;
1266 DoShowclassid =
TRUE;
1270 DoSetclassid =
TRUE;
1288 else if (DoFlushdns)
1290 else if (DoRegisterdns)
1292 else if (DoDisplaydns)
1302 else if (DoShowclassid)
1303 _tprintf(
_T(
"\nSorry /showclassid adapter is not implemented yet\n"));
1304 else if (DoSetclassid)
1305 _tprintf(
_T(
"\nSorry /setclassid adapter is not implemented yet\n"));
1311 _tprintf(
_T(
"\nSorry /setclassid adapter [classid]is not implemented yet\n"));
PRTL_UNICODE_STRING_BUFFER Path
int strcmp(const char *String1, const char *String2)
ACPI_SIZE strlen(const char *String)
void ConPuts(FILE *fp, LPCWSTR psz)
#define ConInitStdStreams()
void ConResPrintf(FILE *fp, UINT nID,...)
#define IDS_DNSSECTIONAUTHORITY
#define IDS_DEFAULTGATEWAY
#define IDS_DNSRECORDTYPE
#define IDS_CONNECTIONDNSSUFFIX
#define IDS_UNKNOWNADAPTER
#define IDS_DNSSECTIONANSWER
#define IDS_DHCPNOTENABLED
#define IDS_PRIMARYWINSSERVER
#define IDS_NODETYPEBCAST
#define IDS_DNSSUFFIXLIST
#define IDS_DNSRECORDLENGTH
#define IDS_DNSSECTIONADDITIONAL
#define IDS_DNSSECTIONQUESTION
#define IDS_LEASEOBTAINED
#define IDS_SECONDARYWINSSERVER
#define IDS_DNSRECORDNAME
#define IDS_DHCPNOADAPTER
#define IDS_PHYSICALADDRESS
#define IDS_AUTOCONFIGYES
#define IDS_DHCPRENEWERROR
#define IDS_DNSFLUSHERROR
#define IDS_MEDIADISCONNECTED
#define IDS_NODETYPEUNKNOWN
#define IDS_PRIMARYDNSSUFFIX
#define IDS_NODETYPEMIXED
#define IDS_DNSFLUSHSUCCESS
#define IDS_DHCPNOTCONNECTED
#define IDS_DHCPRELEASEERROR
#define IDS_NODETYPEHYBRID
#define RegCloseKey(hKey)
static BOOL bFoundAdapter
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
#define ERROR_NO_MORE_ITEMS
#define HeapFree(x, y, z)
BOOL WINAPI DnsFlushResolverCache(VOID)
DNS_STATUS WINAPI DnsQuery_W(LPCWSTR Name, WORD Type, DWORD Options, PVOID Extra, PDNS_RECORD *QueryResultSet, PVOID *Reserved)
BOOL WINAPI DnsGetCacheDataTable(_Out_ PDNS_CACHE_ENTRY *DnsCache)
VOID WINAPI DnsRecordListFree(PDNS_RECORD list, DNS_FREE_TYPE type)
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
HLOCAL NTAPI LocalFree(HLOCAL hMem)
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
VOID Renew(LPWSTR pszAdapterName)
VOID GetInterfaceFriendlyName(_In_ LPWSTR lpDeviceName, _In_ DWORD cchFriendlyNameLength, _Out_ LPWSTR pszFriendlyName)
_Ret_opt_z_ PTSTR timeToStr(_In_ time_t TimeStamp)
VOID ShowInfo(BOOL bShowHeader, BOOL bAll)
VOID DoFormatMessage(LONG ErrorCode)
LPTSTR GetRecordTypeName(WORD wType)
struct _RECORDTYPE * PRECORDTYPE
static VOID PrintAdapterDescription(LPSTR lpClass)
struct _RECORDTYPE RECORDTYPE
static VOID BuildAdapterMap(PIP_ADAPTER_INDEX_MAP pAdapterMap, PIP_ADAPTER_INFO pAdapterInfo)
PCHAR PrintMacAddr(PBYTE Mac)
static VOID PrintNodeType(_In_ UINT NodeType)
static VOID PrintAdapterTypeAndName(PIP_ADAPTER_INFO pAdapterInfo)
static BOOL MatchWildcard(_In_ PWSTR pszExpression, _In_ PWSTR pszName)
VOID GetAdapterFriendlyName(_In_ LPSTR lpClass, _In_ DWORD cchFriendlyNameLength, _Out_ LPWSTR pszFriendlyName)
static VOID DisplayDnsRecord(PWSTR pszName, WORD wType)
DWORD WINAPI IpReleaseAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo)
DWORD WINAPI GetIfEntry(PMIB_IFROW pIfRow)
DWORD WINAPI GetNetworkParams(PFIXED_INFO pFixedInfo, PULONG pOutBufLen)
DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
DWORD WINAPI GetPerAdapterInfo(ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterInfo, PULONG pOutBufLen)
DWORD WINAPI IpRenewAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo)
BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT, LPSTR, LPDWORD)
#define MIB_IF_TYPE_ETHERNET
#define MIB_IF_TYPE_LOOPBACK
#define MIB_IF_TYPE_OTHER
#define IF_TYPE_IEEE80211
#define MIB_IF_OPER_STATUS_CONNECTED
#define MIB_IF_TYPE_TOKENRING
#define MIB_IF_OPER_STATUS_OPERATIONAL
struct _IP_PER_ADAPTER_INFO * PIP_PER_ADAPTER_INFO
#define PEER_TO_PEER_NODETYPE
#define BROADCAST_NODETYPE
#define sprintf(buf, format,...)
_In_ NDIS_ERROR_CODE ErrorCode
NTSYSAPI PWSTR NTAPI RtlIpv4AddressToStringW(_In_ const struct in_addr *Addr, _Out_writes_(16) PWCHAR S)
NTSYSAPI PWSTR NTAPI RtlIpv6AddressToStringW(_In_ const struct in6_addr *Addr, _Out_writes_(46) PWSTR S)
#define LOCALE_USER_DEFAULT
static const WCHAR szName[]
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
IP_ADDR_STRING DnsServerList
char HostName[MAX_HOSTNAME_LEN+4]
char DomainName[MAX_DOMAIN_NAME_LEN+4]
struct _DNS_CACHE_ENTRY * pNext
struct _DnsRecordW * pNext
WCHAR Name[MAX_ADAPTER_NAME]
IP_ADDR_STRING SecondaryWinsServer
IP_ADDR_STRING IpAddressList
BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH]
IP_ADDR_STRING DhcpServer
char AdapterName[MAX_ADAPTER_NAME_LENGTH+4]
IP_ADDR_STRING GatewayList
struct _IP_ADAPTER_INFO * Next
IP_ADDR_STRING PrimaryWinsServer
struct _IP_ADDR_STRING * Next
IP_ADDRESS_STRING IpAddress
INTERNAL_IF_OPER_STATUS dwOperStatus
union in_addr::@1034 S_un
#define RtlCopyMemory(Destination, Source, Length)
DWORD WINAPI GetLastError(void)
#define FORMAT_MESSAGE_IGNORE_INSERTS
#define FORMAT_MESSAGE_FROM_SYSTEM
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
#define DNS_QUERY_NO_WIRE_QUERY
#define ERROR_BUFFER_OVERFLOW
#define DNS_INFO_NO_RECORDS
#define DNS_ERROR_RCODE_NAME_ERROR
#define HKEY_LOCAL_MACHINE