MSI安装被自定义操作DLL中断
MSI installation interrupted by custom action DLL
我已经使用了一个Visual Studio设置项目来创建MSI。我已经在ORCA中编辑了MSI,以便在首次打开时通过DLL执行自定义操作。当我运行MSI时,msiexec
记录以下内容:
MSI (c) (E4:BC) [15:28:14:453]: Doing action: CustomAction1
Action 15:28:14: CustomAction1.
Action start 15:28:14: CustomAction1.
MSI (c) (E4:BC) [15:28:14:453]: Note: 1: 2235 2: 3: ExtendedType 4: SELECT `Action`,`Type`,`Source`,`Target`, NULL, `ExtendedType` FROM `CustomAction` WHERE `Action` = 'CustomAction1'
MSI (c) (E4:BC) [15:28:14:453]: Creating MSIHANDLE (13) of type 790542 for thread 3260
MSI (c) (E4:B4) [15:28:14:453]: Invoking remote custom action. DLL: C:DOCUME~1USERNA~1LOCALS~1TempMSIA3.tmp, Entrypoint: SampleFunction
MSI (c) (E4:B4) [15:28:14:453]: Closing MSIHANDLE (13) of type 790542 for thread 3260
Action ended 15:28:14: CustomAction1. Return value 3.
MSI (c) (E4:BC) [15:28:14:468]: Doing action: FatalErrorForm
Action 15:28:14: FatalErrorForm.
Action start 15:28:14: FatalErrorForm.
MSI (c) (E4:BC) [15:28:14:468]: Note: 1: 2235 2: 3: ExtendedType 4: SELECT `Action`,`Type`,`Source`,`Target`, NULL, `ExtendedType` FROM `CustomAction` WHERE `Action` = 'FatalErrorForm'
安装程序向导然后显示错误消息:The installer was interrupted before MyProduct could be installed. You need to restart the installer to try again.
自定义DLL用C 编写。这是源代码:
mycustomation.cpp:
// MyCustomAction.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
return TRUE;
}
UINT __stdcall SampleFunction(MSIHANDLE hModule)
{
//This is the function that is called by the MSI
//It is empty because I just want to check that it can be called without interrupting the installer, then I will add the actual functionality
}
mycustomation.def:
; MyCustomAction.def
;
; defines the exported functions which will be available to the MSI engine
LIBRARY "MyCustomAction"
DESCRIPTION 'Custom Action DLL'
EXPORTS
SampleFunction
我还在DLL的其他依赖项中引用了msi.lib
。当我目前没有明确告诉它做任何事情时,为什么自定义操作中断安装?任何帮助将不胜感激。
更新:
在ORCA中,自定义操作在Binary
表中,并且在CustomAction
表中是类型1。自定义操作是Immediate
,在IsolateComponents
之后和在InstallUISequence
表中进行WelcomeForm
之前进行。
您应该更新代码和帖子,以表明您实际上返回了error_success。无论是否解决问题,重点是要做的是正确的事情。如果不返回值,则调用序列将失败并获取错误。
由于缺失的依赖关系,您的DLL可能不会加载。如果您在代码中放置一个简单的消息框调用,则至少会查看代码是否实际运行。C 将需要可能还没有系统上的运行时支持DLL。
事实证明您对C 运行时间有依赖性,则在运行MSI之前需要安装它们。这就是先决条件选择的目的 - 它生成一个设置。EXE安装依赖项然后安装您的MSI。
- 挂起和取消挂起一个文件DLL
- std::threads可以从Windows DLL中的全局变量创建/销毁吗?
- 导入库可以跨dll版本工作吗
- 从C++dll访问C#中的一行主要参数
- 链接到自行创建的dll失败
- 为什么使用 P/Invoke 调用 dll 时,某些计算机中的 LoadLibrary 失败?
- 在调用FreeLibrary后,释放动态链接到具有相同版本的CRT堆的DLL的内存
- 如何指定我希望我的LIB链接到的DLL文件?-Visual Studio 2019
- 如何将图像传输到c++(dll)中的缓冲区,然后在c#的缓冲区中读/写
- C++:将外部库链接到dll库
- 在 Windows 上,是否可以让 dll 在不使用 PATH 环境变量的情况下在另一个文件夹中查找依赖项?
- 不同的Visual Studio版本中缺少.dll
- 从DLL中删除类的实例
- 如何包装第三方DLL在R中使用
- 使用c#访问c++dll中带有char*参数的函数时发生AccessViolationException
- 系统.将数组移交给c#中动态加载的c++DLL时发生AccessViolationException
- 为什么导入Mixed native/CLR lib.dll的本机C++应用程序没有在Mixed lib.dll中的外部变
- 类成员和中断
- MSI安装被自定义操作DLL中断
- 当代码执行进入Dll或Lib空间时中断