From 7305e5fd8c1262e369c2807e83adfb9aaf4f2e7a Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 18 May 2018 22:00:58 -0500 Subject: [PATCH] msi/tests: Test deferral of InstallODBC and RemoveODBC. Signed-off-by: Zebediah Figura Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/msi/tests/Makefile.in | 2 +- dlls/msi/tests/action.c | 14 +++++++++++ dlls/msi/tests/custom.c | 49 ++++++++++++++++++++++++++++++++++++++ dlls/msi/tests/custom.spec | 2 ++ 4 files changed, 66 insertions(+), 1 deletion(-) diff --git a/dlls/msi/tests/Makefile.in b/dlls/msi/tests/Makefile.in index 43a56572971..18a6457e4a1 100644 --- a/dlls/msi/tests/Makefile.in +++ b/dlls/msi/tests/Makefile.in @@ -1,7 +1,7 @@ TESTDLL = msi.dll IMPORTS = cabinet msi shell32 ole32 oleaut32 user32 advapi32 version odbccp32 -custom_IMPORTS = uuid msi ole32 shell32 advapi32 +custom_IMPORTS = uuid msi ole32 shell32 advapi32 odbccp32 SOURCES = \ action.c \ diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c index e33decc5733..943c939dc7b 100644 --- a/dlls/msi/tests/action.c +++ b/dlls/msi/tests/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/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 4e3e2dce8e1..0f34eb02f46 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -24,6 +24,7 @@ #include #include #include +#include #define COBJMACROS #include #include @@ -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/dlls/msi/tests/custom.spec b/dlls/msi/tests/custom.spec index 1b15ca9f456..52feffa03f0 100644 --- a/dlls/msi/tests/custom.spec +++ b/dlls/msi/tests/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)