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 summmary 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
, "MsiSetTargetPath on file returned %d\n", r
);
927 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", tempdir
);
928 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath on 'subdir' of file returned %d\n", r
);
930 DeleteFile( buffer
);
932 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", buffer
);
933 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath returned %d\n", r
);
935 r
= GetFileAttributes( buffer
);
936 ok ( r
== INVALID_FILE_ATTRIBUTES
, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r
);
938 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", tempdir
);
939 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath on subsubdir returned %d\n", r
);
941 sz
= sizeof buffer
- 1;
942 lstrcat( tempdir
, "\\" );
943 r
= MsiGetTargetPath( hpkg
, "TARGETDIR", buffer
, &sz
);
944 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
945 ok( !lstrcmp(buffer
, tempdir
), "Expected %s, got %s\n", tempdir
, buffer
);
947 sprintf( file
, "%srootfile.txt", tempdir
);
948 query_file_path( hpkg
, "[#RootFile]", buffer
);
949 ok( !lstrcmp(buffer
, file
), "Expected %s, got %s\n", file
, buffer
);
951 r
= MsiSetTargetPath( hpkg
, "TestParent", "C:\\one\\two" );
952 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath returned %d\n", r
);
954 query_file_path( hpkg
, "[#TestFile]", buffer
);
955 ok( !lstrcmp(buffer
, "C:\\one\\two\\TestDir\\testfile.txt"),
956 "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer
);
958 sz
= sizeof buffer
- 1;
959 r
= MsiGetTargetPath( hpkg
, "TestParent", buffer
, &sz
);
960 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
961 ok( !lstrcmp(buffer
, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer
);
963 MsiCloseHandle( hpkg
);
966 static void test_condition(void)
971 hpkg
= package_from_db(create_package_db());
972 ok( hpkg
, "failed to create package\n");
974 r
= MsiEvaluateCondition(0, NULL
);
975 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
977 r
= MsiEvaluateCondition(hpkg
, NULL
);
978 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
980 r
= MsiEvaluateCondition(hpkg
, "");
981 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
983 r
= MsiEvaluateCondition(hpkg
, "1");
984 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
986 r
= MsiEvaluateCondition(hpkg
, "0");
987 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
989 r
= MsiEvaluateCondition(hpkg
, "-1");
990 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
992 r
= MsiEvaluateCondition(hpkg
, "0 = 0");
993 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
995 r
= MsiEvaluateCondition(hpkg
, "0 <> 0");
996 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
998 r
= MsiEvaluateCondition(hpkg
, "0 = 1");
999 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1001 r
= MsiEvaluateCondition(hpkg
, "0 > 1");
1002 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1004 r
= MsiEvaluateCondition(hpkg
, "0 ~> 1");
1005 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1007 r
= MsiEvaluateCondition(hpkg
, "1 > 1");
1008 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1010 r
= MsiEvaluateCondition(hpkg
, "1 ~> 1");
1011 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1013 r
= MsiEvaluateCondition(hpkg
, "0 >= 1");
1014 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1016 r
= MsiEvaluateCondition(hpkg
, "0 ~>= 1");
1017 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1019 r
= MsiEvaluateCondition(hpkg
, "1 >= 1");
1020 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1022 r
= MsiEvaluateCondition(hpkg
, "1 ~>= 1");
1023 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1025 r
= MsiEvaluateCondition(hpkg
, "0 < 1");
1026 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1028 r
= MsiEvaluateCondition(hpkg
, "0 ~< 1");
1029 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1031 r
= MsiEvaluateCondition(hpkg
, "1 < 1");
1032 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1034 r
= MsiEvaluateCondition(hpkg
, "1 ~< 1");
1035 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1037 r
= MsiEvaluateCondition(hpkg
, "0 <= 1");
1038 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1040 r
= MsiEvaluateCondition(hpkg
, "0 ~<= 1");
1041 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1043 r
= MsiEvaluateCondition(hpkg
, "1 <= 1");
1044 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1046 r
= MsiEvaluateCondition(hpkg
, "1 ~<= 1");
1047 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1049 r
= MsiEvaluateCondition(hpkg
, "0 >=");
1050 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1052 r
= MsiEvaluateCondition(hpkg
, " ");
1053 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
1055 r
= MsiEvaluateCondition(hpkg
, "LicView <> \"1\"");
1056 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1058 r
= MsiEvaluateCondition(hpkg
, "LicView <> \"0\"");
1059 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1061 r
= MsiEvaluateCondition(hpkg
, "LicView <> LicView");
1062 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1064 r
= MsiEvaluateCondition(hpkg
, "not 0");
1065 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1067 r
= MsiEvaluateCondition(hpkg
, "not LicView");
1068 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1070 r
= MsiEvaluateCondition(hpkg
, "not \"A\"");
1071 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1073 r
= MsiEvaluateCondition(hpkg
, "~not \"A\"");
1074 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1076 r
= MsiEvaluateCondition(hpkg
, "\"0\"");
1077 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1079 r
= MsiEvaluateCondition(hpkg
, "1 and 2");
1080 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1082 r
= MsiEvaluateCondition(hpkg
, "not 0 and 3");
1083 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1085 r
= MsiEvaluateCondition(hpkg
, "not 0 and 0");
1086 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1088 r
= MsiEvaluateCondition(hpkg
, "not 0 or 1");
1089 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1091 r
= MsiEvaluateCondition(hpkg
, "(0)");
1092 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1094 r
= MsiEvaluateCondition(hpkg
, "(((((1))))))");
1095 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1097 r
= MsiEvaluateCondition(hpkg
, "(((((1)))))");
1098 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1100 r
= MsiEvaluateCondition(hpkg
, " \"A\" < \"B\" ");
1101 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1103 r
= MsiEvaluateCondition(hpkg
, " \"A\" > \"B\" ");
1104 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1106 r
= MsiEvaluateCondition(hpkg
, " \"1\" > \"12\" ");
1107 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1109 r
= MsiEvaluateCondition(hpkg
, " \"100\" < \"21\" ");
1110 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1112 r
= MsiEvaluateCondition(hpkg
, "0 < > 0");
1113 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1115 r
= MsiEvaluateCondition(hpkg
, "(1<<1) == 2");
1116 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1118 r
= MsiEvaluateCondition(hpkg
, " \"A\" = \"a\" ");
1119 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1121 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~ = \"a\" ");
1122 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1124 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~= \"a\" ");
1125 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1127 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~= 1 ");
1128 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1130 r
= MsiEvaluateCondition(hpkg
, " \"A\" = 1 ");
1131 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1133 r
= MsiEvaluateCondition(hpkg
, " 1 ~= 1 ");
1134 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1136 r
= MsiEvaluateCondition(hpkg
, " 1 ~= \"1\" ");
1137 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1139 r
= MsiEvaluateCondition(hpkg
, " 1 = \"1\" ");
1140 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1142 r
= MsiEvaluateCondition(hpkg
, " 0 = \"1\" ");
1143 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1145 r
= MsiEvaluateCondition(hpkg
, " 0 < \"100\" ");
1146 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1148 r
= MsiEvaluateCondition(hpkg
, " 100 > \"0\" ");
1149 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1151 r
= MsiEvaluateCondition(hpkg
, "1 XOR 1");
1152 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1154 r
= MsiEvaluateCondition(hpkg
, "1 IMP 1");
1155 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1157 r
= MsiEvaluateCondition(hpkg
, "1 IMP 0");
1158 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1160 r
= MsiEvaluateCondition(hpkg
, "0 IMP 0");
1161 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1163 r
= MsiEvaluateCondition(hpkg
, "0 EQV 0");
1164 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1166 r
= MsiEvaluateCondition(hpkg
, "0 EQV 1");
1167 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1169 r
= MsiEvaluateCondition(hpkg
, "1 IMP 1 OR 0");
1170 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1172 r
= MsiEvaluateCondition(hpkg
, "1 IMPL 1");
1173 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1175 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" >< \"S\" ");
1176 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1178 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"s\" ");
1179 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1181 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"\" ");
1182 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1184 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"sss\" ");
1185 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1187 MsiSetProperty(hpkg
, "mm", "5" );
1189 r
= MsiEvaluateCondition(hpkg
, "mm = 5");
1190 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1192 r
= MsiEvaluateCondition(hpkg
, "mm < 6");
1193 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1195 r
= MsiEvaluateCondition(hpkg
, "mm <= 5");
1196 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1198 r
= MsiEvaluateCondition(hpkg
, "mm > 4");
1199 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1201 r
= MsiEvaluateCondition(hpkg
, "mm < 12");
1202 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1204 r
= MsiEvaluateCondition(hpkg
, "mm = \"5\"");
1205 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1207 r
= MsiEvaluateCondition(hpkg
, "0 = \"\"");
1208 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1210 r
= MsiEvaluateCondition(hpkg
, "0 AND \"\"");
1211 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1213 r
= MsiEvaluateCondition(hpkg
, "1 AND \"\"");
1214 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1216 r
= MsiEvaluateCondition(hpkg
, "1 AND \"1\"");
1217 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1219 r
= MsiEvaluateCondition(hpkg
, "3 >< 1");
1220 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1222 r
= MsiEvaluateCondition(hpkg
, "3 >< 4");
1223 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1225 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 0");
1226 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1228 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 1");
1229 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1231 r
= MsiEvaluateCondition(hpkg
, "NOT 1 OR 0");
1232 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1234 r
= MsiEvaluateCondition(hpkg
, "0 AND 1 OR 1");
1235 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1237 r
= MsiEvaluateCondition(hpkg
, "0 AND 0 OR 1");
1238 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1240 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 1 OR 0");
1241 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1243 r
= MsiEvaluateCondition(hpkg
, "_1 = _1");
1244 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1246 r
= MsiEvaluateCondition(hpkg
, "( 1 AND 1 ) = 2");
1247 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1249 r
= MsiEvaluateCondition(hpkg
, "NOT ( 1 AND 1 )");
1250 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1252 r
= MsiEvaluateCondition(hpkg
, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1253 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1255 r
= MsiEvaluateCondition(hpkg
, "Installed<>\"\"");
1256 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1258 r
= MsiEvaluateCondition(hpkg
, "NOT 1 AND 0");
1259 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1261 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1262 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1264 r
= MsiEvaluateCondition(hpkg
, "bandalmael<>0");
1265 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1267 r
= MsiEvaluateCondition(hpkg
, "bandalmael<0");
1268 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1270 r
= MsiEvaluateCondition(hpkg
, "bandalmael>0");
1271 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1273 r
= MsiEvaluateCondition(hpkg
, "bandalmael>=0");
1274 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1276 r
= MsiEvaluateCondition(hpkg
, "bandalmael<=0");
1277 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1279 r
= MsiEvaluateCondition(hpkg
, "bandalmael~<>0");
1280 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1282 MsiSetProperty(hpkg
, "bandalmael", "0" );
1283 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1284 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1286 MsiSetProperty(hpkg
, "bandalmael", "" );
1287 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1288 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1290 MsiSetProperty(hpkg
, "bandalmael", "asdf" );
1291 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1292 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1294 MsiSetProperty(hpkg
, "bandalmael", "0asdf" );
1295 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1296 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1298 MsiSetProperty(hpkg
, "bandalmael", "0 " );
1299 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1300 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1302 MsiSetProperty(hpkg
, "bandalmael", "-0" );
1303 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1304 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1306 MsiSetProperty(hpkg
, "bandalmael", "0000000000000" );
1307 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1308 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1310 MsiSetProperty(hpkg
, "bandalmael", "--0" );
1311 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1312 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1314 MsiSetProperty(hpkg
, "bandalmael", "0x00" );
1315 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1316 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1318 MsiSetProperty(hpkg
, "bandalmael", "-" );
1319 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1320 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1322 MsiSetProperty(hpkg
, "bandalmael", "+0" );
1323 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1324 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1326 MsiSetProperty(hpkg
, "bandalmael", "0.0" );
1327 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1328 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1329 r
= MsiEvaluateCondition(hpkg
, "bandalmael<>0");
1330 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1332 MsiSetProperty(hpkg
, "one", "hi");
1333 MsiSetProperty(hpkg
, "two", "hithere");
1334 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1335 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1337 MsiSetProperty(hpkg
, "one", "hithere");
1338 MsiSetProperty(hpkg
, "two", "hi");
1339 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1340 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1342 MsiSetProperty(hpkg
, "one", "hello");
1343 MsiSetProperty(hpkg
, "two", "hi");
1344 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1345 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1347 MsiSetProperty(hpkg
, "one", "hellohithere");
1348 MsiSetProperty(hpkg
, "two", "hi");
1349 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1350 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1352 MsiSetProperty(hpkg
, "one", "");
1353 MsiSetProperty(hpkg
, "two", "hi");
1354 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1355 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1357 MsiSetProperty(hpkg
, "one", "hi");
1358 MsiSetProperty(hpkg
, "two", "");
1359 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1360 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1362 MsiSetProperty(hpkg
, "one", "");
1363 MsiSetProperty(hpkg
, "two", "");
1364 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1365 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1367 MsiSetProperty(hpkg
, "one", "1234");
1368 MsiSetProperty(hpkg
, "two", "1");
1369 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1370 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1372 MsiSetProperty(hpkg
, "one", "one 1234");
1373 MsiSetProperty(hpkg
, "two", "1");
1374 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1375 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1377 MsiSetProperty(hpkg
, "one", "hithere");
1378 MsiSetProperty(hpkg
, "two", "hi");
1379 r
= MsiEvaluateCondition(hpkg
, "one << two");
1380 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1382 MsiSetProperty(hpkg
, "one", "hi");
1383 MsiSetProperty(hpkg
, "two", "hithere");
1384 r
= MsiEvaluateCondition(hpkg
, "one << two");
1385 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1387 MsiSetProperty(hpkg
, "one", "hi");
1388 MsiSetProperty(hpkg
, "two", "hi");
1389 r
= MsiEvaluateCondition(hpkg
, "one << two");
1390 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1392 MsiSetProperty(hpkg
, "one", "abcdhithere");
1393 MsiSetProperty(hpkg
, "two", "hi");
1394 r
= MsiEvaluateCondition(hpkg
, "one << two");
1395 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1397 MsiSetProperty(hpkg
, "one", "");
1398 MsiSetProperty(hpkg
, "two", "hi");
1399 r
= MsiEvaluateCondition(hpkg
, "one << two");
1400 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1402 MsiSetProperty(hpkg
, "one", "hithere");
1403 MsiSetProperty(hpkg
, "two", "");
1404 r
= MsiEvaluateCondition(hpkg
, "one << two");
1405 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1407 MsiSetProperty(hpkg
, "one", "");
1408 MsiSetProperty(hpkg
, "two", "");
1409 r
= MsiEvaluateCondition(hpkg
, "one << two");
1410 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1412 MsiSetProperty(hpkg
, "one", "1234");
1413 MsiSetProperty(hpkg
, "two", "1");
1414 r
= MsiEvaluateCondition(hpkg
, "one << two");
1415 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1417 MsiSetProperty(hpkg
, "one", "1234 one");
1418 MsiSetProperty(hpkg
, "two", "1");
1419 r
= MsiEvaluateCondition(hpkg
, "one << two");
1420 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1422 MsiSetProperty(hpkg
, "one", "hithere");
1423 MsiSetProperty(hpkg
, "two", "there");
1424 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1425 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1427 MsiSetProperty(hpkg
, "one", "hithere");
1428 MsiSetProperty(hpkg
, "two", "hi");
1429 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1430 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1432 MsiSetProperty(hpkg
, "one", "there");
1433 MsiSetProperty(hpkg
, "two", "hithere");
1434 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1435 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1437 MsiSetProperty(hpkg
, "one", "there");
1438 MsiSetProperty(hpkg
, "two", "there");
1439 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1440 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1442 MsiSetProperty(hpkg
, "one", "abcdhithere");
1443 MsiSetProperty(hpkg
, "two", "hi");
1444 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1445 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1447 MsiSetProperty(hpkg
, "one", "");
1448 MsiSetProperty(hpkg
, "two", "there");
1449 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1450 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1452 MsiSetProperty(hpkg
, "one", "there");
1453 MsiSetProperty(hpkg
, "two", "");
1454 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1455 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1457 MsiSetProperty(hpkg
, "one", "");
1458 MsiSetProperty(hpkg
, "two", "");
1459 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1460 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1462 MsiSetProperty(hpkg
, "one", "1234");
1463 MsiSetProperty(hpkg
, "two", "4");
1464 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1465 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1467 MsiSetProperty(hpkg
, "one", "one 1234");
1468 MsiSetProperty(hpkg
, "two", "4");
1469 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1470 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1472 MsiSetProperty(hpkg
, "MsiNetAssemblySupport", NULL
); /* make sure it's empty */
1474 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322\"");
1475 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1477 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport > \"1.1.4322\"");
1478 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1480 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport >= \"1.1.4322\"");
1481 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1483 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport <= \"1.1.4322\"");
1484 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1486 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport <> \"1.1.4322\"");
1487 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1489 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1490 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1492 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"abcd\"");
1493 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1495 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a1.1.4322\"");
1496 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1498 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322a\"");
1499 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1501 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1502 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1504 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1505 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1507 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1508 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1510 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"1.1");
1511 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1513 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"1.1\"");
1514 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1516 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"12.1\"");
1517 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1519 r
= MsiEvaluateCondition(hpkg
, "\"02.1\" < \"2.11\"");
1520 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1522 r
= MsiEvaluateCondition(hpkg
, "\"02.1.1\" < \"2.1\"");
1523 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1525 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1\"");
1526 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1528 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1\"");
1529 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1531 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"0\"");
1532 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1534 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"-1\"");
1535 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1537 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a\"");
1538 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1540 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"!\"");
1541 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1543 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"!\"");
1544 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1546 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"/\"");
1547 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1549 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \" \"");
1550 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1552 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"azAZ_\"");
1553 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1555 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a[a]\"");
1556 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1558 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a[a]a\"");
1559 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1561 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a]\"");
1562 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1564 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a]a\"");
1565 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1567 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"{a}\"");
1568 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1570 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"{a\"");
1571 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1573 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a\"");
1574 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1576 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a{\"");
1577 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1579 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a]\"");
1580 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1582 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"A\"");
1583 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1585 MsiSetProperty(hpkg
, "MsiNetAssemblySupport", "1.1.4322");
1586 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322\"");
1587 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1589 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.14322\"");
1590 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1592 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.5\"");
1593 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1595 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1\"");
1596 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1598 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1\"");
1599 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1601 MsiSetProperty(hpkg
, "one", "1");
1602 r
= MsiEvaluateCondition(hpkg
, "one < \"1\"");
1603 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1605 MsiSetProperty(hpkg
, "X", "5.0");
1607 r
= MsiEvaluateCondition(hpkg
, "X != \"\"");
1608 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1610 r
= MsiEvaluateCondition(hpkg
, "X =\"5.0\"");
1611 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1613 r
= MsiEvaluateCondition(hpkg
, "X =\"5.1\"");
1614 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1616 r
= MsiEvaluateCondition(hpkg
, "X =\"6.0\"");
1617 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1619 r
= MsiEvaluateCondition(hpkg
, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1620 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1622 r
= MsiEvaluateCondition(hpkg
, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1623 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1625 r
= MsiEvaluateCondition(hpkg
, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1626 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1628 /* feature doesn't exist */
1629 r
= MsiEvaluateCondition(hpkg
, "&nofeature");
1630 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1632 MsiCloseHandle( hpkg
);
1633 DeleteFile(msifile
);
1636 static BOOL
check_prop_empty( MSIHANDLE hpkg
, const char * prop
)
1644 r
= MsiGetProperty( hpkg
, prop
, buffer
, &sz
);
1645 return r
== ERROR_SUCCESS
&& buffer
[0] == 0 && sz
== 0;
1648 static void test_props(void)
1650 MSIHANDLE hpkg
, hdb
;
1655 hdb
= create_package_db();
1657 "CREATE TABLE `Property` ( "
1658 "`Property` CHAR(255) NOT NULL, "
1659 "`Value` CHAR(255) "
1660 "PRIMARY KEY `Property`)" );
1661 ok( r
== ERROR_SUCCESS
, "Failed\n" );
1664 "INSERT INTO `Property` "
1665 "(`Property`, `Value`) "
1666 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1667 ok( r
== ERROR_SUCCESS
, "Failed\n" );
1669 hpkg
= package_from_db( hdb
);
1670 ok( hpkg
, "failed to create package\n");
1672 /* test invalid values */
1673 r
= MsiGetProperty( 0, NULL
, NULL
, NULL
);
1674 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1676 r
= MsiGetProperty( hpkg
, NULL
, NULL
, NULL
);
1677 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1679 r
= MsiGetProperty( hpkg
, "boo", NULL
, NULL
);
1680 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1682 r
= MsiGetProperty( hpkg
, "boo", buffer
, NULL
);
1683 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1685 /* test retrieving an empty/nonexistent property */
1687 r
= MsiGetProperty( hpkg
, "boo", NULL
, &sz
);
1688 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1689 ok( sz
== 0, "wrong size returned\n");
1691 check_prop_empty( hpkg
, "boo");
1694 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1695 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1696 ok( !strcmp(buffer
,"x"), "buffer was changed\n");
1697 ok( sz
== 0, "wrong size returned\n");
1701 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1702 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1703 ok( buffer
[0] == 0, "buffer was not changed\n");
1704 ok( sz
== 0, "wrong size returned\n");
1706 /* set the property to something */
1707 r
= MsiSetProperty( 0, NULL
, NULL
);
1708 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
1710 r
= MsiSetProperty( hpkg
, NULL
, NULL
);
1711 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1713 r
= MsiSetProperty( hpkg
, "", NULL
);
1714 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1716 /* try set and get some illegal property identifiers */
1717 r
= MsiSetProperty( hpkg
, "", "asdf" );
1718 ok( r
== ERROR_FUNCTION_FAILED
, "wrong return val\n");
1720 r
= MsiSetProperty( hpkg
, "=", "asdf" );
1721 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1723 r
= MsiSetProperty( hpkg
, " ", "asdf" );
1724 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1726 r
= MsiSetProperty( hpkg
, "'", "asdf" );
1727 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1731 r
= MsiGetProperty( hpkg
, "'", buffer
, &sz
);
1732 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1733 ok( !strcmp(buffer
,"asdf"), "buffer was not changed\n");
1735 /* set empty values */
1736 r
= MsiSetProperty( hpkg
, "boo", NULL
);
1737 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1738 ok( check_prop_empty( hpkg
, "boo"), "prop wasn't empty\n");
1740 r
= MsiSetProperty( hpkg
, "boo", "" );
1741 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1742 ok( check_prop_empty( hpkg
, "boo"), "prop wasn't empty\n");
1744 /* set a non-empty value */
1745 r
= MsiSetProperty( hpkg
, "boo", "xyz" );
1746 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1750 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1751 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1752 ok( buffer
[0] == 0, "buffer was not changed\n");
1753 ok( sz
== 3, "wrong size returned\n");
1757 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1758 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1759 ok( !strcmp(buffer
,"xyz"), "buffer was not changed\n");
1760 ok( sz
== 3, "wrong size returned\n");
1764 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1765 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1766 ok( !strcmp(buffer
,"xy"), "buffer was not changed\n");
1767 ok( sz
== 3, "wrong size returned\n");
1769 r
= MsiSetProperty(hpkg
, "SourceDir", "foo");
1770 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1773 r
= MsiGetProperty(hpkg
, "SOURCEDIR", buffer
, &sz
);
1774 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1775 ok( !strcmp(buffer
,""), "buffer wrong\n");
1776 ok( sz
== 0, "wrong size returned\n");
1779 r
= MsiGetProperty(hpkg
, "SOMERANDOMNAME", buffer
, &sz
);
1780 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1781 ok( !strcmp(buffer
,""), "buffer wrong\n");
1782 ok( sz
== 0, "wrong size returned\n");
1785 r
= MsiGetProperty(hpkg
, "SourceDir", buffer
, &sz
);
1786 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1787 ok( !strcmp(buffer
,"foo"), "buffer wrong\n");
1788 ok( sz
== 3, "wrong size returned\n");
1790 r
= MsiSetProperty(hpkg
, "MetadataCompName", "Photoshop.dll");
1791 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1794 r
= MsiGetProperty(hpkg
, "MetadataCompName", NULL
, &sz
);
1795 ok( r
== ERROR_SUCCESS
, "return wrong\n");
1796 ok( sz
== 13, "size wrong (%d)\n", sz
);
1799 r
= MsiGetProperty(hpkg
, "MetadataCompName", buffer
, &sz
);
1800 ok( r
== ERROR_MORE_DATA
, "return wrong\n");
1801 ok( !strcmp(buffer
,"Photoshop.dl"), "buffer wrong\n");
1803 r
= MsiSetProperty(hpkg
, "property", "value");
1804 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1807 r
= MsiGetProperty(hpkg
, "property", buffer
, &sz
);
1808 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1809 ok( !strcmp(buffer
, "value"), "Expected value, got %s\n", buffer
);
1811 r
= MsiSetProperty(hpkg
, "property", NULL
);
1812 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1815 r
= MsiGetProperty(hpkg
, "property", buffer
, &sz
);
1816 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1817 ok( !strlen(buffer
), "Expected empty string, got %s\n", buffer
);
1819 MsiCloseHandle( hpkg
);
1820 DeleteFile(msifile
);
1823 static BOOL
find_prop_in_property(MSIHANDLE hdb
, LPCSTR prop
, LPCSTR val
)
1825 MSIHANDLE hview
, hrec
;
1827 CHAR buffer
[MAX_PATH
];
1831 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Property`", &hview
);
1832 ok(r
== ERROR_SUCCESS
, "MsiDatabaseOpenView failed\n");
1833 r
= MsiViewExecute(hview
, 0);
1834 ok(r
== ERROR_SUCCESS
, "MsiViewExecute failed\n");
1837 while (r
== ERROR_SUCCESS
&& !found
)
1839 r
= MsiViewFetch(hview
, &hrec
);
1840 if (r
!= ERROR_SUCCESS
) break;
1843 r
= MsiRecordGetString(hrec
, 1, buffer
, &sz
);
1844 if (r
== ERROR_SUCCESS
&& !lstrcmpA(buffer
, prop
))
1847 r
= MsiRecordGetString(hrec
, 2, buffer
, &sz
);
1848 if (r
== ERROR_SUCCESS
&& !lstrcmpA(buffer
, val
))
1852 MsiCloseHandle(hrec
);
1855 MsiViewClose(hview
);
1856 MsiCloseHandle(hview
);
1861 static void test_property_table(void)
1865 MSIHANDLE hpkg
, hdb
, hrec
;
1866 char buffer
[MAX_PATH
];
1870 hdb
= create_package_db();
1871 ok( hdb
, "failed to create package\n");
1873 hpkg
= package_from_db(hdb
);
1874 ok( hpkg
, "failed to create package\n");
1876 MsiCloseHandle(hdb
);
1878 hdb
= MsiGetActiveDatabase(hpkg
);
1880 query
= "CREATE TABLE `_Property` ( "
1881 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1882 r
= run_query(hdb
, query
);
1883 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
1885 MsiCloseHandle(hdb
);
1886 MsiCloseHandle(hpkg
);
1887 DeleteFile(msifile
);
1889 hdb
= create_package_db();
1890 ok( hdb
, "failed to create package\n");
1892 query
= "CREATE TABLE `_Property` ( "
1893 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1894 r
= run_query(hdb
, query
);
1895 ok(r
== ERROR_SUCCESS
, "failed to create table\n");
1897 query
= "ALTER `_Property` ADD `foo` INTEGER";
1898 r
= run_query(hdb
, query
);
1899 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "failed to add column\n");
1901 query
= "ALTER TABLE `_Property` ADD `foo` INTEGER";
1902 r
= run_query(hdb
, query
);
1903 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "failed to add column\n");
1905 query
= "ALTER TABLE `_Property` ADD `extra` INTEGER";
1906 r
= run_query(hdb
, query
);
1907 ok(r
== ERROR_SUCCESS
, "failed to add column\n");
1909 hpkg
= package_from_db(hdb
);
1912 ok(!hpkg
, "package should not be created\n");
1915 MsiCloseHandle(hdb
);
1916 MsiCloseHandle(hpkg
);
1917 DeleteFile(msifile
);
1919 hdb
= create_package_db();
1920 ok (hdb
, "failed to create package database\n");
1922 r
= create_property_table(hdb
);
1923 ok(r
== ERROR_SUCCESS
, "cannot create Property table: %d\n", r
);
1925 r
= add_property_entry(hdb
, "'prop', 'val'");
1926 ok(r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
1928 hpkg
= package_from_db(hdb
);
1929 ok(hpkg
, "failed to create package\n");
1931 MsiCloseHandle(hdb
);
1934 r
= MsiGetProperty(hpkg
, "prop", buffer
, &sz
);
1935 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1936 ok(!lstrcmp(buffer
, "val"), "Expected val, got %s\n", buffer
);
1938 hdb
= MsiGetActiveDatabase(hpkg
);
1940 found
= find_prop_in_property(hdb
, "prop", "val");
1941 ok(found
, "prop should be in the _Property table\n");
1943 r
= add_property_entry(hdb
, "'dantes', 'mercedes'");
1944 ok(r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
1946 query
= "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
1947 r
= do_query(hdb
, query
, &hrec
);
1948 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
1950 found
= find_prop_in_property(hdb
, "dantes", "mercedes");
1951 ok(found
== FALSE
, "dantes should not be in the _Property table\n");
1954 lstrcpy(buffer
, "aaa");
1955 r
= MsiGetProperty(hpkg
, "dantes", buffer
, &sz
);
1956 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1957 ok(lstrlenA(buffer
) == 0, "Expected empty string, got %s\n", buffer
);
1959 r
= MsiSetProperty(hpkg
, "dantes", "mercedes");
1960 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1962 found
= find_prop_in_property(hdb
, "dantes", "mercedes");
1963 ok(found
== TRUE
, "dantes should be in the _Property table\n");
1965 MsiCloseHandle(hdb
);
1966 MsiCloseHandle(hpkg
);
1967 DeleteFile(msifile
);
1970 static UINT
try_query_param( MSIHANDLE hdb
, LPCSTR szQuery
, MSIHANDLE hrec
)
1975 res
= MsiDatabaseOpenView( hdb
, szQuery
, &htab
);
1976 if( res
== ERROR_SUCCESS
)
1980 r
= MsiViewExecute( htab
, hrec
);
1981 if( r
!= ERROR_SUCCESS
)
1984 fprintf(stderr
,"MsiViewExecute failed %08x\n", res
);
1987 r
= MsiViewClose( htab
);
1988 if( r
!= ERROR_SUCCESS
)
1991 r
= MsiCloseHandle( htab
);
1992 if( r
!= ERROR_SUCCESS
)
1998 static UINT
try_query( MSIHANDLE hdb
, LPCSTR szQuery
)
2000 return try_query_param( hdb
, szQuery
, 0 );
2003 static void set_summary_str(MSIHANDLE hdb
, DWORD pid
, LPCSTR value
)
2008 r
= MsiGetSummaryInformationA(hdb
, NULL
, 1, &summary
);
2009 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2011 r
= MsiSummaryInfoSetPropertyA(summary
, pid
, VT_LPSTR
, 0, NULL
, value
);
2012 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2014 r
= MsiSummaryInfoPersist(summary
);
2015 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2017 MsiCloseHandle(summary
);
2020 static void set_summary_dword(MSIHANDLE hdb
, DWORD pid
, DWORD value
)
2025 r
= MsiGetSummaryInformationA(hdb
, NULL
, 1, &summary
);
2026 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2028 r
= MsiSummaryInfoSetPropertyA(summary
, pid
, VT_I4
, value
, NULL
, NULL
);
2029 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2031 r
= MsiSummaryInfoPersist(summary
);
2032 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2034 MsiCloseHandle(summary
);
2037 static void test_msipackage(void)
2039 MSIHANDLE hdb
= 0, hpack
= 100;
2044 /* NULL szPackagePath */
2045 r
= MsiOpenPackage(NULL
, &hpack
);
2046 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2048 /* empty szPackagePath */
2049 r
= MsiOpenPackage("", &hpack
);
2052 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2055 if (r
== ERROR_SUCCESS
)
2056 MsiCloseHandle(hpack
);
2058 /* nonexistent szPackagePath */
2059 r
= MsiOpenPackage("nonexistent", &hpack
);
2060 ok(r
== ERROR_FILE_NOT_FOUND
, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2063 r
= MsiOpenPackage(msifile
, NULL
);
2064 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2068 r
= MsiOpenPackage(name
, &hpack
);
2069 ok(r
== ERROR_INVALID_HANDLE
, "Expected ERROR_INVALID_HANDLE, got %d\n", r
);
2071 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
2072 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2074 /* database exists, but is emtpy */
2075 sprintf(name
, "#%ld", hdb
);
2076 r
= MsiOpenPackage(name
, &hpack
);
2077 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2078 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2080 query
= "CREATE TABLE `Property` ( "
2081 "`Property` CHAR(72), `Value` CHAR(0) "
2082 "PRIMARY KEY `Property`)";
2083 r
= try_query(hdb
, query
);
2084 ok(r
== ERROR_SUCCESS
, "failed to create Properties table\n");
2086 query
= "CREATE TABLE `InstallExecuteSequence` ("
2087 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2088 "PRIMARY KEY `Action`)";
2089 r
= try_query(hdb
, query
);
2090 ok(r
== ERROR_SUCCESS
, "failed to create InstallExecuteSequence table\n");
2092 /* a few key tables exist */
2093 sprintf(name
, "#%ld", hdb
);
2094 r
= MsiOpenPackage(name
, &hpack
);
2095 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2096 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2098 MsiCloseHandle(hdb
);
2099 DeleteFile(msifile
);
2101 /* start with a clean database to show what constitutes a valid package */
2102 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
2103 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2105 sprintf(name
, "#%ld", hdb
);
2107 /* The following summary information props must exist:
2112 set_summary_dword(hdb
, PID_PAGECOUNT
, 100);
2113 r
= MsiOpenPackage(name
, &hpack
);
2114 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2115 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2117 set_summary_str(hdb
, PID_REVNUMBER
, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2118 r
= MsiOpenPackage(name
, &hpack
);
2119 ok(r
== ERROR_SUCCESS
,
2120 "Expected ERROR_SUCCESS, got %d\n", r
);
2122 MsiCloseHandle(hpack
);
2123 MsiCloseHandle(hdb
);
2124 DeleteFile(msifile
);
2127 static void test_formatrecord2(void)
2129 MSIHANDLE hpkg
, hrec
;
2134 hpkg
= package_from_db(create_package_db());
2135 ok( hpkg
, "failed to create package\n");
2137 r
= MsiSetProperty(hpkg
, "Manufacturer", " " );
2138 ok( r
== ERROR_SUCCESS
, "set property failed\n");
2140 hrec
= MsiCreateRecord(2);
2141 ok(hrec
, "create record failed\n");
2143 r
= MsiRecordSetString( hrec
, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2144 ok( r
== ERROR_SUCCESS
, "format record failed\n");
2148 r
= MsiFormatRecord( hpkg
, hrec
, buffer
, &sz
);
2150 r
= MsiRecordSetString(hrec
, 0, "[foo][1]");
2151 r
= MsiRecordSetString(hrec
, 1, "hoo");
2153 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2154 ok( sz
== 3, "size wrong\n");
2155 ok( 0 == strcmp(buffer
,"hoo"), "wrong output %s\n",buffer
);
2156 ok( r
== ERROR_SUCCESS
, "format failed\n");
2158 r
= MsiRecordSetString(hrec
, 0, "x[~]x");
2160 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2161 ok( sz
== 3, "size wrong\n");
2162 ok( 0 == strcmp(buffer
,"x"), "wrong output %s\n",buffer
);
2163 ok( r
== ERROR_SUCCESS
, "format failed\n");
2165 r
= MsiRecordSetString(hrec
, 0, "[foo.$%}][1]");
2166 r
= MsiRecordSetString(hrec
, 1, "hoo");
2168 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2169 ok( sz
== 3, "size wrong\n");
2170 ok( 0 == strcmp(buffer
,"hoo"), "wrong output %s\n",buffer
);
2171 ok( r
== ERROR_SUCCESS
, "format failed\n");
2173 r
= MsiRecordSetString(hrec
, 0, "[\\[]");
2175 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2176 ok( sz
== 1, "size wrong\n");
2177 ok( 0 == strcmp(buffer
,"["), "wrong output %s\n",buffer
);
2178 ok( r
== ERROR_SUCCESS
, "format failed\n");
2180 SetEnvironmentVariable("FOO", "BAR");
2181 r
= MsiRecordSetString(hrec
, 0, "[%FOO]");
2183 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2184 ok( sz
== 3, "size wrong\n");
2185 ok( 0 == strcmp(buffer
,"BAR"), "wrong output %s\n",buffer
);
2186 ok( r
== ERROR_SUCCESS
, "format failed\n");
2188 r
= MsiRecordSetString(hrec
, 0, "[[1]]");
2189 r
= MsiRecordSetString(hrec
, 1, "%FOO");
2191 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2192 ok( sz
== 3, "size wrong\n");
2193 ok( 0 == strcmp(buffer
,"BAR"), "wrong output %s\n",buffer
);
2194 ok( r
== ERROR_SUCCESS
, "format failed\n");
2196 MsiCloseHandle( hrec
);
2197 MsiCloseHandle( hpkg
);
2198 DeleteFile(msifile
);
2201 /* FIXME: state is INSTALLSTATE_UNKNOWN if any features are removed and the
2202 * feature in question is not in ADD*
2204 static void test_states(void)
2209 INSTALLSTATE state
, action
;
2211 hdb
= create_package_db();
2212 ok ( hdb
, "failed to create package database\n" );
2214 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
2215 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
2217 r
= create_property_table( hdb
);
2218 ok( r
== ERROR_SUCCESS
, "cannot create Property table: %d\n", r
);
2220 r
= add_property_entry( hdb
, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2221 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2223 r
= add_property_entry( hdb
, "'ProductLanguage', '1033'" );
2224 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2226 r
= add_property_entry( hdb
, "'ProductName', 'MSITEST'" );
2227 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2229 r
= add_property_entry( hdb
, "'ProductVersion', '1.1.1'" );
2230 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2232 r
= create_install_execute_sequence_table( hdb
);
2233 ok( r
== ERROR_SUCCESS
, "cannot create InstallExecuteSequence table: %d\n", r
);
2235 r
= add_install_execute_sequence_entry( hdb
, "'CostInitialize', '', '800'" );
2236 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2238 r
= add_install_execute_sequence_entry( hdb
, "'FileCost', '', '900'" );
2239 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2241 r
= add_install_execute_sequence_entry( hdb
, "'CostFinalize', '', '1000'" );
2242 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2244 r
= add_install_execute_sequence_entry( hdb
, "'InstallValidate', '', '1400'" );
2245 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2247 r
= add_install_execute_sequence_entry( hdb
, "'InstallInitialize', '', '1500'" );
2248 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2250 r
= add_install_execute_sequence_entry( hdb
, "'ProcessComponents', '', '1600'" );
2251 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2253 r
= add_install_execute_sequence_entry( hdb
, "'UnpublishFeatures', '', '1800'" );
2254 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2256 r
= add_install_execute_sequence_entry( hdb
, "'RegisterProduct', '', '6100'" );
2257 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2259 r
= add_install_execute_sequence_entry( hdb
, "'PublishFeatures', '', '6300'" );
2260 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2262 r
= add_install_execute_sequence_entry( hdb
, "'PublishProduct', '', '6400'" );
2263 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2265 r
= add_install_execute_sequence_entry( hdb
, "'InstallFinalize', '', '6600'" );
2266 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2268 r
= create_media_table( hdb
);
2269 ok( r
== ERROR_SUCCESS
, "cannot create media table: %d\n", r
);
2271 r
= add_media_entry( hdb
, "'1', '3', '', '', 'DISK1', ''");
2272 ok( r
== ERROR_SUCCESS
, "cannot add media entry: %d\n", r
);
2274 r
= create_feature_table( hdb
);
2275 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
2277 r
= create_component_table( hdb
);
2278 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
2280 /* msidbFeatureAttributesFavorLocal */
2281 r
= add_feature_entry( hdb
, "'one', '', '', '', 2, 1, '', 0" );
2282 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2284 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2285 r
= add_component_entry( hdb
, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2286 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2288 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2289 r
= add_component_entry( hdb
, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2290 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2292 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2293 r
= add_component_entry( hdb
, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2294 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2296 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2297 r
= add_component_entry( hdb
, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2298 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2300 /* msidbFeatureAttributesFavorSource */
2301 r
= add_feature_entry( hdb
, "'two', '', '', '', 2, 1, '', 1" );
2302 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2304 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2305 r
= add_component_entry( hdb
, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2306 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2308 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2309 r
= add_component_entry( hdb
, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2310 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2312 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2313 r
= add_component_entry( hdb
, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2314 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2316 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2317 r
= add_component_entry( hdb
, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2318 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2320 /* msidbFeatureAttributesFavorSource */
2321 r
= add_feature_entry( hdb
, "'three', '', '', '', 2, 1, '', 1" );
2322 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2324 /* msidbFeatureAttributesFavorLocal */
2325 r
= add_feature_entry( hdb
, "'four', '', '', '', 2, 1, '', 0" );
2326 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2329 r
= add_feature_entry( hdb
, "'five', '', '', '', 2, 0, '', 1" );
2330 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2332 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2333 r
= add_component_entry( hdb
, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2334 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2336 /* no feature parent:msidbComponentAttributesLocalOnly */
2337 r
= add_component_entry( hdb
, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2338 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2340 /* msidbFeatureAttributesFavorLocal:removed */
2341 r
= add_feature_entry( hdb
, "'six', '', '', '', 2, 1, '', 0" );
2342 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2344 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2345 r
= add_component_entry( hdb
, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2346 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2348 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2349 r
= add_component_entry( hdb
, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2350 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2352 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2353 r
= add_component_entry( hdb
, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2354 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2356 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2357 r
= add_component_entry( hdb
, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2358 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2360 /* msidbFeatureAttributesFavorSource:removed */
2361 r
= add_feature_entry( hdb
, "'seven', '', '', '', 2, 1, '', 1" );
2362 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2364 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2365 r
= add_component_entry( hdb
, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2366 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2368 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2369 r
= add_component_entry( hdb
, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2370 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2372 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2373 r
= add_component_entry( hdb
, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2374 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2376 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2377 r
= add_component_entry( hdb
, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2378 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2380 r
= create_feature_components_table( hdb
);
2381 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
2383 r
= add_feature_components_entry( hdb
, "'one', 'alpha'" );
2384 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2386 r
= add_feature_components_entry( hdb
, "'one', 'beta'" );
2387 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2389 r
= add_feature_components_entry( hdb
, "'one', 'gamma'" );
2390 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2392 r
= add_feature_components_entry( hdb
, "'one', 'theta'" );
2393 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2395 r
= add_feature_components_entry( hdb
, "'two', 'delta'" );
2396 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2398 r
= add_feature_components_entry( hdb
, "'two', 'epsilon'" );
2399 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2401 r
= add_feature_components_entry( hdb
, "'two', 'zeta'" );
2402 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2404 r
= add_feature_components_entry( hdb
, "'two', 'iota'" );
2405 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2407 r
= add_feature_components_entry( hdb
, "'three', 'eta'" );
2408 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2410 r
= add_feature_components_entry( hdb
, "'four', 'eta'" );
2411 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2413 r
= add_feature_components_entry( hdb
, "'five', 'eta'" );
2414 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2416 r
= add_feature_components_entry( hdb
, "'six', 'lambda'" );
2417 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2419 r
= add_feature_components_entry( hdb
, "'six', 'mu'" );
2420 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2422 r
= add_feature_components_entry( hdb
, "'six', 'nu'" );
2423 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2425 r
= add_feature_components_entry( hdb
, "'six', 'xi'" );
2426 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2428 r
= add_feature_components_entry( hdb
, "'seven', 'omicron'" );
2429 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2431 r
= add_feature_components_entry( hdb
, "'seven', 'pi'" );
2432 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2434 r
= add_feature_components_entry( hdb
, "'seven', 'rho'" );
2435 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2437 r
= add_feature_components_entry( hdb
, "'seven', 'sigma'" );
2438 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2440 r
= create_file_table( hdb
);
2441 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
2443 r
= add_file_entry( hdb
, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2444 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2446 r
= add_file_entry( hdb
, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2447 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2449 r
= add_file_entry( hdb
, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2450 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2452 r
= add_file_entry( hdb
, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2453 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2455 r
= add_file_entry( hdb
, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2456 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2458 r
= add_file_entry( hdb
, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2459 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2461 r
= add_file_entry( hdb
, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2462 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2464 r
= add_file_entry( hdb
, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2465 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2467 /* compressed file */
2468 r
= add_file_entry( hdb
, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2469 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2471 r
= add_file_entry( hdb
, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2472 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2474 r
= add_file_entry( hdb
, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2475 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2477 r
= add_file_entry( hdb
, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2478 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2480 r
= add_file_entry( hdb
, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2481 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2483 r
= add_file_entry( hdb
, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2484 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2486 r
= add_file_entry( hdb
, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2487 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2489 r
= add_file_entry( hdb
, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2490 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2492 r
= add_file_entry( hdb
, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2493 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2495 r
= add_file_entry( hdb
, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2496 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2498 MsiDatabaseCommit(hdb
);
2500 /* these properties must not be in the saved msi file */
2501 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,four'");
2502 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2504 r
= add_property_entry( hdb
, "'ADDSOURCE', 'two,three'");
2505 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2507 r
= add_property_entry( hdb
, "'REMOVE', 'six,seven'");
2508 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2510 hpkg
= package_from_db( hdb
);
2511 ok( hpkg
, "failed to create package\n");
2513 MsiCloseHandle(hdb
);
2517 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2518 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2519 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2520 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2524 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2525 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2526 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2527 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2531 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2532 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2533 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2534 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2538 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2539 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2540 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2541 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2545 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2546 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2547 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2548 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2552 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2553 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2554 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2555 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2559 r
= MsiGetFeatureState(hpkg
, "seven", &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
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2567 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, 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
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2574 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, 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
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2581 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, 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
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2588 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, 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
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2595 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, 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
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
2602 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, 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
, "zeta", &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
, "iota", &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
, "eta", &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
, "kappa", &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
, "lambda", &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
, "mu", &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
, "nu", &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
, "xi", &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
, "omicron", &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
, "pi", &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
, "rho", &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
, "sigma", &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
);
2690 r
= MsiDoAction( hpkg
, "CostInitialize");
2691 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
2695 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2696 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2697 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2698 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2702 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2703 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2704 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2705 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2709 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2710 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2711 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2712 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2716 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2717 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2718 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2719 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2723 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2724 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2725 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2726 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2730 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2731 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2732 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2733 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2737 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
2738 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2739 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2740 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2744 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2745 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2746 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2747 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2751 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2752 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2753 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2754 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2758 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2759 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2760 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2761 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2765 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2766 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2767 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2768 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2772 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2773 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2774 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2775 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2779 r
= MsiGetComponentState(hpkg
, "epsilon", &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
, "zeta", &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
, "iota", &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
, "eta", &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
, "kappa", &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
, "lambda", &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
, "mu", &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
, "nu", &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
, "xi", &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
, "omicron", &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
, "pi", &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
, "rho", &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
, "sigma", &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
);
2868 r
= MsiDoAction( hpkg
, "FileCost");
2869 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
2873 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2874 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2875 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2876 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2880 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2881 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2882 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2883 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2887 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2888 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2889 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2890 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2894 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2895 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2896 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2897 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2901 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2902 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2903 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2904 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2908 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2909 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2910 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2911 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2915 r
= MsiGetFeatureState(hpkg
, "seven", &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
= MsiGetComponentState(hpkg
, "alpha", &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
= MsiGetComponentState(hpkg
, "beta", &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
= MsiGetComponentState(hpkg
, "gamma", &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
= MsiGetComponentState(hpkg
, "theta", &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
= MsiGetComponentState(hpkg
, "delta", &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
= MsiGetComponentState(hpkg
, "epsilon", &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
, "zeta", &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
, "iota", &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
, "eta", &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
, "kappa", &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
, "lambda", &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
, "mu", &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
, "nu", &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
, "xi", &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
, "omicron", &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
, "pi", &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
, "rho", &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
, "sigma", &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
);
3046 r
= MsiDoAction( hpkg
, "CostFinalize");
3047 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
3051 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3052 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3053 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3054 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3058 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3059 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3060 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3061 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3065 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3066 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3067 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3068 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3072 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3073 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3074 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3075 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3079 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3080 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3081 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3082 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3086 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3087 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3088 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3091 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3096 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3097 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3098 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3101 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3106 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3107 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3108 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3109 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3113 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3114 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3115 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3116 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3120 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3121 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3122 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3123 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3127 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3128 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3129 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3130 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3134 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3135 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3136 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3137 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3141 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3142 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3143 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3144 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3148 r
= MsiGetComponentState(hpkg
, "zeta", &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_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3155 r
= MsiGetComponentState(hpkg
, "iota", &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_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3162 r
= MsiGetComponentState(hpkg
, "eta", &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
, "kappa", &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_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3176 r
= MsiGetComponentState(hpkg
, "lambda", &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
);
3181 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3186 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3187 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3188 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3191 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3196 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3197 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3198 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3201 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3206 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3207 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3208 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3211 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3216 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3217 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3218 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3221 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3226 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3227 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3228 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3231 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3236 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3237 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3238 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3241 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3246 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3247 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3248 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3251 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3254 MsiCloseHandle( hpkg
);
3256 /* publish the features and components */
3257 r
= MsiInstallProduct(msifile
, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven");
3258 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3260 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
3261 ok(r
== ERROR_SUCCESS
, "failed to open database: %d\n", r
);
3263 /* these properties must not be in the saved msi file */
3264 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,four'");
3265 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3267 r
= add_property_entry( hdb
, "'ADDSOURCE', 'two,three'");
3268 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3270 r
= add_property_entry( hdb
, "'REMOVE', 'six,seven'");
3271 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3273 hpkg
= package_from_db( hdb
);
3274 ok( hpkg
, "failed to create package\n");
3276 MsiCloseHandle(hdb
);
3280 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3281 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3282 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3283 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3287 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3288 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3289 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3290 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3294 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3295 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3296 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3297 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3301 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3302 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3303 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3304 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3308 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3309 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3310 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3311 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3315 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3316 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3317 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3318 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3322 r
= MsiGetFeatureState(hpkg
, "seven", &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
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3330 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, 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
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3337 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, 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
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3344 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, 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
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3351 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, 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
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3358 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, 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
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3365 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, 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
, "zeta", &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
, "iota", &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
, "eta", &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
, "kappa", &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
, "lambda", &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
, "mu", &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
, "nu", &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
, "xi", &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
, "omicron", &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
, "pi", &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
, "rho", &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
, "sigma", &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
);
3453 r
= MsiDoAction( hpkg
, "CostInitialize");
3454 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
3458 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3459 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3460 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3461 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3465 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3466 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3467 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3468 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3472 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3473 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3474 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3475 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3479 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3480 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3481 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3482 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3486 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3487 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3488 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3489 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3493 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3494 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3495 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3496 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3500 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3501 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3502 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3503 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3507 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3508 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3509 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3510 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3514 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3515 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3516 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3517 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3521 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3522 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3523 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3524 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3528 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3529 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3530 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3531 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3535 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3536 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3537 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3538 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3542 r
= MsiGetComponentState(hpkg
, "epsilon", &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
, "zeta", &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
, "iota", &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
, "eta", &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
, "kappa", &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
, "lambda", &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
, "mu", &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
, "nu", &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
, "xi", &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
, "omicron", &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
, "pi", &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
, "rho", &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
, "sigma", &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
);
3631 r
= MsiDoAction( hpkg
, "FileCost");
3632 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
3636 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3637 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3638 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3639 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3643 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3644 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3645 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3646 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3650 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3651 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3652 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3653 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3657 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3658 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3659 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3660 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3664 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3665 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3666 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3667 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3671 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3672 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3673 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3674 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3678 r
= MsiGetFeatureState(hpkg
, "seven", &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
= MsiGetComponentState(hpkg
, "alpha", &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
= MsiGetComponentState(hpkg
, "beta", &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
= MsiGetComponentState(hpkg
, "gamma", &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
= MsiGetComponentState(hpkg
, "theta", &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
= MsiGetComponentState(hpkg
, "delta", &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
= MsiGetComponentState(hpkg
, "epsilon", &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
, "zeta", &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
, "iota", &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
, "eta", &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
, "kappa", &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
, "lambda", &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
, "mu", &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
, "nu", &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
, "xi", &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
, "omicron", &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
, "pi", &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
, "rho", &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
, "sigma", &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
);
3809 r
= MsiDoAction( hpkg
, "CostFinalize");
3810 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
3814 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3815 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3818 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3820 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3824 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3825 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3828 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3830 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3834 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3835 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3838 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3840 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3844 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3845 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3848 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3850 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3854 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3855 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3856 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3857 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3861 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3862 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3863 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3866 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3871 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3872 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3873 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3876 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3881 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3882 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3885 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3887 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3891 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3892 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3895 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3897 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3901 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3902 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3905 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3907 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3911 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3912 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3915 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3917 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3921 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3922 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3925 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3927 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3931 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3932 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3935 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3936 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3941 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3942 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3945 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3946 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3951 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3952 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3955 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3957 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3961 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3962 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3965 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3967 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3971 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3972 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3973 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3974 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3978 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3979 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3980 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3983 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3988 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3989 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3990 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3993 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3998 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3999 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4000 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4003 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4008 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4009 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4010 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4013 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4018 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4019 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4020 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4023 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4028 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4029 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4030 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4033 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4038 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4039 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4040 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4043 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4048 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4049 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4050 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4053 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4056 MsiCloseHandle(hpkg
);
4058 /* uninstall the product */
4059 r
= MsiInstallProduct(msifile
, "REMOVE=ALL");
4060 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4062 DeleteFileA(msifile
);
4065 static void test_getproperty(void)
4067 MSIHANDLE hPackage
= 0;
4069 static CHAR empty
[] = "";
4073 hPackage
= package_from_db(create_package_db());
4074 ok( hPackage
!= 0, " Failed to create package\n");
4076 /* set the property */
4077 r
= MsiSetProperty(hPackage
, "Name", "Value");
4078 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4080 /* retrieve the size, NULL pointer */
4082 r
= MsiGetProperty(hPackage
, "Name", NULL
, &size
);
4083 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4084 ok( size
== 5, "Expected 5, got %d\n", size
);
4086 /* retrieve the size, empty string */
4088 r
= MsiGetProperty(hPackage
, "Name", empty
, &size
);
4089 ok( r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
4090 ok( size
== 5, "Expected 5, got %d\n", size
);
4092 /* don't change size */
4093 r
= MsiGetProperty(hPackage
, "Name", prop
, &size
);
4094 ok( r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
4095 ok( size
== 5, "Expected 5, got %d\n", size
);
4096 ok( !lstrcmp(prop
, "Valu"), "Expected Valu, got %s\n", prop
);
4098 /* increase the size by 1 */
4100 r
= MsiGetProperty(hPackage
, "Name", prop
, &size
);
4101 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4102 ok( size
== 5, "Expected 5, got %d\n", size
);
4103 ok( !lstrcmp(prop
, "Value"), "Expected Value, got %s\n", prop
);
4105 r
= MsiCloseHandle( hPackage
);
4106 ok( r
== ERROR_SUCCESS
, "Failed to close package\n" );
4107 DeleteFile(msifile
);
4110 static void test_removefiles(void)
4116 hdb
= create_package_db();
4117 ok ( hdb
, "failed to create package database\n" );
4119 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
4120 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
4122 r
= create_feature_table( hdb
);
4123 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
4125 r
= create_component_table( hdb
);
4126 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
4128 r
= add_feature_entry( hdb
, "'one', '', '', '', 2, 1, '', 0" );
4129 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4131 r
= add_component_entry( hdb
, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
4132 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4134 r
= add_component_entry( hdb
, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
4135 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4137 r
= add_component_entry( hdb
, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
4138 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4140 r
= add_component_entry( hdb
, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
4141 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4143 r
= add_component_entry( hdb
, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
4144 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4146 r
= add_component_entry( hdb
, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
4147 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4149 r
= create_feature_components_table( hdb
);
4150 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
4152 r
= add_feature_components_entry( hdb
, "'one', 'hydrogen'" );
4153 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4155 r
= add_feature_components_entry( hdb
, "'one', 'helium'" );
4156 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4158 r
= add_feature_components_entry( hdb
, "'one', 'lithium'" );
4159 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4161 r
= add_feature_components_entry( hdb
, "'one', 'beryllium'" );
4162 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4164 r
= add_feature_components_entry( hdb
, "'one', 'boron'" );
4165 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4167 r
= add_feature_components_entry( hdb
, "'one', 'carbon'" );
4168 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4170 r
= create_file_table( hdb
);
4171 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
4173 r
= add_file_entry( hdb
, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
4174 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4176 r
= add_file_entry( hdb
, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
4177 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4179 r
= add_file_entry( hdb
, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
4180 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4182 r
= add_file_entry( hdb
, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
4183 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4185 r
= add_file_entry( hdb
, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
4186 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4188 r
= add_file_entry( hdb
, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
4189 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4191 r
= create_remove_file_table( hdb
);
4192 ok( r
== ERROR_SUCCESS
, "cannot create Remove File table: %d\n", r
);
4194 hpkg
= package_from_db( hdb
);
4195 ok( hpkg
, "failed to create package\n");
4197 MsiCloseHandle( hdb
);
4199 create_test_file( "hydrogen.txt" );
4200 create_test_file( "helium.txt" );
4201 create_test_file( "lithium.txt" );
4202 create_test_file( "beryllium.txt" );
4203 create_test_file( "boron.txt" );
4204 create_test_file( "carbon.txt" );
4206 r
= MsiSetProperty( hpkg
, "TARGETDIR", CURR_DIR
);
4207 ok( r
== ERROR_SUCCESS
, "set property failed\n");
4209 r
= MsiDoAction( hpkg
, "CostInitialize");
4210 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4212 r
= MsiDoAction( hpkg
, "FileCost");
4213 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
4215 r
= MsiDoAction( hpkg
, "CostFinalize");
4216 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
4218 r
= MsiDoAction( hpkg
, "InstallValidate");
4219 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
4221 r
= MsiSetComponentState( hpkg
, "hydrogen", INSTALLSTATE_ABSENT
);
4222 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4224 r
= MsiSetComponentState( hpkg
, "helium", INSTALLSTATE_LOCAL
);
4225 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4227 r
= MsiSetComponentState( hpkg
, "lithium", INSTALLSTATE_SOURCE
);
4228 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4230 r
= MsiSetComponentState( hpkg
, "beryllium", INSTALLSTATE_ABSENT
);
4231 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4233 r
= MsiSetComponentState( hpkg
, "boron", INSTALLSTATE_LOCAL
);
4234 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4236 r
= MsiSetComponentState( hpkg
, "carbon", INSTALLSTATE_SOURCE
);
4237 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4239 r
= MsiDoAction( hpkg
, "RemoveFiles");
4240 ok( r
== ERROR_SUCCESS
, "remove files failed\n");
4242 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
4243 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
4244 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
4245 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
4246 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
4247 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
4249 MsiCloseHandle( hpkg
);
4250 DeleteFileA(msifile
);
4253 static void test_appsearch(void)
4258 CHAR prop
[MAX_PATH
];
4259 DWORD size
= MAX_PATH
;
4261 hdb
= create_package_db();
4262 ok ( hdb
, "failed to create package database\n" );
4264 r
= create_appsearch_table( hdb
);
4265 ok( r
== ERROR_SUCCESS
, "cannot create AppSearch table: %d\n", r
);
4267 r
= add_appsearch_entry( hdb
, "'WEBBROWSERPROG', 'NewSignature1'" );
4268 ok( r
== ERROR_SUCCESS
, "cannot add entry: %d\n", r
);
4270 r
= create_reglocator_table( hdb
);
4271 ok( r
== ERROR_SUCCESS
, "cannot create RegLocator table: %d\n", r
);
4273 r
= add_reglocator_entry( hdb
, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
4274 ok( r
== ERROR_SUCCESS
, "cannot create RegLocator table: %d\n", r
);
4276 r
= create_signature_table( hdb
);
4277 ok( r
== ERROR_SUCCESS
, "cannot create Signature table: %d\n", r
);
4279 r
= add_signature_entry( hdb
, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
4280 ok( r
== ERROR_SUCCESS
, "cannot create Signature table: %d\n", r
);
4282 hpkg
= package_from_db( hdb
);
4283 ok( hpkg
, "failed to create package\n");
4285 MsiCloseHandle( hdb
);
4287 r
= MsiDoAction( hpkg
, "AppSearch" );
4288 ok( r
== ERROR_SUCCESS
, "AppSearch failed: %d\n", r
);
4290 r
= MsiGetPropertyA( hpkg
, "WEBBROWSERPROG", prop
, &size
);
4291 ok( r
== ERROR_SUCCESS
, "get property failed: %d\n", r
);
4292 ok( lstrlenA(prop
) != 0, "Expected non-zero length\n");
4294 MsiCloseHandle( hpkg
);
4295 DeleteFileA(msifile
);
4298 static void test_featureparents(void)
4303 INSTALLSTATE state
, action
;
4305 hdb
= create_package_db();
4306 ok ( hdb
, "failed to create package database\n" );
4308 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
4309 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
4311 r
= create_feature_table( hdb
);
4312 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
4314 r
= create_component_table( hdb
);
4315 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
4317 r
= create_feature_components_table( hdb
);
4318 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
4320 r
= create_file_table( hdb
);
4321 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
4323 /* msidbFeatureAttributesFavorLocal */
4324 r
= add_feature_entry( hdb
, "'zodiac', '', '', '', 2, 1, '', 0" );
4325 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4327 /* msidbFeatureAttributesFavorSource */
4328 r
= add_feature_entry( hdb
, "'perseus', '', '', '', 2, 1, '', 1" );
4329 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4331 /* msidbFeatureAttributesFavorLocal */
4332 r
= add_feature_entry( hdb
, "'orion', '', '', '', 2, 1, '', 0" );
4333 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4335 /* disabled because of install level */
4336 r
= add_feature_entry( hdb
, "'waters', '', '', '', 15, 101, '', 9" );
4337 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4339 /* child feature of disabled feature */
4340 r
= add_feature_entry( hdb
, "'bayer', 'waters', '', '', 14, 1, '', 9" );
4341 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4343 /* component of disabled feature (install level) */
4344 r
= add_component_entry( hdb
, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
4345 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4347 /* component of disabled child feature (install level) */
4348 r
= add_component_entry( hdb
, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
4349 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4351 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
4352 r
= add_component_entry( hdb
, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
4353 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4355 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
4356 r
= add_component_entry( hdb
, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
4357 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4359 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
4360 r
= add_component_entry( hdb
, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
4361 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4363 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
4364 r
= add_component_entry( hdb
, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
4365 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4367 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
4368 r
= add_component_entry( hdb
, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
4369 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4371 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
4372 r
= add_component_entry( hdb
, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
4373 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4375 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
4376 r
= add_component_entry( hdb
, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
4377 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4379 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
4380 r
= add_component_entry( hdb
, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
4381 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4383 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
4384 r
= add_component_entry( hdb
, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
4386 r
= add_feature_components_entry( hdb
, "'zodiac', 'leo'" );
4387 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4389 r
= add_feature_components_entry( hdb
, "'zodiac', 'virgo'" );
4390 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4392 r
= add_feature_components_entry( hdb
, "'zodiac', 'libra'" );
4393 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4395 r
= add_feature_components_entry( hdb
, "'perseus', 'cassiopeia'" );
4396 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4398 r
= add_feature_components_entry( hdb
, "'perseus', 'cepheus'" );
4399 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4401 r
= add_feature_components_entry( hdb
, "'perseus', 'andromeda'" );
4402 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4404 r
= add_feature_components_entry( hdb
, "'orion', 'leo'" );
4405 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4407 r
= add_feature_components_entry( hdb
, "'orion', 'virgo'" );
4408 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4410 r
= add_feature_components_entry( hdb
, "'orion', 'libra'" );
4411 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4413 r
= add_feature_components_entry( hdb
, "'orion', 'cassiopeia'" );
4414 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4416 r
= add_feature_components_entry( hdb
, "'orion', 'cepheus'" );
4417 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4419 r
= add_feature_components_entry( hdb
, "'orion', 'andromeda'" );
4420 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4422 r
= add_feature_components_entry( hdb
, "'orion', 'canis'" );
4423 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4425 r
= add_feature_components_entry( hdb
, "'orion', 'monoceros'" );
4426 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4428 r
= add_feature_components_entry( hdb
, "'orion', 'lepus'" );
4429 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4431 r
= add_feature_components_entry( hdb
, "'waters', 'delphinus'" );
4432 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4434 r
= add_feature_components_entry( hdb
, "'bayer', 'hydrus'" );
4435 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4437 r
= add_file_entry( hdb
, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
4438 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4440 r
= add_file_entry( hdb
, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
4441 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4443 r
= add_file_entry( hdb
, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
4444 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4446 r
= add_file_entry( hdb
, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
4447 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4449 r
= add_file_entry( hdb
, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
4450 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4452 r
= add_file_entry( hdb
, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
4453 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4455 r
= add_file_entry( hdb
, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
4456 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4458 r
= add_file_entry( hdb
, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
4459 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4461 r
= add_file_entry( hdb
, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
4462 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4464 r
= add_file_entry( hdb
, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
4465 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4467 r
= add_file_entry( hdb
, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
4468 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4470 hpkg
= package_from_db( hdb
);
4471 ok( hpkg
, "failed to create package\n");
4473 MsiCloseHandle( hdb
);
4475 r
= MsiDoAction( hpkg
, "CostInitialize");
4476 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4478 r
= MsiDoAction( hpkg
, "FileCost");
4479 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
4481 r
= MsiDoAction( hpkg
, "CostFinalize");
4482 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
4486 r
= MsiGetFeatureState(hpkg
, "zodiac", &state
, &action
);
4487 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4488 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4489 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4493 r
= MsiGetFeatureState(hpkg
, "perseus", &state
, &action
);
4494 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4495 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4496 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
4500 r
= MsiGetFeatureState(hpkg
, "orion", &state
, &action
);
4501 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4502 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4503 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4507 r
= MsiGetFeatureState(hpkg
, "waters", &state
, &action
);
4508 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4509 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4510 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4514 r
= MsiGetFeatureState(hpkg
, "bayer", &state
, &action
);
4515 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4516 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4517 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4521 r
= MsiGetComponentState(hpkg
, "leo", &state
, &action
);
4522 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4523 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4524 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4528 r
= MsiGetComponentState(hpkg
, "virgo", &state
, &action
);
4529 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4530 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state
);
4531 ok( action
== INSTALLSTATE_SOURCE
, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action
);
4535 r
= MsiGetComponentState(hpkg
, "libra", &state
, &action
);
4536 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4537 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state
);
4538 ok( action
== INSTALLSTATE_LOCAL
, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action
);
4542 r
= MsiGetComponentState(hpkg
, "cassiopeia", &state
, &action
);
4543 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4544 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state
);
4545 ok( action
== INSTALLSTATE_LOCAL
, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action
);
4549 r
= MsiGetComponentState(hpkg
, "cepheus", &state
, &action
);
4550 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4551 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4552 ok( action
== INSTALLSTATE_SOURCE
, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action
);
4556 r
= MsiGetComponentState(hpkg
, "andromeda", &state
, &action
);
4557 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4558 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state
);
4559 ok( action
== INSTALLSTATE_LOCAL
, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action
);
4563 r
= MsiGetComponentState(hpkg
, "canis", &state
, &action
);
4564 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4565 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state
);
4566 ok( action
== INSTALLSTATE_LOCAL
, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action
);
4570 r
= MsiGetComponentState(hpkg
, "monoceros", &state
, &action
);
4571 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4572 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state
);
4573 ok( action
== INSTALLSTATE_SOURCE
, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action
);
4577 r
= MsiGetComponentState(hpkg
, "lepus", &state
, &action
);
4578 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4579 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4580 ok( action
== INSTALLSTATE_LOCAL
, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action
);
4584 r
= MsiGetComponentState(hpkg
, "delphinus", &state
, &action
);
4585 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4586 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4587 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action
);
4591 r
= MsiGetComponentState(hpkg
, "hydrus", &state
, &action
);
4592 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4593 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4594 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action
);
4596 r
= MsiSetFeatureState(hpkg
, "orion", INSTALLSTATE_ABSENT
);
4597 ok( r
== ERROR_SUCCESS
, "failed to set feature state: %d\n", r
);
4601 r
= MsiGetFeatureState(hpkg
, "zodiac", &state
, &action
);
4602 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4603 ok( state
== INSTALLSTATE_ABSENT
, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state
);
4604 ok( action
== INSTALLSTATE_LOCAL
, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action
);
4608 r
= MsiGetFeatureState(hpkg
, "perseus", &state
, &action
);
4609 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4610 ok( state
== INSTALLSTATE_ABSENT
, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state
);
4611 ok( action
== INSTALLSTATE_SOURCE
, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action
);
4615 r
= MsiGetFeatureState(hpkg
, "orion", &state
, &action
);
4616 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4617 ok( state
== INSTALLSTATE_ABSENT
, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state
);
4618 ok( action
== INSTALLSTATE_ABSENT
, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action
);
4622 r
= MsiGetComponentState(hpkg
, "leo", &state
, &action
);
4623 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4624 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state
);
4625 ok( action
== INSTALLSTATE_LOCAL
, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action
);
4629 r
= MsiGetComponentState(hpkg
, "virgo", &state
, &action
);
4630 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4631 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state
);
4632 ok( action
== INSTALLSTATE_SOURCE
, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action
);
4636 r
= MsiGetComponentState(hpkg
, "libra", &state
, &action
);
4637 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4638 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state
);
4639 ok( action
== INSTALLSTATE_LOCAL
, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action
);
4643 r
= MsiGetComponentState(hpkg
, "cassiopeia", &state
, &action
);
4644 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4645 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state
);
4646 ok( action
== INSTALLSTATE_LOCAL
, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action
);
4650 r
= MsiGetComponentState(hpkg
, "cepheus", &state
, &action
);
4651 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4652 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4653 ok( action
== INSTALLSTATE_SOURCE
, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action
);
4657 r
= MsiGetComponentState(hpkg
, "andromeda", &state
, &action
);
4658 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4659 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state
);
4660 ok( action
== INSTALLSTATE_SOURCE
, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action
);
4664 r
= MsiGetComponentState(hpkg
, "canis", &state
, &action
);
4665 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4666 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state
);
4667 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action
);
4671 r
= MsiGetComponentState(hpkg
, "monoceros", &state
, &action
);
4672 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4673 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state
);
4674 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action
);
4678 r
= MsiGetComponentState(hpkg
, "lepus", &state
, &action
);
4679 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4680 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4681 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action
);
4685 r
= MsiGetComponentState(hpkg
, "delphinus", &state
, &action
);
4686 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4687 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4688 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action
);
4692 r
= MsiGetComponentState(hpkg
, "hydrus", &state
, &action
);
4693 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4694 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4695 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action
);
4697 MsiCloseHandle(hpkg
);
4698 DeleteFileA(msifile
);
4701 static void test_installprops(void)
4703 MSIHANDLE hpkg
, hdb
;
4704 CHAR path
[MAX_PATH
];
4711 GetCurrentDirectory(MAX_PATH
, path
);
4712 lstrcat(path
, "\\");
4713 lstrcat(path
, msifile
);
4715 hdb
= create_package_db();
4716 ok( hdb
, "failed to create database\n");
4718 hpkg
= package_from_db(hdb
);
4719 ok( hpkg
, "failed to create package\n");
4721 MsiCloseHandle(hdb
);
4724 r
= MsiGetProperty(hpkg
, "DATABASE", buf
, &size
);
4725 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4726 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
4728 RegOpenKey(HKEY_CURRENT_USER
, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1
);
4730 RegOpenKey(HKEY_LOCAL_MACHINE
, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2
);
4734 if (RegQueryValueEx(hkey1
, "DefName", NULL
, &type
, (LPBYTE
)path
, &size
) != ERROR_SUCCESS
)
4738 RegQueryValueEx(hkey2
, "RegisteredOwner", NULL
, &type
, (LPBYTE
)path
, &size
);
4742 r
= MsiGetProperty(hpkg
, "USERNAME", buf
, &size
);
4743 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4744 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
4748 if (RegQueryValueEx(hkey1
, "DefCompany", NULL
, &type
, (LPBYTE
)path
, &size
) != ERROR_SUCCESS
)
4752 RegQueryValueEx(hkey2
, "RegisteredOrganization", NULL
, &type
, (LPBYTE
)path
, &size
);
4756 r
= MsiGetProperty(hpkg
, "COMPANYNAME", buf
, &size
);
4757 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4758 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
4761 r
= MsiGetProperty(hpkg
, "VersionDatabase", buf
, &size
);
4762 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4763 trace("VersionDatabase = %s\n", buf
);
4766 r
= MsiGetProperty(hpkg
, "VersionMsi", buf
, &size
);
4767 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4768 trace("VersionMsi = %s\n", buf
);
4771 r
= MsiGetProperty(hpkg
, "Date", buf
, &size
);
4772 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4773 trace("Date = %s\n", buf
);
4776 r
= MsiGetProperty(hpkg
, "Time", buf
, &size
);
4777 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4778 trace("Time = %s\n", buf
);
4781 r
= MsiGetProperty(hpkg
, "PackageCode", buf
, &size
);
4782 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4783 trace("PackageCode = %s\n", buf
);
4785 langid
= GetUserDefaultLangID();
4786 sprintf(path
, "%d", langid
);
4789 r
= MsiGetProperty(hpkg
, "UserLanguageID", buf
, &size
);
4790 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS< got %d\n", r
);
4791 ok( !lstrcmpA(buf
, path
), "Expected \"%s\", got \"%s\"\n", path
, buf
);
4795 MsiCloseHandle(hpkg
);
4796 DeleteFile(msifile
);
4799 static void test_sourcedirprop(void)
4801 MSIHANDLE hpkg
, hdb
;
4802 CHAR source_dir
[MAX_PATH
];
4803 CHAR path
[MAX_PATH
];
4807 hdb
= create_package_db();
4808 ok ( hdb
, "failed to create package database\n" );
4810 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
4811 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
4813 hpkg
= package_from_db( hdb
);
4814 ok( hpkg
, "failed to create package\n");
4816 MsiCloseHandle( hdb
);
4819 r
= MsiGetProperty( hpkg
, "SourceDir", source_dir
, &size
);
4820 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4821 ok( !lstrlenA(source_dir
), "Expected emtpy source dir, got %s\n", source_dir
);
4824 r
= MsiGetProperty( hpkg
, "SOURCEDIR", source_dir
, &size
);
4825 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4826 ok( !lstrlenA(source_dir
), "Expected emtpy source dir, got %s\n", source_dir
);
4828 r
= MsiDoAction( hpkg
, "CostInitialize");
4829 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4832 r
= MsiGetProperty( hpkg
, "SourceDir", source_dir
, &size
);
4833 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4834 ok( !lstrlenA(source_dir
), "Expected emtpy source dir, got %s\n", source_dir
);
4837 r
= MsiGetProperty( hpkg
, "SOURCEDIR", source_dir
, &size
);
4838 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4839 ok( !lstrlenA(source_dir
), "Expected emtpy source dir, got %s\n", source_dir
);
4841 r
= MsiDoAction( hpkg
, "ResolveSource");
4842 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
4844 GetCurrentDirectory(MAX_PATH
, path
);
4845 lstrcatA(path
, "\\");
4848 r
= MsiGetProperty( hpkg
, "SourceDir", source_dir
, &size
);
4849 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4850 ok( !lstrcmpA(source_dir
, path
), "Expected %s, got %s\n", path
, source_dir
);
4853 r
= MsiGetProperty( hpkg
, "SOURCEDIR", source_dir
, &size
);
4854 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4855 ok( !lstrcmpA(source_dir
, path
), "Expected %s, got %s\n", path
, source_dir
);
4858 r
= MsiGetProperty( hpkg
, "SoUrCeDiR", source_dir
, &size
);
4859 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4860 ok( !lstrlenA(source_dir
), "Expected emtpy source dir, got %s\n", source_dir
);
4862 MsiCloseHandle(hpkg
);
4863 DeleteFileA(msifile
);
4866 static void test_prop_path(void)
4868 MSIHANDLE hpkg
, hdb
;
4869 char buffer
[MAX_PATH
], cwd
[MAX_PATH
];
4873 GetCurrentDirectory(MAX_PATH
, cwd
);
4876 hdb
= create_package_db();
4877 ok( hdb
, "failed to create database\n");
4879 r
= add_directory_entry( hdb
, "'TARGETDIR','','SourceDir'" );
4880 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
4882 r
= add_directory_entry( hdb
, "'foo','TARGETDIR','foosrc:footgt'" );
4883 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
4885 hpkg
= package_from_db(hdb
);
4886 ok( hpkg
, "failed to create package\n");
4888 r
= MsiGetSourcePath(hpkg
, "SourceDir", buffer
, &sz
);
4889 ok( r
== ERROR_DIRECTORY
, "failed to get source path\n");
4891 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", buffer
, &sz
);
4892 ok( r
== ERROR_DIRECTORY
, "failed to get source path\n");
4894 r
= MsiDoAction( hpkg
, "CostInitialize");
4895 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4899 r
= MsiGetProperty(hpkg
, "SourceDir", buffer
, &sz
);
4900 ok( r
== ERROR_SUCCESS
, "property not set\n");
4901 ok( !buffer
[0], "SourceDir should be empty\n");
4905 r
= MsiGetProperty(hpkg
, "SOURCEDIR", buffer
, &sz
);
4906 ok( r
== ERROR_SUCCESS
, "property not set\n");
4907 ok( !buffer
[0], "SourceDir should be empty\n");
4911 r
= MsiGetSourcePath(hpkg
, "SourceDir", buffer
, &sz
);
4912 ok( r
== ERROR_SUCCESS
, "failed to get source path\n");
4913 ok( !lstrcmpi(cwd
, buffer
), "SourceDir (%s) should be current dir (%s)\n", buffer
, cwd
);
4917 r
= MsiGetProperty(hpkg
, "SourceDir", buffer
, &sz
);
4918 ok( r
== ERROR_SUCCESS
, "property not set\n");
4920 ok( !lstrcmpi(cwd
, buffer
), "SourceDir (%s) should be current dir (%s)\n", buffer
, cwd
);
4925 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", buffer
, &sz
);
4926 ok( r
== ERROR_DIRECTORY
, "failed to get source path\n");
4930 r
= MsiGetProperty(hpkg
, "SOURCEDIR", buffer
, &sz
);
4931 ok( r
== ERROR_SUCCESS
, "property not set\n");
4933 ok( !lstrcmpi(cwd
, buffer
), "SourceDir (%s) should be current dir (%s)\n", buffer
, cwd
);
4936 r
= MsiSetProperty(hpkg
, "SourceDir", "goo");
4937 ok( r
== ERROR_SUCCESS
, "property not set\n");
4941 r
= MsiGetProperty(hpkg
, "SourceDir", buffer
, &sz
);
4942 ok( r
== ERROR_SUCCESS
, "property not set\n");
4943 ok( !lstrcmpi(buffer
, "goo"), "SourceDir (%s) should be goo\n", buffer
);
4947 r
= MsiGetSourcePath(hpkg
, "SourceDir", buffer
, &sz
);
4948 ok( r
== ERROR_SUCCESS
, "failed to get source path\n");
4949 ok( !lstrcmpi(buffer
, cwd
), "SourceDir (%s) should be goo\n", buffer
);
4953 r
= MsiGetProperty(hpkg
, "SourceDir", buffer
, &sz
);
4954 ok( r
== ERROR_SUCCESS
, "property not set\n");
4955 ok( !lstrcmpi(buffer
, "goo"), "SourceDir (%s) should be goo\n", buffer
);
4957 MsiCloseHandle( hpkg
);
4958 DeleteFile(msifile
);
4961 static void test_launchconditions(void)
4967 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
4969 hdb
= create_package_db();
4970 ok( hdb
, "failed to create package database\n" );
4972 r
= create_launchcondition_table( hdb
);
4973 ok( r
== ERROR_SUCCESS
, "cannot create LaunchCondition table: %d\n", r
);
4975 r
= add_launchcondition_entry( hdb
, "'X = \"1\"', 'one'" );
4976 ok( r
== ERROR_SUCCESS
, "cannot add launch condition: %d\n", r
);
4978 /* invalid condition */
4979 r
= add_launchcondition_entry( hdb
, "'X != \"1\"', 'one'" );
4980 ok( r
== ERROR_SUCCESS
, "cannot add launch condition: %d\n", r
);
4982 hpkg
= package_from_db( hdb
);
4983 ok( hpkg
, "failed to create package\n");
4985 MsiCloseHandle( hdb
);
4987 r
= MsiSetProperty( hpkg
, "X", "1" );
4988 ok( r
== ERROR_SUCCESS
, "failed to set property\n" );
4990 /* invalid conditions are ignored */
4991 r
= MsiDoAction( hpkg
, "LaunchConditions" );
4992 ok( r
== ERROR_SUCCESS
, "cost init failed\n" );
4994 /* verify LaunchConditions still does some verification */
4995 r
= MsiSetProperty( hpkg
, "X", "2" );
4996 ok( r
== ERROR_SUCCESS
, "failed to set property\n" );
4998 r
= MsiDoAction( hpkg
, "LaunchConditions" );
4999 ok( r
== ERROR_INSTALL_FAILURE
, "Expected ERROR_INSTALL_FAILURE, got %d\n", r
);
5001 MsiCloseHandle( hpkg
);
5002 DeleteFile( msifile
);
5005 static void test_ccpsearch(void)
5007 MSIHANDLE hdb
, hpkg
;
5008 CHAR prop
[MAX_PATH
];
5009 DWORD size
= MAX_PATH
;
5012 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
5014 hdb
= create_package_db();
5015 ok(hdb
, "failed to create package database\n");
5017 r
= create_ccpsearch_table(hdb
);
5018 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5020 r
= add_ccpsearch_entry(hdb
, "'CCP_random'");
5021 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5023 r
= add_ccpsearch_entry(hdb
, "'RMCCP_random'");
5024 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5026 r
= create_reglocator_table(hdb
);
5027 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5029 r
= add_reglocator_entry(hdb
, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
5030 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5032 r
= create_drlocator_table(hdb
);
5033 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5035 r
= add_drlocator_entry(hdb
, "'RMCCP_random', '', 'C:\\', '0'");
5036 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5038 r
= create_signature_table(hdb
);
5039 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5041 hpkg
= package_from_db(hdb
);
5042 ok(hpkg
, "failed to create package\n");
5044 MsiCloseHandle(hdb
);
5046 r
= MsiDoAction(hpkg
, "CCPSearch");
5047 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5049 r
= MsiGetPropertyA(hpkg
, "CCP_Success", prop
, &size
);
5050 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5051 ok(!lstrcmpA(prop
, "1"), "Expected 1, got %s\n", prop
);
5053 MsiCloseHandle(hpkg
);
5054 DeleteFileA(msifile
);
5057 static BOOL
squash_guid(LPCWSTR in
, LPWSTR out
)
5062 if (FAILED(CLSIDFromString((LPOLESTR
)in
, &guid
)))
5069 out
[11-i
] = in
[n
++];
5072 out
[15-i
] = in
[n
++];
5076 out
[17+i
*2] = in
[n
++];
5077 out
[16+i
*2] = in
[n
++];
5082 out
[17+i
*2] = in
[n
++];
5083 out
[16+i
*2] = in
[n
++];
5089 static void set_component_path(LPCSTR filename
, LPCSTR guid
)
5091 WCHAR guidW
[MAX_PATH
];
5092 WCHAR squashedW
[MAX_PATH
];
5093 CHAR squashed
[MAX_PATH
];
5094 CHAR substr
[MAX_PATH
];
5095 CHAR path
[MAX_PATH
];
5098 MultiByteToWideChar(CP_ACP
, 0, guid
, -1, guidW
, MAX_PATH
);
5099 squash_guid(guidW
, squashedW
);
5100 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
5102 lstrcpyA(substr
, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
5103 "Installer\\UserData\\S-1-5-18\\Components\\");
5104 lstrcatA(substr
, squashed
);
5106 RegCreateKeyA(HKEY_LOCAL_MACHINE
, substr
, &hkey
);
5108 lstrcpyA(path
, CURR_DIR
);
5109 lstrcatA(path
, "\\");
5110 lstrcatA(path
, filename
);
5112 /* just using a random squashed product code */
5113 RegSetValueExA(hkey
, "7D2F387510109040002000060BECB6AB", 0,
5114 REG_SZ
, (LPBYTE
)path
, lstrlenA(path
));
5118 lstrcpyA(substr
, "SOFTWARE\\Classes\\Installer\\Products\\7D2F387510109040002000060BECB6AB");
5119 RegCreateKeyA(HKEY_LOCAL_MACHINE
, substr
, &hkey
);
5122 static void delete_component_path(LPCSTR guid
)
5124 WCHAR guidW
[MAX_PATH
];
5125 WCHAR squashedW
[MAX_PATH
];
5126 WCHAR substrW
[MAX_PATH
];
5127 CHAR squashed
[MAX_PATH
];
5128 CHAR substr
[MAX_PATH
];
5130 MultiByteToWideChar(CP_ACP
, 0, guid
, -1, guidW
, MAX_PATH
);
5131 squash_guid(guidW
, squashedW
);
5132 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
5134 lstrcpyA(substr
, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
5135 "Installer\\UserData\\S-1-5-18\\Components\\");
5136 lstrcatA(substr
, squashed
);
5138 MultiByteToWideChar(CP_ACP
, 0, substr
, -1, substrW
, MAX_PATH
);
5139 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE
, substrW
);
5141 lstrcpyA(substr
, "SOFTWARE\\Classes\\Installer\\Products\\7D2F387510109040002000060BECB6AB");
5142 MultiByteToWideChar(CP_ACP
, 0, substr
, -1, substrW
, MAX_PATH
);
5143 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE
, substrW
);
5146 static void test_complocator(void)
5148 MSIHANDLE hdb
, hpkg
;
5150 CHAR prop
[MAX_PATH
];
5151 CHAR expected
[MAX_PATH
];
5152 DWORD size
= MAX_PATH
;
5154 hdb
= create_package_db();
5155 ok(hdb
, "failed to create package database\n");
5157 r
= create_appsearch_table(hdb
);
5158 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5160 r
= add_appsearch_entry(hdb
, "'ABELISAURUS', 'abelisaurus'");
5161 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5163 r
= add_appsearch_entry(hdb
, "'BACTROSAURUS', 'bactrosaurus'");
5164 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5166 r
= add_appsearch_entry(hdb
, "'CAMELOTIA', 'camelotia'");
5167 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5169 r
= add_appsearch_entry(hdb
, "'DICLONIUS', 'diclonius'");
5170 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5172 r
= add_appsearch_entry(hdb
, "'ECHINODON', 'echinodon'");
5173 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5175 r
= add_appsearch_entry(hdb
, "'FALCARIUS', 'falcarius'");
5176 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5178 r
= add_appsearch_entry(hdb
, "'GALLIMIMUS', 'gallimimus'");
5179 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5181 r
= add_appsearch_entry(hdb
, "'HAGRYPHUS', 'hagryphus'");
5182 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5184 r
= add_appsearch_entry(hdb
, "'IGUANODON', 'iguanodon'");
5185 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5187 r
= add_appsearch_entry(hdb
, "'JOBARIA', 'jobaria'");
5188 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5190 r
= add_appsearch_entry(hdb
, "'KAKURU', 'kakuru'");
5191 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5193 r
= add_appsearch_entry(hdb
, "'LABOCANIA', 'labocania'");
5194 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5196 r
= add_appsearch_entry(hdb
, "'MEGARAPTOR', 'megaraptor'");
5197 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5199 r
= add_appsearch_entry(hdb
, "'NEOSODON', 'neosodon'");
5200 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5202 r
= add_appsearch_entry(hdb
, "'OLOROTITAN', 'olorotitan'");
5203 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5205 r
= add_appsearch_entry(hdb
, "'PANTYDRACO', 'pantydraco'");
5206 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5208 r
= create_complocator_table(hdb
);
5209 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5211 r
= add_complocator_entry(hdb
, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
5212 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5214 r
= add_complocator_entry(hdb
, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
5215 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5217 r
= add_complocator_entry(hdb
, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
5218 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5220 r
= add_complocator_entry(hdb
, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
5221 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5223 r
= add_complocator_entry(hdb
, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
5224 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5226 r
= add_complocator_entry(hdb
, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
5227 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5229 r
= add_complocator_entry(hdb
, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
5230 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5232 r
= add_complocator_entry(hdb
, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
5233 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5235 r
= add_complocator_entry(hdb
, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
5236 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5238 r
= add_complocator_entry(hdb
, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
5239 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5241 r
= add_complocator_entry(hdb
, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
5242 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5244 r
= add_complocator_entry(hdb
, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
5245 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5247 r
= add_complocator_entry(hdb
, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
5248 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5250 r
= add_complocator_entry(hdb
, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
5251 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5253 r
= add_complocator_entry(hdb
, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
5254 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5256 r
= add_complocator_entry(hdb
, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
5257 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5259 r
= create_signature_table(hdb
);
5260 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5262 r
= add_signature_entry(hdb
, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
5263 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5265 r
= add_signature_entry(hdb
, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
5266 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5268 r
= add_signature_entry(hdb
, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
5269 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5271 r
= add_signature_entry(hdb
, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
5272 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5274 r
= add_signature_entry(hdb
, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
5275 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5277 r
= add_signature_entry(hdb
, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
5278 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5280 r
= add_signature_entry(hdb
, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
5281 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5283 r
= add_signature_entry(hdb
, "'labocania', 'labocania', '', '', '', '', '', '', ''");
5284 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5286 hpkg
= package_from_db(hdb
);
5287 ok(hpkg
, "failed to create package\n");
5289 MsiCloseHandle(hdb
);
5291 create_test_file("abelisaurus");
5292 create_test_file("bactrosaurus");
5293 create_test_file("camelotia");
5294 create_test_file("diclonius");
5295 create_test_file("echinodon");
5296 create_test_file("falcarius");
5297 create_test_file("gallimimus");
5298 create_test_file("hagryphus");
5299 CreateDirectoryA("iguanodon", NULL
);
5300 CreateDirectoryA("jobaria", NULL
);
5301 CreateDirectoryA("kakuru", NULL
);
5302 CreateDirectoryA("labocania", NULL
);
5303 CreateDirectoryA("megaraptor", NULL
);
5304 CreateDirectoryA("neosodon", NULL
);
5305 CreateDirectoryA("olorotitan", NULL
);
5306 CreateDirectoryA("pantydraco", NULL
);
5308 set_component_path("abelisaurus", "{E3619EED-305A-418C-B9C7-F7D7377F0934}");
5309 set_component_path("bactrosaurus", "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}");
5310 set_component_path("echinodon", "{A19E16C5-C75D-4699-8111-C4338C40C3CB}");
5311 set_component_path("falcarius", "{17762FA1-A7AE-4CC6-8827-62873C35361D}");
5312 set_component_path("iguanodon", "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}");
5313 set_component_path("jobaria", "{243C22B1-8C51-4151-B9D1-1AE5265E079E}");
5314 set_component_path("megaraptor", "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}");
5315 set_component_path("neosodon", "{0B499649-197A-48EF-93D2-AF1C17ED6E90}");
5317 r
= MsiDoAction(hpkg
, "AppSearch");
5318 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5321 r
= MsiGetPropertyA(hpkg
, "ABELISAURUS", prop
, &size
);
5322 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5324 lstrcpyA(expected
, CURR_DIR
);
5325 lstrcatA(expected
, "\\abelisaurus");
5326 ok(!lstrcmpA(prop
, expected
), "Expected %s, got %s\n", expected
, prop
);
5329 r
= MsiGetPropertyA(hpkg
, "BACTROSAURUS", prop
, &size
);
5330 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5331 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5334 r
= MsiGetPropertyA(hpkg
, "CAMELOTIA", prop
, &size
);
5335 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5336 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5339 r
= MsiGetPropertyA(hpkg
, "DICLONIUS", prop
, &size
);
5340 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5341 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5344 r
= MsiGetPropertyA(hpkg
, "ECHINODON", prop
, &size
);
5345 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5347 lstrcpyA(expected
, CURR_DIR
);
5348 lstrcatA(expected
, "\\");
5349 ok(!lstrcmpA(prop
, expected
), "Expected %s, got %s\n", expected
, prop
);
5352 r
= MsiGetPropertyA(hpkg
, "FALCARIUS", prop
, &size
);
5353 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5354 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5357 r
= MsiGetPropertyA(hpkg
, "GALLIMIMUS", prop
, &size
);
5358 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5359 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5362 r
= MsiGetPropertyA(hpkg
, "HAGRYPHUS", prop
, &size
);
5363 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5364 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5367 r
= MsiGetPropertyA(hpkg
, "IGUANODON", prop
, &size
);
5368 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5369 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5372 r
= MsiGetPropertyA(hpkg
, "JOBARIA", prop
, &size
);
5373 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5374 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5377 r
= MsiGetPropertyA(hpkg
, "KAKURU", prop
, &size
);
5378 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5379 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5382 r
= MsiGetPropertyA(hpkg
, "LABOCANIA", prop
, &size
);
5383 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5384 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5387 r
= MsiGetPropertyA(hpkg
, "MEGARAPTOR", prop
, &size
);
5388 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5390 lstrcpyA(expected
, CURR_DIR
);
5391 lstrcatA(expected
, "\\");
5392 ok(!lstrcmpA(prop
, expected
), "Expected %s, got %s\n", expected
, prop
);
5395 r
= MsiGetPropertyA(hpkg
, "NEOSODON", prop
, &size
);
5396 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5398 lstrcpyA(expected
, CURR_DIR
);
5399 lstrcatA(expected
, "\\neosodon\\");
5400 ok(!lstrcmpA(prop
, expected
), "Expected %s, got %s\n", expected
, prop
);
5403 r
= MsiGetPropertyA(hpkg
, "OLOROTITAN", prop
, &size
);
5404 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5405 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5408 r
= MsiGetPropertyA(hpkg
, "PANTYDRACO", prop
, &size
);
5409 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5410 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5412 MsiCloseHandle(hpkg
);
5413 DeleteFileA("abelisaurus");
5414 DeleteFileA("bactrosaurus");
5415 DeleteFileA("camelotia");
5416 DeleteFileA("diclonius");
5417 DeleteFileA("echinodon");
5418 DeleteFileA("falcarius");
5419 DeleteFileA("gallimimus");
5420 DeleteFileA("hagryphus");
5421 RemoveDirectoryA("iguanodon");
5422 RemoveDirectoryA("jobaria");
5423 RemoveDirectoryA("kakuru");
5424 RemoveDirectoryA("labocania");
5425 RemoveDirectoryA("megaraptor");
5426 RemoveDirectoryA("neosodon");
5427 RemoveDirectoryA("olorotitan");
5428 RemoveDirectoryA("pantydraco");
5429 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}");
5430 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}");
5431 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}");
5432 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}");
5433 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}");
5434 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}");
5435 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}");
5436 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}");
5437 DeleteFileA(msifile
);
5442 GetCurrentDirectoryA(MAX_PATH
, CURR_DIR
);
5444 test_createpackage();
5445 test_getsourcepath_bad();
5446 test_getsourcepath();
5448 test_gettargetpath_bad();
5449 test_settargetpath();
5451 test_property_table();
5454 test_formatrecord2();
5459 test_featureparents();
5460 test_installprops();
5461 test_sourcedirprop();
5463 test_launchconditions();