Skip to content

Commit bcf72dd

Browse files
authored
Merge pull request #3948 from bclothier/FixElevationForInstaller
Removes the restrictions on the admin elevation; add-in will be automatically registered for an admin user now.
2 parents d24bf63 + a1c8749 commit bcf72dd

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

Rubberduck.Deployment/InnoSetup/Installer Build Script.iss

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -514,18 +514,19 @@ end;
514514
515515
///<remarks>
516516
///Called after successfully installing, including via the elevated installer
517-
///to register the VBE addin. Should be never run under elevated context
518-
///or the registration may not work as expected.
517+
///to register the VBE addin.
519518
///</remarks>
520519
procedure RegisterAddin();
521520
begin
522-
if not IsElevated() then
523-
begin
524-
RegisterAddinForIDE(HKCU32, 'Software\Microsoft\VBA\VBE\6.0\Addins', '{#AddinProgId}');
525-
526521
if IsWin64() then
522+
begin
523+
RegisterAddinForIDE(HKCU32, 'Software\Microsoft\VBA\VBE\6.0\Addins', '{#AddinProgId}');
527524
RegisterAddinForIDE(HKCU64, 'Software\Microsoft\VBA\VBE\6.0\Addins64', '{#AddinProgId}');
528-
end;
525+
end
526+
else
527+
begin
528+
RegisterAddinForIDE(HKCU, 'Software\Microsoft\VBA\VBE\6.0\Addins', '{#AddinProgId}');
529+
end;
529530
end;
530531
531532
///<remarks>
@@ -816,11 +817,10 @@ begin
816817
ExpandConstant('{cm:RegisterAddInCaption}'),
817818
ExpandConstant('{cm:RegisterAddInMessage}'),
818819
ExpandConstant('{cm:RegisterAddInDescription}'),
819-
False, False);
820+
false, false);
820821
821822
RegisterAddInOptionPage.Add(ExpandConstant('{cm:RegisterAddInButtonCaption}'));
822-
RegisterAddInOptionPage.CheckListBox.ItemEnabled[0] := not IsElevated();
823-
RegisterAddInOptionPage.Values[0] := not IsElevated();
823+
RegisterAddInOptionPage.Values[0] := true;
824824
end;
825825
826826
///<remarks>
@@ -847,14 +847,6 @@ begin
847847
PagesSkipped := True;
848848
end;
849849
850-
// If the installer is elevated, we cannot register the addin so we must skip the
851-
// custom page.
852-
if (PageID = RegisterAddInOptionPage.ID) and IsElevated() then
853-
begin
854-
Log('RegisterAddInOptionPage skipped because we are running elevated.');
855-
Result := true;
856-
end;
857-
858850
// We don't need to show the users finished panel from the elevated installer
859851
// if they already have the non-elevated installer running.
860852
if (PageID = wpFinished) and HasElevateSwitch then
@@ -998,14 +990,14 @@ begin
998990
// custom page we should run RegisterAdd()
999991
else if CurPageID = RegisterAddInOptionPage.ID then
1000992
begin
1001-
if not IsElevated() and RegisterAddInOptionPage.Values[0] then
993+
if RegisterAddInOptionPage.Values[0] then
1002994
begin
1003995
Log('Addin registration was requested and will be performed');
1004996
RegisterAddIn();
1005997
end
1006998
else
1007999
begin
1008-
Log('Addin registration was declined because either we are elevated or the user unchecked the checkbox');
1000+
Log('Addin registration was declined because the user unchecked the checkbox');
10091001
end;
10101002
end;
10111003

0 commit comments

Comments
 (0)