C++ Setup Project Custom Action (exe) Fails

  • Thread starter Thread starter AgentMilkshake1
  • Start date Start date
A

AgentMilkshake1

Guest
Hi there,

I've been working with a particular Setup Project for several months now. It's been working fairly well (and reliably) for most of that time, but last week I added a custom action upon Install and Uninstall.

This custom action is simply a .exe that looks at the incoming arguments to decide upon what to execute. In either of the 2 execution cases, it creates a process of an existing executable already on the users PC (using CreateProcess) and runs it with command line arguments. This runs very quickly, and then terminates the process and ends this Custom Action.

I've tested this exe custom action on it's own, and it works perfectly every time. However, upon being packaged into the MSI and used as a custom action, it no longer works and I get the error message: "There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor.".

I've tried early returning out of the .exe line by line to work out where it hits a problem, but it appears that even hitting the first line (a test line simply printing "test" using std::cout) causes this error.

If I run the executable with return 0 as the first line, it executes without a problem (obviously doing nothing) and the installer completes successfully.

Why might this be happening?

Second question on top of that whilst I'm here: For adding arguments to the custom action, I require 2 arguments - first of all a simple string word (such as "add") and then a path containing spaces. I'm assuming that [TARGETDIR] in the command line for this custom action will turn into a path with surrounding quotation marks?

Thanks for any help.

Continue reading...
 
Back
Top