I created a setup with Inno Setup and wanted to query the registry using Pascal Script
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes\\Installer\UpgradeCodes\342603A924F08FA4B95B5C283FC13D13') then
My setup is 32bit (as is my Software I want to install), but on 64bit systems, the query is redirected to HKCR\Wow6432Node\\Installer\UpgradeCodes
Of course, the key is not found, even though it is there. How can I detect the key even though my setup remains 32bit?
I figured it out. You can make a helper function like this in your script:
function GetHKLM: Integer;
begin
if IsWin64 then
Result := HKLM64
else
Result := HKLM32;
end;
Then you use it like e.g.:
RegQueryStringValue(
GetHKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'XYZ', Variable);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With