(Wix 3.5)
I have an installer that places a DLL in the installed program's
directory and which we call into to do some custom twiddling at the
end of the install. A bit like this:
<CustomAction Id="InitializeProduct" FileKey="OurDLL.dll"
DllEntry="InitializeTheProduct" Execute="deferred" Return="ignore"
Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="InitializeProduct"
Before="InstallFinalize">WixUI_InstallMode=""</Custom>
</InstallExecuteSequence>
This has been working great. Inside the function
"InitializeTheProduct" function in the DLL, I now wish to call
MsiGetProperty to get the SOURCEDIR property but this is failing. I
found a lot of sample code for calling MsiGetProperty so I copied the
pattern (abbreviated a bit to keep this post as small as I can):
extern "C" __declspec(dllexport) UINT _stdcall
InitializeTheProduct(MSIHANDLE hInstaller)
{
TCHAR* szValueBuf = NULL;
DWORD cchValueBuf = 0;
UINT uiStat = MsiGetProperty(hInstaller, TEXT("SOURCEDIR"),
TEXT(""), &cchValueBuf);
if (ERROR_MORE_DATA == uiStat)
{
++cchValueBuf;
szValueBuf = new TCHAR[cchValueBuf];
uiStat = MsiGetProperty(hInstaller, TEXT("SourceDir"),
szValueBuf, &cchValueBuf);
}
if (szValueBuf != NULL) delete[] szValueBuf;
return ERROR_SUCCESS;
}
The behavior of all this is, I get ERROR_MORE_DATA back from the first
call, as expected, but cchValueBuf is 0. I would have expected a
different return value if it could not find the property, so a return
that says, "Your size of 0 isn't big enough, use 0" is interesting.
The 2nd call actually returns ERROR_SUCCESS, but no property.
I've tried various permutations of SOURCEDIR (SourceDir, [SOURCEDIR]),
and also tried to reference some custom properties, all with the same
result. For SourceDir I put in a ResolveSource action to see if that
was the problem but it wasn't. The log shows valid values for all the
properties I've tried so I am flummoxed.
Any thoughts out there on similar troubles found? With Google and Bing
search I found some common problems but none applied. Any thoughts
apprecitated. Barring that, the reason I am doing this to begin with
is I need my DLL entry point to know the path to the MSI that called
it, so is there another way of doing this?
-Dave
------------------------------------------------------------------------------
Automate Storage Tiering Simply
Optimize IT performance and efficiency through flexible, powerful,
automated storage tiering capabilities. View this brief to learn how
you can reduce costs and improve performance.
http://p.sf.net/sfu/dell-sfdev2dev
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users