• R/O
  • HTTP
  • SSH
  • HTTPS

winmerge-jp: Commit


Commit MetaInfo

Revision4a2a54e80d53d4c1fa00a7a84fddfdd1e904eb3b (tree)
Time2021-09-15 21:05:09
AuthorTakashi Sawanaka <sdottaka@user...>
CommiterTakashi Sawanaka

Log Message

Shell Extension for Windows 11 or later (4)

Change Summary

Incremental Difference

--- a/Installer/InnoSetup/WinMerge.iss
+++ b/Installer/InnoSetup/WinMerge.iss
@@ -49,6 +49,7 @@
4949
5050 #define AppVersion GetFileVersion(SourcePath + "\..\..\Build\Release\WinMergeU.exe")
5151 #define ShellExtensionVersion GetFileVersion(SourcePath + "..\..\Build\ShellExtension\ShellExtensionU.dll")
52+#define WinMergeContextMenuVersion GetFileVersion(SourcePath + "..\..\Build\ShellExtension\x64\WinMergeContextMenu.dll")
5253
5354 [Setup]
5455 AppName=WinMerge
@@ -433,7 +434,9 @@ Source: ..\..\Build\Release\LogoImages\*.png; DestDir: {app}\LogoImages; Flags:
433434 ; Shell extension
434435 Source: ..\..\Build\ShellExtension\ShellExtensionU.dll; DestDir: {app}; Flags: regserver uninsrestartdelete restartreplace promptifolder; MinVersion: 0, 4; Check: not IsWin64 and not AreSourceAndDestinationOfShellExtensionSame(ExpandConstant('{app}\ShellExtensionU.dll'))
435436 ; 64-bit version of ShellExtension
436-Source: ..\..\Build\ShellExtension\ShellExtensionX64.dll; DestDir: {app}; Flags: regserver uninsrestartdelete restartreplace promptifolder 64bit; MinVersion: 0,5.01.2600; Check: IsWin64 and not AreSourceAndDestinationOfShellExtensionSame(ExpandConstant('{app}\ShellExtensionX64.dll'))
437+Source: ..\..\Build\ShellExtension\ShellExtensionX64.dll; DestDir: {app}; Flags: uninsrestartdelete restartreplace promptifolder 64bit; MinVersion: 0,5.01.2600; Check: IsWin64 and not AreSourceAndDestinationOfShellExtensionSame(ExpandConstant('{app}\ShellExtensionX64.dll'))
438+Source: ..\..\Build\ShellExtension\x64\WinMergeContextMenu.dll; DestDir: {app}; Flags: uninsrestartdelete restartreplace promptifolder 64bit; MinVersion: 0,5.01.2600; Check: IsWin64 and not AreSourceAndDestinationOfWinMergeContextMenuSame(ExpandConstant('{app}\WinMergeContextMenu.dll')) and UnregisterWinMergeContextMenuPackage
439+Source: ..\..\Build\ShellExtension\WinMergeContextMenuPackage.msix; DestDir: {app}; Flags: uninsrestartdelete restartreplace promptifolder 64bit; MinVersion: 0,5.01.2600; Check: IsWin64 and not AreSourceAndDestinationOfWinMergeContextMenuSame(ExpandConstant('{app}\WinMergeContextMenuPackage.msix'))
437440
438441 ; ArchiveSupport
439442 ;Please do not reorder the 7z Dlls by version they compress better ordered by platform and then by version
@@ -742,6 +745,11 @@ Filename: {win}\Explorer.exe; Description: {cm:ViewStartMenuFolder}; Parameters:
742745
743746 Filename: {app}\WinMergeU.exe; Description: {cm:LaunchProgram,WinMerge}; Flags: nowait postinstall skipifsilent runmaximized
744747
748+Filename: {sys}\regsvr32.exe; Parameters: "/s ""{app}\ShellExtensionX64.dll"""; Flags: waituntilterminated; Check: not IsWindows11OrLater
749+Filename: 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
750+
751+[UninstallRun]
752+Filename: {sys}\regsvr32.exe; Parameters: "/s /u ""{app}\ShellExtensionX64.dll"""; Flags: waituntilterminated
745753
746754 [UninstallDelete]
747755 ;Remove 7-zip integration dlls possibly installed (by hand or using separate installer)
@@ -850,6 +858,15 @@ Begin
850858 End;
851859 End;
852860
861+Function UnregisterWinMergeContextMenuPackage: Boolean;
862+var
863+ ResultCode: Integer;
864+Begin;
865+ if RegKeyExists(HKCU, 'SOFTWARE\Classes\PackagedCom\ClassIndex\{90340779-F37E-468E-9728-A2593498ED32}') then
866+ Exec('powershell.exe', '-c "$host.ui.RawUI.WindowTitle = ""Unregistering WinMergeContextMenu package...""; Get-AppxPackage -name WinMerge | Remove-AppxPackage"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
867+ Result := true;
868+End;
869+
853870 {This event procedure is queed each time the user changes pages within the installer}
854871 Procedure CurPageChanged(CurPage: integer);
855872 Begin
@@ -940,7 +957,8 @@ Begin
940957 if LoadStringFromFile(appdir + '\uninsTasks.txt', selectedTasks) then
941958 if Pos('modifypath', selectedTasks) > 0 then
942959 ModPath();
943- DeleteFile(appdir + '\uninsTasks.txt')
960+ DeleteFile(appdir + '\uninsTasks.txt');
961+ UnregisterWinMergeContextMenuPackage()
944962 end;
945963 End;
946964
@@ -972,6 +990,18 @@ begin
972990 Result := false;
973991 end;
974992
993+function AreSourceAndDestinationOfWinMergeContextMenuSame(Filename: String) : Boolean;
994+var
995+ ver: String;
996+begin
997+ ver := ''
998+ GetVersionNumbersString(Filename, ver);
999+ if ver = ExpandConstant('{#WinMergeContextMenuVersion}') then
1000+ Result := true
1001+ else
1002+ Result := false;
1003+end;
1004+
9751005 procedure RegisterPreviousData(PreviousDataKey: Integer);
9761006 begin
9771007 SetPreviousData(PreviousDataKey, 'UseAs3WayMergeTool', BooleanToString(g_CheckListBox.Checked[0]));
@@ -1004,3 +1034,18 @@ begin
10041034 g_CheckListBox.AddRadioButton(ExpandConstant('{cm:MergeAtLeftPane}'), '', 1, StringToBoolean(GetPreviousData('MergeAtLeftPane', 'false')), True, nil);
10051035 g_CheckListBox.AddCheckBox(ExpandConstant('{cm:AutoMergeAtStartup}'), '', 1, StringToBoolean(GetPreviousData('AutoMergeAtStartup', 'true')), True, False, True, nil);
10061036 end;
1037+
1038+Function IsWindows11OrLater(): Boolean;
1039+Var
1040+ OSVersion: TWindowsVersion;
1041+Begin
1042+ GetWindowsVersionEx(OSVersion);
1043+ if OSVersion.Major > 10 then
1044+ Result := true
1045+ else if (OSVersion.Major = 10) and (OSVersion.Minor > 0) then
1046+ Result := true
1047+ else if (OSVersion.Major = 10) and (OSVersion.Build >= 22000) then
1048+ Result := true
1049+ else
1050+ Result := false;
1051+End;
--- a/Src/Merge.rc
+++ b/Src/Merge.rc
@@ -2765,6 +2765,8 @@ BEGIN
27652765 0, 0, 100, 0,
27662766 0, 0, 100, 0,
27672767 0, 0, 100, 0
2768+ 0, 0, 100, 0,
2769+ 0, 0, 100, 0
27682770 END
27692771
27702772 IDD_FILTERS_FILEFILTERS AFX_DIALOG_LAYOUT
Show on old repository browser