Skip to content

Commit

Permalink
Fix issue #2109: "Register Windows 11 Shell Extension" fails because …
Browse files Browse the repository at this point in the history
…PowerShell script doesn't escape special chars correctly
  • Loading branch information
sdottaka committed Nov 16, 2023
1 parent 66631d3 commit f44c06a
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions Docs/Users/ChangeLog.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ <h3 id="file-filters">File filters</h3>
<h3 id="installer">Installer</h3>
<ul>
<li>BugFix: fix bug of Registry path (PR #2086)</li>
<li>BugFix: &quot;Register Windows 11 Shell Extension&quot; fails because PowerShell script doesn&#39;t escape special chars correctly (#2109)</li>
</ul>
<h3 id="translations">Translations</h3>
<ul>
Expand Down
2 changes: 2 additions & 0 deletions Docs/Users/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
### Installer

- BugFix: fix bug of Registry path (PR #2086)
- BugFix: "Register Windows 11 Shell Extension" fails because PowerShell script
doesn't escape special chars correctly (#2109)

### Translations

Expand Down
1 change: 1 addition & 0 deletions Docs/Users/ReleaseNotes.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ <h3 id="file-filters">File filters</h3>
<h3 id="installer">Installer</h3>
<ul>
<li>BugFix: fix bug of Registry path (PR #2086)</li>
<li>BugFix: &quot;Register Windows 11 Shell Extension&quot; fails because PowerShell script doesn&#39;t escape special chars correctly (#2109)</li>
</ul>
<h3 id="translations">Translations</h3>
<ul>
Expand Down
2 changes: 2 additions & 0 deletions Docs/Users/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Please submit bug reports to our bug-tracker.
### Installer

- BugFix: fix bug of Registry path (PR #2086)
- BugFix: "Register Windows 11 Shell Extension" fails because PowerShell script
doesn't escape special chars correctly (#2109)

### Translations

Expand Down
2 changes: 1 addition & 1 deletion Installer/InnoSetup/WinMergeARM64.is6.iss
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ Filename: {sys}\regsvr32.exe; Parameters: "/s ""{app}\{#ShellExtension64bit}""";
Filename: {sys}\regsvr32.exe; Parameters: "/s /n /i:user ""{app}\{#ShellExtension64bit}"""; Flags: waituntilterminated; Check: not IsAdminInstallMode and not IsWindows11OrLater
Filename: {app}\WinMerge32BitPluginProxy.exe; Parameters: "/RegServer"; Flags: waituntilidle; Check: IsAdminInstallMode
Filename: {app}\WinMerge32BitPluginProxy.exe; Parameters: "/RegServerPerUser"; Flags: waituntilidle; Check: not IsAdminInstallMode
Filename: {win}\sysnative\WindowsPowerShell\v1.0\PowerShell.exe; Parameters: "-c ""$host.ui.RawUI.WindowTitle = 'Registering WinMergeContextMenu package...'; if ((Get-AppxPackage -name WinMerge) -eq $null) {{ Add-AppxPackage '{app}\WinMergeContextMenuPackage.msix' -ExternalLocation '{app}'}"""; Flags: waituntilterminated; Check: IsWindows11OrLater
Filename: {win}\sysnative\WindowsPowerShell\v1.0\PowerShell.exe; Parameters: "-c ""$host.ui.RawUI.WindowTitle = 'Registering WinMergeContextMenu package...'; if ((Get-AppxPackage -name WinMerge) -eq $null) {{ Add-AppxPackage \""{app}\WinMergeContextMenuPackage.msix\"" -ExternalLocation \""{app}\""}"""; Flags: waituntilterminated; Check: IsWindows11OrLater

[UninstallRun]
Filename: {syswow64}\regsvr32.exe; Parameters: "/s /u ""{app}\{#ShellExtension32bit}"""; Flags: waituntilterminated; Check: IsAdminInstallMode; Components: ShellExtension32bit
Expand Down
2 changes: 1 addition & 1 deletion Installer/InnoSetup/WinMergeX64.is6.iss
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ Filename: {sys}\regsvr32.exe; Parameters: "/s ""{app}\{#ShellExtension64bit}""";
Filename: {sys}\regsvr32.exe; Parameters: "/s /n /i:user ""{app}\{#ShellExtension64bit}"""; Flags: waituntilterminated; Check: not IsAdminInstallMode and not IsWindows11OrLater
Filename: {app}\WinMerge32BitPluginProxy.exe; Parameters: "/RegServer"; Flags: waituntilidle; Check: IsAdminInstallMode
Filename: {app}\WinMerge32BitPluginProxy.exe; Parameters: "/RegServerPerUser"; Flags: waituntilidle; Check: not IsAdminInstallMode
Filename: {win}\sysnative\WindowsPowerShell\v1.0\PowerShell.exe; Parameters: "-c ""$host.ui.RawUI.WindowTitle = 'Registering WinMergeContextMenu package...'; if ((Get-AppxPackage -name WinMerge) -eq $null) {{ Add-AppxPackage '{app}\WinMergeContextMenuPackage.msix' -ExternalLocation '{app}'}"""; Flags: waituntilterminated; Check: IsWindows11OrLater
Filename: {win}\sysnative\WindowsPowerShell\v1.0\PowerShell.exe; Parameters: "-c ""$host.ui.RawUI.WindowTitle = 'Registering WinMergeContextMenu package...'; if ((Get-AppxPackage -name WinMerge) -eq $null) {{ Add-AppxPackage \""{app}\WinMergeContextMenuPackage.msix\"" -ExternalLocation \""{app}\""}"""; Flags: waituntilterminated; Check: IsWindows11OrLater

[UninstallRun]
Filename: {syswow64}\regsvr32.exe; Parameters: "/s /u ""{app}\{#ShellExtension32bit}"""; Flags: waituntilterminated; Check: IsAdminInstallMode; Components: ShellExtension32bit
Expand Down
2 changes: 1 addition & 1 deletion Installer/InnoSetup/WinMergeX64.iss
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ Filename: {app}\WinMergeU.exe; Description: {cm:LaunchProgram,WinMerge}; Flags:

Filename: {sys}\regsvr32.exe; Parameters: "/s ""{app}\{#ShellExtension64bit}"""; Flags: waituntilterminated; Check: not IsWindows11OrLater
Filename: {app}\WinMerge32BitPluginProxy.exe; Parameters: "/RegServer"; Flags: waituntilidle
Filename: {win}\sysnative\WindowsPowerShell\v1.0\PowerShell.exe; Parameters: "-c ""$host.ui.RawUI.WindowTitle = 'Registering WinMergeContextMenu package...'; if ((Get-AppxPackage -name WinMerge) -eq $null) {{ Add-AppxPackage '{app}\WinMergeContextMenuPackage.msix' -ExternalLocation '{app}'}"""; Flags: waituntilterminated; Check: IsWindows11OrLater
Filename: {win}\sysnative\WindowsPowerShell\v1.0\PowerShell.exe; Parameters: "-c ""$host.ui.RawUI.WindowTitle = 'Registering WinMergeContextMenu package...'; if ((Get-AppxPackage -name WinMerge) -eq $null) {{ Add-AppxPackage \""{app}\WinMergeContextMenuPackage.msix\"" -ExternalLocation \""{app}\""}"""; Flags: waituntilterminated; Check: IsWindows11OrLater

[UninstallRun]
Filename: {sys}\regsvr32.exe; Parameters: "/s /u ""{app}\{#ShellExtension64bit}"""; Flags: waituntilterminated
Expand Down
2 changes: 1 addition & 1 deletion Installer/InnoSetup/WinMergeX64NonAdmin.iss
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ Filename: {app}\WinMergeU.exe; Description: {cm:LaunchProgram,WinMerge}; Flags:
Filename: {syswow64}\regsvr32.exe; Parameters: "/s /n /i:user ""{app}\{#ShellExtension32bit}"""; Flags: waituntilterminated; Components: ShellExtension32bit
Filename: {sys}\regsvr32.exe; Parameters: "/s /n /i:user ""{app}\{#ShellExtension64bit}"""; Flags: waituntilterminated; Check: not IsWindows11OrLater
Filename: {app}\WinMerge32BitPluginProxy.exe; Parameters: "/RegServerPerUser"; Flags: waituntilidle
Filename: {win}\sysnative\WindowsPowerShell\v1.0\PowerShell.exe; Parameters: "-c ""$host.ui.RawUI.WindowTitle = 'Registering WinMergeContextMenu package...'; if ((Get-AppxPackage -name WinMerge) -eq $null) {{ Add-AppxPackage '{app}\WinMergeContextMenuPackage.msix' -ExternalLocation '{app}'}"""; Flags: waituntilterminated; Check: IsWindows11OrLater
Filename: {win}\sysnative\WindowsPowerShell\v1.0\PowerShell.exe; Parameters: "-c ""$host.ui.RawUI.WindowTitle = 'Registering WinMergeContextMenu package...'; if ((Get-AppxPackage -name WinMerge) -eq $null) {{ Add-AppxPackage \""{app}\WinMergeContextMenuPackage.msix\"" -ExternalLocation \""{app}\""}"""; Flags: waituntilterminated; Check: IsWindows11OrLater

[UninstallRun]
Filename: {syswow64}\regsvr32.exe; Parameters: "/s /u /n /i:user ""{app}\{#ShellExtension32bit}"""; Flags: waituntilterminated; Components: ShellExtension32bit
Expand Down
2 changes: 1 addition & 1 deletion Installer/InnoSetup/WinMergeX86.iss
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ Filename: {win}\Explorer.exe; Description: {cm:ViewStartMenuFolder}; Parameters:
Filename: {app}\WinMergeU.exe; Description: {cm:LaunchProgram,WinMerge}; Flags: nowait postinstall skipifsilent runmaximized

Filename: {sys}\regsvr32.exe; Parameters: "/s ""{app}\{#ShellExtension64bit}"""; Flags: waituntilterminated; Check: not IsWindows11OrLater
Filename: {win}\sysnative\WindowsPowerShell\v1.0\PowerShell.exe; Parameters: "-c ""$host.ui.RawUI.WindowTitle = 'Registering WinMergeContextMenu package...'; if ((Get-AppxPackage -name WinMerge) -eq $null) {{ Add-AppxPackage '{app}\WinMergeContextMenuPackage.msix' -ExternalLocation '{app}'}"""; Flags: waituntilterminated; Check: IsWindows11OrLater
Filename: {win}\sysnative\WindowsPowerShell\v1.0\PowerShell.exe; Parameters: "-c ""$host.ui.RawUI.WindowTitle = 'Registering WinMergeContextMenu package...'; if ((Get-AppxPackage -name WinMerge) -eq $null) {{ Add-AppxPackage \""{app}\WinMergeContextMenuPackage.msix\"" -ExternalLocation \""{app}\""}"""; Flags: waituntilterminated; Check: IsWindows11OrLater

[UninstallRun]
Filename: {sys}\regsvr32.exe; Parameters: "/s /u ""{app}\{#ShellExtension64bit}"""; Flags: waituntilterminated
Expand Down
2 changes: 1 addition & 1 deletion Src/PropShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static bool RegisterWinMergeContextMenu(bool unregister)
String progpath = env::GetProgPath();
String packagepath = paths::ConcatPath(progpath, _T("WinMergeContextMenuPackage.msix"));
if (!unregister)
cmd = strutils::format(_T("powershell -c \"Add-AppxPackage '%s' -ExternalLocation '%s'; if (!$?) { pause }\""), packagepath, progpath);
cmd = strutils::format(_T("powershell -c \"Add-AppxPackage \\\"%s\\\" -ExternalLocation \\\"%s\\\"; if (!$?) { pause }\""), packagepath, progpath);
else
cmd = _T("powershell -c \"Get-AppxPackage -name WinMerge | Remove-AppxPackage; if (!$?) { pause }\"");

Expand Down

0 comments on commit f44c06a

Please sign in to comment.