I’m using an Inno Setup script to install my 32- and 64-bit DLLs in a 64-bit install. I can get the 64-bit path from a registry setting, but the 32-bit path is missing does not exist. However, I know that the path’s ‘tail’ is constant, just the head needs to be modified. Ie,
64-bit (from registry) = c:\Program Files\My Application\Bin
32-bit (derived) = c:\Program Files (x86)\My Application\Bin
So what I do is swap out the 64-bit program file path with the 32-bit one. I do this easily with StringChangeEx:
RegQueryStringValue(HKLM, 'SOFTWARE\My Application', 'RootDir', sPath)
if IsWin64() then
StringChangeEx(sPath, ExpandConstant('{pf}'), ExpandConstant('{pf32}'), False);
sPath is returned with my 32-bit path. This works great on most systems, but it seems that sometimes StringChangeEx does not swap out ‘C:\Program Files’ for ‘C:\Program Files (x86)’. I have verified (using MsgBox’s) that the {pf} and {pf32} constants are what I think they are. Casing is the same and there are no leading/trailing spaces. It just seems that on some systems, the function doesn’t work.
I’m using the latest version of InnoSetup (10/2010). The web site doesn’t mention any problems with this function. Has anyone else seen this and/or have any ideas on what it could be?
Turns out that the registry entry sometimes had a lower-case drive letter. I changed the code to:
I had assumed the registry entry was not the problem, but not quite so.