Writing to Wow6432 registry on 64bit Windows...

Got a problem you cannot solve? Try here.
Edhy
Posts: 138
Joined: Sun Jul 31, 2005 4:09 pm
Location: New York, USA

Writing to Wow6432 registry on 64bit Windows...

Postby Edhy » Tue Jul 05, 2016 10:53 am

Hi,
I have a 32bits installation created using the Basic Wizard. This setup may also be run on a 64bit OS and when that is the case, I need to write some registry keys under the HKLM\SOFTWARE\WOW6432 key, but on 32 bits OS these keys should install on HKLM\SOFTWARE, I have the following code:
Here is the Plain Text Clipboard Data

Code: Select all

    Comment: ER: Write Registry Keys based on the OS processor
    if Variable ISWINDOWS64BIT Equals TRUE
      Comment: ER:  If on x64 force it to write to the WOW6432 node.
      Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode
    end
    Write Registry Key HKLM\SOFTWARE\KineticJump\AppLifeUpdate\ApplicationSettings\$DEV_APPLIFEUPDATE_APPLICATIONID$\LogDirectory, $TARGETDIR$\UpdateLogs
    Write Registry Key HKLM\SOFTWARE\KineticJump\AppLifeUpdate\ServiceKeys\$DEV_APPLIFEUPDATE_APPLICATIONID$\Path, $TARGETDIR$\TBRUtils.exe
    Write Registry Key HKLM\SOFTWARE\KineticJump\AppLifeUpdate\ServiceKeys\$DEV_APPLIFEUPDATE_APPLICATIONID$\PublicKey, $AppLifeUpdate_PUBLIC_KEY$
     
    if Variable ISWINDOWS64BIT Equals TRUE
      Comment: ER: Set the OS to x64
      Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
    end


Here is the InstallAware Clipboard Data

Code: Select all

~InstallAware Clipboard Data~
~End~
~{8E4A8DAB-0311-46EE-94F8-F00495CB2450}~
~Set 64 Bit Mode~
~{241CB02B-2B3B-469D-9C49-445DC9EA9A2A}~
~FALSE~
~FALSE~
~TRUE~
~Comment~
~{6B5A19ED-4E09-4B75-B0C2-40A2F6E75D31}~
~ER: Set the OS to x64~
~If~
~{384E09E0-3FD4-4BA9-9182-DDF6F6D01E38}~
~ISWINDOWS64BIT~
~0~
~TRUE~
~FALSE~
~Comment~
~{68C566D8-2040-46D0-AACD-9CB7EF77DFE9}~
~~
~Write Registry~
~{A9FE0D13-D7FE-4AC6-80AD-173225CCE806}~
~0~
~2|~
~SOFTWARE\KineticJump\AppLifeUpdate\ServiceKeys\$DEV_APPLIFEUPDATE_APPLICATIONID$~
~PublicKey~
~$AppLifeUpdate_PUBLIC_KEY$~
~TRUE~
~FALSE~
~Write Registry~
~{96CD90DF-628E-43B4-8F0E-99041E2776EE}~
~0~
~2|~
~SOFTWARE\KineticJump\AppLifeUpdate\ServiceKeys\$DEV_APPLIFEUPDATE_APPLICATIONID$~
~Path~
~$TARGETDIR$\TBRUtils.exe~
~TRUE~
~FALSE~
~Write Registry~
~{4C9E6C16-23C4-4CBB-BDBA-F54173855BA9}~
~0~
~2|~
~SOFTWARE\KineticJump\AppLifeUpdate\ApplicationSettings\$DEV_APPLIFEUPDATE_APPLICATIONID$~
~LogDirectory~
~$TARGETDIR$\UpdateLogs~
~TRUE~
~FALSE~
~End~
~{CE8DCF6C-C797-49A1-B2BB-7B3CF2147C04}~
~Set 64 Bit Mode~
~{2704416B-FB17-48B4-97FD-B9BD601395C1}~
~TRUE~
~FALSE~
~FALSE~
~Comment~
~{28DDE3F1-B9BE-4CAA-9FBF-DF46A3936415}~
~ER:  If on x64 force it to write to the WOW6432 node.~
~If~
~{81ACBC07-932B-47EE-B563-EA8ECC9BE91F}~
~ISWINDOWS64BIT~
~0~
~TRUE~
~FALSE~
~Comment~
~{AF13212E-08E9-430B-B822-6F0CFCA5AD5D}~
~ER: Write Registry Keys based on the OS processor~

What I am seeing in my test, is that when running on 32bits OS, it will create the keys properly on HKLM\SOFTWARE\ but when running on x64 OS, it will also write the keys on HKLM\SOFTWARE\ instead of HKLM\SOFTWARE\WOW6432.
This section of the code is before the Apply Install command.
What am I doing wrong here?

Thanks!!!
Edhy Rijo
Thom Child and Family Services

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Writing to Wow6432 registry on 64bit Windows...

Postby FrancescoT » Tue Jul 05, 2016 12:08 pm

Dear Edhy,

if the code you posted gets executed before Apply Install, it'll never write a key under "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node".

You are switching back to 64 Bit mode before Apply Install statement.

Write Registry command is a Windows Installer command (PURPLE COMMANDS) and it's effective execution is deferred to Apply Install execution.
http://www.installaware.com/forums/viewtopic.php?f=2&t=4338#p14960

Hope this helps you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Edhy
Posts: 138
Joined: Sun Jul 31, 2005 4:09 pm
Location: New York, USA

Re: Writing to Wow6432 registry on 64bit Windows...

Postby Edhy » Tue Jul 05, 2016 12:39 pm

Hi Francesco,
Thanks for the link on the "PURPLE COMMANDS" very good even though not straight answer on how to deal with my current issue.

I found a way to do this by using the NATIVE ENGINE and then manually deleting the keys when uninstalling, here is the code:
Create Registry Keys:

Code: Select all

    Comment: ER: Write Registry Keys based on the OS processor
    if Variable ISWINDOWS64BIT Equals TRUE
      Comment: ER:  If on x64 configure NATIVE_ENGINE to force it to write to the WOW6432 node immediately not matter the Apply Install .  These keys will need to be removed manually when Uninstalling
      Set Variable NATIVE_ENGINE to TRUE
      Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode
      Write Registry Key HKLM\SOFTWARE\KineticJump\AppLifeUpdate\ApplicationSettings\$DEV_APPLIFEUPDATE_APPLICATIONID$\LogDirectory, $TARGETDIR$\UpdateLogs
      Write Registry Key HKLM\SOFTWARE\KineticJump\AppLifeUpdate\ServiceKeys\$DEV_APPLIFEUPDATE_APPLICATIONID$\Path, $TARGETDIR$\TBRUtils.exe
      Write Registry Key HKLM\SOFTWARE\KineticJump\AppLifeUpdate\ServiceKeys\$DEV_APPLIFEUPDATE_APPLICATIONID$\PublicKey, $AppLifeUpdate_PUBLIC_KEY$
      Comment: ER: Set the OS to x64
      Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
      Set Variable NATIVE_ENGINE to FALSE
      else
      Write Registry Key HKLM\SOFTWARE\KineticJump\AppLifeUpdate\ApplicationSettings\$DEV_APPLIFEUPDATE_APPLICATIONID$\LogDirectory, $TARGETDIR$\UpdateLogs
      Write Registry Key HKLM\SOFTWARE\KineticJump\AppLifeUpdate\ServiceKeys\$DEV_APPLIFEUPDATE_APPLICATIONID$\Path, $TARGETDIR$\TBRUtils.exe
      Write Registry Key HKLM\SOFTWARE\KineticJump\AppLifeUpdate\ServiceKeys\$DEV_APPLIFEUPDATE_APPLICATIONID$\PublicKey, $AppLifeUpdate_PUBLIC_KEY$
    end


Then before Apply Uninstall I got this:

Code: Select all

  Comment: ER: Delete Registry Keys based on the OS processor
  if Variable ISWINDOWS64BIT Equals TRUE
    Comment: ER:  If on x64 force it to write to the WOW6432 node.
    Set Variable NATIVE_ENGINE to TRUE
    Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode
    Delete Registry KEY HKLM\SOFTWARE\KineticJump\AppLifeUpdate\ApplicationSettings\$DEV_APPLIFEUPDATE_APPLICATIONID$\*.*
    Delete Registry KEY HKLM\SOFTWARE\KineticJump\AppLifeUpdate\ServiceKeys\$DEV_APPLIFEUPDATE_APPLICATIONID$\*.*
    Comment: ER: Set the OS to x64
    Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
    Set Variable NATIVE_ENGINE to FALSE
  end


So far, I test it on Windows 7 x86 and x64 and seems to work fine. Please let me know if you see anything out of order that may not work.

Thanks again!!!
Edhy Rijo
Thom Child and Family Services

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Writing to Wow6432 registry on 64bit Windows...

Postby FrancescoT » Wed Jul 06, 2016 12:20 pm

Dear Edhy,

for what I see it looks correct!

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: Bing [Bot] and 114 guests