[PATCH] msi: Use special errorctrl-flag for CreateService
Andreas Maier
andy1.m at gmx.de
Sun May 29 16:07:34 CDT 2016
https://bugs.winehq.org/show_bug.cgi?id=40703
Pay attantion to the special errorcontrol-flag
msidbServiceInstallErrorControlVital (0x8000).
This patch creates the Service always without this flag and
fails installation if the flag is present.
Signed-off-by: Andreas Maier <andy1.m at gmx.de>
---
dlls/msi/action.c | 13 +++++++++++++
include/msidefs.h | 5 +++++
2 files changed, 18 insertions(+)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 370007c..5675900 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -5811,6 +5811,7 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
LPWSTR name = NULL, disp = NULL, load_order = NULL, serv_name = NULL;
LPWSTR depends = NULL, pass = NULL, args = NULL, image_path = NULL;
DWORD serv_type, start_type, err_control;
+ BOOL can_fail;
SERVICE_DESCRIPTIONW sd = {NULL};
UINT ret = ERROR_SUCCESS;
@@ -5848,6 +5849,13 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
deformat_string(package, MSI_RecordGetString(rec, 10), &pass);
deformat_string(package, MSI_RecordGetString(rec, 11), &args);
deformat_string(package, MSI_RecordGetString(rec, 13), &sd.lpDescription);
+
+ /* Should the complete install fail if CreateService fails? */
+ can_fail = (err_control && msidbServiceInstallErrorControlVital >= 0);
+
+ /* Remove the msidbServiceInstallErrorControlVital-flag from err_control.
+ CreateService (under Windows) would fail if not. */
+ err_control &= ~msidbServiceInstallErrorControlVital;
/* fetch the service path */
row = MSI_QueryGetRecord(package->db, query, comp);
@@ -5890,7 +5898,12 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
if (!service)
{
if (GetLastError() != ERROR_SERVICE_EXISTS)
+ {
ERR("Failed to create service %s: %d\n", debugstr_w(name), GetLastError());
+ if (can_fail)
+ return ERROR_INSTALL_FAILURE;
+
+ }
}
else if (sd.lpDescription)
{
diff --git a/include/msidefs.h b/include/msidefs.h
index 640bfa1..9456680 100644
--- a/include/msidefs.h
+++ b/include/msidefs.h
@@ -200,6 +200,11 @@ enum msidbServiceControlEvent
msidbServiceControlEventUninstallDelete = 0x00000080,
};
+enum msidbServiceInstallErrorControl
+{
+ msidbServiceInstallErrorControlVital = 0x00008000
+};
+
enum msidbMoveFileOptions
{
msidbMoveFileOptionsMove = 0x00000001,
--
2.8.1
More information about the wine-patches
mailing list