[PATCH 5/5] msi/tests: Test deferral of StartServices and StopServices.

Zebediah Figura z.figura12 at gmail.com
Thu May 17 22:26:12 CDT 2018


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/msi/tests/action.c    | 12 ++++++++++++
 dlls/msi/tests/custom.c    | 35 +++++++++++++++++++++++++++++++++++
 dlls/msi/tests/custom.spec |  2 ++
 3 files changed, 49 insertions(+)

diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c
index 4abf867..70baaa3 100644
--- a/dlls/msi/tests/action.c
+++ b/dlls/msi/tests/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/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c
index 4336504..9c9966c 100644
--- a/dlls/msi/tests/custom.c
+++ b/dlls/msi/tests/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/dlls/msi/tests/custom.spec b/dlls/msi/tests/custom.spec
index 471f956..01b95e9 100644
--- a/dlls/msi/tests/custom.spec
+++ b/dlls/msi/tests/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)
-- 
2.7.4




More information about the wine-devel mailing list