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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "wine/test.h"
31 static const char msifile[] = "winetest.msi";
33 static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec)
38 /* open a select query */
39 r = MsiDatabaseOpenView(hdb, query, &hview);
40 if (r != ERROR_SUCCESS)
42 r = MsiViewExecute(hview, 0);
43 if (r != ERROR_SUCCESS)
45 ret = MsiViewFetch(hview, phrec);
46 r = MsiViewClose(hview);
47 if (r != ERROR_SUCCESS)
49 r = MsiCloseHandle(hview);
50 if (r != ERROR_SUCCESS)
55 static UINT run_query( MSIHANDLE hdb, const char *query )
60 r = MsiDatabaseOpenView(hdb, query, &hview);
61 if( r != ERROR_SUCCESS )
64 r = MsiViewExecute(hview, 0);
65 if( r == ERROR_SUCCESS )
66 r = MsiViewClose(hview);
67 MsiCloseHandle(hview);
71 static UINT create_component_table( MSIHANDLE hdb )
73 return run_query( hdb,
74 "CREATE TABLE `Component` ( "
75 "`Component` CHAR(72) NOT NULL, "
76 "`ComponentId` CHAR(38), "
77 "`Directory_` CHAR(72) NOT NULL, "
78 "`Attributes` SHORT NOT NULL, "
79 "`Condition` CHAR(255), "
81 "PRIMARY KEY `Component`)" );
84 static UINT create_feature_table( MSIHANDLE hdb )
86 return run_query( hdb,
87 "CREATE TABLE `Feature` ( "
88 "`Feature` CHAR(38) NOT NULL, "
89 "`Feature_Parent` CHAR(38), "
91 "`Description` CHAR(255), "
92 "`Display` SHORT NOT NULL, "
93 "`Level` SHORT NOT NULL, "
94 "`Directory_` CHAR(72), "
95 "`Attributes` SHORT NOT NULL "
96 "PRIMARY KEY `Feature`)" );
99 static UINT create_feature_components_table( MSIHANDLE hdb )
101 return run_query( hdb,
102 "CREATE TABLE `FeatureComponents` ( "
103 "`Feature_` CHAR(38) NOT NULL, "
104 "`Component_` CHAR(72) NOT NULL "
105 "PRIMARY KEY `Feature_`, `Component_` )" );
108 static UINT create_file_table( MSIHANDLE hdb )
110 return run_query( hdb,
111 "CREATE TABLE `File` ("
112 "`File` CHAR(72) NOT NULL, "
113 "`Component_` CHAR(72) NOT NULL, "
114 "`FileName` CHAR(255) NOT NULL, "
115 "`FileSize` LONG NOT NULL, "
116 "`Version` CHAR(72), "
117 "`Language` CHAR(20), "
118 "`Attributes` SHORT, "
119 "`Sequence` SHORT NOT NULL "
120 "PRIMARY KEY `File`)" );
123 static UINT create_remove_file_table( MSIHANDLE hdb )
125 return run_query( hdb,
126 "CREATE TABLE `RemoveFile` ("
127 "`FileKey` CHAR(72) NOT NULL, "
128 "`Component_` CHAR(72) NOT NULL, "
129 "`FileName` CHAR(255) LOCALIZABLE, "
130 "`DirProperty` CHAR(72) NOT NULL, "
131 "`InstallMode` SHORT NOT NULL "
132 "PRIMARY KEY `FileKey`)" );
135 static UINT create_appsearch_table( MSIHANDLE hdb )
137 return run_query( hdb,
138 "CREATE TABLE `AppSearch` ("
139 "`Property` CHAR(72) NOT NULL, "
140 "`Signature_` CHAR(72) NOT NULL "
141 "PRIMARY KEY `Property`, `Signature_`)" );
144 static UINT create_reglocator_table( MSIHANDLE hdb )
146 return run_query( hdb,
147 "CREATE TABLE `RegLocator` ("
148 "`Signature_` CHAR(72) NOT NULL, "
149 "`Root` SHORT NOT NULL, "
150 "`Key` CHAR(255) NOT NULL, "
153 "PRIMARY KEY `Signature_`)" );
156 static UINT create_signature_table( MSIHANDLE hdb )
158 return run_query( hdb,
159 "CREATE TABLE `Signature` ("
160 "`Signature` CHAR(72) NOT NULL, "
161 "`FileName` CHAR(255) NOT NULL, "
162 "`MinVersion` CHAR(20), "
163 "`MaxVersion` CHAR(20), "
168 "`Languages` CHAR(255) "
169 "PRIMARY KEY `Signature`)" );
172 static UINT create_launchcondition_table( MSIHANDLE hdb )
174 return run_query( hdb,
175 "CREATE TABLE `LaunchCondition` ("
176 "`Condition` CHAR(255) NOT NULL, "
177 "`Description` CHAR(255) NOT NULL "
178 "PRIMARY KEY `Condition`)" );
181 static UINT create_property_table( MSIHANDLE hdb )
183 return run_query( hdb,
184 "CREATE TABLE `Property` ("
185 "`Property` CHAR(72) NOT NULL, "
187 "PRIMARY KEY `Property`)" );
190 static UINT create_install_execute_sequence_table( MSIHANDLE hdb )
192 return run_query( hdb,
193 "CREATE TABLE `InstallExecuteSequence` ("
194 "`Action` CHAR(72) NOT NULL, "
195 "`Condition` CHAR(255), "
197 "PRIMARY KEY `Action`)" );
200 static UINT create_media_table( MSIHANDLE hdb )
202 return run_query( hdb,
203 "CREATE TABLE `Media` ("
204 "`DiskId` SHORT NOT NULL, "
205 "`LastSequence` SHORT NOT NULL, "
206 "`DiskPrompt` CHAR(64), "
207 "`Cabinet` CHAR(255), "
208 "`VolumeLabel` CHAR(32), "
210 "PRIMARY KEY `DiskId`)" );
213 static UINT add_component_entry( MSIHANDLE hdb, const char *values )
215 char insert[] = "INSERT INTO `Component` "
216 "(`Component`, `ComponentId`, `Directory_`, `Attributes`, `Condition`, `KeyPath`) "
221 sz = strlen(values) + sizeof insert;
222 query = HeapAlloc(GetProcessHeap(),0,sz);
223 sprintf(query,insert,values);
224 r = run_query( hdb, query );
225 HeapFree(GetProcessHeap(), 0, query);
229 static UINT add_feature_entry( MSIHANDLE hdb, const char *values )
231 char insert[] = "INSERT INTO `Feature` (`Feature`, `Feature_Parent`, "
232 "`Title`, `Description`, `Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )";
236 sz = strlen(values) + sizeof insert;
237 query = HeapAlloc(GetProcessHeap(),0,sz);
238 sprintf(query,insert,values);
239 r = run_query( hdb, query );
240 HeapFree(GetProcessHeap(), 0, query);
244 static UINT add_feature_components_entry( MSIHANDLE hdb, const char *values )
246 char insert[] = "INSERT INTO `FeatureComponents` "
247 "(`Feature_`, `Component_`) "
252 sz = strlen(values) + sizeof insert;
253 query = HeapAlloc(GetProcessHeap(),0,sz);
254 sprintf(query,insert,values);
255 r = run_query( hdb, query );
256 HeapFree(GetProcessHeap(), 0, query);
260 static UINT add_file_entry( MSIHANDLE hdb, const char *values )
262 char insert[] = "INSERT INTO `File` "
263 "(`File`, `Component_`, `FileName`, `FileSize`, `Version`, `Language`, `Attributes`, `Sequence`) "
268 sz = strlen(values) + sizeof insert;
269 query = HeapAlloc(GetProcessHeap(),0,sz);
270 sprintf(query,insert,values);
271 r = run_query( hdb, query );
272 HeapFree(GetProcessHeap(), 0, query);
276 static UINT add_appsearch_entry( MSIHANDLE hdb, const char *values )
278 char insert[] = "INSERT INTO `AppSearch` "
279 "(`Property`, `Signature_`) "
284 sz = strlen(values) + sizeof insert;
285 query = HeapAlloc(GetProcessHeap(),0,sz);
286 sprintf(query,insert,values);
287 r = run_query( hdb, query );
288 HeapFree(GetProcessHeap(), 0, query);
292 static UINT add_reglocator_entry( MSIHANDLE hdb, const char *values )
294 char insert[] = "INSERT INTO `RegLocator` "
295 "(`Signature_`, `Root`, `Key`, `Name`, `Type`) "
300 sz = strlen(values) + sizeof insert;
301 query = HeapAlloc(GetProcessHeap(),0,sz);
302 sprintf(query,insert,values);
303 r = run_query( hdb, query );
304 HeapFree(GetProcessHeap(), 0, query);
308 static UINT add_signature_entry( MSIHANDLE hdb, const char *values )
310 char insert[] = "INSERT INTO `Signature` "
311 "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
312 " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
317 sz = strlen(values) + sizeof insert;
318 query = HeapAlloc(GetProcessHeap(),0,sz);
319 sprintf(query,insert,values);
320 r = run_query( hdb, query );
321 HeapFree(GetProcessHeap(), 0, query);
325 static UINT add_launchcondition_entry( MSIHANDLE hdb, const char *values )
327 char insert[] = "INSERT INTO `LaunchCondition` "
328 "(`Condition`, `Description`) "
333 sz = strlen(values) + sizeof insert;
334 query = HeapAlloc(GetProcessHeap(),0,sz);
335 sprintf(query,insert,values);
336 r = run_query( hdb, query );
337 HeapFree(GetProcessHeap(), 0, query);
341 static UINT add_property_entry( MSIHANDLE hdb, const char *values )
343 char insert[] = "INSERT INTO `Property` "
344 "(`Property`, `Value`) "
349 sz = strlen(values) + sizeof insert;
350 query = HeapAlloc(GetProcessHeap(),0,sz);
351 sprintf(query,insert,values);
352 r = run_query( hdb, query );
353 HeapFree(GetProcessHeap(), 0, query);
357 static UINT add_install_execute_sequence_entry( MSIHANDLE hdb, const char *values )
359 char insert[] = "INSERT INTO `InstallExecuteSequence` "
360 "(`Action`, `Condition`, `Sequence`) "
365 sz = strlen(values) + sizeof insert;
366 query = HeapAlloc(GetProcessHeap(),0,sz);
367 sprintf(query,insert,values);
368 r = run_query( hdb, query );
369 HeapFree(GetProcessHeap(), 0, query);
373 static UINT add_media_entry( MSIHANDLE hdb, const char *values )
375 char insert[] = "INSERT INTO `Media` "
376 "(`DiskId`, `LastSequence`, `DiskPrompt`, `Cabinet`, `VolumeLabel`, `Source`) "
381 sz = strlen(values) + sizeof insert;
382 query = HeapAlloc(GetProcessHeap(),0,sz);
383 sprintf(query,insert,values);
384 r = run_query( hdb, query );
385 HeapFree(GetProcessHeap(), 0, query);
389 static UINT set_summary_info(MSIHANDLE hdb)
394 /* build summmary info */
395 res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
396 ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
398 res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
399 "Installation Database");
400 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
402 res = MsiSummaryInfoSetProperty(suminfo,3, VT_LPSTR, 0,NULL,
403 "Installation Database");
404 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
406 res = MsiSummaryInfoSetProperty(suminfo,4, VT_LPSTR, 0,NULL,
408 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
410 res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
412 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
414 res = MsiSummaryInfoSetProperty(suminfo,9, VT_LPSTR, 0,NULL,
415 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
416 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
418 res = MsiSummaryInfoSetProperty(suminfo, 14, VT_I4, 100, NULL, NULL);
419 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
421 res = MsiSummaryInfoSetProperty(suminfo, 15, VT_I4, 0, NULL, NULL);
422 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
424 res = MsiSummaryInfoPersist(suminfo);
425 ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
427 res = MsiCloseHandle( suminfo);
428 ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
434 static MSIHANDLE create_package_db(void)
441 /* create an empty database */
442 res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb );
443 ok( res == ERROR_SUCCESS , "Failed to create database\n" );
444 if( res != ERROR_SUCCESS )
447 res = MsiDatabaseCommit( hdb );
448 ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
450 res = set_summary_info(hdb);
452 res = run_query( hdb,
453 "CREATE TABLE `Directory` ( "
454 "`Directory` CHAR(255) NOT NULL, "
455 "`Directory_Parent` CHAR(255), "
456 "`DefaultDir` CHAR(255) NOT NULL "
457 "PRIMARY KEY `Directory`)" );
458 ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
463 static MSIHANDLE package_from_db(MSIHANDLE hdb)
469 sprintf(szPackage,"#%li",hdb);
470 res = MsiOpenPackage(szPackage,&hPackage);
471 if (res != ERROR_SUCCESS)
474 res = MsiCloseHandle(hdb);
475 if (res != ERROR_SUCCESS)
481 static void create_test_file(const CHAR *name)
486 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
487 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
488 WriteFile(file, name, strlen(name), &written, NULL);
489 WriteFile(file, "\n", strlen("\n"), &written, NULL);
493 static void test_createpackage(void)
495 MSIHANDLE hPackage = 0;
498 hPackage = package_from_db(create_package_db());
499 ok( hPackage != 0, " Failed to create package\n");
501 res = MsiCloseHandle( hPackage);
502 ok( res == ERROR_SUCCESS , "Failed to close package\n" );
506 static void test_getsourcepath_bad( void )
508 static const char str[] = { 0 };
513 r = MsiGetSourcePath( -1, NULL, NULL, NULL );
514 ok( r == ERROR_INVALID_PARAMETER, "return value wrong\n");
517 r = MsiGetSourcePath( -1, NULL, buffer, &sz );
518 ok( r == ERROR_INVALID_PARAMETER, "return value wrong\n");
521 r = MsiGetSourcePath( -1, str, NULL, &sz );
522 ok( r == ERROR_INVALID_HANDLE, "return value wrong\n");
525 r = MsiGetSourcePath( -1, str, NULL, NULL );
526 ok( r == ERROR_INVALID_HANDLE, "return value wrong\n");
529 r = MsiGetSourcePath( -1, str, buffer, &sz );
530 ok( r == ERROR_INVALID_HANDLE, "return value wrong\n");
533 static UINT add_directory_entry( MSIHANDLE hdb, const char *values )
535 char insert[] = "INSERT INTO `Directory` (`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )";
539 sz = strlen(values) + sizeof insert;
540 query = HeapAlloc(GetProcessHeap(),0,sz);
541 sprintf(query,insert,values);
542 r = run_query( hdb, query );
543 HeapFree(GetProcessHeap(), 0, query);
547 static void test_getsourcepath( void )
549 static const char str[] = { 0 };
555 hpkg = package_from_db(create_package_db());
556 ok( hpkg, "failed to create package\n");
560 r = MsiGetSourcePath( hpkg, str, buffer, &sz );
561 ok( r == ERROR_DIRECTORY, "return value wrong\n");
562 ok( buffer[0] == 'x', "buffer modified\n");
566 r = MsiGetSourcePath( hpkg, str, buffer, &sz );
567 ok( r == ERROR_DIRECTORY, "return value wrong\n");
568 ok( buffer[0] == 'x', "buffer modified\n");
570 MsiCloseHandle( hpkg );
573 /* another test but try create a directory this time */
574 hdb = create_package_db();
575 ok( hdb, "failed to create database\n");
577 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
578 ok( r == S_OK, "failed\n");
580 hpkg = package_from_db(hdb);
581 ok( hpkg, "failed to create package\n");
583 sz = sizeof buffer -1;
584 strcpy(buffer,"x bad");
585 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, &sz );
586 ok( r == ERROR_DIRECTORY, "return value wrong\n");
588 r = MsiDoAction( hpkg, "CostInitialize");
589 ok( r == ERROR_SUCCESS, "cost init failed\n");
590 r = MsiDoAction( hpkg, "CostFinalize");
591 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
593 sz = sizeof buffer -1;
595 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, &sz );
596 ok( r == ERROR_SUCCESS, "return value wrong\n");
597 ok( sz == strlen(buffer), "returned length wrong\n");
600 strcpy(buffer,"x bad");
601 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, &sz );
602 ok( r == ERROR_MORE_DATA, "return value wrong\n");
603 ok( buffer[0] == 'x', "buffer modified\n");
605 r = MsiGetSourcePath( hpkg, "TARGETDIR", NULL, NULL );
606 ok( r == ERROR_SUCCESS, "return value wrong\n");
608 r = MsiGetSourcePath( hpkg, "TARGETDIR ", NULL, NULL );
609 ok( r == ERROR_DIRECTORY, "return value wrong\n");
611 r = MsiGetSourcePath( hpkg, "targetdir", NULL, NULL );
612 ok( r == ERROR_DIRECTORY, "return value wrong\n");
614 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, NULL );
615 ok( r == ERROR_INVALID_PARAMETER, "return value wrong\n");
617 r = MsiGetSourcePath( hpkg, "TARGETDIR", NULL, &sz );
618 ok( r == ERROR_SUCCESS, "return value wrong\n");
620 MsiCloseHandle( hpkg );
624 static void test_doaction( void )
629 r = MsiDoAction( -1, NULL );
630 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
632 hpkg = package_from_db(create_package_db());
633 ok( hpkg, "failed to create package\n");
635 r = MsiDoAction(hpkg, NULL);
636 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
638 r = MsiDoAction(0, "boo");
639 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
641 r = MsiDoAction(hpkg, "boo");
642 ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
644 MsiCloseHandle( hpkg );
648 static void test_gettargetpath_bad(void)
655 hpkg = package_from_db(create_package_db());
656 ok( hpkg, "failed to create package\n");
658 r = MsiGetTargetPath( 0, NULL, NULL, NULL );
659 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
661 r = MsiGetTargetPath( 0, NULL, NULL, &sz );
662 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
664 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
665 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
667 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
668 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
670 r = MsiGetTargetPath( hpkg, "boo", NULL, NULL );
671 ok( r == ERROR_DIRECTORY, "wrong return val\n");
673 r = MsiGetTargetPath( hpkg, "boo", buffer, NULL );
674 ok( r == ERROR_DIRECTORY, "wrong return val\n");
676 MsiCloseHandle( hpkg );
680 static void query_file_path(MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
686 rec = MsiCreateRecord( 1 );
687 ok(rec, "MsiCreate record failed\n");
689 r = MsiRecordSetString( rec, 0, file );
690 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
693 r = MsiFormatRecord( hpkg, rec, buff, &size );
694 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
696 MsiCloseHandle( rec );
699 static void test_settargetpath(void)
701 char tempdir[MAX_PATH+8], buffer[MAX_PATH], file[MAX_PATH];
707 hdb = create_package_db();
708 ok ( hdb, "failed to create package database\n" );
710 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
711 ok( r == S_OK, "failed to add directory entry: %d\n" , r );
713 r = create_component_table( hdb );
714 ok( r == S_OK, "cannot create Component table: %d\n", r );
716 r = add_component_entry( hdb, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
717 ok( r == S_OK, "cannot add dummy component: %d\n", r );
719 r = add_component_entry( hdb, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
720 ok( r == S_OK, "cannot add test component: %d\n", r );
722 r = create_feature_table( hdb );
723 ok( r == S_OK, "cannot create Feature table: %d\n", r );
725 r = add_feature_entry( hdb, "'TestFeature', '', '', '', 0, 1, '', 0" );
726 ok( r == ERROR_SUCCESS, "cannot add TestFeature to Feature table: %d\n", r );
728 r = create_feature_components_table( hdb );
729 ok( r == S_OK, "cannot create FeatureComponents table: %d\n", r );
731 r = add_feature_components_entry( hdb, "'TestFeature', 'RootComp'" );
732 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
734 r = add_feature_components_entry( hdb, "'TestFeature', 'TestComp'" );
735 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
737 add_directory_entry( hdb, "'TestParent', 'TARGETDIR', 'TestParent'" );
738 add_directory_entry( hdb, "'TestDir', 'TestParent', 'TestDir'" );
740 r = create_file_table( hdb );
741 ok( r == S_OK, "cannot create File table: %d\n", r );
743 r = add_file_entry( hdb, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
744 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
746 r = add_file_entry( hdb, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
747 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
749 hpkg = package_from_db( hdb );
750 ok( hpkg, "failed to create package\n");
752 r = MsiDoAction( hpkg, "CostInitialize");
753 ok( r == ERROR_SUCCESS, "cost init failed\n");
755 r = MsiDoAction( hpkg, "FileCost");
756 ok( r == ERROR_SUCCESS, "file cost failed\n");
758 r = MsiDoAction( hpkg, "CostFinalize");
759 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
761 r = MsiSetTargetPath( 0, NULL, NULL );
762 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
764 r = MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
765 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
767 r = MsiSetTargetPath( hpkg, "boo", NULL );
768 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
770 r = MsiSetTargetPath( hpkg, "boo", "c:\\bogusx" );
771 ok( r == ERROR_DIRECTORY, "wrong return val\n");
773 sz = sizeof tempdir - 1;
774 r = MsiGetTargetPath( hpkg, "TARGETDIR", tempdir, &sz );
775 sprintf( file, "%srootfile.txt", tempdir );
776 query_file_path( hpkg, "[#RootFile]", buffer );
777 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
778 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer );
780 GetTempFileName( tempdir, "_wt", 0, buffer );
781 sprintf( tempdir, "%s\\subdir", buffer );
783 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
784 ok( r == ERROR_SUCCESS, "MsiSetTargetPath on file returned %d\n", r );
786 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
787 ok( r == ERROR_SUCCESS, "MsiSetTargetPath on 'subdir' of file returned %d\n", r );
789 DeleteFile( buffer );
791 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
792 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
794 r = GetFileAttributes( buffer );
795 ok ( r == INVALID_FILE_ATTRIBUTES, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r );
797 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
798 ok( r == ERROR_SUCCESS, "MsiSetTargetPath on subsubdir returned %d\n", r );
800 sz = sizeof buffer - 1;
801 lstrcat( tempdir, "\\" );
802 r = MsiGetTargetPath( hpkg, "TARGETDIR", buffer, &sz );
803 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
804 ok( !lstrcmp(buffer, tempdir), "Expected %s, got %s\n", tempdir, buffer);
806 sprintf( file, "%srootfile.txt", tempdir );
807 query_file_path( hpkg, "[#RootFile]", buffer );
808 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer);
810 r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two" );
811 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
813 query_file_path( hpkg, "[#TestFile]", buffer );
814 ok( !lstrcmp(buffer, "C:\\one\\two\\TestDir\\testfile.txt"),
815 "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer );
817 sz = sizeof buffer - 1;
818 r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
819 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
820 ok( !lstrcmp(buffer, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer);
822 MsiCloseHandle( hpkg );
825 static void test_condition(void)
830 hpkg = package_from_db(create_package_db());
831 ok( hpkg, "failed to create package\n");
833 r = MsiEvaluateCondition(0, NULL);
834 ok( r == MSICONDITION_ERROR, "wrong return val\n");
836 r = MsiEvaluateCondition(hpkg, NULL);
837 ok( r == MSICONDITION_NONE, "wrong return val\n");
839 r = MsiEvaluateCondition(hpkg, "");
840 ok( r == MSICONDITION_NONE, "wrong return val\n");
842 r = MsiEvaluateCondition(hpkg, "1");
843 ok( r == MSICONDITION_TRUE, "wrong return val\n");
845 r = MsiEvaluateCondition(hpkg, "0");
846 ok( r == MSICONDITION_FALSE, "wrong return val\n");
848 r = MsiEvaluateCondition(hpkg, "0 = 0");
849 ok( r == MSICONDITION_TRUE, "wrong return val\n");
851 r = MsiEvaluateCondition(hpkg, "0 <> 0");
852 ok( r == MSICONDITION_FALSE, "wrong return val\n");
854 r = MsiEvaluateCondition(hpkg, "0 = 1");
855 ok( r == MSICONDITION_FALSE, "wrong return val\n");
857 r = MsiEvaluateCondition(hpkg, "0 > 1");
858 ok( r == MSICONDITION_FALSE, "wrong return val\n");
860 r = MsiEvaluateCondition(hpkg, "0 ~> 1");
861 ok( r == MSICONDITION_FALSE, "wrong return val\n");
863 r = MsiEvaluateCondition(hpkg, "1 > 1");
864 ok( r == MSICONDITION_FALSE, "wrong return val\n");
866 r = MsiEvaluateCondition(hpkg, "1 ~> 1");
867 ok( r == MSICONDITION_FALSE, "wrong return val\n");
869 r = MsiEvaluateCondition(hpkg, "0 >= 1");
870 ok( r == MSICONDITION_FALSE, "wrong return val\n");
872 r = MsiEvaluateCondition(hpkg, "0 ~>= 1");
873 ok( r == MSICONDITION_FALSE, "wrong return val\n");
875 r = MsiEvaluateCondition(hpkg, "1 >= 1");
876 ok( r == MSICONDITION_TRUE, "wrong return val\n");
878 r = MsiEvaluateCondition(hpkg, "1 ~>= 1");
879 ok( r == MSICONDITION_TRUE, "wrong return val\n");
881 r = MsiEvaluateCondition(hpkg, "0 < 1");
882 ok( r == MSICONDITION_TRUE, "wrong return val\n");
884 r = MsiEvaluateCondition(hpkg, "0 ~< 1");
885 ok( r == MSICONDITION_TRUE, "wrong return val\n");
887 r = MsiEvaluateCondition(hpkg, "1 < 1");
888 ok( r == MSICONDITION_FALSE, "wrong return val\n");
890 r = MsiEvaluateCondition(hpkg, "1 ~< 1");
891 ok( r == MSICONDITION_FALSE, "wrong return val\n");
893 r = MsiEvaluateCondition(hpkg, "0 <= 1");
894 ok( r == MSICONDITION_TRUE, "wrong return val\n");
896 r = MsiEvaluateCondition(hpkg, "0 ~<= 1");
897 ok( r == MSICONDITION_TRUE, "wrong return val\n");
899 r = MsiEvaluateCondition(hpkg, "1 <= 1");
900 ok( r == MSICONDITION_TRUE, "wrong return val\n");
902 r = MsiEvaluateCondition(hpkg, "1 ~<= 1");
903 ok( r == MSICONDITION_TRUE, "wrong return val\n");
905 r = MsiEvaluateCondition(hpkg, "0 >=");
906 ok( r == MSICONDITION_ERROR, "wrong return val\n");
908 r = MsiEvaluateCondition(hpkg, " ");
909 ok( r == MSICONDITION_NONE, "wrong return val\n");
911 r = MsiEvaluateCondition(hpkg, "LicView <> \"1\"");
912 ok( r == MSICONDITION_TRUE, "wrong return val\n");
914 r = MsiEvaluateCondition(hpkg, "LicView <> \"0\"");
915 ok( r == MSICONDITION_TRUE, "wrong return val\n");
917 r = MsiEvaluateCondition(hpkg, "LicView <> LicView");
918 ok( r == MSICONDITION_FALSE, "wrong return val\n");
920 r = MsiEvaluateCondition(hpkg, "not 0");
921 ok( r == MSICONDITION_TRUE, "wrong return val\n");
923 r = MsiEvaluateCondition(hpkg, "not LicView");
924 ok( r == MSICONDITION_TRUE, "wrong return val\n");
926 r = MsiEvaluateCondition(hpkg, "not \"A\"");
927 ok( r == MSICONDITION_FALSE, "wrong return val\n");
929 r = MsiEvaluateCondition(hpkg, "~not \"A\"");
930 ok( r == MSICONDITION_ERROR, "wrong return val\n");
932 r = MsiEvaluateCondition(hpkg, "\"0\"");
933 ok( r == MSICONDITION_TRUE, "wrong return val\n");
935 r = MsiEvaluateCondition(hpkg, "1 and 2");
936 ok( r == MSICONDITION_TRUE, "wrong return val\n");
938 r = MsiEvaluateCondition(hpkg, "not 0 and 3");
939 ok( r == MSICONDITION_TRUE, "wrong return val\n");
941 r = MsiEvaluateCondition(hpkg, "not 0 and 0");
942 ok( r == MSICONDITION_FALSE, "wrong return val\n");
944 r = MsiEvaluateCondition(hpkg, "not 0 or 1");
945 ok( r == MSICONDITION_TRUE, "wrong return val\n");
947 r = MsiEvaluateCondition(hpkg, "(0)");
948 ok( r == MSICONDITION_FALSE, "wrong return val\n");
950 r = MsiEvaluateCondition(hpkg, "(((((1))))))");
951 ok( r == MSICONDITION_ERROR, "wrong return val\n");
953 r = MsiEvaluateCondition(hpkg, "(((((1)))))");
954 ok( r == MSICONDITION_TRUE, "wrong return val\n");
956 r = MsiEvaluateCondition(hpkg, " \"A\" < \"B\" ");
957 ok( r == MSICONDITION_TRUE, "wrong return val\n");
959 r = MsiEvaluateCondition(hpkg, " \"A\" > \"B\" ");
960 ok( r == MSICONDITION_FALSE, "wrong return val\n");
962 r = MsiEvaluateCondition(hpkg, " \"1\" > \"12\" ");
963 ok( r == MSICONDITION_FALSE, "wrong return val\n");
965 r = MsiEvaluateCondition(hpkg, " \"100\" < \"21\" ");
966 ok( r == MSICONDITION_TRUE, "wrong return val\n");
968 r = MsiEvaluateCondition(hpkg, "0 < > 0");
969 ok( r == MSICONDITION_ERROR, "wrong return val\n");
971 r = MsiEvaluateCondition(hpkg, "(1<<1) == 2");
972 ok( r == MSICONDITION_ERROR, "wrong return val\n");
974 r = MsiEvaluateCondition(hpkg, " \"A\" = \"a\" ");
975 ok( r == MSICONDITION_FALSE, "wrong return val\n");
977 r = MsiEvaluateCondition(hpkg, " \"A\" ~ = \"a\" ");
978 ok( r == MSICONDITION_ERROR, "wrong return val\n");
980 r = MsiEvaluateCondition(hpkg, " \"A\" ~= \"a\" ");
981 ok( r == MSICONDITION_TRUE, "wrong return val\n");
983 r = MsiEvaluateCondition(hpkg, " \"A\" ~= 1 ");
984 ok( r == MSICONDITION_FALSE, "wrong return val\n");
986 r = MsiEvaluateCondition(hpkg, " \"A\" = 1 ");
987 ok( r == MSICONDITION_FALSE, "wrong return val\n");
989 r = MsiEvaluateCondition(hpkg, " 1 ~= 1 ");
990 ok( r == MSICONDITION_TRUE, "wrong return val\n");
992 r = MsiEvaluateCondition(hpkg, " 1 ~= \"1\" ");
993 ok( r == MSICONDITION_FALSE, "wrong return val\n");
995 r = MsiEvaluateCondition(hpkg, " 1 = \"1\" ");
996 ok( r == MSICONDITION_FALSE, "wrong return val\n");
998 r = MsiEvaluateCondition(hpkg, " 0 = \"1\" ");
999 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1001 r = MsiEvaluateCondition(hpkg, " 0 < \"100\" ");
1002 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1004 r = MsiEvaluateCondition(hpkg, " 100 > \"0\" ");
1005 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1007 r = MsiEvaluateCondition(hpkg, "1 XOR 1");
1008 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1010 r = MsiEvaluateCondition(hpkg, "1 IMP 1");
1011 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1013 r = MsiEvaluateCondition(hpkg, "1 IMP 0");
1014 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1016 r = MsiEvaluateCondition(hpkg, "0 IMP 0");
1017 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1019 r = MsiEvaluateCondition(hpkg, "0 EQV 0");
1020 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1022 r = MsiEvaluateCondition(hpkg, "0 EQV 1");
1023 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1025 r = MsiEvaluateCondition(hpkg, "1 IMP 1 OR 0");
1026 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1028 r = MsiEvaluateCondition(hpkg, "1 IMPL 1");
1029 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1031 r = MsiEvaluateCondition(hpkg, "\"ASFD\" >< \"S\" ");
1032 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1034 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"s\" ");
1035 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1037 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"\" ");
1038 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1040 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"sss\" ");
1041 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1043 MsiSetProperty(hpkg, "mm", "5" );
1045 r = MsiEvaluateCondition(hpkg, "mm = 5");
1046 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1048 r = MsiEvaluateCondition(hpkg, "mm < 6");
1049 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1051 r = MsiEvaluateCondition(hpkg, "mm <= 5");
1052 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1054 r = MsiEvaluateCondition(hpkg, "mm > 4");
1055 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1057 r = MsiEvaluateCondition(hpkg, "mm < 12");
1058 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1060 r = MsiEvaluateCondition(hpkg, "mm = \"5\"");
1061 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1063 r = MsiEvaluateCondition(hpkg, "0 = \"\"");
1064 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1066 r = MsiEvaluateCondition(hpkg, "0 AND \"\"");
1067 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1069 r = MsiEvaluateCondition(hpkg, "1 AND \"\"");
1070 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1072 r = MsiEvaluateCondition(hpkg, "1 AND \"1\"");
1073 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1075 r = MsiEvaluateCondition(hpkg, "3 >< 1");
1076 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1078 r = MsiEvaluateCondition(hpkg, "3 >< 4");
1079 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1081 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 0");
1082 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1084 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1");
1085 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1087 r = MsiEvaluateCondition(hpkg, "NOT 1 OR 0");
1088 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1090 r = MsiEvaluateCondition(hpkg, "0 AND 1 OR 1");
1091 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1093 r = MsiEvaluateCondition(hpkg, "0 AND 0 OR 1");
1094 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1096 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1 OR 0");
1097 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1099 r = MsiEvaluateCondition(hpkg, "_1 = _1");
1100 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1102 r = MsiEvaluateCondition(hpkg, "( 1 AND 1 ) = 2");
1103 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1105 r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
1106 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1108 r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1109 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1111 r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
1112 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1114 r = MsiEvaluateCondition(hpkg, "NOT 1 AND 0");
1115 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1117 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1118 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1120 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1121 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1123 r = MsiEvaluateCondition(hpkg, "bandalmael<0");
1124 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1126 r = MsiEvaluateCondition(hpkg, "bandalmael>0");
1127 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1129 r = MsiEvaluateCondition(hpkg, "bandalmael>=0");
1130 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1132 r = MsiEvaluateCondition(hpkg, "bandalmael<=0");
1133 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1135 r = MsiEvaluateCondition(hpkg, "bandalmael~<>0");
1136 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1138 MsiSetProperty(hpkg, "bandalmael", "0" );
1139 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1140 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1142 MsiSetProperty(hpkg, "bandalmael", "" );
1143 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1144 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1146 MsiSetProperty(hpkg, "bandalmael", "asdf" );
1147 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1148 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1150 MsiSetProperty(hpkg, "bandalmael", "0asdf" );
1151 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1152 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1154 MsiSetProperty(hpkg, "bandalmael", "0 " );
1155 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1156 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1158 MsiSetProperty(hpkg, "bandalmael", "-0" );
1159 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1160 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1162 MsiSetProperty(hpkg, "bandalmael", "0000000000000" );
1163 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1164 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1166 MsiSetProperty(hpkg, "bandalmael", "--0" );
1167 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1168 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1170 MsiSetProperty(hpkg, "bandalmael", "0x00" );
1171 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1172 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1174 MsiSetProperty(hpkg, "bandalmael", "-" );
1175 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1176 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1178 MsiSetProperty(hpkg, "bandalmael", "+0" );
1179 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1180 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1182 MsiSetProperty(hpkg, "bandalmael", "0.0" );
1183 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1184 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1185 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1186 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1188 MsiSetProperty(hpkg, "one", "hi");
1189 MsiSetProperty(hpkg, "two", "hithere");
1190 r = MsiEvaluateCondition(hpkg, "one >< two");
1191 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1193 MsiSetProperty(hpkg, "one", "hithere");
1194 MsiSetProperty(hpkg, "two", "hi");
1195 r = MsiEvaluateCondition(hpkg, "one >< two");
1196 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1198 MsiSetProperty(hpkg, "one", "hello");
1199 MsiSetProperty(hpkg, "two", "hi");
1200 r = MsiEvaluateCondition(hpkg, "one >< two");
1201 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1203 MsiSetProperty(hpkg, "one", "hellohithere");
1204 MsiSetProperty(hpkg, "two", "hi");
1205 r = MsiEvaluateCondition(hpkg, "one >< two");
1206 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1208 MsiSetProperty(hpkg, "one", "");
1209 MsiSetProperty(hpkg, "two", "hi");
1210 r = MsiEvaluateCondition(hpkg, "one >< two");
1211 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1213 MsiSetProperty(hpkg, "one", "hi");
1214 MsiSetProperty(hpkg, "two", "");
1215 r = MsiEvaluateCondition(hpkg, "one >< two");
1216 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1218 MsiSetProperty(hpkg, "one", "");
1219 MsiSetProperty(hpkg, "two", "");
1220 r = MsiEvaluateCondition(hpkg, "one >< two");
1221 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1223 MsiSetProperty(hpkg, "one", "1234");
1224 MsiSetProperty(hpkg, "two", "1");
1225 r = MsiEvaluateCondition(hpkg, "one >< two");
1226 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1228 MsiSetProperty(hpkg, "one", "one 1234");
1229 MsiSetProperty(hpkg, "two", "1");
1230 r = MsiEvaluateCondition(hpkg, "one >< two");
1231 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1233 MsiSetProperty(hpkg, "one", "hithere");
1234 MsiSetProperty(hpkg, "two", "hi");
1235 r = MsiEvaluateCondition(hpkg, "one << two");
1236 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1238 MsiSetProperty(hpkg, "one", "hi");
1239 MsiSetProperty(hpkg, "two", "hithere");
1240 r = MsiEvaluateCondition(hpkg, "one << two");
1241 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1243 MsiSetProperty(hpkg, "one", "hi");
1244 MsiSetProperty(hpkg, "two", "hi");
1245 r = MsiEvaluateCondition(hpkg, "one << two");
1246 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1248 MsiSetProperty(hpkg, "one", "abcdhithere");
1249 MsiSetProperty(hpkg, "two", "hi");
1250 r = MsiEvaluateCondition(hpkg, "one << two");
1251 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1253 MsiSetProperty(hpkg, "one", "");
1254 MsiSetProperty(hpkg, "two", "hi");
1255 r = MsiEvaluateCondition(hpkg, "one << two");
1256 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1258 MsiSetProperty(hpkg, "one", "hithere");
1259 MsiSetProperty(hpkg, "two", "");
1260 r = MsiEvaluateCondition(hpkg, "one << two");
1261 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1263 MsiSetProperty(hpkg, "one", "");
1264 MsiSetProperty(hpkg, "two", "");
1265 r = MsiEvaluateCondition(hpkg, "one << two");
1266 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1268 MsiSetProperty(hpkg, "one", "1234");
1269 MsiSetProperty(hpkg, "two", "1");
1270 r = MsiEvaluateCondition(hpkg, "one << two");
1271 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1273 MsiSetProperty(hpkg, "one", "1234 one");
1274 MsiSetProperty(hpkg, "two", "1");
1275 r = MsiEvaluateCondition(hpkg, "one << two");
1276 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1278 MsiSetProperty(hpkg, "one", "hithere");
1279 MsiSetProperty(hpkg, "two", "there");
1280 r = MsiEvaluateCondition(hpkg, "one >> two");
1281 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1283 MsiSetProperty(hpkg, "one", "hithere");
1284 MsiSetProperty(hpkg, "two", "hi");
1285 r = MsiEvaluateCondition(hpkg, "one >> two");
1286 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1288 MsiSetProperty(hpkg, "one", "there");
1289 MsiSetProperty(hpkg, "two", "hithere");
1290 r = MsiEvaluateCondition(hpkg, "one >> two");
1291 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1293 MsiSetProperty(hpkg, "one", "there");
1294 MsiSetProperty(hpkg, "two", "there");
1295 r = MsiEvaluateCondition(hpkg, "one >> two");
1296 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1298 MsiSetProperty(hpkg, "one", "abcdhithere");
1299 MsiSetProperty(hpkg, "two", "hi");
1300 r = MsiEvaluateCondition(hpkg, "one >> two");
1301 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1303 MsiSetProperty(hpkg, "one", "");
1304 MsiSetProperty(hpkg, "two", "there");
1305 r = MsiEvaluateCondition(hpkg, "one >> two");
1306 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1308 MsiSetProperty(hpkg, "one", "there");
1309 MsiSetProperty(hpkg, "two", "");
1310 r = MsiEvaluateCondition(hpkg, "one >> two");
1311 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1313 MsiSetProperty(hpkg, "one", "");
1314 MsiSetProperty(hpkg, "two", "");
1315 r = MsiEvaluateCondition(hpkg, "one >> two");
1316 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1318 MsiSetProperty(hpkg, "one", "1234");
1319 MsiSetProperty(hpkg, "two", "4");
1320 r = MsiEvaluateCondition(hpkg, "one >> two");
1321 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1323 MsiSetProperty(hpkg, "one", "one 1234");
1324 MsiSetProperty(hpkg, "two", "4");
1325 r = MsiEvaluateCondition(hpkg, "one >> two");
1326 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1328 MsiSetProperty(hpkg, "MsiNetAssemblySupport", NULL); /* make sure it's empty */
1330 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1331 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1333 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport > \"1.1.4322\"");
1334 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1336 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport >= \"1.1.4322\"");
1337 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1339 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <= \"1.1.4322\"");
1340 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1342 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <> \"1.1.4322\"");
1343 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1345 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1346 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1348 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"abcd\"");
1349 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1351 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a1.1.4322\"");
1352 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1354 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322a\"");
1355 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1357 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1358 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1360 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1361 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1363 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1364 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1366 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1");
1367 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1369 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1\"");
1370 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1372 r = MsiEvaluateCondition(hpkg, "\"2\" < \"12.1\"");
1373 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1375 r = MsiEvaluateCondition(hpkg, "\"02.1\" < \"2.11\"");
1376 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1378 r = MsiEvaluateCondition(hpkg, "\"02.1.1\" < \"2.1\"");
1379 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1381 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1382 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1384 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1385 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1387 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0\"");
1388 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1390 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"-1\"");
1391 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1393 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a\"");
1394 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1396 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1397 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1399 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1400 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1402 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"/\"");
1403 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1405 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \" \"");
1406 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1408 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"azAZ_\"");
1409 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1411 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]\"");
1412 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1414 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]a\"");
1415 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1417 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]\"");
1418 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1420 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]a\"");
1421 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1423 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a}\"");
1424 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1426 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a\"");
1427 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1429 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a\"");
1430 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1432 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a{\"");
1433 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1435 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a]\"");
1436 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1438 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"A\"");
1439 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1441 MsiSetProperty(hpkg, "MsiNetAssemblySupport", "1.1.4322");
1442 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1443 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1445 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.14322\"");
1446 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1448 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.5\"");
1449 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1451 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1452 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1454 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1455 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1457 MsiSetProperty(hpkg, "one", "1");
1458 r = MsiEvaluateCondition(hpkg, "one < \"1\"");
1459 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1461 MsiSetProperty(hpkg, "X", "5.0");
1463 r = MsiEvaluateCondition(hpkg, "X != \"\"");
1464 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1466 r = MsiEvaluateCondition(hpkg, "X =\"5.0\"");
1467 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1469 r = MsiEvaluateCondition(hpkg, "X =\"5.1\"");
1470 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1472 r = MsiEvaluateCondition(hpkg, "X =\"6.0\"");
1473 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1475 r = MsiEvaluateCondition(hpkg, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1476 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1478 r = MsiEvaluateCondition(hpkg, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1479 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1481 r = MsiEvaluateCondition(hpkg, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1482 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1484 MsiCloseHandle( hpkg );
1485 DeleteFile(msifile);
1488 static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop)
1496 r = MsiGetProperty( hpkg, prop, buffer, &sz );
1497 return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
1500 static void test_props(void)
1502 MSIHANDLE hpkg, hdb;
1507 hdb = create_package_db();
1509 "CREATE TABLE `Property` ( "
1510 "`Property` CHAR(255) NOT NULL, "
1511 "`Value` CHAR(255) "
1512 "PRIMARY KEY `Property`)" );
1513 ok( r == ERROR_SUCCESS , "Failed\n" );
1516 "INSERT INTO `Property` "
1517 "(`Property`, `Value`) "
1518 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1519 ok( r == ERROR_SUCCESS , "Failed\n" );
1521 hpkg = package_from_db( hdb );
1522 ok( hpkg, "failed to create package\n");
1524 /* test invalid values */
1525 r = MsiGetProperty( 0, NULL, NULL, NULL );
1526 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1528 r = MsiGetProperty( hpkg, NULL, NULL, NULL );
1529 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1531 r = MsiGetProperty( hpkg, "boo", NULL, NULL );
1532 ok( r == ERROR_SUCCESS, "wrong return val\n");
1534 r = MsiGetProperty( hpkg, "boo", buffer, NULL );
1535 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1537 /* test retrieving an empty/nonexistent property */
1539 r = MsiGetProperty( hpkg, "boo", NULL, &sz );
1540 ok( r == ERROR_SUCCESS, "wrong return val\n");
1541 ok( sz == 0, "wrong size returned\n");
1543 check_prop_empty( hpkg, "boo");
1546 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1547 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1548 ok( !strcmp(buffer,"x"), "buffer was changed\n");
1549 ok( sz == 0, "wrong size returned\n");
1553 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1554 ok( r == ERROR_SUCCESS, "wrong return val\n");
1555 ok( buffer[0] == 0, "buffer was not changed\n");
1556 ok( sz == 0, "wrong size returned\n");
1558 /* set the property to something */
1559 r = MsiSetProperty( 0, NULL, NULL );
1560 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1562 r = MsiSetProperty( hpkg, NULL, NULL );
1563 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1565 r = MsiSetProperty( hpkg, "", NULL );
1566 ok( r == ERROR_SUCCESS, "wrong return val\n");
1568 /* try set and get some illegal property identifiers */
1569 r = MsiSetProperty( hpkg, "", "asdf" );
1570 ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n");
1572 r = MsiSetProperty( hpkg, "=", "asdf" );
1573 ok( r == ERROR_SUCCESS, "wrong return val\n");
1575 r = MsiSetProperty( hpkg, " ", "asdf" );
1576 ok( r == ERROR_SUCCESS, "wrong return val\n");
1578 r = MsiSetProperty( hpkg, "'", "asdf" );
1579 ok( r == ERROR_SUCCESS, "wrong return val\n");
1583 r = MsiGetProperty( hpkg, "'", buffer, &sz );
1584 ok( r == ERROR_SUCCESS, "wrong return val\n");
1585 ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
1587 /* set empty values */
1588 r = MsiSetProperty( hpkg, "boo", NULL );
1589 ok( r == ERROR_SUCCESS, "wrong return val\n");
1590 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1592 r = MsiSetProperty( hpkg, "boo", "" );
1593 ok( r == ERROR_SUCCESS, "wrong return val\n");
1594 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1596 /* set a non-empty value */
1597 r = MsiSetProperty( hpkg, "boo", "xyz" );
1598 ok( r == ERROR_SUCCESS, "wrong return val\n");
1602 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1603 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1604 ok( buffer[0] == 0, "buffer was not changed\n");
1605 ok( sz == 3, "wrong size returned\n");
1609 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1610 ok( r == ERROR_SUCCESS, "wrong return val\n");
1611 ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
1612 ok( sz == 3, "wrong size returned\n");
1616 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1617 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1618 ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
1619 ok( sz == 3, "wrong size returned\n");
1621 r = MsiSetProperty(hpkg, "SourceDir", "foo");
1622 ok( r == ERROR_SUCCESS, "wrong return val\n");
1625 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
1626 ok( r == ERROR_SUCCESS, "wrong return val\n");
1627 ok( !strcmp(buffer,""), "buffer wrong\n");
1628 ok( sz == 0, "wrong size returned\n");
1631 r = MsiGetProperty(hpkg, "SOMERANDOMNAME", buffer, &sz);
1632 ok( r == ERROR_SUCCESS, "wrong return val\n");
1633 ok( !strcmp(buffer,""), "buffer wrong\n");
1634 ok( sz == 0, "wrong size returned\n");
1637 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
1638 ok( r == ERROR_SUCCESS, "wrong return val\n");
1639 ok( !strcmp(buffer,"foo"), "buffer wrong\n");
1640 ok( sz == 3, "wrong size returned\n");
1642 r = MsiSetProperty(hpkg, "MetadataCompName", "Photoshop.dll");
1643 ok( r == ERROR_SUCCESS, "wrong return val\n");
1646 r = MsiGetProperty(hpkg, "MetadataCompName", NULL, &sz );
1647 ok( r == ERROR_SUCCESS, "return wrong\n");
1648 ok( sz == 13, "size wrong (%d)\n", sz);
1651 r = MsiGetProperty(hpkg, "MetadataCompName", buffer, &sz );
1652 ok( r == ERROR_MORE_DATA, "return wrong\n");
1653 ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n");
1655 r = MsiSetProperty(hpkg, "property", "value");
1656 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1659 r = MsiGetProperty(hpkg, "property", buffer, &sz);
1660 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1661 ok( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer);
1663 r = MsiSetProperty(hpkg, "property", NULL);
1664 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1667 r = MsiGetProperty(hpkg, "property", buffer, &sz);
1668 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1669 ok( !strlen(buffer), "Expected empty string, got %s\n", buffer);
1671 MsiCloseHandle( hpkg );
1672 DeleteFile(msifile);
1675 static BOOL find_prop_in_property(MSIHANDLE hdb, LPCSTR prop, LPCSTR val)
1677 MSIHANDLE hview, hrec;
1679 CHAR buffer[MAX_PATH];
1683 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
1684 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
1685 r = MsiViewExecute(hview, 0);
1686 ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
1689 while (r == ERROR_SUCCESS && !found)
1691 r = MsiViewFetch(hview, &hrec);
1692 if (r != ERROR_SUCCESS) break;
1695 r = MsiRecordGetString(hrec, 1, buffer, &sz);
1696 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
1699 r = MsiRecordGetString(hrec, 2, buffer, &sz);
1700 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, val))
1704 MsiCloseHandle(hrec);
1707 MsiViewClose(hview);
1708 MsiCloseHandle(hview);
1713 static void test_property_table(void)
1717 MSIHANDLE hpkg, hdb, hrec;
1718 char buffer[MAX_PATH];
1722 hdb = create_package_db();
1723 ok( hdb, "failed to create package\n");
1725 hpkg = package_from_db(hdb);
1726 ok( hpkg, "failed to create package\n");
1728 MsiCloseHandle(hdb);
1730 hdb = MsiGetActiveDatabase(hpkg);
1732 query = "CREATE TABLE `_Property` ( "
1733 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1734 r = run_query(hdb, query);
1735 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
1737 MsiCloseHandle(hdb);
1738 MsiCloseHandle(hpkg);
1739 DeleteFile(msifile);
1741 hdb = create_package_db();
1742 ok( hdb, "failed to create package\n");
1744 query = "CREATE TABLE `_Property` ( "
1745 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1746 r = run_query(hdb, query);
1747 ok(r == ERROR_SUCCESS, "failed to create table\n");
1749 query = "ALTER `_Property` ADD `foo` INTEGER";
1750 r = run_query(hdb, query);
1751 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
1753 query = "ALTER TABLE `_Property` ADD `foo` INTEGER";
1754 r = run_query(hdb, query);
1755 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
1757 query = "ALTER TABLE `_Property` ADD `extra` INTEGER";
1758 r = run_query(hdb, query);
1759 ok(r == ERROR_SUCCESS, "failed to add column\n");
1761 hpkg = package_from_db(hdb);
1764 ok(!hpkg, "package should not be created\n");
1767 MsiCloseHandle(hdb);
1768 MsiCloseHandle(hpkg);
1769 DeleteFile(msifile);
1771 hdb = create_package_db();
1772 ok (hdb, "failed to create package database\n");
1774 r = create_property_table(hdb);
1775 ok(r == ERROR_SUCCESS, "cannot create Property table: %d\n", r);
1777 r = add_property_entry(hdb, "'prop', 'val'");
1778 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
1780 hpkg = package_from_db(hdb);
1781 ok(hpkg, "failed to create package\n");
1783 MsiCloseHandle(hdb);
1786 r = MsiGetProperty(hpkg, "prop", buffer, &sz);
1787 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1788 ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
1790 hdb = MsiGetActiveDatabase(hpkg);
1792 found = find_prop_in_property(hdb, "prop", "val");
1793 ok(found, "prop should be in the _Property table\n");
1795 r = add_property_entry(hdb, "'dantes', 'mercedes'");
1796 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
1798 query = "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
1799 r = do_query(hdb, query, &hrec);
1800 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
1802 found = find_prop_in_property(hdb, "dantes", "mercedes");
1803 ok(found == FALSE, "dantes should not be in the _Property table\n");
1806 lstrcpy(buffer, "aaa");
1807 r = MsiGetProperty(hpkg, "dantes", buffer, &sz);
1808 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1809 ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer);
1811 r = MsiSetProperty(hpkg, "dantes", "mercedes");
1812 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1814 found = find_prop_in_property(hdb, "dantes", "mercedes");
1815 ok(found == TRUE, "dantes should be in the _Property table\n");
1817 MsiCloseHandle(hdb);
1818 MsiCloseHandle(hpkg);
1819 DeleteFile(msifile);
1822 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
1827 res = MsiDatabaseOpenView( hdb, szQuery, &htab );
1828 if( res == ERROR_SUCCESS )
1832 r = MsiViewExecute( htab, hrec );
1833 if( r != ERROR_SUCCESS )
1836 fprintf(stderr,"MsiViewExecute failed %08x\n", res);
1839 r = MsiViewClose( htab );
1840 if( r != ERROR_SUCCESS )
1843 r = MsiCloseHandle( htab );
1844 if( r != ERROR_SUCCESS )
1850 static UINT try_query( MSIHANDLE hdb, LPCSTR szQuery )
1852 return try_query_param( hdb, szQuery, 0 );
1855 static void test_msipackage(void)
1857 MSIHANDLE hdb = 0, hpack = 100;
1862 DeleteFile(msifile);
1866 r = MsiOpenPackage(name, &hpack);
1867 ok(r == ERROR_SUCCESS, "failed to open package with no name\n");
1868 r = MsiCloseHandle(hpack);
1869 ok(r == ERROR_SUCCESS, "failed to close package\n");
1872 /* just MsiOpenDatabase should not create a file */
1873 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
1874 ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
1878 r = MsiOpenPackage(name, &hpack);
1879 ok(r == ERROR_INVALID_HANDLE, "MsiOpenPackage returned wrong code\n");
1882 /* now try again with our empty database */
1883 sprintf(name, "#%ld", hdb);
1884 r = MsiOpenPackage(name, &hpack);
1885 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "MsiOpenPackage returned wrong code\n");
1886 if (!r) MsiCloseHandle(hpack);
1889 /* create a table */
1890 query = "CREATE TABLE `Property` ( "
1891 "`Property` CHAR(72), `Value` CHAR(0) "
1892 "PRIMARY KEY `Property`)";
1893 r = try_query(hdb, query);
1894 ok(r == ERROR_SUCCESS, "failed to create Properties table\n");
1896 query = "CREATE TABLE `InstallExecuteSequence` ("
1897 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
1898 "PRIMARY KEY `Action`)";
1899 r = try_query(hdb, query);
1900 ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n");
1903 sprintf(name, "#%ld", hdb);
1904 r = MsiOpenPackage(name, &hpack);
1905 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "MsiOpenPackage returned wrong code\n");
1906 if (!r) MsiCloseHandle(hpack);
1909 r = MsiCloseHandle(hdb);
1910 ok(r == ERROR_SUCCESS, "MsiCloseHandle(database) failed\n");
1911 DeleteFile(msifile);
1914 static void test_formatrecord2(void)
1916 MSIHANDLE hpkg, hrec ;
1921 hpkg = package_from_db(create_package_db());
1922 ok( hpkg, "failed to create package\n");
1924 r = MsiSetProperty(hpkg, "Manufacturer", " " );
1925 ok( r == ERROR_SUCCESS, "set property failed\n");
1927 hrec = MsiCreateRecord(2);
1928 ok(hrec, "create record failed\n");
1930 r = MsiRecordSetString( hrec, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
1931 ok( r == ERROR_SUCCESS, "format record failed\n");
1935 r = MsiFormatRecord( hpkg, hrec, buffer, &sz );
1937 r = MsiRecordSetString(hrec, 0, "[foo][1]");
1938 r = MsiRecordSetString(hrec, 1, "hoo");
1940 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
1941 ok( sz == 3, "size wrong\n");
1942 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
1943 ok( r == ERROR_SUCCESS, "format failed\n");
1945 r = MsiRecordSetString(hrec, 0, "x[~]x");
1947 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
1948 ok( sz == 3, "size wrong\n");
1949 ok( 0 == strcmp(buffer,"x"), "wrong output %s\n",buffer);
1950 ok( r == ERROR_SUCCESS, "format failed\n");
1952 r = MsiRecordSetString(hrec, 0, "[foo.$%}][1]");
1953 r = MsiRecordSetString(hrec, 1, "hoo");
1955 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
1956 ok( sz == 3, "size wrong\n");
1957 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
1958 ok( r == ERROR_SUCCESS, "format failed\n");
1960 r = MsiRecordSetString(hrec, 0, "[\\[]");
1962 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
1963 ok( sz == 1, "size wrong\n");
1964 ok( 0 == strcmp(buffer,"["), "wrong output %s\n",buffer);
1965 ok( r == ERROR_SUCCESS, "format failed\n");
1967 SetEnvironmentVariable("FOO", "BAR");
1968 r = MsiRecordSetString(hrec, 0, "[%FOO]");
1970 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
1971 ok( sz == 3, "size wrong\n");
1972 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
1973 ok( r == ERROR_SUCCESS, "format failed\n");
1975 r = MsiRecordSetString(hrec, 0, "[[1]]");
1976 r = MsiRecordSetString(hrec, 1, "%FOO");
1978 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
1979 ok( sz == 3, "size wrong\n");
1980 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
1981 ok( r == ERROR_SUCCESS, "format failed\n");
1983 MsiCloseHandle( hrec );
1984 MsiCloseHandle( hpkg );
1985 DeleteFile(msifile);
1988 /* FIXME: state is INSTALLSTATE_UNKNOWN if any features are removed and the
1989 * feature in question is not in ADD*
1991 static void test_states(void)
1996 INSTALLSTATE state, action;
1998 hdb = create_package_db();
1999 ok ( hdb, "failed to create package database\n" );
2001 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
2002 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
2004 r = create_property_table( hdb );
2005 ok( r == ERROR_SUCCESS, "cannot create Property table: %d\n", r );
2007 r = add_property_entry( hdb, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2008 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2010 r = add_property_entry( hdb, "'ProductLanguage', '1033'" );
2011 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2013 r = add_property_entry( hdb, "'ProductName', 'MSITEST'" );
2014 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2016 r = add_property_entry( hdb, "'ProductVersion', '1.1.1'" );
2017 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2019 r = create_install_execute_sequence_table( hdb );
2020 ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table: %d\n", r );
2022 r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
2023 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2025 r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
2026 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2028 r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
2029 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2031 r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" );
2032 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2034 r = add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" );
2035 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2037 r = add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" );
2038 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2040 r = add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" );
2041 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2043 r = add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" );
2044 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2046 r = add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" );
2047 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2049 r = add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" );
2050 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2052 r = add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" );
2053 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2055 r = create_media_table( hdb );
2056 ok( r == ERROR_SUCCESS, "cannot create media table: %d\n", r );
2058 r = add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''");
2059 ok( r == ERROR_SUCCESS, "cannot add media entry: %d\n", r );
2061 r = create_feature_table( hdb );
2062 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
2064 r = create_component_table( hdb );
2065 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
2067 /* msidbFeatureAttributesFavorLocal */
2068 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
2069 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2071 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2072 r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2073 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2075 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2076 r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2077 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2079 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2080 r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2081 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2083 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2084 r = add_component_entry( hdb, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2085 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2087 /* msidbFeatureAttributesFavorSource */
2088 r = add_feature_entry( hdb, "'two', '', '', '', 2, 1, '', 1" );
2089 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2091 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2092 r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2093 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2095 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2096 r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2097 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2099 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2100 r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2101 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2103 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2104 r = add_component_entry( hdb, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2105 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2107 /* msidbFeatureAttributesFavorSource */
2108 r = add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" );
2109 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2111 /* msidbFeatureAttributesFavorLocal */
2112 r = add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" );
2113 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2116 r = add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" );
2117 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2119 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2120 r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2121 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2123 /* no feature parent:msidbComponentAttributesLocalOnly */
2124 r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2125 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2127 /* msidbFeatureAttributesFavorLocal:removed */
2128 r = add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" );
2129 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2131 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2132 r = add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2133 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2135 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2136 r = add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2137 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2139 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2140 r = add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2141 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2143 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2144 r = add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2145 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2147 /* msidbFeatureAttributesFavorSource:removed */
2148 r = add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" );
2149 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2151 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2152 r = add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2153 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2155 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2156 r = add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2157 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2159 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2160 r = add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2161 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2163 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2164 r = add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2165 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2167 r = create_feature_components_table( hdb );
2168 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
2170 r = add_feature_components_entry( hdb, "'one', 'alpha'" );
2171 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2173 r = add_feature_components_entry( hdb, "'one', 'beta'" );
2174 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2176 r = add_feature_components_entry( hdb, "'one', 'gamma'" );
2177 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2179 r = add_feature_components_entry( hdb, "'one', 'theta'" );
2180 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2182 r = add_feature_components_entry( hdb, "'two', 'delta'" );
2183 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2185 r = add_feature_components_entry( hdb, "'two', 'epsilon'" );
2186 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2188 r = add_feature_components_entry( hdb, "'two', 'zeta'" );
2189 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2191 r = add_feature_components_entry( hdb, "'two', 'iota'" );
2192 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2194 r = add_feature_components_entry( hdb, "'three', 'eta'" );
2195 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2197 r = add_feature_components_entry( hdb, "'four', 'eta'" );
2198 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2200 r = add_feature_components_entry( hdb, "'five', 'eta'" );
2201 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2203 r = add_feature_components_entry( hdb, "'six', 'lambda'" );
2204 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2206 r = add_feature_components_entry( hdb, "'six', 'mu'" );
2207 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2209 r = add_feature_components_entry( hdb, "'six', 'nu'" );
2210 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2212 r = add_feature_components_entry( hdb, "'six', 'xi'" );
2213 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2215 r = add_feature_components_entry( hdb, "'seven', 'omicron'" );
2216 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2218 r = add_feature_components_entry( hdb, "'seven', 'pi'" );
2219 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2221 r = add_feature_components_entry( hdb, "'seven', 'rho'" );
2222 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2224 r = add_feature_components_entry( hdb, "'seven', 'sigma'" );
2225 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2227 r = create_file_table( hdb );
2228 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
2230 r = add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2231 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2233 r = add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2234 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2236 r = add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2237 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2239 r = add_file_entry( hdb, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2240 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2242 r = add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2243 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2245 r = add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2246 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2248 r = add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2249 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2251 r = add_file_entry( hdb, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2252 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2254 /* compressed file */
2255 r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2256 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2258 r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2259 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2261 r = add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2262 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2264 r = add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2265 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2267 r = add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2268 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2270 r = add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2271 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2273 r = add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2274 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2276 r = add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2277 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2279 r = add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2280 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2282 r = add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2283 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2285 MsiDatabaseCommit(hdb);
2287 /* these properties must not be in the saved msi file */
2288 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
2289 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2291 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
2292 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2294 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
2295 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2297 hpkg = package_from_db( hdb );
2298 ok( hpkg, "failed to create package\n");
2300 MsiCloseHandle(hdb);
2304 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2305 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2306 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2307 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2311 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2312 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2313 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2314 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2318 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2319 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2320 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2321 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2325 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2326 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2327 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2328 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2332 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2333 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2334 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2335 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2339 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2340 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2341 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2342 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2346 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2347 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2348 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2349 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2353 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2354 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2355 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2356 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2360 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2361 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2362 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2363 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2367 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2368 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2369 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2370 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2374 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2375 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2376 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2377 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2381 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2382 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2383 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2384 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2388 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2389 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2390 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2391 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2395 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2396 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2397 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2398 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2402 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2403 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2404 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2405 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2409 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2410 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2411 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2412 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2416 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2417 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2418 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2419 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2423 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2424 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2425 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2426 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2430 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2431 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2432 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2433 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2437 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2438 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2439 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2440 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2444 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2445 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2446 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2447 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2451 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
2452 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2453 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2454 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2458 r = MsiGetComponentState(hpkg, "pi", &state, &action);
2459 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2460 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2461 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2465 r = MsiGetComponentState(hpkg, "rho", &state, &action);
2466 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2467 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2468 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2472 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
2473 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2474 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2475 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2477 r = MsiDoAction( hpkg, "CostInitialize");
2478 ok( r == ERROR_SUCCESS, "cost init failed\n");
2482 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2483 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2484 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2485 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2489 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2490 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2491 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2492 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2496 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2497 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2498 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2499 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2503 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2504 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2505 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2506 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2510 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2511 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2512 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2513 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2517 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2518 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2519 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2520 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2524 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2525 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2526 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2527 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2531 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2532 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2533 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2534 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2538 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2539 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2540 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2541 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2545 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2546 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2547 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2548 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2552 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2553 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2554 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2555 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2559 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2560 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2561 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2562 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2566 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2567 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2568 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2569 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2573 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2574 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2575 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2576 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2580 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2581 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2582 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2583 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2587 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2588 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2589 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2590 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2594 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2595 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2596 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2597 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2601 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2602 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2603 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2604 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2608 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2609 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2610 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2611 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2615 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2616 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2617 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2618 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2622 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2623 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2624 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2625 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2629 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
2630 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2631 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2632 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2636 r = MsiGetComponentState(hpkg, "pi", &state, &action);
2637 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2638 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2639 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2643 r = MsiGetComponentState(hpkg, "rho", &state, &action);
2644 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2645 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2646 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2650 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
2651 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2652 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2653 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2655 r = MsiDoAction( hpkg, "FileCost");
2656 ok( r == ERROR_SUCCESS, "file cost failed\n");
2660 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2661 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2662 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2663 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2667 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2668 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2669 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2670 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2674 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2675 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2676 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2677 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2681 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2682 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2683 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2684 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2688 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2689 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2690 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2691 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2695 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2696 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2697 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2698 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2702 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2703 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2704 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2705 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2709 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2710 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2711 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2712 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2716 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2717 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2718 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2719 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2723 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2724 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2725 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2726 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2730 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2731 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2732 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2733 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2737 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2738 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2739 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2740 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2744 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2745 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2746 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2747 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2751 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2752 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2753 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2754 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2758 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2759 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2760 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2761 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2765 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2766 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2767 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2768 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2772 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2773 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2774 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2775 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2779 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2780 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2781 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2782 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2786 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2787 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2788 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2789 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2793 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2794 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2795 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2796 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2800 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2801 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2802 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2803 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2807 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
2808 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2809 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2810 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2814 r = MsiGetComponentState(hpkg, "pi", &state, &action);
2815 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2816 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2817 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2821 r = MsiGetComponentState(hpkg, "rho", &state, &action);
2822 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2823 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2824 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2828 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
2829 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2830 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2831 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2833 r = MsiDoAction( hpkg, "CostFinalize");
2834 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
2838 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2839 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2840 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2841 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
2845 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2846 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2847 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2848 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
2852 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2853 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2854 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2855 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
2859 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2860 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2861 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2862 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
2866 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2867 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2868 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2869 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2873 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2874 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2875 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2878 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2883 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2884 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2885 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2888 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2893 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2894 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2895 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2896 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
2900 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2901 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2902 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2903 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
2907 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2908 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2909 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2910 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
2914 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2915 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2916 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2917 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
2921 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2922 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2923 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2924 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
2928 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2929 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2930 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2931 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
2935 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2936 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2937 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2938 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
2942 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2943 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2944 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2945 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
2949 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2950 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2951 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2952 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
2956 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2957 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2958 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2959 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2963 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2964 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2965 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2968 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2973 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2974 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2975 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2978 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2983 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2984 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2985 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2988 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2993 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2994 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2995 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2998 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3003 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3004 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3005 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3008 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3013 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3014 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3015 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3018 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3023 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3024 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3025 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3028 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3033 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3034 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3035 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3038 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3041 MsiCloseHandle( hpkg );
3043 /* publish the features and components */
3044 r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven");
3045 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3047 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
3048 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
3050 /* these properties must not be in the saved msi file */
3051 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
3052 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3054 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
3055 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3057 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
3058 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3060 hpkg = package_from_db( hdb );
3061 ok( hpkg, "failed to create package\n");
3063 MsiCloseHandle(hdb);
3067 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3068 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3069 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3070 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3074 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3075 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3076 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3077 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3081 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3082 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3083 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3084 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3088 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3089 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3090 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3091 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3095 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3096 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3097 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3098 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3102 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3103 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3104 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3105 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3109 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3110 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3111 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3112 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3116 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3117 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3118 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3119 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3123 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3124 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3125 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3126 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3130 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3131 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3132 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3133 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3137 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3138 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3139 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3140 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3144 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3145 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3146 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3147 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3151 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3152 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3153 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3154 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3158 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3159 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3160 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3161 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3165 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3166 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3167 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3168 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3172 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3173 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3174 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3175 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3179 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3180 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3181 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3182 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3186 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3187 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3188 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3189 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3193 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3194 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3195 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3196 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3200 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3201 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3202 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3203 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3207 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3208 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3209 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3210 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3214 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3215 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3216 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3217 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3221 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3222 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3223 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3224 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3228 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3229 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3230 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3231 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3235 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3236 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3237 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3238 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3240 r = MsiDoAction( hpkg, "CostInitialize");
3241 ok( r == ERROR_SUCCESS, "cost init failed\n");
3245 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3246 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3247 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3248 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3252 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3253 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3254 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3255 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3259 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3260 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3261 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3262 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3266 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3267 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3268 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3269 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3273 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3274 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3275 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3276 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3280 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3281 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3282 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3283 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3287 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3288 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3289 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3290 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3294 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3295 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3296 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3297 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3301 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3302 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3303 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3304 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3308 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3309 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3310 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3311 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3315 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3316 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3317 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3318 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3322 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3323 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3324 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3325 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3329 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3330 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3331 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3332 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3336 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3337 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3338 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3339 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3343 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3344 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3345 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3346 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3350 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3351 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3352 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3353 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3357 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3358 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3359 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3360 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3364 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3365 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3366 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3367 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3371 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3372 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3373 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3374 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3378 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3379 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3380 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3381 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3385 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3386 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3387 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3388 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3392 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3393 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3394 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3395 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3399 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3400 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3401 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3402 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3406 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3407 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3408 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3409 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3413 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3414 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3415 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3416 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3418 r = MsiDoAction( hpkg, "FileCost");
3419 ok( r == ERROR_SUCCESS, "file cost failed\n");
3423 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3424 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3425 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3426 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3430 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3431 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3432 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3433 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3437 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3438 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3439 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3440 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3444 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3445 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3446 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3447 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3451 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3452 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3453 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3454 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3458 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3459 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3460 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3461 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3465 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3466 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3467 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3468 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3472 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3473 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3474 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3475 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3479 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3480 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3481 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3482 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3486 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3487 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3488 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3489 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3493 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3494 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3495 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3496 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3500 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3501 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3502 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3503 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3507 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3508 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3509 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3510 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3514 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3515 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3516 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3517 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3521 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3522 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3523 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3524 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3528 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3529 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3530 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3531 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3535 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3536 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3537 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3538 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3542 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3543 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3544 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3545 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3549 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3550 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3551 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3552 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3556 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3557 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3558 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3559 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3563 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3564 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3565 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3566 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3570 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3571 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3572 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3573 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3577 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3578 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3579 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3580 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3584 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3585 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3586 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3587 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3591 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3592 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3593 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3594 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3596 r = MsiDoAction( hpkg, "CostFinalize");
3597 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3601 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3602 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3605 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3607 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3611 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3612 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3615 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3617 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3621 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3622 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3625 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3627 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3631 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3632 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3635 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3637 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3641 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3642 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3645 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3647 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3651 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3652 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3653 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3656 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3661 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3662 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3663 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3666 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3671 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3672 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3675 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3677 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3681 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3682 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3685 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3687 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3691 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3692 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3695 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3697 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3701 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3702 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3705 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3707 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3711 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3712 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3715 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3717 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3721 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3722 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3725 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3726 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3731 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3732 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3735 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3736 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3741 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3742 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3745 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3747 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3751 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3752 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3755 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3757 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3761 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3762 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3763 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3764 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3768 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3769 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3770 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3773 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3778 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3779 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3780 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3783 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3788 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3789 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3790 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3793 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3798 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3799 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3800 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3803 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3808 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3809 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3810 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3813 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3818 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3819 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3820 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3823 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3828 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3829 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3830 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3833 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3838 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3839 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3840 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3843 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3846 MsiCloseHandle(hpkg);
3848 /* uninstall the product */
3849 r = MsiInstallProduct(msifile, "REMOVE=ALL");
3850 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3852 DeleteFileA(msifile);
3855 static void test_getproperty(void)
3857 MSIHANDLE hPackage = 0;
3859 static CHAR empty[] = "";
3863 hPackage = package_from_db(create_package_db());
3864 ok( hPackage != 0, " Failed to create package\n");
3866 /* set the property */
3867 r = MsiSetProperty(hPackage, "Name", "Value");
3868 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3870 /* retrieve the size, NULL pointer */
3872 r = MsiGetProperty(hPackage, "Name", NULL, &size);
3873 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3874 ok( size == 5, "Expected 5, got %d\n", size);
3876 /* retrieve the size, empty string */
3878 r = MsiGetProperty(hPackage, "Name", empty, &size);
3879 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
3880 ok( size == 5, "Expected 5, got %d\n", size);
3882 /* don't change size */
3883 r = MsiGetProperty(hPackage, "Name", prop, &size);
3884 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
3885 ok( size == 5, "Expected 5, got %d\n", size);
3886 ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
3888 /* increase the size by 1 */
3890 r = MsiGetProperty(hPackage, "Name", prop, &size);
3891 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3892 ok( size == 5, "Expected 5, got %d\n", size);
3893 ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
3895 r = MsiCloseHandle( hPackage);
3896 ok( r == ERROR_SUCCESS , "Failed to close package\n" );
3897 DeleteFile(msifile);
3900 static void test_removefiles(void)
3905 char CURR_DIR[MAX_PATH];
3907 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
3909 hdb = create_package_db();
3910 ok ( hdb, "failed to create package database\n" );
3912 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
3913 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
3915 r = create_feature_table( hdb );
3916 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
3918 r = create_component_table( hdb );
3919 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
3921 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
3922 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
3924 r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
3925 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
3927 r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
3928 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
3930 r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
3931 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
3933 r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
3934 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
3936 r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
3937 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
3939 r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
3940 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
3942 r = create_feature_components_table( hdb );
3943 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
3945 r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
3946 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
3948 r = add_feature_components_entry( hdb, "'one', 'helium'" );
3949 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
3951 r = add_feature_components_entry( hdb, "'one', 'lithium'" );
3952 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
3954 r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
3955 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
3957 r = add_feature_components_entry( hdb, "'one', 'boron'" );
3958 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
3960 r = add_feature_components_entry( hdb, "'one', 'carbon'" );
3961 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
3963 r = create_file_table( hdb );
3964 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
3966 r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
3967 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
3969 r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
3970 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
3972 r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
3973 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
3975 r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
3976 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
3978 r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
3979 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
3981 r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
3982 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
3984 r = create_remove_file_table( hdb );
3985 ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
3987 hpkg = package_from_db( hdb );
3988 ok( hpkg, "failed to create package\n");
3990 MsiCloseHandle( hdb );
3992 create_test_file( "hydrogen.txt" );
3993 create_test_file( "helium.txt" );
3994 create_test_file( "lithium.txt" );
3995 create_test_file( "beryllium.txt" );
3996 create_test_file( "boron.txt" );
3997 create_test_file( "carbon.txt" );
3999 r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
4000 ok( r == ERROR_SUCCESS, "set property failed\n");
4002 r = MsiDoAction( hpkg, "CostInitialize");
4003 ok( r == ERROR_SUCCESS, "cost init failed\n");
4005 r = MsiDoAction( hpkg, "FileCost");
4006 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4008 r = MsiDoAction( hpkg, "CostFinalize");
4009 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4011 r = MsiDoAction( hpkg, "InstallValidate");
4012 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4014 r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
4015 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4017 r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
4018 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4020 r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
4021 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4023 r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
4024 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4026 r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
4027 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4029 r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
4030 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4032 r = MsiDoAction( hpkg, "RemoveFiles");
4033 ok( r == ERROR_SUCCESS, "remove files failed\n");
4035 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
4036 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
4037 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
4038 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
4039 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
4040 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
4042 MsiCloseHandle( hpkg );
4043 DeleteFileA(msifile);
4046 static void test_appsearch(void)
4051 CHAR prop[MAX_PATH];
4052 DWORD size = MAX_PATH;
4054 hdb = create_package_db();
4055 ok ( hdb, "failed to create package database\n" );
4057 r = create_appsearch_table( hdb );
4058 ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
4060 r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
4061 ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
4063 r = create_reglocator_table( hdb );
4064 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
4066 r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
4067 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
4069 r = create_signature_table( hdb );
4070 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
4072 r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
4073 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
4075 hpkg = package_from_db( hdb );
4076 ok( hpkg, "failed to create package\n");
4078 MsiCloseHandle( hdb );
4080 r = MsiDoAction( hpkg, "AppSearch" );
4081 ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
4083 r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
4084 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4085 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
4087 MsiCloseHandle( hpkg );
4088 DeleteFileA(msifile);
4091 static void test_featureparents(void)
4096 INSTALLSTATE state, action;
4098 hdb = create_package_db();
4099 ok ( hdb, "failed to create package database\n" );
4101 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
4102 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4104 r = create_feature_table( hdb );
4105 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
4107 r = create_component_table( hdb );
4108 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
4110 r = create_feature_components_table( hdb );
4111 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
4113 r = create_file_table( hdb );
4114 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
4116 /* msidbFeatureAttributesFavorLocal */
4117 r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
4118 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4120 /* msidbFeatureAttributesFavorSource */
4121 r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
4122 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4124 /* msidbFeatureAttributesFavorLocal */
4125 r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
4126 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4128 /* disabled because of install level */
4129 r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
4130 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4132 /* child feature of disabled feature */
4133 r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
4134 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4136 /* component of disabled feature (install level) */
4137 r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
4138 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4140 /* component of disabled child feature (install level) */
4141 r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
4142 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4144 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
4145 r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
4146 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4148 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
4149 r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
4150 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4152 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
4153 r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
4154 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4156 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
4157 r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
4158 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4160 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
4161 r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
4162 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4164 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
4165 r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
4166 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4168 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
4169 r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
4170 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4172 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
4173 r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
4174 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4176 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
4177 r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
4179 r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
4180 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4182 r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
4183 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4185 r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
4186 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4188 r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
4189 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4191 r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
4192 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4194 r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
4195 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4197 r = add_feature_components_entry( hdb, "'orion', 'leo'" );
4198 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4200 r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
4201 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4203 r = add_feature_components_entry( hdb, "'orion', 'libra'" );
4204 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4206 r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
4207 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4209 r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
4210 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4212 r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
4213 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4215 r = add_feature_components_entry( hdb, "'orion', 'canis'" );
4216 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4218 r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
4219 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4221 r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
4222 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4224 r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
4225 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4227 r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
4228 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4230 r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
4231 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4233 r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
4234 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4236 r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
4237 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4239 r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
4240 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4242 r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
4243 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4245 r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
4246 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4248 r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
4249 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4251 r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
4252 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4254 r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
4255 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4257 r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
4258 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4260 r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
4261 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4263 hpkg = package_from_db( hdb );
4264 ok( hpkg, "failed to create package\n");
4266 MsiCloseHandle( hdb );
4268 r = MsiDoAction( hpkg, "CostInitialize");
4269 ok( r == ERROR_SUCCESS, "cost init failed\n");
4271 r = MsiDoAction( hpkg, "FileCost");
4272 ok( r == ERROR_SUCCESS, "file cost failed\n");
4274 r = MsiDoAction( hpkg, "CostFinalize");
4275 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4279 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
4280 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4281 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4282 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4286 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
4287 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4288 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4289 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4293 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
4294 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4295 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4296 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4300 r = MsiGetFeatureState(hpkg, "waters", &state, &action);
4301 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4302 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4303 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4307 r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
4308 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4309 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4310 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4314 r = MsiGetComponentState(hpkg, "leo", &state, &action);
4315 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4316 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4317 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4321 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
4322 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4323 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
4324 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
4328 r = MsiGetComponentState(hpkg, "libra", &state, &action);
4329 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4330 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
4331 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
4335 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
4336 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4337 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
4338 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
4342 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
4343 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4344 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
4345 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
4349 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
4350 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4351 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
4352 ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
4356 r = MsiGetComponentState(hpkg, "canis", &state, &action);
4357 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4358 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
4359 ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
4363 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
4364 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4365 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
4366 ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
4370 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
4371 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4372 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
4373 ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
4377 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
4378 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4379 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
4380 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
4384 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
4385 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4386 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
4387 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
4389 r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
4390 ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
4394 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
4395 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4396 ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
4397 ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
4401 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
4402 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4403 ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
4404 ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
4408 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
4409 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4410 ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
4411 ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
4415 r = MsiGetComponentState(hpkg, "leo", &state, &action);
4416 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4417 ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
4418 ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
4422 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
4423 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4424 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
4425 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
4429 r = MsiGetComponentState(hpkg, "libra", &state, &action);
4430 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4431 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
4432 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
4436 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
4437 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4438 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
4439 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
4443 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
4444 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4445 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
4446 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
4450 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
4451 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4452 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
4453 ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
4457 r = MsiGetComponentState(hpkg, "canis", &state, &action);
4458 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4459 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
4460 ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
4464 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
4465 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4466 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
4467 ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
4471 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
4472 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4473 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
4474 ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
4478 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
4479 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4480 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
4481 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
4485 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
4486 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4487 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
4488 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
4490 MsiCloseHandle(hpkg);
4491 DeleteFileA(msifile);
4494 static void test_installprops(void)
4496 MSIHANDLE hpkg, hdb;
4497 CHAR path[MAX_PATH];
4503 GetCurrentDirectory(MAX_PATH, path);
4504 lstrcat(path, "\\");
4505 lstrcat(path, msifile);
4507 hdb = create_package_db();
4508 ok( hdb, "failed to create database\n");
4510 hpkg = package_from_db(hdb);
4511 ok( hpkg, "failed to create package\n");
4513 MsiCloseHandle(hdb);
4516 r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
4517 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4518 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
4520 RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey);
4524 RegQueryValueEx(hkey, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
4527 r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
4528 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4529 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
4533 RegQueryValueEx(hkey, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
4536 r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
4537 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4538 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
4541 r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
4542 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4543 trace("VersionDatabase = %s\n", buf);
4546 r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
4547 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4548 trace("VersionMsi = %s\n", buf);
4551 r = MsiGetProperty(hpkg, "Date", buf, &size);
4552 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4553 trace("Date = %s\n", buf);
4556 r = MsiGetProperty(hpkg, "Time", buf, &size);
4557 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4558 trace("Time = %s\n", buf);
4561 r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
4562 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4563 trace("PackageCode = %s\n", buf);
4566 MsiCloseHandle(hpkg);
4567 DeleteFile(msifile);
4570 static void test_sourcedirprop(void)
4572 MSIHANDLE hpkg, hdb;
4573 CHAR source_dir[MAX_PATH];
4574 CHAR path[MAX_PATH];
4578 hdb = create_package_db();
4579 ok ( hdb, "failed to create package database\n" );
4581 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
4582 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4584 hpkg = package_from_db( hdb );
4585 ok( hpkg, "failed to create package\n");
4587 MsiCloseHandle( hdb );
4590 r = MsiGetProperty( hpkg, "SourceDir", source_dir, &size );
4591 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4592 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4595 r = MsiGetProperty( hpkg, "SOURCEDIR", source_dir, &size );
4596 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4597 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4599 r = MsiDoAction( hpkg, "CostInitialize");
4600 ok( r == ERROR_SUCCESS, "cost init failed\n");
4603 r = MsiGetProperty( hpkg, "SourceDir", source_dir, &size );
4604 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4605 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4608 r = MsiGetProperty( hpkg, "SOURCEDIR", source_dir, &size );
4609 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4610 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4612 r = MsiDoAction( hpkg, "ResolveSource");
4613 ok( r == ERROR_SUCCESS, "file cost failed\n");
4615 GetCurrentDirectory(MAX_PATH, path);
4616 lstrcatA(path, "\\");
4619 r = MsiGetProperty( hpkg, "SourceDir", source_dir, &size );
4620 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4621 ok( !lstrcmpA(source_dir, path), "Expected %s, got %s\n", path, source_dir);
4624 r = MsiGetProperty( hpkg, "SOURCEDIR", source_dir, &size );
4625 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4626 ok( !lstrcmpA(source_dir, path), "Expected %s, got %s\n", path, source_dir);
4629 r = MsiGetProperty( hpkg, "SoUrCeDiR", source_dir, &size );
4630 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4631 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4633 MsiCloseHandle(hpkg);
4634 DeleteFileA(msifile);
4637 static void test_prop_path(void)
4639 MSIHANDLE hpkg, hdb;
4640 char buffer[MAX_PATH], cwd[MAX_PATH];
4644 GetCurrentDirectory(MAX_PATH, cwd);
4647 hdb = create_package_db();
4648 ok( hdb, "failed to create database\n");
4650 r = add_directory_entry( hdb, "'TARGETDIR','','SourceDir'" );
4651 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4653 r = add_directory_entry( hdb, "'foo','TARGETDIR','foosrc:footgt'" );
4654 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4656 hpkg = package_from_db(hdb);
4657 ok( hpkg, "failed to create package\n");
4659 r = MsiGetSourcePath(hpkg, "SourceDir", buffer, &sz );
4660 ok( r == ERROR_DIRECTORY, "failed to get source path\n");
4662 r = MsiGetSourcePath(hpkg, "SOURCEDIR", buffer, &sz );
4663 ok( r == ERROR_DIRECTORY, "failed to get source path\n");
4665 r = MsiDoAction( hpkg, "CostInitialize");
4666 ok( r == ERROR_SUCCESS, "cost init failed\n");
4670 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
4671 ok( r == ERROR_SUCCESS, "property not set\n");
4672 ok( !buffer[0], "SourceDir should be empty\n");
4676 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
4677 ok( r == ERROR_SUCCESS, "property not set\n");
4678 ok( !buffer[0], "SourceDir should be empty\n");
4682 r = MsiGetSourcePath(hpkg, "SourceDir", buffer, &sz );
4683 ok( r == ERROR_SUCCESS, "failed to get source path\n");
4684 ok( !lstrcmpi(cwd, buffer), "SourceDir (%s) should be current dir (%s)\n", buffer, cwd);
4688 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
4689 ok( r == ERROR_SUCCESS, "property not set\n");
4691 ok( !lstrcmpi(cwd, buffer), "SourceDir (%s) should be current dir (%s)\n", buffer, cwd);
4696 r = MsiGetSourcePath(hpkg, "SOURCEDIR", buffer, &sz );
4697 ok( r == ERROR_DIRECTORY, "failed to get source path\n");
4701 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
4702 ok( r == ERROR_SUCCESS, "property not set\n");
4704 ok( !lstrcmpi(cwd, buffer), "SourceDir (%s) should be current dir (%s)\n", buffer, cwd);
4707 r = MsiSetProperty(hpkg, "SourceDir", "goo");
4708 ok( r == ERROR_SUCCESS, "property not set\n");
4712 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
4713 ok( r == ERROR_SUCCESS, "property not set\n");
4714 ok( !lstrcmpi(buffer, "goo"), "SourceDir (%s) should be goo\n", buffer);
4718 r = MsiGetSourcePath(hpkg, "SourceDir", buffer, &sz );
4719 ok( r == ERROR_SUCCESS, "failed to get source path\n");
4720 ok( !lstrcmpi(buffer, cwd), "SourceDir (%s) should be goo\n", buffer);
4724 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
4725 ok( r == ERROR_SUCCESS, "property not set\n");
4726 ok( !lstrcmpi(buffer, "goo"), "SourceDir (%s) should be goo\n", buffer);
4728 MsiCloseHandle( hpkg );
4729 DeleteFile(msifile);
4732 static void test_launchconditions(void)
4738 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4740 hdb = create_package_db();
4741 ok( hdb, "failed to create package database\n" );
4743 r = create_launchcondition_table( hdb );
4744 ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
4746 r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
4747 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
4749 /* invalid condition */
4750 r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
4751 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
4753 hpkg = package_from_db( hdb );
4754 ok( hpkg, "failed to create package\n");
4756 MsiCloseHandle( hdb );
4758 r = MsiSetProperty( hpkg, "X", "1" );
4759 ok( r == ERROR_SUCCESS, "failed to set property\n" );
4761 /* invalid conditions are ignored */
4762 r = MsiDoAction( hpkg, "LaunchConditions" );
4763 ok( r == ERROR_SUCCESS, "cost init failed\n" );
4765 /* verify LaunchConditions still does some verification */
4766 r = MsiSetProperty( hpkg, "X", "2" );
4767 ok( r == ERROR_SUCCESS, "failed to set property\n" );
4769 r = MsiDoAction( hpkg, "LaunchConditions" );
4770 ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
4772 MsiCloseHandle( hpkg );
4773 DeleteFile( msifile );
4778 test_createpackage();
4779 test_getsourcepath_bad();
4780 test_getsourcepath();
4782 test_gettargetpath_bad();
4783 test_settargetpath();
4785 test_property_table();
4788 test_formatrecord2();
4793 test_featureparents();
4794 test_installprops();
4795 test_sourcedirprop();
4797 test_launchconditions();