2 * tests for Microsoft Installer functionality
4 * Copyright 2005 Mike McCormack for CodeWeavers
5 * Copyright 2005 Aric Stewart for CodeWeavers
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #include "wine/test.h"
31 static UINT run_query( MSIHANDLE hdb, const char *query )
36 r = MsiDatabaseOpenView(hdb, query, &hview);
37 if( r != ERROR_SUCCESS )
40 r = MsiViewExecute(hview, 0);
41 if( r == ERROR_SUCCESS )
42 r = MsiViewClose(hview);
43 MsiCloseHandle(hview);
47 static UINT set_summary_info(MSIHANDLE hdb)
52 /* build summmary info */
53 res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
54 ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
56 res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
57 "Installation Database");
58 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
60 res = MsiSummaryInfoSetProperty(suminfo,3, VT_LPSTR, 0,NULL,
61 "Installation Database");
62 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
64 res = MsiSummaryInfoSetProperty(suminfo,4, VT_LPSTR, 0,NULL,
66 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
68 res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
70 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
72 res = MsiSummaryInfoSetProperty(suminfo,9, VT_LPSTR, 0,NULL,
73 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
74 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
76 res = MsiSummaryInfoSetProperty(suminfo, 14, VT_I4, 100, NULL, NULL);
77 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
79 res = MsiSummaryInfoSetProperty(suminfo, 15, VT_I4, 0, NULL, NULL);
80 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
82 res = MsiSummaryInfoPersist(suminfo);
83 ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
85 res = MsiCloseHandle( suminfo);
86 ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
92 MSIHANDLE create_package_db(void)
95 CHAR szName[] = "winetest.msi";
100 /* create an empty database */
101 res = MsiOpenDatabase(szName, MSIDBOPEN_CREATE, &hdb );
102 ok( res == ERROR_SUCCESS , "Failed to create database\n" );
103 if( res != ERROR_SUCCESS )
106 res = MsiDatabaseCommit( hdb );
107 ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
109 res = set_summary_info(hdb);
111 res = run_query( hdb,
112 "CREATE TABLE `Directory` ( "
113 "`Directory` CHAR(255) NOT NULL, "
114 "`Directory_Parent` CHAR(255), "
115 "`DefaultDir` CHAR(255) NOT NULL "
116 "PRIMARY KEY `Directory`)" );
117 ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
122 MSIHANDLE package_from_db(MSIHANDLE hdb)
128 sprintf(szPackage,"#%li",hdb);
129 res = MsiOpenPackage(szPackage,&hPackage);
130 ok( res == ERROR_SUCCESS , "Failed to open package\n" );
132 res = MsiCloseHandle(hdb);
133 ok( res == ERROR_SUCCESS , "Failed to close db handle\n" );
138 static void test_createpackage(void)
140 MSIHANDLE hPackage = 0;
143 hPackage = package_from_db(create_package_db());
144 ok( hPackage != 0, " Failed to create package\n");
146 res = MsiCloseHandle( hPackage);
147 ok( res == ERROR_SUCCESS , "Failed to close package\n" );
150 static void test_getsourcepath_bad( void )
152 static const char str[] = { 0 };
157 r = MsiGetSourcePath( -1, NULL, NULL, NULL );
158 ok( r == ERROR_INVALID_PARAMETER, "return value wrong\n");
161 r = MsiGetSourcePath( -1, NULL, buffer, &sz );
162 ok( r == ERROR_INVALID_PARAMETER, "return value wrong\n");
165 r = MsiGetSourcePath( -1, str, NULL, &sz );
166 ok( r == ERROR_INVALID_HANDLE, "return value wrong\n");
169 r = MsiGetSourcePath( -1, str, NULL, NULL );
170 ok( r == ERROR_INVALID_HANDLE, "return value wrong\n");
173 r = MsiGetSourcePath( -1, str, buffer, &sz );
174 ok( r == ERROR_INVALID_HANDLE, "return value wrong\n");
177 static UINT add_directory_entry( MSIHANDLE hdb, char *values )
179 char insert[] = "INSERT INTO `Directory` (`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )";
183 sz = strlen(values) + sizeof insert;
184 query = HeapAlloc(GetProcessHeap(),0,sz);
185 sprintf(query,insert,values);
186 r = run_query( hdb, query );
187 HeapFree(GetProcessHeap(), 0, query);
191 static void test_getsourcepath( void )
193 static const char str[] = { 0 };
199 hpkg = package_from_db(create_package_db());
200 ok( hpkg, "failed to create package\n");
204 r = MsiGetSourcePath( hpkg, str, buffer, &sz );
205 ok( r == ERROR_DIRECTORY, "return value wrong\n");
206 ok( buffer[0] == 'x', "buffer modified\n");
210 r = MsiGetSourcePath( hpkg, str, buffer, &sz );
211 ok( r == ERROR_DIRECTORY, "return value wrong\n");
212 ok( buffer[0] == 'x', "buffer modified\n");
214 MsiCloseHandle( hpkg );
217 /* another test but try create a directory this time */
218 hdb = create_package_db();
219 ok( hdb, "failed to create database\n");
221 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
222 ok( r == S_OK, "failed\n");
224 hpkg = package_from_db(hdb);
225 ok( hpkg, "failed to create package\n");
227 sz = sizeof buffer -1;
228 strcpy(buffer,"x bad");
229 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, &sz );
230 ok( r == ERROR_DIRECTORY, "return value wrong\n");
233 r = MsiDoAction( hpkg, "CostInitialize");
234 ok( r == ERROR_SUCCESS, "cost init failed\n");
236 r = MsiDoAction( hpkg, "CostFinalize");
237 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
240 sz = sizeof buffer -1;
242 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, &sz );
243 ok( r == ERROR_SUCCESS, "return value wrong\n");
244 ok( sz == strlen(buffer), "returned length wrong\n");
247 strcpy(buffer,"x bad");
248 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, &sz );
249 ok( r == ERROR_MORE_DATA, "return value wrong\n");
251 ok( buffer[0] == 'x', "buffer modified\n");
254 r = MsiGetSourcePath( hpkg, "TARGETDIR", NULL, NULL );
255 ok( r == ERROR_SUCCESS, "return value wrong\n");
258 r = MsiGetSourcePath( hpkg, "TARGETDIR ", NULL, NULL );
259 ok( r == ERROR_DIRECTORY, "return value wrong\n");
261 r = MsiGetSourcePath( hpkg, "targetdir", NULL, NULL );
262 ok( r == ERROR_DIRECTORY, "return value wrong\n");
264 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, NULL );
265 ok( r == ERROR_INVALID_PARAMETER, "return value wrong\n");
268 r = MsiGetSourcePath( hpkg, "TARGETDIR", NULL, &sz );
269 ok( r == ERROR_SUCCESS, "return value wrong\n");
272 MsiCloseHandle( hpkg );
275 static void test_doaction( void )
280 r = MsiDoAction( -1, NULL );
281 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
283 hpkg = package_from_db(create_package_db());
284 ok( hpkg, "failed to create package\n");
286 r = MsiDoAction(hpkg, NULL);
287 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
289 r = MsiDoAction(0, "boo");
290 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
292 r = MsiDoAction(hpkg, "boo");
293 ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
295 MsiCloseHandle( hpkg );
298 static void test_gettargetpath_bad(void)
305 hpkg = package_from_db(create_package_db());
306 ok( hpkg, "failed to create package\n");
308 r = MsiGetTargetPath( 0, NULL, NULL, NULL );
309 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
311 r = MsiGetTargetPath( 0, NULL, NULL, &sz );
312 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
314 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
315 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
317 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
318 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
320 r = MsiGetTargetPath( hpkg, "boo", NULL, NULL );
321 ok( r == ERROR_DIRECTORY, "wrong return val\n");
323 r = MsiGetTargetPath( hpkg, "boo", buffer, NULL );
324 ok( r == ERROR_DIRECTORY, "wrong return val\n");
326 MsiCloseHandle( hpkg );
329 void test_settargetpath_bad(void)
334 hpkg = package_from_db(create_package_db());
335 ok( hpkg, "failed to create package\n");
337 r = MsiSetTargetPath( 0, NULL, NULL );
338 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
340 r = MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
341 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
343 r = MsiSetTargetPath( hpkg, "boo", NULL );
344 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
346 r = MsiSetTargetPath( hpkg, "boo", "c:\\bogusx" );
347 ok( r == ERROR_DIRECTORY, "wrong return val\n");
349 MsiCloseHandle( hpkg );
352 void test_condition(void)
357 hpkg = package_from_db(create_package_db());
358 ok( hpkg, "failed to create package\n");
360 r = MsiEvaluateCondition(0, NULL);
361 ok( r == MSICONDITION_ERROR, "wrong return val\n");
363 r = MsiEvaluateCondition(hpkg, NULL);
364 ok( r == MSICONDITION_NONE, "wrong return val\n");
366 r = MsiEvaluateCondition(hpkg, "");
367 ok( r == MSICONDITION_NONE, "wrong return val\n");
369 r = MsiEvaluateCondition(hpkg, "1");
370 ok( r == MSICONDITION_TRUE, "wrong return val\n");
372 r = MsiEvaluateCondition(hpkg, "0");
373 ok( r == MSICONDITION_FALSE, "wrong return val\n");
375 r = MsiEvaluateCondition(hpkg, "0 = 0");
376 ok( r == MSICONDITION_TRUE, "wrong return val\n");
378 r = MsiEvaluateCondition(hpkg, "0 <> 0");
379 ok( r == MSICONDITION_FALSE, "wrong return val\n");
381 r = MsiEvaluateCondition(hpkg, "0 = 1");
382 ok( r == MSICONDITION_FALSE, "wrong return val\n");
384 r = MsiEvaluateCondition(hpkg, "0 >= 1");
385 ok( r == MSICONDITION_FALSE, "wrong return val\n");
387 r = MsiEvaluateCondition(hpkg, "0 >=");
388 ok( r == MSICONDITION_ERROR, "wrong return val\n");
390 r = MsiEvaluateCondition(hpkg, " ");
391 ok( r == MSICONDITION_NONE, "wrong return val\n");
393 r = MsiEvaluateCondition(hpkg, "LicView <> \"1\"");
394 ok( r == MSICONDITION_TRUE, "wrong return val\n");
396 r = MsiEvaluateCondition(hpkg, "LicView <> \"0\"");
397 ok( r == MSICONDITION_TRUE, "wrong return val\n");
399 r = MsiEvaluateCondition(hpkg, "LicView <> LicView");
400 ok( r == MSICONDITION_FALSE, "wrong return val\n");
402 r = MsiEvaluateCondition(hpkg, "not 0");
403 ok( r == MSICONDITION_TRUE, "wrong return val\n");
405 r = MsiEvaluateCondition(hpkg, "not LicView");
406 ok( r == MSICONDITION_TRUE, "wrong return val\n");
408 r = MsiEvaluateCondition(hpkg, "not \"A\"");
409 ok( r == MSICONDITION_FALSE, "wrong return val\n");
411 r = MsiEvaluateCondition(hpkg, "~not \"A\"");
412 ok( r == MSICONDITION_ERROR, "wrong return val\n");
414 r = MsiEvaluateCondition(hpkg, "\"0\"");
415 ok( r == MSICONDITION_TRUE, "wrong return val\n");
417 r = MsiEvaluateCondition(hpkg, "1 and 2");
418 ok( r == MSICONDITION_TRUE, "wrong return val\n");
420 r = MsiEvaluateCondition(hpkg, "not 0 and 3");
421 ok( r == MSICONDITION_TRUE, "wrong return val\n");
423 r = MsiEvaluateCondition(hpkg, "not 0 and 0");
424 ok( r == MSICONDITION_FALSE, "wrong return val\n");
426 r = MsiEvaluateCondition(hpkg, "not 0 or 1");
427 ok( r == MSICONDITION_TRUE, "wrong return val\n");
429 r = MsiEvaluateCondition(hpkg, "(0)");
430 ok( r == MSICONDITION_FALSE, "wrong return val\n");
432 r = MsiEvaluateCondition(hpkg, "(((((1))))))");
433 ok( r == MSICONDITION_ERROR, "wrong return val\n");
435 r = MsiEvaluateCondition(hpkg, "(((((1)))))");
436 ok( r == MSICONDITION_TRUE, "wrong return val\n");
438 r = MsiEvaluateCondition(hpkg, " \"A\" < \"B\" ");
439 ok( r == MSICONDITION_TRUE, "wrong return val\n");
441 r = MsiEvaluateCondition(hpkg, " \"A\" > \"B\" ");
442 ok( r == MSICONDITION_FALSE, "wrong return val\n");
444 r = MsiEvaluateCondition(hpkg, " \"1\" > \"12\" ");
445 ok( r == MSICONDITION_FALSE, "wrong return val\n");
447 r = MsiEvaluateCondition(hpkg, " \"100\" < \"21\" ");
448 ok( r == MSICONDITION_TRUE, "wrong return val\n");
450 r = MsiEvaluateCondition(hpkg, "0 < > 0");
451 ok( r == MSICONDITION_ERROR, "wrong return val\n");
453 r = MsiEvaluateCondition(hpkg, "(1<<1) == 2");
454 ok( r == MSICONDITION_ERROR, "wrong return val\n");
456 r = MsiEvaluateCondition(hpkg, " \"A\" = \"a\" ");
457 ok( r == MSICONDITION_FALSE, "wrong return val\n");
459 r = MsiEvaluateCondition(hpkg, " \"A\" ~ = \"a\" ");
460 ok( r == MSICONDITION_ERROR, "wrong return val\n");
462 r = MsiEvaluateCondition(hpkg, " \"A\" ~= \"a\" ");
463 ok( r == MSICONDITION_TRUE, "wrong return val\n");
465 r = MsiEvaluateCondition(hpkg, " \"A\" ~= 1 ");
466 ok( r == MSICONDITION_FALSE, "wrong return val\n");
468 r = MsiEvaluateCondition(hpkg, " \"A\" = 1 ");
469 ok( r == MSICONDITION_FALSE, "wrong return val\n");
471 r = MsiEvaluateCondition(hpkg, " 1 ~= 1 ");
472 ok( r == MSICONDITION_TRUE, "wrong return val\n");
474 r = MsiEvaluateCondition(hpkg, " 1 ~= \"1\" ");
475 ok( r == MSICONDITION_FALSE, "wrong return val\n");
477 r = MsiEvaluateCondition(hpkg, " 1 = \"1\" ");
478 ok( r == MSICONDITION_FALSE, "wrong return val\n");
480 r = MsiEvaluateCondition(hpkg, " 0 = \"1\" ");
481 ok( r == MSICONDITION_FALSE, "wrong return val\n");
483 r = MsiEvaluateCondition(hpkg, " 0 < \"100\" ");
484 ok( r == MSICONDITION_FALSE, "wrong return val\n");
486 r = MsiEvaluateCondition(hpkg, " 100 > \"0\" ");
487 ok( r == MSICONDITION_FALSE, "wrong return val\n");
489 r = MsiEvaluateCondition(hpkg, "1 XOR 1");
490 ok( r == MSICONDITION_FALSE, "wrong return val\n");
492 r = MsiEvaluateCondition(hpkg, "1 IMP 1");
493 ok( r == MSICONDITION_TRUE, "wrong return val\n");
495 r = MsiEvaluateCondition(hpkg, "1 IMP 0");
496 ok( r == MSICONDITION_FALSE, "wrong return val\n");
498 r = MsiEvaluateCondition(hpkg, "0 IMP 0");
499 ok( r == MSICONDITION_TRUE, "wrong return val\n");
501 r = MsiEvaluateCondition(hpkg, "0 EQV 0");
502 ok( r == MSICONDITION_TRUE, "wrong return val\n");
504 r = MsiEvaluateCondition(hpkg, "0 EQV 1");
505 ok( r == MSICONDITION_FALSE, "wrong return val\n");
507 r = MsiEvaluateCondition(hpkg, "1 IMP 1 OR 0");
508 ok( r == MSICONDITION_TRUE, "wrong return val\n");
510 r = MsiEvaluateCondition(hpkg, "1 IMPL 1");
511 ok( r == MSICONDITION_ERROR, "wrong return val\n");
513 r = MsiEvaluateCondition(hpkg, "\"ASFD\" >< \"S\" ");
514 ok( r == MSICONDITION_TRUE, "wrong return val\n");
516 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"s\" ");
517 ok( r == MSICONDITION_TRUE, "wrong return val\n");
519 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"\" ");
520 ok( r == MSICONDITION_TRUE, "wrong return val\n");
522 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"sss\" ");
523 ok( r == MSICONDITION_FALSE, "wrong return val\n");
525 MsiSetProperty(hpkg, "mm", "5" );
527 r = MsiEvaluateCondition(hpkg, "mm = 5");
528 ok( r == MSICONDITION_TRUE, "wrong return val\n");
530 r = MsiEvaluateCondition(hpkg, "mm < 6");
531 ok( r == MSICONDITION_TRUE, "wrong return val\n");
533 r = MsiEvaluateCondition(hpkg, "mm <= 5");
534 ok( r == MSICONDITION_TRUE, "wrong return val\n");
536 r = MsiEvaluateCondition(hpkg, "mm > 4");
537 ok( r == MSICONDITION_TRUE, "wrong return val\n");
539 r = MsiEvaluateCondition(hpkg, "mm < 12");
540 ok( r == MSICONDITION_TRUE, "wrong return val\n");
542 r = MsiEvaluateCondition(hpkg, "mm = \"5\"");
543 ok( r == MSICONDITION_TRUE, "wrong return val\n");
545 r = MsiEvaluateCondition(hpkg, "0 = \"\"");
546 ok( r == MSICONDITION_FALSE, "wrong return val\n");
548 r = MsiEvaluateCondition(hpkg, "0 AND \"\"");
549 ok( r == MSICONDITION_FALSE, "wrong return val\n");
551 r = MsiEvaluateCondition(hpkg, "1 AND \"\"");
552 ok( r == MSICONDITION_FALSE, "wrong return val\n");
554 r = MsiEvaluateCondition(hpkg, "1 AND \"1\"");
555 ok( r == MSICONDITION_TRUE, "wrong return val\n");
557 r = MsiEvaluateCondition(hpkg, "3 >< 1");
558 ok( r == MSICONDITION_TRUE, "wrong return val\n");
560 r = MsiEvaluateCondition(hpkg, "3 >< 4");
561 ok( r == MSICONDITION_FALSE, "wrong return val\n");
563 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 0");
564 ok( r == MSICONDITION_FALSE, "wrong return val\n");
566 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1");
567 ok( r == MSICONDITION_TRUE, "wrong return val\n");
569 r = MsiEvaluateCondition(hpkg, "NOT 1 OR 0");
570 ok( r == MSICONDITION_FALSE, "wrong return val\n");
572 r = MsiEvaluateCondition(hpkg, "0 AND 1 OR 1");
573 ok( r == MSICONDITION_TRUE, "wrong return val\n");
575 r = MsiEvaluateCondition(hpkg, "0 AND 0 OR 1");
576 ok( r == MSICONDITION_TRUE, "wrong return val\n");
578 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1 OR 0");
579 ok( r == MSICONDITION_TRUE, "wrong return val\n");
581 r = MsiEvaluateCondition(hpkg, "_1 = _1");
582 ok( r == MSICONDITION_TRUE, "wrong return val\n");
584 r = MsiEvaluateCondition(hpkg, "( 1 AND 1 ) = 2");
585 ok( r == MSICONDITION_ERROR, "wrong return val\n");
587 r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
588 ok( r == MSICONDITION_FALSE, "wrong return val\n");
590 r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
591 ok( r == MSICONDITION_FALSE, "wrong return val\n");
593 r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
594 ok( r == MSICONDITION_FALSE, "wrong return val\n");
596 MsiCloseHandle( hpkg );
599 static BOOL check_prop_empty( MSIHANDLE hpkg, char * prop)
607 r = MsiGetProperty( hpkg, prop, buffer, &sz );
608 return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
611 static void test_props(void)
618 hpkg = package_from_db(create_package_db());
619 ok( hpkg, "failed to create package\n");
621 /* test invalid values */
622 r = MsiGetProperty( 0, NULL, NULL, NULL );
623 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
625 r = MsiGetProperty( hpkg, NULL, NULL, NULL );
626 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
628 r = MsiGetProperty( hpkg, "boo", NULL, NULL );
629 ok( r == ERROR_SUCCESS, "wrong return val\n");
631 r = MsiGetProperty( hpkg, "boo", buffer, NULL );
632 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
634 /* test retrieving an empty/nonexistent property */
636 r = MsiGetProperty( hpkg, "boo", NULL, &sz );
637 ok( r == ERROR_SUCCESS, "wrong return val\n");
638 ok( sz == 0, "wrong size returned\n");
640 check_prop_empty( hpkg, "boo");
643 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
644 ok( r == ERROR_MORE_DATA, "wrong return val\n");
645 ok( !strcmp(buffer,"x"), "buffer was changed\n");
646 ok( sz == 0, "wrong size returned\n");
650 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
651 ok( r == ERROR_SUCCESS, "wrong return val\n");
652 ok( buffer[0] == 0, "buffer was not changed\n");
653 ok( sz == 0, "wrong size returned\n");
655 /* set the property to something */
656 r = MsiSetProperty( 0, NULL, NULL );
657 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
659 r = MsiSetProperty( hpkg, NULL, NULL );
660 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
662 r = MsiSetProperty( hpkg, "", NULL );
663 ok( r == ERROR_SUCCESS, "wrong return val\n");
665 /* try set and get some illegal property identifiers */
666 r = MsiSetProperty( hpkg, "", "asdf" );
667 ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n");
669 r = MsiSetProperty( hpkg, "=", "asdf" );
670 ok( r == ERROR_SUCCESS, "wrong return val\n");
672 r = MsiSetProperty( hpkg, " ", "asdf" );
673 ok( r == ERROR_SUCCESS, "wrong return val\n");
675 r = MsiSetProperty( hpkg, "'", "asdf" );
676 ok( r == ERROR_SUCCESS, "wrong return val\n");
680 r = MsiGetProperty( hpkg, "'", buffer, &sz );
681 ok( r == ERROR_SUCCESS, "wrong return val\n");
682 ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
684 /* set empty values */
685 r = MsiSetProperty( hpkg, "boo", NULL );
686 ok( r == ERROR_SUCCESS, "wrong return val\n");
687 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
689 r = MsiSetProperty( hpkg, "boo", "" );
690 ok( r == ERROR_SUCCESS, "wrong return val\n");
691 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
693 /* set a non-empty value */
694 r = MsiSetProperty( hpkg, "boo", "xyz" );
695 ok( r == ERROR_SUCCESS, "wrong return val\n");
699 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
700 ok( r == ERROR_MORE_DATA, "wrong return val\n");
701 ok( buffer[0] == 0, "buffer was not changed\n");
702 ok( sz == 3, "wrong size returned\n");
706 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
707 ok( r == ERROR_SUCCESS, "wrong return val\n");
708 ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
709 ok( sz == 3, "wrong size returned\n");
713 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
714 ok( r == ERROR_MORE_DATA, "wrong return val\n");
715 ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
716 ok( sz == 3, "wrong size returned\n");
718 MsiCloseHandle( hpkg );
723 test_createpackage();
724 test_getsourcepath_bad();
725 test_getsourcepath();
727 test_gettargetpath_bad();
728 test_settargetpath_bad();