I've got a DLL from an old WiSE installer that i'm trying to get working in WiX, so i'm pretty sure the DLL works with MSI-based installers.
Here is my definition:
<Binary Id="SetupDLL" SourceFile="../Tools/Setup.dll" />
<CustomAction Id="ReadConfigFiles" BinaryKey="SetupDLL" DllEntry="readConfigFiles" />
and usage:
<Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="ReadConfigFiles" Order="3">1</Publish>
My C++ function looks like this:
extern "C" UINT __stdcall ReadConfigFiles(MSIHANDLE hInstall, CHAR * szDirectory)
Where exactly can I pass in parameters?
You can't pass parameters directly because in order for this to work, your function has to be exported with exactly the right footprint. When you call readConfigFiles
in your custom action dll, it should have a footprint like this:
extern "C" UINT __stdcall readConfigFiles(MSIHANDLE hInstaller);
You can use the hInstaller
parameter to read properties from the MSI. Use MsiGetProperty()
:
HRESULT GetProperty(MSIHANDLE hInstaller, LPCWSTR property, LPWSTR value, DWORD cch_value) {
UINT err = MsiGetProperty(hInstaller, property, value, &cch_value);
return (err == ERROR_SUCCESS ? S_OK : E_FAIL);
}
Then just make sure you set the property in your .wxs file:
<Property Id="YOUR-PROPERTY-NAME">your-property-value</Property>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With