You don't/can't. Before elaborating, if you want to install a service then why
not use the ServiceInstall/ServiceControl elements which exist today? Getting
code right which modifies machine state is hard to do, as you have to handle
the install/upgrade/repair/remove operations along with rollbacks.
If you are dead set on running your own CA, create a second export on your C++
DLL using the right signature for a CA.
Ex:
// WiX Header Files:
#include <wcautil.h>
EXPORT UINT __stdcall InstallServiceCA(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
hr = WcaInitialize(hInstall, " InstallServiceCA ");
ExitOnFailure(hr, "Failed to initialize");
WcaLog(LOGMSG_STANDARD, "Initialized.");
// Use WcaGetProperty to get your 2 strings from the properties, or
WcaReadStringFromCaData (depending on if the CA is deferred)
if (InstallService (...)) {
hr = WcaSetProperty(InstallServiceCA _Property, Installed);
ExitOnFailure(hr, "Failed to SetProperty");
}
LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
// DllMain - Initialize and cleanup WiX custom action utils.
extern "C" BOOL WINAPI DllMain(
__in HINSTANCE hInst,
__in ULONG ulReason,
__in LPVOID
)
{
switch(ulReason)
{
case DLL_PROCESS_ATTACH:
WcaGlobalInitialize(hInst);
break;
case DLL_PROCESS_DETACH:
WcaGlobalFinalize();
break;
}
return TRUE;
}
-----Original Message-----
From: Marc Beaudry [mailto:[email protected]]
Sent: Thursday, July 11, 2013 8:05 AM
To: [email protected]
Subject: [WiX-users] Custom Action syntax Issue
Hello All,
I have what should be a simple request, even though from all my google searches
I cannot get the proper syntax. I can correctly call a custom action without
any parameters.
I am converting an old Wise MSI to WIX:
Essentially in Wise I call my dll with 2 parameters, I really want to mimic
this in WIX
I have a C++ DLL with this entry point
extern "C" __declspec(dllexport) int InstallService(char* pszServiceName,
char* pszServiceFileName)
In Wix I can't figure out what the complete syntax to call my DLL with these
2 char*, Here is what I figured out so far, which compiles fine but my CA
never seems to get called
<Binary Id='CustomActionID' src='..\..\Release\CustomActions.dll'/>
<CustomAction Id='InstallService' BinaryKey='CustomActionID' DllEntry=
'InstallService'
Execute='deferred' Return='ignore'/>
<CustomAction Id="InstallServiceData" Return='check'
Property="InstallService"
Value='MyService, TestService.exe' />
<InstallExecuteSequence>
<Custom Action="InstallServiceData" Before="InstallService">NOT
Installed</Custom>
<Custom Action="InstallService" Before="InstallFinalize">NOT
Installed</Custom> </InstallExecuteSequence>
Thanks for the help,
Marc
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics Get end-to-end
visibility with application monitoring from AppDynamics Isolate bottlenecks and
diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users