Index: scripts/setup.iss =================================================================== diff -u -r64e73d0972db79d7e038d557f124f0c7d7137746 -r477c71d2b9d6e07f70f19e860dbc2ae13063704b --- scripts/setup.iss (.../setup.iss) (revision 64e73d0972db79d7e038d557f124f0c7d7137746) +++ scripts/setup.iss (.../setup.iss) (revision 477c71d2b9d6e07f70f19e860dbc2ae13063704b) @@ -169,8 +169,6 @@ [Run] Filename: "{app}\{code:ExpandArch|ExeFilename}"; Flags: nowait postinstall skipifsilent; Description: "{cm:LaunchProgram,{#MyAppName}}" -Filename: "Reg.exe"; Parameters: "delete ""HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"" /v ""Copy Handler"" /f"; Flags: runasoriginaluser; -Filename: "Reg.exe"; Parameters: "add ""HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"" /v ""Copy Handler"" /t REG_SZ /d ""{app}\{code:ExpandArch|ExeFilename}"" /f"; Flags: runasoriginaluser postinstall; Tasks: startatboot [Registry] Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: none; ValueName: "Copy Handler"; Flags: deletevalue uninsdeletevalue @@ -208,3 +206,16 @@ end; end; end; + +procedure CurStepChanged(CurStep: TSetupStep); +var + ResultCode: Integer; +begin + if CurStep = ssPostInstall then + begin + if IsTaskSelected('startatboot') then + ExecAsOriginalUser('Reg.exe', 'add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "Copy Handler" /d "' + ExpandConstant('{app}\{code:ExpandArch|ExeFilename}') + '" /f', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) + else + ExecAsOriginalUser('Reg.exe', 'delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "Copy Handler" /f', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) + end; +end;