PDA

View Full Version : HKLM writing and reading in Windows 7



torrid
10-20-2010, 02:34 PM
Hi,
I read several posts about this but could not reply to them so started a new thread...

I have SB7 writing to the HKLM tree on Windows 7... it gets directed to the WOW6432Node. I am writing an InstallDate key in there.

When my app runs for the first time, I am trying to read that key but nothing is being returned. Does Windows 7 automatically redirect the HKLM to the Wow6432Node? I thought I read that it did indeed do that.

However I cannot read the InstallDate key from HKLM and thus my code on start up is failing.

ANy suggestions or suggested reading? I have searched HKLM on forum and read a lot of the posts.

Related question... in newer version of SB the embed manifest has a new selection for Windows 7 compatibility. I added that and recompiled... did not realize it was there though... My question is should I do that for all of my installers? i.e. even if installing XP or VIsta this won't negatively affect it....

Thanks
-Tim

linder
10-21-2010, 12:10 AM
Tim,

There is an interesting reading in the SetupBuilder help (see attached screenshot).

The WOW64 subsystem provides redirection at the Registry level. Computers that are running an Windows x64-based operating system use a different registry layout to handle both 32-bit and 64-bit programs. The registry layout changes in x64 Edition versions of the Windows operating system make sure that the programs hard-coded .dll paths, program settings, and other parameter values are not overwritten. If the call is from a 32-bit application, then the call to access the HKLM\Software registry hive is intercepted by the WOW64 subsystem and redirected to the HKLM\Software\Wow6432Node. If the call is from a 64-bit application, then it is routed to the HKLM\ Software node.

BTW, do not hard-code "HKLM\Software\Wow6432Node\yada" in the function that reads the registry key from your app. Windows handles this automatically. Use: "HKLM\Software\yada" instead.

With regard to the second question, your SB7.x installer is automatically Win7-compliant. If you are using the "#embed UAC manifest..." compiler directive to make your own applications UAC-aware and you would like to embed a Win7-aware manifest into your .exe files then yes, you should set "Compatibility Information" to "Windows 7".

Does this help?

Friedrich