DittoSetup_arm64.iss 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. #define MyAppName "Ditto"
  2. #define MyAppVersion GetFileVersion("..\ARM64\Release\Ditto.exe")
  3. #define MyAppVerName MyAppName + " " + MyAppVersion
  4. #define bit64
  5. [Setup]
  6. AppName={#MyAppName}
  7. AppVersion={#MyAppVersion}
  8. AppVerName={#MyAppVerName}
  9. OutputBaseFilename=DittoSetup_{#MyAppVersion}
  10. AppPublisher=Scott Brogden
  11. AppPublisherURL=ditto-cp.sourceforge.net
  12. AppSupportURL=ditto-cp.sourceforge.net
  13. AppUpdatesURL=ditto-cp.sourceforge.net
  14. #ifdef bit64
  15. ArchitecturesInstallIn64BitMode=arm64
  16. ArchitecturesAllowed=arm64
  17. #endif
  18. DefaultDirName={pf}\{#MyAppName}
  19. DefaultGroupName={#MyAppName}
  20. ;UsePreviousTasks=no
  21. ;DisableDirPage=yes
  22. DisableProgramGroupPage=yes
  23. DisableReadyPage=yes
  24. DirExistsWarning=no
  25. UninstallLogMode=overwrite
  26. ChangesAssociations=yes
  27. CloseApplications=yes
  28. ;Windows 10 forward
  29. MinVersion=10.0.0000
  30. SetupLogging=yes
  31. [Languages]
  32. Name: English; MessagesFile: compiler:Default.isl
  33. ;Inno Setup Official translations
  34. Name: Czech; MessagesFile: compiler:Languages\Czech.isl
  35. Name: Danish; MessagesFile: compiler:Languages\Danish.isl
  36. Name: Dutch; MessagesFile: compiler:Languages\Dutch.isl
  37. Name: Finnish; MessagesFile: compiler:Languages\Finnish.isl
  38. Name: French; MessagesFile: compiler:Languages\French.isl
  39. Name: German; MessagesFile: compiler:Languages\German.isl
  40. Name: Hebrew; MessagesFile: compiler:Languages\Hebrew.isl
  41. Name: Italiano; MessagesFile: compiler:Languages\Italian.isl
  42. Name: Japanese; MessagesFile: compiler:Languages\Japanese.isl
  43. Name: Polish; MessagesFile: compiler:Languages\Polish.isl
  44. Name: Portuguese_Brazil; MessagesFile: compiler:Languages\BrazilianPortuguese.isl
  45. Name: Portuguese_Portugal; MessagesFile: compiler:Languages\Portuguese.isl
  46. Name: Russian; MessagesFile: compiler:Languages\Russian.isl
  47. Name: Slovak; MessagesFile: compiler:Languages\Slovak.isl
  48. Name: Slovenian; MessagesFile: compiler:Languages\Slovenian.isl
  49. Name: Spanish; MessagesFile: compiler:Languages\Spanish.isl
  50. Name: Turkish; MessagesFile: compiler:Languages\Turkish.isl
  51. Name: Ukrainian; MessagesFile: compiler:Languages\Ukrainian.isl
  52. ;Inno Setup Unofficial translations
  53. Name: Simplified_Chinese; MessagesFile: ChineseSimplified.isl
  54. Name: Traditional_Chinese; MessagesFile: ChineseTraditional.isl
  55. Name: Croatian; MessagesFile: Croatian.isl
  56. Name: Greek; MessagesFile: Greek.isl
  57. Name: Hungarian; MessagesFile: Hungarian.isl
  58. Name: Korean; MessagesFile: Korean.isl
  59. Name: Romanian; MessagesFile: Romanian.isl
  60. Name: Swedish; MessagesFile: Swedish.isl
  61. [Tasks]
  62. Name: RunAtStartup; Description: Run Ditto on windows startup
  63. Name: AddFireWallException; Description: Add Windows Firewall exception for Ditto on port 23443; Flags: unchecked
  64. [Files]
  65. #ifdef bit64
  66. Source: ..\ARM64\Release\Ditto.exe; DestDir: {app}; DestName: Ditto.exe; Check: InstallARM64; Flags: ignoreversion; AfterInstall: AddProgramToFirewall(ExpandConstant('{app}\Ditto.exe'), 'Ditto_FromInstaller_64');
  67. Source: ..\ARM64\Release\ICU_Loader.dll; DestDir: {app}; Check: InstallARM64; Flags: ignoreversion
  68. Source: ..\ARM64\Release\Addins\DittoUtil.dll; DestDir: {app}\Addins; Check: InstallARM64; Flags: ignoreversion
  69. ; "C:\Windows\sysnative" will be converted to "C:\Windows\System32"
  70. ; System32 stores a 64-bit DLL on x64 system
  71. Source: C:\Windows\sysnative\vcruntime140.dll; DestDir: {app}; Flags: ignoreversion
  72. Source: C:\Windows\sysnative\vcruntime140_1.dll; DestDir: {app}; Flags: ignoreversion
  73. Source: C:\Windows\sysnative\msvcp140.dll; DestDir: {app}; Flags: ignoreversion
  74. Source: C:\Windows\sysnative\mfc140u.dll; DestDir: {app}; Flags: ignoreversion
  75. #endif
  76. #ifndef bit64
  77. ; Source: ..\Release\Ditto.exe; DestDir: {app}; DestName: Ditto.exe; Flags: ignoreversion; AfterInstall: AddProgramToFirewall(ExpandConstant('{app}\Ditto.exe'), 'Ditto_FromInstaller_32');
  78. ; Source: ..\Release\ICU_Loader.dll; DestDir: {app}; Flags: ignoreversion
  79. ; Source: ..\Release\Addins\DittoUtil.dll; DestDir: {app}\Addins; Flags: ignoreversion
  80. ; Source: C:\Windows\SysWOW64\vcruntime140.dll; DestDir: {app}; Flags: ignoreversion
  81. ; Source: C:\Windows\SysWOW64\msvcp140.dll; DestDir: {app}; Flags: ignoreversion
  82. ; Source: C:\Windows\SysWOW64\mfc140u.dll; DestDir: {app}; Flags: ignoreversion
  83. #endif
  84. Source: ..\Debug\Language\*; DestDir: {app}\Language; BeforeInstall: BeforeLanguageInstall()
  85. Source: ..\Debug\Themes\*; DestDir: {app}\Themes
  86. [Icons]
  87. Name: {group}\Ditto; Filename: {app}\Ditto.exe
  88. Name: {group}\Uninstall; Filename: {uninstallexe}
  89. [Run]
  90. Filename: {app}\Ditto.exe; Description: Launch Ditto; Flags: nowait postinstall
  91. Filename: https://sourceforge.net/p/ditto-cp/wiki/Getting%20Started; Description: View Help; Flags: nowait postinstall skipifsilent shellexec unchecked
  92. Filename: https://ditto-cp.sourceforge.io/changeHistory.php; Description: View Change History; Flags: nowait postinstall skipifsilent shellexec unchecked
  93. [Registry]
  94. Root: HKCU; Subkey: Software\Ditto; Flags: uninsdeletekey
  95. Root: HKCU; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\Run; ValueType: string; ValueName: Ditto; flags: uninsdeletevalue; ValueData: {app}\Ditto.exe; Tasks: RunAtStartup
  96. Root: HKCU; Subkey: Software\Ditto; ValueType: dword; ValueName: SetFocus_iexplore.exe; ValueData: 00000001
  97. Root: HKCU; Subkey: Software\Ditto; ValueType: string; ValueName: LanguageFile; ValueData: {language}
  98. Root: HKCU; Subkey: Software\Ditto\PasteStrings; ValueType: string; ValueName: gvim.exe; ValueData: """{{PLUS}gP"
  99. Root: HKCU; Subkey: Software\Ditto\CopyStrings; ValueType: string; ValueName: gvim.exe; ValueData: """{{PLUS}y"
  100. Root: HKCU; Subkey: Software\Ditto\CutStrings; ValueType: string; ValueName: gvim.exe; ValueData: """{{PLUS}x"
  101. Root: HKCU; Subkey: Software\Ditto\PasteStrings; ValueType: string; ValueName: cmd.exe; OnlyBelowVersion: 10; ValueData: % {{Delay100}ep
  102. Root: HKCU; Subkey: Software\Ditto\CopyStrings; ValueType: string; ValueName: cmd.exe; OnlyBelowVersion: 10; ValueData: % {{Delay100}ey
  103. Root: HKCU; Subkey: Software\Ditto\PasteStrings; ValueName: cmd.exe; MinVersion: 10; Flags: deletevalue
  104. Root: HKCU; Subkey: Software\Ditto\CopyStrings; ValueName: cmd.exe; MinVersion: 10; Flags: deletevalue
  105. ;associate .dto with Ditto
  106. Root: HKCR; Subkey: .dto; ValueType: string; ValueName: ; ValueData: Ditto; Flags: uninsdeletevalue
  107. Root: HKCR; Subkey: Ditto; ValueType: string; ValueName: ; ValueData: Ditto; Flags: uninsdeletekey
  108. Root: HKCR; Subkey: Ditto\DefaultIcon; ValueType: string; ValueName: ; ValueData: {app}\Ditto.exe,0
  109. Root: HKCR; Subkey: Ditto\shell\open\command; ValueType: string; ValueName: ; ValueData: """{app}\Ditto.exe"" ""%1"""
  110. [Code]
  111. procedure BeforeLanguageInstall();
  112. var
  113. sDir: String;
  114. begin
  115. end;
  116. procedure CleanupOldFiles();
  117. var
  118. sDir: String;
  119. begin
  120. sDir := ExpandConstant('{app}');
  121. DeleteFile(sDir+'\mfc100u.dll')
  122. DeleteFile(sDir+'\mfcm100u.dll')
  123. DeleteFile(sDir+'\msvcp100.dll')
  124. DeleteFile(sDir+'\msvcr100.dll')
  125. DeleteFile(sDir+'\iculx55.dll')
  126. DeleteFile(sDir+'\icule55.dll')
  127. DeleteFile(sDir+'\icuuc55.dll')
  128. DeleteFile(sDir+'\icutu55.dll')
  129. DeleteFile(sDir+'\icuio55.dll')
  130. DeleteFile(sDir+'\icuin55.dll')
  131. DeleteFile(sDir+'\icudt55.dll')
  132. //moved to use the windows included dll
  133. DeleteFile(sDir+'\icuuc58.dll')
  134. DeleteFile(sDir+'\icuin58.dll')
  135. DeleteFile(sDir+'\icutu58.dll')
  136. DeleteFile(sDir+'\icuio58.dll')
  137. DeleteFile(sDir+'\icudt58.dll')
  138. DelTree(sDir+'\Help', TRUE, TRUE, TRUE)
  139. end;
  140. procedure RegisterForCrashDump(theApp : String);
  141. var
  142. theExe : String;
  143. begin
  144. theExe := theApp + '.exe';
  145. if IsWin64() then
  146. begin
  147. if RegValueExists(HKLM64, 'Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\' + theExe, 'DumpFolder') = false then
  148. RegWriteStringValue(HKLM64, 'Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\' + theExe, 'DumpFolder', ExpandConstant('{userappdata}') + '\Ditto\Dumps');
  149. if RegValueExists(HKLM64, 'Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\' + theExe, 'DumpType') = false then
  150. RegWriteDWordValue(HKLM64, 'Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\' + theExe, 'DumpType', 2);
  151. if RegValueExists(HKLM64, 'Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\' + theExe, 'DumpCount') = false then
  152. RegWriteDWordValue(HKLM64, 'Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\' + theExe, 'DumpCount', 3);
  153. end
  154. else
  155. begin
  156. if RegValueExists(HKEY_LOCAL_MACHINE, 'Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\' + theExe, 'DumpFolder') = false then
  157. RegWriteStringValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\' + theExe, 'DumpFolder', ExpandConstant('{userappdata}') + '\Ditto\Dumps');
  158. if RegValueExists(HKEY_LOCAL_MACHINE, 'Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\' + theExe, 'DumpType') = false then
  159. RegWriteDWordValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\' + theExe, 'DumpType', 2);
  160. if RegValueExists(HKEY_LOCAL_MACHINE, 'Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\' + theExe, 'DumpCount') = false then
  161. RegWriteDWordValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\' + theExe, 'DumpCount', 3);
  162. end;
  163. end;
  164. function IsVC2017CRuntimeInstalled(): Boolean;
  165. var
  166. Installed: Boolean;
  167. IsInstalled: Cardinal;
  168. begin
  169. Installed := false
  170. IsInstalled := 0;
  171. #ifdef bit64
  172. if RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64', 'Installed', IsInstalled) then
  173. begin
  174. if (IsInstalled = 1) then
  175. begin
  176. Installed := true;
  177. end;
  178. end;
  179. //double check the HKLM64 key
  180. if (IsInstalled <> 1) and IsWin64() then
  181. begin
  182. if RegQueryDWordValue(HKLM64, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64', 'Installed', IsInstalled) then
  183. begin
  184. if (IsInstalled = 1) then
  185. begin
  186. Installed := true;
  187. end;
  188. end;
  189. end;
  190. #endif
  191. #ifndef bit64
  192. if RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86', 'Installed', IsInstalled) then
  193. begin
  194. if (IsInstalled = 1) then
  195. begin
  196. Installed := true;
  197. end;
  198. end;
  199. //double check the HKLM64 key
  200. if (IsInstalled <> 1) and IsWin64() then
  201. begin
  202. if RegQueryDWordValue(HKLM64, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86', 'Installed', IsInstalled) then
  203. begin
  204. if (IsInstalled = 1) then
  205. begin
  206. Installed := true;
  207. end;
  208. end;
  209. end;
  210. #endif
  211. Result := Installed;
  212. end;
  213. procedure CheckForPreReqs();
  214. var
  215. nReturnCode: Integer;
  216. begin
  217. end;
  218. procedure CurStepChanged(CurStep: TSetupStep);
  219. var
  220. ProgressPage: TOutputProgressWizardPage;
  221. ErrorCode : Integer;
  222. AbortNeeded: Boolean;
  223. begin
  224. AbortNeeded := false;
  225. case CurStep of
  226. ssInstall:
  227. begin
  228. CheckForPreReqs();
  229. end;
  230. ssPostInstall:
  231. begin
  232. end;
  233. ssDone:
  234. begin
  235. RegisterForCrashDump('Ditto')
  236. CleanupOldFiles()
  237. end;
  238. end;
  239. end;
  240. function RuleExistsInFirewall(RuleName : String) : Boolean;
  241. var
  242. ErrorCode : Integer;
  243. begin
  244. Exec('>', 'netsh advfirewall firewall show rule name="' + RuleName + '"', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
  245. if ErrorCode = 0 then
  246. Result := True
  247. else
  248. Result := False;
  249. end;
  250. procedure AddProgramToFirewall(ProgramName : String; RuleName : String);
  251. var
  252. ErrorCode : Integer;
  253. Success : Boolean;
  254. WindowsVersion : TWindowsVersion;
  255. begin
  256. if IsTaskSelected('AddFireWallException') then
  257. begin
  258. GetWindowsVersionEx(WindowsVersion);
  259. if (WindowsVersion.Major < 6) then
  260. begin
  261. Success := Exec('>', 'netsh firewall add allowedprogram "' + ProgramName + '" "' + RuleName + '" ENABLE ALL', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
  262. end
  263. else
  264. begin
  265. if (not RuleExistsInFirewall(RuleName)) then
  266. begin
  267. Success := Exec('>', 'netsh advfirewall firewall add rule name="' + RuleName + '" dir=in action=allow protocol=TCP localport=23443 program="' + ProgramName + '" enable=yes', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
  268. Success := Exec('>', 'netsh advfirewall firewall add rule name="' + RuleName + '" dir=out action=allow protocol=TCP localport=23443 program="' + ProgramName + '" enable=yes', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
  269. end
  270. end;
  271. if not Success then
  272. Log('Error - Unable to add ' + RuleName + ' to List of Windows firewall exceptions. ErrorCode: ' + IntToStr(ErrorCode))
  273. else
  274. Log(RuleName + ' successfully added to list of Windows firewall exceptions. ErrorCode: ' + IntToStr(ErrorCode))
  275. end
  276. end;
  277. function InstallARM64: Boolean;
  278. begin
  279. Result := Is64BitInstallMode and (ProcessorArchitecture = paARM64);
  280. end;
  281. [CustomMessages]
  282. VCRuntimeInstallFailed=VCRuntime prerequisite install failed.