2

I believe services.exe uses the command line msiexec.exe /v to reinstall or recache or whatever it is my software. The issue is when you actually install you choose a path to install to and it gets set as a registry key. When this msiexec.exe /v gets called, all of the registry keys get reset but, since it doesn't have this path anymore, the path key gets left blank.

I ran process monitor and waited for it to happen and the above information is what I've deduced. I need to know why it is calling it and how to stop it. Any information or knowledge to help me understand what is going on would be appreciated as I'm actively working to solve this. There is nothing in particular that I have found that initiates these events. Possibly a startup though.

ReddShepherd
  • 467
  • 1
  • 11
  • 24

1 Answers1

1

Very difficult to know what is going on. Are you installing your own service executable as part of your MSI? If so it will be a "self repair" entry point when invoked (start / stop). This means that all key paths in all components will be verified on the fly and if any key paths are found to be missing a reinstall of your application is performed automatically. You can use a verbose log file to determine what component triggered self repair. Use the Windows Installer Command Line Builder to construct the msiexec.exe command line to create the file. See my answer here: How to interactive a silently installing msi? (Progress data and cancel it)

Note that you can also generally find the component responsible for the self repair by checking the system's event log. This is the fastest approach. A log file will give you more information. To make sense of the log use Microsoft's own log file analyzer: http://msdn.microsoft.com/en-us/library/windows/desktop/aa372811(v=vs.85).aspx

If you are hard coding registry keys in the msi, they will indeed tend to be reset when the repair is done. When you point an MSI component towards a registry path as key path, the MSI file thinks it "owns" that key and will reset it on install and remove it on uninstall unless you design the MSI file specifically to avoid this. You can avoid this by setting the component as "permanent" and "never overwrite if keypath exists". A better option is to have the service exe file write its own defaults to the registry after installation if it has permissions to do so. This will decouple your settings from MSI and the installer will never mess with them.

If my gut feel is correct your service exe file is resetting registry values that the MSI thinks it "owns" and starting the service triggers a key path check that in turn triggers a self repair to revert the values to the MSI defaults. Sorry for the messy explanation, but I am shooting from the hip here trying to give you some pointers for debugging.

Community
  • 1
  • 1
Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • Yeah sorry I had forgotten to post my answer. You're right my software creates a shortcut so it is an advertised shortcut. It would see one of the components was gone and then start the reinstall. The reinstall would replace the file, but simultaneously take out the registry key that would generally be getting set when going through the actual install process. I had to make a custom action to add a shortcut so that it wouldn't be advertised because the file that was causing the reinstall was unimportant. – ReddShepherd Aug 27 '12 at 19:00
  • You may still have problems. Self repair can be triggered by other means than an advertised shortcut. Better to fix the root cause of the problem: the file that went missing. Most likely this is a file generated or edited by your application? In such cases the application should generate the file, and it shouldn't be installed at all. Take it out of your installer, and leave the shortcut advertised to comply with Windows Installer guidelines. Some companies reject software that doesn't comply. – Stein Åsmul Aug 27 '12 at 23:21
  • Yeah the file is an old flash file and gets replaced when flash is updated, hence causing the re installation. I agree that the final solution would be to take out the flash file especially since we no longer use it, but we needed a quicker fix. Thanks for all of the help. – ReddShepherd Aug 29 '12 at 19:32