Hans Leidekker : msi: Register service arguments in the InstallServices action.
Alexandre Julliard
julliard at winehq.org
Fri Oct 22 12:30:47 CDT 2010
Module: wine
Branch: master
Commit: 031c70c965be095629181f3dec00e88076508d42
URL: http://source.winehq.org/git/wine.git/?a=commit;h=031c70c965be095629181f3dec00e88076508d42
Author: Hans Leidekker <hans at codeweavers.com>
Date: Fri Oct 22 10:37:02 2010 +0200
msi: Register service arguments in the InstallServices action.
---
dlls/msi/action.c | 24 +++++++++++++++++++-----
dlls/msi/tests/action.c | 2 +-
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 633557d..a8e3a5d 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -5369,9 +5369,8 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
SC_HANDLE hscm, service = NULL;
LPCWSTR comp, key;
LPWSTR name = NULL, disp = NULL, load_order = NULL, serv_name = NULL;
- LPWSTR depends = NULL, pass = NULL;
- DWORD serv_type, start_type;
- DWORD err_control;
+ LPWSTR depends = NULL, pass = NULL, args = NULL, image_path = NULL;
+ DWORD serv_type, start_type, err_control;
SERVICE_DESCRIPTIONW sd = {NULL};
static const WCHAR query[] =
@@ -5400,6 +5399,7 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
deformat_string(package, MSI_RecordGetString(rec, 8), &depends);
deformat_string(package, MSI_RecordGetString(rec, 9), &serv_name);
deformat_string(package, MSI_RecordGetString(rec, 10), &pass);
+ deformat_string(package, MSI_RecordGetString(rec, 11), &args);
comp = MSI_RecordGetString(rec, 12);
deformat_string(package, MSI_RecordGetString(rec, 13), &sd.lpDescription);
@@ -5420,9 +5420,21 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
goto done;
}
+ if (!args || !args[0]) image_path = file->TargetPath;
+ else
+ {
+ int len = strlenW(file->TargetPath) + strlenW(args) + 2;
+ if (!(image_path = msi_alloc(len * sizeof(WCHAR))))
+ return ERROR_OUTOFMEMORY;
+
+ strcpyW(image_path, file->TargetPath);
+ strcatW(image_path, szSpace);
+ strcatW(image_path, args);
+ }
service = CreateServiceW(hscm, name, disp, GENERIC_ALL, serv_type,
- start_type, err_control, file->TargetPath,
- load_order, NULL, depends, serv_name, pass);
+ start_type, err_control, image_path, load_order,
+ NULL, depends, serv_name, pass);
+
if (!service)
{
if (GetLastError() != ERROR_SERVICE_EXISTS)
@@ -5434,6 +5446,7 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
WARN("failed to set service description %u\n", GetLastError());
}
+ if (image_path != file->TargetPath) msi_free(image_path);
done:
CloseServiceHandle(service);
CloseServiceHandle(hscm);
@@ -5444,6 +5457,7 @@ done:
msi_free(serv_name);
msi_free(pass);
msi_free(depends);
+ msi_free(args);
return ERROR_SUCCESS;
}
diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c
index f483583..f036c5b 100644
--- a/dlls/msi/tests/action.c
+++ b/dlls/msi/tests/action.c
@@ -212,7 +212,7 @@ static const char service_install_dat[] =
"LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
"s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
"ServiceInstall\tServiceInstall\n"
- "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\t";
+ "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\tservice1[~]+group1[~]service2[~]+group2[~][~]\tTestService\t\t-a arg\tservice_comp\tdescription";
static const char service_control_dat[] =
"ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
More information about the wine-cvs
mailing list