Skip to content

Commit a06d5f3

Browse files
winesynclearn-more
authored andcommitted
[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]>
1 parent d15d81d commit a06d5f3

File tree

4 files changed

+66
-1
lines changed

4 files changed

+66
-1
lines changed

modules/rostests/winetests/msi/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ spec2def(custom.dll custom.spec)
33
add_library(custom MODULE custom.c ${CMAKE_CURRENT_BINARY_DIR}/custom.def)
44
target_link_libraries(custom uuid)
55
set_module_type(custom win32dll)
6-
add_importlibs(custom msi ole32 shell32 advapi32 msvcrt kernel32)
6+
add_importlibs(custom msi ole32 odbccp32 shell32 advapi32 msvcrt kernel32)
77

88
list(APPEND SOURCE
99
action.c

modules/rostests/winetests/msi/action.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,14 +870,27 @@ static const char odbc_install_exec_seq_dat[] =
870870
"InstallInitialize\t\t1500\n"
871871
"ProcessComponents\t\t1600\n"
872872
"InstallODBC\t\t3000\n"
873+
"io_immediate\tNOT REMOVE\t3001\n"
874+
"io_deferred\tNOT REMOVE\t3002\n"
873875
"RemoveODBC\t\t3100\n"
876+
"ro_immediate\tREMOVE\t3101\n"
877+
"ro_deferred\tREMOVE\t3102\n"
874878
"RemoveFiles\t\t3900\n"
875879
"InstallFiles\t\t4000\n"
876880
"RegisterProduct\t\t5000\n"
877881
"PublishFeatures\t\t5100\n"
878882
"PublishProduct\t\t5200\n"
879883
"InstallFinalize\t\t6000\n";
880884

885+
static const char odbc_custom_action_dat[] =
886+
"Action\tType\tSource\tTarget\n"
887+
"s72\ti2\tS64\tS0\n"
888+
"CustomAction\tAction\n"
889+
"io_immediate\t1\tcustom.dll\todbc_absent\n"
890+
"io_deferred\t1025\tcustom.dll\todbc_present\n"
891+
"ro_immediate\t1\tcustom.dll\todbc_present\n"
892+
"ro_deferred\t1025\tcustom.dll\todbc_absent\n";
893+
881894
static const char odbc_media_dat[] =
882895
"DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
883896
"i2\ti4\tL64\tS255\tS32\tS72\n"
@@ -1969,6 +1982,7 @@ static const msi_table odbc_tables[] =
19691982
ADD_TABLE(odbc_translator),
19701983
ADD_TABLE(odbc_datasource),
19711984
ADD_TABLE(odbc_install_exec_seq),
1985+
ADD_TABLE(odbc_custom_action),
19721986
ADD_TABLE(odbc_media),
19731987
ADD_TABLE(property)
19741988
};

modules/rostests/winetests/msi/custom.c

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <windef.h>
2525
#include <winbase.h>
2626
#include <winsvc.h>
27+
#include <odbcinst.h>
2728
#define COBJMACROS
2829
#include <shlobj.h>
2930
#include <msxml.h>
@@ -1314,3 +1315,51 @@ todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
13141315
ok(hinst, !pf_exists("msitest\\duplicate2.txt"), "file present\n");
13151316
return ERROR_SUCCESS;
13161317
}
1318+
1319+
UINT WINAPI odbc_present(MSIHANDLE hinst)
1320+
{
1321+
int gotdriver = 0, gotdriver2 = 0;
1322+
char buffer[1000], *p;
1323+
WORD len;
1324+
BOOL r;
1325+
1326+
r = SQLGetInstalledDrivers(buffer, sizeof(buffer), &len);
1327+
ok(hinst, len < sizeof(buffer), "buffer too small\n");
1328+
ok(hinst, r, "SQLGetInstalledDrivers failed\n");
1329+
for (p = buffer; *p; p += strlen(p) + 1)
1330+
{
1331+
if (!strcmp(p, "ODBC test driver"))
1332+
gotdriver = 1;
1333+
if (!strcmp(p, "ODBC test driver2"))
1334+
gotdriver2 = 1;
1335+
}
1336+
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
1337+
ok(hinst, gotdriver, "driver absent\n");
1338+
ok(hinst, gotdriver2, "driver 2 absent\n");
1339+
}
1340+
return ERROR_SUCCESS;
1341+
}
1342+
1343+
UINT WINAPI odbc_absent(MSIHANDLE hinst)
1344+
{
1345+
int gotdriver = 0, gotdriver2 = 0;
1346+
char buffer[1000], *p;
1347+
WORD len;
1348+
BOOL r;
1349+
1350+
r = SQLGetInstalledDrivers(buffer, sizeof(buffer), &len);
1351+
ok(hinst, len < sizeof(buffer), "buffer too small\n");
1352+
ok(hinst, r, "SQLGetInstalledDrivers failed\n");
1353+
for (p = buffer; *p; p += strlen(p) + 1)
1354+
{
1355+
if (!strcmp(p, "ODBC test driver"))
1356+
gotdriver = 1;
1357+
if (!strcmp(p, "ODBC test driver2"))
1358+
gotdriver2 = 1;
1359+
}
1360+
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
1361+
ok(hinst, !gotdriver, "driver present\n");
1362+
ok(hinst, !gotdriver2, "driver 2 present\n");
1363+
}
1364+
return ERROR_SUCCESS;
1365+
}

modules/rostests/winetests/msi/custom.spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
@ stdcall crs_absent(long)
1010
@ stdcall file_present(long)
1111
@ stdcall file_absent(long)
12+
@ stdcall odbc_present(long)
13+
@ stdcall odbc_absent(long)
1214
@ stdcall rd_present(long)
1315
@ stdcall rd_absent(long)
1416
@ stdcall sds_present(long)

0 commit comments

Comments
 (0)