Thread: Registry changes?

  1. #1
    Bit Fiddler
    Join Date
    Sep 2009
    Posts
    79

    Registry changes?

    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?

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Are you sure it's not actually buried in the wow6432node key? The 64-bit windows registry is a peculiar thing.
    If you understand what you're doing, you're not learning anything.

  3. #3
    Bit Fiddler
    Join Date
    Sep 2009
    Posts
    79
    Wonderful...

    Thank you very much.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Registry
    By maxorator in forum Tech Board
    Replies: 4
    Last Post: 01-25-2006, 08:16 PM
  2. Registry
    By gvector1 in forum C# Programming
    Replies: 0
    Last Post: 07-30-2003, 04:02 PM
  3. Registry
    By sean345 in forum Windows Programming
    Replies: 4
    Last Post: 07-15-2002, 01:24 PM
  4. registry
    By unregistered in forum Windows Programming
    Replies: 3
    Last Post: 12-11-2001, 08:04 PM