install4j: Extract application JARs from a Windows installer - install4j

We are looking for an approach to extract our application JARs and resources from an EXE installer built with install4j. We are trying to automate installers testing though without actual installation - we want to run our application main JAR unpacked from an installer.
With help of PE file format parser https://github.com/kichik/pecoff4j I've found the major part of content is placed in some kind of preamble of an image. The same entry with the same size is shown when I opened the installer in 7-Zip:
But the format of the entry is unknown to 7-Zip and I can't to go deeper. When I opened the entry in a hex editor I found some of the application resources content, classes names, etc.
The question is - what is a format of the entry and how can I parse it?
P.S.: It seems there should be no issues with DMG for Apple and SH for Linux - as they are regular archives and I hope I can read them in my Java code.

This is not a documented format, it is internal to the installer. You could build an additional Windows ZIP archive media file and extract that. It will have the same contents as the installer.

Related

LNK1104 when using MASM 64bit

I'm currently trying to learn Assembly for x64 Windows. I tried the example code from this Intel website,
but whenever I try to compile it with the command given in the document:
ml64 hello.asm /link /subsystem:windows /defaultlib:kernel32.lib /defaultlib:user32.lib /entry:Start
I always get an
LNK1104 error
I know that it means the compiler can't find the library file, I googled the problem and quickly found that I need Visual Studio with Windows SDK, which I downloaded and installed. But still can't find a kernel32.lib or user32.lib in any files other than the Windows system files.
I tried everything and I simply can't fix it. I hope someone could help figure this out.
There is a well-known MASM32 SDK available created by hutch--. This package contains the requested libraries in a (legacy) 32-bit version.
But there is also a 64-bit update of that famous package by hutch--:
Current build of the 64 bit MASM SDK.
It should contain the .inc and .lib files you need and more...
This is the current build of the 64 bit MASM SDK. This one is a lot closer to complete and with the correct Microsoft binaries added to it, it is capable of building a wide array of application types. It can be use in 2 different ways, it should be unzipped from the root directory of the partition that it is being installed on. You can either manually add it to an installation of the MASM32 SDK OR you can install it on a partition that does not have MASM32 on it and simply rename the buildx64 directory to MASM32. Installing it on another partition is the preferred technique as QE has its menus and accessories set up for building 64 bit code.
You still need to add the Microsoft binaries which would typically be from an installation of vs2017 or from an earlier version for Win7 64. In the bin64 directory there is a file called "Microsoft_File_List.txt" which shows the files you need. The list is from the current version of Visual Studio 2017 version and if this is the version you have, use the ML64 from the "x86_amd64" directory that is 402,584 bytes in size.
In the "buildx64" directory is a batch file called "makeall.bat". This must be run to build all of the libraries and include files.
They are the gold standard of Windows assembly developing.

Install software using command prompt start command with target directory

I am trying to install software using command prompt using below command
start /wait /d "C:\abc" C:\Users\abc.exe /silent /norestart
I want to install software in c:\abc folder but it is installing in the software default directory. Is there any way to install it into the custom directory using the start command or are there any other alternatives to install the software on the target directory.
SHORT VERSION:
This may be the most "accessible" and "quick" explanation for your particular case: http://unattended.sourceforge.net/installers.php
If you are dealing with an MSI file, you should use the admin install feature to extract all the installation files first and then customize your install by setting public properties or utilizing a transform to configure the install. Details here: How to make better use of MSI files.
See the link towards the bottom to find a list of different parameters you can use for different types of setup.exe files.
DETAILS:
A setup.exe file can be "anything". It can be an old, legacy Installshield or Wise installer, a modern Windows Installer file (MSI) embedded in a setup.exe launcher, an Inno setup file (non MSI), an embedded Advanced Installer MSI setup, a compressed and self-extracting zip file, a unique and custom made installer (proprietary), or any number of other technologies, the list goes on and on and on - it is impossible to tell what tool or technology was used to create your setup.exe from the information supplied.
Just for reference, let's link to installsite.org's information on different setup technologies and available tools. Most likely your setup.exe is made using one of these tools:
Non-MSI installer tools: http://www.installsite.org/pages/en/tt_nonmsi.htm
Windows installer tools: http://www.installsite.org/pages/en/msi/authoring.htm
This may also be of help: Wix - How to run/install application without UI.
The point is, naturally, that every, different technology has its own way to enable silent installation and to customize installation parameters. So the first step for you is to determine what this file really is. Right click the file, select properties and check the details tab for any clues. Or just run the setup.exe interactively and see what the window title is (top window title bar). It will generally indicate what tool was used to create the setup.exe.
Rather than rewriting it all, and since it is a stackoverflow link (unlikely to be removed), I will just link to a similar answer on how to install setup.exe files silently: How can I use powershell to run through an installer?. See the "some links" section for links to documentation for various tools.

JavaFX exe bundling for x86 windows systems

usually I deploy my Java apps as a bundle which contains the JVM, so there's no need to install a JVM on the system.
Btw: This is no jnlp applet, this is a normal Swing Application.
I did this using ant's fx:deploy. This already works for 64bit systems.
My problem is, that I want to deploy this application to a 32bit system and don't get it to work.
Here's what I did:
I've set up a clean Windows 7 (32bit) instance and installed a 32bit JVM. Now i ran my ant script to build a bundled Java app and it built a App.exe.
But when I tried to start this exe by double clicking, I get the following message box
If I click OK, I get another message box
After this the app is terminated.
I did not find anything searching the web relating to bundling for 32/64 bit systems.
So I would be very glad if someone can point me in the right direction.
Many thanks in advance!
Greetings, -chris-
Looks like a known bug fixed for an upcoming JavaFX version (currently known as 2.2.40):
RT-25715 The Windows launcher generated by the packager fails to load msvcr100.dll on 32-bit OS
RT-22610 .exe created by fx:deploy can't be executed due to missing msvcr100.dll
On the bug case, the user mentions a work-around:
If I give a try to the workaround documented in RT-22610, which is to copy runtime\jre\bin\msvcr100.dll side to my application's launcher binary, it fixes it.
I think the bug is fixed in JDK 8, so another possible work-around is to download a JDK 8 early access release and use the packaging tools from there to package a Java 7 application (though I have never tried that and am not sure if it would work).
Just a small modification to #jewelsea's Fix:
copying msvcr100.dll into the app/ folder instead putting it right next to the exe also works, and at least it is somewhat hidden away then.
If you're generating an MSI you can hack the WXS file used by WIX to automatically copy msvcr100.dll into the app folder. Making FX Deploy verbose will tell you where it's putting the temporary WXS file you can copy and modify and use to override the WXS like you would the program icon for example.

Low footprint download/installation program

I run an open source project that normally distributes our code in a universal zip format. In addition to the core software, we also have several community developed add-ons for the software.
Rather that getting the user to download all of the options from disparate locations and websites, I'd like to provide a small footprint installer that would
Download and install java as needed. If the user is on 64bit OS, it would need to download both 32 and 64 bit.
Download and unpack the core software zip file
Allow the user to choose the latest stable version or the development version (two different websites)
Choose the additional software options (multiple options)
Download each one individually (different websites)
Unpack/Install as necessary
Write configuration files (plain text)
Clean up directory as needed depending on the configuration options.
E.g. if I select optional software "1", delete directory "X"
I don't necessarily want to provide all of those additional software options in the core installation file (in fact, if I could just provide an installation program with a small footprint that could determine the latest versions of all the available software (probably have to screen scrape some websites, others might provide a text file with the version number in it)
Is Install4j suitable for this?
I know that I would have to write some code to do the version identification, but mostly I want a GUI with a guided path for the user to choose the options and for it to download them as needed.
Once I've written the script, I'd prefer to leave it be and not have to compile new versions all the time (if possible), excepting the instances where the URL information might change.
You can use "Download file" actions to download ZIP files from arbitrary sites and then "Install contents of ZIP file" actions to install them as needed.
As for the presentation to the user, you can use the standard installation components facility where you can order installations components into a tree which is displayed on the "Installation components" screen. You can leave all the installation components empty in your case. Another advantage is that you can specify dependencies for installation components.
In the "Installation screen", I would add action groups that contain pairs of "Download file"/"Install contents of ZIP file" actions (and whatever other action are required for each component). The condition expression of each action group should be set to
context.getInstallationComponentById("123").isSelected()
where "123" is the ID of the corresponding installation component.
As for 64-bit/32-bit: On Windows, I would propose to only create an installer for 32-bit with a bundled 32-bit JRE. This works just as well on a 64-bit JRE. If necessary, a separate 64-bit media file has to be created. The bundled JRE can be downloaded on demand.
On Linux I would not really recommend to bundle a JRE. If necessary, provide two separate media files for 32-bit Linux and 64-bit Linux.
As for the "guided path for the user", you can create custom screens in install4j.

Ada: windows installation

When downloading the tar file from AdaCore for the GNAT compiler (the libre version), I noticed that there are two exe files for installation purposes:
win32ada-gpl-2010.exe of size 2.67 MB
and
gnat-gpl-2010-i686-pc-mingw32-bin.exe of size 70.2 MB
In the folder containing the second one, there are instructions for the installation and it installs the GPS editor as well.
I have Win XP and chose to install the second exe file. Now I'm thinking that the second one is for a MINGW installation whereas the first exe file is for a native Windows installation. But I can't find information for this. Which of the two exe files is for a normal Windows installation?
Thanks a lot...
Win32Ada I believe is just a set of Win32 bindings for Ada. That's why it is so much smaller.
You might download that if you want to do a lot of Win32 systems programming or GUI work, and don't have a set of higher-level bindings (eg: GTKAda)