Brandan

Untitled

Mar 12th, 2014
586
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Script generated by the Inno Setup Script Wizard.
  2. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
  3.  
  4. #define MyAppName "Expansive Civilian Warfare"
  5. #define MyAppVersion "1.0.0"
  6. #define MyAppPublisher "Expansive Civilian Warfare"
  7. #define MyAppURL "http://expansivecivilianwarfare.com/"
  8. #define MyAppExeName "ECW.exe"
  9.  
  10. [Setup]
  11. ; NOTE: The value of AppId uniquely identifies this application.
  12. ; Do not use the same AppId value in installers for other applications.
  13. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
  14. AppId={{E3A60976-1DE1-40E2-9915-02631397DF03}
  15. AppName={#MyAppName}
  16. AppVersion={#MyAppVersion}
  17. ;AppVerName={#MyAppName} {#MyAppVersion}
  18. AppPublisher={#MyAppPublisher}
  19. AppPublisherURL={#MyAppURL}
  20. AppSupportURL={#MyAppURL}
  21. AppUpdatesURL={#MyAppURL}
  22. DefaultDirName={pf}\{#MyAppName}
  23. DefaultGroupName={#MyAppName}
  24. AllowNoIcons=yes
  25. OutputBaseFilename=setup
  26. Compression=lzma
  27. SolidCompression=yes
  28.  
  29. [Languages]
  30. Name: "english"; MessagesFile: "compiler:Default.isl"
  31.  
  32. [Tasks]
  33. Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
  34. Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
  35.  
  36. [Files]
  37. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\ECW.exe"; DestDir: "{app}"; Flags: ignoreversion
  38. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\_MOD_SCRIPTS.DLL"; DestDir: "{app}"; Flags: ignoreversion
  39. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\00000000.256"; DestDir: "{app}"; Flags: ignoreversion
  40. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\00000409.016"; DestDir: "{app}"; Flags: ignoreversion
  41. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\00000409.256"; DestDir: "{app}"; Flags: ignoreversion
  42. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\54251___.TTF"; DestDir: "{app}"; Flags: ignoreversion
  43. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\ARI_____.TTF"; DestDir: "{app}"; Flags: ignoreversion
  44. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\BandTest.dll"; DestDir: "{app}"; Flags: ignoreversion
  45. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\bhs.dll"; DestDir: "{app}"; Flags: ignoreversion
  46. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\binkw32.dll"; DestDir: "{app}"; Flags: ignoreversion
  47. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Config.exe"; DestDir: "{app}"; Flags: ignoreversion
  48. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\d3d8.dll"; DestDir: "{app}"; Flags: ignoreversion
  49. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\d3d9.dll"; DestDir: "{app}"; Flags: ignoreversion
  50. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\d3dx9_32.dll"; DestDir: "{app}"; Flags: ignoreversion
  51. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\d3dx9_42.dll"; DestDir: "{app}"; Flags: ignoreversion
  52. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\DataGridViewPercentageColumn.dll"; DestDir: "{app}"; Flags: ignoreversion
  53. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\drvmgt.dll"; DestDir: "{app}"; Flags: ignoreversion
  54. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Game100.exe"; DestDir: "{app}"; Flags: ignoreversion
  55. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Game1000.exe"; DestDir: "{app}"; Flags: ignoreversion
  56. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Game150.exe"; DestDir: "{app}"; Flags: ignoreversion
  57. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Game200.exe"; DestDir: "{app}"; Flags: ignoreversion
  58. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Game2000.exe"; DestDir: "{app}"; Flags: ignoreversion
  59. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Game300.exe"; DestDir: "{app}"; Flags: ignoreversion
  60. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Game400.exe"; DestDir: "{app}"; Flags: ignoreversion
  61. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Game4000.exe"; DestDir: "{app}"; Flags: ignoreversion
  62. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Game500.exe"; DestDir: "{app}"; Flags: ignoreversion
  63. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Game750.exe"; DestDir: "{app}"; Flags: ignoreversion
  64. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\ICSharpCode.SharpZipLib.dll"; DestDir: "{app}"; Flags: ignoreversion
  65. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\keycfg.exe"; DestDir: "{app}"; Flags: ignoreversion
  66. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Launcher.bmp"; DestDir: "{app}"; Flags: ignoreversion
  67. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Meebey.SmartIrc4net.dll"; DestDir: "{app}"; Flags: ignoreversion
  68. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Mp3dec.asi"; DestDir: "{app}"; Flags: ignoreversion
  69. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Mss32.dll"; DestDir: "{app}"; Flags: ignoreversion
  70. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Mssa3d.m3d"; DestDir: "{app}"; Flags: ignoreversion
  71. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Mssds3dh.m3d"; DestDir: "{app}"; Flags: ignoreversion
  72. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Msseax.m3d"; DestDir: "{app}"; Flags: ignoreversion
  73. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Msseax2.m3d"; DestDir: "{app}"; Flags: ignoreversion
  74. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Mssfast.m3d"; DestDir: "{app}"; Flags: ignoreversion
  75. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Notes.ico"; DestDir: "{app}"; Flags: ignoreversion
  76. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\patchget.dat"; DestDir: "{app}"; Flags: ignoreversion
  77. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\PATCHW32.DLL"; DestDir: "{app}"; Flags: ignoreversion
  78. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Renegade.lcf"; DestDir: "{app}"; Flags: ignoreversion
  79. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\RP2CSP.dll"; DestDir: "{app}"; Flags: ignoreversion
  80. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\scripts.dll"; DestDir: "{app}"; Flags: ignoreversion
  81. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\scripts2.dll"; DestDir: "{app}"; Flags: ignoreversion
  82. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\shaders.dll"; DestDir: "{app}"; Flags: ignoreversion
  83. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\SMAA.fx"; DestDir: "{app}"; Flags: ignoreversion
  84. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\SMAA.h"; DestDir: "{app}"; Flags: ignoreversion
  85. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\TabControlEX.dll"; DestDir: "{app}"; Flags: ignoreversion
  86. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Uninst.loc"; DestDir: "{app}"; Flags: ignoreversion
  87. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Uninst.wsu"; DestDir: "{app}"; Flags: ignoreversion
  88. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Update.bat"; DestDir: "{app}"; Flags: ignoreversion
  89. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\Data\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
  90. Source: "C:\Program Files (x86)\ExpansiveCivilianWarfare\dxwebsetup.exe"; Flags: dontcopy
  91. ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
  92.  
  93. [Icons]
  94. Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
  95. Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
  96. Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
  97.  
  98. [Run]
  99. Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
  100. [Files]
  101. Source: "C:\Users\Brandan\Desktop\scripts\isxdl\isxdl.dll"; Flags: dontcopy
  102.  
  103. [Code]
  104. //replace PAnsiChar with PChar on non-unicode Inno Setup
  105. procedure isxdl_AddFile(URL, Filename: PAnsiChar);
  106. external 'isxdl_AddFile@files:isxdl.dll stdcall';
  107.  
  108. function isxdl_DownloadFiles(hWnd: Integer): Integer;
  109. external 'isxdl_DownloadFiles@files:isxdl.dll stdcall';
  110.  
  111. //replace PAnsiChar with PChar on non-unicode Inno Setup
  112. function isxdl_SetOption(Option, Value: PAnsiChar): Integer;
  113. external 'isxdl_SetOption@files:isxdl.dll stdcall';
  114.  
  115. [Files]
  116. Source: "C:\Users\Brandan\Desktop\scripts\isxdl\german2.ini"; Flags: dontcopy
  117.  
  118. [Code]
  119. type
  120.     TProduct = record
  121.         File: String;
  122.         Title: String;
  123.         Parameters: String;
  124.         InstallClean : boolean;
  125.         MustRebootAfter : boolean;
  126.     end;
  127.  
  128.     InstallResult = (InstallSuccessful, InstallRebootRequired, InstallError);
  129.  
  130. var
  131.     installMemo, downloadMemo, downloadMessage: string;
  132.     products: array of TProduct;
  133.     delayedReboot: boolean;
  134.     DependencyPage: TOutputProgressWizardPage;
  135.  
  136.  
  137. procedure AddProduct(FileName, Parameters, Title, Size, URL: string; InstallClean : boolean; MustRebootAfter : boolean);
  138. var
  139.     path: string;
  140.     i: Integer;
  141. begin
  142.     installMemo := installMemo + '%1' + Title + #13;
  143.  
  144.     path := ExpandConstant('{src}{\}') + CustomMessage('DependenciesDir') + '\' + FileName;
  145.     if not FileExists(path) then begin
  146.         path := ExpandConstant('{tmp}{\}') + FileName;
  147.  
  148.         isxdl_AddFile(URL, path);
  149.  
  150.         downloadMemo := downloadMemo + '%1' + Title + #13;
  151.         downloadMessage := downloadMessage + '  ' + Title + ' (' + Size + ')' + #13;
  152.     end;
  153.  
  154.     i := GetArrayLength(products);
  155.     SetArrayLength(products, i + 1);
  156.     products[i].File := path;
  157.     products[i].Title := Title;
  158.     products[i].Parameters := Parameters;
  159.     products[i].InstallClean := InstallClean;
  160.     products[i].MustRebootAfter := MustRebootAfter;
  161. end;
  162.  
  163. function SmartExec(prod : TProduct; var ResultCode : Integer) : boolean;
  164. begin
  165.     if (LowerCase(Copy(prod.File,Length(prod.File)-2,3)) = 'exe') then begin
  166.         Result := Exec(prod.File, prod.Parameters, '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
  167.     end else begin
  168.         Result := ShellExec('', prod.File, prod.Parameters, '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
  169.     end;
  170. end;
  171.  
  172. function PendingReboot : boolean;
  173. var names: String;
  174. begin
  175.     if (RegQueryMultiStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager', 'PendingFileRenameOperations', names)) then begin
  176.         Result := true;
  177.     end else if ((RegQueryMultiStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager', 'SetupExecute', names)) and (names <> ''))  then begin
  178.         Result := true;
  179.     end else begin
  180.         Result := false;
  181.     end;
  182. end;
  183.  
  184. function InstallProducts: InstallResult;
  185. var
  186.     ResultCode, i, productCount, finishCount: Integer;
  187. begin
  188.     Result := InstallSuccessful;
  189.     productCount := GetArrayLength(products);
  190.  
  191.     if productCount > 0 then begin
  192.         DependencyPage := CreateOutputProgressPage(CustomMessage('depinstall_title'), CustomMessage('depinstall_description'));
  193.         DependencyPage.Show;
  194.  
  195.         for i := 0 to productCount - 1 do begin
  196.             if (products[i].InstallClean and (delayedReboot or PendingReboot())) then begin
  197.                 Result := InstallRebootRequired;
  198.                 break;
  199.             end;
  200.  
  201.             DependencyPage.SetText(FmtMessage(CustomMessage('depinstall_status'), [products[i].Title]), '');
  202.             DependencyPage.SetProgress(i, productCount);
  203.  
  204.             if SmartExec(products[i], ResultCode) then begin
  205.                 //setup executed; ResultCode contains the exit code
  206.                 //MsgBox(products[i].Title + ' install executed. Result Code: ' + IntToStr(ResultCode), mbInformation, MB_OK);
  207.                 if (products[i].MustRebootAfter) then begin
  208.                     //delay reboot after install if we installed the last dependency anyways
  209.                     if (i = productCount - 1) then begin
  210.                         delayedReboot := true;
  211.                     end else begin
  212.                         Result := InstallRebootRequired;
  213.                     end;
  214.                     break;
  215.                 end else if (ResultCode = 0) then begin
  216.                     finishCount := finishCount + 1;
  217.                 end else if (ResultCode = 3010) then begin
  218.                     //ResultCode 3010: A restart is required to complete the installation. This message indicates success.
  219.                     delayedReboot := true;
  220.                     finishCount := finishCount + 1;
  221.                 end else begin
  222.                     Result := InstallError;
  223.                     break;
  224.                 end;
  225.             end else begin
  226.                 //MsgBox(products[i].Title + ' install failed. Result Code: ' + IntToStr(ResultCode), mbInformation, MB_OK);
  227.                 Result := InstallError;
  228.                 break;
  229.             end;
  230.         end;
  231.  
  232.         //only leave not installed products for error message
  233.         for i := 0 to productCount - finishCount - 1 do begin
  234.             products[i] := products[i+finishCount];
  235.         end;
  236.         SetArrayLength(products, productCount - finishCount);
  237.  
  238.         DependencyPage.Hide;
  239.     end;
  240. end;
  241.  
  242. function PrepareToInstall(var NeedsRestart: boolean): String;
  243. var
  244.     i: Integer;
  245.     s: string;
  246. begin
  247.     delayedReboot := false;
  248.  
  249.     case InstallProducts() of
  250.         InstallError: begin
  251.             s := CustomMessage('depinstall_error');
  252.  
  253.             for i := 0 to GetArrayLength(products) - 1 do begin
  254.                 s := s + #13 + '    ' + products[i].Title;
  255.             end;
  256.  
  257.             Result := s;
  258.             end;
  259.         InstallRebootRequired: begin
  260.             Result := products[0].Title;
  261.             NeedsRestart := true;
  262.  
  263.             //write into the registry that the installer needs to be executed again after restart
  264.             RegWriteStringValue(HKEY_CURRENT_USER, 'SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce', 'InstallBootstrap', ExpandConstant('{srcexe}'));
  265.             end;
  266.     end;
  267. end;
  268.  
  269. function NeedRestart : boolean;
  270. begin
  271.     if (delayedReboot) then
  272.         Result := true;
  273. end;
  274.  
  275. function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
  276. var
  277.     s: string;
  278. begin
  279.     if downloadMemo <> '' then
  280.         s := s + CustomMessage('depdownload_memo_title') + ':' + NewLine + FmtMessage(downloadMemo, [Space]) + NewLine;
  281.     if installMemo <> '' then
  282.         s := s + CustomMessage('depinstall_memo_title') + ':' + NewLine + FmtMessage(installMemo, [Space]) + NewLine;
  283.  
  284.     s := s + MemoDirInfo + NewLine + NewLine + MemoGroupInfo
  285.  
  286.     if MemoTasksInfo <> '' then
  287.         s := s + NewLine + NewLine + MemoTasksInfo;
  288.  
  289.     Result := s
  290. end;
  291.  
  292. function NextButtonClick(CurPageID: Integer): boolean;
  293. begin
  294.     Result := true;
  295.  
  296.     if CurPageID = wpReady then begin
  297.         if downloadMemo <> '' then begin
  298.             //change isxdl language only if it is not english because isxdl default language is already english
  299.             if (ActiveLanguage() <> 'en') then begin
  300.                 ExtractTemporaryFile(CustomMessage('isxdl_langfile'));
  301.                 isxdl_SetOption('language', ExpandConstant('{tmp}{\}') + CustomMessage('isxdl_langfile'));
  302.             end;
  303.             //isxdl_SetOption('title', FmtMessage(SetupMessage(msgSetupWindowTitle), [CustomMessage('appname')]));
  304.  
  305.             if SuppressibleMsgBox(FmtMessage(CustomMessage('depdownload_msg'), [downloadMessage]), mbConfirmation, MB_YESNO, IDYES) = IDNO then
  306.                 Result := false
  307.             else if isxdl_DownloadFiles(StrToInt(ExpandConstant('{wizardhwnd}'))) = 0 then
  308.                 Result := false;
  309.         end;
  310.     end;
  311. end;
  312.  
  313. function IsX86: boolean;
  314. begin
  315.     Result := (ProcessorArchitecture = paX86) or (ProcessorArchitecture = paUnknown);
  316. end;
  317.  
  318. function IsX64: boolean;
  319. begin
  320.     Result := Is64BitInstallMode and (ProcessorArchitecture = paX64);
  321. end;
  322.  
  323. function IsIA64: boolean;
  324. begin
  325.     Result := Is64BitInstallMode and (ProcessorArchitecture = paIA64);
  326. end;
  327.  
  328. function GetString(x86, x64, ia64: String): String;
  329. begin
  330.     if IsX64() and (x64 <> '') then begin
  331.         Result := x64;
  332.     end else if IsIA64() and (ia64 <> '') then begin
  333.         Result := ia64;
  334.     end else begin
  335.         Result := x86;
  336.     end;
  337. end;
  338.  
  339. function GetArchitectureString(): String;
  340. begin
  341.     if IsX64() then begin
  342.         Result := '_x64';
  343.     end else if IsIA64() then begin
  344.         Result := '_ia64';
  345.     end else begin
  346.         Result := '';
  347.     end;
  348. end;
  349.  
  350. [Code]
  351. type
  352.     NetFXType = (NetFx10, NetFx11, NetFx20, NetFx30, NetFx35, NetFx40Client, NetFx40Full);
  353.  
  354. const
  355.     netfx11plus_reg = 'Software\Microsoft\NET Framework Setup\NDP\';
  356.  
  357. function netfxinstalled(version: NetFXType; lcid: string): boolean;
  358. var
  359.     regVersion: cardinal;
  360.     regVersionString: string;
  361. begin
  362.     if (lcid <> '') then
  363.         lcid := '\' + lcid;
  364.  
  365.     if (version = NetFx10) then begin
  366.         RegQueryStringValue(HKLM, 'Software\Microsoft\.NETFramework\Policy\v1.0\3705', 'Install', regVersionString);
  367.         Result := regVersionString <> '';
  368.     end else begin
  369.         case version of
  370.             NetFx11:
  371.                 RegQueryDWordValue(HKLM, netfx11plus_reg + 'v1.1.4322' + lcid, 'Install', regVersion);
  372.             NetFx20:
  373.                 RegQueryDWordValue(HKLM, netfx11plus_reg + 'v2.0.50727' + lcid, 'Install', regVersion);
  374.             NetFx30:
  375.                 RegQueryDWordValue(HKLM, netfx11plus_reg + 'v3.0\Setup' + lcid, 'InstallSuccess', regVersion);
  376.             NetFx35:
  377.                 RegQueryDWordValue(HKLM, netfx11plus_reg + 'v3.5' + lcid, 'Install', regVersion);
  378.             NetFx40Client:
  379.                 RegQueryDWordValue(HKLM, netfx11plus_reg + 'v4\Client' + lcid, 'Install', regVersion);
  380.             NetFx40Full:
  381.                 RegQueryDWordValue(HKLM, netfx11plus_reg + 'v4\Full' + lcid, 'Install', regVersion);
  382.         end;
  383.         Result := (regVersion <> 0);
  384.     end;
  385. end;
  386.  
  387. function netfxspversion(version: NetFXType; lcid: string): integer;
  388. var
  389.     regVersion: cardinal;
  390. begin
  391.     if (lcid <> '') then
  392.         lcid := '\' + lcid;
  393.  
  394.     case version of
  395.         NetFx10:
  396.             //not supported
  397.             regVersion := -1;
  398.         NetFx11:
  399.             if (not RegQueryDWordValue(HKLM, netfx11plus_reg + 'v1.1.4322' + lcid, 'SP', regVersion)) then
  400.                 regVersion := -1;
  401.         NetFx20:
  402.             if (not RegQueryDWordValue(HKLM, netfx11plus_reg + 'v2.0.50727' + lcid, 'SP', regVersion)) then
  403.                 regVersion := -1;
  404.         NetFx30:
  405.             if (not RegQueryDWordValue(HKLM, netfx11plus_reg + 'v3.0' + lcid, 'SP', regVersion)) then
  406.                 regVersion := -1;
  407.         NetFx35:
  408.             if (not RegQueryDWordValue(HKLM, netfx11plus_reg + 'v3.5' + lcid, 'SP', regVersion)) then
  409.                 regVersion := -1;
  410.         NetFx40Client:
  411.             if (not RegQueryDWordValue(HKLM, netfx11plus_reg + 'v4\Client' + lcid, 'Servicing', regVersion)) then
  412.                 regVersion := -1;
  413.         NetFx40Full:
  414.             if (not RegQueryDWordValue(HKLM, netfx11plus_reg + 'v4\Full' + lcid, 'Servicing', regVersion)) then
  415.                 regVersion := -1;
  416.     end;
  417.     Result := regVersion;
  418. end;
  419.  
  420. [Code]
  421. const
  422.     dotnetfx40full_url = 'http://download.microsoft.com/download/1/B/E/1BE39E79-7E39-46A3-96FF-047F95396215/dotNetFx40_Full_setup.exe';
  423.  
  424. procedure dotnetfx40full();
  425. begin
  426.     if (not netfxinstalled(NetFx40Full, '')) then
  427.         AddProduct('dotNetFx40_Full_setup.exe',
  428.             CustomMessage('dotnetfx40full_lcid') + '/q /passive /norestart',
  429.             CustomMessage('dotnetfx40full_title'),
  430.             CustomMessage('dotnetfx40full_size'),
  431.             dotnetfx40full_url,
  432.             false, false);
  433. end;
  434.  
  435. procedure DecodeVersion( verstr: String; var verint: array of Integer );
  436. var
  437.   i,p: Integer; s: string;
  438.  
  439. begin
  440.   verint := [0,0,0,0];
  441.   i := 0;
  442.  
  443.   while ( (Length(verstr) > 0) and (i < 4) ) do
  444.   begin
  445.      p := pos('.', verstr);
  446.      if p > 0 then
  447.      begin
  448.       if p = 1 then s:= '0' else s:= Copy( verstr, 1, p - 1 );
  449.        verint[i] := StrToInt(s);
  450.        i := i + 1;
  451.        verstr := Copy( verstr, p+1, Length(verstr) );
  452.      end
  453.      else
  454.      begin
  455.        verint[i] := StrToInt( verstr );
  456.        verstr := '';
  457.      end;
  458.   end;
  459. end;
  460.  
  461. function CompareVersion( ver1, ver2: String ) : Integer;
  462. var
  463.   verint1, verint2: array of Integer;
  464.   i: integer;
  465.  
  466. begin
  467.   SetArrayLength( verint1, 4 );
  468.   DecodeVersion( ver1, verint1 );
  469.  
  470.   SetArrayLength( verint2, 4 );
  471.   DecodeVersion( ver2, verint2 );
  472.  
  473.   Result := 0; i := 0;
  474.   while ( (Result = 0) and ( i < 4 ) ) do
  475.   begin
  476.      if verint1[i] > verint2[i] then
  477.        Result := 1
  478.      else
  479.       if verint1[i] < verint2[i] then
  480.          Result := -1
  481.        else
  482.          Result := 0;
  483.  
  484.      i := i + 1;
  485.   end;
  486. end;
  487.  
  488. function GetDirectXVersion(): String;
  489. var
  490.   sVersion:  String;
  491.  
  492. begin
  493.   sVersion := '';
  494.   RegQueryStringValue( HKLM, 'SOFTWARE\Microsoft\DirectX', 'Version', sVersion );
  495.   Result := sVersion;
  496. end;
  497.  
  498.  
  499.  
  500. function InitializeSetup(): Boolean;
  501. var
  502.   ResultCode: Integer;
  503. begin
  504.   if CompareVersion( GetDirectXVersion(), '4.9.0.904') < 0 then
  505.   begin
  506.     Result := MsgBox('DirectX 9.0.904 or higher is needed but it has not been found. Do you wish to continue with the installation?',
  507.         mbConfirmation, MB_YESNO) = idYes;
  508.     if Result = False then begin
  509.       MsgBox('Please upgrade your DirectX Version to at least least 9.0.904. (DirectX 9,0c aug 2009)', mbInformation, MB_OK);
  510.     end
  511.     else begin
  512.         ExtractTemporaryFile('dxwebsetup.exe');
  513.  
  514.       // Launch Notepad and wait for it to terminate
  515.         if Exec(ExpandConstant('{tmp}\dxwebsetup.exe'), '', '', SW_SHOW,
  516.            ewWaitUntilTerminated, ResultCode) then  
  517.         begin
  518.           // handle success if necessary; ResultCode contains the exit code
  519.         end
  520.         else begin
  521.           // handle failure if necessary; ResultCode contains the error code
  522.         end;
  523.  
  524.      end
  525.   end
  526.   else
  527.     Result := true;
  528. end;
RAW Paste Data