msi/tests: Test deferral of InstallODBC and RemoveODBC.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2018-05-18 22:00:58 -05:00 committed by Alexandre Julliard
parent 7f69ea3c57
commit 7305e5fd8c
4 changed files with 66 additions and 1 deletions

View File

@ -1,7 +1,7 @@
TESTDLL = msi.dll TESTDLL = msi.dll
IMPORTS = cabinet msi shell32 ole32 oleaut32 user32 advapi32 version odbccp32 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 = \ SOURCES = \
action.c \ action.c \

View File

@ -870,7 +870,11 @@ static const char odbc_install_exec_seq_dat[] =
"InstallInitialize\t\t1500\n" "InstallInitialize\t\t1500\n"
"ProcessComponents\t\t1600\n" "ProcessComponents\t\t1600\n"
"InstallODBC\t\t3000\n" "InstallODBC\t\t3000\n"
"io_immediate\tNOT REMOVE\t3001\n"
"io_deferred\tNOT REMOVE\t3002\n"
"RemoveODBC\t\t3100\n" "RemoveODBC\t\t3100\n"
"ro_immediate\tREMOVE\t3101\n"
"ro_deferred\tREMOVE\t3102\n"
"RemoveFiles\t\t3900\n" "RemoveFiles\t\t3900\n"
"InstallFiles\t\t4000\n" "InstallFiles\t\t4000\n"
"RegisterProduct\t\t5000\n" "RegisterProduct\t\t5000\n"
@ -878,6 +882,15 @@ static const char odbc_install_exec_seq_dat[] =
"PublishProduct\t\t5200\n" "PublishProduct\t\t5200\n"
"InstallFinalize\t\t6000\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[] = static const char odbc_media_dat[] =
"DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n" "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
"i2\ti4\tL64\tS255\tS32\tS72\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_translator),
ADD_TABLE(odbc_datasource), ADD_TABLE(odbc_datasource),
ADD_TABLE(odbc_install_exec_seq), ADD_TABLE(odbc_install_exec_seq),
ADD_TABLE(odbc_custom_action),
ADD_TABLE(odbc_media), ADD_TABLE(odbc_media),
ADD_TABLE(property) ADD_TABLE(property)
}; };

View File

@ -24,6 +24,7 @@
#include <windef.h> #include <windef.h>
#include <winbase.h> #include <winbase.h>
#include <winsvc.h> #include <winsvc.h>
#include <odbcinst.h>
#define COBJMACROS #define COBJMACROS
#include <shlobj.h> #include <shlobj.h>
#include <msxml.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"); ok(hinst, !pf_exists("msitest\\duplicate2.txt"), "file present\n");
return ERROR_SUCCESS; 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;
}

View File

@ -9,6 +9,8 @@
@ stdcall crs_absent(long) @ stdcall crs_absent(long)
@ stdcall file_present(long) @ stdcall file_present(long)
@ stdcall file_absent(long) @ stdcall file_absent(long)
@ stdcall odbc_present(long)
@ stdcall odbc_absent(long)
@ stdcall rd_present(long) @ stdcall rd_present(long)
@ stdcall rd_absent(long) @ stdcall rd_absent(long)
@ stdcall sds_present(long) @ stdcall sds_present(long)