Add UnPacking extra installer code

This commit is contained in:
DSR! 2023-03-09 14:28:18 -03:00
parent 3ec2a9399e
commit fb977f1978
5 changed files with 248 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -0,0 +1,70 @@
[Code]
procedure EnvAddPath(Path: string);
var
Paths: string;
begin
{ Retrieve current path (use empty string if entry not exists) }
if not RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Paths) then
Paths := '';
{ Skip if string already found in path }
if Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';') > 0 then
exit;
{ App string to the end of the path variable }
Paths := Paths + ';'+ Path //+';'
{ Overwrite (or create if missing) path environment variable }
if RegWriteStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Paths) then
Log(Format('The [%s] added to PATH: [%s]', [Path, Paths]))
else
Log(Format('Error while adding the [%s] to PATH: [%s]', [Path, Paths]));
end;
procedure EnvRemovePath(Path: string);
var
Paths: string;
P: Integer;
begin
{ Skip if registry entry not exists }
if not RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Paths) then
exit;
{ Skip if string not found in path }
P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';');
if P = 0 then
exit;
{ Update path variable }
Delete(Paths, P - 1, Length(Path) + 1);
{ Overwrite path environment variable }
if RegWriteStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Paths) then
Log(Format('The [%s] removed from PATH: [%s]', [Path, Paths]))
else
Log(Format('Error while removing the [%s] from PATH: [%s]', [Path, Paths]));
end;
{
;;;;; AUTOGENERATED!
;;;;;;;;;;;;;;;;;;;;;;;;;
}
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
if WizardIsComponentSelected('unpacking\novmp') then EnvAddPath(ExpandConstant('{#MyAppToolsFolder}') + '\UnPacking\NoVmp');
if WizardIsComponentSelected('unpacking\vmunprotect') then EnvAddPath(ExpandConstant('{#MyAppToolsFolder}') + '\UnPacking\VMUnprotect');
if WizardIsComponentSelected('unpacking\vmunprotectdumper') then EnvAddPath(ExpandConstant('{#MyAppToolsFolder}') + '\UnPacking\VMUnprotectDumper');
end
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usPostUninstall then
begin
EnvRemovePath(ExpandConstant('{#MyAppToolsFolder}') + '\UnPacking\NoVmp');
EnvRemovePath(ExpandConstant('{#MyAppToolsFolder}') + '\UnPacking\VMUnprotect');
EnvRemovePath(ExpandConstant('{#MyAppToolsFolder}') + '\UnPacking\VMUnprotectDumper');
end
end;

View File

@ -0,0 +1,51 @@
; Magicmida
[Components]
Name: "unpacking\magicmida"; Description: "Magicmida"; Types: full;
[Files]
Source: "{#MySrcDir}\toolkit\UnPacking\Magicmida\*"; DestDir: "{#MyAppToolsFolder}\UnPacking\Magicmida"; Components: "unpacking\magicmida"; Flags: ignoreversion recursesubdirs createallsubdirs;
[Icons]
Name: "{group}\Magicmida"; Filename: "{#MyAppToolsFolder}\UnPacking\Magicmida\Magicmida.exe"; WorkingDir: "{#MyAppToolsFolder}\UnPacking\Magicmida"; Components: "unpacking\magicmida";
Name: "{#MyAppBinsFolder}\sendto\sendto\UnPacking\Magicmida"; Filename: "{#MyAppToolsFolder}\UnPacking\Magicmida\Magicmida.exe"; WorkingDir: "{#MyAppToolsFolder}\UnPacking\Magicmida"; Components: "unpacking\magicmida";
; NoVmp
[Components]
Name: "unpacking\novmp"; Description: "NoVmp"; Types: full;
[Files]
Source: "{#MySrcDir}\toolkit\UnPacking\NoVmp\*"; DestDir: "{#MyAppToolsFolder}\UnPacking\NoVmp"; Components: "unpacking\novmp"; Flags: ignoreversion recursesubdirs createallsubdirs;
[Icons]
Name: "{group}\NoVmp x64"; Filename: "{sys}\cmd.exe"; WorkingDir: "{#MyAppToolsFolder}\UnPacking\NoVmp"; Components: "unpacking\novmp"; Parameters: "/K ""{#MyAppToolsFolder}\UnPacking\NoVmp\NoVmp.exe"""; IconFilename: "{#MyAppToolsFolder}\UnPacking\NoVmp\NoVmp.exe"; Check: Is64BitInstallMode;
Name: "{#MyAppBinsFolder}\sendto\sendto\UnPacking\NoVmp x64"; Filename: "{sys}\cmd.exe"; WorkingDir: "{#MyAppToolsFolder}\UnPacking\NoVmp"; Components: "unpacking\novmp"; Parameters: "/K ""{#MyAppToolsFolder}\UnPacking\NoVmp\NoVmp.exe"""; IconFilename: "{#MyAppToolsFolder}\UnPacking\NoVmp\NoVmp.exe"; Check: Is64BitInstallMode;
; VMUnprotect
[Components]
Name: "unpacking\vmunprotect"; Description: "VMUnprotect"; Types: full;
[Files]
Source: "{#MySrcDir}\toolkit\UnPacking\VMUnprotect\*"; DestDir: "{#MyAppToolsFolder}\UnPacking\VMUnprotect"; Components: "unpacking\vmunprotect"; Flags: ignoreversion recursesubdirs createallsubdirs;
[Icons]
Name: "{group}\VMUnprotect"; Filename: "{sys}\cmd.exe"; WorkingDir: "{#MyAppToolsFolder}\UnPacking\VMUnprotect"; Components: "unpacking\vmunprotect"; Parameters: "/K ""{#MyAppToolsFolder}\UnPacking\VMUnprotect\VMUnprotect.exe"""; IconFilename: "{#MyAppToolsFolder}\UnPacking\VMUnprotect\VMUnprotect.exe";
Name: "{#MyAppBinsFolder}\sendto\sendto\UnPacking\VMUnprotect"; Filename: "{sys}\cmd.exe"; WorkingDir: "{#MyAppToolsFolder}\UnPacking\VMUnprotect"; Components: "unpacking\vmunprotect"; Parameters: "/K ""{#MyAppToolsFolder}\UnPacking\VMUnprotect\VMUnprotect.exe"""; IconFilename: "{#MyAppToolsFolder}\UnPacking\VMUnprotect\VMUnprotect.exe";
; VMUnprotectDumper
[Components]
Name: "unpacking\vmunprotectdumper"; Description: "VMUnprotectDumper"; Types: full;
[Files]
Source: "{#MySrcDir}\toolkit\UnPacking\VMUnprotectDumper\*"; DestDir: "{#MyAppToolsFolder}\UnPacking\VMUnprotectDumper"; Components: "unpacking\vmunprotectdumper"; Flags: ignoreversion recursesubdirs createallsubdirs;
[Icons]
Name: "{group}\VMUnprotectDumper"; Filename: "{sys}\cmd.exe"; WorkingDir: "{#MyAppToolsFolder}\UnPacking\VMUnprotectDumper"; Components: "unpacking\vmunprotectdumper"; Parameters: "/K ""{#MyAppToolsFolder}\UnPacking\VMUnprotectDumper\VMUnprotectDumper.exe"""; IconFilename: "{#MyAppToolsFolder}\UnPacking\VMUnprotectDumper\VMUnprotectDumper.exe";
Name: "{#MyAppBinsFolder}\sendto\sendto\UnPacking\VMUnprotectDumper"; Filename: "{sys}\cmd.exe"; WorkingDir: "{#MyAppToolsFolder}\UnPacking\VMUnprotectDumper"; Components: "unpacking\vmunprotectdumper"; Parameters: "/K ""{#MyAppToolsFolder}\UnPacking\VMUnprotectDumper\VMUnprotectDumper.exe"""; IconFilename: "{#MyAppToolsFolder}\UnPacking\VMUnprotectDumper\VMUnprotectDumper.exe";

View File

@ -0,0 +1,29 @@
; Updater
[Components]
Name: "updater\main"; Description: "Updater"; Types: full compact;
[Files]
Source: "{#MySrcDir}\..\..\bin\updater\*"; DestDir: "{#MyAppBinsFolder}\updater"; Components: "updater\main"; Flags: ignoreversion recursesubdirs createallsubdirs; BeforeInstall: BeforeInstallScript;
Source: "{#MySrcDir}\..\..\bin\hstart\*"; Destdir: "{#MyAppBinsFolder}\hstart\"; Components: "updater\main"; Flags: ignoreversion recursesubdirs createallsubdirs;
[Icons]
Name: "{group}\Toolkit Updater"; Filename: "{#MyAppBinsFolder}\updater\updater.exe"; WorkingDir: "{#MyAppBinsFolder}\updater"; Components: "updater\main";
Name: "{userdesktop}\{#MyAppNameOriginal}\Toolkit Updater"; Filename: "{#MyAppBinsFolder}\updater\updater.exe"; WorkingDir: "{#MyAppBinsFolder}\updater"; Components: "updater\main";
; Fix default update config
[INI]
Filename: {#MyAppBinsFolder}\updater\tools.ini; Section: UpdaterConfig; Key: disable_clean; String: True; Components: "updater\main";
Filename: {#MyAppBinsFolder}\updater\tools.ini; Section: UpdaterConfig; Key: disable_repack; String: True; Components: "updater\main";
; Add Task Schedule
[Components]
Name: "updater\task"; Description: "Add Updater Task Schedule"; Types: full compact;
[Run]
Filename: "{sys}\schtasks.exe"; Parameters: "/Delete /TN IndetectablesToolkit_Updater /F"; Components: "updater\task"; Flags: runhidden;
Filename: "{sys}\schtasks.exe"; Parameters: "/CREATE /SC WEEKLY /TN IndetectablesToolkit_Updater /TR ""'{#MyAppBinsFolder}\hstart\hstart.exe' /NOCONSOLE '{#MyAppBinsFolder}\updater\updater.exe'"""; Components: "updater\task"; Flags: runhidden;
[UninstallRun]
Filename: "{#MyAppBinsFolder}\hstart\hstart.exe"; Parameters: "/ELEVATE ""{sys}\schtasks.exe /Delete /TN IndetectablesToolkit_Updater /F"""; Components: "updater\task"; Flags: runhidden;

View File

@ -0,0 +1,98 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Indetectables Toolkit Extras: Unpacking"
#define MyAppNameOriginal "Indetectables Toolkit"
#define MyAppVersion "2023.3"
#define MyAppPublisher "Indetectables"
#define MyAppURL "https://www.indetectables.net/"
#define MyAppToolsFolder "{app}\toolkit"
#define MyAppBinsFolder "{app}\bin"
#define MySrcDir "C:\code\toolkit\extras\unpacking"
#define MyOutputDir "C:\code"
[Setup]
AppId={{968CE526-6B32-4998-84F9-6CDD43CFBC2C}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
VersionInfoVersion={#MyAppVersion}
AppVerName={#MyAppName} - {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={sd}\{#MyAppNameOriginal}
DefaultGroupName={#MyAppNameOriginal}
PrivilegesRequired=admin
;PrivilegesRequiredOverridesAllowed=dialog
OutputBaseFilename=Toolkit_{#MyAppVersion}_Extras_Unpacking
Compression=lzma2/max
SolidCompression=yes
WizardStyle=modern
ArchitecturesInstallIn64BitMode=x64
SetupIconFile="{#MySrcDir}\installer\icon.ico"
OutputDir={#MyOutputDir}
Uninstallable=no
DirExistsWarning=no
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
[CustomMessages]
english.FolderValidationError=The toolkit was not found in the selected folder. You must install it before you can continue.
spanish.FolderValidationError=No se ha encontrado el kit de herramientas en la carpeta seleccionada. Debe instalarlo antes de continuar.
catalan.FolderValidationError=El conjunt d'eines no s'ha trobat a la carpeta seleccionada. Heu d'instal·lar-lo abans de poder continuar.
portuguese.FolderValidationError=O conjunto de ferramentas não foi encontrado na pasta seleccionada. Deve ser instalado antes de poder continuar.
[Components]
Name: "unpacking"; Description: "UnPacking"; Types: full;
#include "sections\unpacking.iss"
[Components]
Name: "updater"; Description: "Tools auto updater"; Types: full;
#include "sections\updater.iss"
;;; etc
[Run]
; Configure installed tools
Filename: "{#MyAppBinsFolder}\updater\bin\auto-config-ini.exe"; Parameters: "/FOLDER={#MyAppBinsFolder}\updater /TYPE=clean"; Flags: runhidden;
; Sync tools versions
Filename: "{#MyAppBinsFolder}\updater\bin\auto-config-ini.exe"; Parameters: "/FOLDER={#MyAppBinsFolder}\updater /TYPE=sync"; Flags: runhidden;
[code]
function GetFileName(const FileName: string): string;
begin
Result := ExpandConstant('{#MyAppBinsFolder}\updater\' + FileName);
end;
procedure BeforeInstallScript();
begin
if FileExists(GetFileName('tools.ini')) then
begin
RenameFile(GetFileName('tools.ini'), GetFileName('tools.ini.old'));
end;
end;
function NextButtonClick(PageId: Integer): Boolean;
begin
Result := True;
if (PageId = wpSelectDir) and not FileExists(ExpandConstant('{app}\CHANGELOG.md')) then
begin
MsgBox(ExpandConstant('{cm:FolderValidationError}'), mbError, MB_OK);
Result := False;
exit;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep = ssDone) and FileExists(GetFileName('tools.ini.old')) then
begin
DeleteFile(GetFileName('tools.ini.old'));
end;
end;