Skip to content

Commit cfee127

Browse files
committed
fix windows protocol handler path
1 parent 0cb4e29 commit cfee127

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

windows/installer/codex-dream-skin.iss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define AppPublisher "Codex Dream Skin contributors"
1313
#define AppUrl "https://dreamskin.cc"
1414
#define PowerShellPath "{sysnative}\WindowsPowerShell\v1.0\powershell.exe"
15+
#define PersistentPowerShellPath "{win}\System32\WindowsPowerShell\v1.0\powershell.exe"
1516

1617
[Setup]
1718
AppId={{DCCDAF1A-9ACD-4AAB-B55B-DF17EB2CDA2E}
@@ -72,14 +73,14 @@ Source: "{#StageRoot}\NOTICE.md"; DestDir: "{app}"; Flags: ignoreversion
7273
Source: "{#StageRoot}\payload\*"; DestDir: "{app}\payload"; Flags: ignoreversion recursesubdirs createallsubdirs
7374

7475
[Icons]
75-
Name: "{group}\Codex Dream Skin"; Filename: "{#PowerShellPath}"; Parameters: "-NoProfile -STA -WindowStyle Hidden -ExecutionPolicy RemoteSigned -File ""{app}\setup-bootstrap.ps1"" -LaunchTray"; WorkingDir: "{app}"; IconFilename: "{app}\payload\assets\codex-dream-skin.ico"
76-
Name: "{userstartup}\Codex Dream Skin"; Filename: "{#PowerShellPath}"; Parameters: "-NoProfile -STA -WindowStyle Hidden -ExecutionPolicy RemoteSigned -File ""{app}\setup-bootstrap.ps1"" -LaunchTray"; WorkingDir: "{app}"; IconFilename: "{app}\payload\assets\codex-dream-skin.ico"; Tasks: startup
76+
Name: "{group}\Codex Dream Skin"; Filename: "{#PersistentPowerShellPath}"; Parameters: "-NoProfile -STA -WindowStyle Hidden -ExecutionPolicy RemoteSigned -File ""{app}\setup-bootstrap.ps1"" -LaunchTray"; WorkingDir: "{app}"; IconFilename: "{app}\payload\assets\codex-dream-skin.ico"
77+
Name: "{userstartup}\Codex Dream Skin"; Filename: "{#PersistentPowerShellPath}"; Parameters: "-NoProfile -STA -WindowStyle Hidden -ExecutionPolicy RemoteSigned -File ""{app}\setup-bootstrap.ps1"" -LaunchTray"; WorkingDir: "{app}"; IconFilename: "{app}\payload\assets\codex-dream-skin.ico"; Tasks: startup
7778

7879
[Registry]
7980
Root: HKCU; Subkey: "Software\Classes\dreamskin"; ValueType: string; ValueName: ""; ValueData: "URL:DreamSkin Protocol"; Flags: uninsdeletekey
8081
Root: HKCU; Subkey: "Software\Classes\dreamskin"; ValueType: string; ValueName: "URL Protocol"; ValueData: ""
8182
Root: HKCU; Subkey: "Software\Classes\dreamskin\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\payload\assets\codex-dream-skin.ico"
82-
Root: HKCU; Subkey: "Software\Classes\dreamskin\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{#PowerShellPath}"" -NoProfile -STA -WindowStyle Hidden -ExecutionPolicy RemoteSigned -File ""{localappdata}\CodexDreamSkin\engine\scripts\apply-community-theme.ps1"" ""%1"""
83+
Root: HKCU; Subkey: "Software\Classes\dreamskin\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{#PersistentPowerShellPath}"" -NoProfile -STA -WindowStyle Hidden -ExecutionPolicy RemoteSigned -File ""{localappdata}\CodexDreamSkin\engine\scripts\apply-community-theme.ps1"" ""%1"""
8384

8485
[Run]
8586
Filename: "{#PowerShellPath}"; Parameters: "-NoProfile -STA -WindowStyle Hidden -ExecutionPolicy RemoteSigned -File ""{app}\setup-bootstrap.ps1"" -LaunchTray"; WorkingDir: "{app}"; Description: "Launch Codex Dream Skin"; Flags: nowait postinstall skipifsilent

windows/tests/installer-static.tests.ps1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,26 @@ if ($definition.Contains('Root: HKLM') -or
9393
[regex]::Matches($definition, '(?m)^Root: HKCU; Subkey: "Software\\Classes\\dreamskin').Count -ne 4) {
9494
throw 'The dreamskin protocol must be a four-entry current-user registration with no arbitrary URL contract.'
9595
}
96+
if (-not $definition.Contains('#define PersistentPowerShellPath "{win}\System32\WindowsPowerShell\v1.0\powershell.exe"')) {
97+
throw 'Persistent shortcuts and URL handlers must use a System32 PowerShell path that 64-bit launchers can access.'
98+
}
99+
$persistentCommandEntries = @(
100+
'Name: "{group}\Codex Dream Skin"',
101+
'Name: "{userstartup}\Codex Dream Skin"',
102+
'Subkey: "Software\Classes\dreamskin\shell\open\command"'
103+
)
104+
foreach ($entry in $persistentCommandEntries) {
105+
$line = ([regex]::Match(
106+
$definition,
107+
'(?m)^.*' + [regex]::Escape($entry) + '.*$'
108+
)).Value
109+
if (-not $line.Contains('{#PersistentPowerShellPath}')) {
110+
throw "Persistent command does not use the browser-accessible PowerShell path: $entry"
111+
}
112+
if ($line.Contains('{#PowerShellPath}') -or $line.Contains('{sysnative}')) {
113+
throw "Persistent command still references sysnative, which 64-bit launchers cannot access: $entry"
114+
}
115+
}
96116

97117
$uninstallStepIndex = $definition.IndexOf(
98118
'if CurUninstallStep <> usUninstall then',

0 commit comments

Comments
 (0)