Getting CustomActionData in deferred custom action

眉间皱痕 提交于 2019-12-11 18:01:49

问题


I try to get data from the CustomActionData property in a c++ dll, but it's always empty during the deferred sequence. If I use the exact same code in a CA executed during the UI sequence it all works great.

        UINT iCASize = 0;
        UINT uiStat = MsiGetProperty(hInstall, TEXT("CustomActionData"), TEXT(""), &iCASize);
        if (uiStat == ERROR_MORE_DATA)
        {
            // this means there are data to read. Allocate array for all data and read it (+1 for null termination)
            pCustData = new WCHAR[iCASize + 1];
            uiStat = MsiGetProperty(hInstall, TEXT("CustomActionData"), pCustData, &iCASize);
        }

Any of you out there have an idea what could be wrong?


回答1:


Either there is something wrong with this C++ code (I haven't done c++ in twenty years) or more likely you not setting the CustomActionData correctly.

You need to a custom action scheduled in the immediate context before your deferred custom action. The property it sets is the name of the deferred CA.

Customaction Name: SetSomething Property: Something = Value: FOO ( Not CustomActionData = FOO )

Customaction Name: Something MsiGetProperty( ... "CustomactionData" ... );



来源:https://stackoverflow.com/questions/47811341/getting-customactiondata-in-deferred-custom-action

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!