Go Back   FileForums > Game Backup > PC Games > PC Games - CD/DVD Conversions > Conversion Tutorials

Reply
 
Thread Tools Display Modes
  #1546  
Old 18-05-2023, 05:02
shazzla shazzla is offline
Registered User
 
Join Date: Nov 2010
Location: Hunnia
Posts: 269
Thanks: 486
Thanked 94 Times in 71 Posts
shazzla is on a distinguished road
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.)
Reply With Quote
Sponsored Links
  #1547  
Old 18-05-2023, 06:51
Cesar82's Avatar
Cesar82 Cesar82 is offline
Registered User
 
Join Date: May 2011
Location: Brazil
Posts: 936
Thanks: 1,571
Thanked 2,058 Times in 692 Posts
Cesar82 is on a distinguished road
Quote:
Originally Posted by shazzla View Post
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
Code:
DefaultDirName={reg:HKLM\SOFTWARE\Microsoft\Windows\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.

Last edited by Cesar82; 18-05-2023 at 07:01.
Reply With Quote
The Following User Says Thank You to Cesar82 For This Useful Post:
shazzla (19-05-2023)
  #1548  
Old 18-05-2023, 21:13
shazzla shazzla is offline
Registered User
 
Join Date: Nov 2010
Location: Hunnia
Posts: 269
Thanks: 486
Thanked 94 Times in 71 Posts
shazzla is on a distinguished road
Thank you very much!
I will try and report back ASAP !

Its working fine !
Thanks !

Last edited by shazzla; 19-05-2023 at 02:35.
Reply With Quote
  #1549  
Old 07-06-2023, 17:44
Junior53's Avatar
Junior53 Junior53 is offline
Registered User
 
Join Date: May 2023
Location: Sri Lanka
Posts: 23
Thanks: 21
Thanked 21 Times in 8 Posts
Junior53 is on a distinguished road
Thumbs up

Quote:
Originally Posted by BLACKFIRE69 View Post
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.

Code:
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;
Code:
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;


Code:
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 or Bing Ai for this!
Reply With Quote
  #1550  
Old 08-06-2023, 00:32
Masquerade's Avatar
Masquerade Masquerade is offline
Registered User
 
Join Date: Jan 2020
Location: Monte d'Or
Posts: 1,051
Thanks: 270
Thanked 1,199 Times in 562 Posts
Masquerade is on a distinguished road
Quote:
Originally Posted by Junior53 View Post
I recommend you to use ChatGPT or Bing Ai 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.
Reply With Quote
  #1551  
Old 08-06-2023, 03:03
Junior53's Avatar
Junior53 Junior53 is offline
Registered User
 
Join Date: May 2023
Location: Sri Lanka
Posts: 23
Thanks: 21
Thanked 21 Times in 8 Posts
Junior53 is on a distinguished road
Lightbulb

Quote:
Originally Posted by Masquerade View Post
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.
Reply With Quote
  #1552  
Old 23-06-2023, 09:14
Junior53's Avatar
Junior53 Junior53 is offline
Registered User
 
Join Date: May 2023
Location: Sri Lanka
Posts: 23
Thanks: 21
Thanked 21 Times in 8 Posts
Junior53 is on a distinguished road
Question Question's

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

Code:
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;
Reply With Quote
  #1553  
Old 15-07-2023, 07:19
-tara -tara is offline
Registered User
 
Join Date: May 2022
Location: Asda
Posts: 10
Thanks: 6
Thanked 7 Times in 3 Posts
-tara is on a distinguished road
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:

Code:
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:
Code:
    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
Reply With Quote
  #1554  
Old 16-07-2023, 07:08
audiofeel's Avatar
audiofeel audiofeel is offline
Registered User
 
Join Date: Jan 2013
Location: USSR
Posts: 216
Thanks: 263
Thanked 347 Times in 159 Posts
audiofeel is on a distinguished road
Quote:
Originally Posted by -tara View Post
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:

Code:
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:
Code:
    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
View in the module FMXInnoHandle.is on Mr. BLACKFIRE 69 offered two functions and procedur...
Code:
procedure wCreateFilePatch(Const fOldFile, fNewFile, fDiffFile: WideString; fMatchLength: Cardinal; fPatchCallback: TFDiffCallback);
  external 'wCreateFilePatch@files:FMXInno.dll stdcall delayload';
procedure wApplyFilePatch(Const fOldFile, fNewFile, fDiffFile: WideString);
  external 'wApplyFilePatch@files:FMXInno.dll stdcall delayload';
There is an example in the WPI_Core Pack.iss script.
Code:
    #ifdef Patch1
    if FileExists(ExpandConstant('{#P1[59]}')) and FileExists(ExpandConstant('{#P1[61]}')) then begin
      wApplyFilePatch(ExpandConstant('{#P1[59]}'), ExpandConstant('{#P1[60]}'), ExpandConstant('{#P1[61]}'));
      #if P1[62] == "1"
      DeleteFile(ExpandConstant('{#P1[59]}')); DeleteFile(ExpandConstant('{#P1[61]}'));
      #endif
    end;
    #endif
__________________
https://steamcommunity.com/id/LiLBabushka

Last edited by audiofeel; 16-07-2023 at 07:10.
Reply With Quote
  #1555  
Old 16-07-2023, 08:04
-tara -tara is offline
Registered User
 
Join Date: May 2022
Location: Asda
Posts: 10
Thanks: 6
Thanked 7 Times in 3 Posts
-tara is on a distinguished road
audiofeel, How would I achieve this without utilizing FMXInno.dll?
Reply With Quote
  #1556  
Old 16-07-2023, 13:30
-tara -tara is offline
Registered User
 
Join Date: May 2022
Location: Asda
Posts: 10
Thanks: 6
Thanked 7 Times in 3 Posts
-tara is on a distinguished road
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.
Reply With Quote
  #1557  
Old 22-07-2023, 13:09
Lord.Freddy's Avatar
Lord.Freddy Lord.Freddy is offline
Registered User
 
Join Date: Apr 2022
Location: In Forest
Posts: 31
Thanks: 80
Thanked 21 Times in 15 Posts
Lord.Freddy is on a distinguished road
Post SelectDisk

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
Attached Files
File Type: zip SelectDisk Fun.zip (4.2 KB, 2 views)
__________________
Life good be a Dream

Last edited by Lord.Freddy; 22-07-2023 at 13:14.
Reply With Quote
  #1558  
Old 22-07-2023, 18:37
Cesar82's Avatar
Cesar82 Cesar82 is offline
Registered User
 
Join Date: May 2011
Location: Brazil
Posts: 936
Thanks: 1,571
Thanked 2,058 Times in 692 Posts
Cesar82 is on a distinguished road
Quote:
Originally Posted by Lord.Freddy View Post
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".
Attached Files
File Type: 7z SelectDisk.7z (2.2 KB, 4 views)
Reply With Quote
The Following 2 Users Say Thank You to Cesar82 For This Useful Post:
audiofeel (23-07-2023), Lord.Freddy (22-07-2023)
  #1559  
Old 06-08-2023, 03:29
Tmills Tmills is offline
Registered User
 
Join Date: Aug 2023
Location: UK
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Tmills is on a distinguished road
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.
Reply With Quote
  #1560  
Old 17-09-2023, 04:05
Dragonis40 Dragonis40 is offline
Registered User
 
Join Date: Mar 2021
Location: italy
Posts: 49
Thanks: 0
Thanked 1 Time in 1 Post
Dragonis40 is on a distinguished road
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!

Last edited by Dragonis40; 17-09-2023 at 04:22.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
INNO TROUBLESHOOT - Tutorials and Answers about INNO Setup REV0 Conversion Tutorials 129 21-05-2021 05:51
INNO TUTORIAL - Using Unicode and ANSI Versions of INNO Setup REV0 Conversion Tutorials 51 26-03-2015 06:57
Frequently Asked Questions Joe Forster/STA PC Games - Frequently Asked Questions 0 29-11-2005 09:48



All times are GMT -7. The time now is 13:28.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2000-2020, FileForums @ https://fileforums.com