Comment écrire bootstrap EXE, dont le lancement MSIEXEC.EXE puis attendre son achèvement
-
28-10-2019 - |
Question
Je suis en train d'installer mon plug-in ActiveX, emballé dans nsi dans un fichier de taxi, et rencontré un problème.
Le journal est
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"
Je pense est le même que celui-ci:
Je veux essayer la solution qui y est suggéré, mais n'a aucune idée comment
créer un petit EXE d'amorçage, qui ne fait rien, mais de lancer MSIEXEC.EXE puis attendre son achèvement.
Quelqu'un peut-il fournir une aide?
Merci !!
La solution
Jetez un oeil à dotNetInstaller - programme préécrite bootstrapper qui fait beaucoup plus que ce dont vous avez besoin, mais peut faire exactement ce que vous demandez.
Autres conseils
Voici un emballage simple qui appelle MsiExec.exe à installer tranquillement le msi passé dans le premier paramètre de ligne de commande.
Il est écrit comme une application de ligne de commande 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;
}
L'espoir qui aide.