How to make the installer behave correctly with Windows?

I made a simple installer application in Delphi, nothing out of the ordinary. Basically, I include the files in Exe, and then I extract them at the path specified by the user.

However, I came across a problem, and I noticed that this works with ANY Windows executable, no matter if it is an installer or not.

If the Exe name is specified or contains the following words in the file name: "Setup", "Build", "Install" and, possibly, others, then ... whenever the application starts and closes, Windows displays compatibility with the product Helper dialog box stating that the application may not be installed correctly.

This is a problem, since even the files from my installer are really extracted, and in my eyes the installer did its job, Windows complains about it.

The only idea that I have in this regard is that Windows should check the name of the application file when it is executed, in which case it is identified as an installer. Windows should set a flag or something in the System, should my installer update this flag to say that the installation was successful?

Windows does not complain about this when debugging from the IDE, therefore it cannot be connected with the code, it must be the OS - this only happens when the application is launched from Windows, and not in Delphi.

You can try it easily, create an application or rename it as Setup.exe, start it, and then close - wait a few seconds, and the Assistant Compatibility Assistant dialog box appears.

I do not know where to start the investigation, how to stop this dialog box, or where it may be indicated that the Windows Installer was executed correctly.

Appreciate your thoughts and decisions.

+4
source share
2 answers

If I remember correctly, this happens when your installation application does not include the application manifest. When UAC was introduced, MS introduced heuristic detection for installers and displays a UAC enhancement dialog box. Heuristic checking for names such as setup.exe, install.exe. A simple solution is to enable the application manifest. If it is an installer, you probably want to use the requireAdministrator parameter.

This feature is known as installer detection and is discussed here.

For what it's worth, I always created the installer using a special installation tool such as InnoSetup, for example.

+8
source

As David noted, MS uses some fuzzy logic to try and guess if the program is an installer. I would not rely on this because it is only for supporting legacy installer applications.

All new applications should have a manifest file, indicating whether it requires elevated privileges.

If an application has a manifest file that includes requestExecutionLevel directive, Windows does not try to "Installer Detection" .

Any program that is detected as an installer, but does not add an entry to the "Delete files" section in the registry (HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall), will receive the message "This program may not work installed correctly."

+3
source

Source: https://habr.com/ru/post/1383318/


All Articles