繁体   English   中英

MSI安装被自定义操作DLL中断

[英]MSI installation interrupted by custom action DLL

我已使用Visual Studio安装项目来创建MSI。 我在Orca中编辑了MSI,以便在第一次打开DLL时通过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~1\USERNA~1\LOCALS~1\Temp\MSIA3.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. The installer was interrupted before MyProduct could be installed. You need to restart the installer to try again.

自定义DLL是用C ++编写的。 这是源代码:

MyCustomAction.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
}

MyCustomAction.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中引用了msi.lib 当我当前未明确告诉其执行任何操作时,为什么自定义操作会中断安装? 任何帮助,将不胜感激。

更新:

在Orca中,自定义操作位于Binary表中,并且在CustomAction表中键入1。 自定义动作是Immediate和之后发生IsolateComponents之前WelcomeFormInstallUISequence表。

您应该更新代码和帖子,以表明您实际上正在返回ERROR_SUCCESS。 无论它是否解决了问题,关键在于它是正确的做法。 如果未返回值,则调用序列将失败并出现错误。

您的Dll可能由于缺少相关性而无法加载。 如果在代码中添加一个简单的messagebox调用,则至少会看到该代码是否真正开始运行。 C ++将需要运行时支持Dll,而这些Dll可能尚未在系统上。

如果事实证明您对C ++运行时具有依赖性,则需要在运行MSI之前安装它们。 这就是先决条件选择的含义-它生成setup.exe以安装依赖项,然后安装MSI。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM