RegKeyExists

118 views
Skip to first unread message

Justin Seabrook

unread,
May 19, 2022, 10:43:24 AM5/19/22
to innosetup
Hi, I have strange problem in Inno, I'm using a check on a registry key to see if a related program is already installed, it looks like this:

function OtherProgramPresentCheck(): Boolean;
begin
  if RegKeyExists(HKEY_LOCAL_MACHINE,'SOFTWARE\Other Program') then
    Result := true
    else
    Result := false;
end;     

It returns false even though Other Program is there in the HKLM registry.  Eventually I worked out that it does work for all the other keys in there (e.g. if I do RegKeyExists(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft') but not this particular key.  There is nothing special about the key.

Bizarrely it does work for the same Other Program key entry in HKCU.

Does anyone have any idea what could cause this issue?

Jernej Simončič

unread,
May 19, 2022, 11:08:22 AM5/19/22
to Justin Seabrook on [innosetup]

On Thursday, May 19, 2022, 16:43:24, Justin Seabrook wrote:


Does anyone have any idea what could cause this issue?

The other program is 64-bit, and your setup is running in 32-bit mode? See https://jrsoftware.org/ishelp/topic_32vs64bitinstalls.htm

 

-- 
< Jernej Simončič ><><><><>< https://eternallybored.org/ >


Almost anything is easier to get into than out of.
       -- Allen's Law

Justin Seabrook

unread,
May 20, 2022, 4:04:49 AM5/20/22
to innosetup
Thanks, that's helpful, I get stuck at the next step though ;-).
If I stick with 32-bit installation, can I still check for the existence of a 64-bit registry key?

Jernej Simončič

unread,
May 20, 2022, 7:17:51 AM5/20/22
to Justin Seabrook on [innosetup]

On Friday, May 20, 2022, 10:04:49, Justin Seabrook wrote:


Thanks, that's helpful, I get stuck at the next step though ;-).
If I stick with 32-bit installation, can I still check for the existence of a 64-bit registry key?

Yes, use HKLM64 (but check if you're running on 64-bit Windows with IsWin64 first, otherwise you'll get an exception).

 

-- 
< Jernej Simončič ><><><><>< https://eternallybored.org/ >


Only a mediocre person is always at his best.
       -- Maugham's Thought
Reply all
Reply to author
Forward
0 new messages