Thank you for the responses. The key was the deferred part and the effect that has, and the keyword "CustomActionData". My custom action and MsiGetProperty works as expected now.
I found this blog which helped a lot once I knew what my problem basically was: http://blogs.claritycon.com/blogs/sajo_jacob/archive/2008/02/28/customactiondata-in-wix-with-deferred-custom-actions.aspx Thanks... On Fri, Sep 10, 2010 at 12:19 AM, Rob Mensching <r...@robmensching.com> wrote: > Correct. I highly suggest reading all the Custom Action content in the MSI > SDK. You'll learn all kinds of interesting little facts... like the many > limitations of deferred Custom Actions. <smile/> > > On Thu, Sep 9, 2010 at 11:56 PM, Fabio Di Lorenzo <fa...@dilorenzo.ch>wrote: > >> Hi Dave, >> >> Im not experienced in C/C++ custom actions, but in VBScript you are unable >> to access any Property during the deferred sequence. >> >> You can workaround this with the following trick: >> >> Create a immediate custom action which reads out the "SourceDir" Property >> and places the value into a property with the exactly same name as the >> deferred custom action. >> >> Afterward you should be able to access the value through the "virtual" >> property called CustomActionData. >> >> Kind Regards, >> Fabio Di Lorenzo >> >> On Fri, Sep 10, 2010 at 3:26 AM, Dave DaveLists <dbfli...@gmail.com> >> wrote: >> >> > (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 >> > WiX-users@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/wix-users >> > >> >> ------------------------------------------------------------------------------ >> 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 >> WiX-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wix-users >> >> > > > -- > virtually, Rob Mensching - http://RobMensching.com LLC > ------------------------------------------------------------------------------ > 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 > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users