Seva Alekseyev
Seva Alekseyev

Reputation: 61361

64-bit MSI executes as a 32-bit one

I've created an MSI package (in Orca). The Platform field in the summary information says "x64;1033". The machine is a 64 bit one. The schema version, in case it matters, is 400.

When I run it with with MSIExec like this:

msiexec /qn /li a.txt /i b.msi

I can see that it executes in a 32 bit process. Not the intended result.

To check, I've placed a value under HKLM\SOFTWARE - Bits, REG_SZ, value "64", and a similar one under HKLM\SOFTWARE\WOW6432Node, but with value "32", and I dump that value in a custom JScript action early in the install sequence. I get "32".

The copy of msiexec that I run is under c:\Windows\System32, it's a 64 bit executable, and it's not supposed to matter anyway, the installer is not running in the msiexec process AFAIK.

The Platform in the summary info is not completely ignored - if I specify "Intel64", which stands for Itanium, I get an "Unsupported architecture" error. Tried "AMD64" - it's only option in Orca if you provide Schema>=500 - same result, 32 bit.

Upvotes: 2

Views: 607

Answers (1)

Seva Alekseyev
Seva Alekseyev

Reputation: 61361

Custom actions have their own bitness each. For DLL-type actions, it's derived from the target architecture of the DLL. For script-type actions, where bitness can't be inferred, the Type field value must be ORred with 0x1000 (msidbCustomActionType64BitScript, decimal 4096) for a 64-bit execution context.

A script action without that bit set will be executed in a 32-bit environment even in an otherwise 64-bit targeting MSI. That was my case.

The issue at hand, as observed, was an artifact of the the way the bitness check was implemented. That said, in case of this particular MSI there was a custom action script that was not bitness agnostic, so the root cause of this issue mattered to the project.

One presumes the same applies on ARM/ARM64; I could not test.

https://learn.microsoft.com/en-us/windows/win32/msi/64-bit-custom-actions

Upvotes: 2

Related Questions