locked
windows doesn´t keep track of registry keys 64 bit RRS feed

  • Question

  • I´m using Inno Setup to install a small program of mine:

    [Registry]
    Root: HKLM; Subkey: "Software\MyProgram"; ValueType: string; ValueName: "mykey"; ValueData: {app};  Flags: uninsdeletekey
    Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "MyProgram"; ValueData: "{app}\{#MyAppExeName}"; Flags: uninsdeletekey
    Root: HKLM; Subkey: "Software\Myprogram"; ValueType: string; ValueName: "myeky2"; ValueData: "{code:us}"; Flags: uninsdeletekey
    Root: HKLM; Subkey: "Software\Myprogram"; ValueType: string; ValueName: "mykey3"; ValueData: "{code:pw}"; Flags: uninsdeletekey

    After that, the program gets those values back, like so:

            Dim pKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64)
            pKey = pKey.OpenSubKey("software")
            pKey = pKey.OpenSubKey("myprogram")

    Mystring = CStr(pKey.GetValue("mykey2"))

    Now, this doesn´t work on windows 7 64 bit. Could you please help me with this?

    Thanks


    • Edited by Black Santa Thursday, June 6, 2013 11:32 PM
    Thursday, June 6, 2013 10:34 PM

Answers

All replies

  • Friday, June 7, 2013 4:05 AM
  • Does it work if you specify Microsoft.Win32.RegistryView.Registry32?

    Friday, June 7, 2013 5:33 AM
  • Does it work if you specify Microsoft.Win32.RegistryView.Registry32?

    Thanks for answering.

    I´ve tried it on xp-machines, and it works. I´ve deployed it to the 64 bit users so I´ll know during the day.

    I thought that if you use the .Registry64, it works on both 32 and 64. Ah well, we´ll see.

    Friday, June 7, 2013 7:08 AM
  • Try this:
    http://www.jrsoftware.org/contact.php

    Thanks for answering.

    So you think this is a problem with Inno Setup? Maybe it is, but the keys are where they should be (well, of course windows puts them in the wow6432node, but apart from that).

    The thing is it´s actually quite annoying. If you move the keys from where they should be, you should have some method to keep track of it. The way it is, I´m guessing there won´t be a proper uninstall on the 64 bit machines since the registry can´t find the keys that´s been moved. I´m not entirely sure about the autostart function either.

    Guess I´ll find out.

    Friday, June 7, 2013 7:31 AM
  • If the keys can be viewed manually then the setup program is fine. 

    Maybe this will help clarify:

    http://msdn.microsoft.com/en-us/library/aa384129(v=vs.85).aspx

    There are many articles about "Registry Redirection".

    Friday, June 7, 2013 12:51 PM
  • The behavior you describe is correct. I think the doc explains how to work with 64-bit installs:

    http://www.jrsoftware.org/ishelp/index.php?topic=registrysection


    Paul ~~~~ Microsoft MVP (Visual Basic)

    • Marked as answer by Black Santa Wednesday, June 12, 2013 10:19 PM
    Friday, June 7, 2013 3:19 PM
  • The behavior you describe is correct. I think the doc explains how to work with 64-bit installs:

    http://www.jrsoftware.org/ishelp/index.php?topic=registrysection


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Thanks.

    I use HKLM64 now in inno setup, and the keys are now created in hklm/software/myprogram.

    Now, instead, myprogram can´t read the values.

    I´ve tried this:

    Dim pKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64)
            pKey = pKey.OpenSubKey("software")
            pKey = pKey.OpenSubKey("myprogram")

    Mystring = CStr(pKey.GetValue("mykey2"))

    and this:

    CStr(My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\myprogram", "MyKey2", Nothing))

    Isn´t there a bug fix for this? This problem can´t be new?

    Thanks

    Friday, June 7, 2013 10:40 PM
  • Thanks.

    Yes, thats the answer to the registry problem.

    It turns out I had another problem due to UAC bugging the programs folder. Apparently you´re not allowed to use it.

    Thanks again.

    Wednesday, June 12, 2013 10:22 PM