15{
16 const char *ifname =
NULL;
20
22 ptr->LeaseObtained = 0;
23 ptr->LeaseExpires = 0;
24 strcpy(
ptr->DhcpServer.IpAddress.String,
"");
25
27 if (!ifname)
29
31 L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces",
32 0,
34 &hKeyInterfaces);
36 goto done;
37
39 ifname,
40 0,
42 &hKeyInterface);
44 goto done;
45
50 &dwType,
55
56 if (
ptr->DhcpEnabled != 0)
57 {
62 &dwType,
67
70 L"LeaseTerminatesTime",
72 &dwType,
77
78 dwSize =
sizeof(
ptr->DhcpServer.IpAddress.String);
80 "DhcpServer",
82 &dwType,
83 (
PBYTE)&
ptr->DhcpServer.IpAddress.String,
86 strcpy(
ptr->DhcpServer.IpAddress.String,
"");
87 }
89
90done:
91 if (hKeyInterface)
93
94 if (hKeyInterfaces)
96
97 if (ifname)
99
101}
#define RegCloseKey(hKey)
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)
const char * getInterfaceNameByIndex(DWORD index)
void consumeInterfaceName(const char *ifname)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
#define HKEY_LOCAL_MACHINE