Re: SE_REGISTRY_WOW64_64KEY?

From: Martijn Laan (mlaan_at_nospam.nospam)
Date: 02/23/05

  • Next message: scott: "RE: Decryption using private key from cert store failing with err"
    Date: Wed, 23 Feb 2005 20:08:51 +0100
    
    

    Hi,

    Rhett Gong [MSFT] wrote:
    > LONG result1 = RegCreateKeyEx(HKEY_CURRENT_USER,

    Just also noticed you're using HKCU. Please note that this is a bad
    place to test since there is no separate 32 and 64 bit view of HKCU. You
    should test under HKCR or HKLM\Software. See
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win64/win64/registry_redirector.asp

    Below is an example. It results in an ERROR_FILE_NOT_FOUND because
    SetNamedSecurityInfo is looking in the 32 bit view (i.e.
    HKLM\SOFTWARE\Wow6432Node\MyTest64BitKey).

    ---
    {
    	ACL acl;
    	HKEY hKey1;
    	DWORD dispo;
    	LONG result1;
    	DWORD result2;
    	
    	// create an empty ACL
    	acl.AclRevision = ACL_REVISION;
    	acl.Sbz1 = 0;
    	acl.AclSize = sizeof(acl);
    	acl.AceCount = 0;
    	acl.Sbz2 = 0;
    	result1 = RegCreateKeyEx(HKEY_LOCAL_MACHINE,
    		"SOFTWARE\\MyTest64BitKey",
    		0,
    		NULL,
    		REG_OPTION_NON_VOLATILE,
    		KEY_ALL_ACCESS|KEY_WOW64_64KEY,
    		NULL,
    		&hKey1,
    		&dispo);
    	result2 = SetNamedSecurityInfo(
    		"MACHINE\\SOFTWARE\\MyTest64BitKey",
    		SE_REGISTRY_KEY,
    		DACL_SECURITY_INFORMATION | PROTECTED_DACL_SECURITY_INFORMATION,
    		NULL,
    		NULL,
    		&acl,
    		NULL);
    	// result2 == ERROR_FILE_NOT_FOUND
    }
    ---
    Greetings,
    Martijn Laan
    

  • Next message: scott: "RE: Decryption using private key from cert store failing with err"