1

During its lifetime, MyApp creates extra shortcuts to Userappdata,

MyAppGroupName\MyAppShortcut#2
MyAppGroupName\MyAppShortcut#3
...

yet as Inno Setup requires elevation because of registry Association edits the original {Group} item is inserted in a different (commonstartmenu) directory:

MyAppGroupName\MyAppShortcutAtInstallation

Very happy with the {Group} flavour in the install so

DisableProgramGroupPage=yes

is not an option at this stage. Else creating paths in Dirs like

{Userappdata}\MyAppGroupName

doesn't appear to function in the current script:

        ...
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
ChangesAssociations = yes


[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
; (Note: Scroll to the right to see the full lines!)
Source: "Test.exe"; DestDir: "{app}"; Flags: ignoreversion

[Icons]
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"

[Registry]
Root: HKCU; Subkey: "Software\Auth/MyApp"; Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\Auth\MyApp"; ValueType: string; ValueName: "Name"; ValueData: "{app}";

;Association
Root: HKCR; Subkey: ".XXX";ValueData: "{#MyAppName}";Flags: uninsdeletevalue; ValueType: string; ValueName: ""
Root: HKCR; Subkey: "{#MyAppName}";ValueData: "Program {#MyAppName}";   Flags: uninsdeletekey; ValueType: string; ValueName: ""
Root: HKCR; Subkey: "{#MyAppName}\DefaultIcon";ValueData: "{app}\{#MyAppExeName},0";ValueType: string; ValueName: ""
Root: HKCR; Subkey: "{#MyAppName}\shell\open\command";ValueData: """{app}\{#MyAppExeName}"" ""%1""";ValueType: string;ValueName: ""


[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: en;  MessagesFile: "compiler:Default.isl"
Name: deu; MessagesFile: "compiler:Languages\German.isl"
Name: es;  MessagesFile: "compiler:Languages\Spanish.isl"

[Dirs]
Name: "{userstartmenu}\{userstartmenu}\{#MyAppName}"

[UninstallDelete]
Type: files; Name: "{#MyAppName}.chw"

Is there any known method of pointing {Group} to {Userappdata} in an elevated scenario? Or any other helpers e.g. here?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Laurie Stearn
  • 959
  • 1
  • 13
  • 34

1 Answers1

1

If I understand your question correctly you are looking for a combination of {userprograms} and {groupname}:

[Icons]
Name: "{userprograms}\{groupname}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"

Though note that:

  • Your approach is flawed in general. An installer should not both require elevation and modify environment of a specific user. The elevation can change user context (e.g. if Administrator account is distinct to the regular user account). So you do not know, if the "user" is the right user.
  • Using groups in Start menu is against Windows guidelines for Windows 8 and newer.
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • "Using groups in Start menu is against Windows guidelines": Fair enough, but in that directory there are, amongst others, things like "Windows Power Shell", "Windows System", "Ease of Access", "HTML Help Workshop". Old habits die hard it seems! – Laurie Stearn Jun 15 '17 at 05:39
  • "An installer should not both require elevation and modify environment of a specific user": Right of course. Well the only choice then is to perform the app extension association from _MyApp_. Pity, as _MyApp_ is RunasAdmin on first run and **two** admin prompts at install/launch is not a good look! – Laurie Stearn Jun 15 '17 at 06:41
  • I do not understand, why is MyApp run as admin for the first time? – Martin Prikryl Jun 15 '17 at 06:42
  • MyApp has to read off MHZ values. RegOpen fails on `HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0`. There are ways around it, but less fuss this way.:) – Laurie Stearn Jun 15 '17 at 06:50