2424#include <windef.h>
2525#include <winbase.h>
2626#define COBJMACROS
27+ #include <shlobj.h>
2728#include <msxml.h>
2829#include <msi.h>
2930#include <msiquery.h>
3031
32+ static int todo_level , todo_do_loop ;
33+
3134static void ok_ (MSIHANDLE hinst , int todo , const char * file , int line , int condition , const char * msg , ...)
3235{
3336 static char buffer [2000 ];
@@ -47,8 +50,30 @@ static void ok_(MSIHANDLE hinst, int todo, const char *file, int line, int condi
4750 MsiProcessMessage (hinst , INSTALLMESSAGE_USER , record );
4851 MsiCloseHandle (record );
4952}
50- #define ok (hinst , condition , ...) ok_(hinst, 0, __FILE__, __LINE__, condition, __VA_ARGS__)
51- #define todo_wine_ok (hinst , condition , ...) ok_(hinst, 1, __FILE__, __LINE__, condition, __VA_ARGS__)
53+
54+ static void winetest_start_todo ( int is_todo )
55+ {
56+ todo_level = (todo_level << 1 ) | (is_todo != 0 );
57+ todo_do_loop = 1 ;
58+ }
59+
60+ static int winetest_loop_todo (void )
61+ {
62+ int do_loop = todo_do_loop ;
63+ todo_do_loop = 0 ;
64+ return do_loop ;
65+ }
66+
67+ static void winetest_end_todo (void )
68+ {
69+ todo_level >>= 1 ;
70+ }
71+
72+ #define ok (hinst , condition , ...) ok_(hinst, todo_level, __FILE__, __LINE__, condition, __VA_ARGS__)
73+ #define todo_wine_if (is_todo ) for (winetest_start_todo(is_todo); \
74+ winetest_loop_todo(); \
75+ winetest_end_todo())
76+ #define todo_wine todo_wine_if(1)
5277
5378static const char * dbgstr_w (WCHAR * str )
5479{
@@ -886,15 +911,17 @@ static void test_costs(MSIHANDLE hinst)
886911 cost = 0xdead ;
887912 r = MsiGetFeatureCostA (hinst , NULL , MSICOSTTREE_CHILDREN , INSTALLSTATE_LOCAL , & cost );
888913 ok (hinst , r == ERROR_INVALID_PARAMETER , "got %u\n" , r );
889- todo_wine_ok (hinst , !cost , "got %d\n" , cost );
914+ todo_wine
915+ ok (hinst , !cost , "got %d \n ", cost );
890916
891917 r = MsiGetFeatureCostA (hinst , "One" , MSICOSTTREE_CHILDREN , INSTALLSTATE_LOCAL , NULL );
892918 ok (hinst , r == RPC_X_NULL_REF_POINTER , "got %u\n" , r );
893919
894920 cost = 0xdead ;
895921 r = MsiGetFeatureCostA (hinst , "One" , MSICOSTTREE_CHILDREN , INSTALLSTATE_LOCAL , & cost );
896922 ok (hinst , !r , "got %u\n" , r );
897- todo_wine_ok (hinst , cost == 8 , "got %d\n" , cost );
923+ todo_wine
924+ ok (hinst , cost == 8 , "got %d \n ", cost );
898925
899926 sz = cost = temp = 0xdead ;
900927 r = MsiEnumComponentCostsA (hinst , "One" , 0 , INSTALLSTATE_LOCAL , NULL , & sz , & cost , & temp );
@@ -946,23 +973,28 @@ static void test_costs(MSIHANDLE hinst)
946973 r = MsiEnumComponentCostsA (hinst , "One" , 0 , INSTALLSTATE_LOCAL , buffer , & sz , & cost , & temp );
947974 ok (hinst , r == ERROR_MORE_DATA , "got %u\n" , r );
948975 ok (hinst , !strcmp (buffer , "q" ), "got \"%s\"\n" , buffer );
949- todo_wine_ok (hinst , sz == 4 , "got size %u\n" , sz );
976+ todo_wine
977+ ok (hinst , sz == 4 , "got size %u\n" , sz );
950978 ok (hinst , cost == 8 , "got cost %d\n" , cost );
951979 ok (hinst , !temp , "got temp %d\n" , temp );
952980
953981 sz = 1 ;
954982 strcpy (buffer ,"x" );
955983 r = MsiEnumComponentCostsA (hinst , "One" , 0 , INSTALLSTATE_LOCAL , buffer , & sz , & cost , & temp );
956984 ok (hinst , r == ERROR_MORE_DATA , "got %u\n" , r );
957- todo_wine_ok (hinst , !buffer [0 ], "got \"%s\"\n" , buffer );
958- todo_wine_ok (hinst , sz == 4 , "got size %u\n" , sz );
985+ todo_wine {
986+ ok (hinst , !buffer [0 ], "got \"%s\"\n" , buffer );
987+ ok (hinst , sz == 4 , "got size %u\n" , sz );
988+ }
959989
960990 sz = 2 ;
961991 strcpy (buffer ,"x" );
962992 r = MsiEnumComponentCostsA (hinst , "One" , 0 , INSTALLSTATE_LOCAL , buffer , & sz , & cost , & temp );
963993 ok (hinst , r == ERROR_MORE_DATA , "got %u\n" , r );
964- todo_wine_ok (hinst , !strcmp (buffer , "C" ), "got \"%s\"\n" , buffer );
965- todo_wine_ok (hinst , sz == 4 , "got size %u\n" , sz );
994+ todo_wine {
995+ ok (hinst , !strcmp (buffer , "C" ), "got \"%s\"\n" , buffer );
996+ ok (hinst , sz == 4 , "got size %u\n" , sz );
997+ }
966998
967999 sz = 3 ;
9681000 strcpy (buffer ,"x" );
@@ -1021,7 +1053,8 @@ UINT WINAPI main_test(MSIHANDLE hinst)
10211053
10221054 /* Test MsiGetDatabaseState() */
10231055 res = MsiGetDatabaseState (hinst );
1024- todo_wine_ok (hinst , res == MSIDBSTATE_ERROR , "expected MSIDBSTATE_ERROR, got %u\n" , res );
1056+ todo_wine
1057+ ok (hinst , res == MSIDBSTATE_ERROR , "expected MSIDBSTATE_ERROR, got %u\n" , res );
10251058
10261059 test_props (hinst );
10271060 test_db (hinst );
@@ -1101,7 +1134,8 @@ UINT WINAPI da_deferred(MSIHANDLE hinst)
11011134 len = sizeof (prop );
11021135 r = MsiGetPropertyA (hinst , "TESTPATH" , prop , & len );
11031136 ok (hinst , r == ERROR_SUCCESS , "got %u\n" , r );
1104- todo_wine_ok (hinst , !prop [0 ], "got %s\n" , prop );
1137+ todo_wine
1138+ ok (hinst , !prop [0 ], "got %s \n ", prop );
11051139
11061140 /* Test modes */
11071141 ok (hinst , MsiGetMode (hinst , MSIRUNMODE_SCHEDULED ), "should be scheduled\n" );
@@ -1113,3 +1147,34 @@ UINT WINAPI da_deferred(MSIHANDLE hinst)
11131147
11141148 return ERROR_SUCCESS ;
11151149}
1150+
1151+ static BOOL pf_exists (const char * file )
1152+ {
1153+ char path [MAX_PATH ];
1154+
1155+ if (FAILED (SHGetFolderPathA (NULL , CSIDL_PROGRAM_FILESX86 , NULL , 0 , path )))
1156+ SHGetFolderPathA (NULL , CSIDL_PROGRAM_FILES , NULL , 0 , path );
1157+ strcat (path , "\\" );
1158+ strcat (path , file );
1159+ return GetFileAttributesA (path ) != INVALID_FILE_ATTRIBUTES ;
1160+ }
1161+
1162+ UINT WINAPI cf_present (MSIHANDLE hinst )
1163+ {
1164+ todo_wine_if (!MsiGetMode (hinst , MSIRUNMODE_SCHEDULED )) {
1165+ ok (hinst , pf_exists ("msitest\\first" ), "folder absent\n" );
1166+ ok (hinst , pf_exists ("msitest\\second" ), "folder absent\n" );
1167+ ok (hinst , pf_exists ("msitest\\third" ), "folder absent\n" );
1168+ }
1169+ return ERROR_SUCCESS ;
1170+ }
1171+
1172+ UINT WINAPI cf_absent (MSIHANDLE hinst )
1173+ {
1174+ todo_wine_if (!MsiGetMode (hinst , MSIRUNMODE_SCHEDULED )) {
1175+ ok (hinst , !pf_exists ("msitest\\first" ), "folder present\n" );
1176+ ok (hinst , !pf_exists ("msitest\\second" ), "folder present\n" );
1177+ ok (hinst , !pf_exists ("msitest\\third" ), "folder present\n" );
1178+ }
1179+ return ERROR_SUCCESS ;
1180+ }
0 commit comments