IlkkaV
Level 7

Identifying 64-bit installation in InstallScript?

I have a Basic MSI project where we have two releases defined, 32-bit and 64-bit. The files are separated just fine using release flags for features, but InstallScript custom actions seem a bit more tricky. Is there a way to check if the custom action has been called from a 64-bit installer? So e.g. a property to check to see if I need to pass REGDB_OPTION_WOW64_64KEY to REGDB_OPTIONS when my custom actions are accessing the Registry. I wouldn't like to create duplicate functions just for that.

I guess InstallScript custom actions are otherwise compatible regardless of the bitness? The documentation states that only JScript and VBScript custom actions need to have the 64-bit flag set when using a 64-bit installer.
Labels (1)
0 Kudos
2 Replies
MichaelU
Level 12 Flexeran
Level 12 Flexeran

Those flags change the run-mode (probably by changing which Custom Action host is used) for the Windows scripting engine. InstallScript always runs in 32-bit mode. There's no indication here what the package is, although in an immediate-mode action you might be able to determine it.

I think you'd be better off doing what you say you don't want to - create a couple different entry-point functions. All these functions should do is call the "real" function with the REGDB_OPTIONS you want to use. Something like this:
function MyX86Version(hInstall)
begin
MySharedVersion(hInstall, REGDB_OPTIONS & ~REGDB_OPTION_WOW64_64KEY)
end;

function MyX64Version(hInstall)
begin
MySharedVersion(hInstall, REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY)
end;
0 Kudos
IlkkaV
Level 7

Thanks for the information, MichaelU. Writing all those entry point functions and duplicating the custom actions calling them is much more tolerable when I can keep the "there must be a better way to do this" voices out of my head. At least now I know there isn't 🙂
0 Kudos