3

want to make a check in my installer before starting installation if any other installation is running beforehand. Like I want to make a check if windows update or any other installer is running i'll not start my installer.

I'm planning to check if any msiexec instance is running before hand. Is there any better approach, and will that be same for checking windows update. FYI my installer is in java

1
  • What if user starts msiexec right after your check showed it wasn't running? Feb 5, 2012 at 17:38

4 Answers 4

3

You should know that msiexec.exe will still be running for a couple of minutes after an installation is finished. This is a default behavior in the OS, it keeps the process alive for a couple of minutes, in case the user will start another installation, to save time from starting it all over again. So checking for the process could give you incorrect data.

Also, if you have your installer written in Java can you please explain why do you need to check for msiexec.exe processes?

2
  • becoz it is going to install a list of msi at a later stage and at that point failing the installer is not good.
    – prithu
    Feb 6, 2012 at 8:45
  • so what could be the approach you suggest?
    – prithu
    Feb 6, 2012 at 8:49
1

Since your installer is in Java, I see no reason to check whether other installers are running, moreover there's no robust way to do so.

Does your installer try to replace system files? It should not.
Does your installer try to update a file in use? It must do it gracefully. And ask user to close an offending application; if it's not possible or user does not want to close the application right away, your installer asks user to restart the system when it completed installation.

Too much to care about, without other installers running. That's why it's wiser to use a specialized installer tool.

1

To check the OS for installations in progress you can use the following registry entry:

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\InProgress

Please note that Windows Installer does not allow multiple InstallExecuteSequences to be executed simultaneously, however you can launch multiple installation UIs from different packages. The package enters InstallExecuteSequence usually at the moment you press "Install" and grant all the permissions for starting the system changes (creating registry, copying files, etc...).

Here you can find more information about InstallUISequence and InstallExecuteSequence: http://msdn.microsoft.com/en-us/library/windows/desktop/aa372404(v=vs.85).aspx

1
  • The key you specified does not exist.
    – user844541
    Jun 13, 2013 at 10:47
0

Thank u guys for your suggestions, I final decided to go with creating a windows native dll to check the status of WindowsInstaller. The Windows Installer service is currently running if the value of the dwControlsAccepted member of the returned SERVICE_STATUS_PROCESS structure is SERVICE_ACCEPT_SHUTDOWN. Then used JNI to to call it from my java class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.