Dpack get data Node : V10
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

165 lignes
5.3 KiB

  1. ; Script generated by the Inno Setup Script Wizard.
  2. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
  3. #define MyAppName "DpackGetData"
  4. #define MyAppVersion "1.2"
  5. #define MyAppPublisher "Thamrin Brothers"
  6. #define MyAppURL "http://www.thamrin.co.id"
  7. [Setup]
  8. ; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
  9. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
  10. AppId={{1141F88D-8868-41E0-A87E-87DF6803E7C4}
  11. AppName={#MyAppName}
  12. AppVersion={#MyAppVersion}
  13. ;AppVerName={#MyAppName} {#MyAppVersion}
  14. AppPublisher={#MyAppPublisher}
  15. AppPublisherURL={#MyAppURL}
  16. AppSupportURL={#MyAppURL}
  17. AppUpdatesURL={#MyAppURL}
  18. DefaultDirName={userappdata}\DPACKGetData
  19. DisableDirPage=yes
  20. DefaultGroupName={#MyAppName}
  21. DisableProgramGroupPage=yes
  22. ; Uncomment the following line to run in non administrative install mode (install for current user only.)
  23. ;PrivilegesRequired=lowest
  24. OutputBaseFilename=DpackGetDatax64
  25. SetupIconFile=D:\node-data\Installer For 64 Bit Application\setupicon.ico
  26. UninstallDisplayIcon=D:\node-data\Installer For 64 Bit Application\setupicon.ico
  27. Compression=lzma
  28. SolidCompression=yes
  29. WizardStyle=modern
  30. PrivilegesRequired=admin
  31. CloseApplications=force
  32. [Languages]
  33. Name: "english"; MessagesFile: "compiler:Default.isl"
  34. [Files]
  35. Source: "D:\node-data\Installer For 64 Bit Application\node-v10.16.0-x64.msi"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall
  36. Source: "D:\node-data\Installer For 64 Bit Application\sachet-sugar_icon-icons.com_61149.ico"; DestDir: "{app}"; Flags: ignoreversion
  37. Source: "D:\node-data\Installer For 64 Bit Application\setupicon.ico"; DestDir: "{app}"; Flags: ignoreversion
  38. Source: "D:\node-data\Installer For 64 Bit Application\vcredist_x64.exe"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall
  39. Source: "D:\node-data\64bit\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
  40. Source: "D:\node-data\Installer For 64 Bit Application\instantclient_12_2\*"; DestDir: "{app}\instant12.2_client"; Flags: ignoreversion recursesubdirs createallsubdirs
  41. [Run]
  42. Filename: "msiexec.exe"; Parameters: "/i ""{app}\node-v10.16.0-x64.msi""/quiet"
  43. Filename: "{app}\vcredist_x64.exe"; Parameters: "/q /norestart /q:a /c:""""VCREDI~3.EXE /q:a /c:""""""""msiexec /i vcredist.msi /qn"""""""" """""""; Flags: hidewizard
  44. Filename: "{app}\install.bat"; Flags: postinstall runascurrentuser; BeforeInstall: RefreshEnvironment
  45. [Registry]
  46. Root: "HKLM32"; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\instant12.2_client";Check: NeedsAddPath('{app}\instant12.2_client')
  47. [UninstallRun]
  48. Filename: "{app}\uninstall.bat"; Flags: shellexec waituntilterminated;
  49. [Icons]
  50. Name: "{group}\icon"; Filename: "{app}\setupicon.ico"; IconFilename: "{app}\setupicon.ico"; IconIndex: 0
  51. [Code]
  52. function NeedsAddPath(Param: string): boolean;
  53. var
  54. OrigPath: string;
  55. begin
  56. if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
  57. 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
  58. 'Path', OrigPath)
  59. then begin
  60. Result := True;
  61. exit;
  62. end;
  63. { look for the path with leading and trailing semicolon }
  64. { Pos() returns 0 if not found }
  65. Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
  66. end;
  67. const
  68. SMTO_ABORTIFHUNG = 2;
  69. WM_WININICHANGE = $001A;
  70. WM_SETTINGCHANGE = WM_WININICHANGE;
  71. type
  72. WPARAM = UINT_PTR;
  73. LPARAM = INT_PTR;
  74. LRESULT = INT_PTR;
  75. function SendTextMessageTimeout(hWnd: HWND; Msg: UINT;
  76. wParam: WPARAM; lParam: PAnsiChar; fuFlags: UINT;
  77. uTimeout: UINT; out lpdwResult: DWORD): LRESULT;
  78. external 'SendMessageTimeoutA@user32.dll stdcall';
  79. procedure RefreshEnvironment;
  80. var
  81. S: AnsiString;
  82. MsgResult: DWORD;
  83. begin
  84. S := 'Environment';
  85. SendTextMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0,
  86. PAnsiChar(S), SMTO_ABORTIFHUNG, 5000, MsgResult);
  87. end;
  88. const
  89. EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
  90. procedure RemovePath(Path: string);
  91. var
  92. Paths: string;
  93. P: Integer;
  94. begin
  95. if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then
  96. begin
  97. Log('PATH not found');
  98. end
  99. else
  100. begin
  101. Log(Format('PATH is [%s]', [Paths]));
  102. P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';');
  103. if P = 0 then
  104. begin
  105. Log(Format('Path [%s] not found in PATH', [Path]));
  106. end
  107. else
  108. begin
  109. if P > 1 then P := P - 1;
  110. Delete(Paths, P, Length(Path) + 1);
  111. Log(Format('Path [%s] removed from PATH => [%s]', [Path, Paths]));
  112. if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then
  113. begin
  114. Log('PATH written');
  115. end
  116. else
  117. begin
  118. Log('Error writing PATH');
  119. end;
  120. end;
  121. end;
  122. end;
  123. procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
  124. begin
  125. if CurUninstallStep = usUninstall then
  126. begin
  127. RemovePath(ExpandConstant('{app}\instant12.2_client'));
  128. end;
  129. end;
  130. procedure CurStepChanged(CurStep: TSetupStep);
  131. var
  132. ResultCode: Integer;
  133. wmicommand: string;
  134. ErrorCode: Integer;
  135. begin
  136. // before installing any file
  137. if CurStep = ssInstall then
  138. begin
  139. ShellExec('', ExpandConstant('{app}\uninstall.bat'),
  140. '', '', SW_SHOW, ewNoWait, ErrorCode)
  141. end;
  142. end;