QuestionHow should I determine the success or failure of a Windows Installer install?
Generally there are two ways of invoking Windows Installer, a MSIExec command line call or an MSI API (MsiInstallProduct, MsiInstallProductEx, MsiReinstallProduct).
For the MSIExec case
- If one is calling via the command line, they can look at the ERRORLEVEL of the command shell to see if Windows Installer returned success (zero).
- If one is using the an API to call the command line (like CreateProcess) check the return value available through that API as you would above.
For the MSI API case, consult the MSDN documentation on the API to determine which of the parameters determines success.
Where the problem gets interesting is when there is a failure as there is no automated way to determine with 100% accuracy what a source of an error has been. We have produced a best effort tool called wilogutl.exe that will highlight errors in the MSI. In this case best effort means there will be some false positives (cases where the error is inconsequential) and some negatives (cases where errors are known only by analyzing a combination of lines from the log along with the package).
As a windows installer dev in test, I found it most helpful to examine the verbose log file generated during the install and see what the MainEngineThread returns.