I distribute my software with a WinZip self-extract archive (SFX).
I am aware of this and that. But those doesn't seem to work for SFX scenarios.
While installing, the SFX unpacks and starts a contained program (written by me), that does the installation. This includes the creation of a registry entry for the programs list under the windows control panel. Further, the program has a manifest. So it should be "Vista-aware". The SFX-executable also includes a manifest.
The problem is that the Program Compatibility Assistant (PCA) throws its message
"This program might not have installed correctly"
anyway.
So my customers tell me i'm a bad programmer...
I googled a lot, and read a lot about the PCA, including many Microsoft sites.
Those tell me to do:
- embed a manifest
- create registry entries for the programs list under the windows control panel
My manifest looks like this:
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
</applicationRequestMinimum>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</asmv1:assembly>
So where did i go wrong?
Are there any further things to do for the PCA?
Do the SFX executable have to include some other things?
As was described in the other answer the key is setting the headers correctly in the PE (Portable Executable) portion of the file. We were encountering this problem while attempting to construct self extracting executables using SFX files & 7-zip.
NOTE: The PE file format is similar to ELF under Linux.
Building these files went smoothly, however when we tried to run our resulting files on Win7 we'd get the following dialog.
The biggest hint here is that this dialog is being thrown by PCA - Program Compatibility Assistant. This error is being thrown because PCA has either detected:
Fixing with PE Tools
In our case it seemed to be #2 that was causing the issue. So we downloaded PE Tools and opened the 7-zip SFX file. NOTE: We loaded the file
7zS.sfx
.Once loaded we changed the following version info from a
4
to a6
.References
We fixed a similar issue in NSIS by setting a version field in the PE header to 6.0. I believe that was for our uninstaller but it might apply to your scenario as well.