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

commit dc4f732a065a17aa901232e0f37c092ac508036f
Author:     winesync <[email protected]>
AuthorDate: Sat Mar 12 23:54:33 2022 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Sun Mar 20 19:27:59 2022 +0100

    [WINESYNC] msi/tests: Add a test for asynchronous custom actions.
    
    Signed-off-by: Zebediah Figura <[email protected]>
    Signed-off-by: Hans Leidekker <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 6387476d99f4f762628cb0d72b2d43c23f76f563 by Zebediah Figura 
<[email protected]>
---
 modules/rostests/winetests/msi/custom.c    | 21 +++++++++++++++++++++
 modules/rostests/winetests/msi/custom.spec |  2 ++
 modules/rostests/winetests/msi/install.c   | 10 +++++++++-
 3 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/modules/rostests/winetests/msi/custom.c 
b/modules/rostests/winetests/msi/custom.c
index 3989ca8c10a..6332d68768a 100644
--- a/modules/rostests/winetests/msi/custom.c
+++ b/modules/rostests/winetests/msi/custom.c
@@ -1169,6 +1169,27 @@ UINT WINAPI process2(MSIHANDLE hinst)
     return ERROR_SUCCESS;
 }
 
+UINT WINAPI async1(MSIHANDLE hinst)
+{
+    HANDLE event = CreateEventA(NULL, TRUE, FALSE, "wine_msi_async_test");
+    HANDLE event2 = CreateEventA(NULL, TRUE, FALSE, "wine_msi_async_test2");
+    DWORD r = WaitForSingleObject(event, 10000);
+    ok(hinst, !r, "wait timed out\n");
+    SetEvent(event2);
+    return ERROR_SUCCESS;
+}
+
+UINT WINAPI async2(MSIHANDLE hinst)
+{
+    HANDLE event = CreateEventA(NULL, TRUE, FALSE, "wine_msi_async_test");
+    HANDLE event2 = CreateEventA(NULL, TRUE, FALSE, "wine_msi_async_test2");
+    DWORD r;
+    SetEvent(event);
+    r = WaitForSingleObject(event2, 10000);
+    ok(hinst, !r, "wait timed out\n");
+    return ERROR_SUCCESS;
+}
+
 static BOOL pf_exists(const char *file)
 {
     char path[MAX_PATH];
diff --git a/modules/rostests/winetests/msi/custom.spec 
b/modules/rostests/winetests/msi/custom.spec
index b7cbe582506..5d78377a799 100644
--- a/modules/rostests/winetests/msi/custom.spec
+++ b/modules/rostests/winetests/msi/custom.spec
@@ -5,6 +5,8 @@
 @ stdcall nested(long)
 @ stdcall process1(long)
 @ stdcall process2(long)
+@ stdcall async1(long)
+@ stdcall async2(long)
 
 @ stdcall cf_present(long)
 @ stdcall cf_absent(long)
diff --git a/modules/rostests/winetests/msi/install.c 
b/modules/rostests/winetests/msi/install.c
index e147df6a3a5..4fa186246a1 100644
--- a/modules/rostests/winetests/msi/install.c
+++ b/modules/rostests/winetests/msi/install.c
@@ -677,6 +677,8 @@ static const CHAR ca1_install_exec_seq_dat[] = 
"Action\tCondition\tSequence\n"
                                                "process1\tTEST_PROCESS\t720\n"
                                                "process2\tTEST_PROCESS\t721\n"
                                                
"process_deferred\tTEST_PROCESS\t722\n"
+                                               "async1\tTEST_ASYNC\t730\n"
+                                               "async2\tTEST_ASYNC\t731\n"
                                                "InstallFinalize\t\t800\n";
 
 static const CHAR ca1_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
@@ -689,6 +691,8 @@ static const CHAR ca1_custom_action_dat[] = 
"Action\tType\tSource\tTarget\n"
                                              
"process1\t1\tcustom.dll\tprocess1\n"
                                              
"process2\t1\tcustom.dll\tprocess2\n"
                                              
"process_deferred\t1025\tcustom.dll\tprocess2\n"
+                                             
"async1\t129\tcustom.dll\tasync1\n"
+                                             "async2\t1\tcustom.dll\tasync2\n"
                                              
"testretval\t1\tcustom.dll\ttest_retval\n";
 
 static const CHAR ca1_test_seq_dat[] = "Action\tCondition\tSequence\n"
@@ -4129,7 +4133,7 @@ static void test_customaction1(void)
     r = MsiInstallProductA(msifile, "TEST_RETVAL=0");
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
 
-    r = MsiInstallProductA(msifile, "TEST_RETVAL=1626"); /* 
ERROR_FUNCTION_NOT_CALLED*/
+    r = MsiInstallProductA(msifile, "TEST_RETVAL=1626"); /* 
ERROR_FUNCTION_NOT_CALLED */
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
 
     r = MsiInstallProductA(msifile, "TEST_RETVAL=1602");
@@ -4146,6 +4150,10 @@ static void test_customaction1(void)
     r = MsiInstallProductA(msifile, "TEST_PROCESS=1");
     ok(!r, "got %u\n", r);
 
+    /* test asynchronous actions (msidbCustomActionTypeAsync) */
+    r = MsiInstallProductA(msifile, "TEST_ASYNC=1");
+    ok(!r, "got %u\n", r);
+
     delete_test_files();
     DeleteFileA(msifile);
     DeleteFileA("unus");

Reply via email to