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
30 #include "wine/test.h"
32 static const char msifile[] = "winetest.msi";
33 char CURR_DIR[MAX_PATH];
35 /* RegDeleteTreeW from dlls/advapi32/registry.c */
36 LSTATUS WINAPI package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
39 DWORD dwMaxSubkeyLen, dwMaxValueLen;
40 DWORD dwMaxLen, dwSize;
41 WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
46 ret = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
50 ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
51 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
52 if (ret) goto cleanup;
56 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
57 if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
59 /* Name too big: alloc a buffer for it */
60 if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
62 ret = ERROR_NOT_ENOUGH_MEMORY;
67 /* Recursively delete all the subkeys */
71 if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
72 NULL, NULL, NULL)) break;
74 ret = package_RegDeleteTreeW(hSubKey, lpszName);
75 if (ret) goto cleanup;
79 ret = RegDeleteKeyW(hKey, lpszSubKey);
84 if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
85 NULL, NULL, NULL, NULL)) break;
87 ret = RegDeleteValueW(hKey, lpszName);
88 if (ret) goto cleanup;
92 if (lpszName != szNameBuf)
93 HeapFree(GetProcessHeap(), 0, lpszName);
99 static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec)
104 /* open a select query */
105 r = MsiDatabaseOpenView(hdb, query, &hview);
106 if (r != ERROR_SUCCESS)
108 r = MsiViewExecute(hview, 0);
109 if (r != ERROR_SUCCESS)
111 ret = MsiViewFetch(hview, phrec);
112 r = MsiViewClose(hview);
113 if (r != ERROR_SUCCESS)
115 r = MsiCloseHandle(hview);
116 if (r != ERROR_SUCCESS)
121 static UINT run_query( MSIHANDLE hdb, const char *query )
126 r = MsiDatabaseOpenView(hdb, query, &hview);
127 if( r != ERROR_SUCCESS )
130 r = MsiViewExecute(hview, 0);
131 if( r == ERROR_SUCCESS )
132 r = MsiViewClose(hview);
133 MsiCloseHandle(hview);
137 static UINT create_component_table( MSIHANDLE hdb )
139 return run_query( hdb,
140 "CREATE TABLE `Component` ( "
141 "`Component` CHAR(72) NOT NULL, "
142 "`ComponentId` CHAR(38), "
143 "`Directory_` CHAR(72) NOT NULL, "
144 "`Attributes` SHORT NOT NULL, "
145 "`Condition` CHAR(255), "
146 "`KeyPath` CHAR(72) "
147 "PRIMARY KEY `Component`)" );
150 static UINT create_feature_table( MSIHANDLE hdb )
152 return run_query( hdb,
153 "CREATE TABLE `Feature` ( "
154 "`Feature` CHAR(38) NOT NULL, "
155 "`Feature_Parent` CHAR(38), "
157 "`Description` CHAR(255), "
158 "`Display` SHORT NOT NULL, "
159 "`Level` SHORT NOT NULL, "
160 "`Directory_` CHAR(72), "
161 "`Attributes` SHORT NOT NULL "
162 "PRIMARY KEY `Feature`)" );
165 static UINT create_feature_components_table( MSIHANDLE hdb )
167 return run_query( hdb,
168 "CREATE TABLE `FeatureComponents` ( "
169 "`Feature_` CHAR(38) NOT NULL, "
170 "`Component_` CHAR(72) NOT NULL "
171 "PRIMARY KEY `Feature_`, `Component_` )" );
174 static UINT create_file_table( MSIHANDLE hdb )
176 return run_query( hdb,
177 "CREATE TABLE `File` ("
178 "`File` CHAR(72) NOT NULL, "
179 "`Component_` CHAR(72) NOT NULL, "
180 "`FileName` CHAR(255) NOT NULL, "
181 "`FileSize` LONG NOT NULL, "
182 "`Version` CHAR(72), "
183 "`Language` CHAR(20), "
184 "`Attributes` SHORT, "
185 "`Sequence` SHORT NOT NULL "
186 "PRIMARY KEY `File`)" );
189 static UINT create_remove_file_table( MSIHANDLE hdb )
191 return run_query( hdb,
192 "CREATE TABLE `RemoveFile` ("
193 "`FileKey` CHAR(72) NOT NULL, "
194 "`Component_` CHAR(72) NOT NULL, "
195 "`FileName` CHAR(255) LOCALIZABLE, "
196 "`DirProperty` CHAR(72) NOT NULL, "
197 "`InstallMode` SHORT NOT NULL "
198 "PRIMARY KEY `FileKey`)" );
201 static UINT create_appsearch_table( MSIHANDLE hdb )
203 return run_query( hdb,
204 "CREATE TABLE `AppSearch` ("
205 "`Property` CHAR(72) NOT NULL, "
206 "`Signature_` CHAR(72) NOT NULL "
207 "PRIMARY KEY `Property`, `Signature_`)" );
210 static UINT create_reglocator_table( MSIHANDLE hdb )
212 return run_query( hdb,
213 "CREATE TABLE `RegLocator` ("
214 "`Signature_` CHAR(72) NOT NULL, "
215 "`Root` SHORT NOT NULL, "
216 "`Key` CHAR(255) NOT NULL, "
219 "PRIMARY KEY `Signature_`)" );
222 static UINT create_signature_table( MSIHANDLE hdb )
224 return run_query( hdb,
225 "CREATE TABLE `Signature` ("
226 "`Signature` CHAR(72) NOT NULL, "
227 "`FileName` CHAR(255) NOT NULL, "
228 "`MinVersion` CHAR(20), "
229 "`MaxVersion` CHAR(20), "
234 "`Languages` CHAR(255) "
235 "PRIMARY KEY `Signature`)" );
238 static UINT create_launchcondition_table( MSIHANDLE hdb )
240 return run_query( hdb,
241 "CREATE TABLE `LaunchCondition` ("
242 "`Condition` CHAR(255) NOT NULL, "
243 "`Description` CHAR(255) NOT NULL "
244 "PRIMARY KEY `Condition`)" );
247 static UINT create_property_table( MSIHANDLE hdb )
249 return run_query( hdb,
250 "CREATE TABLE `Property` ("
251 "`Property` CHAR(72) NOT NULL, "
253 "PRIMARY KEY `Property`)" );
256 static UINT create_install_execute_sequence_table( MSIHANDLE hdb )
258 return run_query( hdb,
259 "CREATE TABLE `InstallExecuteSequence` ("
260 "`Action` CHAR(72) NOT NULL, "
261 "`Condition` CHAR(255), "
263 "PRIMARY KEY `Action`)" );
266 static UINT create_media_table( MSIHANDLE hdb )
268 return run_query( hdb,
269 "CREATE TABLE `Media` ("
270 "`DiskId` SHORT NOT NULL, "
271 "`LastSequence` SHORT NOT NULL, "
272 "`DiskPrompt` CHAR(64), "
273 "`Cabinet` CHAR(255), "
274 "`VolumeLabel` CHAR(32), "
276 "PRIMARY KEY `DiskId`)" );
279 static UINT create_ccpsearch_table( MSIHANDLE hdb )
281 return run_query( hdb,
282 "CREATE TABLE `CCPSearch` ("
283 "`Signature_` CHAR(72) NOT NULL "
284 "PRIMARY KEY `Signature_`)" );
287 static UINT create_drlocator_table( MSIHANDLE hdb )
289 return run_query( hdb,
290 "CREATE TABLE `DrLocator` ("
291 "`Signature_` CHAR(72) NOT NULL, "
292 "`Parent` CHAR(72), "
295 "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
298 static UINT create_complocator_table( MSIHANDLE hdb )
300 return run_query( hdb,
301 "CREATE TABLE `CompLocator` ("
302 "`Signature_` CHAR(72) NOT NULL, "
303 "`ComponentId` CHAR(38) NOT NULL, "
305 "PRIMARY KEY `Signature_`)" );
308 static UINT add_component_entry( MSIHANDLE hdb, const char *values )
310 char insert[] = "INSERT INTO `Component` "
311 "(`Component`, `ComponentId`, `Directory_`, `Attributes`, `Condition`, `KeyPath`) "
316 sz = strlen(values) + sizeof insert;
317 query = HeapAlloc(GetProcessHeap(),0,sz);
318 sprintf(query,insert,values);
319 r = run_query( hdb, query );
320 HeapFree(GetProcessHeap(), 0, query);
324 static UINT add_feature_entry( MSIHANDLE hdb, const char *values )
326 char insert[] = "INSERT INTO `Feature` (`Feature`, `Feature_Parent`, "
327 "`Title`, `Description`, `Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )";
331 sz = strlen(values) + sizeof insert;
332 query = HeapAlloc(GetProcessHeap(),0,sz);
333 sprintf(query,insert,values);
334 r = run_query( hdb, query );
335 HeapFree(GetProcessHeap(), 0, query);
339 static UINT add_feature_components_entry( MSIHANDLE hdb, const char *values )
341 char insert[] = "INSERT INTO `FeatureComponents` "
342 "(`Feature_`, `Component_`) "
347 sz = strlen(values) + sizeof insert;
348 query = HeapAlloc(GetProcessHeap(),0,sz);
349 sprintf(query,insert,values);
350 r = run_query( hdb, query );
351 HeapFree(GetProcessHeap(), 0, query);
355 static UINT add_file_entry( MSIHANDLE hdb, const char *values )
357 char insert[] = "INSERT INTO `File` "
358 "(`File`, `Component_`, `FileName`, `FileSize`, `Version`, `Language`, `Attributes`, `Sequence`) "
363 sz = strlen(values) + sizeof insert;
364 query = HeapAlloc(GetProcessHeap(),0,sz);
365 sprintf(query,insert,values);
366 r = run_query( hdb, query );
367 HeapFree(GetProcessHeap(), 0, query);
371 static UINT add_appsearch_entry( MSIHANDLE hdb, const char *values )
373 char insert[] = "INSERT INTO `AppSearch` "
374 "(`Property`, `Signature_`) "
379 sz = strlen(values) + sizeof insert;
380 query = HeapAlloc(GetProcessHeap(),0,sz);
381 sprintf(query,insert,values);
382 r = run_query( hdb, query );
383 HeapFree(GetProcessHeap(), 0, query);
387 static UINT add_reglocator_entry( MSIHANDLE hdb, const char *values )
389 char insert[] = "INSERT INTO `RegLocator` "
390 "(`Signature_`, `Root`, `Key`, `Name`, `Type`) "
395 sz = strlen(values) + sizeof insert;
396 query = HeapAlloc(GetProcessHeap(),0,sz);
397 sprintf(query,insert,values);
398 r = run_query( hdb, query );
399 HeapFree(GetProcessHeap(), 0, query);
403 static UINT add_signature_entry( MSIHANDLE hdb, const char *values )
405 char insert[] = "INSERT INTO `Signature` "
406 "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
407 " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
412 sz = strlen(values) + sizeof insert;
413 query = HeapAlloc(GetProcessHeap(),0,sz);
414 sprintf(query,insert,values);
415 r = run_query( hdb, query );
416 HeapFree(GetProcessHeap(), 0, query);
420 static UINT add_launchcondition_entry( MSIHANDLE hdb, const char *values )
422 char insert[] = "INSERT INTO `LaunchCondition` "
423 "(`Condition`, `Description`) "
428 sz = strlen(values) + sizeof insert;
429 query = HeapAlloc(GetProcessHeap(),0,sz);
430 sprintf(query,insert,values);
431 r = run_query( hdb, query );
432 HeapFree(GetProcessHeap(), 0, query);
436 static UINT add_property_entry( MSIHANDLE hdb, const char *values )
438 char insert[] = "INSERT INTO `Property` "
439 "(`Property`, `Value`) "
444 sz = strlen(values) + sizeof insert;
445 query = HeapAlloc(GetProcessHeap(),0,sz);
446 sprintf(query,insert,values);
447 r = run_query( hdb, query );
448 HeapFree(GetProcessHeap(), 0, query);
452 static UINT add_install_execute_sequence_entry( MSIHANDLE hdb, const char *values )
454 char insert[] = "INSERT INTO `InstallExecuteSequence` "
455 "(`Action`, `Condition`, `Sequence`) "
460 sz = strlen(values) + sizeof insert;
461 query = HeapAlloc(GetProcessHeap(),0,sz);
462 sprintf(query,insert,values);
463 r = run_query( hdb, query );
464 HeapFree(GetProcessHeap(), 0, query);
468 static UINT add_media_entry( MSIHANDLE hdb, const char *values )
470 char insert[] = "INSERT INTO `Media` "
471 "(`DiskId`, `LastSequence`, `DiskPrompt`, `Cabinet`, `VolumeLabel`, `Source`) "
476 sz = strlen(values) + sizeof insert;
477 query = HeapAlloc(GetProcessHeap(),0,sz);
478 sprintf(query,insert,values);
479 r = run_query( hdb, query );
480 HeapFree(GetProcessHeap(), 0, query);
484 static UINT add_ccpsearch_entry( MSIHANDLE hdb, const char *values )
486 char insert[] = "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )";
490 sz = strlen(values) + sizeof insert;
491 query = HeapAlloc(GetProcessHeap(),0,sz);
492 sprintf(query,insert,values);
493 r = run_query( hdb, query );
494 HeapFree(GetProcessHeap(), 0, query);
498 static UINT add_drlocator_entry( MSIHANDLE hdb, const char *values )
500 char insert[] = "INSERT INTO `DrLocator` "
501 "(`Signature_`, `Parent`, `Path`, `Depth`) "
506 sz = strlen(values) + sizeof insert;
507 query = HeapAlloc(GetProcessHeap(),0,sz);
508 sprintf(query,insert,values);
509 r = run_query( hdb, query );
510 HeapFree(GetProcessHeap(), 0, query);
514 static UINT add_complocator_entry( MSIHANDLE hdb, const char *values )
516 char insert[] = "INSERT INTO `CompLocator` "
517 "(`Signature_`, `ComponentId`, `Type`) "
522 sz = strlen(values) + sizeof insert;
523 query = HeapAlloc(GetProcessHeap(),0,sz);
524 sprintf(query,insert,values);
525 r = run_query( hdb, query );
526 HeapFree(GetProcessHeap(), 0, query);
530 static UINT set_summary_info(MSIHANDLE hdb)
535 /* build summary info */
536 res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
537 ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
539 res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
540 "Installation Database");
541 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
543 res = MsiSummaryInfoSetProperty(suminfo,3, VT_LPSTR, 0,NULL,
544 "Installation Database");
545 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
547 res = MsiSummaryInfoSetProperty(suminfo,4, VT_LPSTR, 0,NULL,
549 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
551 res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
553 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
555 res = MsiSummaryInfoSetProperty(suminfo,9, VT_LPSTR, 0,NULL,
556 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
557 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
559 res = MsiSummaryInfoSetProperty(suminfo, 14, VT_I4, 100, NULL, NULL);
560 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
562 res = MsiSummaryInfoSetProperty(suminfo, 15, VT_I4, 0, NULL, NULL);
563 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
565 res = MsiSummaryInfoPersist(suminfo);
566 ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
568 res = MsiCloseHandle( suminfo);
569 ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
575 static MSIHANDLE create_package_db(void)
582 /* create an empty database */
583 res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb );
584 ok( res == ERROR_SUCCESS , "Failed to create database\n" );
585 if( res != ERROR_SUCCESS )
588 res = MsiDatabaseCommit( hdb );
589 ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
591 res = set_summary_info(hdb);
593 res = run_query( hdb,
594 "CREATE TABLE `Directory` ( "
595 "`Directory` CHAR(255) NOT NULL, "
596 "`Directory_Parent` CHAR(255), "
597 "`DefaultDir` CHAR(255) NOT NULL "
598 "PRIMARY KEY `Directory`)" );
599 ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
604 static MSIHANDLE package_from_db(MSIHANDLE hdb)
610 sprintf(szPackage,"#%li",hdb);
611 res = MsiOpenPackage(szPackage,&hPackage);
612 if (res != ERROR_SUCCESS)
615 res = MsiCloseHandle(hdb);
616 if (res != ERROR_SUCCESS)
622 static void create_test_file(const CHAR *name)
627 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
628 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
629 WriteFile(file, name, strlen(name), &written, NULL);
630 WriteFile(file, "\n", strlen("\n"), &written, NULL);
634 static void test_createpackage(void)
636 MSIHANDLE hPackage = 0;
639 hPackage = package_from_db(create_package_db());
640 ok( hPackage != 0, " Failed to create package\n");
642 res = MsiCloseHandle( hPackage);
643 ok( res == ERROR_SUCCESS , "Failed to close package\n" );
647 static void test_getsourcepath_bad( void )
649 static const char str[] = { 0 };
654 r = MsiGetSourcePath( -1, NULL, NULL, NULL );
655 ok( r == ERROR_INVALID_PARAMETER, "return value wrong\n");
658 r = MsiGetSourcePath( -1, NULL, buffer, &sz );
659 ok( r == ERROR_INVALID_PARAMETER, "return value wrong\n");
662 r = MsiGetSourcePath( -1, str, NULL, &sz );
663 ok( r == ERROR_INVALID_HANDLE, "return value wrong\n");
666 r = MsiGetSourcePath( -1, str, NULL, NULL );
667 ok( r == ERROR_INVALID_HANDLE, "return value wrong\n");
670 r = MsiGetSourcePath( -1, str, buffer, &sz );
671 ok( r == ERROR_INVALID_HANDLE, "return value wrong\n");
674 static UINT add_directory_entry( MSIHANDLE hdb, const char *values )
676 char insert[] = "INSERT INTO `Directory` (`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )";
680 sz = strlen(values) + sizeof insert;
681 query = HeapAlloc(GetProcessHeap(),0,sz);
682 sprintf(query,insert,values);
683 r = run_query( hdb, query );
684 HeapFree(GetProcessHeap(), 0, query);
688 static void test_getsourcepath( void )
690 static const char str[] = { 0 };
696 hpkg = package_from_db(create_package_db());
697 ok( hpkg, "failed to create package\n");
701 r = MsiGetSourcePath( hpkg, str, buffer, &sz );
702 ok( r == ERROR_DIRECTORY, "return value wrong\n");
703 ok( buffer[0] == 'x', "buffer modified\n");
707 r = MsiGetSourcePath( hpkg, str, buffer, &sz );
708 ok( r == ERROR_DIRECTORY, "return value wrong\n");
709 ok( buffer[0] == 'x', "buffer modified\n");
711 MsiCloseHandle( hpkg );
714 /* another test but try create a directory this time */
715 hdb = create_package_db();
716 ok( hdb, "failed to create database\n");
718 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
719 ok( r == S_OK, "failed\n");
721 hpkg = package_from_db(hdb);
722 ok( hpkg, "failed to create package\n");
724 sz = sizeof buffer -1;
725 strcpy(buffer,"x bad");
726 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, &sz );
727 ok( r == ERROR_DIRECTORY, "return value wrong\n");
729 r = MsiDoAction( hpkg, "CostInitialize");
730 ok( r == ERROR_SUCCESS, "cost init failed\n");
731 r = MsiDoAction( hpkg, "CostFinalize");
732 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
734 sz = sizeof buffer -1;
736 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, &sz );
737 ok( r == ERROR_SUCCESS, "return value wrong\n");
738 ok( sz == strlen(buffer), "returned length wrong\n");
741 strcpy(buffer,"x bad");
742 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, &sz );
743 ok( r == ERROR_MORE_DATA, "return value wrong\n");
744 ok( buffer[0] == 'x', "buffer modified\n");
746 r = MsiGetSourcePath( hpkg, "TARGETDIR", NULL, NULL );
747 ok( r == ERROR_SUCCESS, "return value wrong\n");
749 r = MsiGetSourcePath( hpkg, "TARGETDIR ", NULL, NULL );
750 ok( r == ERROR_DIRECTORY, "return value wrong\n");
752 r = MsiGetSourcePath( hpkg, "targetdir", NULL, NULL );
753 ok( r == ERROR_DIRECTORY, "return value wrong\n");
755 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, NULL );
756 ok( r == ERROR_INVALID_PARAMETER, "return value wrong\n");
758 r = MsiGetSourcePath( hpkg, "TARGETDIR", NULL, &sz );
759 ok( r == ERROR_SUCCESS, "return value wrong\n");
761 MsiCloseHandle( hpkg );
765 static void test_doaction( void )
770 r = MsiDoAction( -1, NULL );
771 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
773 hpkg = package_from_db(create_package_db());
774 ok( hpkg, "failed to create package\n");
776 r = MsiDoAction(hpkg, NULL);
777 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
779 r = MsiDoAction(0, "boo");
780 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
782 r = MsiDoAction(hpkg, "boo");
783 ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
785 MsiCloseHandle( hpkg );
789 static void test_gettargetpath_bad(void)
796 hpkg = package_from_db(create_package_db());
797 ok( hpkg, "failed to create package\n");
799 r = MsiGetTargetPath( 0, NULL, NULL, NULL );
800 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
802 r = MsiGetTargetPath( 0, NULL, NULL, &sz );
803 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
805 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
806 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
808 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
809 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
811 r = MsiGetTargetPath( hpkg, "boo", NULL, NULL );
812 ok( r == ERROR_DIRECTORY, "wrong return val\n");
814 r = MsiGetTargetPath( hpkg, "boo", buffer, NULL );
815 ok( r == ERROR_DIRECTORY, "wrong return val\n");
817 MsiCloseHandle( hpkg );
821 static void query_file_path(MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
827 rec = MsiCreateRecord( 1 );
828 ok(rec, "MsiCreate record failed\n");
830 r = MsiRecordSetString( rec, 0, file );
831 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
834 r = MsiFormatRecord( hpkg, rec, buff, &size );
835 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
837 MsiCloseHandle( rec );
840 static void test_settargetpath(void)
842 char tempdir[MAX_PATH+8], buffer[MAX_PATH], file[MAX_PATH];
848 hdb = create_package_db();
849 ok ( hdb, "failed to create package database\n" );
851 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
852 ok( r == S_OK, "failed to add directory entry: %d\n" , r );
854 r = create_component_table( hdb );
855 ok( r == S_OK, "cannot create Component table: %d\n", r );
857 r = add_component_entry( hdb, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
858 ok( r == S_OK, "cannot add dummy component: %d\n", r );
860 r = add_component_entry( hdb, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
861 ok( r == S_OK, "cannot add test component: %d\n", r );
863 r = create_feature_table( hdb );
864 ok( r == S_OK, "cannot create Feature table: %d\n", r );
866 r = add_feature_entry( hdb, "'TestFeature', '', '', '', 0, 1, '', 0" );
867 ok( r == ERROR_SUCCESS, "cannot add TestFeature to Feature table: %d\n", r );
869 r = create_feature_components_table( hdb );
870 ok( r == S_OK, "cannot create FeatureComponents table: %d\n", r );
872 r = add_feature_components_entry( hdb, "'TestFeature', 'RootComp'" );
873 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
875 r = add_feature_components_entry( hdb, "'TestFeature', 'TestComp'" );
876 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
878 add_directory_entry( hdb, "'TestParent', 'TARGETDIR', 'TestParent'" );
879 add_directory_entry( hdb, "'TestDir', 'TestParent', 'TestDir'" );
881 r = create_file_table( hdb );
882 ok( r == S_OK, "cannot create File table: %d\n", r );
884 r = add_file_entry( hdb, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
885 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
887 r = add_file_entry( hdb, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
888 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
890 hpkg = package_from_db( hdb );
891 ok( hpkg, "failed to create package\n");
893 r = MsiDoAction( hpkg, "CostInitialize");
894 ok( r == ERROR_SUCCESS, "cost init failed\n");
896 r = MsiDoAction( hpkg, "FileCost");
897 ok( r == ERROR_SUCCESS, "file cost failed\n");
899 r = MsiDoAction( hpkg, "CostFinalize");
900 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
902 r = MsiSetTargetPath( 0, NULL, NULL );
903 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
905 r = MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
906 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
908 r = MsiSetTargetPath( hpkg, "boo", NULL );
909 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
911 r = MsiSetTargetPath( hpkg, "boo", "c:\\bogusx" );
912 ok( r == ERROR_DIRECTORY, "wrong return val\n");
914 sz = sizeof tempdir - 1;
915 r = MsiGetTargetPath( hpkg, "TARGETDIR", tempdir, &sz );
916 sprintf( file, "%srootfile.txt", tempdir );
917 query_file_path( hpkg, "[#RootFile]", buffer );
918 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
919 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer );
921 GetTempFileName( tempdir, "_wt", 0, buffer );
922 sprintf( tempdir, "%s\\subdir", buffer );
924 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
925 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
926 "MsiSetTargetPath on file returned %d\n", r );
928 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
929 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
930 "MsiSetTargetPath on 'subdir' of file returned %d\n", r );
932 DeleteFile( buffer );
934 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
935 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
937 r = GetFileAttributes( buffer );
938 ok ( r == INVALID_FILE_ATTRIBUTES, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r );
940 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
941 ok( r == ERROR_SUCCESS, "MsiSetTargetPath on subsubdir returned %d\n", r );
943 sz = sizeof buffer - 1;
944 lstrcat( tempdir, "\\" );
945 r = MsiGetTargetPath( hpkg, "TARGETDIR", buffer, &sz );
946 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
947 ok( !lstrcmp(buffer, tempdir), "Expected %s, got %s\n", tempdir, buffer);
949 sprintf( file, "%srootfile.txt", tempdir );
950 query_file_path( hpkg, "[#RootFile]", buffer );
951 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer);
953 r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two" );
954 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
956 query_file_path( hpkg, "[#TestFile]", buffer );
957 ok( !lstrcmp(buffer, "C:\\one\\two\\TestDir\\testfile.txt"),
958 "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer );
960 sz = sizeof buffer - 1;
961 r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
962 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
963 ok( !lstrcmp(buffer, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer);
965 MsiCloseHandle( hpkg );
968 static void test_condition(void)
973 hpkg = package_from_db(create_package_db());
974 ok( hpkg, "failed to create package\n");
976 r = MsiEvaluateCondition(0, NULL);
977 ok( r == MSICONDITION_ERROR, "wrong return val\n");
979 r = MsiEvaluateCondition(hpkg, NULL);
980 ok( r == MSICONDITION_NONE, "wrong return val\n");
982 r = MsiEvaluateCondition(hpkg, "");
983 ok( r == MSICONDITION_NONE, "wrong return val\n");
985 r = MsiEvaluateCondition(hpkg, "1");
986 ok( r == MSICONDITION_TRUE, "wrong return val\n");
988 r = MsiEvaluateCondition(hpkg, "0");
989 ok( r == MSICONDITION_FALSE, "wrong return val\n");
991 r = MsiEvaluateCondition(hpkg, "-1");
992 ok( r == MSICONDITION_TRUE, "wrong return val\n");
994 r = MsiEvaluateCondition(hpkg, "0 = 0");
995 ok( r == MSICONDITION_TRUE, "wrong return val\n");
997 r = MsiEvaluateCondition(hpkg, "0 <> 0");
998 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1000 r = MsiEvaluateCondition(hpkg, "0 = 1");
1001 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1003 r = MsiEvaluateCondition(hpkg, "0 > 1");
1004 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1006 r = MsiEvaluateCondition(hpkg, "0 ~> 1");
1007 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1009 r = MsiEvaluateCondition(hpkg, "1 > 1");
1010 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1012 r = MsiEvaluateCondition(hpkg, "1 ~> 1");
1013 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1015 r = MsiEvaluateCondition(hpkg, "0 >= 1");
1016 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1018 r = MsiEvaluateCondition(hpkg, "0 ~>= 1");
1019 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1021 r = MsiEvaluateCondition(hpkg, "1 >= 1");
1022 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1024 r = MsiEvaluateCondition(hpkg, "1 ~>= 1");
1025 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1027 r = MsiEvaluateCondition(hpkg, "0 < 1");
1028 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1030 r = MsiEvaluateCondition(hpkg, "0 ~< 1");
1031 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1033 r = MsiEvaluateCondition(hpkg, "1 < 1");
1034 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1036 r = MsiEvaluateCondition(hpkg, "1 ~< 1");
1037 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1039 r = MsiEvaluateCondition(hpkg, "0 <= 1");
1040 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1042 r = MsiEvaluateCondition(hpkg, "0 ~<= 1");
1043 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1045 r = MsiEvaluateCondition(hpkg, "1 <= 1");
1046 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1048 r = MsiEvaluateCondition(hpkg, "1 ~<= 1");
1049 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1051 r = MsiEvaluateCondition(hpkg, "0 >=");
1052 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1054 r = MsiEvaluateCondition(hpkg, " ");
1055 ok( r == MSICONDITION_NONE, "wrong return val\n");
1057 r = MsiEvaluateCondition(hpkg, "LicView <> \"1\"");
1058 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1060 r = MsiEvaluateCondition(hpkg, "LicView <> \"0\"");
1061 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1063 r = MsiEvaluateCondition(hpkg, "LicView <> LicView");
1064 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1066 r = MsiEvaluateCondition(hpkg, "not 0");
1067 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1069 r = MsiEvaluateCondition(hpkg, "not LicView");
1070 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1072 r = MsiEvaluateCondition(hpkg, "not \"A\"");
1073 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1075 r = MsiEvaluateCondition(hpkg, "~not \"A\"");
1076 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1078 r = MsiEvaluateCondition(hpkg, "\"0\"");
1079 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1081 r = MsiEvaluateCondition(hpkg, "1 and 2");
1082 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1084 r = MsiEvaluateCondition(hpkg, "not 0 and 3");
1085 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1087 r = MsiEvaluateCondition(hpkg, "not 0 and 0");
1088 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1090 r = MsiEvaluateCondition(hpkg, "not 0 or 1");
1091 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1093 r = MsiEvaluateCondition(hpkg, "(0)");
1094 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1096 r = MsiEvaluateCondition(hpkg, "(((((1))))))");
1097 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1099 r = MsiEvaluateCondition(hpkg, "(((((1)))))");
1100 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1102 r = MsiEvaluateCondition(hpkg, " \"A\" < \"B\" ");
1103 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1105 r = MsiEvaluateCondition(hpkg, " \"A\" > \"B\" ");
1106 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1108 r = MsiEvaluateCondition(hpkg, " \"1\" > \"12\" ");
1109 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1111 r = MsiEvaluateCondition(hpkg, " \"100\" < \"21\" ");
1112 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1114 r = MsiEvaluateCondition(hpkg, "0 < > 0");
1115 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1117 r = MsiEvaluateCondition(hpkg, "(1<<1) == 2");
1118 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1120 r = MsiEvaluateCondition(hpkg, " \"A\" = \"a\" ");
1121 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1123 r = MsiEvaluateCondition(hpkg, " \"A\" ~ = \"a\" ");
1124 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1126 r = MsiEvaluateCondition(hpkg, " \"A\" ~= \"a\" ");
1127 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1129 r = MsiEvaluateCondition(hpkg, " \"A\" ~= 1 ");
1130 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1132 r = MsiEvaluateCondition(hpkg, " \"A\" = 1 ");
1133 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1135 r = MsiEvaluateCondition(hpkg, " 1 ~= 1 ");
1136 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1138 r = MsiEvaluateCondition(hpkg, " 1 ~= \"1\" ");
1139 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1141 r = MsiEvaluateCondition(hpkg, " 1 = \"1\" ");
1142 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1144 r = MsiEvaluateCondition(hpkg, " 0 = \"1\" ");
1145 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1147 r = MsiEvaluateCondition(hpkg, " 0 < \"100\" ");
1148 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1150 r = MsiEvaluateCondition(hpkg, " 100 > \"0\" ");
1151 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1153 r = MsiEvaluateCondition(hpkg, "1 XOR 1");
1154 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1156 r = MsiEvaluateCondition(hpkg, "1 IMP 1");
1157 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1159 r = MsiEvaluateCondition(hpkg, "1 IMP 0");
1160 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1162 r = MsiEvaluateCondition(hpkg, "0 IMP 0");
1163 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1165 r = MsiEvaluateCondition(hpkg, "0 EQV 0");
1166 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1168 r = MsiEvaluateCondition(hpkg, "0 EQV 1");
1169 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1171 r = MsiEvaluateCondition(hpkg, "1 IMP 1 OR 0");
1172 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1174 r = MsiEvaluateCondition(hpkg, "1 IMPL 1");
1175 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1177 r = MsiEvaluateCondition(hpkg, "\"ASFD\" >< \"S\" ");
1178 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1180 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"s\" ");
1181 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1183 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"\" ");
1184 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1186 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"sss\" ");
1187 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1189 MsiSetProperty(hpkg, "mm", "5" );
1191 r = MsiEvaluateCondition(hpkg, "mm = 5");
1192 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1194 r = MsiEvaluateCondition(hpkg, "mm < 6");
1195 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1197 r = MsiEvaluateCondition(hpkg, "mm <= 5");
1198 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1200 r = MsiEvaluateCondition(hpkg, "mm > 4");
1201 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1203 r = MsiEvaluateCondition(hpkg, "mm < 12");
1204 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1206 r = MsiEvaluateCondition(hpkg, "mm = \"5\"");
1207 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1209 r = MsiEvaluateCondition(hpkg, "0 = \"\"");
1210 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1212 r = MsiEvaluateCondition(hpkg, "0 AND \"\"");
1213 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1215 r = MsiEvaluateCondition(hpkg, "1 AND \"\"");
1216 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1218 r = MsiEvaluateCondition(hpkg, "1 AND \"1\"");
1219 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1221 r = MsiEvaluateCondition(hpkg, "3 >< 1");
1222 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1224 r = MsiEvaluateCondition(hpkg, "3 >< 4");
1225 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1227 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 0");
1228 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1230 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1");
1231 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1233 r = MsiEvaluateCondition(hpkg, "NOT 1 OR 0");
1234 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1236 r = MsiEvaluateCondition(hpkg, "0 AND 1 OR 1");
1237 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1239 r = MsiEvaluateCondition(hpkg, "0 AND 0 OR 1");
1240 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1242 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1 OR 0");
1243 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1245 r = MsiEvaluateCondition(hpkg, "_1 = _1");
1246 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1248 r = MsiEvaluateCondition(hpkg, "( 1 AND 1 ) = 2");
1249 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1251 r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
1252 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1254 r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1255 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1257 r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
1258 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1260 r = MsiEvaluateCondition(hpkg, "NOT 1 AND 0");
1261 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1263 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1264 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1266 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1267 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1269 r = MsiEvaluateCondition(hpkg, "bandalmael<0");
1270 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1272 r = MsiEvaluateCondition(hpkg, "bandalmael>0");
1273 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1275 r = MsiEvaluateCondition(hpkg, "bandalmael>=0");
1276 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1278 r = MsiEvaluateCondition(hpkg, "bandalmael<=0");
1279 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1281 r = MsiEvaluateCondition(hpkg, "bandalmael~<>0");
1282 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1284 MsiSetProperty(hpkg, "bandalmael", "0" );
1285 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1286 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1288 MsiSetProperty(hpkg, "bandalmael", "" );
1289 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1290 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1292 MsiSetProperty(hpkg, "bandalmael", "asdf" );
1293 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1294 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1296 MsiSetProperty(hpkg, "bandalmael", "0asdf" );
1297 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1298 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1300 MsiSetProperty(hpkg, "bandalmael", "0 " );
1301 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1302 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1304 MsiSetProperty(hpkg, "bandalmael", "-0" );
1305 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1306 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1308 MsiSetProperty(hpkg, "bandalmael", "0000000000000" );
1309 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1310 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1312 MsiSetProperty(hpkg, "bandalmael", "--0" );
1313 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1314 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1316 MsiSetProperty(hpkg, "bandalmael", "0x00" );
1317 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1318 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1320 MsiSetProperty(hpkg, "bandalmael", "-" );
1321 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1322 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1324 MsiSetProperty(hpkg, "bandalmael", "+0" );
1325 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1326 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1328 MsiSetProperty(hpkg, "bandalmael", "0.0" );
1329 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1330 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1331 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1332 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1334 MsiSetProperty(hpkg, "one", "hi");
1335 MsiSetProperty(hpkg, "two", "hithere");
1336 r = MsiEvaluateCondition(hpkg, "one >< two");
1337 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1339 MsiSetProperty(hpkg, "one", "hithere");
1340 MsiSetProperty(hpkg, "two", "hi");
1341 r = MsiEvaluateCondition(hpkg, "one >< two");
1342 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1344 MsiSetProperty(hpkg, "one", "hello");
1345 MsiSetProperty(hpkg, "two", "hi");
1346 r = MsiEvaluateCondition(hpkg, "one >< two");
1347 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1349 MsiSetProperty(hpkg, "one", "hellohithere");
1350 MsiSetProperty(hpkg, "two", "hi");
1351 r = MsiEvaluateCondition(hpkg, "one >< two");
1352 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1354 MsiSetProperty(hpkg, "one", "");
1355 MsiSetProperty(hpkg, "two", "hi");
1356 r = MsiEvaluateCondition(hpkg, "one >< two");
1357 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1359 MsiSetProperty(hpkg, "one", "hi");
1360 MsiSetProperty(hpkg, "two", "");
1361 r = MsiEvaluateCondition(hpkg, "one >< two");
1362 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1364 MsiSetProperty(hpkg, "one", "");
1365 MsiSetProperty(hpkg, "two", "");
1366 r = MsiEvaluateCondition(hpkg, "one >< two");
1367 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1369 MsiSetProperty(hpkg, "one", "1234");
1370 MsiSetProperty(hpkg, "two", "1");
1371 r = MsiEvaluateCondition(hpkg, "one >< two");
1372 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1374 MsiSetProperty(hpkg, "one", "one 1234");
1375 MsiSetProperty(hpkg, "two", "1");
1376 r = MsiEvaluateCondition(hpkg, "one >< two");
1377 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1379 MsiSetProperty(hpkg, "one", "hithere");
1380 MsiSetProperty(hpkg, "two", "hi");
1381 r = MsiEvaluateCondition(hpkg, "one << two");
1382 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1384 MsiSetProperty(hpkg, "one", "hi");
1385 MsiSetProperty(hpkg, "two", "hithere");
1386 r = MsiEvaluateCondition(hpkg, "one << two");
1387 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1389 MsiSetProperty(hpkg, "one", "hi");
1390 MsiSetProperty(hpkg, "two", "hi");
1391 r = MsiEvaluateCondition(hpkg, "one << two");
1392 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1394 MsiSetProperty(hpkg, "one", "abcdhithere");
1395 MsiSetProperty(hpkg, "two", "hi");
1396 r = MsiEvaluateCondition(hpkg, "one << two");
1397 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1399 MsiSetProperty(hpkg, "one", "");
1400 MsiSetProperty(hpkg, "two", "hi");
1401 r = MsiEvaluateCondition(hpkg, "one << two");
1402 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1404 MsiSetProperty(hpkg, "one", "hithere");
1405 MsiSetProperty(hpkg, "two", "");
1406 r = MsiEvaluateCondition(hpkg, "one << two");
1407 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1409 MsiSetProperty(hpkg, "one", "");
1410 MsiSetProperty(hpkg, "two", "");
1411 r = MsiEvaluateCondition(hpkg, "one << two");
1412 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1414 MsiSetProperty(hpkg, "one", "1234");
1415 MsiSetProperty(hpkg, "two", "1");
1416 r = MsiEvaluateCondition(hpkg, "one << two");
1417 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1419 MsiSetProperty(hpkg, "one", "1234 one");
1420 MsiSetProperty(hpkg, "two", "1");
1421 r = MsiEvaluateCondition(hpkg, "one << two");
1422 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1424 MsiSetProperty(hpkg, "one", "hithere");
1425 MsiSetProperty(hpkg, "two", "there");
1426 r = MsiEvaluateCondition(hpkg, "one >> two");
1427 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1429 MsiSetProperty(hpkg, "one", "hithere");
1430 MsiSetProperty(hpkg, "two", "hi");
1431 r = MsiEvaluateCondition(hpkg, "one >> two");
1432 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1434 MsiSetProperty(hpkg, "one", "there");
1435 MsiSetProperty(hpkg, "two", "hithere");
1436 r = MsiEvaluateCondition(hpkg, "one >> two");
1437 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1439 MsiSetProperty(hpkg, "one", "there");
1440 MsiSetProperty(hpkg, "two", "there");
1441 r = MsiEvaluateCondition(hpkg, "one >> two");
1442 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1444 MsiSetProperty(hpkg, "one", "abcdhithere");
1445 MsiSetProperty(hpkg, "two", "hi");
1446 r = MsiEvaluateCondition(hpkg, "one >> two");
1447 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1449 MsiSetProperty(hpkg, "one", "");
1450 MsiSetProperty(hpkg, "two", "there");
1451 r = MsiEvaluateCondition(hpkg, "one >> two");
1452 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1454 MsiSetProperty(hpkg, "one", "there");
1455 MsiSetProperty(hpkg, "two", "");
1456 r = MsiEvaluateCondition(hpkg, "one >> two");
1457 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1459 MsiSetProperty(hpkg, "one", "");
1460 MsiSetProperty(hpkg, "two", "");
1461 r = MsiEvaluateCondition(hpkg, "one >> two");
1462 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1464 MsiSetProperty(hpkg, "one", "1234");
1465 MsiSetProperty(hpkg, "two", "4");
1466 r = MsiEvaluateCondition(hpkg, "one >> two");
1467 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1469 MsiSetProperty(hpkg, "one", "one 1234");
1470 MsiSetProperty(hpkg, "two", "4");
1471 r = MsiEvaluateCondition(hpkg, "one >> two");
1472 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1474 MsiSetProperty(hpkg, "MsiNetAssemblySupport", NULL); /* make sure it's empty */
1476 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1477 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1479 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport > \"1.1.4322\"");
1480 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1482 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport >= \"1.1.4322\"");
1483 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1485 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <= \"1.1.4322\"");
1486 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1488 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <> \"1.1.4322\"");
1489 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1491 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1492 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1494 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"abcd\"");
1495 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1497 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a1.1.4322\"");
1498 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1500 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322a\"");
1501 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1503 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1504 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1506 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1507 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1509 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1510 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1512 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1");
1513 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1515 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1\"");
1516 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1518 r = MsiEvaluateCondition(hpkg, "\"2\" < \"12.1\"");
1519 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1521 r = MsiEvaluateCondition(hpkg, "\"02.1\" < \"2.11\"");
1522 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1524 r = MsiEvaluateCondition(hpkg, "\"02.1.1\" < \"2.1\"");
1525 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1527 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1528 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1530 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1531 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1533 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0\"");
1534 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1536 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"-1\"");
1537 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1539 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a\"");
1540 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1542 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1543 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1545 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1546 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1548 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"/\"");
1549 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1551 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \" \"");
1552 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1554 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"azAZ_\"");
1555 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1557 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]\"");
1558 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1560 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]a\"");
1561 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1563 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]\"");
1564 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1566 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]a\"");
1567 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1569 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a}\"");
1570 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1572 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a\"");
1573 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1575 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a\"");
1576 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1578 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a{\"");
1579 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1581 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a]\"");
1582 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1584 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"A\"");
1585 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1587 MsiSetProperty(hpkg, "MsiNetAssemblySupport", "1.1.4322");
1588 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1589 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1591 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.14322\"");
1592 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1594 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.5\"");
1595 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1597 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1598 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1600 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1601 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1603 MsiSetProperty(hpkg, "one", "1");
1604 r = MsiEvaluateCondition(hpkg, "one < \"1\"");
1605 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1607 MsiSetProperty(hpkg, "X", "5.0");
1609 r = MsiEvaluateCondition(hpkg, "X != \"\"");
1610 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1612 r = MsiEvaluateCondition(hpkg, "X =\"5.0\"");
1613 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1615 r = MsiEvaluateCondition(hpkg, "X =\"5.1\"");
1616 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1618 r = MsiEvaluateCondition(hpkg, "X =\"6.0\"");
1619 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1621 r = MsiEvaluateCondition(hpkg, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1622 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1624 r = MsiEvaluateCondition(hpkg, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1625 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1627 r = MsiEvaluateCondition(hpkg, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1628 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1630 /* feature doesn't exist */
1631 r = MsiEvaluateCondition(hpkg, "&nofeature");
1632 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1634 MsiSetProperty(hpkg, "A", "2");
1635 MsiSetProperty(hpkg, "X", "50");
1637 r = MsiEvaluateCondition(hpkg, "2 <= X");
1638 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1640 r = MsiEvaluateCondition(hpkg, "A <= X");
1641 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1643 r = MsiEvaluateCondition(hpkg, "A <= 50");
1644 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1646 MsiSetProperty(hpkg, "X", "50val");
1648 r = MsiEvaluateCondition(hpkg, "2 <= X");
1649 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1651 r = MsiEvaluateCondition(hpkg, "A <= X");
1652 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1654 MsiSetProperty(hpkg, "A", "7");
1655 MsiSetProperty(hpkg, "X", "50");
1657 r = MsiEvaluateCondition(hpkg, "7 <= X");
1658 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1660 r = MsiEvaluateCondition(hpkg, "A <= X");
1661 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1663 r = MsiEvaluateCondition(hpkg, "A <= 50");
1664 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1666 MsiSetProperty(hpkg, "X", "50val");
1668 r = MsiEvaluateCondition(hpkg, "2 <= X");
1669 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1671 r = MsiEvaluateCondition(hpkg, "A <= X");
1672 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1674 MsiCloseHandle( hpkg );
1675 DeleteFile(msifile);
1678 static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop)
1686 r = MsiGetProperty( hpkg, prop, buffer, &sz );
1687 return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
1690 static void test_props(void)
1692 MSIHANDLE hpkg, hdb;
1697 hdb = create_package_db();
1699 "CREATE TABLE `Property` ( "
1700 "`Property` CHAR(255) NOT NULL, "
1701 "`Value` CHAR(255) "
1702 "PRIMARY KEY `Property`)" );
1703 ok( r == ERROR_SUCCESS , "Failed\n" );
1706 "INSERT INTO `Property` "
1707 "(`Property`, `Value`) "
1708 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1709 ok( r == ERROR_SUCCESS , "Failed\n" );
1711 hpkg = package_from_db( hdb );
1712 ok( hpkg, "failed to create package\n");
1714 /* test invalid values */
1715 r = MsiGetProperty( 0, NULL, NULL, NULL );
1716 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1718 r = MsiGetProperty( hpkg, NULL, NULL, NULL );
1719 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1721 r = MsiGetProperty( hpkg, "boo", NULL, NULL );
1722 ok( r == ERROR_SUCCESS, "wrong return val\n");
1724 r = MsiGetProperty( hpkg, "boo", buffer, NULL );
1725 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1727 /* test retrieving an empty/nonexistent property */
1729 r = MsiGetProperty( hpkg, "boo", NULL, &sz );
1730 ok( r == ERROR_SUCCESS, "wrong return val\n");
1731 ok( sz == 0, "wrong size returned\n");
1733 check_prop_empty( hpkg, "boo");
1736 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1737 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1738 ok( !strcmp(buffer,"x"), "buffer was changed\n");
1739 ok( sz == 0, "wrong size returned\n");
1743 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1744 ok( r == ERROR_SUCCESS, "wrong return val\n");
1745 ok( buffer[0] == 0, "buffer was not changed\n");
1746 ok( sz == 0, "wrong size returned\n");
1748 /* set the property to something */
1749 r = MsiSetProperty( 0, NULL, NULL );
1750 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1752 r = MsiSetProperty( hpkg, NULL, NULL );
1753 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1755 r = MsiSetProperty( hpkg, "", NULL );
1756 ok( r == ERROR_SUCCESS, "wrong return val\n");
1758 /* try set and get some illegal property identifiers */
1759 r = MsiSetProperty( hpkg, "", "asdf" );
1760 ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n");
1762 r = MsiSetProperty( hpkg, "=", "asdf" );
1763 ok( r == ERROR_SUCCESS, "wrong return val\n");
1765 r = MsiSetProperty( hpkg, " ", "asdf" );
1766 ok( r == ERROR_SUCCESS, "wrong return val\n");
1768 r = MsiSetProperty( hpkg, "'", "asdf" );
1769 ok( r == ERROR_SUCCESS, "wrong return val\n");
1773 r = MsiGetProperty( hpkg, "'", buffer, &sz );
1774 ok( r == ERROR_SUCCESS, "wrong return val\n");
1775 ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
1777 /* set empty values */
1778 r = MsiSetProperty( hpkg, "boo", NULL );
1779 ok( r == ERROR_SUCCESS, "wrong return val\n");
1780 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1782 r = MsiSetProperty( hpkg, "boo", "" );
1783 ok( r == ERROR_SUCCESS, "wrong return val\n");
1784 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1786 /* set a non-empty value */
1787 r = MsiSetProperty( hpkg, "boo", "xyz" );
1788 ok( r == ERROR_SUCCESS, "wrong return val\n");
1792 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1793 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1794 ok( buffer[0] == 0, "buffer was not changed\n");
1795 ok( sz == 3, "wrong size returned\n");
1799 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1800 ok( r == ERROR_SUCCESS, "wrong return val\n");
1801 ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
1802 ok( sz == 3, "wrong size returned\n");
1806 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1807 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1808 ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
1809 ok( sz == 3, "wrong size returned\n");
1811 r = MsiSetProperty(hpkg, "SourceDir", "foo");
1812 ok( r == ERROR_SUCCESS, "wrong return val\n");
1815 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
1816 ok( r == ERROR_SUCCESS, "wrong return val\n");
1817 ok( !strcmp(buffer,""), "buffer wrong\n");
1818 ok( sz == 0, "wrong size returned\n");
1821 r = MsiGetProperty(hpkg, "SOMERANDOMNAME", buffer, &sz);
1822 ok( r == ERROR_SUCCESS, "wrong return val\n");
1823 ok( !strcmp(buffer,""), "buffer wrong\n");
1824 ok( sz == 0, "wrong size returned\n");
1827 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
1828 ok( r == ERROR_SUCCESS, "wrong return val\n");
1829 ok( !strcmp(buffer,"foo"), "buffer wrong\n");
1830 ok( sz == 3, "wrong size returned\n");
1832 r = MsiSetProperty(hpkg, "MetadataCompName", "Photoshop.dll");
1833 ok( r == ERROR_SUCCESS, "wrong return val\n");
1836 r = MsiGetProperty(hpkg, "MetadataCompName", NULL, &sz );
1837 ok( r == ERROR_SUCCESS, "return wrong\n");
1838 ok( sz == 13, "size wrong (%d)\n", sz);
1841 r = MsiGetProperty(hpkg, "MetadataCompName", buffer, &sz );
1842 ok( r == ERROR_MORE_DATA, "return wrong\n");
1843 ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n");
1845 r = MsiSetProperty(hpkg, "property", "value");
1846 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1849 r = MsiGetProperty(hpkg, "property", buffer, &sz);
1850 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1851 ok( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer);
1853 r = MsiSetProperty(hpkg, "property", NULL);
1854 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1857 r = MsiGetProperty(hpkg, "property", buffer, &sz);
1858 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1859 ok( !strlen(buffer), "Expected empty string, got %s\n", buffer);
1861 MsiCloseHandle( hpkg );
1862 DeleteFile(msifile);
1865 static BOOL find_prop_in_property(MSIHANDLE hdb, LPCSTR prop, LPCSTR val)
1867 MSIHANDLE hview, hrec;
1869 CHAR buffer[MAX_PATH];
1873 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
1874 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
1875 r = MsiViewExecute(hview, 0);
1876 ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
1879 while (r == ERROR_SUCCESS && !found)
1881 r = MsiViewFetch(hview, &hrec);
1882 if (r != ERROR_SUCCESS) break;
1885 r = MsiRecordGetString(hrec, 1, buffer, &sz);
1886 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
1889 r = MsiRecordGetString(hrec, 2, buffer, &sz);
1890 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, val))
1894 MsiCloseHandle(hrec);
1897 MsiViewClose(hview);
1898 MsiCloseHandle(hview);
1903 static void test_property_table(void)
1907 MSIHANDLE hpkg, hdb, hrec;
1908 char buffer[MAX_PATH];
1912 hdb = create_package_db();
1913 ok( hdb, "failed to create package\n");
1915 hpkg = package_from_db(hdb);
1916 ok( hpkg, "failed to create package\n");
1918 MsiCloseHandle(hdb);
1920 hdb = MsiGetActiveDatabase(hpkg);
1922 query = "CREATE TABLE `_Property` ( "
1923 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1924 r = run_query(hdb, query);
1925 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
1927 MsiCloseHandle(hdb);
1928 MsiCloseHandle(hpkg);
1929 DeleteFile(msifile);
1931 hdb = create_package_db();
1932 ok( hdb, "failed to create package\n");
1934 query = "CREATE TABLE `_Property` ( "
1935 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1936 r = run_query(hdb, query);
1937 ok(r == ERROR_SUCCESS, "failed to create table\n");
1939 query = "ALTER `_Property` ADD `foo` INTEGER";
1940 r = run_query(hdb, query);
1941 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
1943 query = "ALTER TABLE `_Property` ADD `foo` INTEGER";
1944 r = run_query(hdb, query);
1945 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
1947 query = "ALTER TABLE `_Property` ADD `extra` INTEGER";
1948 r = run_query(hdb, query);
1949 ok(r == ERROR_SUCCESS, "failed to add column\n");
1951 hpkg = package_from_db(hdb);
1954 ok(!hpkg, "package should not be created\n");
1957 MsiCloseHandle(hdb);
1958 MsiCloseHandle(hpkg);
1959 DeleteFile(msifile);
1961 hdb = create_package_db();
1962 ok (hdb, "failed to create package database\n");
1964 r = create_property_table(hdb);
1965 ok(r == ERROR_SUCCESS, "cannot create Property table: %d\n", r);
1967 r = add_property_entry(hdb, "'prop', 'val'");
1968 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
1970 hpkg = package_from_db(hdb);
1971 ok(hpkg, "failed to create package\n");
1973 MsiCloseHandle(hdb);
1976 r = MsiGetProperty(hpkg, "prop", buffer, &sz);
1977 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1978 ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
1980 hdb = MsiGetActiveDatabase(hpkg);
1982 found = find_prop_in_property(hdb, "prop", "val");
1983 ok(found, "prop should be in the _Property table\n");
1985 r = add_property_entry(hdb, "'dantes', 'mercedes'");
1986 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
1988 query = "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
1989 r = do_query(hdb, query, &hrec);
1990 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
1992 found = find_prop_in_property(hdb, "dantes", "mercedes");
1993 ok(found == FALSE, "dantes should not be in the _Property table\n");
1996 lstrcpy(buffer, "aaa");
1997 r = MsiGetProperty(hpkg, "dantes", buffer, &sz);
1998 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1999 ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer);
2001 r = MsiSetProperty(hpkg, "dantes", "mercedes");
2002 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2004 found = find_prop_in_property(hdb, "dantes", "mercedes");
2005 ok(found == TRUE, "dantes should be in the _Property table\n");
2007 MsiCloseHandle(hdb);
2008 MsiCloseHandle(hpkg);
2009 DeleteFile(msifile);
2012 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
2017 res = MsiDatabaseOpenView( hdb, szQuery, &htab );
2018 if( res == ERROR_SUCCESS )
2022 r = MsiViewExecute( htab, hrec );
2023 if( r != ERROR_SUCCESS )
2026 fprintf(stderr,"MsiViewExecute failed %08x\n", res);
2029 r = MsiViewClose( htab );
2030 if( r != ERROR_SUCCESS )
2033 r = MsiCloseHandle( htab );
2034 if( r != ERROR_SUCCESS )
2040 static UINT try_query( MSIHANDLE hdb, LPCSTR szQuery )
2042 return try_query_param( hdb, szQuery, 0 );
2045 static void set_summary_str(MSIHANDLE hdb, DWORD pid, LPCSTR value)
2050 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2051 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2053 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
2054 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2056 r = MsiSummaryInfoPersist(summary);
2057 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2059 MsiCloseHandle(summary);
2062 static void set_summary_dword(MSIHANDLE hdb, DWORD pid, DWORD value)
2067 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2068 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2070 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_I4, value, NULL, NULL);
2071 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2073 r = MsiSummaryInfoPersist(summary);
2074 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2076 MsiCloseHandle(summary);
2079 static void test_msipackage(void)
2081 MSIHANDLE hdb = 0, hpack = 100;
2086 /* NULL szPackagePath */
2087 r = MsiOpenPackage(NULL, &hpack);
2088 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2090 /* empty szPackagePath */
2091 r = MsiOpenPackage("", &hpack);
2094 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2097 if (r == ERROR_SUCCESS)
2098 MsiCloseHandle(hpack);
2100 /* nonexistent szPackagePath */
2101 r = MsiOpenPackage("nonexistent", &hpack);
2102 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2105 r = MsiOpenPackage(msifile, NULL);
2106 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2110 r = MsiOpenPackage(name, &hpack);
2111 ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r);
2113 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2114 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2116 /* database exists, but is emtpy */
2117 sprintf(name, "#%ld", hdb);
2118 r = MsiOpenPackage(name, &hpack);
2119 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2120 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2122 query = "CREATE TABLE `Property` ( "
2123 "`Property` CHAR(72), `Value` CHAR(0) "
2124 "PRIMARY KEY `Property`)";
2125 r = try_query(hdb, query);
2126 ok(r == ERROR_SUCCESS, "failed to create Properties table\n");
2128 query = "CREATE TABLE `InstallExecuteSequence` ("
2129 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2130 "PRIMARY KEY `Action`)";
2131 r = try_query(hdb, query);
2132 ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n");
2134 /* a few key tables exist */
2135 sprintf(name, "#%ld", hdb);
2136 r = MsiOpenPackage(name, &hpack);
2137 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2138 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2140 MsiCloseHandle(hdb);
2141 DeleteFile(msifile);
2143 /* start with a clean database to show what constitutes a valid package */
2144 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2145 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2147 sprintf(name, "#%ld", hdb);
2149 /* The following summary information props must exist:
2154 set_summary_dword(hdb, PID_PAGECOUNT, 100);
2155 r = MsiOpenPackage(name, &hpack);
2156 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2157 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2159 set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2160 r = MsiOpenPackage(name, &hpack);
2161 ok(r == ERROR_SUCCESS,
2162 "Expected ERROR_SUCCESS, got %d\n", r);
2164 MsiCloseHandle(hpack);
2165 MsiCloseHandle(hdb);
2166 DeleteFile(msifile);
2169 static void test_formatrecord2(void)
2171 MSIHANDLE hpkg, hrec ;
2176 hpkg = package_from_db(create_package_db());
2177 ok( hpkg, "failed to create package\n");
2179 r = MsiSetProperty(hpkg, "Manufacturer", " " );
2180 ok( r == ERROR_SUCCESS, "set property failed\n");
2182 hrec = MsiCreateRecord(2);
2183 ok(hrec, "create record failed\n");
2185 r = MsiRecordSetString( hrec, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2186 ok( r == ERROR_SUCCESS, "format record failed\n");
2190 r = MsiFormatRecord( hpkg, hrec, buffer, &sz );
2192 r = MsiRecordSetString(hrec, 0, "[foo][1]");
2193 r = MsiRecordSetString(hrec, 1, "hoo");
2195 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2196 ok( sz == 3, "size wrong\n");
2197 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2198 ok( r == ERROR_SUCCESS, "format failed\n");
2200 r = MsiRecordSetString(hrec, 0, "x[~]x");
2202 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2203 ok( sz == 3, "size wrong\n");
2204 ok( 0 == strcmp(buffer,"x"), "wrong output %s\n",buffer);
2205 ok( r == ERROR_SUCCESS, "format failed\n");
2207 r = MsiRecordSetString(hrec, 0, "[foo.$%}][1]");
2208 r = MsiRecordSetString(hrec, 1, "hoo");
2210 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2211 ok( sz == 3, "size wrong\n");
2212 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2213 ok( r == ERROR_SUCCESS, "format failed\n");
2215 r = MsiRecordSetString(hrec, 0, "[\\[]");
2217 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2218 ok( sz == 1, "size wrong\n");
2219 ok( 0 == strcmp(buffer,"["), "wrong output %s\n",buffer);
2220 ok( r == ERROR_SUCCESS, "format failed\n");
2222 SetEnvironmentVariable("FOO", "BAR");
2223 r = MsiRecordSetString(hrec, 0, "[%FOO]");
2225 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2226 ok( sz == 3, "size wrong\n");
2227 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2228 ok( r == ERROR_SUCCESS, "format failed\n");
2230 r = MsiRecordSetString(hrec, 0, "[[1]]");
2231 r = MsiRecordSetString(hrec, 1, "%FOO");
2233 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2234 ok( sz == 3, "size wrong\n");
2235 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2236 ok( r == ERROR_SUCCESS, "format failed\n");
2238 MsiCloseHandle( hrec );
2239 MsiCloseHandle( hpkg );
2240 DeleteFile(msifile);
2243 /* FIXME: state is INSTALLSTATE_UNKNOWN if any features are removed and the
2244 * feature in question is not in ADD*
2246 static void test_states(void)
2251 INSTALLSTATE state, action;
2253 hdb = create_package_db();
2254 ok ( hdb, "failed to create package database\n" );
2256 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
2257 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
2259 r = create_property_table( hdb );
2260 ok( r == ERROR_SUCCESS, "cannot create Property table: %d\n", r );
2262 r = add_property_entry( hdb, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2263 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2265 r = add_property_entry( hdb, "'ProductLanguage', '1033'" );
2266 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2268 r = add_property_entry( hdb, "'ProductName', 'MSITEST'" );
2269 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2271 r = add_property_entry( hdb, "'ProductVersion', '1.1.1'" );
2272 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2274 r = create_install_execute_sequence_table( hdb );
2275 ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table: %d\n", r );
2277 r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
2278 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2280 r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
2281 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2283 r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
2284 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2286 r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" );
2287 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2289 r = add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" );
2290 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2292 r = add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" );
2293 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2295 r = add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" );
2296 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2298 r = add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" );
2299 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2301 r = add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" );
2302 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2304 r = add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" );
2305 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2307 r = add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" );
2308 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2310 r = create_media_table( hdb );
2311 ok( r == ERROR_SUCCESS, "cannot create media table: %d\n", r );
2313 r = add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''");
2314 ok( r == ERROR_SUCCESS, "cannot add media entry: %d\n", r );
2316 r = create_feature_table( hdb );
2317 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
2319 r = create_component_table( hdb );
2320 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
2322 /* msidbFeatureAttributesFavorLocal */
2323 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
2324 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2326 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2327 r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2328 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2330 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2331 r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2332 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2334 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2335 r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2336 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2338 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2339 r = add_component_entry( hdb, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2340 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2342 /* msidbFeatureAttributesFavorSource */
2343 r = add_feature_entry( hdb, "'two', '', '', '', 2, 1, '', 1" );
2344 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2346 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2347 r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2348 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2350 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2351 r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2352 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2354 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2355 r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2356 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2358 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2359 r = add_component_entry( hdb, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2360 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2362 /* msidbFeatureAttributesFavorSource */
2363 r = add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" );
2364 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2366 /* msidbFeatureAttributesFavorLocal */
2367 r = add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" );
2368 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2371 r = add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" );
2372 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2374 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2375 r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2376 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2378 /* no feature parent:msidbComponentAttributesLocalOnly */
2379 r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2380 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2382 /* msidbFeatureAttributesFavorLocal:removed */
2383 r = add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" );
2384 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2386 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2387 r = add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2388 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2390 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2391 r = add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2392 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2394 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2395 r = add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2396 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2398 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2399 r = add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2400 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2402 /* msidbFeatureAttributesFavorSource:removed */
2403 r = add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" );
2404 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2406 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2407 r = add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2408 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2410 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2411 r = add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2412 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2414 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2415 r = add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2416 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2418 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2419 r = add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2420 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2422 r = create_feature_components_table( hdb );
2423 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
2425 r = add_feature_components_entry( hdb, "'one', 'alpha'" );
2426 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2428 r = add_feature_components_entry( hdb, "'one', 'beta'" );
2429 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2431 r = add_feature_components_entry( hdb, "'one', 'gamma'" );
2432 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2434 r = add_feature_components_entry( hdb, "'one', 'theta'" );
2435 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2437 r = add_feature_components_entry( hdb, "'two', 'delta'" );
2438 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2440 r = add_feature_components_entry( hdb, "'two', 'epsilon'" );
2441 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2443 r = add_feature_components_entry( hdb, "'two', 'zeta'" );
2444 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2446 r = add_feature_components_entry( hdb, "'two', 'iota'" );
2447 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2449 r = add_feature_components_entry( hdb, "'three', 'eta'" );
2450 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2452 r = add_feature_components_entry( hdb, "'four', 'eta'" );
2453 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2455 r = add_feature_components_entry( hdb, "'five', 'eta'" );
2456 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2458 r = add_feature_components_entry( hdb, "'six', 'lambda'" );
2459 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2461 r = add_feature_components_entry( hdb, "'six', 'mu'" );
2462 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2464 r = add_feature_components_entry( hdb, "'six', 'nu'" );
2465 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2467 r = add_feature_components_entry( hdb, "'six', 'xi'" );
2468 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2470 r = add_feature_components_entry( hdb, "'seven', 'omicron'" );
2471 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2473 r = add_feature_components_entry( hdb, "'seven', 'pi'" );
2474 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2476 r = add_feature_components_entry( hdb, "'seven', 'rho'" );
2477 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2479 r = add_feature_components_entry( hdb, "'seven', 'sigma'" );
2480 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2482 r = create_file_table( hdb );
2483 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
2485 r = add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2486 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2488 r = add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2489 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2491 r = add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2492 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2494 r = add_file_entry( hdb, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2495 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2497 r = add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2498 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2500 r = add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2501 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2503 r = add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2504 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2506 r = add_file_entry( hdb, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2507 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2509 /* compressed file */
2510 r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2511 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2513 r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2514 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2516 r = add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2517 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2519 r = add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2520 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2522 r = add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2523 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2525 r = add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2526 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2528 r = add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2529 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2531 r = add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2532 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2534 r = add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2535 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2537 r = add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2538 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2540 MsiDatabaseCommit(hdb);
2542 /* these properties must not be in the saved msi file */
2543 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
2544 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2546 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
2547 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2549 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
2550 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2552 hpkg = package_from_db( hdb );
2553 ok( hpkg, "failed to create package\n");
2555 MsiCloseHandle(hdb);
2559 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2560 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2561 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2562 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2566 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2567 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2568 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2569 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2573 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2574 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2575 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2576 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2580 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2581 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2582 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2583 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2587 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2588 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2589 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2590 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2594 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2595 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2596 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2597 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2601 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2602 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2603 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2604 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2608 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2609 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2610 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2611 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2615 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2616 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2617 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2618 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2622 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2623 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2624 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2625 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2629 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2630 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2631 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2632 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2636 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2637 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2638 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2639 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2643 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2644 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2645 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2646 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2650 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2651 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2652 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2653 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2657 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2658 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2659 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2660 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2664 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2665 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2666 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2667 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2671 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2672 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2673 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2674 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2678 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2679 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2680 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2681 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2685 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2686 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2687 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2688 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2692 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2693 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2694 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2695 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2699 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2700 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2701 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2702 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2706 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
2707 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2708 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2709 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2713 r = MsiGetComponentState(hpkg, "pi", &state, &action);
2714 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2715 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2716 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2720 r = MsiGetComponentState(hpkg, "rho", &state, &action);
2721 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2722 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2723 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2727 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
2728 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2729 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2730 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2732 r = MsiDoAction( hpkg, "CostInitialize");
2733 ok( r == ERROR_SUCCESS, "cost init failed\n");
2737 r = MsiGetFeatureState(hpkg, "one", &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 = MsiGetFeatureState(hpkg, "two", &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 = MsiGetFeatureState(hpkg, "three", &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 = MsiGetFeatureState(hpkg, "four", &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 = MsiGetFeatureState(hpkg, "five", &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 = MsiGetFeatureState(hpkg, "six", &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 = MsiGetFeatureState(hpkg, "seven", &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, "alpha", &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, "beta", &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, "gamma", &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, "theta", &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, "delta", &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, "epsilon", &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, "zeta", &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);
2835 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2836 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2837 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2838 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2842 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2843 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2844 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2845 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2849 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2850 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2851 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2852 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2856 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2857 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2858 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2859 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2863 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2864 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2865 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2866 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2870 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2871 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2872 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2873 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2877 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2878 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2879 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2880 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2884 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
2885 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2886 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2887 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2891 r = MsiGetComponentState(hpkg, "pi", &state, &action);
2892 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2893 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2894 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2898 r = MsiGetComponentState(hpkg, "rho", &state, &action);
2899 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2900 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2901 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2905 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
2906 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2907 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2908 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2910 r = MsiDoAction( hpkg, "FileCost");
2911 ok( r == ERROR_SUCCESS, "file cost failed\n");
2915 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2916 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2917 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2918 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2922 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2923 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2924 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2925 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2929 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2930 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2931 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2932 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2936 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2937 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2938 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2939 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2943 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2944 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2945 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2946 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2950 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2951 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2952 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2953 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2957 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2958 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2959 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2960 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2964 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2965 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2966 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2967 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2971 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2972 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2973 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2974 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2978 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2979 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2980 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2981 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2985 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2986 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2987 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2988 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2992 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2993 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2994 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2995 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2999 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3000 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3001 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3002 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3006 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3007 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3008 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3009 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3013 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3014 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3015 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3016 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3020 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3021 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3022 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3023 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3027 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3028 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3029 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3030 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3034 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3035 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3036 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3037 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3041 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3042 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3043 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3044 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3048 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3049 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3050 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3051 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3055 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3056 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3057 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3058 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3062 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3063 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3064 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3065 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3069 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3070 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3071 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3072 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3076 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3077 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3078 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3079 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3083 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3084 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3085 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3086 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3088 r = MsiDoAction( hpkg, "CostFinalize");
3089 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3093 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3094 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3095 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3096 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3100 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3101 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3102 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3103 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3107 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3108 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3109 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3110 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3114 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3115 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3116 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3117 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3121 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3122 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3123 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3124 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3128 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3129 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3130 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3133 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3138 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3139 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3140 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3143 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3148 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3149 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3150 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3151 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3155 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3156 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3157 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3158 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3162 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3163 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3164 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3165 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3169 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3170 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3171 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3172 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3176 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3177 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3178 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3179 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3183 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3184 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3185 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3186 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3190 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3191 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3192 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3193 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3197 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3198 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3199 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3200 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3204 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3205 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3206 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3207 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3211 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3212 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3213 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3214 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3218 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3219 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3220 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3223 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3228 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3229 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3230 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3233 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3238 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3239 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3240 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3243 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3248 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3249 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3250 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3253 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3258 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3259 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3260 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3263 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3268 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3269 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3270 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3273 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3278 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3279 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3280 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3283 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3288 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3289 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3290 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3293 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3296 MsiCloseHandle( hpkg );
3298 /* publish the features and components */
3299 r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven");
3300 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3302 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
3303 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
3305 /* these properties must not be in the saved msi file */
3306 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
3307 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3309 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
3310 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3312 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
3313 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3315 hpkg = package_from_db( hdb );
3316 ok( hpkg, "failed to create package\n");
3318 MsiCloseHandle(hdb);
3322 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3323 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3324 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3325 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3329 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3330 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3331 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3332 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3336 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3337 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3338 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3339 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3343 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3344 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3345 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3346 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3350 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3351 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3352 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3353 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3357 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3358 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3359 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3360 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3364 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3365 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3366 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3367 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3371 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3372 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3373 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3374 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3378 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3379 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3380 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3381 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3385 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3386 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3387 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3388 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3392 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3393 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3394 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3395 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3399 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3400 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3401 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3402 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3406 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3407 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3408 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3409 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3413 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3414 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3415 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3416 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3420 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3421 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3422 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3423 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3427 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3428 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3429 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3430 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3434 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3435 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3436 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3437 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3441 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3442 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3443 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3444 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3448 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3449 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3450 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3451 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3455 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3456 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3457 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3458 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3462 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3463 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3464 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3465 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3469 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3470 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3471 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3472 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3476 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3477 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3478 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3479 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3483 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3484 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3485 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3486 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3490 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3491 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3492 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3493 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3495 r = MsiDoAction( hpkg, "CostInitialize");
3496 ok( r == ERROR_SUCCESS, "cost init failed\n");
3500 r = MsiGetFeatureState(hpkg, "one", &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 = MsiGetFeatureState(hpkg, "two", &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 = MsiGetFeatureState(hpkg, "three", &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 = MsiGetFeatureState(hpkg, "four", &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 = MsiGetFeatureState(hpkg, "five", &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 = MsiGetFeatureState(hpkg, "six", &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 = MsiGetFeatureState(hpkg, "seven", &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, "alpha", &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, "beta", &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, "gamma", &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, "theta", &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, "delta", &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, "epsilon", &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, "zeta", &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);
3598 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3599 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3600 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3601 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3605 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3606 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3607 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3608 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3612 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3613 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3614 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3615 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3619 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3620 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3621 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3622 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3626 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3627 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3628 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3629 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3633 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3634 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3635 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3636 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3640 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3641 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3642 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3643 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3647 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3648 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3649 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3650 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3654 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3655 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3656 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3657 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3661 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3662 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3663 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3664 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3668 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3669 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3670 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3671 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3673 r = MsiDoAction( hpkg, "FileCost");
3674 ok( r == ERROR_SUCCESS, "file cost failed\n");
3678 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3679 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3680 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3681 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3685 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3686 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3687 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3688 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3692 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3693 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3694 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3695 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3699 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3700 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3701 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3702 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3706 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3707 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3708 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3709 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3713 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3714 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3715 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3716 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3720 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3721 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3722 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3723 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3727 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3728 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3729 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3730 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3734 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3735 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3736 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3737 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3741 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3742 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3743 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3744 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3748 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3749 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3750 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3751 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3755 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3756 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3757 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3758 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3762 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3763 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3764 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3765 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3769 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3770 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3771 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3772 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3776 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3777 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3778 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3779 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3783 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3784 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3785 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3786 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3790 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3791 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3792 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3793 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3797 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3798 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3799 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3800 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3804 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3805 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3806 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3807 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3811 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3812 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3813 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3814 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3818 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3819 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3820 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3821 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3825 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3826 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3827 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3828 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3832 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3833 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3834 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3835 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3839 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3840 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3841 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3842 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3846 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3847 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3848 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3849 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3851 r = MsiDoAction( hpkg, "CostFinalize");
3852 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3856 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3857 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3860 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3862 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3866 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3867 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3870 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3872 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3876 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3877 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3880 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3882 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3886 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3887 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3890 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3892 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3896 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3897 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3898 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3899 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3903 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3904 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3905 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3908 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3913 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3914 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3915 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3918 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3923 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3924 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3927 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3929 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3933 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3934 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3937 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3939 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3943 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3944 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3947 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3949 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3953 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3954 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3957 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3959 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3963 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3964 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3967 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3969 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3973 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3974 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3977 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3978 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3983 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3984 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3987 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3988 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3993 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3994 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3997 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3999 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4003 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4004 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4007 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4009 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4013 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4014 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4015 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4016 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4020 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4021 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4022 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4025 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4030 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4031 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4032 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4035 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4040 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4041 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4042 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4045 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4050 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4051 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4052 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4055 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4060 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4061 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4062 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4065 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4070 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4071 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4072 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4075 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4080 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4081 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4082 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4085 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4090 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4091 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4092 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4095 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4098 MsiCloseHandle(hpkg);
4100 /* uninstall the product */
4101 r = MsiInstallProduct(msifile, "REMOVE=ALL");
4102 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4104 DeleteFileA(msifile);
4107 static void test_getproperty(void)
4109 MSIHANDLE hPackage = 0;
4111 static CHAR empty[] = "";
4115 hPackage = package_from_db(create_package_db());
4116 ok( hPackage != 0, " Failed to create package\n");
4118 /* set the property */
4119 r = MsiSetProperty(hPackage, "Name", "Value");
4120 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4122 /* retrieve the size, NULL pointer */
4124 r = MsiGetProperty(hPackage, "Name", NULL, &size);
4125 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4126 ok( size == 5, "Expected 5, got %d\n", size);
4128 /* retrieve the size, empty string */
4130 r = MsiGetProperty(hPackage, "Name", empty, &size);
4131 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
4132 ok( size == 5, "Expected 5, got %d\n", size);
4134 /* don't change size */
4135 r = MsiGetProperty(hPackage, "Name", prop, &size);
4136 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
4137 ok( size == 5, "Expected 5, got %d\n", size);
4138 ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
4140 /* increase the size by 1 */
4142 r = MsiGetProperty(hPackage, "Name", prop, &size);
4143 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4144 ok( size == 5, "Expected 5, got %d\n", size);
4145 ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
4147 r = MsiCloseHandle( hPackage);
4148 ok( r == ERROR_SUCCESS , "Failed to close package\n" );
4149 DeleteFile(msifile);
4152 static void test_removefiles(void)
4158 hdb = create_package_db();
4159 ok ( hdb, "failed to create package database\n" );
4161 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
4162 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4164 r = create_feature_table( hdb );
4165 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
4167 r = create_component_table( hdb );
4168 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
4170 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
4171 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4173 r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
4174 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4176 r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
4177 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4179 r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
4180 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4182 r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
4183 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4185 r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
4186 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4188 r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
4189 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4191 r = create_feature_components_table( hdb );
4192 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
4194 r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
4195 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4197 r = add_feature_components_entry( hdb, "'one', 'helium'" );
4198 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4200 r = add_feature_components_entry( hdb, "'one', 'lithium'" );
4201 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4203 r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
4204 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4206 r = add_feature_components_entry( hdb, "'one', 'boron'" );
4207 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4209 r = add_feature_components_entry( hdb, "'one', 'carbon'" );
4210 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4212 r = create_file_table( hdb );
4213 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
4215 r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
4216 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4218 r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
4219 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4221 r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
4222 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4224 r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
4225 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4227 r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
4228 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4230 r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
4231 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4233 r = create_remove_file_table( hdb );
4234 ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
4236 hpkg = package_from_db( hdb );
4237 ok( hpkg, "failed to create package\n");
4239 MsiCloseHandle( hdb );
4241 create_test_file( "hydrogen.txt" );
4242 create_test_file( "helium.txt" );
4243 create_test_file( "lithium.txt" );
4244 create_test_file( "beryllium.txt" );
4245 create_test_file( "boron.txt" );
4246 create_test_file( "carbon.txt" );
4248 r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
4249 ok( r == ERROR_SUCCESS, "set property failed\n");
4251 r = MsiDoAction( hpkg, "CostInitialize");
4252 ok( r == ERROR_SUCCESS, "cost init failed\n");
4254 r = MsiDoAction( hpkg, "FileCost");
4255 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4257 r = MsiDoAction( hpkg, "CostFinalize");
4258 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4260 r = MsiDoAction( hpkg, "InstallValidate");
4261 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4263 r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
4264 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4266 r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
4267 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4269 r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
4270 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4272 r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
4273 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4275 r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
4276 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4278 r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
4279 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4281 r = MsiDoAction( hpkg, "RemoveFiles");
4282 ok( r == ERROR_SUCCESS, "remove files failed\n");
4284 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
4285 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
4286 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
4287 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
4288 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
4289 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
4291 MsiCloseHandle( hpkg );
4292 DeleteFileA(msifile);
4295 static void test_appsearch(void)
4300 CHAR prop[MAX_PATH];
4301 DWORD size = MAX_PATH;
4303 hdb = create_package_db();
4304 ok ( hdb, "failed to create package database\n" );
4306 r = create_appsearch_table( hdb );
4307 ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
4309 r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
4310 ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
4312 r = create_reglocator_table( hdb );
4313 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
4315 r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
4316 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
4318 r = create_signature_table( hdb );
4319 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
4321 r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
4322 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
4324 hpkg = package_from_db( hdb );
4325 ok( hpkg, "failed to create package\n");
4327 MsiCloseHandle( hdb );
4329 r = MsiDoAction( hpkg, "AppSearch" );
4330 ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
4332 r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
4333 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4334 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
4336 MsiCloseHandle( hpkg );
4337 DeleteFileA(msifile);
4340 static void test_featureparents(void)
4345 INSTALLSTATE state, action;
4347 hdb = create_package_db();
4348 ok ( hdb, "failed to create package database\n" );
4350 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
4351 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4353 r = create_feature_table( hdb );
4354 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
4356 r = create_component_table( hdb );
4357 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
4359 r = create_feature_components_table( hdb );
4360 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
4362 r = create_file_table( hdb );
4363 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
4365 /* msidbFeatureAttributesFavorLocal */
4366 r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
4367 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4369 /* msidbFeatureAttributesFavorSource */
4370 r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
4371 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4373 /* msidbFeatureAttributesFavorLocal */
4374 r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
4375 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4377 /* disabled because of install level */
4378 r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
4379 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4381 /* child feature of disabled feature */
4382 r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
4383 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4385 /* component of disabled feature (install level) */
4386 r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
4387 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4389 /* component of disabled child feature (install level) */
4390 r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
4391 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4393 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
4394 r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
4395 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4397 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
4398 r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
4399 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4401 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
4402 r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
4403 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4405 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
4406 r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
4407 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4409 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
4410 r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
4411 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4413 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
4414 r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
4415 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4417 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
4418 r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
4419 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4421 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
4422 r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
4423 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4425 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
4426 r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
4428 r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
4429 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4431 r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
4432 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4434 r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
4435 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4437 r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
4438 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4440 r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
4441 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4443 r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
4444 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4446 r = add_feature_components_entry( hdb, "'orion', 'leo'" );
4447 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4449 r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
4450 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4452 r = add_feature_components_entry( hdb, "'orion', 'libra'" );
4453 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4455 r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
4456 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4458 r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
4459 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4461 r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
4462 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4464 r = add_feature_components_entry( hdb, "'orion', 'canis'" );
4465 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4467 r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
4468 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4470 r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
4471 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4473 r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
4474 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4476 r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
4477 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4479 r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
4480 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4482 r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
4483 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4485 r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
4486 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4488 r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
4489 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4491 r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
4492 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4494 r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
4495 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4497 r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
4498 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4500 r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
4501 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4503 r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
4504 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4506 r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
4507 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4509 r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
4510 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4512 hpkg = package_from_db( hdb );
4513 ok( hpkg, "failed to create package\n");
4515 MsiCloseHandle( hdb );
4517 r = MsiDoAction( hpkg, "CostInitialize");
4518 ok( r == ERROR_SUCCESS, "cost init failed\n");
4520 r = MsiDoAction( hpkg, "FileCost");
4521 ok( r == ERROR_SUCCESS, "file cost failed\n");
4523 r = MsiDoAction( hpkg, "CostFinalize");
4524 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4528 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
4529 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4530 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4531 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4535 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
4536 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4537 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4538 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4542 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
4543 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4544 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4545 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4549 r = MsiGetFeatureState(hpkg, "waters", &state, &action);
4550 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4551 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4552 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4556 r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
4557 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4558 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4559 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4563 r = MsiGetComponentState(hpkg, "leo", &state, &action);
4564 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4565 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4566 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4570 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
4571 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4572 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
4573 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
4577 r = MsiGetComponentState(hpkg, "libra", &state, &action);
4578 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4579 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
4580 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
4584 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
4585 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4586 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
4587 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
4591 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
4592 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4593 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
4594 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
4598 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
4599 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4600 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
4601 ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
4605 r = MsiGetComponentState(hpkg, "canis", &state, &action);
4606 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4607 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
4608 ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
4612 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
4613 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4614 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
4615 ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
4619 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
4620 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4621 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
4622 ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
4626 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
4627 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4628 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
4629 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
4633 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
4634 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4635 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
4636 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
4638 r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
4639 ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
4643 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
4644 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4645 ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
4646 ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
4650 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
4651 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4652 ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
4653 ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
4657 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
4658 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4659 ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
4660 ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
4664 r = MsiGetComponentState(hpkg, "leo", &state, &action);
4665 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4666 ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
4667 ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
4671 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
4672 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4673 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
4674 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
4678 r = MsiGetComponentState(hpkg, "libra", &state, &action);
4679 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4680 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
4681 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
4685 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
4686 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4687 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
4688 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
4692 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
4693 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4694 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
4695 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
4699 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
4700 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4701 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
4702 ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
4706 r = MsiGetComponentState(hpkg, "canis", &state, &action);
4707 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4708 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
4709 ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
4713 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
4714 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4715 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
4716 ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
4720 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
4721 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4722 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
4723 ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
4727 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
4728 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4729 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
4730 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
4734 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
4735 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4736 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
4737 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
4739 MsiCloseHandle(hpkg);
4740 DeleteFileA(msifile);
4743 static void test_installprops(void)
4745 MSIHANDLE hpkg, hdb;
4746 CHAR path[MAX_PATH];
4754 GetCurrentDirectory(MAX_PATH, path);
4755 lstrcat(path, "\\");
4756 lstrcat(path, msifile);
4758 hdb = create_package_db();
4759 ok( hdb, "failed to create database\n");
4761 hpkg = package_from_db(hdb);
4762 ok( hpkg, "failed to create package\n");
4764 MsiCloseHandle(hdb);
4767 r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
4768 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4769 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
4771 RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
4773 RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2);
4778 if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
4782 RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
4785 /* win9x doesn't set this */
4789 r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
4790 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4791 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
4797 if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
4801 RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
4807 r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
4808 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4809 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
4813 r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
4814 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4815 trace("VersionDatabase = %s\n", buf);
4818 r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
4819 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4820 trace("VersionMsi = %s\n", buf);
4823 r = MsiGetProperty(hpkg, "Date", buf, &size);
4824 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4825 trace("Date = %s\n", buf);
4828 r = MsiGetProperty(hpkg, "Time", buf, &size);
4829 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4830 trace("Time = %s\n", buf);
4833 r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
4834 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4835 trace("PackageCode = %s\n", buf);
4837 langid = GetUserDefaultLangID();
4838 sprintf(path, "%d", langid);
4841 r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
4842 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
4843 ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
4845 res = GetSystemMetrics(SM_CXSCREEN);
4847 r = MsiGetProperty(hpkg, "ScreenX", buf, &size);
4848 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
4850 res = GetSystemMetrics(SM_CYSCREEN);
4852 r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
4853 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
4857 MsiCloseHandle(hpkg);
4858 DeleteFile(msifile);
4861 static void test_sourcedirprop(void)
4863 MSIHANDLE hpkg, hdb;
4864 CHAR source_dir[MAX_PATH];
4865 CHAR path[MAX_PATH];
4869 hdb = create_package_db();
4870 ok ( hdb, "failed to create package database\n" );
4872 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
4873 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4875 hpkg = package_from_db( hdb );
4876 ok( hpkg, "failed to create package\n");
4878 MsiCloseHandle( hdb );
4881 r = MsiGetProperty( hpkg, "SourceDir", source_dir, &size );
4882 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4883 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4886 r = MsiGetProperty( hpkg, "SOURCEDIR", source_dir, &size );
4887 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4888 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4890 r = MsiDoAction( hpkg, "CostInitialize");
4891 ok( r == ERROR_SUCCESS, "cost init failed\n");
4894 r = MsiGetProperty( hpkg, "SourceDir", source_dir, &size );
4895 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4896 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4899 r = MsiGetProperty( hpkg, "SOURCEDIR", source_dir, &size );
4900 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4901 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4903 r = MsiDoAction( hpkg, "ResolveSource");
4904 ok( r == ERROR_SUCCESS, "file cost failed\n");
4906 GetCurrentDirectory(MAX_PATH, path);
4907 lstrcatA(path, "\\");
4910 r = MsiGetProperty( hpkg, "SourceDir", source_dir, &size );
4911 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4912 ok( !lstrcmpA(source_dir, path), "Expected %s, got %s\n", path, source_dir);
4915 r = MsiGetProperty( hpkg, "SOURCEDIR", source_dir, &size );
4916 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4917 ok( !lstrcmpA(source_dir, path), "Expected %s, got %s\n", path, source_dir);
4920 r = MsiGetProperty( hpkg, "SoUrCeDiR", source_dir, &size );
4921 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4922 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4924 MsiCloseHandle(hpkg);
4925 DeleteFileA(msifile);
4928 static void test_prop_path(void)
4930 MSIHANDLE hpkg, hdb;
4931 char buffer[MAX_PATH], cwd[MAX_PATH];
4935 GetCurrentDirectory(MAX_PATH, cwd);
4938 hdb = create_package_db();
4939 ok( hdb, "failed to create database\n");
4941 r = add_directory_entry( hdb, "'TARGETDIR','','SourceDir'" );
4942 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4944 r = add_directory_entry( hdb, "'foo','TARGETDIR','foosrc:footgt'" );
4945 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4947 hpkg = package_from_db(hdb);
4948 ok( hpkg, "failed to create package\n");
4950 r = MsiGetSourcePath(hpkg, "SourceDir", buffer, &sz );
4951 ok( r == ERROR_DIRECTORY, "failed to get source path\n");
4953 r = MsiGetSourcePath(hpkg, "SOURCEDIR", buffer, &sz );
4954 ok( r == ERROR_DIRECTORY, "failed to get source path\n");
4956 r = MsiDoAction( hpkg, "CostInitialize");
4957 ok( r == ERROR_SUCCESS, "cost init failed\n");
4961 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
4962 ok( r == ERROR_SUCCESS, "property not set\n");
4963 ok( !buffer[0], "SourceDir should be empty\n");
4967 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
4968 ok( r == ERROR_SUCCESS, "property not set\n");
4969 ok( !buffer[0], "SourceDir should be empty\n");
4973 r = MsiGetSourcePath(hpkg, "SourceDir", buffer, &sz );
4974 ok( r == ERROR_SUCCESS, "failed to get source path\n");
4975 ok( !lstrcmpi(cwd, buffer), "SourceDir (%s) should be current dir (%s)\n", buffer, cwd);
4979 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
4980 ok( r == ERROR_SUCCESS, "property not set\n");
4982 ok( !lstrcmpi(cwd, buffer), "SourceDir (%s) should be current dir (%s)\n", buffer, cwd);
4987 r = MsiGetSourcePath(hpkg, "SOURCEDIR", buffer, &sz );
4988 ok( r == ERROR_DIRECTORY, "failed to get source path\n");
4992 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
4993 ok( r == ERROR_SUCCESS, "property not set\n");
4995 ok( !lstrcmpi(cwd, buffer), "SourceDir (%s) should be current dir (%s)\n", buffer, cwd);
4998 r = MsiSetProperty(hpkg, "SourceDir", "goo");
4999 ok( r == ERROR_SUCCESS, "property not set\n");
5003 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
5004 ok( r == ERROR_SUCCESS, "property not set\n");
5005 ok( !lstrcmpi(buffer, "goo"), "SourceDir (%s) should be goo\n", buffer);
5009 r = MsiGetSourcePath(hpkg, "SourceDir", buffer, &sz );
5010 ok( r == ERROR_SUCCESS, "failed to get source path\n");
5011 ok( !lstrcmpi(buffer, cwd), "SourceDir (%s) should be goo\n", buffer);
5015 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
5016 ok( r == ERROR_SUCCESS, "property not set\n");
5017 ok( !lstrcmpi(buffer, "goo"), "SourceDir (%s) should be goo\n", buffer);
5019 MsiCloseHandle( hpkg );
5020 DeleteFile(msifile);
5023 static void test_launchconditions(void)
5029 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5031 hdb = create_package_db();
5032 ok( hdb, "failed to create package database\n" );
5034 r = create_launchcondition_table( hdb );
5035 ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
5037 r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
5038 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
5040 /* invalid condition */
5041 r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
5042 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
5044 hpkg = package_from_db( hdb );
5045 ok( hpkg, "failed to create package\n");
5047 MsiCloseHandle( hdb );
5049 r = MsiSetProperty( hpkg, "X", "1" );
5050 ok( r == ERROR_SUCCESS, "failed to set property\n" );
5052 /* invalid conditions are ignored */
5053 r = MsiDoAction( hpkg, "LaunchConditions" );
5054 ok( r == ERROR_SUCCESS, "cost init failed\n" );
5056 /* verify LaunchConditions still does some verification */
5057 r = MsiSetProperty( hpkg, "X", "2" );
5058 ok( r == ERROR_SUCCESS, "failed to set property\n" );
5060 r = MsiDoAction( hpkg, "LaunchConditions" );
5061 ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
5063 MsiCloseHandle( hpkg );
5064 DeleteFile( msifile );
5067 static void test_ccpsearch(void)
5069 MSIHANDLE hdb, hpkg;
5070 CHAR prop[MAX_PATH];
5071 DWORD size = MAX_PATH;
5074 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5076 hdb = create_package_db();
5077 ok(hdb, "failed to create package database\n");
5079 r = create_ccpsearch_table(hdb);
5080 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5082 r = add_ccpsearch_entry(hdb, "'CCP_random'");
5083 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5085 r = add_ccpsearch_entry(hdb, "'RMCCP_random'");
5086 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5088 r = create_reglocator_table(hdb);
5089 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5091 r = add_reglocator_entry(hdb, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
5092 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5094 r = create_drlocator_table(hdb);
5095 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5097 r = add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
5098 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5100 r = create_signature_table(hdb);
5101 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5103 hpkg = package_from_db(hdb);
5104 ok(hpkg, "failed to create package\n");
5106 MsiCloseHandle(hdb);
5108 r = MsiDoAction(hpkg, "CCPSearch");
5109 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5111 r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
5112 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5113 ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
5115 MsiCloseHandle(hpkg);
5116 DeleteFileA(msifile);
5119 static BOOL squash_guid(LPCWSTR in, LPWSTR out)
5124 if (FAILED(CLSIDFromString((LPOLESTR)in, &guid)))
5131 out[11-i] = in[n++];
5134 out[15-i] = in[n++];
5138 out[17+i*2] = in[n++];
5139 out[16+i*2] = in[n++];
5144 out[17+i*2] = in[n++];
5145 out[16+i*2] = in[n++];
5151 static void set_component_path(LPCSTR filename, LPCSTR guid)
5153 WCHAR guidW[MAX_PATH];
5154 WCHAR squashedW[MAX_PATH];
5155 CHAR squashed[MAX_PATH];
5156 CHAR substr[MAX_PATH];
5157 CHAR path[MAX_PATH];
5160 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
5161 squash_guid(guidW, squashedW);
5162 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
5164 lstrcpyA(substr, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
5165 "Installer\\UserData\\S-1-5-18\\Components\\");
5166 lstrcatA(substr, squashed);
5168 RegCreateKeyA(HKEY_LOCAL_MACHINE, substr, &hkey);
5170 lstrcpyA(path, CURR_DIR);
5171 lstrcatA(path, "\\");
5172 lstrcatA(path, filename);
5174 /* just using a random squashed product code */
5175 RegSetValueExA(hkey, "7D2F387510109040002000060BECB6AB", 0,
5176 REG_SZ, (LPBYTE)path, lstrlenA(path));
5180 lstrcpyA(substr, "SOFTWARE\\Classes\\Installer\\Products\\7D2F387510109040002000060BECB6AB");
5181 RegCreateKeyA(HKEY_LOCAL_MACHINE, substr, &hkey);
5184 static void delete_component_path(LPCSTR guid)
5186 WCHAR guidW[MAX_PATH];
5187 WCHAR squashedW[MAX_PATH];
5188 WCHAR substrW[MAX_PATH];
5189 CHAR squashed[MAX_PATH];
5190 CHAR substr[MAX_PATH];
5192 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
5193 squash_guid(guidW, squashedW);
5194 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
5196 lstrcpyA(substr, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
5197 "Installer\\UserData\\S-1-5-18\\Components\\");
5198 lstrcatA(substr, squashed);
5200 MultiByteToWideChar(CP_ACP, 0, substr, -1, substrW, MAX_PATH);
5201 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW);
5203 lstrcpyA(substr, "SOFTWARE\\Classes\\Installer\\Products\\7D2F387510109040002000060BECB6AB");
5204 MultiByteToWideChar(CP_ACP, 0, substr, -1, substrW, MAX_PATH);
5205 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW);
5208 static void test_complocator(void)
5210 MSIHANDLE hdb, hpkg;
5212 CHAR prop[MAX_PATH];
5213 CHAR expected[MAX_PATH];
5214 DWORD size = MAX_PATH;
5216 hdb = create_package_db();
5217 ok(hdb, "failed to create package database\n");
5219 r = create_appsearch_table(hdb);
5220 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5222 r = add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
5223 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5225 r = add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
5226 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5228 r = add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
5229 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5231 r = add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
5232 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5234 r = add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
5235 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5237 r = add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
5238 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5240 r = add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
5241 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5243 r = add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
5244 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5246 r = add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
5247 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5249 r = add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
5250 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5252 r = add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
5253 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5255 r = add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
5256 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5258 r = add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
5259 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5261 r = add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
5262 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5264 r = add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
5265 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5267 r = add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
5268 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5270 r = create_complocator_table(hdb);
5271 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5273 r = add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
5274 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5276 r = add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
5277 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5279 r = add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
5280 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5282 r = add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
5283 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5285 r = add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
5286 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5288 r = add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
5289 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5291 r = add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
5292 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5294 r = add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
5295 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5297 r = add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
5298 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5300 r = add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
5301 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5303 r = add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
5304 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5306 r = add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
5307 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5309 r = add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
5310 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5312 r = add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
5313 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5315 r = add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
5316 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5318 r = add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
5319 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5321 r = create_signature_table(hdb);
5322 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5324 r = add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
5325 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5327 r = add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
5328 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5330 r = add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
5331 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5333 r = add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
5334 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5336 r = add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
5337 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5339 r = add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
5340 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5342 r = add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
5343 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5345 r = add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
5346 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5348 hpkg = package_from_db(hdb);
5349 ok(hpkg, "failed to create package\n");
5351 MsiCloseHandle(hdb);
5353 create_test_file("abelisaurus");
5354 create_test_file("bactrosaurus");
5355 create_test_file("camelotia");
5356 create_test_file("diclonius");
5357 create_test_file("echinodon");
5358 create_test_file("falcarius");
5359 create_test_file("gallimimus");
5360 create_test_file("hagryphus");
5361 CreateDirectoryA("iguanodon", NULL);
5362 CreateDirectoryA("jobaria", NULL);
5363 CreateDirectoryA("kakuru", NULL);
5364 CreateDirectoryA("labocania", NULL);
5365 CreateDirectoryA("megaraptor", NULL);
5366 CreateDirectoryA("neosodon", NULL);
5367 CreateDirectoryA("olorotitan", NULL);
5368 CreateDirectoryA("pantydraco", NULL);
5370 set_component_path("abelisaurus", "{E3619EED-305A-418C-B9C7-F7D7377F0934}");
5371 set_component_path("bactrosaurus", "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}");
5372 set_component_path("echinodon", "{A19E16C5-C75D-4699-8111-C4338C40C3CB}");
5373 set_component_path("falcarius", "{17762FA1-A7AE-4CC6-8827-62873C35361D}");
5374 set_component_path("iguanodon", "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}");
5375 set_component_path("jobaria", "{243C22B1-8C51-4151-B9D1-1AE5265E079E}");
5376 set_component_path("megaraptor", "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}");
5377 set_component_path("neosodon", "{0B499649-197A-48EF-93D2-AF1C17ED6E90}");
5379 r = MsiDoAction(hpkg, "AppSearch");
5380 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5383 r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
5384 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5386 lstrcpyA(expected, CURR_DIR);
5387 lstrcatA(expected, "\\abelisaurus");
5388 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
5389 "Expected %s or empty string, got %s\n", expected, prop);
5392 r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
5393 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5394 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5397 r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
5398 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5399 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5402 r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
5403 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5404 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5407 r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
5408 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5410 lstrcpyA(expected, CURR_DIR);
5411 lstrcatA(expected, "\\");
5412 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
5413 "Expected %s or empty string, got %s\n", expected, prop);
5416 r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
5417 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5418 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5421 r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
5422 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5423 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5426 r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
5427 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5428 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5431 r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
5432 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5433 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5436 r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
5437 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5438 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5441 r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
5442 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5443 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5446 r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
5447 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5448 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5451 r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
5452 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5454 lstrcpyA(expected, CURR_DIR);
5455 lstrcatA(expected, "\\");
5456 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
5457 "Expected %s or empty string, got %s\n", expected, prop);
5460 r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
5461 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5463 lstrcpyA(expected, CURR_DIR);
5464 lstrcatA(expected, "\\neosodon\\");
5465 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
5466 "Expected %s or empty string, got %s\n", expected, prop);
5469 r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
5470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5471 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5474 r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
5475 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5476 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5478 MsiCloseHandle(hpkg);
5479 DeleteFileA("abelisaurus");
5480 DeleteFileA("bactrosaurus");
5481 DeleteFileA("camelotia");
5482 DeleteFileA("diclonius");
5483 DeleteFileA("echinodon");
5484 DeleteFileA("falcarius");
5485 DeleteFileA("gallimimus");
5486 DeleteFileA("hagryphus");
5487 RemoveDirectoryA("iguanodon");
5488 RemoveDirectoryA("jobaria");
5489 RemoveDirectoryA("kakuru");
5490 RemoveDirectoryA("labocania");
5491 RemoveDirectoryA("megaraptor");
5492 RemoveDirectoryA("neosodon");
5493 RemoveDirectoryA("olorotitan");
5494 RemoveDirectoryA("pantydraco");
5495 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}");
5496 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}");
5497 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}");
5498 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}");
5499 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}");
5500 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}");
5501 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}");
5502 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}");
5503 DeleteFileA(msifile);
5508 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
5510 test_createpackage();
5511 test_getsourcepath_bad();
5512 test_getsourcepath();
5514 test_gettargetpath_bad();
5515 test_settargetpath();
5517 test_property_table();
5520 test_formatrecord2();
5525 test_featureparents();
5526 test_installprops();
5527 test_sourcedirprop();
5529 test_launchconditions();