【问题标题】:How to write bootstrap EXE, which launch MSIEXEC.EXE and then wait for its completion如何编写引导程序 EXE,它启动 MSIEXEC.EXE,然后等待其完成
【发布时间】:2011-06-15 08:59:35
【问题描述】:

我正在尝试安装我的 ActiveX 插件,在 cab 文件中打包在 nsi 中,但遇到了问题。

日志是

Code Download Error: (hr = 80070005) Access is denied.

ERR: Run Setup Hook: Failed Error Code:(hr) = 80070005, processing: msiexec.exe /package "%EXTRACT_DIR%\TempR.msi"

我觉得和这个一样:

http://social.msdn.microsoft.com/Forums/en-US/ieextensiondevelopment/thread/3d355fb6-8d6a-4177-98c2-a25665510727/

我想尝试那里建议的解决方案,但不知道如何

创建一个小的引导程序 EXE,它 除了启动 MSIEXEC.EXE 什么都不做 然后等待它完成。

有人可以提供帮助吗?

谢谢!!

【问题讨论】:

  • 那为什么不能直接使用微星呢?我的意思是用户双击您的 MSI 文件并 MSI 部署它?

标签: installation activex bootstrapper windows-installer


【解决方案1】:

这里是一个简单的包装器,它调用 msiexec.exe 来安静地安装第一个命令行参数中传递的 msi。

它是作为 Visual C++ 命令行应用程序编写的:

// InstallMSI.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <Windows.h>
#include <string>

int wmain(int argc, wchar_t* argv[])
{
if(argc < 2) {
    printf("Usage: installmsi.exe <full path to msi file>\n\n");
    printf("Package will be installed using msiexec.exe with the /qn (quiet install) flags.\n");
    return 1;
}

std::wstring args;
args = L"msiexec.exe /i \"";
args += argv[1];
args += L"\" /qn";

PROCESS_INFORMATION pi;
STARTUPINFO si;

ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);

ZeroMemory(&pi, sizeof(pi));

if(!CreateProcess(NULL, (LPWSTR)args.c_str(),
    NULL, NULL, TRUE, NULL, NULL, NULL, &si, &pi)) {
        printf("CreateProcess failed (%d).\n", GetLastError());
        return 2;
}

WaitForSingleObject( pi.hProcess, INFINITE );

CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);

return 0;
}

希望对您有所帮助。

【讨论】:

    【解决方案2】:

    看看dotNetInstaller - 预先编写的引导程序,它的功能远远超出您的需要,但可以完全按照您的要求完成。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-09
      • 2010-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多