Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Urgent!  Parameter to dll to retrieve CustomActionData


2 replies to this topic

JoeThompson

JoeThompson
  • Members
  • 80 posts

Posted 06 November 2001 - 22:11

I am really struggling with this.  I have a deferred custom action that calls a dll that is installed with the product.  In the dll, I need to access 5 properties that are set during the UI sequence of my installation.  I have read article Q104413 about CustomActionData.  My question is this:
When my custom action was immediate, I could pass the hMSI to the dll and use MsiGetProperty to get what I wanted.
Now that it is deferred, what parameter should I be passing to the dll (written in C++).  What type should it be declared as?
Any C++ examples about "unpacking" the CustomActionData.  Any help is appreciated.
I am using ISWI 2.01 on W2K.

Thank you,
Joe


Irina

Irina
  • Members
  • 227 posts

Posted 08 November 2001 - 16:29

Hi Joe,
It is the same for the deferred custom actions as you do for the immediately custom actions. You pass hMSI and use MsiGetProperty to get the "CustomActionData" property and then you can split this string if you have several properties. This is a part of my code:
UINT_stdcall CopyDemoKeys(MSIHANDLE hInstall)
{
char szCustomActionData[MAX_PATH]="";
char *pszProperty = szCustomActionData;
char szSourceDirFile[MAX_PATH]="";
char szTargetDirFile[MAX_PATH]="";
char szSourceDir[MAX_PATH]="";
DWORD dwSourceDir = MAX_PATH;
char szTargetDir[MAX_PATH]="";
BOOL bRet;

// get property CustomActionData
MsiGetProperty(hInstall, "CustomActionData", szCustomActionData, &dwSourceDir);

// split property to SourceDir and InstallDir
strncat(szSourceDir, szCustomActionData, strcspn(szCustomActionData, ";"));
// point to InstallDir
pszProperty += strlen(szSourceDir) + 1;
strncat(szTargetDir, pszProperty, strcspn(pszProperty, ":"));
........

You set target in this deferred custom action as [Prop1];[Prop2].

Good luck!


JoeThompson

JoeThompson
  • Members
  • 80 posts

Posted 08 November 2001 - 16:35

Thank you Irina.  That is exactly what I was looking for.