Page 1 of 2

More details on \"Set 64 Bit Mode\" command

Posted: Mon Sep 28, 2009 12:59 pm
by wolbrink
Is "Set 64 Bit Mode" a special MSI command? Or does this command immediately turn off WOW64 file/registry redirection?

For example, if in one portion of the script, I'd like to read from the 64-bit (non-redirected) portion of the registry, would the "Set 64 Bit Mode" command enable me to do this?

Would I just:

Set 64 Bit Mode (x64) // turn off redirection
Read Registry...
Set 64 Bit Mode (x86) // back to normal

Thanks,
Troy

Posted: Mon Sep 28, 2009 2:10 pm
by rasmusw
Yes, it works as you describe in your sample.

Note that the IA default scripts for e.g. .net framework x64 will stop the installation when the installer is run on x86.
If you want to make a single installer which includes both x64 and x86 versions of those runtimes, you need to make changes in both versions.

Posted: Mon Sep 28, 2009 2:26 pm
by wolbrink
rasmusw wrote:Yes, it works as you describe in your sample.
Thanks. Just to confirm: It's NOT a special MSI command? It immediately turns off WOW64 file/registry redirection?

--Troy

Posted: Mon Sep 28, 2009 2:28 pm
by rasmusw
wolbrink wrote:Just to confirm: It's NOT a special MSI command? It immediately turns off WOW64 file/registry redirection?
That I don't know. Maybe somebody from IA can explain?

Posted: Tue Sep 29, 2009 2:14 pm
by neillans
Correct -- it is not a special MSI command, and actually is a dll inserted that calls the redirection APIs

Re: More details on \"Set 64 Bit Mode\" command

Posted: Wed Aug 11, 2010 4:44 am
by martinb
We have encountered a problem with the Set 64 Bit Mode:

On a virtualized Windows 2008 x64 Enterprise, the follwing script does not work:

Code: Select all

Set 64 Bit Mode (x64) // turn off 
Write Registry...
Set 64 Bit Mode (x86) // back to normal 
The Registry value does not get written to the 64-bit branch of the registry. More exactly, it does not get written at all.

Info: The installer is a 32-bit installer and we try to switch to 64-bit mode to write to the 64-bit branch of the registry. Setup is started with admistrator rights.

Is this a bug ?

Any help is greatly appreciated.

Re: More details on \"Set 64 Bit Mode\" command

Posted: Wed Aug 11, 2010 2:53 pm
by mills
Write registry (and all pinkish commands) will not be run until Apply Install (Apply Changes). In fact, it's the Apply Install that you want to set the 64 bit mode on.

The following should do the trick:

Code: Select all

Write Registry Key HKLM\SOFTWARE\test\test, test
Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
Apply Install
Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode

Re: More details on \"Set 64 Bit Mode\" command

Posted: Thu Aug 12, 2010 1:18 am
by martinb
mills wrote:Write registry (and all pinkish commands) will not be run until Apply Install (Apply Changes). In fact, it's the Apply Install that you want to set the 64 bit mode on.
The following should do the trick:

Code: Select all

Write Registry Key HKLM\SOFTWARE\test\test, test
Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
Apply Install
Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode
Thank you.

One more question: I'v read in other posts, that calling apply install twice could mess up the uninstall process. Do you see any problems here ?

Re: More details on \"Set 64 Bit Mode\" command

Posted: Thu Aug 12, 2010 3:12 pm
by mills
Generally, you should only need to call Apply Install once. The pinkish commands do stack to the windows installer. So, the second Apply Install call will apply any pinkish MSI commands that were called in the first Apply Install, because a list is basically generated in the MSI table. There's no sense in duplicating that work...

In my example, I added a second Apply Install after the switch back to 32-bit mode. That effectively created another entry under the wow6432Node tree. However, that was the entry that was removed during Uninstall (not the initial, 64-bit entry; it still remained).

If you realize a need to run multiple Apply Installs, what seems to be the most common approach is to create unique installers for each set of commands you want to run under a give Apply Install, treating them as individual "products" (i.e. make sure product codes don't match). From your main installer, you can call the other installers with Run Program and run them silently.

Re: More details on \"Set 64 Bit Mode\" command

Posted: Fri Aug 13, 2010 3:16 am
by martinb
Now I think I do understand the approach. Thanks for explaining ! :D

Re: More details on \"Set 64 Bit Mode\" command

Posted: Fri Aug 13, 2010 1:01 pm
by KevinTX
mills wrote: If you realize a need to run multiple Apply Installs, what seems to be the most common approach is to create unique installers for each set of commands you want to run under a give Apply Install, treating them as individual "products" (i.e. make sure product codes don't match). From your main installer, you can call the other installers with Run Program and run them silently.
What if my 64-bit app installer needs to write some registry key/value in WOW6432NODE (and also in the normal one)? In this case, I would still need to call APPLY INSTALL twice, right?

Thanks,

Re: More details on \"Set 64 Bit Mode\" command

Posted: Fri Aug 13, 2010 2:19 pm
by mills
Yes, you will need to make 2 calls.

I ran a test, to see if two calls to Apply Uninstall would clear up the distinct bit-mode calls. It didn't work.

For the cleanest installation (and uninstall) of the 64bit and 32bit work, you'll need 2 installers.

I created one called 64bitWork. The first line I set to

Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode

The only work it does is:

Write Registry Key HKLM\SOFTWARE\test\test, test64

Nothing else was changed.

I created a second installer called 32bitWork and added 64bitWork.exe as an installable file.

It writes an entry to registry (in wow6432Node) and also calls the 64bitWork installer.

Its code looks like this:
code.jpg
code.jpg (151.73 KiB) Viewed 32808 times
It's important to call the other installer after the apply install and before the apply uninstall

I verified both registry entries were properly installed and uninstalled when the 32bitWork (parent) installer was installed/uninstalled.

Re: More details on \"Set 64 Bit Mode\" command

Posted: Fri Aug 13, 2010 3:21 pm
by KevinTX
Thank you for the detailed explanation and the code example. This is very helpful.

Have a nice weekend.

Re: More details on \"Set 64 Bit Mode\" command

Posted: Fri Sep 03, 2010 7:42 am
by KevinTX
Hello Andy,

I have one more question on the example you provided. How do I prevent both program from appearing in the Windows Add and Remove Program list. I only want one of them (the one that installs the real product) to appear in the Windows Add and Remove Program list.

Thanks,
Kevin

Re: More details on \"Set 64 Bit Mode\" command

Posted: Fri Sep 03, 2010 8:34 pm
by mills
I haven't tested it, but you may be able to remove a key from the registry. See:
http://www.annoyances.org/exec/show/article05-009

I'm not sure if that will prevent you from properly uninstalling the product that you don't want to appear in add/remove programs. You may have to resort to "manual" deletions.