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

commit a06d5f3df5a98ed6142bec470f281c3658c3da24
Author:     winesync <[email protected]>
AuthorDate: Sat Mar 12 15:12:25 2022 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Sun Mar 20 19:27:48 2022 +0100

    [WINESYNC] msi/tests: Test deferral of InstallODBC and RemoveODBC.
    
    Signed-off-by: Zebediah Figura <[email protected]>
    Signed-off-by: Hans Leidekker <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 7305e5fd8c1262e369c2807e83adfb9aaf4f2e7a by Zebediah Figura 
<[email protected]>
---
 modules/rostests/winetests/msi/CMakeLists.txt |  2 +-
 modules/rostests/winetests/msi/action.c       | 14 ++++++++
 modules/rostests/winetests/msi/custom.c       | 49 +++++++++++++++++++++++++++
 modules/rostests/winetests/msi/custom.spec    |  2 ++
 4 files changed, 66 insertions(+), 1 deletion(-)

diff --git a/modules/rostests/winetests/msi/CMakeLists.txt 
b/modules/rostests/winetests/msi/CMakeLists.txt
index e44cb08c6f8..e40bf5dc904 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 advapi32 msvcrt kernel32)
+add_importlibs(custom msi ole32 odbccp32 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 e33decc5733..943c939dc7b 100644
--- a/modules/rostests/winetests/msi/action.c
+++ b/modules/rostests/winetests/msi/action.c
@@ -870,7 +870,11 @@ static const char odbc_install_exec_seq_dat[] =
     "InstallInitialize\t\t1500\n"
     "ProcessComponents\t\t1600\n"
     "InstallODBC\t\t3000\n"
+    "io_immediate\tNOT REMOVE\t3001\n"
+    "io_deferred\tNOT REMOVE\t3002\n"
     "RemoveODBC\t\t3100\n"
+    "ro_immediate\tREMOVE\t3101\n"
+    "ro_deferred\tREMOVE\t3102\n"
     "RemoveFiles\t\t3900\n"
     "InstallFiles\t\t4000\n"
     "RegisterProduct\t\t5000\n"
@@ -878,6 +882,15 @@ static const char odbc_install_exec_seq_dat[] =
     "PublishProduct\t\t5200\n"
     "InstallFinalize\t\t6000\n";
 
+static const char odbc_custom_action_dat[] =
+    "Action\tType\tSource\tTarget\n"
+    "s72\ti2\tS64\tS0\n"
+    "CustomAction\tAction\n"
+    "io_immediate\t1\tcustom.dll\todbc_absent\n"
+    "io_deferred\t1025\tcustom.dll\todbc_present\n"
+    "ro_immediate\t1\tcustom.dll\todbc_present\n"
+    "ro_deferred\t1025\tcustom.dll\todbc_absent\n";
+
 static const char odbc_media_dat[] =
     "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
     "i2\ti4\tL64\tS255\tS32\tS72\n"
@@ -1969,6 +1982,7 @@ static const msi_table odbc_tables[] =
     ADD_TABLE(odbc_translator),
     ADD_TABLE(odbc_datasource),
     ADD_TABLE(odbc_install_exec_seq),
+    ADD_TABLE(odbc_custom_action),
     ADD_TABLE(odbc_media),
     ADD_TABLE(property)
 };
diff --git a/modules/rostests/winetests/msi/custom.c 
b/modules/rostests/winetests/msi/custom.c
index 4e3e2dce8e1..0f34eb02f46 100644
--- a/modules/rostests/winetests/msi/custom.c
+++ b/modules/rostests/winetests/msi/custom.c
@@ -24,6 +24,7 @@
 #include <windef.h>
 #include <winbase.h>
 #include <winsvc.h>
+#include <odbcinst.h>
 #define COBJMACROS
 #include <shlobj.h>
 #include <msxml.h>
@@ -1314,3 +1315,51 @@ todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
     ok(hinst, !pf_exists("msitest\\duplicate2.txt"), "file present\n");
     return ERROR_SUCCESS;
 }
+
+UINT WINAPI odbc_present(MSIHANDLE hinst)
+{
+    int gotdriver = 0, gotdriver2 = 0;
+    char buffer[1000], *p;
+    WORD len;
+    BOOL r;
+
+    r = SQLGetInstalledDrivers(buffer, sizeof(buffer), &len);
+    ok(hinst, len < sizeof(buffer), "buffer too small\n");
+    ok(hinst, r, "SQLGetInstalledDrivers failed\n");
+    for (p = buffer; *p; p += strlen(p) + 1)
+    {
+        if (!strcmp(p, "ODBC test driver"))
+            gotdriver = 1;
+        if (!strcmp(p, "ODBC test driver2"))
+            gotdriver2 = 1;
+    }
+todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
+    ok(hinst, gotdriver, "driver absent\n");
+    ok(hinst, gotdriver2, "driver 2 absent\n");
+}
+    return ERROR_SUCCESS;
+}
+
+UINT WINAPI odbc_absent(MSIHANDLE hinst)
+{
+    int gotdriver = 0, gotdriver2 = 0;
+    char buffer[1000], *p;
+    WORD len;
+    BOOL r;
+
+    r = SQLGetInstalledDrivers(buffer, sizeof(buffer), &len);
+    ok(hinst, len < sizeof(buffer), "buffer too small\n");
+    ok(hinst, r, "SQLGetInstalledDrivers failed\n");
+    for (p = buffer; *p; p += strlen(p) + 1)
+    {
+        if (!strcmp(p, "ODBC test driver"))
+            gotdriver = 1;
+        if (!strcmp(p, "ODBC test driver2"))
+            gotdriver2 = 1;
+    }
+todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
+    ok(hinst, !gotdriver, "driver present\n");
+    ok(hinst, !gotdriver2, "driver 2 present\n");
+}
+    return ERROR_SUCCESS;
+}
diff --git a/modules/rostests/winetests/msi/custom.spec 
b/modules/rostests/winetests/msi/custom.spec
index 1b15ca9f456..52feffa03f0 100644
--- a/modules/rostests/winetests/msi/custom.spec
+++ b/modules/rostests/winetests/msi/custom.spec
@@ -9,6 +9,8 @@
 @ stdcall crs_absent(long)
 @ stdcall file_present(long)
 @ stdcall file_absent(long)
+@ stdcall odbc_present(long)
+@ stdcall odbc_absent(long)
 @ stdcall rd_present(long)
 @ stdcall rd_absent(long)
 @ stdcall sds_present(long)

Reply via email to