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

prithu
  • 311
  • 1
  • 3
  • 10

4 Answers4

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?

Bogdan Mitrache
  • 10,536
  • 19
  • 34
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.

Alexey Ivanov
  • 11,541
  • 4
  • 39
  • 68
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

Bogdan Mitrache
  • 10,536
  • 19
  • 34
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.

prithu
  • 311
  • 1
  • 3
  • 10