From 7894753d2e38c9bd02b7d616871faf182700f51c Mon Sep 17 00:00:00 2001 From: David Sangrey Date: Thu, 17 Aug 2023 23:15:33 -0400 Subject: [PATCH 1/3] [Installer] Old Ver Removal with Diff GUID --- modules.p | Bin 44756 -> 44802 bytes resources/EDMC_Installer_Config_template.txt | 40 +++++++++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/modules.p b/modules.p index 5d7adf41c450797b7e5a1f1db483adc5a5717d44..c48f76c4894fdb061e0a1967f388afe819e679c4 100644 GIT binary patch delta 1566 zcmZ{kO=uHA6vvZozDWIOAQfrR*2Q9%h%H?eYl7L^A|cpA3*w=&n`}NdnxNHEER`st z9)uhwt<+O)#)~L91WHNlRTM-#R#5~&DX4f*N)PVNymg%HW)53Ye((R@Z+B+iz2|O! z;5=o|^6%%KXax1`^M)6+Vred=6pPx`%Y})Hsxp^Pp<8?V8}Z1R;2uQV)5neH*i6)T z7R+bk@yxm2!&Q&Vl{l#{8-L{ZXAv)b1^>Epz_ln{Yqj&NB`zWw=R z2g64Rm;mtWs<|H7Qa2QlfENJVdS$NH0NzK}*7cj)IB^hFQhsz=4U&Q>DEP(9d-q<1 z+jVx$C}^v~v5D$Zbu{Noa5`4Bdaxx_v8}=|X~%4;XJn&z3IT)Oo1!_$2^hpn z23diUoi4I%l}BGvp@Zhs$^C9j8xrJ`P{n3iKxfiHf<-$ps%2so3!Cl0s8lm8M$Cq? zw0NGF;0+-e|1y`&3wPI``)-a5*<<@~%`}fbYJODFf+N^xoS?E4%;06yYH1=N=bcGv z*3yjckb&HFXPOEYGmu;8A@5)6VJ_tz|LYCMXD)+`pe;I)E5$5%>>DDoW^anwx5t!SD zUMgi>Jb-To7kL-fCZ~2A1>uNwi%8_~cCd5;lePS6jx6;uShQN`b?p9sqVs(J3>u+J YLox39C>pQxXrUfPlkPo@`TDHyFB-4y7ytkO delta 1548 zcmZ{kPiWIn9LLivZA#SXV2W0@VQ|<`8O}@*I#_N&N~Z@4A~>0Lqt97 zJG|2J$@hIfFR$>(S&1A#$=rZDU(BW5dET3=Uvg)59DXElT;`;M+z)-|hl+<&#^3JU z`mQf^PC0YvSzbm?zJtJnq3}#0`{~zh*~tD zRySp|W{GIhf(ozw;Jq!5W5t3Br%0%-u_Ucfu@ux@g4~zkG*!!%Aa^|qYKazVUhany zsKrI177wUZEE!$4Mbu+Mg#|zO5OW;pVH~!h!nqh!U`eVrY%A!ap9>XqjissDA3yhP z9CCY^&1G}%IM8=i0$O2i9(tiHIcgWaLO8Mq{sE^(8)M3mE!?b diff --git a/resources/EDMC_Installer_Config_template.txt b/resources/EDMC_Installer_Config_template.txt index 4b8f053d8..f873eb2c1 100644 --- a/resources/EDMC_Installer_Config_template.txt +++ b/resources/EDMC_Installer_Config_template.txt @@ -54,27 +54,48 @@ Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChang ;Check if a WiX-based installation exists. If so, kill it with fire. [Code] -function IsWixInstalled: Boolean; +function EndsWith(SubText, Text: AnsiString): Boolean; var - Uninstall: String; + EndStr: string; begin - Result := RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5E9AD4D3-0365-41D5-9586-9368745DD109}', 'UninstallString', Uninstall); + Log('Starting'); + EndStr := Copy(Text, Length(Text) - Length(SubText) + 1, Length(SubText)); + Log(EndStr); + { Use SameStr, if you need a case-sensitive comparison } + Result := SameText(SubText, EndStr); end; +// EDMC didn't keep a consistant GUID during previous history. Due to that, we have to do this tomfoolery. procedure CurStepChanged(CurStep: TSetupStep); var ResultCode: Integer; Uninstall: String; + OldWiX: Boolean; + S: AnsiString; + PowerShellOutputFile: String; begin - if (CurStep = ssInstall) and IsWixInstalled then + if (CurStep = ssInstall) then begin - MsgBox('Warning: an old version of EDMC is installed! Please close EDMC while we remove the old version!', mbInformation, MB_OK); - Uninstall := '/x {5E9AD4D3-0365-41D5-9586-9368745DD109}'; - Exec('MsiExec.exe', Uninstall, '', SW_SHOW, ewWaitUntilTerminated, ResultCode); + PowerShellOutputFile := ExpandConstant('{tmp}\PowershellOutput.txt'); + // Construct the PowerShell command and capture output to a file + Exec('powershell.exe', '-NoProfile -ExecutionPolicy Bypass -Command "Get-WmiObject -Class Win32_Product | ForEach-Object { $_.Name -like ''*Elite Dangerous Market Connector*'' } | Select-Object -ExpandProperty IdentifyingNumber" | Out-File -Encoding ASCII "' + PowerShellOutputFile + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode); + begin + if LoadStringFromFile(PowerShellOutputFile, S) then + S:= Trim(S); + Log(S); + begin + OldWiX:=EndsWith('}', S); + if (OldWiX = True) then + begin + MsgBox('Warning: an old version of EDMC is installed! Please close EDMC while we remove the old version!', mbInformation, MB_OK); + Uninstall := '/x ' + S; + Exec('MsiExec.exe', Uninstall, '', SW_SHOW, ewWaitUntilTerminated, ResultCode); + end; + end; + end; end; end; - [Registry] ; Create the main registry key under HKCR Root: HKCR; Subkey: "edmc"; Flags: uninsdeletekey @@ -92,3 +113,6 @@ Root: HKCR; Subkey: "edmc\shell\open"; Flags: uninsdeletekey Root: HKCR; Subkey: "edmc\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\EDMarketConnector.exe"" ""%1"""; Flags: uninsdeletekey ; Create the "ddeexec" subkey under the "open" subkey Root: HKCR; Subkey: "edmc\shell\open\ddeexec"; ValueType: string; ValueName: ""; ValueData: "Open(""%1"")"; Flags: uninsdeletekey + +[InstallDelete] +Type: filesandordirs; Name: "{app}/plugins" From 99f46dd01fea65a793093d2f947e3d042bccc2cc Mon Sep 17 00:00:00 2001 From: David Sangrey Date: Fri, 18 Aug 2023 13:21:04 -0400 Subject: [PATCH 2/3] [Minor] Force Clean File Install Every Time --- resources/EDMC_Installer_Config_template.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/EDMC_Installer_Config_template.txt b/resources/EDMC_Installer_Config_template.txt index f873eb2c1..ff0307768 100644 --- a/resources/EDMC_Installer_Config_template.txt +++ b/resources/EDMC_Installer_Config_template.txt @@ -115,4 +115,4 @@ Root: HKCR; Subkey: "edmc\shell\open\command"; ValueType: string; ValueName: ""; Root: HKCR; Subkey: "edmc\shell\open\ddeexec"; ValueType: string; ValueName: ""; ValueData: "Open(""%1"")"; Flags: uninsdeletekey [InstallDelete] -Type: filesandordirs; Name: "{app}/plugins" +Type: filesandordirs; Name: "{app}" From 688cb1b32373b76c444f9b4e859d8b3246d1aaa8 Mon Sep 17 00:00:00 2001 From: David Sangrey Date: Fri, 18 Aug 2023 16:39:55 -0400 Subject: [PATCH 3/3] [Installer] Simplify the PowerShell Search --- resources/EDMC_Installer_Config_template.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/EDMC_Installer_Config_template.txt b/resources/EDMC_Installer_Config_template.txt index ff0307768..254c95ca3 100644 --- a/resources/EDMC_Installer_Config_template.txt +++ b/resources/EDMC_Installer_Config_template.txt @@ -78,7 +78,7 @@ begin begin PowerShellOutputFile := ExpandConstant('{tmp}\PowershellOutput.txt'); // Construct the PowerShell command and capture output to a file - Exec('powershell.exe', '-NoProfile -ExecutionPolicy Bypass -Command "Get-WmiObject -Class Win32_Product | ForEach-Object { $_.Name -like ''*Elite Dangerous Market Connector*'' } | Select-Object -ExpandProperty IdentifyingNumber" | Out-File -Encoding ASCII "' + PowerShellOutputFile + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode); + Exec('powershell.exe', '-NoProfile -ExecutionPolicy Bypass -Command "Get-WmiObject -Class Win32_Product | where Name -eq ''Elite Dangerous Market Connector'' | select-object -expandproperty IdentifyingNumber" | Out-File -Encoding ASCII "' + PowerShellOutputFile + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode); begin if LoadStringFromFile(PowerShellOutputFile, S) then S:= Trim(S);