Search code examples
installscript

Limitations of InstallScript "Is(FILE_EXISTS, filename)"?


My InstallScript 2014 project installs our application on a desktop PC or an embedded PC that controls an industrial instrument. The only way to know the difference is the presence of a unique USB device driver on the embedded PC that is used to enable the instrument front panel - there is obviously no front panel on the desktop.

The InstallScript code says

if (IS(FILE_EXISTS, "c:\\windows\\system32\\mydriver.sys")) then
    do instrument stuff
else
    do desktop stuff
endif;

The file is present on the instrument hard disk in the windows\system32 folder, yet the IS function always returns false.

I don't understand why this would be failing. The installer itself is running with elevated privilege, but examining the contents of Win\Sys32 does not require any special permissions - I can see the file using Windows Explorer.

What am I missing?


Solution

  • Apparently there is "magic" at the file system level that redirects requests between various directories on a 64 bit Windows system.

    It seems that all that must be done is

    Disable(WOW64FSREDIRECTION);
    do stuff
    Enable(WOW64FSREDIRECTION);
    

    See Targeting 64 bit operating systems with InstallScript Installations