- DWORD Error = ERROR_SUCCESS, DhcpEnabled;
+ DWORD Error = ERROR_SUCCESS, DhcpEnabled, Length;
[...]
+ Error = RegQueryValueEx(AdapterKey,
"EnableDHCP", NULL, NULL, (LPBYTE)&DhcpEnabled, &Length);
IMO Length needs to be initialized first
+
+ if (Error != ERROR_SUCCESS || Length != sizeof(DWORD))
DhcpEnabled = 1;
CloseHandle(AdapterKey);
regards
Johannes
[1]
http://msdn.microsoft.com/en-us/library/ms724911%28VS.85%29.aspx