PDA

View Full Version : INNO TROUBLESHOOT - Questions Here


Pages : 1 2 3 4 5 6 [7]

kj911
26-11-2021, 13:31
Questions from calculated installed game size info added via INNO setup appsize info: Use raw bytes count on installed all files or use phsycal disk storage count calculated via OS??? (Note: The disk size reservation is related to the sector size. Example: 512byte, 4096byter, 32kB, etc...)

Example:

~160k files, and size in bytes (without uninstaller): 19 034 361 518 byte
OS calculated Disk Space size (NTFS, WinXP): 19 340 095 488 byte

Size difference its ~300MB!

Joe Forster/STA
26-11-2021, 23:58
(Note: The disk size reservation is related to the sector size. Example: 512byte, 4096byter, 32kB, etc...)

That's more precisely the cluster size.

fabrieunko
03-12-2021, 04:02
Hello, how do I display the installer at the bottom of the screen? instead of being in the middle?

sakhjack
12-05-2022, 15:17
Unarc.dll error code: -12
Error: file ...\Music_2.csb failed CRC check
compression: xtool:mreflate + any other method
things tried: disable AV, install MVC++, increase page file, install on different drive
-----
using different pre-compressor like xt_lzo (or none at all) solves the issue

kj911
24-05-2022, 07:39
The task killing code (green line, from use Xtool) its works from newer OS than Win XP??

procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
....
ISDoneError:=True;
ISDoneCancel:=1;
Exec('taskkill.exe', '/f /im XT.exe','', SW_HIDE, ewNoWait, ResultCode);
DelTree(ExpandConstant('{app}'), True, True, True);
AllCancel2;
....

Joe Forster/STA
24-05-2022, 23:50
The task killing code (green line, from use Xtool) its works from newer OS than Win XP??[/CODE]

It does.

L33THAK0R
05-08-2022, 23:02
Is it possible to import an external variable, for example the name of the software package that is defined within a ".ini" config file, for use in an Inno Setup message (namely SetupAppTitle, line 31 (https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/EnglishBritish.isl))?

In essence I'm attempting "SetupAppTitle" to read (for example) "{#Game_Name} Setup", but can't quite figure out if this is possible. I'm currently just manually overwriting the value in question but it is a tad tedious.

KaktoR
06-08-2022, 00:35
There are GetIniInt and GetIniString functions.

L0v3craft
24-08-2022, 14:07
Hi guys. I'm using Inno Script Studio + Inno Setup (both updated) to compress little games. For example "Cult of the Lamb" (1.14GB).

I have tested the installation on my pc (ryzen with 16 threads and 16GB of ram), but a friend of mine is getting an error "out of memory" on his pc with 32GB of ram.

These are the parameters that I'm using:

Compression=lzma2/ultra64
DiskSpanning=yes
DiskSliceSize=max
LZMAUseSeparateProcess=yes
LZMADictionarySize=1048576
LZMANumFastBytes=273

someone knows which one of those parameters is causing "out of memory" error in installation? Thanks to everyone that is going to help me.

Checking from the task manager, the setup in installation is using 1029MB of ram at max and works fine on my pc.

Edit: solved using -> LZMADictionarySize=524288

Lord.Freddy
24-08-2022, 22:39
Hi guys. I'm using Inno Script Studio + Inno Setup (both updated) to compress little games. For example "Cult of the Lamb" (1.14GB).

I have tested the installation on my pc (ryzen with 16 threads and 16GB of ram), but a friend of mine is getting an error "out of memory" on his pc with 32GB of ram.

These are the parameters that I'm using:

Compression=lzma2/ultra64
DiskSpanning=yes
DiskSliceSize=max
LZMAUseSeparateProcess=yes
LZMADictionarySize=1048576
LZMANumFastBytes=273

someone knows which one of those parameters is causing "out of memory" error in installation? Thanks to everyone that is going to help me.

Checking from the task manager, the setup in installation is using 1029MB of ram at max and works fine on my pc.

Use this:
LZMADictionarySize=10500

Lord.Freddy
27-08-2022, 04:43
Hi guys, I have questions about features of this version

1: what's the [speed button] is and what is its use?
2: how to create a custom page in design mode?

Cesar82
28-08-2022, 14:19
Hi guys, I have questions about features of this version

1: what's the [speed button] is and what is its use?
2: how to create a custom page in design mode?

Speed Button (see image) of the New SpeedButton class is a button with the option of including a context menu, but for this you must also use TPopupMenu and TMenuItem.

Masquerade
01-09-2022, 05:48
Is there a list of T<> identifiers in Inno Setup 6?

I am trying to load an animated gif but I'm finding it hard. TBitmapImage is incorrect, I found references online to needing to use TGifImage or TImage but they don't appear to exist in inno.

Here's what I have so far (I understand that it isn't correct):

ExtractTemporaryFile('LOGOIMAGE.GIF');
LogoImage := TGifImage.Create(WizardForm);
with LogoImage do
begin
Name := 'LogoImage';
Parent := WizardForm;
SetBounds(ScaleX(10), ScaleY(10), ScaleX(300), ScaleY(60));
//Gif.LoadFromFile(ExpandConstant('{tmp}\LOGOIMAGE.G IF'));
end;

Thanks!

KaktoR
01-09-2022, 06:00
I think there is no native way in Inno Setup to show animated gif images.

Masquerade
01-09-2022, 06:01
I think there is no native way in Inno Setup.

Would that mean I would need to include a library such as botva2?

KaktoR
01-09-2022, 06:02
I think there is isgsg.dll library (https://github.com/KngStr/Inno-All-in-One-Setup/tree/master/Examples/Isgsg)

Masquerade
01-09-2022, 06:06
I think there is isgsg.dll library (https://github.com/KngStr/Inno-All-in-One-Setup/tree/master/Examples/Isgsg)

That appears to only do Splash screen judging by the iss examples and by looking at the DLL exports

KaktoR
01-09-2022, 06:09
Ok, so you want to show the gif image permanent somewhere on installer surface, like a bitmap image?

Pretty sure it's possible but never thought about that :(

Cesar82
01-09-2022, 17:56
Is there a list of T<> identifiers in Inno Setup 6?

I am trying to load an animated gif but I'm finding it hard. TBitmapImage is incorrect, I found references online to needing to use TGifImage or TImage but they don't appear to exist in inno.

Here's what I have so far (I understand that it isn't correct):

ExtractTemporaryFile('LOGOIMAGE.GIF');
LogoImage := TGifImage.Create(WizardForm);
with LogoImage do
begin
Name := 'LogoImage';
Parent := WizardForm;
SetBounds(ScaleX(10), ScaleY(10), ScaleX(300), ScaleY(60));
//Gif.LoadFromFile(ExpandConstant('{tmp}\LOGOIMAGE.G IF'));
end;

Thanks!
To use gif images in Inno Setup you can use the library GifCtrl.dll

PercyMaliek
16-09-2022, 12:01
I'm bloody new to Inno Setup script.
I've created the bins for a game, but I'm unsure how to have Inno decompress them

Compression was PrecompX+srep+lolz

precompx\x64\PrecompX.exe -e - - <stdin> <stdout>
srep\srep.exe -m3f -l512 $$arcdatafile$$.tmp $$arcpackedfile$$.tmp
lolz\lolz_x64.exe -d256 -mc192 -mt4 $$arcdatafile$$.tmp $$arcpackedfile$$.tmp

Besides a few basic tutorials, I've not come across anything about decompression with ISS...

Lord.Freddy
16-09-2022, 12:48
That appears to only do Splash screen judging by the iss examples and by looking at the DLL exports
@Masquerade

I try apply gif in WizardForm in a month ago and now...
Use GifLib by SkyGZ(Support All version of innoSetup)

Lord.Freddy
16-09-2022, 12:58
I'm bloody new to Inno Setup script.
I've created the bins for a game, but I'm unsure how to have Inno decompress them

Compression was PrecompX+srep+lolz

precompx\x64\PrecompX.exe -e - - <stdin> <stdout>
srep\srep.exe -m3f -l512 $$arcdatafile$$.tmp $$arcpackedfile$$.tmp
lolz\lolz_x64.exe -d256 -mc192 -mt4 $$arcdatafile$$.tmp $$arcpackedfile$$.tmp

Besides a few basic tutorials, I've not come across anything about decompression with ISS...
If you use freearc for compression well need a library to call unarc.dll for extract files(isdone.dll). Search on this forum, download example script like ASIS OR Lite installer ... see a script, learn and use.

KaktoR
16-09-2022, 13:30
You don't need ISDone library, there is ISArcEx here: https://fileforums.com/showthread.php?t=104980

If you want to use ISDone library, there is a example script somewhere on the internet, most likely where ISDone library is shared by it's creator (krinkels.org)

Moreover, to a new person I would not suggest scripts like ASIS, CIU and such to learn about this, they are just too much.

L33THAK0R
26-09-2022, 12:09
Has anyone implemented Inno Download Plugin (https://mitrichsoftware.wordpress.com/inno-setup-tools/inno-download-plugin/) in their script? I'm looking to implement it be able to offer redist. packages like Nvidia's PhysX (for titles such as the first two "Metro" titles and some Ubisoft titles) to the end-user, whilst avoiding having to include the executable itself (since some are still 35MB+ after packing them!) and instead fetching a download link. If anyone could show me their implementation I'd very much appreciate any insight anyone could offer!

Cesar82
26-09-2022, 12:26
Has anyone implemented Inno Download Plugin (https://mitrichsoftware.wordpress.com/inno-setup-tools/inno-download-plugin/) in their script? I'm looking to implement it be able to offer redist. packages like Nvidia's PhysX (for titles such as the first two "Metro" titles and some Ubisoft titles) to the end-user, whilst avoiding having to include the executable itself (since some are still 35MB+ after packing them!) and instead fetching a download link. If anyone could show me their implementation I'd very much appreciate any insight anyone could offer!

As I remember this plugin didn't work with most of the links (I could be wrong).
I recommend using DwinsHs (https://www.han-soft.com/dwinshs.php) (Downloader for Inno Setup).
DwinsHs already has an example script.
I use DwinsHs code in DiskSpan GUI to download plugins and it works great.

L33THAK0R
26-09-2022, 20:48
As I remember this plugin didn't work with most of the links (I could be wrong).
I recommend using DwinsHs (https://www.han-soft.com/dwinshs.php) (Downloader for Inno Setup).
DwinsHs already has an example script.
I use DwinsHs code in DiskSpan GUI to download plugins and it works great.

This definitely looks easier to implement! Thanks a bunch for linking this. However looking at my problem after a good nights sleep (I'm always far too tired writing out any questions here I swear), I think I'll just use powershell to download the file, since running the installer requires elevated privileges already (also means a lot less work wrangling this plugin). One day though I'll probably migrate to using an actual plugin instead of a series of scripts.

Dragonis40
30-11-2022, 02:59
Hello everybody! I have an issue with isskin.dll in inno setup welcome page final exe: if I use a version of isskin.dll (395.184 byte, date: 02/12/2012) and mouse scroll, welcome page text scrolls, the scrollbar appears, but it doesn't work (if I try to move scrollbar by using mouse left button or by pressing scrollup or scrolldown button, nothing happens).
If I use another version of isskin.dll (395.184 byte, date: 04/11/2009) and mouse scroll, welcome page text scrolls, the scrollbar appears AND IT works, but the skin i've choosen DOESN'T work (the skin is white reguardless *.cjstyles file).
I've tried several isskin.dll versions founded on internet, but nothing different happens.

Is it a bug? Do I need a specific version of isskin.dll? Thank you!

Masquerade
04-01-2023, 10:36
Hi!

Is there a way to enforce compatibility mode for an executable using Inno Setup?

For example, Crysis in my tests requires compatbility mode to be set to Win Vista SP2 so I was wondering if this can be done automatically after the game has been decompressed onto the users' computer.

Thanks!

KaktoR
04-01-2023, 11:13
Yes you have to make it with registry.

L33THAK0R
11-01-2023, 05:54
Is there any way to execute a registry update as the first operation of an install? I'm currently packing the "LEGO" games by the "Traveler's Tales" developers and as many of you undoubtedly know the unpacked "*.dat" archives can have some rather long paths for some files, particularly in newer titles. As a fix to this I'm currently planning to launch either a basic registry script in the form of a ".reg" or use Inno Setup's built-in registry functions to disable Window's 256 character limit (which is perfectly safe to do and only requires a very small modification, I honestly don't know why it isn't disabled by default), but I'm currently a tad unsure how to proceed, has anyone accomplished anything similar in the past, that they'd be willing to share details on?

Masquerade
11-01-2023, 07:02
^^
I don't see why you wouldn't be able to put an Exec2 leading to a batch file before ISDone (or whatever implementation you use to bridge Inno Setup and FreeArc) starts.

A suggestion,

Paste this into a batch file and save it as disable_path_limit.bat:

REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\FileSystem" /v "LongPathsEnabled" /t REG_DWORD /d 1 /f

Add this section to the [Files] section in your script:
Source: disable_path_limit.bat; DestDir: {tmp}; Flags: dontcopy

Then somewhere in your script (e.g. just after arc.ini is extracted for example), add this code section:
ExtractTemporaryFile('disable_path_limit.bat');
Exec2(ExpandConstant('{tmp}\disable_path_limit.bat '),'',false);
DeleteFile(ExpandConstant('{tmp}\disable_path_limi t.bat'));

Providing that you put that section of code just after arc.ini is extracted (if you are unsure where this is, CTRL+F for "ExtractTemporaryFile('arc.ini');" to find it easy) it will run and the reg will get updated before the archives are unpacked.

Note that this batch file requires admin permissions so providing the installer is running in an elevated state, the script should face no issues.

L33THAK0R
11-01-2023, 21:01
^^
I don't see why you wouldn't be able to put an Exec2 leading to a batch file before ISDone (or whatever implementation you use to bridge Inno Setup and FreeArc) starts.

A suggestion,

Paste this into a batch file and save it as disable_path_limit.bat:

REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\FileSystem" /v "LongPathsEnabled" /t REG_DWORD /d 1 /f

Add this section to the [Files] section in your script:
Source: disable_path_limit.bat; DestDir: {tmp}; Flags: dontcopy

Then somewhere in your script (e.g. just after arc.ini is extracted for example), add this code section:
ExtractTemporaryFile('disable_path_limit.bat');
Exec2(ExpandConstant('{tmp}\disable_path_limit.bat '),'',false);
DeleteFile(ExpandConstant('{tmp}\disable_path_limi t.bat'));

This is definitely a much simpler approach, rather than additional inno-setup-native functionality, and it seems to work a treat! Cheers for the help mate!

UPDATE: It seems that FreeArc doesn't like Long Paths regardless of the registry, looks like I'll have to resign myself to using a shorter default folder name.

Dragonis40
31-01-2023, 02:31
Good morning everybody! Is there any way to add a check box in setup.exe for unnecessary .bin files (e.g. soundtracks, manuals, .png images, bonus content in general) and the corresponding instructions in archives.ini file for inno setup? Which are the needed instructions for it? Thank you so much!

Cesar82
05-02-2023, 09:05
Does anyone know how to change the border cursor of an EDIT?
See the attached file.
I would like the cursor when entering the edit to also display the "Hand" cursor and not the "Arrow" cursor.
P.S: If you disable the Edit border, this cursor is not displayed.
Although the attachment file is created in delphi I would like a solution that I can use in Inno Setup.
Thanks!

Lord.Freddy
10-04-2023, 07:52
#define public RequiredSpace "1000"

#define MbToBytes(str *Value) \
Local[1] = MbToBytes((Value)), \
Local[1]

[Setup]
AppName=111
AppVersion=0.0
AppPublisher=bbbbb
DefaultDirName={autopf}\111
ExtraDiskSpaceRequired={#MbToBytes(RequiredSpace)}

[_Code]
function MbToBytes(Value: Integer): Integer;
begin
Result := (Value * (1024 * 1024));
end;

Cesar82
10-04-2023, 10:10
You cannot mix ISPP and CODE section codes.
Try like this:
#define public RequiredSpace "1000"

#define MbToBytes(str Value) \
Int(Value, 0) * 1024 * 1024

[Setup]
AppName=111
AppVersion=0.0
AppPublisher=bbbbb
DefaultDirName={autopf}\111
ExtraDiskSpaceRequired={#MbToBytes(RequiredSpace)}

Lord.Freddy
10-04-2023, 10:22
Does anyone know how to change the border cursor of an EDIT?
See the attached file.
I would like the cursor when entering the edit to also display the "Hand" cursor and not the "Arrow" cursor.
P.S: If you disable the Edit border, this cursor is not displayed.
Although the attachment file is created in delphi I would like a solution that I can use in Inno Setup.
Thanks!

I found this, but I don't know if it works or not

[_Code]
const
IDC_MYCURSOR = 100; // Custom cursor ID

var
MyCursor: HCURSOR;

function LoadCursorFromFile(lpFileName: string): HCURSOR;
external '[email protected] stdcall';

procedure InitializeWizard;
begin
MyCursor := LoadCursorFromFile('C:\Path\To\MyCursor.cur');
end;

procedure CurPageChanged(CurPageID: Integer);
var
EditHandle: HWND;
begin
if CurPageID = wpSelectDir then begin
EditHandle := WizardForm.DirEdit.Handle;
SendMessage(EditHandle, EM_SETCURSOR, 0, LPARAM(MyCursor));
end;
end;

BLACKFIRE69
29-04-2023, 06:33
does anyone know how to convert this following Delphi code into InnoSetup?
alternatively, if you have any other suggestions on how to accomplish this in a similar manner, please feel free to share your thoughts. thanks.

uses
Winapi.Windows, System.SysUtils;

type
TFuncX = procedure(const Var1: Integer); cdecl;
TFuncY = function(const Count: Longint; var Str: AnsiString): Integer; cdecl;
TFuncZ = procedure(const Str1, Str2: WideString); cdecl;
TFuncCommon = record
case Integer of
0: (FuncX: TFuncX);
1: (FuncY: TFuncY);
2: (FuncZ: TFuncZ);
end;

function MySafeLoadLibFunc(const LibName, FuncName: WideString;
var Func: TFuncCommon; var ErrorStr: WideString): Cardinal;
begin
ErrorStr := '';
Result := LoadLibraryW(PWideChar(LibName));
if Result > 32 then begin
try
case Integer(Func) of // Get the address of the function by name
0: Func.FuncX := GetProcAddress(Result, PWideChar(FuncName));
1: Func.FuncY := GetProcAddress(Result, PWideChar(FuncName));
2: Func.FuncZ := GetProcAddress(Result, PWideChar(FuncName));
end;
if not Assigned(Pointer(Integer(Func))) then begin
ErrorStr := 'Could not find function "' + FuncName + '" in library "' + LibName + '"';
Result := 0;
end;
except
on E: Exception do begin
ErrorStr := 'Error loading function "' + FuncName + '" from library "' + LibName + '": ' + E.Message;
Result := 0;
end;
end;
end else ErrorStr := 'Could not load library "' + LibName + '"';

if ErrorStr = '' then ErrorStr := 'empty';
end;

USAGE:

procedure Test;
var
MyFunc: TFuncCommon;
ErrorStr: WideString;
LibModule: Cardinal;
TmpStr: AnsiString;
begin
try
LibModule := MySafeLoadLibFunc('MyDll.dll', 'MyFunc3', MyFunc, ErrorStr);
if LibModule > 32 then
begin
//MyFunc.FuncX(69); // Call function FuncX
//MyFunc.FuncY(47, TmpStr); // Call function FuncY
MyFunc.FuncZ('Hello', 'World'); // Call function FuncZ

FreeLibrary(LibModule); // Free MyDll.dll
end
else WriteLn(ErrorStr);
except
on E: Exception do WriteLn(E.ClassName, ': ', E.Message);
end;
end;



MyDll:

library MyDll;

uses
System.SysUtils, Winapi.Windows;

{$R *.res}

function ShowMsg(const Msg: WideString; Caption: WideString = 'A Msg From MyDll.dll'): Integer; cdecl;
begin
Result := MessageBoxW(0, PWideChar(Msg), PWideChar(Caption), MB_OK);
end;

procedure MyFunc1(const Var1: Integer); cdecl;
begin
ShowMsg('[MyFunc1] : Var1 = ' + IntToStr(Var1));
end;

function MyFunc2(const Count: Longint; var Str: AnsiString): Integer; cdecl;
begin
Str := 'BLACKFIRE';
Result := -10;
ShowMsg('[MyFunc2] : Count = ' + IntToStr(Count));
end;

procedure MyFunc3(const Str1, Str2: WideString); cdecl;
begin
ShowMsg('[MyFunc3] : Str1 = ' + Str1 + ', Str2 = ' + Str2);
end;

exports MyFunc1, MyFunc2, MyFunc3;

begin
end.

Junior53
05-05-2023, 01:52
function CreateFileMapping(
File: Cardinal; Attributes: Cardinal; Protect: Cardinal;
MaximumSizeHigh: Cardinal; MaximumSizeLow: Cardinal; Name: PAnsiChar): Cardinal;
external '[email protected] stdcall';

function MapViewOfFile(
FileMappingObject: THandle; DesiredAccess: Cardinal; FileOffsetHigh: Cardinal;
FileOffsetLow: Cardinal; NumberOfBytesToMap: Cardinal): PChar;
external '[email protected] stdcall';

What is FileMapping & benefits of FileMapping?

File mapping is a technique that allows you to map the contents of a file into the virtual memory space of a process. This allows you to access the contents of the file as if it were in memory, rather than on disk.
There are several benefits to using file mapping:

• Performance: File mapping can improve the performance of file I/O operations by reducing the number of disk accesses. When you map a file into memory, the operating system can use its virtual memory management mechanisms to cache the contents of the file in memory. This means that subsequent accesses to the file can be satisfied from memory, rather than requiring a disk access.

• Concurrency: File mapping allows multiple processes to access the same file concurrently. When multiple processes map the same file into their virtual memory space, they can all access the contents of the file simultaneously. This can be useful for inter-process communication and data sharing.

• Ease of use: File mapping allows you to access the contents of a file using memory-mapped I/O operations, rather than traditional file I/O operations. This can make it easier to work with files, as you can use pointer arithmetic and other memory-based operations to manipulate the contents of the file.
Overall, file mapping is a powerful technique that can improve the performance and ease-of-use of file I/O operations. It is widely used in many different types of applications and is supported by most modern operating systems.

IRAQIGHOST
06-05-2023, 14:23
Hi
In last days I used method (xt_zlib+srep_new:3+LOLZ_NORMAL) DiskSpan
In thes games
Call of Duty Ghosts
Call of Duty Black Ops 4
A Plague Tale Requiem

but every time after click on install this what come to me
https://i.ibb.co/rGnJSM6/Desktop-06-05-2023-08-14-11-734.png

what is the wrong that I did?

Cesar82
06-05-2023, 16:38
Hi
In last days I used method (xt_zlib+srep_new:3+LOLZ_NORMAL) DiskSpan
In thes games
Call of Duty Ghosts
Call of Duty Black Ops 4
A Plague Tale Requiem

but every time after click on install this what come to me
https://i.ibb.co/rGnJSM6/Desktop-06-05-2023-08-14-11-734.png

what is the wrong that I did?

I don't know if that's it, more the ISDone limits the number of characters to 255 or 260 characters.
Make sure the selected installation path is not too long. Try installing in a folder like "D:\Games\Call of Duty Ghosts"
It also cannot contain special characters in the installation path.

KaktoR
17-05-2023, 14:37
My question is not about INNO but batch. Since batch is not something I deal everyday with, I need some help here. I don't want to open a new topic for this.

I have some files which I extract with a tool. The problem is that the extracted folders have the exact name as the files.

For example
File1.abc > Folder1.abc
File2.abc > Folder2.abc
...

Basically I need to get rid of the ".abc" in the folder names.


I already tried something like this but didn't work.
for /d %%i in (*.abc) do ren "%%~i" *

Cesar82
17-05-2023, 18:45
My question is not about INNO but batch. Since batch is not something I deal everyday with, I need some help here. I don't want to open a new topic for this.

I have some files which I extract with a tool. The problem is that the extracted folders have the exact name as the files.

For example
File1.abc > Folder1.abc
File2.abc > Folder2.abc
...

Basically I need to get rid of the ".abc" in the folder names.


I already tried something like this but didn't work.
for /d %%i in (*.abc) do ren "%%~i" *

Try
for /d %%i in (*.abc) do ren "%%~i" "%%~ni"

KaktoR
18-05-2023, 01:10
Thanks this works :)

shazzla
18-05-2023, 05:02
Hi all !

How can i get the installed app's path to 'DefaultDirName' ?

I have a reg-entry :
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\ Windows\CurrentVersion\Uninstall\MyApp]
"InstallLocation"="D:\\MyProgram"

Theoretically in InnoSetup's [setup] section

DefaultDirName={reg:HKLM64\HKEY_LOCAL_MACHINE\SOFT WARE\Microsoft\Windows\CurrentVersion\Uninstall\My App, InstallLocation}

should do the job. But no... Any idea ?

Note : (there are "spaces" in the example paths,etc. Its only visible here,dont know why. I my script they doesnt exists. No matter.)

Cesar82
18-05-2023, 06:51
Hi all !

How can i get the installed app's path to 'DefaultDirName' ?

I have a reg-entry :
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\ Windows\CurrentVersion\Uninstall\MyApp]
"InstallLocation"="D:\\MyProgram"

Theoretically in InnoSetup's [setup] section

DefaultDirName={reg:HKLM64\HKEY_LOCAL_MACHINE\SOFT WARE\Microsoft\Windows\CurrentVersion\Uninstall\My App, InstallLocation}

should do the job. But no... Any idea ?

Note : (there are "spaces" in the example paths,etc. Its only visible here,dont know why. I my script they doesnt exists. No matter.)

Try

DefaultDirName={reg:HKLM\SOFTWARE\Microsoft\Window s\CurrentVersion\Uninstall\My App_is1,InstallLocation|{pf}\My App}
UsePreviousAppDir=no

The value {pf}\My App is default dir if not found value in windows registry.

shazzla
18-05-2023, 21:13
Thank you very much!
I will try and report back ASAP !

Its working fine !
Thanks ! :)

Junior53
07-06-2023, 17:44
does anyone know how to convert this following Delphi code into InnoSetup?
alternatively, if you have any other suggestions on how to accomplish this in a similar manner, please feel free to share your thoughts. thanks.

uses
Winapi.Windows, System.SysUtils;

type
TFuncX = procedure(const Var1: Integer); cdecl;
TFuncY = function(const Count: Longint; var Str: AnsiString): Integer; cdecl;
TFuncZ = procedure(const Str1, Str2: WideString); cdecl;
TFuncCommon = record
case Integer of
0: (FuncX: TFuncX);
1: (FuncY: TFuncY);
2: (FuncZ: TFuncZ);
end;

function MySafeLoadLibFunc(const LibName, FuncName: WideString;
var Func: TFuncCommon; var ErrorStr: WideString): Cardinal;
begin
ErrorStr := '';
Result := LoadLibraryW(PWideChar(LibName));
if Result > 32 then begin
try
case Integer(Func) of // Get the address of the function by name
0: Func.FuncX := GetProcAddress(Result, PWideChar(FuncName));
1: Func.FuncY := GetProcAddress(Result, PWideChar(FuncName));
2: Func.FuncZ := GetProcAddress(Result, PWideChar(FuncName));
end;
if not Assigned(Pointer(Integer(Func))) then begin
ErrorStr := 'Could not find function "' + FuncName + '" in library "' + LibName + '"';
Result := 0;
end;
except
on E: Exception do begin
ErrorStr := 'Error loading function "' + FuncName + '" from library "' + LibName + '": ' + E.Message;
Result := 0;
end;
end;
end else ErrorStr := 'Could not load library "' + LibName + '"';

if ErrorStr = '' then ErrorStr := 'empty';
end;

USAGE:

procedure Test;
var
MyFunc: TFuncCommon;
ErrorStr: WideString;
LibModule: Cardinal;
TmpStr: AnsiString;
begin
try
LibModule := MySafeLoadLibFunc('MyDll.dll', 'MyFunc3', MyFunc, ErrorStr);
if LibModule > 32 then
begin
//MyFunc.FuncX(69); // Call function FuncX
//MyFunc.FuncY(47, TmpStr); // Call function FuncY
MyFunc.FuncZ('Hello', 'World'); // Call function FuncZ

FreeLibrary(LibModule); // Free MyDll.dll
end
else WriteLn(ErrorStr);
except
on E: Exception do WriteLn(E.ClassName, ': ', E.Message);
end;
end;



MyDll:

library MyDll;

uses
System.SysUtils, Winapi.Windows;

{$R *.res}

function ShowMsg(const Msg: WideString; Caption: WideString = 'A Msg From MyDll.dll'): Integer; cdecl;
begin
Result := MessageBoxW(0, PWideChar(Msg), PWideChar(Caption), MB_OK);
end;

procedure MyFunc1(const Var1: Integer); cdecl;
begin
ShowMsg('[MyFunc1] : Var1 = ' + IntToStr(Var1));
end;

function MyFunc2(const Count: Longint; var Str: AnsiString): Integer; cdecl;
begin
Str := 'BLACKFIRE';
Result := -10;
ShowMsg('[MyFunc2] : Count = ' + IntToStr(Count));
end;

procedure MyFunc3(const Str1, Str2: WideString); cdecl;
begin
ShowMsg('[MyFunc3] : Str1 = ' + Str1 + ', Str2 = ' + Str2);
end;

exports MyFunc1, MyFunc2, MyFunc3;

begin
end.


I recommend you to use ChatGPT (https://chat.openai.com/) or Bing Ai (https://www.bing.com/search?form=MY0291&OCID=MY0291&q=Bing+AI&showconv=1) for this!

Masquerade
08-06-2023, 00:32
I recommend you to use ChatGPT (https://chat.openai.com/) or Bing Ai (https://www.bing.com/search?form=MY0291&OCID=MY0291&q=Bing+AI&showconv=1) for this!

ChatGPT is notoriously bad at writing complicated code. Sure, it can write simple algorithms, I use it sometimes to write quick scripts for making my repacks, but anything beyond this it usually gets the syntax wrong or the program will not work.

Junior53
08-06-2023, 03:03
ChatGPT is notoriously bad at writing complicated code. Sure, it can write simple algorithms, I use it sometimes to write quick scripts for making my repacks, but anything beyond this it usually gets the syntax wrong or the program will not work.
Actually, I told him to use it because he can get an simple idea of ​​how to do this.

Junior53
23-06-2023, 09:14
01.how to show Component Page before the Select Dir Page (without creating custom forms or anything like that) in Inno setup 5.5.1 ee2 version?

02.how to calculate the required disk space based on the components selected and show in gigabyte on Component page in Inno setup 5.5.1 ee2 version?

I actually found an answer to this. But it doesn't work. If someone gives an answer to these two, it will be a great help <3


var
Component1Size: Extended;
Component2Size: Extended;
// Add variables for each component as needed

procedure InitializeWizard;
begin
Component1Size := 1048576;
Component2Size := 2097152;
// Assign sizes for other components if needed
end;

function GetTotalSize: String;
var
TotalSize: Extended;
begin
TotalSize := 0;
if WizardForm.ComponentsList.Checked[0] then
TotalSize := TotalSize + Component1Size;
if WizardForm.ComponentsList.Checked[1] then
TotalSize := TotalSize + Component2Size;
// Add similar lines for other components if needed

Result := FormatFloat('#,##0.00', TotalSize / 1024 / 1024 / 1024); // Convert bytes to gigabytes
end;

procedure ComponentsPageOnNextButtonClick(Sender: TWizardPage; var Continue: Boolean);
begin
if Sender.ID = wpSelectComponents then
WizardForm.DiskSpaceLabel.Caption := 'Required disk space: ' + GetTotalSize + ' GB';
end;

-tara
15-07-2023, 07:19
Hello everybody,
I'm using IsArcEx for FreeArc archive decompression and I am attempting to apply a hdiffz patch after install, here is how I'm doing so:

procedure patching;
var
ResultCode: Integer;
begin
Exec(ExpandConstant('{tmp}\hpatchz.exe'), (ExpandConstant('{app}\...\file.one {app}\...\file.two {app}\...\file.three')), (ExpandConstant('{app}')), SW_SHOW, ewWaitUntilTerminated, ResultCode)

DeleteFile (ExpandConstant('{app}\...\file.one'));
DeleteFile (ExpandConstant('{app}\...\file.two'));
end;

Where patching is refrenced:
if (ISArcDiskAddingSuccess) and ISArcExInit(MainForm.Handle, {#TimeFormat}, @ProgressCallback) then
begin
repeat
if ISArcExDiskCount = 0 then begin
MsgBox('There is no any archive found for unpacking.', mbError, MB_OK);
break;
end;

ChangeLanguage('English');
//ChangeLanguage('Russian');

for i := 1 to ISArcExDiskCount do begin
ISArcExError := not ISArcExExtract(i, ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}'));
if ISArcExError then break;
end;
until true;
patching();
ISArcExStop;

if ISArcExError then
MsgBox('Installation is corrupted.', mbError, MB_OK)
end;

HideControls;
WizardForm.CancelButton.Visible := true;
WizardForm.CancelButton.Enabled := false;
end;

However, what ends up happening is the patch does not apply and after decompression the timer immediately ends.
What I would like to happen is the timer continuing and after the patch is applied for it to end. Thanks in advance

-tara
16-07-2023, 08:04
audiofeel, How would I achieve this without utilizing FMXInno.dll?

-tara
16-07-2023, 13:30
Quick update.
What I was doing was using absolute paths instead of using relative ones, this lead the patch to attempt to execute but it would lead to an error.
The way I fixed it, if anyone encounters this issue in the future was to copy the necessary files to {app} and run with relative paths there.

Lord.Freddy
22-07-2023, 13:09
Hello everyone, I am trying to implement the function (SelectDisk) that is available in (InnoSetup) 6, so I wrote the code that is in the (zip) file below, but after execution

1: If I click on the (OK) button and if the requested file is not there, it should give me an error, but it ignores this.

2: If I click on the (cancel) button, it should show me the exit message box, but it ignores it.

I will be glad if someone can fix the problems of this code :)

Cesar82
22-07-2023, 18:37
Hello everyone, I am trying to implement the function (SelectDisk) that is available in (InnoSetup) 6, so I wrote the code that is in the (zip) file below, but after execution

1: If I click on the (OK) button and if the requested file is not there, it should give me an error, but it ignores this.

2: If I click on the (cancel) button, it should show me the exit message box, but it ignores it.

I will be glad if someone can fix the problems of this code :)

The functions "TNewDiskForm.OnCloseQuery " or "TNewDiskForm.OnClose" are called before returning a ShowModal value.
I recommend putting OnClick procedures for the "OK" and "Cancel" buttons and putting your functions there, then you can set the values of the global variable "ModalResult".

Tmills
06-08-2023, 03:29
Hey, I'm a new member and joined yesterday. I am a complete noob but have learned a lot reading through this forum in just one day. I am currently using ASIS: Advanced Simple Installer Script and want to change the background JPG slideshow to a GIF image. I have found GifLib.dll but do not know how to adjust the script code and wondered if someone with know-how can do this for me or show me what needs changing. I have no coding experience, but I learn pretty quick, I'm a visual learner.

I have put the GifLib.dll in ASIS.v7.4.4\Resources\Modules\InstallBG folder

i have found the following lines in the script that I'm assuming need changing:

#if UseInstallBackground
Source: "Resources\Modules\InstallBG\InnoCallback.dll"; DestDir: "{tmp}"; Flags: dontcopy
Source: "Resources\Modules\InstallBG\IsSlideShow.dll"; DestDir: "{tmp}"; Flags: dontcopy
#sub AddFile2
Source: "Setup\Background\{#i}.jpg"; DestDir: "{tmp}"; Flags: dontcopy
#endsub
#for {i = 1; FileExists("Setup\Background" + Str(i) + ".jpg" ) != 0; i++} AddFile2
#endif

Any help appreciated.

Dragonis40
17-09-2023, 04:05
function GetVolumeFreeSpace(const RootDir: PAnsichar; const OutSizeType: Byte): Double; external 'GetVolumeFreeSpace@files:Isab.dll stdcall delayload';

Good morning, how to extract the value from the function above?

I've tried:

value.Caption:=StrToInt(GetVolumeFreeSpace);
value.Caption:=FloatToStr(GetVolumeFreeSpace);
value.Caption:=StrToFloat(GetVolumeFreeSpace);

I have "invalid parameters" issue.

How can i fix the problem? Thanks in advance!

Lord.Freddy
17-09-2023, 04:59
function GetVolumeFreeSpace(const RootDir: PAnsichar; const OutSizeType: Byte): Double; external 'GetVolumeFreeSpace@files:Isab.dll stdcall delayload';

Good morning, how to extract the value from the function above?

I've tried:

value.Caption:=StrToInt(GetVolumeFreeSpace);
value.Caption:=FloatToStr(GetVolumeFreeSpace);
value.Caption:=StrToFloat(GetVolumeFreeSpace);

I have "invalid parameters" issue.

How can i fix the problem? Thanks in advance!

if you want to get free and total bytes or megabytes on a drive,
Use this function (https://jrsoftware.org/ishelp/index.php?topic=isxfunc_getspaceondisk) instead.

shazzla
23-09-2023, 00:10
hi !

Need a little help here... I tried many combinations ,googled for it ,but no solution. (Standard ISDone)

I want to include/extract some files (XTool-BIK compressor) in my installer and extract them to a sub-folder in {tmp} but the subfolder is not created. Simply all files extracted to the same place ( {tmp} ) ,and it is not good....

Here comes a snippet :

#ifdef xBIK
Source: Include\XToolbpk\_libraries\bik.ini; DestDir: "{tmp}\xBIK\_libraries"; Flags: dontcopy recursesubdirs createallsubdirs
Source: Include\XToolbpk\_libraries\bk2.ini; DestDir: "{tmp}\xBIK\_libraries"; Flags: dontcopy recursesubdirs createallsubdirs
.......


#ifdef xBIK
ExtractTemporaryFile('bik.ini');
ExtractTemporaryFile('bk2.ini');


Whats wrong with my script ?

shazzla
23-09-2023, 08:51
Thanks,but it only creates folders.
How to implement it in my script? (Above)
(Atm im away from my comp,btw tomorrow will try something with it)

shazzla
24-09-2023, 00:09
tried. i still cant extract the files there.. ( {tmp}\xBIK )

Any solution ? Anyone ?

Junior53
29-09-2023, 16:53
01.how to show Component Page before the Select Dir Page (without creating custom forms or anything like that) in Inno setup 5.5.1 ee2 version?

02.how to calculate the required disk space based on the components selected and show in gigabyte on Component page in Inno setup 5.5.1 ee2 version?

I actually found an answer to this. But it doesn't work. If someone gives an answer to these two, it will be a great help <3


var
Component1Size: Extended;
Component2Size: Extended;
// Add variables for each component as needed

procedure InitializeWizard;
begin
Component1Size := 1048576;
Component2Size := 2097152;
// Assign sizes for other components if needed
end;

function GetTotalSize: String;
var
TotalSize: Extended;
begin
TotalSize := 0;
if WizardForm.ComponentsList.Checked[0] then
TotalSize := TotalSize + Component1Size;
if WizardForm.ComponentsList.Checked[1] then
TotalSize := TotalSize + Component2Size;
// Add similar lines for other components if needed

Result := FormatFloat('#,##0.00', TotalSize / 1024 / 1024 / 1024); // Convert bytes to gigabytes
end;

procedure ComponentsPageOnNextButtonClick(Sender: TWizardPage; var Continue: Boolean);
begin
if Sender.ID = wpSelectComponents then
WizardForm.DiskSpaceLabel.Caption := 'Required disk space: ' + GetTotalSize + ' GB';
end;

It's Actually 05:20 Am here in sri lanka :o and i finally found the answer (https://stackru.com/questions/47222099/kak-izmenit-poryadok-stranits-v-innosetup) to this :) LMAO

Lord.Freddy
27-06-2024, 00:09
Hello, yesterday I attempted to create a function in Inno Setup to gather file names and their respective sizes, but only a few files were returned. I am currently at a standstill and unsure of how to proceed. Does anyone know where i went wrong?

[Setup]
AppName=FindFiles
AppVerName=FindFiles
CreateAppDir=no
OutputDir=.\OutPut
OutputBaseFilename=FindFiles

[_Code]
type
TAutoString = {#defined(UNICODE) ? "Wide" : ""}String;
TFileList = array of record
FileName, FileSize: TAutoString;
end;

var
FileList: TFileList;

function Size64(const Hi, Lo: Integer): Extended;
begin
Result := Lo;
if (Lo < 0) then
Result := (Result + $7FFFFFFF + $7FFFFFFF + 2);
for Hi := (Hi - 1) downto 0 do
Result := (Result + $7FFFFFFF + $7FFFFFFF + 2);
end;

function FloatToStrEx(const value: Extended): TAutoString;
begin
Result := FloatToStr(value);
while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do
SetLength(Result, (Length(Result) - 1));
end;

function FindFilesEx(FolderPath: TAutoString; var FilesList, FileSize: array of TAutoString): Integer;
var
FindRec: TFindRec;
begin
Result := 0;
if FindFirst(ExpandConstant(AddBackslash(FolderPath)) + '*', FindRec) then
begin
repeat
if (FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0) or
(FindRec.Attributes and FILE_ATTRIBUTE_HIDDEN <> 0) then
begin
SetArrayLength(FilesList, Result + 1);
SetArrayLength(FileSize, Result + 1);
FilesList[GetArrayLength(FilesList) - 1] := ExpandConstant(AddBackslash(FolderPath)) + FindRec.Name;
FileSize[GetArrayLength(FileSize) - 1] := FloatToStrEx(Size64(FindRec.SizeHigh, FindRec.SizeLow));
Result := Result + 1;
end;
if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0 then
begin
if (FindRec.Name <> '.') and (FindRec.Name <> '..') then
Result := Result + FindFilesEx(AddBackslash(FolderPath) + FindRec.Name, FilesList, FileSize);
end;
until not FindNext(FindRec);
FindClose(FindRec);
end;
end;

procedure FindFiles(Dir: TAutoString; var FilesFound: Integer);
var
TotalFilesFound, Y, S: Integer;
FilesNameList, FileNameSize: array of TAutoString;
begin
TotalFilesFound := FindFilesEx(ExpandConstant(Dir), FilesNameList, FileNameSize);
FilesFound := TotalFilesFound;
for Y := 0 to totalFilesFound - 1 do
begin
SetArrayLength(FileList, GetArrayLength(FileList) + 1);
S := GetArrayLength(FileList) - 1;
with FileList[S] do
begin
FileList[S].FileName := FilesNameList[Y];
Delete(FileList[S].FileName, Pos(AddBackslash(Dir), FileList[S].FileName), Length(AddBackslash(Dir)));
FileList[S].FileSize := FileNameSize[Y];
end;
end;
end;

function InitializeSetup: Boolean;
var
TotalFilesFound, I: Integer;
Dir: TAutoString;
begin
Dir := ExpandConstant('{src}\..');
FindFiles(Dir, TotalFilesFound);
for I := 0 to GetArrayLength(FileList) - 1 do
begin
msgbox('FileName: ' + FileList[I].FileName + #13#10 + 'FileSize: ' + FileList[I].FileSize + ' bytes', mbInformation, MB_OK);
end;
Result := False;
end;


Update(solution):
I found a solution for the above code, which is as follows.

[Setup]
AppName=FindFiles
AppVerName=FindFiles
CreateAppDir=no
OutputDir=.\OutPut
OutputBaseFilename=FindFiles

[_Code]
type
TAutoString = {#defined(UNICODE) ? "Wide" : ""}String;
TFileList = array of record
FileName, FileExt, FileSize, FilePath: TAutoString;
end;

function Size64(const Hi, Lo: Integer): Extended;
begin
Result := Lo;
if (Lo < 0) then
Result := (Result + $7FFFFFFF + $7FFFFFFF + 2);
for Hi := (Hi - 1) downto 0 do
Result := (Result + $7FFFFFFF + $7FFFFFFF + 2);
end;

function FloatToStrEx(const value: Extended): TAutoString;
begin
Result := FloatToStr(value);
while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do
SetLength(Result, (Length(Result) - 1));
end;

function pFindFiles(const BaseDir, DestDir, FileMask: TAutoString; var OutFileList: TFileList): Integer;
var
FSR, DSR: TFindRec;
FindResult: Boolean;
APath: TAutoString;
nCount: Integer;
begin
APath := ExpandConstant(AddBackslash(DestDir));
FindResult := FindFirst(APath + '*.*', DSR);
try
while FindResult do
begin
if ((DSR.Attributes and FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY) and not ((DSR.Name = '.') or (DSR.Name = '..')) then
begin
pFindFiles(BaseDir, APath + DSR.Name, FileMask, OutFileList);
end;
FindResult := FindNext(DSR);
end;

FindResult := FindFirst(APath + FileMask, FSR);

while FindResult do
begin
if (FSR.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0) then
begin
SetArrayLength(OutFileList, GetArrayLength(OutFileList) + 1);
OutFileList[GetArrayLength(OutFileList) - 1].FileName := FSR.Name;
OutFileList[GetArrayLength(OutFileList) - 1].FileExt := ExtractFileExt(FSR.Name);
OutFileList[GetArrayLength(OutFileList) - 1].FileSize := FloatToStrEx(Size64(FSR.SizeHigh, FSR.SizeLow));
OutFileList[GetArrayLength(OutFileList) - 1].FilePath := ExtractFilePath(ExtractRelativePath(AddBackslash(B aseDir), APath + FSR.Name));
nCount := nCount + 1;
end;
FindResult := FindNext(FSR);
end;
finally
FindClose(FSR);
FindClose(DSR);
end;
Result := nCount;
end;

function InitializeSetup: Boolean;
var
TotalFilesFound, I: Integer;
Dir: TAutoString;
FileList: TFileList;
OutList: TAutoString;
begin
Dir := ExpandConstant('{src}\..');
TotalFilesFound := pFindFiles(Dir, Dir, '*.*', FileList);
for I := 0 to GetArrayLength(FileList) - 1 do
begin
OutList := OutList + 'FileName: ' + FileList[I].FileName + #13#10 + 'FileSize: ' + FileList[I].FileSize + ' bytes' + #13#10 + 'FileExt: ' + FileList[I].FileExt + #13#10 + 'FilePath: ' + FileList[I].FilePath + #13#10 + #13#10;
end;
msgbox(OutList, mbInformation, MB_OK);
Result := False;
end;

demon964
11-07-2024, 03:23
Root: "HKLM"; Subkey: "SOFTWARE\Wow6432Node\KONAMI\PES2013"; ValueType: string; ValueName: "installdir"; ValueData: "{app}{#MyAppExeName}"; Flags: uninsdeletekey

I added this code to my script, but it duplicates Wow6432Node the folder in regedit.

It should be: SOFTWARE\Wow6432Node\KONAMI\PES2013

But it shows: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Wow6432Nod e\KONAMI\PES2013

jakepaulie
29-11-2024, 09:51
Hello, i have a problem. When i want to do some repacks it normaly works. But when i want to start the wizard the problem starts. It Normally installs, But not really... It just corrupts the file. Please help me with it