https://git.reactos.org/?p=reactos.git;a=commitdiff;h=49a44f014f04fb0816982361399385aae66e2334

commit 49a44f014f04fb0816982361399385aae66e2334
Author:     winesync <[email protected]>
AuthorDate: Sat Mar 12 15:12:21 2022 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Sun Mar 20 19:27:47 2022 +0100

    [WINESYNC] msi/tests: Test deferral of DeleteServices.
    
    Signed-off-by: Zebediah Figura <[email protected]>
    Signed-off-by: Hans Leidekker <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 5d8e16f7018b4fb0382ec991adc08e1f305bd353 by Zebediah Figura 
<[email protected]>
---
 modules/rostests/winetests/msi/CMakeLists.txt |  2 +-
 modules/rostests/winetests/msi/action.c       | 10 ++++++++++
 modules/rostests/winetests/msi/custom.c       | 24 ++++++++++++++++++++++++
 modules/rostests/winetests/msi/custom.spec    |  2 ++
 4 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/modules/rostests/winetests/msi/CMakeLists.txt 
b/modules/rostests/winetests/msi/CMakeLists.txt
index 229847ed1a5..5090555bf35 100644
--- a/modules/rostests/winetests/msi/CMakeLists.txt
+++ b/modules/rostests/winetests/msi/CMakeLists.txt
@@ -3,7 +3,7 @@ spec2def(custom.dll custom.spec)
 add_library(custom MODULE custom.c ${CMAKE_CURRENT_BINARY_DIR}/custom.def)
 target_link_libraries(custom uuid)
 set_module_type(custom win32dll)
-add_importlibs(custom msi ole32 shell32 msvcrt kernel32)
+add_importlibs(custom msi ole32 shell32 advapi32 msvcrt kernel32)
 
 list(APPEND SOURCE
     action.c
diff --git a/modules/rostests/winetests/msi/action.c 
b/modules/rostests/winetests/msi/action.c
index ce36edaefd8..b0055294946 100644
--- a/modules/rostests/winetests/msi/action.c
+++ b/modules/rostests/winetests/msi/action.c
@@ -282,6 +282,8 @@ static const char sds_install_exec_seq_dat[] =
     "InstallInitialize\t\t1500\n"
     "StopServices\t\t5000\n"
     "DeleteServices\t\t5050\n"
+    "sds_immediate\tNOT REMOVE\t5051\n"
+    "sds_deferred\tNOT REMOVE\t5052\n"
     "MoveFiles\t\t5100\n"
     "InstallFiles\t\t5200\n"
     "DuplicateFiles\t\t5300\n"
@@ -292,6 +294,13 @@ static const char sds_install_exec_seq_dat[] =
     "PublishProduct\t\t5700\n"
     "InstallFinalize\t\t6000\n";
 
+static const char sds_custom_action_dat[] =
+    "Action\tType\tSource\tTarget\n"
+    "s72\ti2\tS64\tS0\n"
+    "CustomAction\tAction\n"
+    "sds_immediate\t1\tcustom.dll\tsds_present\n"
+    "sds_deferred\t1025\tcustom.dll\tsds_absent\n";
+
 static const char rof_component_dat[] =
     "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
     "s72\tS38\ts72\ti2\tS255\tS72\n"
@@ -1823,6 +1832,7 @@ static const msi_table sds_tables[] =
     ADD_TABLE(feature_comp),
     ADD_TABLE(file),
     ADD_TABLE(sds_install_exec_seq),
+    ADD_TABLE(sds_custom_action),
     ADD_TABLE(service_control),
     ADD_TABLE(service_install),
     ADD_TABLE(media),
diff --git a/modules/rostests/winetests/msi/custom.c 
b/modules/rostests/winetests/msi/custom.c
index db6d61239ec..4497f3cc680 100644
--- a/modules/rostests/winetests/msi/custom.c
+++ b/modules/rostests/winetests/msi/custom.c
@@ -23,6 +23,7 @@
 
 #include <windef.h>
 #include <winbase.h>
+#include <winsvc.h>
 #define COBJMACROS
 #include <shlobj.h>
 #include <msxml.h>
@@ -1192,3 +1193,26 @@ todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED))
     ok(hinst, !pf_exists("msitest\\shortcut.lnk"), "shortcut present\n");
     return ERROR_SUCCESS;
 }
+
+UINT WINAPI sds_present(MSIHANDLE hinst)
+{
+    SC_HANDLE manager, service;
+    manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
+    service = OpenServiceA(manager, "TestService3", GENERIC_ALL);
+todo_wine
+    ok(hinst, !!service, "service absent: %u\n", GetLastError());
+    CloseServiceHandle(service);
+    CloseServiceHandle(manager);
+    return ERROR_SUCCESS;
+}
+
+UINT WINAPI sds_absent(MSIHANDLE hinst)
+{
+    SC_HANDLE manager, service;
+    manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
+    service = OpenServiceA(manager, "TestService3", GENERIC_ALL);
+    ok(hinst, !service, "service present\n");
+    if (service) CloseServiceHandle(service);
+    CloseServiceHandle(manager);
+    return ERROR_SUCCESS;
+}
diff --git a/modules/rostests/winetests/msi/custom.spec 
b/modules/rostests/winetests/msi/custom.spec
index 774f77bf793..1485546321c 100644
--- a/modules/rostests/winetests/msi/custom.spec
+++ b/modules/rostests/winetests/msi/custom.spec
@@ -7,3 +7,5 @@
 @ stdcall cf_absent(long)
 @ stdcall crs_present(long)
 @ stdcall crs_absent(long)
+@ stdcall sds_present(long)
+@ stdcall sds_absent(long)

Reply via email to