https://git.reactos.org/?p=reactos.git;a=commitdiff;h=df90c9beba67a8f59f919…
commit df90c9beba67a8f59f919084ecb8d2a78e524e69
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Mar 12 15:12:22 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:27:47 2022 +0100
[WINESYNC] msi/tests: Test deferral of StartServices and StopServices.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 7f0c8b3c6130bf1181e83bcdd9ab6b71583208f5 by Zebediah Figura
<z.figura12(a)gmail.com>
---
modules/rostests/winetests/msi/action.c | 12 ++++++++++
modules/rostests/winetests/msi/custom.c | 35 ++++++++++++++++++++++++++++++
modules/rostests/winetests/msi/custom.spec | 2 ++
3 files changed, 49 insertions(+)
diff --git a/modules/rostests/winetests/msi/action.c
b/modules/rostests/winetests/msi/action.c
index 4abf8675350..70baaa342b2 100644
--- a/modules/rostests/winetests/msi/action.c
+++ b/modules/rostests/winetests/msi/action.c
@@ -259,16 +259,27 @@ static const char sss_install_exec_seq_dat[] =
"InstallValidate\t\t1400\n"
"InstallInitialize\t\t1500\n"
"StopServices\t\t4000\n"
+ "stop_immediate\tNOT REMOVE\t4001\n"
+ "stop_deferred\tNOT REMOVE\t4002\n"
"DeleteServices\t\t5000\n"
"MoveFiles\t\t5100\n"
"InstallFiles\t\t5200\n"
"DuplicateFiles\t\t5300\n"
"StartServices\t\t5400\n"
+ "start_deferred\tNOT REMOVE\t5401\n"
"RegisterProduct\t\t5500\n"
"PublishFeatures\t\t5600\n"
"PublishProduct\t\t5700\n"
"InstallFinalize\t\t6000\n";
+static const char sss_custom_action_dat[] =
+ "Action\tType\tSource\tTarget\n"
+ "s72\ti2\tS64\tS0\n"
+ "CustomAction\tAction\n"
+ "stop_immediate\t1\tcustom.dll\tsss_started\n"
+ "stop_deferred\t1025\tcustom.dll\tsss_stopped\n"
+ "start_deferred\t1025\tcustom.dll\tsss_started\n";
+
static const char sds_install_exec_seq_dat[] =
"Action\tCondition\tSequence\n"
"s72\tS255\tI2\n"
@@ -1848,6 +1859,7 @@ static const msi_table sss_tables[] =
ADD_TABLE(file),
ADD_TABLE(sss_install_exec_seq),
ADD_TABLE(sss_service_control),
+ ADD_TABLE(sss_custom_action),
ADD_TABLE(media),
ADD_TABLE(property)
};
diff --git a/modules/rostests/winetests/msi/custom.c
b/modules/rostests/winetests/msi/custom.c
index 43365041a04..9c9966cabac 100644
--- a/modules/rostests/winetests/msi/custom.c
+++ b/modules/rostests/winetests/msi/custom.c
@@ -1239,3 +1239,38 @@ todo_wine
CloseServiceHandle(manager);
return ERROR_SUCCESS;
}
+
+UINT WINAPI sss_started(MSIHANDLE hinst)
+{
+ SC_HANDLE manager, service;
+ SERVICE_STATUS status;
+ BOOL ret;
+
+ manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
+ service = OpenServiceA(manager, "Spooler", SC_MANAGER_ALL_ACCESS);
+ ret = QueryServiceStatus(service, &status);
+ ok(hinst, ret, "QueryServiceStatus failed: %u\n", GetLastError());
+todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED))
+ ok(hinst, status.dwCurrentState == SERVICE_RUNNING, "got %u\n",
status.dwCurrentState);
+
+ CloseServiceHandle(service);
+ CloseServiceHandle(manager);
+ return ERROR_SUCCESS;
+}
+
+UINT WINAPI sss_stopped(MSIHANDLE hinst)
+{
+ SC_HANDLE manager, service;
+ SERVICE_STATUS status;
+ BOOL ret;
+
+ manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
+ service = OpenServiceA(manager, "Spooler", SC_MANAGER_ALL_ACCESS);
+ ret = QueryServiceStatus(service, &status);
+ ok(hinst, ret, "QueryServiceStatus failed: %u\n", GetLastError());
+ ok(hinst, status.dwCurrentState == SERVICE_STOPPED, "got %u\n",
status.dwCurrentState);
+
+ CloseServiceHandle(service);
+ CloseServiceHandle(manager);
+ return ERROR_SUCCESS;
+}
diff --git a/modules/rostests/winetests/msi/custom.spec
b/modules/rostests/winetests/msi/custom.spec
index 471f9569711..01b95e92b77 100644
--- a/modules/rostests/winetests/msi/custom.spec
+++ b/modules/rostests/winetests/msi/custom.spec
@@ -11,3 +11,5 @@
@ stdcall sds_absent(long)
@ stdcall sis_present(long)
@ stdcall sis_absent(long)
+@ stdcall sss_started(long)
+@ stdcall sss_stopped(long)