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
, "0 = 0");
990 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
992 r
= MsiEvaluateCondition(hpkg
, "0 <> 0");
993 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
995 r
= MsiEvaluateCondition(hpkg
, "0 = 1");
996 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
998 r
= MsiEvaluateCondition(hpkg
, "0 > 1");
999 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1001 r
= MsiEvaluateCondition(hpkg
, "0 ~> 1");
1002 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1004 r
= MsiEvaluateCondition(hpkg
, "1 > 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
, "0 >= 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
, "1 >= 1");
1017 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1019 r
= MsiEvaluateCondition(hpkg
, "1 ~>= 1");
1020 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1022 r
= MsiEvaluateCondition(hpkg
, "0 < 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
, "1 < 1");
1029 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1031 r
= MsiEvaluateCondition(hpkg
, "1 ~< 1");
1032 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1034 r
= MsiEvaluateCondition(hpkg
, "0 <= 1");
1035 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1037 r
= MsiEvaluateCondition(hpkg
, "0 ~<= 1");
1038 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1040 r
= MsiEvaluateCondition(hpkg
, "1 <= 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
, "0 >=");
1047 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1049 r
= MsiEvaluateCondition(hpkg
, " ");
1050 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
1052 r
= MsiEvaluateCondition(hpkg
, "LicView <> \"1\"");
1053 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1055 r
= MsiEvaluateCondition(hpkg
, "LicView <> \"0\"");
1056 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1058 r
= MsiEvaluateCondition(hpkg
, "LicView <> LicView");
1059 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1061 r
= MsiEvaluateCondition(hpkg
, "not 0");
1062 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1064 r
= MsiEvaluateCondition(hpkg
, "not LicView");
1065 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1067 r
= MsiEvaluateCondition(hpkg
, "not \"A\"");
1068 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1070 r
= MsiEvaluateCondition(hpkg
, "~not \"A\"");
1071 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1073 r
= MsiEvaluateCondition(hpkg
, "\"0\"");
1074 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1076 r
= MsiEvaluateCondition(hpkg
, "1 and 2");
1077 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1079 r
= MsiEvaluateCondition(hpkg
, "not 0 and 3");
1080 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1082 r
= MsiEvaluateCondition(hpkg
, "not 0 and 0");
1083 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1085 r
= MsiEvaluateCondition(hpkg
, "not 0 or 1");
1086 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1088 r
= MsiEvaluateCondition(hpkg
, "(0)");
1089 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1091 r
= MsiEvaluateCondition(hpkg
, "(((((1))))))");
1092 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1094 r
= MsiEvaluateCondition(hpkg
, "(((((1)))))");
1095 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1097 r
= MsiEvaluateCondition(hpkg
, " \"A\" < \"B\" ");
1098 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1100 r
= MsiEvaluateCondition(hpkg
, " \"A\" > \"B\" ");
1101 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1103 r
= MsiEvaluateCondition(hpkg
, " \"1\" > \"12\" ");
1104 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1106 r
= MsiEvaluateCondition(hpkg
, " \"100\" < \"21\" ");
1107 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1109 r
= MsiEvaluateCondition(hpkg
, "0 < > 0");
1110 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1112 r
= MsiEvaluateCondition(hpkg
, "(1<<1) == 2");
1113 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1115 r
= MsiEvaluateCondition(hpkg
, " \"A\" = \"a\" ");
1116 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1118 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~ = \"a\" ");
1119 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1121 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~= \"a\" ");
1122 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1124 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~= 1 ");
1125 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1127 r
= MsiEvaluateCondition(hpkg
, " \"A\" = 1 ");
1128 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1130 r
= MsiEvaluateCondition(hpkg
, " 1 ~= 1 ");
1131 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1133 r
= MsiEvaluateCondition(hpkg
, " 1 ~= \"1\" ");
1134 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1136 r
= MsiEvaluateCondition(hpkg
, " 1 = \"1\" ");
1137 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1139 r
= MsiEvaluateCondition(hpkg
, " 0 = \"1\" ");
1140 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1142 r
= MsiEvaluateCondition(hpkg
, " 0 < \"100\" ");
1143 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1145 r
= MsiEvaluateCondition(hpkg
, " 100 > \"0\" ");
1146 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1148 r
= MsiEvaluateCondition(hpkg
, "1 XOR 1");
1149 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1151 r
= MsiEvaluateCondition(hpkg
, "1 IMP 1");
1152 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1154 r
= MsiEvaluateCondition(hpkg
, "1 IMP 0");
1155 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1157 r
= MsiEvaluateCondition(hpkg
, "0 IMP 0");
1158 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1160 r
= MsiEvaluateCondition(hpkg
, "0 EQV 0");
1161 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1163 r
= MsiEvaluateCondition(hpkg
, "0 EQV 1");
1164 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1166 r
= MsiEvaluateCondition(hpkg
, "1 IMP 1 OR 0");
1167 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1169 r
= MsiEvaluateCondition(hpkg
, "1 IMPL 1");
1170 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1172 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" >< \"S\" ");
1173 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1175 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"s\" ");
1176 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1178 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"\" ");
1179 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1181 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"sss\" ");
1182 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1184 MsiSetProperty(hpkg
, "mm", "5" );
1186 r
= MsiEvaluateCondition(hpkg
, "mm = 5");
1187 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1189 r
= MsiEvaluateCondition(hpkg
, "mm < 6");
1190 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1192 r
= MsiEvaluateCondition(hpkg
, "mm <= 5");
1193 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1195 r
= MsiEvaluateCondition(hpkg
, "mm > 4");
1196 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1198 r
= MsiEvaluateCondition(hpkg
, "mm < 12");
1199 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1201 r
= MsiEvaluateCondition(hpkg
, "mm = \"5\"");
1202 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1204 r
= MsiEvaluateCondition(hpkg
, "0 = \"\"");
1205 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1207 r
= MsiEvaluateCondition(hpkg
, "0 AND \"\"");
1208 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1210 r
= MsiEvaluateCondition(hpkg
, "1 AND \"\"");
1211 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1213 r
= MsiEvaluateCondition(hpkg
, "1 AND \"1\"");
1214 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1216 r
= MsiEvaluateCondition(hpkg
, "3 >< 1");
1217 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1219 r
= MsiEvaluateCondition(hpkg
, "3 >< 4");
1220 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1222 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 0");
1223 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1225 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 1");
1226 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1228 r
= MsiEvaluateCondition(hpkg
, "NOT 1 OR 0");
1229 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1231 r
= MsiEvaluateCondition(hpkg
, "0 AND 1 OR 1");
1232 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1234 r
= MsiEvaluateCondition(hpkg
, "0 AND 0 OR 1");
1235 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1237 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 1 OR 0");
1238 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1240 r
= MsiEvaluateCondition(hpkg
, "_1 = _1");
1241 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1243 r
= MsiEvaluateCondition(hpkg
, "( 1 AND 1 ) = 2");
1244 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1246 r
= MsiEvaluateCondition(hpkg
, "NOT ( 1 AND 1 )");
1247 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1249 r
= MsiEvaluateCondition(hpkg
, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1250 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1252 r
= MsiEvaluateCondition(hpkg
, "Installed<>\"\"");
1253 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1255 r
= MsiEvaluateCondition(hpkg
, "NOT 1 AND 0");
1256 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1258 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1259 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1261 r
= MsiEvaluateCondition(hpkg
, "bandalmael<>0");
1262 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1264 r
= MsiEvaluateCondition(hpkg
, "bandalmael<0");
1265 ok( r
== MSICONDITION_FALSE
, "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_TRUE
, "wrong return val\n");
1279 MsiSetProperty(hpkg
, "bandalmael", "0" );
1280 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1281 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1283 MsiSetProperty(hpkg
, "bandalmael", "" );
1284 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1285 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1287 MsiSetProperty(hpkg
, "bandalmael", "asdf" );
1288 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1289 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1291 MsiSetProperty(hpkg
, "bandalmael", "0asdf" );
1292 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1293 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1295 MsiSetProperty(hpkg
, "bandalmael", "0 " );
1296 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1297 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1299 MsiSetProperty(hpkg
, "bandalmael", "-0" );
1300 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1301 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1303 MsiSetProperty(hpkg
, "bandalmael", "0000000000000" );
1304 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1305 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1307 MsiSetProperty(hpkg
, "bandalmael", "--0" );
1308 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1309 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1311 MsiSetProperty(hpkg
, "bandalmael", "0x00" );
1312 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1313 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1315 MsiSetProperty(hpkg
, "bandalmael", "-" );
1316 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1317 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1319 MsiSetProperty(hpkg
, "bandalmael", "+0" );
1320 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1321 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1323 MsiSetProperty(hpkg
, "bandalmael", "0.0" );
1324 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1325 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1326 r
= MsiEvaluateCondition(hpkg
, "bandalmael<>0");
1327 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1329 MsiSetProperty(hpkg
, "one", "hi");
1330 MsiSetProperty(hpkg
, "two", "hithere");
1331 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1332 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1334 MsiSetProperty(hpkg
, "one", "hithere");
1335 MsiSetProperty(hpkg
, "two", "hi");
1336 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1337 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1339 MsiSetProperty(hpkg
, "one", "hello");
1340 MsiSetProperty(hpkg
, "two", "hi");
1341 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1342 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1344 MsiSetProperty(hpkg
, "one", "hellohithere");
1345 MsiSetProperty(hpkg
, "two", "hi");
1346 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1347 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1349 MsiSetProperty(hpkg
, "one", "");
1350 MsiSetProperty(hpkg
, "two", "hi");
1351 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1352 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1354 MsiSetProperty(hpkg
, "one", "hi");
1355 MsiSetProperty(hpkg
, "two", "");
1356 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1357 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1359 MsiSetProperty(hpkg
, "one", "");
1360 MsiSetProperty(hpkg
, "two", "");
1361 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1362 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1364 MsiSetProperty(hpkg
, "one", "1234");
1365 MsiSetProperty(hpkg
, "two", "1");
1366 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1367 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1369 MsiSetProperty(hpkg
, "one", "one 1234");
1370 MsiSetProperty(hpkg
, "two", "1");
1371 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1372 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1374 MsiSetProperty(hpkg
, "one", "hithere");
1375 MsiSetProperty(hpkg
, "two", "hi");
1376 r
= MsiEvaluateCondition(hpkg
, "one << two");
1377 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1379 MsiSetProperty(hpkg
, "one", "hi");
1380 MsiSetProperty(hpkg
, "two", "hithere");
1381 r
= MsiEvaluateCondition(hpkg
, "one << two");
1382 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1384 MsiSetProperty(hpkg
, "one", "hi");
1385 MsiSetProperty(hpkg
, "two", "hi");
1386 r
= MsiEvaluateCondition(hpkg
, "one << two");
1387 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1389 MsiSetProperty(hpkg
, "one", "abcdhithere");
1390 MsiSetProperty(hpkg
, "two", "hi");
1391 r
= MsiEvaluateCondition(hpkg
, "one << two");
1392 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1394 MsiSetProperty(hpkg
, "one", "");
1395 MsiSetProperty(hpkg
, "two", "hi");
1396 r
= MsiEvaluateCondition(hpkg
, "one << two");
1397 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1399 MsiSetProperty(hpkg
, "one", "hithere");
1400 MsiSetProperty(hpkg
, "two", "");
1401 r
= MsiEvaluateCondition(hpkg
, "one << two");
1402 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1404 MsiSetProperty(hpkg
, "one", "");
1405 MsiSetProperty(hpkg
, "two", "");
1406 r
= MsiEvaluateCondition(hpkg
, "one << two");
1407 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1409 MsiSetProperty(hpkg
, "one", "1234");
1410 MsiSetProperty(hpkg
, "two", "1");
1411 r
= MsiEvaluateCondition(hpkg
, "one << two");
1412 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1414 MsiSetProperty(hpkg
, "one", "1234 one");
1415 MsiSetProperty(hpkg
, "two", "1");
1416 r
= MsiEvaluateCondition(hpkg
, "one << two");
1417 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1419 MsiSetProperty(hpkg
, "one", "hithere");
1420 MsiSetProperty(hpkg
, "two", "there");
1421 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1422 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1424 MsiSetProperty(hpkg
, "one", "hithere");
1425 MsiSetProperty(hpkg
, "two", "hi");
1426 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1427 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1429 MsiSetProperty(hpkg
, "one", "there");
1430 MsiSetProperty(hpkg
, "two", "hithere");
1431 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1432 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1434 MsiSetProperty(hpkg
, "one", "there");
1435 MsiSetProperty(hpkg
, "two", "there");
1436 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1437 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1439 MsiSetProperty(hpkg
, "one", "abcdhithere");
1440 MsiSetProperty(hpkg
, "two", "hi");
1441 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1442 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1444 MsiSetProperty(hpkg
, "one", "");
1445 MsiSetProperty(hpkg
, "two", "there");
1446 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1447 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1449 MsiSetProperty(hpkg
, "one", "there");
1450 MsiSetProperty(hpkg
, "two", "");
1451 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1452 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1454 MsiSetProperty(hpkg
, "one", "");
1455 MsiSetProperty(hpkg
, "two", "");
1456 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1457 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1459 MsiSetProperty(hpkg
, "one", "1234");
1460 MsiSetProperty(hpkg
, "two", "4");
1461 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1462 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1464 MsiSetProperty(hpkg
, "one", "one 1234");
1465 MsiSetProperty(hpkg
, "two", "4");
1466 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1467 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1469 MsiSetProperty(hpkg
, "MsiNetAssemblySupport", NULL
); /* make sure it's empty */
1471 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322\"");
1472 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1474 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport > \"1.1.4322\"");
1475 ok( r
== MSICONDITION_FALSE
, "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_TRUE
, "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 < \"abcd\"");
1490 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1492 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a1.1.4322\"");
1493 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1495 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322a\"");
1496 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1498 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1499 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1501 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1502 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1504 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1505 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1507 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"1.1");
1508 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1510 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"1.1\"");
1511 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1513 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"12.1\"");
1514 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1516 r
= MsiEvaluateCondition(hpkg
, "\"02.1\" < \"2.11\"");
1517 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1519 r
= MsiEvaluateCondition(hpkg
, "\"02.1.1\" < \"2.1\"");
1520 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1522 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1\"");
1523 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1525 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1\"");
1526 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1528 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"0\"");
1529 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1531 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"-1\"");
1532 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1534 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a\"");
1535 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1537 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"!\"");
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 < \"azAZ_\"");
1550 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1552 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a[a]\"");
1553 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1555 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a[a]a\"");
1556 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1558 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a]\"");
1559 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1561 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a]a\"");
1562 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1564 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"{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 MsiSetProperty(hpkg
, "MsiNetAssemblySupport", "1.1.4322");
1583 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322\"");
1584 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1586 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.14322\"");
1587 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1589 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.5\"");
1590 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1592 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1\"");
1593 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1595 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1\"");
1596 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1598 MsiSetProperty(hpkg
, "one", "1");
1599 r
= MsiEvaluateCondition(hpkg
, "one < \"1\"");
1600 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1602 MsiSetProperty(hpkg
, "X", "5.0");
1604 r
= MsiEvaluateCondition(hpkg
, "X != \"\"");
1605 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1607 r
= MsiEvaluateCondition(hpkg
, "X =\"5.0\"");
1608 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1610 r
= MsiEvaluateCondition(hpkg
, "X =\"5.1\"");
1611 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1613 r
= MsiEvaluateCondition(hpkg
, "X =\"6.0\"");
1614 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1616 r
= MsiEvaluateCondition(hpkg
, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1617 ok( r
== MSICONDITION_TRUE
, "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 !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1623 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1625 MsiCloseHandle( hpkg
);
1626 DeleteFile(msifile
);
1629 static BOOL
check_prop_empty( MSIHANDLE hpkg
, const char * prop
)
1637 r
= MsiGetProperty( hpkg
, prop
, buffer
, &sz
);
1638 return r
== ERROR_SUCCESS
&& buffer
[0] == 0 && sz
== 0;
1641 static void test_props(void)
1643 MSIHANDLE hpkg
, hdb
;
1648 hdb
= create_package_db();
1650 "CREATE TABLE `Property` ( "
1651 "`Property` CHAR(255) NOT NULL, "
1652 "`Value` CHAR(255) "
1653 "PRIMARY KEY `Property`)" );
1654 ok( r
== ERROR_SUCCESS
, "Failed\n" );
1657 "INSERT INTO `Property` "
1658 "(`Property`, `Value`) "
1659 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1660 ok( r
== ERROR_SUCCESS
, "Failed\n" );
1662 hpkg
= package_from_db( hdb
);
1663 ok( hpkg
, "failed to create package\n");
1665 /* test invalid values */
1666 r
= MsiGetProperty( 0, NULL
, NULL
, NULL
);
1667 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1669 r
= MsiGetProperty( hpkg
, NULL
, NULL
, NULL
);
1670 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1672 r
= MsiGetProperty( hpkg
, "boo", NULL
, NULL
);
1673 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1675 r
= MsiGetProperty( hpkg
, "boo", buffer
, NULL
);
1676 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1678 /* test retrieving an empty/nonexistent property */
1680 r
= MsiGetProperty( hpkg
, "boo", NULL
, &sz
);
1681 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1682 ok( sz
== 0, "wrong size returned\n");
1684 check_prop_empty( hpkg
, "boo");
1687 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1688 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1689 ok( !strcmp(buffer
,"x"), "buffer was changed\n");
1690 ok( sz
== 0, "wrong size returned\n");
1694 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1695 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1696 ok( buffer
[0] == 0, "buffer was not changed\n");
1697 ok( sz
== 0, "wrong size returned\n");
1699 /* set the property to something */
1700 r
= MsiSetProperty( 0, NULL
, NULL
);
1701 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
1703 r
= MsiSetProperty( hpkg
, NULL
, NULL
);
1704 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1706 r
= MsiSetProperty( hpkg
, "", NULL
);
1707 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1709 /* try set and get some illegal property identifiers */
1710 r
= MsiSetProperty( hpkg
, "", "asdf" );
1711 ok( r
== ERROR_FUNCTION_FAILED
, "wrong return val\n");
1713 r
= MsiSetProperty( hpkg
, "=", "asdf" );
1714 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1716 r
= MsiSetProperty( hpkg
, " ", "asdf" );
1717 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1719 r
= MsiSetProperty( hpkg
, "'", "asdf" );
1720 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1724 r
= MsiGetProperty( hpkg
, "'", buffer
, &sz
);
1725 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1726 ok( !strcmp(buffer
,"asdf"), "buffer was not changed\n");
1728 /* set empty values */
1729 r
= MsiSetProperty( hpkg
, "boo", NULL
);
1730 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1731 ok( check_prop_empty( hpkg
, "boo"), "prop wasn't empty\n");
1733 r
= MsiSetProperty( hpkg
, "boo", "" );
1734 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1735 ok( check_prop_empty( hpkg
, "boo"), "prop wasn't empty\n");
1737 /* set a non-empty value */
1738 r
= MsiSetProperty( hpkg
, "boo", "xyz" );
1739 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1743 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1744 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1745 ok( buffer
[0] == 0, "buffer was not changed\n");
1746 ok( sz
== 3, "wrong size returned\n");
1750 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1751 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1752 ok( !strcmp(buffer
,"xyz"), "buffer was not changed\n");
1753 ok( sz
== 3, "wrong size returned\n");
1757 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1758 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1759 ok( !strcmp(buffer
,"xy"), "buffer was not changed\n");
1760 ok( sz
== 3, "wrong size returned\n");
1762 r
= MsiSetProperty(hpkg
, "SourceDir", "foo");
1763 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1766 r
= MsiGetProperty(hpkg
, "SOURCEDIR", buffer
, &sz
);
1767 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1768 ok( !strcmp(buffer
,""), "buffer wrong\n");
1769 ok( sz
== 0, "wrong size returned\n");
1772 r
= MsiGetProperty(hpkg
, "SOMERANDOMNAME", buffer
, &sz
);
1773 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1774 ok( !strcmp(buffer
,""), "buffer wrong\n");
1775 ok( sz
== 0, "wrong size returned\n");
1778 r
= MsiGetProperty(hpkg
, "SourceDir", buffer
, &sz
);
1779 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1780 ok( !strcmp(buffer
,"foo"), "buffer wrong\n");
1781 ok( sz
== 3, "wrong size returned\n");
1783 r
= MsiSetProperty(hpkg
, "MetadataCompName", "Photoshop.dll");
1784 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1787 r
= MsiGetProperty(hpkg
, "MetadataCompName", NULL
, &sz
);
1788 ok( r
== ERROR_SUCCESS
, "return wrong\n");
1789 ok( sz
== 13, "size wrong (%d)\n", sz
);
1792 r
= MsiGetProperty(hpkg
, "MetadataCompName", buffer
, &sz
);
1793 ok( r
== ERROR_MORE_DATA
, "return wrong\n");
1794 ok( !strcmp(buffer
,"Photoshop.dl"), "buffer wrong\n");
1796 r
= MsiSetProperty(hpkg
, "property", "value");
1797 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1800 r
= MsiGetProperty(hpkg
, "property", buffer
, &sz
);
1801 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1802 ok( !strcmp(buffer
, "value"), "Expected value, got %s\n", buffer
);
1804 r
= MsiSetProperty(hpkg
, "property", NULL
);
1805 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1808 r
= MsiGetProperty(hpkg
, "property", buffer
, &sz
);
1809 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1810 ok( !strlen(buffer
), "Expected empty string, got %s\n", buffer
);
1812 MsiCloseHandle( hpkg
);
1813 DeleteFile(msifile
);
1816 static BOOL
find_prop_in_property(MSIHANDLE hdb
, LPCSTR prop
, LPCSTR val
)
1818 MSIHANDLE hview
, hrec
;
1820 CHAR buffer
[MAX_PATH
];
1824 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Property`", &hview
);
1825 ok(r
== ERROR_SUCCESS
, "MsiDatabaseOpenView failed\n");
1826 r
= MsiViewExecute(hview
, 0);
1827 ok(r
== ERROR_SUCCESS
, "MsiViewExecute failed\n");
1830 while (r
== ERROR_SUCCESS
&& !found
)
1832 r
= MsiViewFetch(hview
, &hrec
);
1833 if (r
!= ERROR_SUCCESS
) break;
1836 r
= MsiRecordGetString(hrec
, 1, buffer
, &sz
);
1837 if (r
== ERROR_SUCCESS
&& !lstrcmpA(buffer
, prop
))
1840 r
= MsiRecordGetString(hrec
, 2, buffer
, &sz
);
1841 if (r
== ERROR_SUCCESS
&& !lstrcmpA(buffer
, val
))
1845 MsiCloseHandle(hrec
);
1848 MsiViewClose(hview
);
1849 MsiCloseHandle(hview
);
1854 static void test_property_table(void)
1858 MSIHANDLE hpkg
, hdb
, hrec
;
1859 char buffer
[MAX_PATH
];
1863 hdb
= create_package_db();
1864 ok( hdb
, "failed to create package\n");
1866 hpkg
= package_from_db(hdb
);
1867 ok( hpkg
, "failed to create package\n");
1869 MsiCloseHandle(hdb
);
1871 hdb
= MsiGetActiveDatabase(hpkg
);
1873 query
= "CREATE TABLE `_Property` ( "
1874 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1875 r
= run_query(hdb
, query
);
1876 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
1878 MsiCloseHandle(hdb
);
1879 MsiCloseHandle(hpkg
);
1880 DeleteFile(msifile
);
1882 hdb
= create_package_db();
1883 ok( hdb
, "failed to create package\n");
1885 query
= "CREATE TABLE `_Property` ( "
1886 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1887 r
= run_query(hdb
, query
);
1888 ok(r
== ERROR_SUCCESS
, "failed to create table\n");
1890 query
= "ALTER `_Property` ADD `foo` INTEGER";
1891 r
= run_query(hdb
, query
);
1892 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "failed to add column\n");
1894 query
= "ALTER TABLE `_Property` ADD `foo` INTEGER";
1895 r
= run_query(hdb
, query
);
1896 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "failed to add column\n");
1898 query
= "ALTER TABLE `_Property` ADD `extra` INTEGER";
1899 r
= run_query(hdb
, query
);
1900 ok(r
== ERROR_SUCCESS
, "failed to add column\n");
1902 hpkg
= package_from_db(hdb
);
1905 ok(!hpkg
, "package should not be created\n");
1908 MsiCloseHandle(hdb
);
1909 MsiCloseHandle(hpkg
);
1910 DeleteFile(msifile
);
1912 hdb
= create_package_db();
1913 ok (hdb
, "failed to create package database\n");
1915 r
= create_property_table(hdb
);
1916 ok(r
== ERROR_SUCCESS
, "cannot create Property table: %d\n", r
);
1918 r
= add_property_entry(hdb
, "'prop', 'val'");
1919 ok(r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
1921 hpkg
= package_from_db(hdb
);
1922 ok(hpkg
, "failed to create package\n");
1924 MsiCloseHandle(hdb
);
1927 r
= MsiGetProperty(hpkg
, "prop", buffer
, &sz
);
1928 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1929 ok(!lstrcmp(buffer
, "val"), "Expected val, got %s\n", buffer
);
1931 hdb
= MsiGetActiveDatabase(hpkg
);
1933 found
= find_prop_in_property(hdb
, "prop", "val");
1934 ok(found
, "prop should be in the _Property table\n");
1936 r
= add_property_entry(hdb
, "'dantes', 'mercedes'");
1937 ok(r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
1939 query
= "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
1940 r
= do_query(hdb
, query
, &hrec
);
1941 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
1943 found
= find_prop_in_property(hdb
, "dantes", "mercedes");
1944 ok(found
== FALSE
, "dantes should not be in the _Property table\n");
1947 lstrcpy(buffer
, "aaa");
1948 r
= MsiGetProperty(hpkg
, "dantes", buffer
, &sz
);
1949 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1950 ok(lstrlenA(buffer
) == 0, "Expected empty string, got %s\n", buffer
);
1952 r
= MsiSetProperty(hpkg
, "dantes", "mercedes");
1953 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1955 found
= find_prop_in_property(hdb
, "dantes", "mercedes");
1956 ok(found
== TRUE
, "dantes should be in the _Property table\n");
1958 MsiCloseHandle(hdb
);
1959 MsiCloseHandle(hpkg
);
1960 DeleteFile(msifile
);
1963 static UINT
try_query_param( MSIHANDLE hdb
, LPCSTR szQuery
, MSIHANDLE hrec
)
1968 res
= MsiDatabaseOpenView( hdb
, szQuery
, &htab
);
1969 if( res
== ERROR_SUCCESS
)
1973 r
= MsiViewExecute( htab
, hrec
);
1974 if( r
!= ERROR_SUCCESS
)
1977 fprintf(stderr
,"MsiViewExecute failed %08x\n", res
);
1980 r
= MsiViewClose( htab
);
1981 if( r
!= ERROR_SUCCESS
)
1984 r
= MsiCloseHandle( htab
);
1985 if( r
!= ERROR_SUCCESS
)
1991 static UINT
try_query( MSIHANDLE hdb
, LPCSTR szQuery
)
1993 return try_query_param( hdb
, szQuery
, 0 );
1996 static void set_summary_str(MSIHANDLE hdb
, DWORD pid
, LPCSTR value
)
2001 r
= MsiGetSummaryInformationA(hdb
, NULL
, 1, &summary
);
2002 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2004 r
= MsiSummaryInfoSetPropertyA(summary
, pid
, VT_LPSTR
, 0, NULL
, value
);
2005 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2007 r
= MsiSummaryInfoPersist(summary
);
2008 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2010 MsiCloseHandle(summary
);
2013 static void set_summary_dword(MSIHANDLE hdb
, DWORD pid
, DWORD value
)
2018 r
= MsiGetSummaryInformationA(hdb
, NULL
, 1, &summary
);
2019 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2021 r
= MsiSummaryInfoSetPropertyA(summary
, pid
, VT_I4
, value
, NULL
, NULL
);
2022 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2024 r
= MsiSummaryInfoPersist(summary
);
2025 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2027 MsiCloseHandle(summary
);
2030 static void test_msipackage(void)
2032 MSIHANDLE hdb
= 0, hpack
= 100;
2037 /* NULL szPackagePath */
2038 r
= MsiOpenPackage(NULL
, &hpack
);
2039 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2041 /* empty szPackagePath */
2042 r
= MsiOpenPackage("", &hpack
);
2045 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2048 if (r
== ERROR_SUCCESS
)
2049 MsiCloseHandle(hpack
);
2051 /* nonexistent szPackagePath */
2052 r
= MsiOpenPackage("nonexistent", &hpack
);
2053 ok(r
== ERROR_FILE_NOT_FOUND
, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2056 r
= MsiOpenPackage(msifile
, NULL
);
2057 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2061 r
= MsiOpenPackage(name
, &hpack
);
2062 ok(r
== ERROR_INVALID_HANDLE
, "Expected ERROR_INVALID_HANDLE, got %d\n", r
);
2064 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
2065 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2067 /* database exists, but is emtpy */
2068 sprintf(name
, "#%ld", hdb
);
2069 r
= MsiOpenPackage(name
, &hpack
);
2070 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2071 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2073 query
= "CREATE TABLE `Property` ( "
2074 "`Property` CHAR(72), `Value` CHAR(0) "
2075 "PRIMARY KEY `Property`)";
2076 r
= try_query(hdb
, query
);
2077 ok(r
== ERROR_SUCCESS
, "failed to create Properties table\n");
2079 query
= "CREATE TABLE `InstallExecuteSequence` ("
2080 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2081 "PRIMARY KEY `Action`)";
2082 r
= try_query(hdb
, query
);
2083 ok(r
== ERROR_SUCCESS
, "failed to create InstallExecuteSequence table\n");
2085 /* a few key tables exist */
2086 sprintf(name
, "#%ld", hdb
);
2087 r
= MsiOpenPackage(name
, &hpack
);
2088 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2089 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2091 MsiCloseHandle(hdb
);
2092 DeleteFile(msifile
);
2094 /* start with a clean database to show what constitutes a valid package */
2095 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
2096 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2098 sprintf(name
, "#%ld", hdb
);
2100 /* The following summary information props must exist:
2105 set_summary_dword(hdb
, PID_PAGECOUNT
, 100);
2106 r
= MsiOpenPackage(name
, &hpack
);
2107 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2108 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2110 set_summary_str(hdb
, PID_REVNUMBER
, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2111 r
= MsiOpenPackage(name
, &hpack
);
2112 ok(r
== ERROR_SUCCESS
,
2113 "Expected ERROR_SUCCESS, got %d\n", r
);
2115 MsiCloseHandle(hpack
);
2116 MsiCloseHandle(hdb
);
2117 DeleteFile(msifile
);
2120 static void test_formatrecord2(void)
2122 MSIHANDLE hpkg
, hrec
;
2127 hpkg
= package_from_db(create_package_db());
2128 ok( hpkg
, "failed to create package\n");
2130 r
= MsiSetProperty(hpkg
, "Manufacturer", " " );
2131 ok( r
== ERROR_SUCCESS
, "set property failed\n");
2133 hrec
= MsiCreateRecord(2);
2134 ok(hrec
, "create record failed\n");
2136 r
= MsiRecordSetString( hrec
, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2137 ok( r
== ERROR_SUCCESS
, "format record failed\n");
2141 r
= MsiFormatRecord( hpkg
, hrec
, buffer
, &sz
);
2143 r
= MsiRecordSetString(hrec
, 0, "[foo][1]");
2144 r
= MsiRecordSetString(hrec
, 1, "hoo");
2146 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2147 ok( sz
== 3, "size wrong\n");
2148 ok( 0 == strcmp(buffer
,"hoo"), "wrong output %s\n",buffer
);
2149 ok( r
== ERROR_SUCCESS
, "format failed\n");
2151 r
= MsiRecordSetString(hrec
, 0, "x[~]x");
2153 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2154 ok( sz
== 3, "size wrong\n");
2155 ok( 0 == strcmp(buffer
,"x"), "wrong output %s\n",buffer
);
2156 ok( r
== ERROR_SUCCESS
, "format failed\n");
2158 r
= MsiRecordSetString(hrec
, 0, "[foo.$%}][1]");
2159 r
= MsiRecordSetString(hrec
, 1, "hoo");
2161 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2162 ok( sz
== 3, "size wrong\n");
2163 ok( 0 == strcmp(buffer
,"hoo"), "wrong output %s\n",buffer
);
2164 ok( r
== ERROR_SUCCESS
, "format failed\n");
2166 r
= MsiRecordSetString(hrec
, 0, "[\\[]");
2168 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2169 ok( sz
== 1, "size wrong\n");
2170 ok( 0 == strcmp(buffer
,"["), "wrong output %s\n",buffer
);
2171 ok( r
== ERROR_SUCCESS
, "format failed\n");
2173 SetEnvironmentVariable("FOO", "BAR");
2174 r
= MsiRecordSetString(hrec
, 0, "[%FOO]");
2176 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2177 ok( sz
== 3, "size wrong\n");
2178 ok( 0 == strcmp(buffer
,"BAR"), "wrong output %s\n",buffer
);
2179 ok( r
== ERROR_SUCCESS
, "format failed\n");
2181 r
= MsiRecordSetString(hrec
, 0, "[[1]]");
2182 r
= MsiRecordSetString(hrec
, 1, "%FOO");
2184 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2185 ok( sz
== 3, "size wrong\n");
2186 ok( 0 == strcmp(buffer
,"BAR"), "wrong output %s\n",buffer
);
2187 ok( r
== ERROR_SUCCESS
, "format failed\n");
2189 MsiCloseHandle( hrec
);
2190 MsiCloseHandle( hpkg
);
2191 DeleteFile(msifile
);
2194 /* FIXME: state is INSTALLSTATE_UNKNOWN if any features are removed and the
2195 * feature in question is not in ADD*
2197 static void test_states(void)
2202 INSTALLSTATE state
, action
;
2204 hdb
= create_package_db();
2205 ok ( hdb
, "failed to create package database\n" );
2207 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
2208 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
2210 r
= create_property_table( hdb
);
2211 ok( r
== ERROR_SUCCESS
, "cannot create Property table: %d\n", r
);
2213 r
= add_property_entry( hdb
, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2214 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2216 r
= add_property_entry( hdb
, "'ProductLanguage', '1033'" );
2217 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2219 r
= add_property_entry( hdb
, "'ProductName', 'MSITEST'" );
2220 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2222 r
= add_property_entry( hdb
, "'ProductVersion', '1.1.1'" );
2223 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2225 r
= create_install_execute_sequence_table( hdb
);
2226 ok( r
== ERROR_SUCCESS
, "cannot create InstallExecuteSequence table: %d\n", r
);
2228 r
= add_install_execute_sequence_entry( hdb
, "'CostInitialize', '', '800'" );
2229 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2231 r
= add_install_execute_sequence_entry( hdb
, "'FileCost', '', '900'" );
2232 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2234 r
= add_install_execute_sequence_entry( hdb
, "'CostFinalize', '', '1000'" );
2235 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2237 r
= add_install_execute_sequence_entry( hdb
, "'InstallValidate', '', '1400'" );
2238 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2240 r
= add_install_execute_sequence_entry( hdb
, "'InstallInitialize', '', '1500'" );
2241 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2243 r
= add_install_execute_sequence_entry( hdb
, "'ProcessComponents', '', '1600'" );
2244 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2246 r
= add_install_execute_sequence_entry( hdb
, "'UnpublishFeatures', '', '1800'" );
2247 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2249 r
= add_install_execute_sequence_entry( hdb
, "'RegisterProduct', '', '6100'" );
2250 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2252 r
= add_install_execute_sequence_entry( hdb
, "'PublishFeatures', '', '6300'" );
2253 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2255 r
= add_install_execute_sequence_entry( hdb
, "'PublishProduct', '', '6400'" );
2256 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2258 r
= add_install_execute_sequence_entry( hdb
, "'InstallFinalize', '', '6600'" );
2259 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2261 r
= create_media_table( hdb
);
2262 ok( r
== ERROR_SUCCESS
, "cannot create media table: %d\n", r
);
2264 r
= add_media_entry( hdb
, "'1', '3', '', '', 'DISK1', ''");
2265 ok( r
== ERROR_SUCCESS
, "cannot add media entry: %d\n", r
);
2267 r
= create_feature_table( hdb
);
2268 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
2270 r
= create_component_table( hdb
);
2271 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
2273 /* msidbFeatureAttributesFavorLocal */
2274 r
= add_feature_entry( hdb
, "'one', '', '', '', 2, 1, '', 0" );
2275 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2277 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2278 r
= add_component_entry( hdb
, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2279 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2281 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2282 r
= add_component_entry( hdb
, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2283 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2285 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2286 r
= add_component_entry( hdb
, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2287 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2289 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2290 r
= add_component_entry( hdb
, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2291 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2293 /* msidbFeatureAttributesFavorSource */
2294 r
= add_feature_entry( hdb
, "'two', '', '', '', 2, 1, '', 1" );
2295 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2297 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2298 r
= add_component_entry( hdb
, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2299 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2301 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2302 r
= add_component_entry( hdb
, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2303 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2305 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2306 r
= add_component_entry( hdb
, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2307 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2309 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2310 r
= add_component_entry( hdb
, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2311 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2313 /* msidbFeatureAttributesFavorSource */
2314 r
= add_feature_entry( hdb
, "'three', '', '', '', 2, 1, '', 1" );
2315 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2317 /* msidbFeatureAttributesFavorLocal */
2318 r
= add_feature_entry( hdb
, "'four', '', '', '', 2, 1, '', 0" );
2319 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2322 r
= add_feature_entry( hdb
, "'five', '', '', '', 2, 0, '', 1" );
2323 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2325 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2326 r
= add_component_entry( hdb
, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2327 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2329 /* no feature parent:msidbComponentAttributesLocalOnly */
2330 r
= add_component_entry( hdb
, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2331 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2333 /* msidbFeatureAttributesFavorLocal:removed */
2334 r
= add_feature_entry( hdb
, "'six', '', '', '', 2, 1, '', 0" );
2335 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2337 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2338 r
= add_component_entry( hdb
, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2339 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2341 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2342 r
= add_component_entry( hdb
, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2343 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2345 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2346 r
= add_component_entry( hdb
, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2347 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2349 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2350 r
= add_component_entry( hdb
, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2351 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2353 /* msidbFeatureAttributesFavorSource:removed */
2354 r
= add_feature_entry( hdb
, "'seven', '', '', '', 2, 1, '', 1" );
2355 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2357 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2358 r
= add_component_entry( hdb
, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2359 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2361 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2362 r
= add_component_entry( hdb
, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2363 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2365 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2366 r
= add_component_entry( hdb
, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2367 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2369 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2370 r
= add_component_entry( hdb
, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2371 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2373 r
= create_feature_components_table( hdb
);
2374 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
2376 r
= add_feature_components_entry( hdb
, "'one', 'alpha'" );
2377 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2379 r
= add_feature_components_entry( hdb
, "'one', 'beta'" );
2380 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2382 r
= add_feature_components_entry( hdb
, "'one', 'gamma'" );
2383 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2385 r
= add_feature_components_entry( hdb
, "'one', 'theta'" );
2386 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2388 r
= add_feature_components_entry( hdb
, "'two', 'delta'" );
2389 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2391 r
= add_feature_components_entry( hdb
, "'two', 'epsilon'" );
2392 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2394 r
= add_feature_components_entry( hdb
, "'two', 'zeta'" );
2395 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2397 r
= add_feature_components_entry( hdb
, "'two', 'iota'" );
2398 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2400 r
= add_feature_components_entry( hdb
, "'three', 'eta'" );
2401 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2403 r
= add_feature_components_entry( hdb
, "'four', 'eta'" );
2404 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2406 r
= add_feature_components_entry( hdb
, "'five', 'eta'" );
2407 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2409 r
= add_feature_components_entry( hdb
, "'six', 'lambda'" );
2410 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2412 r
= add_feature_components_entry( hdb
, "'six', 'mu'" );
2413 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2415 r
= add_feature_components_entry( hdb
, "'six', 'nu'" );
2416 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2418 r
= add_feature_components_entry( hdb
, "'six', 'xi'" );
2419 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2421 r
= add_feature_components_entry( hdb
, "'seven', 'omicron'" );
2422 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2424 r
= add_feature_components_entry( hdb
, "'seven', 'pi'" );
2425 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2427 r
= add_feature_components_entry( hdb
, "'seven', 'rho'" );
2428 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2430 r
= add_feature_components_entry( hdb
, "'seven', 'sigma'" );
2431 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2433 r
= create_file_table( hdb
);
2434 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
2436 r
= add_file_entry( hdb
, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2437 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2439 r
= add_file_entry( hdb
, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2440 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2442 r
= add_file_entry( hdb
, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2443 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2445 r
= add_file_entry( hdb
, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2446 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2448 r
= add_file_entry( hdb
, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2449 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2451 r
= add_file_entry( hdb
, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2452 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2454 r
= add_file_entry( hdb
, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2455 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2457 r
= add_file_entry( hdb
, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2458 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2460 /* compressed file */
2461 r
= add_file_entry( hdb
, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2462 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2464 r
= add_file_entry( hdb
, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2465 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2467 r
= add_file_entry( hdb
, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2468 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2470 r
= add_file_entry( hdb
, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2471 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2473 r
= add_file_entry( hdb
, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2474 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2476 r
= add_file_entry( hdb
, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2477 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2479 r
= add_file_entry( hdb
, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2480 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2482 r
= add_file_entry( hdb
, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2483 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2485 r
= add_file_entry( hdb
, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2486 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2488 r
= add_file_entry( hdb
, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2489 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2491 MsiDatabaseCommit(hdb
);
2493 /* these properties must not be in the saved msi file */
2494 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,four'");
2495 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2497 r
= add_property_entry( hdb
, "'ADDSOURCE', 'two,three'");
2498 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2500 r
= add_property_entry( hdb
, "'REMOVE', 'six,seven'");
2501 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2503 hpkg
= package_from_db( hdb
);
2504 ok( hpkg
, "failed to create package\n");
2506 MsiCloseHandle(hdb
);
2510 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2511 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2512 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2513 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2517 r
= MsiGetFeatureState(hpkg
, "two", &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
, "three", &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
, "four", &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
, "five", &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
, "six", &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
, "seven", &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
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2560 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, 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
, "beta", &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
, "gamma", &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
, "theta", &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
, "delta", &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
, "epsilon", &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
, "zeta", &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
, "iota", &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
, "eta", &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
, "kappa", &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
, "lambda", &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
, "mu", &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
, "nu", &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
, "xi", &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
, "omicron", &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
, "pi", &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
, "rho", &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
, "sigma", &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
);
2683 r
= MsiDoAction( hpkg
, "CostInitialize");
2684 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
2688 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2689 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2690 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2691 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2695 r
= MsiGetFeatureState(hpkg
, "two", &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
, "three", &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
, "four", &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
, "five", &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
, "six", &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
, "seven", &state
, &action
);
2731 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2732 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2733 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2737 r
= MsiGetComponentState(hpkg
, "alpha", &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
, "beta", &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
, "gamma", &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
, "theta", &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
, "delta", &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
, "epsilon", &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
, "zeta", &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
, "iota", &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
, "eta", &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
, "kappa", &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
, "lambda", &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
, "mu", &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
, "nu", &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
, "xi", &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
, "omicron", &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
, "pi", &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
, "rho", &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
, "sigma", &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
);
2861 r
= MsiDoAction( hpkg
, "FileCost");
2862 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
2866 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2867 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2868 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2869 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2873 r
= MsiGetFeatureState(hpkg
, "two", &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
, "three", &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
, "four", &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
, "five", &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
, "six", &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
, "seven", &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
= MsiGetComponentState(hpkg
, "alpha", &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
, "beta", &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
, "gamma", &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
, "theta", &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
, "delta", &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
, "epsilon", &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
, "zeta", &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
, "iota", &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
, "eta", &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
, "kappa", &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
, "lambda", &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
, "mu", &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
, "nu", &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
, "xi", &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
, "omicron", &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
, "pi", &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
, "rho", &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
, "sigma", &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
);
3039 r
= MsiDoAction( hpkg
, "CostFinalize");
3040 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
3044 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3045 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3046 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3047 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3051 r
= MsiGetFeatureState(hpkg
, "two", &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_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3058 r
= MsiGetFeatureState(hpkg
, "three", &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_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3065 r
= MsiGetFeatureState(hpkg
, "four", &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
, "five", &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_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3079 r
= MsiGetFeatureState(hpkg
, "six", &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
);
3084 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3089 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3090 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3091 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3094 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3099 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3100 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3101 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3102 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3106 r
= MsiGetComponentState(hpkg
, "beta", &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_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3113 r
= MsiGetComponentState(hpkg
, "gamma", &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_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3120 r
= MsiGetComponentState(hpkg
, "theta", &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
, "delta", &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
, "epsilon", &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_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3141 r
= MsiGetComponentState(hpkg
, "zeta", &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
, "iota", &state
, &action
);
3149 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3150 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3151 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3155 r
= MsiGetComponentState(hpkg
, "eta", &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
, "kappa", &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_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3169 r
= MsiGetComponentState(hpkg
, "lambda", &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
);
3174 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3179 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3180 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3181 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3184 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3189 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3190 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3191 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3194 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3199 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3200 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3201 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3204 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3209 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3210 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3211 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3214 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3219 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3220 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3221 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3224 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3229 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3230 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3231 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3234 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3239 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3240 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3241 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3244 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3247 MsiCloseHandle( hpkg
);
3249 /* publish the features and components */
3250 r
= MsiInstallProduct(msifile
, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven");
3251 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3253 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
3254 ok(r
== ERROR_SUCCESS
, "failed to open database: %d\n", r
);
3256 /* these properties must not be in the saved msi file */
3257 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,four'");
3258 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3260 r
= add_property_entry( hdb
, "'ADDSOURCE', 'two,three'");
3261 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3263 r
= add_property_entry( hdb
, "'REMOVE', 'six,seven'");
3264 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3266 hpkg
= package_from_db( hdb
);
3267 ok( hpkg
, "failed to create package\n");
3269 MsiCloseHandle(hdb
);
3273 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3274 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3275 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3276 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3280 r
= MsiGetFeatureState(hpkg
, "two", &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
, "three", &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
, "four", &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
, "five", &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
, "six", &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
, "seven", &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
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3323 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, 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
, "beta", &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
, "gamma", &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
, "theta", &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
, "delta", &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
, "epsilon", &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
, "zeta", &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
, "iota", &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
, "eta", &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
, "kappa", &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
, "lambda", &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
, "mu", &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
, "nu", &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
, "xi", &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
, "omicron", &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
, "pi", &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
, "rho", &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
, "sigma", &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
);
3446 r
= MsiDoAction( hpkg
, "CostInitialize");
3447 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
3451 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3452 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3453 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3454 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3458 r
= MsiGetFeatureState(hpkg
, "two", &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
, "three", &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
, "four", &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
, "five", &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
, "six", &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
, "seven", &state
, &action
);
3494 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3495 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3496 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3500 r
= MsiGetComponentState(hpkg
, "alpha", &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
, "beta", &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
, "gamma", &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
, "theta", &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
, "delta", &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
, "epsilon", &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
, "zeta", &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
, "iota", &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
, "eta", &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
, "kappa", &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
, "lambda", &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
, "mu", &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
, "nu", &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
, "xi", &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
, "omicron", &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
, "pi", &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
, "rho", &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
, "sigma", &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
);
3624 r
= MsiDoAction( hpkg
, "FileCost");
3625 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
3629 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3630 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3631 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3632 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3636 r
= MsiGetFeatureState(hpkg
, "two", &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
, "three", &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
, "four", &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
, "five", &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
, "six", &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
, "seven", &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
= MsiGetComponentState(hpkg
, "alpha", &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
, "beta", &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
, "gamma", &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
, "theta", &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
, "delta", &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
, "epsilon", &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
, "zeta", &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
, "iota", &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
, "eta", &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
, "kappa", &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
, "lambda", &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
, "mu", &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
, "nu", &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
, "xi", &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
, "omicron", &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
, "pi", &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
, "rho", &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
, "sigma", &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
);
3802 r
= MsiDoAction( hpkg
, "CostFinalize");
3803 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
3807 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3808 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3811 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3813 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3817 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3818 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3821 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3823 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3827 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3828 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3831 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3833 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3837 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3838 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3841 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3843 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3847 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3848 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3849 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3850 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3854 r
= MsiGetFeatureState(hpkg
, "six", &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
);
3859 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3864 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3865 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3866 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3869 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3874 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3875 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3878 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3880 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3884 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3885 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3888 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3890 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3894 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3895 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3898 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3900 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3904 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3905 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3908 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3910 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3914 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3915 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3918 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3920 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3924 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3925 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3928 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3929 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3934 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3935 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3938 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3939 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3944 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3945 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3948 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3950 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3954 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3955 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3958 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3960 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3964 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3965 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3966 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3967 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3971 r
= MsiGetComponentState(hpkg
, "lambda", &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
);
3976 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3981 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3982 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3983 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3986 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3991 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3992 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3993 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3996 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4001 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4002 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4003 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4006 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4011 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4012 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4013 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4016 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4021 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4022 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4023 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4026 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4031 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4032 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4033 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4036 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4041 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4042 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4043 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4046 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4049 MsiCloseHandle(hpkg
);
4051 /* uninstall the product */
4052 r
= MsiInstallProduct(msifile
, "REMOVE=ALL");
4053 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4055 DeleteFileA(msifile
);
4058 static void test_getproperty(void)
4060 MSIHANDLE hPackage
= 0;
4062 static CHAR empty
[] = "";
4066 hPackage
= package_from_db(create_package_db());
4067 ok( hPackage
!= 0, " Failed to create package\n");
4069 /* set the property */
4070 r
= MsiSetProperty(hPackage
, "Name", "Value");
4071 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4073 /* retrieve the size, NULL pointer */
4075 r
= MsiGetProperty(hPackage
, "Name", NULL
, &size
);
4076 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4077 ok( size
== 5, "Expected 5, got %d\n", size
);
4079 /* retrieve the size, empty string */
4081 r
= MsiGetProperty(hPackage
, "Name", empty
, &size
);
4082 ok( r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
4083 ok( size
== 5, "Expected 5, got %d\n", size
);
4085 /* don't change size */
4086 r
= MsiGetProperty(hPackage
, "Name", prop
, &size
);
4087 ok( r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
4088 ok( size
== 5, "Expected 5, got %d\n", size
);
4089 ok( !lstrcmp(prop
, "Valu"), "Expected Valu, got %s\n", prop
);
4091 /* increase the size by 1 */
4093 r
= MsiGetProperty(hPackage
, "Name", prop
, &size
);
4094 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4095 ok( size
== 5, "Expected 5, got %d\n", size
);
4096 ok( !lstrcmp(prop
, "Value"), "Expected Value, got %s\n", prop
);
4098 r
= MsiCloseHandle( hPackage
);
4099 ok( r
== ERROR_SUCCESS
, "Failed to close package\n" );
4100 DeleteFile(msifile
);
4103 static void test_removefiles(void)
4109 hdb
= create_package_db();
4110 ok ( hdb
, "failed to create package database\n" );
4112 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
4113 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
4115 r
= create_feature_table( hdb
);
4116 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
4118 r
= create_component_table( hdb
);
4119 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
4121 r
= add_feature_entry( hdb
, "'one', '', '', '', 2, 1, '', 0" );
4122 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4124 r
= add_component_entry( hdb
, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
4125 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4127 r
= add_component_entry( hdb
, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
4128 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4130 r
= add_component_entry( hdb
, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
4131 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4133 r
= add_component_entry( hdb
, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
4134 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4136 r
= add_component_entry( hdb
, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
4137 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4139 r
= add_component_entry( hdb
, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
4140 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4142 r
= create_feature_components_table( hdb
);
4143 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
4145 r
= add_feature_components_entry( hdb
, "'one', 'hydrogen'" );
4146 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4148 r
= add_feature_components_entry( hdb
, "'one', 'helium'" );
4149 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4151 r
= add_feature_components_entry( hdb
, "'one', 'lithium'" );
4152 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4154 r
= add_feature_components_entry( hdb
, "'one', 'beryllium'" );
4155 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4157 r
= add_feature_components_entry( hdb
, "'one', 'boron'" );
4158 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4160 r
= add_feature_components_entry( hdb
, "'one', 'carbon'" );
4161 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4163 r
= create_file_table( hdb
);
4164 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
4166 r
= add_file_entry( hdb
, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
4167 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4169 r
= add_file_entry( hdb
, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
4170 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4172 r
= add_file_entry( hdb
, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
4173 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4175 r
= add_file_entry( hdb
, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
4176 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4178 r
= add_file_entry( hdb
, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
4179 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4181 r
= add_file_entry( hdb
, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
4182 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4184 r
= create_remove_file_table( hdb
);
4185 ok( r
== ERROR_SUCCESS
, "cannot create Remove File table: %d\n", r
);
4187 hpkg
= package_from_db( hdb
);
4188 ok( hpkg
, "failed to create package\n");
4190 MsiCloseHandle( hdb
);
4192 create_test_file( "hydrogen.txt" );
4193 create_test_file( "helium.txt" );
4194 create_test_file( "lithium.txt" );
4195 create_test_file( "beryllium.txt" );
4196 create_test_file( "boron.txt" );
4197 create_test_file( "carbon.txt" );
4199 r
= MsiSetProperty( hpkg
, "TARGETDIR", CURR_DIR
);
4200 ok( r
== ERROR_SUCCESS
, "set property failed\n");
4202 r
= MsiDoAction( hpkg
, "CostInitialize");
4203 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4205 r
= MsiDoAction( hpkg
, "FileCost");
4206 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
4208 r
= MsiDoAction( hpkg
, "CostFinalize");
4209 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
4211 r
= MsiDoAction( hpkg
, "InstallValidate");
4212 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
4214 r
= MsiSetComponentState( hpkg
, "hydrogen", INSTALLSTATE_ABSENT
);
4215 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4217 r
= MsiSetComponentState( hpkg
, "helium", INSTALLSTATE_LOCAL
);
4218 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4220 r
= MsiSetComponentState( hpkg
, "lithium", INSTALLSTATE_SOURCE
);
4221 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4223 r
= MsiSetComponentState( hpkg
, "beryllium", INSTALLSTATE_ABSENT
);
4224 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4226 r
= MsiSetComponentState( hpkg
, "boron", INSTALLSTATE_LOCAL
);
4227 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4229 r
= MsiSetComponentState( hpkg
, "carbon", INSTALLSTATE_SOURCE
);
4230 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4232 r
= MsiDoAction( hpkg
, "RemoveFiles");
4233 ok( r
== ERROR_SUCCESS
, "remove files failed\n");
4235 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
4236 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
4237 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
4238 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
4239 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
4240 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
4242 MsiCloseHandle( hpkg
);
4243 DeleteFileA(msifile
);
4246 static void test_appsearch(void)
4251 CHAR prop
[MAX_PATH
];
4252 DWORD size
= MAX_PATH
;
4254 hdb
= create_package_db();
4255 ok ( hdb
, "failed to create package database\n" );
4257 r
= create_appsearch_table( hdb
);
4258 ok( r
== ERROR_SUCCESS
, "cannot create AppSearch table: %d\n", r
);
4260 r
= add_appsearch_entry( hdb
, "'WEBBROWSERPROG', 'NewSignature1'" );
4261 ok( r
== ERROR_SUCCESS
, "cannot add entry: %d\n", r
);
4263 r
= create_reglocator_table( hdb
);
4264 ok( r
== ERROR_SUCCESS
, "cannot create RegLocator table: %d\n", r
);
4266 r
= add_reglocator_entry( hdb
, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
4267 ok( r
== ERROR_SUCCESS
, "cannot create RegLocator table: %d\n", r
);
4269 r
= create_signature_table( hdb
);
4270 ok( r
== ERROR_SUCCESS
, "cannot create Signature table: %d\n", r
);
4272 r
= add_signature_entry( hdb
, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
4273 ok( r
== ERROR_SUCCESS
, "cannot create Signature table: %d\n", r
);
4275 hpkg
= package_from_db( hdb
);
4276 ok( hpkg
, "failed to create package\n");
4278 MsiCloseHandle( hdb
);
4280 r
= MsiDoAction( hpkg
, "AppSearch" );
4281 ok( r
== ERROR_SUCCESS
, "AppSearch failed: %d\n", r
);
4283 r
= MsiGetPropertyA( hpkg
, "WEBBROWSERPROG", prop
, &size
);
4284 ok( r
== ERROR_SUCCESS
, "get property failed: %d\n", r
);
4285 ok( lstrlenA(prop
) != 0, "Expected non-zero length\n");
4287 MsiCloseHandle( hpkg
);
4288 DeleteFileA(msifile
);
4291 static void test_featureparents(void)
4296 INSTALLSTATE state
, action
;
4298 hdb
= create_package_db();
4299 ok ( hdb
, "failed to create package database\n" );
4301 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
4302 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
4304 r
= create_feature_table( hdb
);
4305 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
4307 r
= create_component_table( hdb
);
4308 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
4310 r
= create_feature_components_table( hdb
);
4311 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
4313 r
= create_file_table( hdb
);
4314 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
4316 /* msidbFeatureAttributesFavorLocal */
4317 r
= add_feature_entry( hdb
, "'zodiac', '', '', '', 2, 1, '', 0" );
4318 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4320 /* msidbFeatureAttributesFavorSource */
4321 r
= add_feature_entry( hdb
, "'perseus', '', '', '', 2, 1, '', 1" );
4322 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4324 /* msidbFeatureAttributesFavorLocal */
4325 r
= add_feature_entry( hdb
, "'orion', '', '', '', 2, 1, '', 0" );
4326 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4328 /* disabled because of install level */
4329 r
= add_feature_entry( hdb
, "'waters', '', '', '', 15, 101, '', 9" );
4330 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4332 /* child feature of disabled feature */
4333 r
= add_feature_entry( hdb
, "'bayer', 'waters', '', '', 14, 1, '', 9" );
4334 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4336 /* component of disabled feature (install level) */
4337 r
= add_component_entry( hdb
, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
4338 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4340 /* component of disabled child feature (install level) */
4341 r
= add_component_entry( hdb
, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
4342 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4344 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
4345 r
= add_component_entry( hdb
, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
4346 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4348 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
4349 r
= add_component_entry( hdb
, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
4350 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4352 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
4353 r
= add_component_entry( hdb
, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
4354 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4356 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
4357 r
= add_component_entry( hdb
, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
4358 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4360 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
4361 r
= add_component_entry( hdb
, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
4362 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4364 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
4365 r
= add_component_entry( hdb
, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
4366 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4368 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
4369 r
= add_component_entry( hdb
, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
4370 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4372 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
4373 r
= add_component_entry( hdb
, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
4374 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4376 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
4377 r
= add_component_entry( hdb
, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
4379 r
= add_feature_components_entry( hdb
, "'zodiac', 'leo'" );
4380 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4382 r
= add_feature_components_entry( hdb
, "'zodiac', 'virgo'" );
4383 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4385 r
= add_feature_components_entry( hdb
, "'zodiac', 'libra'" );
4386 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4388 r
= add_feature_components_entry( hdb
, "'perseus', 'cassiopeia'" );
4389 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4391 r
= add_feature_components_entry( hdb
, "'perseus', 'cepheus'" );
4392 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4394 r
= add_feature_components_entry( hdb
, "'perseus', 'andromeda'" );
4395 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4397 r
= add_feature_components_entry( hdb
, "'orion', 'leo'" );
4398 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4400 r
= add_feature_components_entry( hdb
, "'orion', 'virgo'" );
4401 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4403 r
= add_feature_components_entry( hdb
, "'orion', 'libra'" );
4404 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4406 r
= add_feature_components_entry( hdb
, "'orion', 'cassiopeia'" );
4407 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4409 r
= add_feature_components_entry( hdb
, "'orion', 'cepheus'" );
4410 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4412 r
= add_feature_components_entry( hdb
, "'orion', 'andromeda'" );
4413 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4415 r
= add_feature_components_entry( hdb
, "'orion', 'canis'" );
4416 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4418 r
= add_feature_components_entry( hdb
, "'orion', 'monoceros'" );
4419 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4421 r
= add_feature_components_entry( hdb
, "'orion', 'lepus'" );
4422 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4424 r
= add_feature_components_entry( hdb
, "'waters', 'delphinus'" );
4425 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4427 r
= add_feature_components_entry( hdb
, "'bayer', 'hydrus'" );
4428 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4430 r
= add_file_entry( hdb
, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
4431 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4433 r
= add_file_entry( hdb
, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
4434 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4436 r
= add_file_entry( hdb
, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
4437 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4439 r
= add_file_entry( hdb
, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
4440 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4442 r
= add_file_entry( hdb
, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
4443 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4445 r
= add_file_entry( hdb
, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
4446 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4448 r
= add_file_entry( hdb
, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
4449 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4451 r
= add_file_entry( hdb
, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
4452 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4454 r
= add_file_entry( hdb
, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
4455 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4457 r
= add_file_entry( hdb
, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
4458 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4460 r
= add_file_entry( hdb
, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
4461 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4463 hpkg
= package_from_db( hdb
);
4464 ok( hpkg
, "failed to create package\n");
4466 MsiCloseHandle( hdb
);
4468 r
= MsiDoAction( hpkg
, "CostInitialize");
4469 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4471 r
= MsiDoAction( hpkg
, "FileCost");
4472 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
4474 r
= MsiDoAction( hpkg
, "CostFinalize");
4475 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
4479 r
= MsiGetFeatureState(hpkg
, "zodiac", &state
, &action
);
4480 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4481 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4482 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4486 r
= MsiGetFeatureState(hpkg
, "perseus", &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_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
4493 r
= MsiGetFeatureState(hpkg
, "orion", &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_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4500 r
= MsiGetFeatureState(hpkg
, "waters", &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_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4507 r
= MsiGetFeatureState(hpkg
, "bayer", &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
= MsiGetComponentState(hpkg
, "leo", &state
, &action
);
4515 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4516 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4517 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4521 r
= MsiGetComponentState(hpkg
, "virgo", &state
, &action
);
4522 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4523 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state
);
4524 ok( action
== INSTALLSTATE_SOURCE
, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action
);
4528 r
= MsiGetComponentState(hpkg
, "libra", &state
, &action
);
4529 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4530 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state
);
4531 ok( action
== INSTALLSTATE_LOCAL
, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action
);
4535 r
= MsiGetComponentState(hpkg
, "cassiopeia", &state
, &action
);
4536 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4537 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state
);
4538 ok( action
== INSTALLSTATE_LOCAL
, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action
);
4542 r
= MsiGetComponentState(hpkg
, "cepheus", &state
, &action
);
4543 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4544 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4545 ok( action
== INSTALLSTATE_SOURCE
, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action
);
4549 r
= MsiGetComponentState(hpkg
, "andromeda", &state
, &action
);
4550 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4551 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state
);
4552 ok( action
== INSTALLSTATE_LOCAL
, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action
);
4556 r
= MsiGetComponentState(hpkg
, "canis", &state
, &action
);
4557 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4558 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state
);
4559 ok( action
== INSTALLSTATE_LOCAL
, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action
);
4563 r
= MsiGetComponentState(hpkg
, "monoceros", &state
, &action
);
4564 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4565 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state
);
4566 ok( action
== INSTALLSTATE_SOURCE
, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action
);
4570 r
= MsiGetComponentState(hpkg
, "lepus", &state
, &action
);
4571 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4572 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4573 ok( action
== INSTALLSTATE_LOCAL
, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action
);
4577 r
= MsiGetComponentState(hpkg
, "delphinus", &state
, &action
);
4578 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4579 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4580 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action
);
4584 r
= MsiGetComponentState(hpkg
, "hydrus", &state
, &action
);
4585 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4586 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4587 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action
);
4589 r
= MsiSetFeatureState(hpkg
, "orion", INSTALLSTATE_ABSENT
);
4590 ok( r
== ERROR_SUCCESS
, "failed to set feature state: %d\n", r
);
4594 r
= MsiGetFeatureState(hpkg
, "zodiac", &state
, &action
);
4595 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4596 ok( state
== INSTALLSTATE_ABSENT
, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state
);
4597 ok( action
== INSTALLSTATE_LOCAL
, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action
);
4601 r
= MsiGetFeatureState(hpkg
, "perseus", &state
, &action
);
4602 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4603 ok( state
== INSTALLSTATE_ABSENT
, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state
);
4604 ok( action
== INSTALLSTATE_SOURCE
, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action
);
4608 r
= MsiGetFeatureState(hpkg
, "orion", &state
, &action
);
4609 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4610 ok( state
== INSTALLSTATE_ABSENT
, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state
);
4611 ok( action
== INSTALLSTATE_ABSENT
, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action
);
4615 r
= MsiGetComponentState(hpkg
, "leo", &state
, &action
);
4616 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4617 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state
);
4618 ok( action
== INSTALLSTATE_LOCAL
, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action
);
4622 r
= MsiGetComponentState(hpkg
, "virgo", &state
, &action
);
4623 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4624 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state
);
4625 ok( action
== INSTALLSTATE_SOURCE
, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action
);
4629 r
= MsiGetComponentState(hpkg
, "libra", &state
, &action
);
4630 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4631 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state
);
4632 ok( action
== INSTALLSTATE_LOCAL
, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action
);
4636 r
= MsiGetComponentState(hpkg
, "cassiopeia", &state
, &action
);
4637 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4638 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state
);
4639 ok( action
== INSTALLSTATE_LOCAL
, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action
);
4643 r
= MsiGetComponentState(hpkg
, "cepheus", &state
, &action
);
4644 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4645 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4646 ok( action
== INSTALLSTATE_SOURCE
, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action
);
4650 r
= MsiGetComponentState(hpkg
, "andromeda", &state
, &action
);
4651 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4652 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state
);
4653 ok( action
== INSTALLSTATE_SOURCE
, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action
);
4657 r
= MsiGetComponentState(hpkg
, "canis", &state
, &action
);
4658 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4659 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state
);
4660 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action
);
4664 r
= MsiGetComponentState(hpkg
, "monoceros", &state
, &action
);
4665 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4666 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state
);
4667 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action
);
4671 r
= MsiGetComponentState(hpkg
, "lepus", &state
, &action
);
4672 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4673 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4674 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action
);
4678 r
= MsiGetComponentState(hpkg
, "delphinus", &state
, &action
);
4679 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4680 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4681 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action
);
4685 r
= MsiGetComponentState(hpkg
, "hydrus", &state
, &action
);
4686 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4687 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4688 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action
);
4690 MsiCloseHandle(hpkg
);
4691 DeleteFileA(msifile
);
4694 static void test_installprops(void)
4696 MSIHANDLE hpkg
, hdb
;
4697 CHAR path
[MAX_PATH
];
4703 GetCurrentDirectory(MAX_PATH
, path
);
4704 lstrcat(path
, "\\");
4705 lstrcat(path
, msifile
);
4707 hdb
= create_package_db();
4708 ok( hdb
, "failed to create database\n");
4710 hpkg
= package_from_db(hdb
);
4711 ok( hpkg
, "failed to create package\n");
4713 MsiCloseHandle(hdb
);
4716 r
= MsiGetProperty(hpkg
, "DATABASE", buf
, &size
);
4717 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4718 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
4720 RegOpenKey(HKEY_LOCAL_MACHINE
, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey
);
4724 RegQueryValueEx(hkey
, "RegisteredOwner", NULL
, &type
, (LPBYTE
)path
, &size
);
4727 r
= MsiGetProperty(hpkg
, "USERNAME", buf
, &size
);
4728 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4729 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
4733 RegQueryValueEx(hkey
, "RegisteredOrganization", NULL
, &type
, (LPBYTE
)path
, &size
);
4736 r
= MsiGetProperty(hpkg
, "COMPANYNAME", buf
, &size
);
4737 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4738 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
4741 r
= MsiGetProperty(hpkg
, "VersionDatabase", buf
, &size
);
4742 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4743 trace("VersionDatabase = %s\n", buf
);
4746 r
= MsiGetProperty(hpkg
, "VersionMsi", buf
, &size
);
4747 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4748 trace("VersionMsi = %s\n", buf
);
4751 r
= MsiGetProperty(hpkg
, "Date", buf
, &size
);
4752 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4753 trace("Date = %s\n", buf
);
4756 r
= MsiGetProperty(hpkg
, "Time", buf
, &size
);
4757 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4758 trace("Time = %s\n", buf
);
4761 r
= MsiGetProperty(hpkg
, "PackageCode", buf
, &size
);
4762 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4763 trace("PackageCode = %s\n", buf
);
4766 MsiCloseHandle(hpkg
);
4767 DeleteFile(msifile
);
4770 static void test_sourcedirprop(void)
4772 MSIHANDLE hpkg
, hdb
;
4773 CHAR source_dir
[MAX_PATH
];
4774 CHAR path
[MAX_PATH
];
4778 hdb
= create_package_db();
4779 ok ( hdb
, "failed to create package database\n" );
4781 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
4782 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
4784 hpkg
= package_from_db( hdb
);
4785 ok( hpkg
, "failed to create package\n");
4787 MsiCloseHandle( hdb
);
4790 r
= MsiGetProperty( hpkg
, "SourceDir", source_dir
, &size
);
4791 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4792 ok( !lstrlenA(source_dir
), "Expected emtpy source dir, got %s\n", source_dir
);
4795 r
= MsiGetProperty( hpkg
, "SOURCEDIR", source_dir
, &size
);
4796 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4797 ok( !lstrlenA(source_dir
), "Expected emtpy source dir, got %s\n", source_dir
);
4799 r
= MsiDoAction( hpkg
, "CostInitialize");
4800 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4803 r
= MsiGetProperty( hpkg
, "SourceDir", source_dir
, &size
);
4804 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4805 ok( !lstrlenA(source_dir
), "Expected emtpy source dir, got %s\n", source_dir
);
4808 r
= MsiGetProperty( hpkg
, "SOURCEDIR", source_dir
, &size
);
4809 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4810 ok( !lstrlenA(source_dir
), "Expected emtpy source dir, got %s\n", source_dir
);
4812 r
= MsiDoAction( hpkg
, "ResolveSource");
4813 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
4815 GetCurrentDirectory(MAX_PATH
, path
);
4816 lstrcatA(path
, "\\");
4819 r
= MsiGetProperty( hpkg
, "SourceDir", source_dir
, &size
);
4820 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4821 ok( !lstrcmpA(source_dir
, path
), "Expected %s, got %s\n", path
, source_dir
);
4824 r
= MsiGetProperty( hpkg
, "SOURCEDIR", source_dir
, &size
);
4825 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4826 ok( !lstrcmpA(source_dir
, path
), "Expected %s, got %s\n", path
, source_dir
);
4829 r
= MsiGetProperty( hpkg
, "SoUrCeDiR", source_dir
, &size
);
4830 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4831 ok( !lstrlenA(source_dir
), "Expected emtpy source dir, got %s\n", source_dir
);
4833 MsiCloseHandle(hpkg
);
4834 DeleteFileA(msifile
);
4837 static void test_prop_path(void)
4839 MSIHANDLE hpkg
, hdb
;
4840 char buffer
[MAX_PATH
], cwd
[MAX_PATH
];
4844 GetCurrentDirectory(MAX_PATH
, cwd
);
4847 hdb
= create_package_db();
4848 ok( hdb
, "failed to create database\n");
4850 r
= add_directory_entry( hdb
, "'TARGETDIR','','SourceDir'" );
4851 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
4853 r
= add_directory_entry( hdb
, "'foo','TARGETDIR','foosrc:footgt'" );
4854 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
4856 hpkg
= package_from_db(hdb
);
4857 ok( hpkg
, "failed to create package\n");
4859 r
= MsiGetSourcePath(hpkg
, "SourceDir", buffer
, &sz
);
4860 ok( r
== ERROR_DIRECTORY
, "failed to get source path\n");
4862 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", buffer
, &sz
);
4863 ok( r
== ERROR_DIRECTORY
, "failed to get source path\n");
4865 r
= MsiDoAction( hpkg
, "CostInitialize");
4866 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4870 r
= MsiGetProperty(hpkg
, "SourceDir", buffer
, &sz
);
4871 ok( r
== ERROR_SUCCESS
, "property not set\n");
4872 ok( !buffer
[0], "SourceDir should be empty\n");
4876 r
= MsiGetProperty(hpkg
, "SOURCEDIR", buffer
, &sz
);
4877 ok( r
== ERROR_SUCCESS
, "property not set\n");
4878 ok( !buffer
[0], "SourceDir should be empty\n");
4882 r
= MsiGetSourcePath(hpkg
, "SourceDir", buffer
, &sz
);
4883 ok( r
== ERROR_SUCCESS
, "failed to get source path\n");
4884 ok( !lstrcmpi(cwd
, buffer
), "SourceDir (%s) should be current dir (%s)\n", buffer
, cwd
);
4888 r
= MsiGetProperty(hpkg
, "SourceDir", buffer
, &sz
);
4889 ok( r
== ERROR_SUCCESS
, "property not set\n");
4891 ok( !lstrcmpi(cwd
, buffer
), "SourceDir (%s) should be current dir (%s)\n", buffer
, cwd
);
4896 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", buffer
, &sz
);
4897 ok( r
== ERROR_DIRECTORY
, "failed to get source path\n");
4901 r
= MsiGetProperty(hpkg
, "SOURCEDIR", buffer
, &sz
);
4902 ok( r
== ERROR_SUCCESS
, "property not set\n");
4904 ok( !lstrcmpi(cwd
, buffer
), "SourceDir (%s) should be current dir (%s)\n", buffer
, cwd
);
4907 r
= MsiSetProperty(hpkg
, "SourceDir", "goo");
4908 ok( r
== ERROR_SUCCESS
, "property not set\n");
4912 r
= MsiGetProperty(hpkg
, "SourceDir", buffer
, &sz
);
4913 ok( r
== ERROR_SUCCESS
, "property not set\n");
4914 ok( !lstrcmpi(buffer
, "goo"), "SourceDir (%s) should be goo\n", buffer
);
4918 r
= MsiGetSourcePath(hpkg
, "SourceDir", buffer
, &sz
);
4919 ok( r
== ERROR_SUCCESS
, "failed to get source path\n");
4920 ok( !lstrcmpi(buffer
, cwd
), "SourceDir (%s) should be goo\n", buffer
);
4924 r
= MsiGetProperty(hpkg
, "SourceDir", buffer
, &sz
);
4925 ok( r
== ERROR_SUCCESS
, "property not set\n");
4926 ok( !lstrcmpi(buffer
, "goo"), "SourceDir (%s) should be goo\n", buffer
);
4928 MsiCloseHandle( hpkg
);
4929 DeleteFile(msifile
);
4932 static void test_launchconditions(void)
4938 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
4940 hdb
= create_package_db();
4941 ok( hdb
, "failed to create package database\n" );
4943 r
= create_launchcondition_table( hdb
);
4944 ok( r
== ERROR_SUCCESS
, "cannot create LaunchCondition table: %d\n", r
);
4946 r
= add_launchcondition_entry( hdb
, "'X = \"1\"', 'one'" );
4947 ok( r
== ERROR_SUCCESS
, "cannot add launch condition: %d\n", r
);
4949 /* invalid condition */
4950 r
= add_launchcondition_entry( hdb
, "'X != \"1\"', 'one'" );
4951 ok( r
== ERROR_SUCCESS
, "cannot add launch condition: %d\n", r
);
4953 hpkg
= package_from_db( hdb
);
4954 ok( hpkg
, "failed to create package\n");
4956 MsiCloseHandle( hdb
);
4958 r
= MsiSetProperty( hpkg
, "X", "1" );
4959 ok( r
== ERROR_SUCCESS
, "failed to set property\n" );
4961 /* invalid conditions are ignored */
4962 r
= MsiDoAction( hpkg
, "LaunchConditions" );
4963 ok( r
== ERROR_SUCCESS
, "cost init failed\n" );
4965 /* verify LaunchConditions still does some verification */
4966 r
= MsiSetProperty( hpkg
, "X", "2" );
4967 ok( r
== ERROR_SUCCESS
, "failed to set property\n" );
4969 r
= MsiDoAction( hpkg
, "LaunchConditions" );
4970 ok( r
== ERROR_INSTALL_FAILURE
, "Expected ERROR_INSTALL_FAILURE, got %d\n", r
);
4972 MsiCloseHandle( hpkg
);
4973 DeleteFile( msifile
);
4976 static void test_ccpsearch(void)
4978 MSIHANDLE hdb
, hpkg
;
4979 CHAR prop
[MAX_PATH
];
4980 DWORD size
= MAX_PATH
;
4983 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
4985 hdb
= create_package_db();
4986 ok(hdb
, "failed to create package database\n");
4988 r
= create_ccpsearch_table(hdb
);
4989 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4991 r
= add_ccpsearch_entry(hdb
, "'CCP_random'");
4992 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4994 r
= add_ccpsearch_entry(hdb
, "'RMCCP_random'");
4995 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4997 r
= create_reglocator_table(hdb
);
4998 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5000 r
= add_reglocator_entry(hdb
, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
5001 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5003 r
= create_drlocator_table(hdb
);
5004 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5006 r
= add_drlocator_entry(hdb
, "'RMCCP_random', '', 'C:\\', '0'");
5007 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5009 r
= create_signature_table(hdb
);
5010 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5012 hpkg
= package_from_db(hdb
);
5013 ok(hpkg
, "failed to create package\n");
5015 MsiCloseHandle(hdb
);
5017 r
= MsiDoAction(hpkg
, "CCPSearch");
5018 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5020 r
= MsiGetPropertyA(hpkg
, "CCP_Success", prop
, &size
);
5021 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5022 ok(!lstrcmpA(prop
, "1"), "Expected 1, got %s\n", prop
);
5024 MsiCloseHandle(hpkg
);
5025 DeleteFileA(msifile
);
5028 static BOOL
squash_guid(LPCWSTR in
, LPWSTR out
)
5033 if (FAILED(CLSIDFromString((LPOLESTR
)in
, &guid
)))
5040 out
[11-i
] = in
[n
++];
5043 out
[15-i
] = in
[n
++];
5047 out
[17+i
*2] = in
[n
++];
5048 out
[16+i
*2] = in
[n
++];
5053 out
[17+i
*2] = in
[n
++];
5054 out
[16+i
*2] = in
[n
++];
5060 static void set_component_path(LPCSTR filename
, LPCSTR guid
)
5062 WCHAR guidW
[MAX_PATH
];
5063 WCHAR squashedW
[MAX_PATH
];
5064 CHAR squashed
[MAX_PATH
];
5065 CHAR substr
[MAX_PATH
];
5066 CHAR path
[MAX_PATH
];
5069 MultiByteToWideChar(CP_ACP
, 0, guid
, -1, guidW
, MAX_PATH
);
5070 squash_guid(guidW
, squashedW
);
5071 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
5073 lstrcpyA(substr
, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
5074 "Installer\\UserData\\S-1-5-18\\Components\\");
5075 lstrcatA(substr
, squashed
);
5077 RegCreateKeyA(HKEY_LOCAL_MACHINE
, substr
, &hkey
);
5079 lstrcpyA(path
, CURR_DIR
);
5080 lstrcatA(path
, "\\");
5081 lstrcatA(path
, filename
);
5083 /* just using a random squashed product code */
5084 RegSetValueExA(hkey
, "7D2F387510109040002000060BECB6AB", 0,
5085 REG_SZ
, (LPBYTE
)path
, lstrlenA(path
));
5089 lstrcpyA(substr
, "SOFTWARE\\Classes\\Installer\\Products\\7D2F387510109040002000060BECB6AB");
5090 RegCreateKeyA(HKEY_LOCAL_MACHINE
, substr
, &hkey
);
5093 static void delete_component_path(LPCSTR guid
)
5095 WCHAR guidW
[MAX_PATH
];
5096 WCHAR squashedW
[MAX_PATH
];
5097 WCHAR substrW
[MAX_PATH
];
5098 CHAR squashed
[MAX_PATH
];
5099 CHAR substr
[MAX_PATH
];
5101 MultiByteToWideChar(CP_ACP
, 0, guid
, -1, guidW
, MAX_PATH
);
5102 squash_guid(guidW
, squashedW
);
5103 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
5105 lstrcpyA(substr
, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
5106 "Installer\\UserData\\S-1-5-18\\Components\\");
5107 lstrcatA(substr
, squashed
);
5109 MultiByteToWideChar(CP_ACP
, 0, substr
, -1, substrW
, MAX_PATH
);
5110 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE
, substrW
);
5112 lstrcpyA(substr
, "SOFTWARE\\Classes\\Installer\\Products\\7D2F387510109040002000060BECB6AB");
5113 MultiByteToWideChar(CP_ACP
, 0, substr
, -1, substrW
, MAX_PATH
);
5114 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE
, substrW
);
5117 static void test_complocator(void)
5119 MSIHANDLE hdb
, hpkg
;
5121 CHAR prop
[MAX_PATH
];
5122 CHAR expected
[MAX_PATH
];
5123 DWORD size
= MAX_PATH
;
5125 hdb
= create_package_db();
5126 ok(hdb
, "failed to create package database\n");
5128 r
= create_appsearch_table(hdb
);
5129 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5131 r
= add_appsearch_entry(hdb
, "'ABELISAURUS', 'abelisaurus'");
5132 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5134 r
= add_appsearch_entry(hdb
, "'BACTROSAURUS', 'bactrosaurus'");
5135 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5137 r
= add_appsearch_entry(hdb
, "'CAMELOTIA', 'camelotia'");
5138 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5140 r
= add_appsearch_entry(hdb
, "'DICLONIUS', 'diclonius'");
5141 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5143 r
= add_appsearch_entry(hdb
, "'ECHINODON', 'echinodon'");
5144 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5146 r
= add_appsearch_entry(hdb
, "'FALCARIUS', 'falcarius'");
5147 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5149 r
= add_appsearch_entry(hdb
, "'GALLIMIMUS', 'gallimimus'");
5150 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5152 r
= add_appsearch_entry(hdb
, "'HAGRYPHUS', 'hagryphus'");
5153 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5155 r
= add_appsearch_entry(hdb
, "'IGUANODON', 'iguanodon'");
5156 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5158 r
= add_appsearch_entry(hdb
, "'JOBARIA', 'jobaria'");
5159 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5161 r
= add_appsearch_entry(hdb
, "'KAKURU', 'kakuru'");
5162 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5164 r
= add_appsearch_entry(hdb
, "'LABOCANIA', 'labocania'");
5165 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5167 r
= add_appsearch_entry(hdb
, "'MEGARAPTOR', 'megaraptor'");
5168 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5170 r
= add_appsearch_entry(hdb
, "'NEOSODON', 'neosodon'");
5171 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5173 r
= add_appsearch_entry(hdb
, "'OLOROTITAN', 'olorotitan'");
5174 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5176 r
= add_appsearch_entry(hdb
, "'PANTYDRACO', 'pantydraco'");
5177 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5179 r
= create_complocator_table(hdb
);
5180 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5182 r
= add_complocator_entry(hdb
, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
5183 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5185 r
= add_complocator_entry(hdb
, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
5186 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5188 r
= add_complocator_entry(hdb
, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
5189 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5191 r
= add_complocator_entry(hdb
, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
5192 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5194 r
= add_complocator_entry(hdb
, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
5195 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5197 r
= add_complocator_entry(hdb
, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
5198 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5200 r
= add_complocator_entry(hdb
, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
5201 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5203 r
= add_complocator_entry(hdb
, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
5204 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5206 r
= add_complocator_entry(hdb
, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
5207 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5209 r
= add_complocator_entry(hdb
, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
5210 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5212 r
= add_complocator_entry(hdb
, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
5213 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5215 r
= add_complocator_entry(hdb
, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
5216 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5218 r
= add_complocator_entry(hdb
, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
5219 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5221 r
= add_complocator_entry(hdb
, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
5222 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5224 r
= add_complocator_entry(hdb
, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
5225 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5227 r
= add_complocator_entry(hdb
, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
5228 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5230 r
= create_signature_table(hdb
);
5231 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5233 r
= add_signature_entry(hdb
, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
5234 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5236 r
= add_signature_entry(hdb
, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
5237 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5239 r
= add_signature_entry(hdb
, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
5240 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5242 r
= add_signature_entry(hdb
, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
5243 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5245 r
= add_signature_entry(hdb
, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
5246 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5248 r
= add_signature_entry(hdb
, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
5249 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5251 r
= add_signature_entry(hdb
, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
5252 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5254 r
= add_signature_entry(hdb
, "'labocania', 'labocania', '', '', '', '', '', '', ''");
5255 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5257 hpkg
= package_from_db(hdb
);
5258 ok(hpkg
, "failed to create package\n");
5260 MsiCloseHandle(hdb
);
5262 create_test_file("abelisaurus");
5263 create_test_file("bactrosaurus");
5264 create_test_file("camelotia");
5265 create_test_file("diclonius");
5266 create_test_file("echinodon");
5267 create_test_file("falcarius");
5268 create_test_file("gallimimus");
5269 create_test_file("hagryphus");
5270 CreateDirectoryA("iguanodon", NULL
);
5271 CreateDirectoryA("jobaria", NULL
);
5272 CreateDirectoryA("kakuru", NULL
);
5273 CreateDirectoryA("labocania", NULL
);
5274 CreateDirectoryA("megaraptor", NULL
);
5275 CreateDirectoryA("neosodon", NULL
);
5276 CreateDirectoryA("olorotitan", NULL
);
5277 CreateDirectoryA("pantydraco", NULL
);
5279 set_component_path("abelisaurus", "{E3619EED-305A-418C-B9C7-F7D7377F0934}");
5280 set_component_path("bactrosaurus", "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}");
5281 set_component_path("echinodon", "{A19E16C5-C75D-4699-8111-C4338C40C3CB}");
5282 set_component_path("falcarius", "{17762FA1-A7AE-4CC6-8827-62873C35361D}");
5283 set_component_path("iguanodon", "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}");
5284 set_component_path("jobaria", "{243C22B1-8C51-4151-B9D1-1AE5265E079E}");
5285 set_component_path("megaraptor", "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}");
5286 set_component_path("neosodon", "{0B499649-197A-48EF-93D2-AF1C17ED6E90}");
5288 r
= MsiDoAction(hpkg
, "AppSearch");
5289 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5292 r
= MsiGetPropertyA(hpkg
, "ABELISAURUS", prop
, &size
);
5293 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5295 lstrcpyA(expected
, CURR_DIR
);
5296 lstrcatA(expected
, "\\abelisaurus");
5297 ok(!lstrcmpA(prop
, expected
), "Expected %s, got %s\n", expected
, prop
);
5300 r
= MsiGetPropertyA(hpkg
, "BACTROSAURUS", prop
, &size
);
5301 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5302 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5305 r
= MsiGetPropertyA(hpkg
, "CAMELOTIA", prop
, &size
);
5306 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5307 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5310 r
= MsiGetPropertyA(hpkg
, "DICLONIUS", prop
, &size
);
5311 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5312 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5315 r
= MsiGetPropertyA(hpkg
, "ECHINODON", prop
, &size
);
5316 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5318 lstrcpyA(expected
, CURR_DIR
);
5319 lstrcatA(expected
, "\\");
5320 ok(!lstrcmpA(prop
, expected
), "Expected %s, got %s\n", expected
, prop
);
5323 r
= MsiGetPropertyA(hpkg
, "FALCARIUS", prop
, &size
);
5324 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5325 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5328 r
= MsiGetPropertyA(hpkg
, "GALLIMIMUS", prop
, &size
);
5329 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5330 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5333 r
= MsiGetPropertyA(hpkg
, "HAGRYPHUS", prop
, &size
);
5334 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5335 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5338 r
= MsiGetPropertyA(hpkg
, "IGUANODON", prop
, &size
);
5339 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5340 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5343 r
= MsiGetPropertyA(hpkg
, "JOBARIA", prop
, &size
);
5344 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5345 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5348 r
= MsiGetPropertyA(hpkg
, "KAKURU", prop
, &size
);
5349 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5350 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5353 r
= MsiGetPropertyA(hpkg
, "LABOCANIA", prop
, &size
);
5354 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5355 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5358 r
= MsiGetPropertyA(hpkg
, "MEGARAPTOR", prop
, &size
);
5359 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5361 lstrcpyA(expected
, CURR_DIR
);
5362 lstrcatA(expected
, "\\");
5363 ok(!lstrcmpA(prop
, expected
), "Expected %s, got %s\n", expected
, prop
);
5366 r
= MsiGetPropertyA(hpkg
, "NEOSODON", prop
, &size
);
5367 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5369 lstrcpyA(expected
, CURR_DIR
);
5370 lstrcatA(expected
, "\\neosodon\\");
5371 ok(!lstrcmpA(prop
, expected
), "Expected %s, got %s\n", expected
, prop
);
5374 r
= MsiGetPropertyA(hpkg
, "OLOROTITAN", prop
, &size
);
5375 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5376 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5379 r
= MsiGetPropertyA(hpkg
, "PANTYDRACO", prop
, &size
);
5380 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5381 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5383 MsiCloseHandle(hpkg
);
5384 DeleteFileA("abelisaurus");
5385 DeleteFileA("bactrosaurus");
5386 DeleteFileA("camelotia");
5387 DeleteFileA("diclonius");
5388 DeleteFileA("echinodon");
5389 DeleteFileA("falcarius");
5390 DeleteFileA("gallimimus");
5391 DeleteFileA("hagryphus");
5392 RemoveDirectoryA("iguanodon");
5393 RemoveDirectoryA("jobaria");
5394 RemoveDirectoryA("kakuru");
5395 RemoveDirectoryA("labocania");
5396 RemoveDirectoryA("megaraptor");
5397 RemoveDirectoryA("neosodon");
5398 RemoveDirectoryA("olorotitan");
5399 RemoveDirectoryA("pantydraco");
5400 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}");
5401 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}");
5402 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}");
5403 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}");
5404 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}");
5405 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}");
5406 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}");
5407 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}");
5408 DeleteFileA(msifile
);
5413 GetCurrentDirectoryA(MAX_PATH
, CURR_DIR
);
5415 test_createpackage();
5416 test_getsourcepath_bad();
5417 test_getsourcepath();
5419 test_gettargetpath_bad();
5420 test_settargetpath();
5422 test_property_table();
5425 test_formatrecord2();
5430 test_featureparents();
5431 test_installprops();
5432 test_sourcedirprop();
5434 test_launchconditions();