How can I delete references to types and components in the uninstall registry key?

88 views
Skip to first unread message

George Hovhannisian

unread,
Jan 14, 2024, 3:45:02 PM1/14/24
to innosetup
I need to hide the fact that my installer has multiple types and components, I'm doing this:


procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssDone then
  begin
    RegDeleteKeyIncludingSubkeys(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\George''s test_is1\Inno Setup: Deselected Components');
    RegDeleteKeyIncludingSubkeys(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\George''s test_is1\Inno Setup: Selected Components');
    RegDeleteKeyIncludingSubkeys(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\George''s test_is1\Inno Setup: Setup Type');
  end;
end;

I understand this is used my  subsequent installs, but my installer forces uninstalling the previous one before proceeding, so I never need this:


function InitializeSetup(): Boolean;
begin
  Result := True;
  if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\UninstallGeorge''s test_is1', 'UninstallString', Uninstaller) then
    if (MsgBox('Uninstall previous version?', mbConfirmation, MB_YESNO) = IDYES) then
      Result := Exec(RemoveQuotes(Uninstaller), '/SILENT', '', SW_SHOWNORMAL, ewNoWait, ResultCode)
    else
      Result := False;
end;

I thought ssDone would be safe enough, but it doesn't work. What can I do?

Eivind Bakkestuen

unread,
Jan 14, 2024, 4:22:57 PM1/14/24
to inno...@googlegroups.com
" it doesn't work" means what exactly? Are you checking function return values, studied the /LOG file output...?

--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/innosetup/f5b7a45f-f865-40fe-aa05-34727f73fb44n%40googlegroups.com.

George Hovhannisian

unread,
Jan 14, 2024, 4:34:40 PM1/14/24
to innosetup
I check the registry keys after install and all of them are still there. I use Inno Sctipt Studio. The internal log shows no mentions of running any `RegDeleteKeyIncludingSubkeys` commands.

Eivind Bakkestuen

unread,
Jan 14, 2024, 4:45:50 PM1/14/24
to inno...@googlegroups.com
Do some basic debugging. Pop up a message box just after calling RegDeleteKeyIncludingSubkeys(); display the parameters in the message box to make sure they are as expected, etc.

While the debug message box is popped up, look in the registry and check if the key was removed (then you know if the installer put it back afterwards)...



George Hovhannisian

unread,
Jan 14, 2024, 5:07:07 PM1/14/24
to innosetup
Well, RegGetSubkeyNames is empty. Am I not escaping the `'` character correctly?

George Hovhannisian

unread,
Jan 14, 2024, 5:44:48 PM1/14/24
to innosetup
procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssDone then
  begin
    if RegGetSubkeyNames(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\George''s test_is1', Names) then
      begin
        S := '';
        for I := 0 to GetArrayLength(Names)-1 do
          S := S + Names[I] + #13#10;
        MsgBox('List of subkeys:'#13#10#13#10 + S, mbInformation, MB_OK);
      end
    else
      begin
        MsgBox('No subkeys returned!', mbInformation, MB_OK);
      end;
  end;
end;


Message box just says "List of subkeys:". I think it's the single quote, but I'm not sure. I'm messing around with ways to read it correctly.

George Hovhannisian

unread,
Jan 14, 2024, 7:32:28 PM1/14/24
to innosetup
I made a dumb mistake. Those are values, not keys.
Reply all
Reply to author
Forward
0 new messages