WIX C ++自定义操作
-
22-09-2019 - |
题
我有一个基本WIX自定义动作:
UINT __stdcall MyCustomAction(MSIHANDLE hInstaller)
{
DWORD dwSize=0;
MsiGetProperty(hInstaller, TEXT("MyProperty"), TEXT(""), &dwSize);
return ERROR_SUCCESS;
}
添加到安装程序:
<CustomAction Id="CustomActionId" FileKey="CustomDll" DllEntry="MyCustomAction"/>
<InstallExecuteSequence>
<Custom Action="CustomActionId" Before="InstallFinalize" />
</InstallExecuteSequence>
的问题是,无论我做什么,手柄hInstaller无效。我已经设置了行动承诺,延期,请在InstallExecute顺序改变的地方,hInstaller始终是无效的。
任何帮助,将不胜感激。感谢。
解决方案
您需要导出叫功能,因此MSI可以使用未修饰的空调风格的名字称呼它
与此替换代码
extern "C" _declspec(dllexport) UINT __stdcall MyCustomAction(MSIHANDLE hInstall);
extern "C" UINT __stdcall MyCustomAction(MSIHANDLE hInstall)
{
DWORD dwSize=0;
MsiGetProperty(hInstaller, TEXT("MyProperty"), TEXT(""), &dwSize);
return ERROR_SUCCESS;
}
其他提示
#pragma comment(linker, "/EXPORT:SomeFunction=_SomeFunction@@@23mangledstuff#@@@@")
这会在DLL导出表的第二项。
不隶属于 StackOverflow