【发布时间】:2019-03-10 15:23:48
【问题描述】:
你好 Stackoverflow 社区,
我在 Installscript 自定义操作中调用 C++ DLL 时遇到问题。当我尝试使用参数调用我的 DLL 时,就会出现问题。错误图像如下所示:
使用参数调用 DLL
值、参数在 DLL 中已成功处理(值也已成功传输)
DLL方法成功完成后,没有返回值,但设置失败,错误1603。
但是,如果我在没有参数的情况下调用相同的方法,则一切正常。
传递哪些参数或传递多少参数无关紧要。只要只传递一个参数,设置就会失败。
安装脚本:
prototype NUMBER DoSomeThing(HWND, STRING, INT);
prototype NUMBER MsiCppTest.DoSomethingInCpp(STRING, INT);
prototype NUMBER MsiCppTest.DoSomethingOtherInCpp();
function NUMBER DoSomething(hMSi, sText, nCount)
STRING sSupportDir;
NUMBER nSize, nResult, nValue;
begin
nSize = 256;
nValue = -1;
MsiGetProperty(hMSi, "SUPPORTDIR", sSupportDir, nSize);
nResult = UseDLL(sSupportDir ^ "MsiCppTest.dll");
if (nResult = 0) then
//does not work:
nValue = MsiCppTest.DoSomethingInCpp(sText, nCount);
//would work:
nValue = MsiCppTest.DoSomethingOtherInCpp();
UnUseDLL(sSupportDir ^ "MsiCppTest.dll");
endif;
return nValue;
end;
C++ DLL:
int DoSomethingInCpp(LPCTSTR lpText, int nCount) {
//The ToDo function is executed successfully with the correct values
ToDo(lpText, nCount);
//As soon as the function is completed, the setup is aborted
return 123;
}
int DoSomethingOtherInCpp() {
//would work
ToDo();
return 321;
}
有没有人想办法解决这个问题?
【问题讨论】:
-
您找到解决方案了吗?
标签: c++ dll windows-installer installshield installscript