InnoSetup module for Observer

Here you can discuss about your favorite plug-in.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

InnoSetup module for Observer

Post by pepak »

Here you can download an InnoSetup module for the Observer plugin. The module is based on InnoUnp 0.48, which I had to modify quite a lot to make it usable in FAR. Both the updated InnoUnp and the InnoUnp Module should be considered an extreme alpha, as I only performed minimal testing. But it seems to work reasonably well.

Download
InnoUnp v0.50.3 + Observer 1.12.0 - Source + Binaries

Installation
  1. From the archive, copy bin\innounp.x86.so (for 32bit FAR) or bin\innounp.x64.so (for 64bit FAR) to %FARHOME%\Plugins\Observer\Modules.
  2. In %FARHOME%\Plugins\Observer\observer.ini:
    1. In the Modules section, add the following line:

      Code: Select all

      Inno=modules\innounp.x86.so
      (for 32bit version)

      Code: Select all

      Inno=modules\innounp.x64.so
      (for 64bit version)
    2. In the Filters section, add the following line:

      Code: Select all

      Inno=*.exe
  3. Restart FAR.
  4. Press CTRL+PgDown on an InnoSetup file to open it.
Compatibility
The module is compatible with all versions of Observer. At least, it should be - I only tested it for FAR3, but there isn't really anything that could cause trouble with previous versions of FAR. 64bit versions are supported since version 0.47.2, but should not be considered reliable without extensive testing as the changes needed for them were rather horrific. Note that Observer 1.12 changed the structure of its plugins so a different version of the plugin is needed.

License
Same as InnoUnp, which is, I believe, GPL (oh well). If Ariman wants to incorporate my changes into InnoUnp, I would welcome it.

Changes made to InnoUnp
  • Compatibility with Unicode Delphi (tested with Delphi XE2). Non-unicode Delphi still works, too (tested with Delphi 7).
  • Since version 0.48.0, all builds produce the same output, using UTF8. The original InnoUnp creates a different input depending on whether the installer itself was unicode or not.
  • Support for x64 builds (with Delphi XE6+).
  • No more global variables for non-shared stuff. Some global variables remain, but they are not activelly accessed by the current code.
  • Proper dealocation of allocated structures. The original InnoUnp leaked horribly - strings didn't get deallocated, even though they are reference-counted (the nasty use of structures accounted for that).
  • I provided a standalone class for InnoSetup file handling. That way you can easily use InnoUnp in your own software (e.g. Observer modules).
  • Much simplified build environment.
  • All this was made while keeping the original code as much as possible. For this reason the code tends to be difficult to read and unnecessarily complex (see the TInnoSetupFile.Extract function, or the runtime variables which are split among TMainInfo and TInnoSetupFile).
Known issues
  • The code should be treated with caution. I did only a very limited testing with limited InnoSetup files. If your life or well-being depends on properly extracting InnoSetup archives, do perform some major testing before using my module!
  • A few memory leaks remain. I know where FastMM4 tells me they originate, but I couldn't find the cause. It should not present a problem unless you plan to extract thousands of setups without restarting FAR, though.
  • Once the modification gets properly tested, I would strongly recommend rewriting it from its current records-and-pointers-based structure to standard class structure. I can understand why InnoSetup wants to use records (it keeps the size small, which is quite useful in a setup-building program), but that is irrelevant to InnoUnp - and with my modifications, InnoUnp is quite far away from InnoSetup, anyway, so why stick to its philosophy?
  • It would be, IMHO, quite useful if Observer introduced a new API which would allow to e.g. return textual description of errors, so that the user could get a more detailed reason for failure than, basically, "error reading archive".
I hope you like this module. I would welcome any suggestions you might have, provided they are not requests for 64bit support :-)

Old downloads
Last edited by pepak on Sun 12 Mar, 2023 11:41, edited 15 times in total.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

InnoSetup module for Observer

Post by pepak »

Released the updated plugin:

1) Updated to InnoUnp v0.45 sources.
2) Updated to Observer v1.11.0.
Ariman
Posts: 1351
Joined: Fri 30 Nov, 2007 15:32
Location: Крым
Has thanked: 15 times
Been thanked: 50 times
Contact:

InnoSetup module for Observer

Post by Ariman »

Tested the module and noticed one strange thing - folder 'embedded' contains only one file 'uninstall.exe' which has size = 0, all other files that should be there are missing.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

InnoSetup module for Observer

Post by pepak »

The same thing happens with the official InnoUnp.exe. Presumably, that's because "extract embedded" is off by default. Will change that for the InnoUnp module. Not sure if it will help with the missing files, but as I was able to simulate the situation, I hope I will be able to find and fix the cause.
Ariman
Posts: 1351
Joined: Fri 30 Nov, 2007 15:32
Location: Крым
Has thanked: 15 times
Been thanked: 50 times
Contact:

InnoSetup module for Observer

Post by Ariman »

Yes. Embedded files are off by default. You have to specify -m switch to see them. Module have no command line so I guess it is better to add them by default. Or you can use Observer's config file if you want to give users more control for this option.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

InnoSetup module for Observer

Post by pepak »

Activated both extraction of embedded files (-m) and extraction of all copies (-a).
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

InnoSetup module for Observer

Post by pepak »

Updated the plugin to InnoUnp v0.46
Source + Binaries
User avatar
HaRT
Moderator
Posts: 10806
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 220 times
Been thanked: 357 times

InnoSetup module for Observer

Post by HaRT »

pepak, thank you for the module!
How can one build it? I tried hard but failed to find any instruction either in the package or on SourceForge.
I'd like to add the AppId property to the install script (because Ariman seems too busy).
I tried using both Delphi (10.2 Starter) and Lazarus (1.8.2) but I always get an error like [dcc32 Fatal Error] StructJoin.pas(4): F1026 File not found: 'StructList.inc' (and removing that directive causes other errors). I only see the StructList file with lots of numbers in it. Should some preprocessing/code-generation happen? Please help.

23:05 MSK
Looked even closer, found prep.bat (what an unintuitive name for the build entry-point script!), built something successfully. But it's 1.5 times larger even in Release and exports a few extra symbols. Also, it doesn't have the correct VERSIONINFO on the DLL… What am I missing?
Last edited by HaRT on Tue 06 Mar, 2018 20:36, edited 1 time in total.
Reason: Added a paragraph on prep.bat
Фар есть инструмент, а не нянька. © 2009 DrKnS
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

InnoSetup module for Observer

Post by pepak »

Yeah, you need to run prep.bat. I kept that from Ariman's code. Plus a few more. A correct sequence for Delphi XE2 is:

Code: Select all

clean.bat
prep.bat
dcc32.exe -NSSystem;WinApi innounp.dpr
brcc.exe innounp_observer.rc
dcc32.exe -NSSystem;WinApi innounp_observer.dpr
That works even for Delphi 10.1, the newest I have. With versions older than XE2, remove the -NS switches.

As for size, it depends on the version of Delphi. The newer Delphi tend to generate larger code, often a lot larger. FreePascal tends to generate even larger code. In my tests, Delphi 10.1 version is indeed about 1.7 MB while the XE2 version is only 1.1 MB. Delphi 7 version is 700 KB, except that apparently in the Unicode rewrite I forgot to write a CharInSet function for it so it won't compile (but it can be modified easily - change CharInSet(A, B) into (A in B)). You hsould use the oldest possible version of Delphi you can, as the original code is intended for Delphi 2 and tends to have unexpected behavior in newer Delphi; I tried to fix all of these gotchas as much as I could, but I am not willing to state that I solved everything.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

InnoSetup module for Observer

Post by pepak »

https://www.pepak.net/files/far/innounp-0.47-mod.zip
  • Updated to InnoUnp v0.47.
  • Fixed non-working -m (extract embedded) switch in InnoUnp.exe.
  • Fixed incorrect encoding of some embedded files (e.g. license.txt) when extracted using InnoUnp compiled with unicode Delphi.
  • Fixed compilation with Delphi 7.
The building from sources is now much simplified, simply run build, build observer or build-all and you are done. For all versions of Delphi starting with 7 up to 10.1 Berlin.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

InnoSetup module for Observer

Post by pepak »

http://www.pepak.net/files/far/innounp-0.47.2-mod.zip
  • Support for a 64bit build. That means that the plugin can now be used with 64bit versions of FAR.
Note that the 64bit code required major rewrite of many parts of InnoUnp. While I did a limited testing with various versions of InnoSetup and various compression algorithms, the changes are prone to problems. Unfortunately, I don't see any way around that, 64bit Delphi introduce incompatibilities which affect InnoUnp very significantly.
Ariman
Posts: 1351
Joined: Fri 30 Nov, 2007 15:32
Location: Крым
Has thanked: 15 times
Been thanked: 50 times
Contact:

InnoSetup module for Observer

Post by Ariman »

I've noticed minor issue. Reconstructed script have some strange symbols at the start for unicode installers. Innounp adds UTF-8 BOM there but your module adds something else. Is it intended behavior or a bug?
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

InnoSetup module for Observer

Post by pepak »

That is certainly not intended. Probably a bug in the Unicodification code from the earlier versions, because the x64 changes should not influence this. If you have a sample installer, I will gladly take a look at that. I have never actually encountered a Unicode installer before.
Ariman
Posts: 1351
Joined: Fri 30 Nov, 2007 15:32
Location: Крым
Has thanked: 15 times
Been thanked: 50 times
Contact:

InnoSetup module for Observer

Post by Ariman »

You can use vanilla InnoSetup installer from http://www.jrsoftware.org/isdl.php
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

InnoSetup module for Observer

Post by pepak »

I tried version 5.6.1, in both Unicode and ANSI, and both in x86 and x64, and both seem perfectly fine. What exactly do you get that is not correct?
Post Reply

Return to “General Plug-In Discussions”