PDA

View Full Version : InnoSetup - Private Edition


BLACKFIRE69
13-09-2024, 13:26
Project: InnoSetup - Private Edition
Based on: v6.4.0-dev (latest)
Changes by: BLACKFIRE69


What's New:

* Added Setup Directives:
- Cursor
- ResourceFiles
- StorePrivateKey
- StyleFile
- EnableTaskbarPreview
- AlphaBlendValue

* Added Script Functions:

- File Extraction:
- procedure ExtractTemporaryFileEx(const BaseName: String; const DestDir: string);
- function ExtractTemporaryFilesEx(const Pattern: String; const DestDir: string): Integer;
- function ExtractTemporaryFileSize(const BaseName: String): Cardinal;
- function ExtractTemporaryFileToBuffer(const BaseName: String; Buffer: Integer): Boolean;
- function ExtractTemporaryFileToStream(const BaseName: String; const Stream: TStream): Boolean;

- function ExtractResourceFile(const ResourceName: string; const OutFile: String): Boolean;
- function ExtractResourceFileSize(const ResourceName: String): Cardinal;
- function ExtractResourceFileToBuffer(const ResourceName: String; Buffer: Integer): Boolean;
- function ExtractResourceFileToStream(const ResourceName: String; const Stream: TStream): Boolean;

- Type Casting:
- function CastAnsiStringToInteger(var S: AnsiString): LongInt;
- function CastIntegerToAnsiString(const L: LongInt): AnsiString;
- function wBufferToFile(const Buffer: Integer; const Count: Cardinal; const OutFile: WideString): Boolean;

- Private Key Handling:
- function GetStoredPrivateKey(const TheRealKey: Boolean): String; - Installation Control:
- procedure BeginInstallProcPause;
- procedure EndInstallProcPause;
- function IsInstallProcPaused: Boolean;

- Audio Playback:
- function PlayWavFile1(const WavFileName: WideString): Boolean;
- function PlayWavFile2(const WavFileName: WideString; Flags: Cardinal): Boolean;
- function PlayWavFile3(const WavFileName: WideString; Handle, Flags: Cardinal): Boolean;

- System Icon Retrieval:
- function wGetSysDefaultIcons(const Src: WideString; SHLIcoSize: Cardinal; const Buffer: Integer; var Count: Cardinal): Integer;
- function wGetSysDefaultIcons2(const Src, OutImgFile: WideString; SHLIcoSize: Cardinal): Boolean;
- function wGetSysDefaultIconsSize(const Src: WideString; SHLIcoSize: Cardinal): Integer;

- function wGetSysDefaultIconsFromResLib(const AModule: WideString; AIndex, RISIcoSize: Cardinal; const Buffer: Integer; var Count: Cardinal): Integer;
- function wGetSysDefaultIconsFromResLib2(const AModule, AOutFile: WideString; AIndex, RISIcoSize: Cardinal): Boolean;
- function wGetSysDefaultIconsSizeFromResLib(const AModule: WideString; AIndex, RISIcoSize: Cardinal): Integer;

* Added Setup Event Functions:
- procedure CurInstallProgressChangedEx(CurProgress, MaxProgress, iPercentage: Integer; sElapsed, sRemaining: String);
- procedure InitializeWizardEve();
* Added Classes:
- TApplication
- TMemoryStream
- TResourceStream
- TImgSlideshow → SlideShow
- TSplashImage → SplashScreen
- TSplashImageAnimated → SplashScreenAnimated
- TWaterRipples → WaterRipples

* Added Class Variables:
- Application: TApplication

* Added Properties and Functions:

- WizardForm:
- WizardForm.AlphaBlendValue: Byte;
- WizardForm.DoubleBuffered: Boolean;

- WizardForm.BlendOnMoveEnable(const AllowOnDeactive: Boolean);
- WizardForm.BlendOnMovePause(const Paused: Boolean);
- WizardForm.BlendOnMoveOpacity(const AlphaValue: Byte);
- WizardForm.BlendOnMoveIsPaused: Boolean;

- WizardForm.CreateRgn(const sMaskBmp: WideString; iTrRGBColor: Integer): Integer;
- WizardForm.CreateRgnFromBuffer(const Buffer: PAnsiChar; const Count: Cardinal; iTrRGBColor: Integer): Integer;
- WizardForm.CreateFormFromBmp(const sBmpFile: WideString; bACPremultiplied, bDraggableForm: Boolean; iOpacityPct: Byte): Integer;
- WizardForm.CreateFormFromBmpBuffer(const Buffer: PAnsiChar; const Count: Cardinal; bACPremultiplied, bDraggableForm: Boolean; iOpacityPct: Byte): Integer;

- WizardForm.JumpToPage(const NewPageID: Integer);

- UninstallProgressForm:
- UninstallProgressForm.DoubleBuffered: Boolean;
* Added Preprocessor (ISPP) Predefined Variable:
- IS_PRIVATE_EDITION

* New Built-in Support for Partially Encrypted Scripts:
- Ability to encrypt portions of the code for sharing scripts,
while leaving the rest as plain text.
- I already explained what partially encrypted scripts mean here (https://fileforums.com/showthread.php?t=106410).

* Changes:
- IDE:
- Minor syntax highlighting adjustments.


* All the changes in the Private Edition are documented, so you can easily find help.



InnoSetup - Private Edition Documentation


InnoSetup Private Edition is based on v6.4.0-dev, the latest version available on GitHub.
Ensure that the following lines remain in the script to guarantee the use of the Private Edition:

#ifndef IS_PRIVATE_EDITION
#error InnoSetup 'Private Edition' is required to compile this script
#endif

Setup Directives

1). Cursor

The cursor can be applied to specific forms such as `SelectLanguageForm`, `WizardForm`, `SelectFolderForm`, and `NewDiskForm`.
Supported cursor file types: `.cur` and `.ani`.

[Setup]
Cursor=.\Cursor\Dark.Ani

2). ResourceFiles and Extracting Files to Buffer

The Private Edition allows storing files in resources, encrypting them internally so they cannot be extracted outside the `setup.exe`.
Multiple files can be included, separated by the pipe (`|`) symbol.
When using the extraction functions, prepend the resource name with `_IS_`.

function ExtractResourceFile(const ResourceName: string; const OutFile: string): Boolean;
function ExtractResourceFileSize(const ResourceName: string): Cardinal;
function ExtractResourceFileToBuffer(const ResourceName: string; Buffer: Integer): Boolean;
function ExtractResourceFileToStream(const BaseName: string; const Stream: TStream): Boolean;

[Setup]
ResourceFiles=Resource1:".\File1.ext"|Resource2:".\File2.ext"


Additional Functions:

procedure ExtractTemporaryFileEx(const BaseName: string; const DestDir: string);
function ExtractTemporaryFilesEx(const Pattern: string; const DestDir: string): Integer;
function ExtractTemporaryFileSize(const BaseName: string): Cardinal;
function ExtractTemporaryFileToBuffer(const BaseName: string; Buffer: Integer): Boolean;
function ExtractTemporaryFileToStream(const BaseName: string; const Stream: TStream): Boolean;




Example: Playing Music from Memory


* Using `ExtractTemporaryFile`:
[Files]
Source: ".\XBass\{#MusicFileOnly}"; DestDir: {tmp}; Flags: dontcopy;

[Code}
procedure InitializeWizard();
var
Buffer: AnsiString;
Count: Cardinal;
begin
Count := ExtractTemporaryFileSize('{#MusicFileOnly}');
SetLength(Buffer, Count);
ExtractTemporaryFileToBuffer('{#MusicFileOnly}', CastAnsiStringToInteger(Buffer));

if not xbassCreateFromMem(WizardForm.Handle,
Buffer, Count, C_XBASS_OGG,
1, True, @MusicCallback) then
MsgBox('XBass - error(s) occured while creating.', mbError, MB_OK);

SetLength(Buffer, 0);
end;


* Using `ExtractResourceFile`:
[Setup]
ResourceFiles=MusicX:".\XBass\{#MusicFileOnly}"

[Code}
procedure InitializeWizard();
var
Buffer: AnsiString;
Count: Cardinal;
begin
// InnoSetup-Private: ( Don't forget the prefix: "_IS_" )
Count := ExtractResourceFileSize('_IS_MUSICX');
SetLength(Buffer, Count);
ExtractResourceFileToBuffer('_IS_MUSICX', CastAnsiStringToInteger(Buffer));

if not xbassCreateFromMem(WizardForm.Handle,
Buffer, Count, C_XBASS_OGG,
1, True, @MusicCallback) then
MsgBox('XBass - error(s) occured while creating.', mbError, MB_OK);

SetLength(Buffer, 0);
end;


3. StorePrivateKey

The `StorePrivateKey` directive securely stores the encryption key within the setup, preventing exposure of the key in plain text.
The key can be retrieved dynamically at runtime using the `GetStoredPrivateKey` function, protecting it from reverse engineering.

[Setup]
// Encryption
Encryption=True
Password=HelloPwd_123
StorePrivateKey=HelloPwd_123
//

[Code}
var
IsPwdPg: Boolean;

// function GetStoredPrivateKey(const TheRealKey: Boolean): String;
// - TheRealKey: If False, the function returns garbage instead of real key.

procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpPassword then
begin
IsPwdPg := True;
WizardForm.PasswordEdit.Text := GetStoredPrivateKey(IsPwdPg);
end else
begin
IsPwdPg := False;
WizardForm.PasswordEdit.Text := 'wrng_pwd';
end;
end;


4. StyleFile

The `StyleFile` directive allows you to apply a VCL style to various forms during setup.

[Setup]
StyleFile=".\Styles\AquaGraphite.vsf"

5. Other Directives
[Setup]
EnableTaskbarPreview=True
// 0 - 255
AlphaBlendValue=200

Installation Progress Tracking and Controls

The Private Edition introduces a new event to track installation progress with elapsed time, remaining time, and percentage progress. It also supports `Pause`/`Resume` functionality.

procedure CurInstallProgressChangedEx(CurProgress, MaxProgress, iPercentage: Integer;
sElapsed, sRemaining: String);
begin
WzdProgressLbs[1].Vl.Caption := IntToStr(iPercentage) + '%';
WzdProgressLbs[2].Vl.Caption := sElapsed;
WzdProgressLbs[3].Vl.Caption := sRemaining;
WzdProgressLbs[4].Vl.Caption := sElapsed;
end;

Page Navigation with `JumpToPage`

The `JumpToPage` method allows you to jump directly to specific pages in the setup process, bypassing validation checks like license acceptance. Use it cautiously.

[Code}
var
Btn: array [1..2] of TNewButton;

procedure CommonBtnOnClick(Sender: TObject);
begin
case Sender of
Btn[1] : WizardForm.JumpToPage(wpWelcome);
Btn[2] : WizardForm.JumpToPage(wpReady);
end;
end;


- A new event function, `InitializeWizardEve`, triggers after `InitializeWizard` but before `WizardForm` is shown. It can be used to jump to specific pages at startup.

procedure InitializeWizardEve();
begin
WizardForm.JumpToPage(wpReady);
end;

Special Effects and Graphics

1). TImgSlideshow
[Files]
Source: ".\Wallpapers\*.jpg"; DestDir: "{tmp}"; Flags: dontcopy;

[Code}
var
ImgSlideshow: TImgSlideshow;

procedure InitializeWizard();
var
sFile: String;
ImgEffectsArray: TIntEffectArray;
Buffer: AnsiString;
i, Count: Cardinal;
begin
SetLength(ImgEffectsArray, 3);
ImgEffectsArray[0] := IMG_ANIM_RANDOM_SQUARES_APPEAR;
ImgEffectsArray[1] := IMG_ANIM_SPECKLE_APPEAR_FROM_LEFT;
ImgEffectsArray[2] := IMG_ANIM_SPIRAL_RECTANGLE;

ImgSlideshow := TImgSlideshow.Create(WizardForm, IMG_ANIM_DIAGONAL_BOX_OUT);
ImgSlideshow.SetBounds(0, 0, WizardForm.Width + ScaleX(85), ScaleY(269));
ImgSlideshow.PlayCustom(ImgEffectsArray, False);
ImgSlideshow.Interval(1000, 50, 5);

for i:= 1 to 5 do
begin
sFile := 'wallpapers' + IntToStr(i) + '.jpg';

Count := ExtractTemporaryFileSize(sFile);
SetLength(Buffer, Count);
ExtractTemporaryFileToBuffer(sFile, CastAnsiStringToInteger(Buffer));

ImgSlideshow.AddImageFromBuffer(Buffer, Count);

SetLength(Buffer, 0);
Count := 0;
end;

ImgSlideshow.Start(True);
end;

2). TSplashImage and TSplashImageAnimated
[Setup]
ResourceFiles=SplshImg:".\Splash\Splash.png"|SplshWav:".\Splash\Splash.wav"

[Code}
var
SplashScreen: TSplashImage;

procedure InitializeWizard();
var
Buffer1, Buffer2: AnsiString;
Count1, Count2: Cardinal;
begin
// Image
Count1 := ExtractResourceFileSize('_IS_SplshImg');
SetLength(Buffer1, Count1);
ExtractResourceFileToBuffer('_IS_SplshImg', CastAnsiStringToInteger(Buffer1));

// Sound
Count2 := ExtractResourceFileSize('_IS_SplshWav');
SetLength(Buffer2, Count2);
ExtractResourceFileToBuffer('_IS_SplshWav', CastAnsiStringToInteger(Buffer2));

SplashScreen := TSplashImage.CreateFromBuffer(WizardForm, Buffer1, Count1, Buffer2, Count2, 1500);
SplashScreen.Play;

// Freeup
SetLength(Buffer1, 0);
SetLength(Buffer2, 0);
end;


3). TWaterRipples
[Setup]
ResourceFiles=Img1:".\WaterRipple\Img.bmp"

[Code}
var
WaterRipples: TWaterRipples;

procedure InitializeWizard();
var
Buffer: AnsiString;
Count: Cardinal;
begin
WizardForm.DoubleBuffered := True;

Count := ExtractResourceFileSize('_IS_Img1');
SetLength(Buffer, Count);
ExtractResourceFileToBuffer('_IS_Img1', CastAnsiStringToInteger(Buffer));

WaterRipples := TWaterRipples.CreateFromBuffer(WizardForm, 0, 0,
WizardForm.Width + ScaleX(85), ScaleY(269), Buffer, Count);
if not WaterRipples.IsStarted then
WaterRipples.Start;
if not WaterRipples.IsRaining then
WaterRipples.StartRainDrops;

SetLength(Buffer, 0);
end;


Advanced Features

1). Blend OnMove
procedure InitializeWizard();
begin
WizardForm.BlendOnMoveEnable(True);
end;

2). Create Form from BMP
[Files]
Source: ".\MaskImg\*.bmp"; DestDir: {tmp}; Flags: dontcopy;

[Code}
procedure InitializeWizard();
var
Buffer: AnsiString;
Count: Cardinal;
begin
{ Custom Shape }
// Rgn
Count := ExtractTemporaryFileSize('mask.bmp');
SetLength(Buffer, Count);
ExtractTemporaryFileToBuffer('mask.bmp', CastAnsiStringToInteger(Buffer));

WizardForm.CreateRgnFromBuffer(Buffer, Count, clBlack);
SetLength(Buffer, 0);

// Form
Count := ExtractTemporaryFileSize('base.bmp');
SetLength(Buffer, Count);
ExtractTemporaryFileToBuffer('base.bmp', CastAnsiStringToInteger(Buffer));

WizardForm.CreateFormFromBmpBuffer(Buffer, Count, False, True, 100);
SetLength(Buffer, 0);
end;




.

Cesar82
13-09-2024, 14:23
Great project. Thanks!
However, what everyone needs is an improved IDE interface with code completion like the one in version 5.5.1 ENHANCED by RESTOOL and also including all the additional classes.

In fact, it would be great to have a remake of version 5.5.1ee2 updated to the current version but without a different IDE, just complementing the official IDE with extra features.
I believe if this remake were done, a large number of people would start using it, because I think that until today the RESTOOL version is the most used among the modified versions of Inno Setup.

demon964
15-09-2024, 02:12
3. StorePrivateKey

its protecting script codes from decompile ?

Dario06
26-09-2024, 12:51
for me the ee2 version doesn't beat the interface, too bad it's old, I can't even read this one, it looks like a rainbow of colors in the code and very dull, you need an oled monitor to read :D

you could add this option like in the screenshot like nsis, it would be an orgasm :D
Thanks mr. blackfire

BLACKFIRE69
17-10-2024, 10:55
Upcoming InnoSetup Private Edition - v1.8 Update


1. Updated InnoSetup version to the latest available on GitHub.

2. Added built-in Botva2-like components/classes:

* Ability to use Botva2-like implementations without any third-party DLL.

A. TImgButton (with CheckBox)
B. TImgProgressbar
C. TImgTrackbar

[Code}
var
ImgBtn: TImgButton;
ImgPB: TImgProgressbar;
ImgTrackBar: TImgTrackbar;

procedure InitializeWizard();
begin
ImgBtn := TImgButton.Create(WizardForm, ExtractAndLoad('Button.png'));
ImgBtn.SetBounds(252, 384, 120, 50);
ImgBtn.Text('< &Back');
ImgBtn.OnClick(@CommonOnClick);


ImgPB := TImgProgressbar.Create(WizardForm,
ExtractAndLoad('pb3.png'),
ExtractAndLoad('pbbkg3.png'), False);
ImgPB.Value(0, 100);


ImgTrackBar: TImgTrackbar.Create(WizardForm,
ExtractAndLoad('trackbar_bkg.png'),
ExtractAndLoad('trackbar_btn.png'));
ImgTrackBar.SetBounds(20, 403, 150, 10);
ImgTrackBar.BtnOffset(393, 18, 33);
ImgTrackBar.SetValue(69);
end;


3. Added Any Image support (TAnyImage)

* Ability to draw any image format (.bmp, .jpg, .png, .gif, .webp, .svg, etc.) in InnoSetup.

* More image manipulations will be available in the future, including:
- Hue and Saturation adjustments
- BlendToMask, BlendToDarken, BlendToLighten, BlendToAlpha
- Draw Shadow, Glow
- Tile images
- Sharpen
- Cropping
- Rotate
- Reduce colors
- Grayscale, Invert Colors

* Currently, images are detected by their file extensions.
- In IS-PE v2.0, a better detection method will be implemented.

* Support for image layers:
- TAnyImageImgLyr: Image Layer (for overlaying images)
- TAnyImageBlurLyr: Blur Layer (Linear, Radial, Custom Shape, etc.)
- Hue and Saturation layers will be added in the future.


[Code}
var
Img: TAnyImage;
ImgBlur: TAnyImageBlurLyr;
ImgLogo: TAnyImageImgLyr

procedure InitializeWizard();
begin
Img := TAnyImage.Create(WizardForm);
Img.SetBounds(382, 110, 230, 300);
// Img.LoadImageEx(ExtractAndLoad('base.dat'), IS_IMG_PNG);
Img.LoadImage(ExtractAndLoad('base.png'));
Img.Stretch(True);

ImgBlur := Img.AddGaussinaBlurLayer;
ImgBlur.Amount(20); // 0-100
ImgBlur.AutoSize(True);

ImgLogo := Img.AddImageLayer;
ImgLogo.SetBounds(15, 100, 200, 200);
ImgLogo.LoadImage(ExtractAndLoad('base.png'));
ImgLogo.Stretch(True);
ImgLogo.BringToFront;
end;

4. Enhanced Auto-Completion:

* Currently in beta stage.
* This feature will be improved in the next major update.

5. Added built-in Audio/Video classes:

A. TVideoPlay (supports .avi, .mp4 formats)
B. TAudioPlay (supports .mp3, .ogg formats)

6. Added ability to load DLLs from memory:

* No need to extract third-party DLLs to the HDD.
* DLLs can be extracted into memory and functions can be called directly from there.

7. Added support for modern Delphi classes/functions.

8. Features on request:

* Individual users can request specific features to be included.

A. Built-in support for `UnArc.dll` or `TISArcEx`
B. Built-in support for `CmdOut.dll` or `TCmdOut`
C. Built-in support for `XHashEx.dll` or `TXHashEx`


Notice:

1. This update WILL NOT be available to the public.

- The update will only be provided to users who requested it and can give credit for my effort.
- You are not allowed to share your IS-PE update with others. Doing so will result in being permanently banned from receiving future updates.

2. The update is not yet finalized.

- If you have suggestions or feature requests, feel free to drop a comment.

3. Update delay.

- I'm currently busy with my job, so updates may not be released quickly.
- I'll notify you when the updates are ready.

4. Future improvements in IS-PE v2.0:

- The new features will be further improved and optimized in the next major update, IS-PE v2.0.



.

Dario06
21-10-2024, 11:32
hi blackfire add unpacked options please (CallWindowProc)

my example:

auaksa
22-10-2024, 15:18
whats problem?

https://i.imgur.com/9flO426.png

Lord.Freddy
23-10-2024, 03:20
whats problem?

https://i.imgur.com/9flO426.png

comment this line.

Dario06
23-10-2024, 09:30
whats problem?



Did you add any incompatible code to the script? because it doesn't give me any errors with windows 11

auaksa
23-10-2024, 14:38
This is the default text file without any modifications or interventions by anyone else. This file works fine with version v6.0.5 but does not work with version Inno Setup Private Edition.

Dario06
23-10-2024, 16:26
This is the default text file without any modifications or interventions by anyone else. This file works fine with version v6.0.5 but does not work with version Inno Setup Private Edition.


I replied because these errors are mostly related to code compatibility, and you didn't give many details, yes in fact you are right, it is not working with the Private Edition of Blasckfire.

Tihiy_Don
24-10-2024, 22:29
I suggest that we first focus on fixing and refining FMXInno - this is really what we need. And then do similar forks Inno Setup.