I'm trying to get some code to work with Windows 7 64-bit. It's a part where a registry value should be removed after cloning.
The opening of the registry key is done with success but I recieve the error that the file is not found (though the value is there) when trying to delete the value.
Code:
int remove_susid(void) {
int rst;
HKEY rkey;
print_log(0, "Remove SUS Client ID...");
rst = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate", 0, KEY_SET_VALUE, &rkey);
rst = RegDeleteValueA(rkey, "SusClientId");
print_log(1, "%s\n", !rst ? "Ok" : "Failed");
RegCloseKey(rkey);
if (rst)
print_log(0, error_msg(rst));
return rst;
}
In an other part of the code some registry values should be changed.
Code:
rst = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", 0, KEY_SET_VALUE, &rkey);
rst |= RegSetValueEx(rkey, "DefaultDomainName", 0, REG_SZ, "xxxx", 5);
rst |= RegSetValueEx(rkey, "DefaultUserName", 0, REG_SZ, "Administrator", 14);
rst |= RegSetValueEx(rkey, "AutoAdminLogon", 0, REG_SZ, "0", 2);
RegCloseKey(rkey);
print_log(1, "%s\n", !rst ? "Ok" : "Failed");
All calls succeeds but nothing gets done.
All run with administrator access...
I'm pretty sure it worked on a Windows 7 32-bit computer. Have I missed something?