CRegKey Create() not working
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: CRegKey Create() not working

  1. #1
    Join Date
    Dec 2003
    Posts
    72

    CRegKey Create() not working

    Hi. I'm having issues with the following code. It's used to fix weird colors with certain games on Vista / 7. It seems to work for almost everyone. But, I found an exception today.

    Code:
    x = rk.Create( HKEY_LOCAL_MACHINE, "Software\\Microsoft\\DirectDraw\\Compatibility\\Duke Nukem 3D");
    I have verified that UAC is disabled. The program and user have full privileges to those keys. Create() returns ERROR_SUCCESS. But, the key never gets created. Interestingly, there is another spot that the key has to be created in on 64-bit systems:

    Code:
    x = rk.Create( HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Microsoft\\DirectDraw\\Compatibility\\Duke Nukem 3D");
    This works fine. Why would the second one work, but not the first?

    Also, if I do these from a reg file, they both work...

  2. #2
    Join Date
    Dec 2003
    Posts
    72

    Re: CRegKey Create() not working

    Ok. I do see one difference in the keys. The Wow6432Node and down don't have special permissions checked. The first one does have it checked. But, when I make the permissions the same, still can't create the first key. Do I need to specify another type of security flag to create the first one?
    Last edited by miclus; April 3rd, 2014 at 09:04 PM.

  3. #3
    Join Date
    Dec 2003
    Posts
    72

    Re: CRegKey Create() not working

    Hmmm, it appears the first one actually modifies the location of the 2nd one? Is this by design for 64-bit systems? I guess it makes me wonder why there would be 2 Directdraw Compatibility folders if the program only modifies the second one?

  4. #4
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,299

    Re: CRegKey Create() not working

    Victor Nijegorodov

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,930

    Re: CRegKey Create() not working

    In case you run 32-bit application in 64-bit Windows, the 32-bit registry hive, which is WoW6432Node, appears to be in use.
    Best regards,
    Igor

  6. #6
    Join Date
    Dec 2003
    Posts
    72

    Re: CRegKey Create() not working

    Ok, makes sense. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center