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_directory_entry( MSIHANDLE hdb
, const char *values
)
326 char insert
[] = "INSERT INTO `Directory` (`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )";
330 sz
= strlen(values
) + sizeof insert
;
331 query
= HeapAlloc(GetProcessHeap(),0,sz
);
332 sprintf(query
,insert
,values
);
333 r
= run_query( hdb
, query
);
334 HeapFree(GetProcessHeap(), 0, query
);
338 static UINT
add_feature_entry( MSIHANDLE hdb
, const char *values
)
340 char insert
[] = "INSERT INTO `Feature` (`Feature`, `Feature_Parent`, "
341 "`Title`, `Description`, `Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )";
345 sz
= strlen(values
) + sizeof insert
;
346 query
= HeapAlloc(GetProcessHeap(),0,sz
);
347 sprintf(query
,insert
,values
);
348 r
= run_query( hdb
, query
);
349 HeapFree(GetProcessHeap(), 0, query
);
353 static UINT
add_feature_components_entry( MSIHANDLE hdb
, const char *values
)
355 char insert
[] = "INSERT INTO `FeatureComponents` "
356 "(`Feature_`, `Component_`) "
361 sz
= strlen(values
) + sizeof insert
;
362 query
= HeapAlloc(GetProcessHeap(),0,sz
);
363 sprintf(query
,insert
,values
);
364 r
= run_query( hdb
, query
);
365 HeapFree(GetProcessHeap(), 0, query
);
369 static UINT
add_file_entry( MSIHANDLE hdb
, const char *values
)
371 char insert
[] = "INSERT INTO `File` "
372 "(`File`, `Component_`, `FileName`, `FileSize`, `Version`, `Language`, `Attributes`, `Sequence`) "
377 sz
= strlen(values
) + sizeof insert
;
378 query
= HeapAlloc(GetProcessHeap(),0,sz
);
379 sprintf(query
,insert
,values
);
380 r
= run_query( hdb
, query
);
381 HeapFree(GetProcessHeap(), 0, query
);
385 static UINT
add_appsearch_entry( MSIHANDLE hdb
, const char *values
)
387 char insert
[] = "INSERT INTO `AppSearch` "
388 "(`Property`, `Signature_`) "
393 sz
= strlen(values
) + sizeof insert
;
394 query
= HeapAlloc(GetProcessHeap(),0,sz
);
395 sprintf(query
,insert
,values
);
396 r
= run_query( hdb
, query
);
397 HeapFree(GetProcessHeap(), 0, query
);
401 static UINT
add_reglocator_entry( MSIHANDLE hdb
, const char *values
)
403 char insert
[] = "INSERT INTO `RegLocator` "
404 "(`Signature_`, `Root`, `Key`, `Name`, `Type`) "
409 sz
= strlen(values
) + sizeof insert
;
410 query
= HeapAlloc(GetProcessHeap(),0,sz
);
411 sprintf(query
,insert
,values
);
412 r
= run_query( hdb
, query
);
413 HeapFree(GetProcessHeap(), 0, query
);
417 static UINT
add_signature_entry( MSIHANDLE hdb
, const char *values
)
419 char insert
[] = "INSERT INTO `Signature` "
420 "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
421 " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
426 sz
= strlen(values
) + sizeof insert
;
427 query
= HeapAlloc(GetProcessHeap(),0,sz
);
428 sprintf(query
,insert
,values
);
429 r
= run_query( hdb
, query
);
430 HeapFree(GetProcessHeap(), 0, query
);
434 static UINT
add_launchcondition_entry( MSIHANDLE hdb
, const char *values
)
436 char insert
[] = "INSERT INTO `LaunchCondition` "
437 "(`Condition`, `Description`) "
442 sz
= strlen(values
) + sizeof insert
;
443 query
= HeapAlloc(GetProcessHeap(),0,sz
);
444 sprintf(query
,insert
,values
);
445 r
= run_query( hdb
, query
);
446 HeapFree(GetProcessHeap(), 0, query
);
450 static UINT
add_property_entry( MSIHANDLE hdb
, const char *values
)
452 char insert
[] = "INSERT INTO `Property` "
453 "(`Property`, `Value`) "
458 sz
= strlen(values
) + sizeof insert
;
459 query
= HeapAlloc(GetProcessHeap(),0,sz
);
460 sprintf(query
,insert
,values
);
461 r
= run_query( hdb
, query
);
462 HeapFree(GetProcessHeap(), 0, query
);
466 static UINT
add_install_execute_sequence_entry( MSIHANDLE hdb
, const char *values
)
468 char insert
[] = "INSERT INTO `InstallExecuteSequence` "
469 "(`Action`, `Condition`, `Sequence`) "
474 sz
= strlen(values
) + sizeof insert
;
475 query
= HeapAlloc(GetProcessHeap(),0,sz
);
476 sprintf(query
,insert
,values
);
477 r
= run_query( hdb
, query
);
478 HeapFree(GetProcessHeap(), 0, query
);
482 static UINT
add_media_entry( MSIHANDLE hdb
, const char *values
)
484 char insert
[] = "INSERT INTO `Media` "
485 "(`DiskId`, `LastSequence`, `DiskPrompt`, `Cabinet`, `VolumeLabel`, `Source`) "
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_ccpsearch_entry( MSIHANDLE hdb
, const char *values
)
500 char insert
[] = "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )";
504 sz
= strlen(values
) + sizeof insert
;
505 query
= HeapAlloc(GetProcessHeap(),0,sz
);
506 sprintf(query
,insert
,values
);
507 r
= run_query( hdb
, query
);
508 HeapFree(GetProcessHeap(), 0, query
);
512 static UINT
add_drlocator_entry( MSIHANDLE hdb
, const char *values
)
514 char insert
[] = "INSERT INTO `DrLocator` "
515 "(`Signature_`, `Parent`, `Path`, `Depth`) "
520 sz
= strlen(values
) + sizeof insert
;
521 query
= HeapAlloc(GetProcessHeap(),0,sz
);
522 sprintf(query
,insert
,values
);
523 r
= run_query( hdb
, query
);
524 HeapFree(GetProcessHeap(), 0, query
);
528 static UINT
add_complocator_entry( MSIHANDLE hdb
, const char *values
)
530 char insert
[] = "INSERT INTO `CompLocator` "
531 "(`Signature_`, `ComponentId`, `Type`) "
536 sz
= strlen(values
) + sizeof insert
;
537 query
= HeapAlloc(GetProcessHeap(),0,sz
);
538 sprintf(query
,insert
,values
);
539 r
= run_query( hdb
, query
);
540 HeapFree(GetProcessHeap(), 0, query
);
544 static UINT
set_summary_info(MSIHANDLE hdb
)
549 /* build summary info */
550 res
= MsiGetSummaryInformation(hdb
, NULL
, 7, &suminfo
);
551 ok( res
== ERROR_SUCCESS
, "Failed to open summaryinfo\n" );
553 res
= MsiSummaryInfoSetProperty(suminfo
,2, VT_LPSTR
, 0,NULL
,
554 "Installation Database");
555 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
557 res
= MsiSummaryInfoSetProperty(suminfo
,3, VT_LPSTR
, 0,NULL
,
558 "Installation Database");
559 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
561 res
= MsiSummaryInfoSetProperty(suminfo
,4, VT_LPSTR
, 0,NULL
,
563 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
565 res
= MsiSummaryInfoSetProperty(suminfo
,7, VT_LPSTR
, 0,NULL
,
567 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
569 res
= MsiSummaryInfoSetProperty(suminfo
,9, VT_LPSTR
, 0,NULL
,
570 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
571 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
573 res
= MsiSummaryInfoSetProperty(suminfo
, 14, VT_I4
, 100, NULL
, NULL
);
574 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
576 res
= MsiSummaryInfoSetProperty(suminfo
, 15, VT_I4
, 0, NULL
, NULL
);
577 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
579 res
= MsiSummaryInfoPersist(suminfo
);
580 ok( res
== ERROR_SUCCESS
, "Failed to make summary info persist\n" );
582 res
= MsiCloseHandle( suminfo
);
583 ok( res
== ERROR_SUCCESS
, "Failed to close suminfo\n" );
589 static MSIHANDLE
create_package_db(void)
596 /* create an empty database */
597 res
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
598 ok( res
== ERROR_SUCCESS
, "Failed to create database\n" );
599 if( res
!= ERROR_SUCCESS
)
602 res
= MsiDatabaseCommit( hdb
);
603 ok( res
== ERROR_SUCCESS
, "Failed to commit database\n" );
605 res
= set_summary_info(hdb
);
607 res
= run_query( hdb
,
608 "CREATE TABLE `Directory` ( "
609 "`Directory` CHAR(255) NOT NULL, "
610 "`Directory_Parent` CHAR(255), "
611 "`DefaultDir` CHAR(255) NOT NULL "
612 "PRIMARY KEY `Directory`)" );
613 ok( res
== ERROR_SUCCESS
, "Failed to create directory table\n" );
618 static MSIHANDLE
package_from_db(MSIHANDLE hdb
)
624 sprintf(szPackage
,"#%li",hdb
);
625 res
= MsiOpenPackage(szPackage
,&hPackage
);
626 if (res
!= ERROR_SUCCESS
)
629 res
= MsiCloseHandle(hdb
);
630 if (res
!= ERROR_SUCCESS
)
636 static void create_test_file(const CHAR
*name
)
641 file
= CreateFileA(name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, NULL
);
642 ok(file
!= INVALID_HANDLE_VALUE
, "Failure to open file %s\n", name
);
643 WriteFile(file
, name
, strlen(name
), &written
, NULL
);
644 WriteFile(file
, "\n", strlen("\n"), &written
, NULL
);
648 static void test_createpackage(void)
650 MSIHANDLE hPackage
= 0;
653 hPackage
= package_from_db(create_package_db());
654 ok( hPackage
!= 0, " Failed to create package\n");
656 res
= MsiCloseHandle( hPackage
);
657 ok( res
== ERROR_SUCCESS
, "Failed to close package\n" );
661 static void test_doaction( void )
666 r
= MsiDoAction( -1, NULL
);
667 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
669 hpkg
= package_from_db(create_package_db());
670 ok( hpkg
, "failed to create package\n");
672 r
= MsiDoAction(hpkg
, NULL
);
673 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
675 r
= MsiDoAction(0, "boo");
676 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
678 r
= MsiDoAction(hpkg
, "boo");
679 ok( r
== ERROR_FUNCTION_NOT_CALLED
, "wrong return val\n");
681 MsiCloseHandle( hpkg
);
685 static void test_gettargetpath_bad(void)
692 hpkg
= package_from_db(create_package_db());
693 ok( hpkg
, "failed to create package\n");
695 r
= MsiGetTargetPath( 0, NULL
, NULL
, NULL
);
696 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
698 r
= MsiGetTargetPath( 0, NULL
, NULL
, &sz
);
699 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
701 r
= MsiGetTargetPath( 0, "boo", NULL
, NULL
);
702 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
704 r
= MsiGetTargetPath( 0, "boo", NULL
, NULL
);
705 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
707 r
= MsiGetTargetPath( hpkg
, "boo", NULL
, NULL
);
708 ok( r
== ERROR_DIRECTORY
, "wrong return val\n");
710 r
= MsiGetTargetPath( hpkg
, "boo", buffer
, NULL
);
711 ok( r
== ERROR_DIRECTORY
, "wrong return val\n");
713 MsiCloseHandle( hpkg
);
717 static void query_file_path(MSIHANDLE hpkg
, LPCSTR file
, LPSTR buff
)
723 rec
= MsiCreateRecord( 1 );
724 ok(rec
, "MsiCreate record failed\n");
726 r
= MsiRecordSetString( rec
, 0, file
);
727 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
730 r
= MsiFormatRecord( hpkg
, rec
, buff
, &size
);
731 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
733 MsiCloseHandle( rec
);
736 static void test_settargetpath(void)
738 char tempdir
[MAX_PATH
+8], buffer
[MAX_PATH
], file
[MAX_PATH
];
744 hdb
= create_package_db();
745 ok ( hdb
, "failed to create package database\n" );
747 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'" );
748 ok( r
== S_OK
, "failed to add directory entry: %d\n" , r
);
750 r
= create_component_table( hdb
);
751 ok( r
== S_OK
, "cannot create Component table: %d\n", r
);
753 r
= add_component_entry( hdb
, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
754 ok( r
== S_OK
, "cannot add dummy component: %d\n", r
);
756 r
= add_component_entry( hdb
, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
757 ok( r
== S_OK
, "cannot add test component: %d\n", r
);
759 r
= create_feature_table( hdb
);
760 ok( r
== S_OK
, "cannot create Feature table: %d\n", r
);
762 r
= add_feature_entry( hdb
, "'TestFeature', '', '', '', 0, 1, '', 0" );
763 ok( r
== ERROR_SUCCESS
, "cannot add TestFeature to Feature table: %d\n", r
);
765 r
= create_feature_components_table( hdb
);
766 ok( r
== S_OK
, "cannot create FeatureComponents table: %d\n", r
);
768 r
= add_feature_components_entry( hdb
, "'TestFeature', 'RootComp'" );
769 ok( r
== S_OK
, "cannot insert component into FeatureComponents table: %d\n", r
);
771 r
= add_feature_components_entry( hdb
, "'TestFeature', 'TestComp'" );
772 ok( r
== S_OK
, "cannot insert component into FeatureComponents table: %d\n", r
);
774 add_directory_entry( hdb
, "'TestParent', 'TARGETDIR', 'TestParent'" );
775 add_directory_entry( hdb
, "'TestDir', 'TestParent', 'TestDir'" );
777 r
= create_file_table( hdb
);
778 ok( r
== S_OK
, "cannot create File table: %d\n", r
);
780 r
= add_file_entry( hdb
, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
781 ok( r
== S_OK
, "cannot add file to the File table: %d\n", r
);
783 r
= add_file_entry( hdb
, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
784 ok( r
== S_OK
, "cannot add file to the File table: %d\n", r
);
786 hpkg
= package_from_db( hdb
);
787 ok( hpkg
, "failed to create package\n");
789 r
= MsiDoAction( hpkg
, "CostInitialize");
790 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
792 r
= MsiDoAction( hpkg
, "FileCost");
793 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
795 r
= MsiDoAction( hpkg
, "CostFinalize");
796 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
798 r
= MsiSetTargetPath( 0, NULL
, NULL
);
799 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
801 r
= MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
802 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
804 r
= MsiSetTargetPath( hpkg
, "boo", NULL
);
805 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
807 r
= MsiSetTargetPath( hpkg
, "boo", "c:\\bogusx" );
808 ok( r
== ERROR_DIRECTORY
, "wrong return val\n");
810 sz
= sizeof tempdir
- 1;
811 r
= MsiGetTargetPath( hpkg
, "TARGETDIR", tempdir
, &sz
);
812 sprintf( file
, "%srootfile.txt", tempdir
);
813 query_file_path( hpkg
, "[#RootFile]", buffer
);
814 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
815 ok( !lstrcmp(buffer
, file
), "Expected %s, got %s\n", file
, buffer
);
817 GetTempFileName( tempdir
, "_wt", 0, buffer
);
818 sprintf( tempdir
, "%s\\subdir", buffer
);
820 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", buffer
);
821 ok( r
== ERROR_SUCCESS
|| r
== ERROR_DIRECTORY
,
822 "MsiSetTargetPath on file returned %d\n", r
);
824 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", tempdir
);
825 ok( r
== ERROR_SUCCESS
|| r
== ERROR_DIRECTORY
,
826 "MsiSetTargetPath on 'subdir' of file returned %d\n", r
);
828 DeleteFile( buffer
);
830 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", buffer
);
831 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath returned %d\n", r
);
833 r
= GetFileAttributes( buffer
);
834 ok ( r
== INVALID_FILE_ATTRIBUTES
, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r
);
836 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", tempdir
);
837 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath on subsubdir returned %d\n", r
);
839 sz
= sizeof buffer
- 1;
840 lstrcat( tempdir
, "\\" );
841 r
= MsiGetTargetPath( hpkg
, "TARGETDIR", buffer
, &sz
);
842 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
843 ok( !lstrcmp(buffer
, tempdir
), "Expected %s, got %s\n", tempdir
, buffer
);
845 sprintf( file
, "%srootfile.txt", tempdir
);
846 query_file_path( hpkg
, "[#RootFile]", buffer
);
847 ok( !lstrcmp(buffer
, file
), "Expected %s, got %s\n", file
, buffer
);
849 r
= MsiSetTargetPath( hpkg
, "TestParent", "C:\\one\\two" );
850 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath returned %d\n", r
);
852 query_file_path( hpkg
, "[#TestFile]", buffer
);
853 ok( !lstrcmp(buffer
, "C:\\one\\two\\TestDir\\testfile.txt"),
854 "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer
);
856 sz
= sizeof buffer
- 1;
857 r
= MsiGetTargetPath( hpkg
, "TestParent", buffer
, &sz
);
858 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
859 ok( !lstrcmp(buffer
, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer
);
861 MsiCloseHandle( hpkg
);
864 static void test_condition(void)
869 hpkg
= package_from_db(create_package_db());
870 ok( hpkg
, "failed to create package\n");
872 r
= MsiEvaluateCondition(0, NULL
);
873 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
875 r
= MsiEvaluateCondition(hpkg
, NULL
);
876 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
878 r
= MsiEvaluateCondition(hpkg
, "");
879 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
881 r
= MsiEvaluateCondition(hpkg
, "1");
882 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
884 r
= MsiEvaluateCondition(hpkg
, "0");
885 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
887 r
= MsiEvaluateCondition(hpkg
, "-1");
888 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
890 r
= MsiEvaluateCondition(hpkg
, "0 = 0");
891 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
893 r
= MsiEvaluateCondition(hpkg
, "0 <> 0");
894 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
896 r
= MsiEvaluateCondition(hpkg
, "0 = 1");
897 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
899 r
= MsiEvaluateCondition(hpkg
, "0 > 1");
900 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
902 r
= MsiEvaluateCondition(hpkg
, "0 ~> 1");
903 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
905 r
= MsiEvaluateCondition(hpkg
, "1 > 1");
906 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
908 r
= MsiEvaluateCondition(hpkg
, "1 ~> 1");
909 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
911 r
= MsiEvaluateCondition(hpkg
, "0 >= 1");
912 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
914 r
= MsiEvaluateCondition(hpkg
, "0 ~>= 1");
915 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
917 r
= MsiEvaluateCondition(hpkg
, "1 >= 1");
918 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
920 r
= MsiEvaluateCondition(hpkg
, "1 ~>= 1");
921 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
923 r
= MsiEvaluateCondition(hpkg
, "0 < 1");
924 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
926 r
= MsiEvaluateCondition(hpkg
, "0 ~< 1");
927 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
929 r
= MsiEvaluateCondition(hpkg
, "1 < 1");
930 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
932 r
= MsiEvaluateCondition(hpkg
, "1 ~< 1");
933 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
935 r
= MsiEvaluateCondition(hpkg
, "0 <= 1");
936 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
938 r
= MsiEvaluateCondition(hpkg
, "0 ~<= 1");
939 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
941 r
= MsiEvaluateCondition(hpkg
, "1 <= 1");
942 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
944 r
= MsiEvaluateCondition(hpkg
, "1 ~<= 1");
945 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
947 r
= MsiEvaluateCondition(hpkg
, "0 >=");
948 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
950 r
= MsiEvaluateCondition(hpkg
, " ");
951 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
953 r
= MsiEvaluateCondition(hpkg
, "LicView <> \"1\"");
954 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
956 r
= MsiEvaluateCondition(hpkg
, "LicView <> \"0\"");
957 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
959 r
= MsiEvaluateCondition(hpkg
, "LicView <> LicView");
960 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
962 r
= MsiEvaluateCondition(hpkg
, "not 0");
963 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
965 r
= MsiEvaluateCondition(hpkg
, "not LicView");
966 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
968 r
= MsiEvaluateCondition(hpkg
, "not \"A\"");
969 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
971 r
= MsiEvaluateCondition(hpkg
, "~not \"A\"");
972 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
974 r
= MsiEvaluateCondition(hpkg
, "\"0\"");
975 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
977 r
= MsiEvaluateCondition(hpkg
, "1 and 2");
978 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
980 r
= MsiEvaluateCondition(hpkg
, "not 0 and 3");
981 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
983 r
= MsiEvaluateCondition(hpkg
, "not 0 and 0");
984 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
986 r
= MsiEvaluateCondition(hpkg
, "not 0 or 1");
987 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
989 r
= MsiEvaluateCondition(hpkg
, "(0)");
990 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
992 r
= MsiEvaluateCondition(hpkg
, "(((((1))))))");
993 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
995 r
= MsiEvaluateCondition(hpkg
, "(((((1)))))");
996 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
998 r
= MsiEvaluateCondition(hpkg
, " \"A\" < \"B\" ");
999 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1001 r
= MsiEvaluateCondition(hpkg
, " \"A\" > \"B\" ");
1002 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1004 r
= MsiEvaluateCondition(hpkg
, " \"1\" > \"12\" ");
1005 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1007 r
= MsiEvaluateCondition(hpkg
, " \"100\" < \"21\" ");
1008 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1010 r
= MsiEvaluateCondition(hpkg
, "0 < > 0");
1011 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1013 r
= MsiEvaluateCondition(hpkg
, "(1<<1) == 2");
1014 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1016 r
= MsiEvaluateCondition(hpkg
, " \"A\" = \"a\" ");
1017 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1019 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~ = \"a\" ");
1020 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1022 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~= \"a\" ");
1023 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1025 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~= 1 ");
1026 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1028 r
= MsiEvaluateCondition(hpkg
, " \"A\" = 1 ");
1029 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1031 r
= MsiEvaluateCondition(hpkg
, " 1 ~= 1 ");
1032 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1034 r
= MsiEvaluateCondition(hpkg
, " 1 ~= \"1\" ");
1035 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1037 r
= MsiEvaluateCondition(hpkg
, " 1 = \"1\" ");
1038 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1040 r
= MsiEvaluateCondition(hpkg
, " 0 = \"1\" ");
1041 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1043 r
= MsiEvaluateCondition(hpkg
, " 0 < \"100\" ");
1044 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1046 r
= MsiEvaluateCondition(hpkg
, " 100 > \"0\" ");
1047 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1049 r
= MsiEvaluateCondition(hpkg
, "1 XOR 1");
1050 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1052 r
= MsiEvaluateCondition(hpkg
, "1 IMP 1");
1053 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1055 r
= MsiEvaluateCondition(hpkg
, "1 IMP 0");
1056 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1058 r
= MsiEvaluateCondition(hpkg
, "0 IMP 0");
1059 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1061 r
= MsiEvaluateCondition(hpkg
, "0 EQV 0");
1062 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1064 r
= MsiEvaluateCondition(hpkg
, "0 EQV 1");
1065 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1067 r
= MsiEvaluateCondition(hpkg
, "1 IMP 1 OR 0");
1068 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1070 r
= MsiEvaluateCondition(hpkg
, "1 IMPL 1");
1071 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1073 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" >< \"S\" ");
1074 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1076 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"s\" ");
1077 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1079 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"\" ");
1080 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1082 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"sss\" ");
1083 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1085 MsiSetProperty(hpkg
, "mm", "5" );
1087 r
= MsiEvaluateCondition(hpkg
, "mm = 5");
1088 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1090 r
= MsiEvaluateCondition(hpkg
, "mm < 6");
1091 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1093 r
= MsiEvaluateCondition(hpkg
, "mm <= 5");
1094 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1096 r
= MsiEvaluateCondition(hpkg
, "mm > 4");
1097 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1099 r
= MsiEvaluateCondition(hpkg
, "mm < 12");
1100 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1102 r
= MsiEvaluateCondition(hpkg
, "mm = \"5\"");
1103 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1105 r
= MsiEvaluateCondition(hpkg
, "0 = \"\"");
1106 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1108 r
= MsiEvaluateCondition(hpkg
, "0 AND \"\"");
1109 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1111 r
= MsiEvaluateCondition(hpkg
, "1 AND \"\"");
1112 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1114 r
= MsiEvaluateCondition(hpkg
, "1 AND \"1\"");
1115 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1117 r
= MsiEvaluateCondition(hpkg
, "3 >< 1");
1118 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1120 r
= MsiEvaluateCondition(hpkg
, "3 >< 4");
1121 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1123 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 0");
1124 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1126 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 1");
1127 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1129 r
= MsiEvaluateCondition(hpkg
, "NOT 1 OR 0");
1130 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1132 r
= MsiEvaluateCondition(hpkg
, "0 AND 1 OR 1");
1133 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1135 r
= MsiEvaluateCondition(hpkg
, "0 AND 0 OR 1");
1136 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1138 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 1 OR 0");
1139 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1141 r
= MsiEvaluateCondition(hpkg
, "_1 = _1");
1142 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1144 r
= MsiEvaluateCondition(hpkg
, "( 1 AND 1 ) = 2");
1145 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1147 r
= MsiEvaluateCondition(hpkg
, "NOT ( 1 AND 1 )");
1148 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1150 r
= MsiEvaluateCondition(hpkg
, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1151 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1153 r
= MsiEvaluateCondition(hpkg
, "Installed<>\"\"");
1154 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1156 r
= MsiEvaluateCondition(hpkg
, "NOT 1 AND 0");
1157 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1159 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1160 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1162 r
= MsiEvaluateCondition(hpkg
, "bandalmael<>0");
1163 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1165 r
= MsiEvaluateCondition(hpkg
, "bandalmael<0");
1166 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1168 r
= MsiEvaluateCondition(hpkg
, "bandalmael>0");
1169 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1171 r
= MsiEvaluateCondition(hpkg
, "bandalmael>=0");
1172 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1174 r
= MsiEvaluateCondition(hpkg
, "bandalmael<=0");
1175 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1177 r
= MsiEvaluateCondition(hpkg
, "bandalmael~<>0");
1178 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1180 MsiSetProperty(hpkg
, "bandalmael", "0" );
1181 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1182 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1184 MsiSetProperty(hpkg
, "bandalmael", "" );
1185 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1186 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1188 MsiSetProperty(hpkg
, "bandalmael", "asdf" );
1189 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1190 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1192 MsiSetProperty(hpkg
, "bandalmael", "0asdf" );
1193 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1194 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1196 MsiSetProperty(hpkg
, "bandalmael", "0 " );
1197 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1198 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1200 MsiSetProperty(hpkg
, "bandalmael", "-0" );
1201 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1202 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1204 MsiSetProperty(hpkg
, "bandalmael", "0000000000000" );
1205 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1206 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1208 MsiSetProperty(hpkg
, "bandalmael", "--0" );
1209 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1210 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1212 MsiSetProperty(hpkg
, "bandalmael", "0x00" );
1213 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1214 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1216 MsiSetProperty(hpkg
, "bandalmael", "-" );
1217 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1218 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1220 MsiSetProperty(hpkg
, "bandalmael", "+0" );
1221 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1222 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1224 MsiSetProperty(hpkg
, "bandalmael", "0.0" );
1225 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1226 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1227 r
= MsiEvaluateCondition(hpkg
, "bandalmael<>0");
1228 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1230 MsiSetProperty(hpkg
, "one", "hi");
1231 MsiSetProperty(hpkg
, "two", "hithere");
1232 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1233 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1235 MsiSetProperty(hpkg
, "one", "hithere");
1236 MsiSetProperty(hpkg
, "two", "hi");
1237 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1238 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1240 MsiSetProperty(hpkg
, "one", "hello");
1241 MsiSetProperty(hpkg
, "two", "hi");
1242 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1243 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1245 MsiSetProperty(hpkg
, "one", "hellohithere");
1246 MsiSetProperty(hpkg
, "two", "hi");
1247 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1248 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1250 MsiSetProperty(hpkg
, "one", "");
1251 MsiSetProperty(hpkg
, "two", "hi");
1252 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1253 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1255 MsiSetProperty(hpkg
, "one", "hi");
1256 MsiSetProperty(hpkg
, "two", "");
1257 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1258 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1260 MsiSetProperty(hpkg
, "one", "");
1261 MsiSetProperty(hpkg
, "two", "");
1262 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1263 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1265 MsiSetProperty(hpkg
, "one", "1234");
1266 MsiSetProperty(hpkg
, "two", "1");
1267 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1268 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1270 MsiSetProperty(hpkg
, "one", "one 1234");
1271 MsiSetProperty(hpkg
, "two", "1");
1272 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1273 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1275 MsiSetProperty(hpkg
, "one", "hithere");
1276 MsiSetProperty(hpkg
, "two", "hi");
1277 r
= MsiEvaluateCondition(hpkg
, "one << two");
1278 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1280 MsiSetProperty(hpkg
, "one", "hi");
1281 MsiSetProperty(hpkg
, "two", "hithere");
1282 r
= MsiEvaluateCondition(hpkg
, "one << two");
1283 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1285 MsiSetProperty(hpkg
, "one", "hi");
1286 MsiSetProperty(hpkg
, "two", "hi");
1287 r
= MsiEvaluateCondition(hpkg
, "one << two");
1288 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1290 MsiSetProperty(hpkg
, "one", "abcdhithere");
1291 MsiSetProperty(hpkg
, "two", "hi");
1292 r
= MsiEvaluateCondition(hpkg
, "one << two");
1293 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1295 MsiSetProperty(hpkg
, "one", "");
1296 MsiSetProperty(hpkg
, "two", "hi");
1297 r
= MsiEvaluateCondition(hpkg
, "one << two");
1298 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1300 MsiSetProperty(hpkg
, "one", "hithere");
1301 MsiSetProperty(hpkg
, "two", "");
1302 r
= MsiEvaluateCondition(hpkg
, "one << two");
1303 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1305 MsiSetProperty(hpkg
, "one", "");
1306 MsiSetProperty(hpkg
, "two", "");
1307 r
= MsiEvaluateCondition(hpkg
, "one << two");
1308 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1310 MsiSetProperty(hpkg
, "one", "1234");
1311 MsiSetProperty(hpkg
, "two", "1");
1312 r
= MsiEvaluateCondition(hpkg
, "one << two");
1313 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1315 MsiSetProperty(hpkg
, "one", "1234 one");
1316 MsiSetProperty(hpkg
, "two", "1");
1317 r
= MsiEvaluateCondition(hpkg
, "one << two");
1318 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1320 MsiSetProperty(hpkg
, "one", "hithere");
1321 MsiSetProperty(hpkg
, "two", "there");
1322 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1323 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1325 MsiSetProperty(hpkg
, "one", "hithere");
1326 MsiSetProperty(hpkg
, "two", "hi");
1327 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1328 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1330 MsiSetProperty(hpkg
, "one", "there");
1331 MsiSetProperty(hpkg
, "two", "hithere");
1332 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1333 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1335 MsiSetProperty(hpkg
, "one", "there");
1336 MsiSetProperty(hpkg
, "two", "there");
1337 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1338 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1340 MsiSetProperty(hpkg
, "one", "abcdhithere");
1341 MsiSetProperty(hpkg
, "two", "hi");
1342 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1343 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1345 MsiSetProperty(hpkg
, "one", "");
1346 MsiSetProperty(hpkg
, "two", "there");
1347 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1348 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1350 MsiSetProperty(hpkg
, "one", "there");
1351 MsiSetProperty(hpkg
, "two", "");
1352 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1353 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1355 MsiSetProperty(hpkg
, "one", "");
1356 MsiSetProperty(hpkg
, "two", "");
1357 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1358 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1360 MsiSetProperty(hpkg
, "one", "1234");
1361 MsiSetProperty(hpkg
, "two", "4");
1362 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1363 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1365 MsiSetProperty(hpkg
, "one", "one 1234");
1366 MsiSetProperty(hpkg
, "two", "4");
1367 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1368 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1370 MsiSetProperty(hpkg
, "MsiNetAssemblySupport", NULL
); /* make sure it's empty */
1372 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322\"");
1373 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1375 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport > \"1.1.4322\"");
1376 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1378 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport >= \"1.1.4322\"");
1379 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1381 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport <= \"1.1.4322\"");
1382 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1384 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport <> \"1.1.4322\"");
1385 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1387 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1388 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1390 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"abcd\"");
1391 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1393 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a1.1.4322\"");
1394 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1396 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322a\"");
1397 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1399 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1400 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1402 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1403 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1405 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1406 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1408 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"1.1");
1409 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1411 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"1.1\"");
1412 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1414 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"12.1\"");
1415 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1417 r
= MsiEvaluateCondition(hpkg
, "\"02.1\" < \"2.11\"");
1418 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1420 r
= MsiEvaluateCondition(hpkg
, "\"02.1.1\" < \"2.1\"");
1421 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1423 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1\"");
1424 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1426 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1\"");
1427 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1429 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"0\"");
1430 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1432 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"-1\"");
1433 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1435 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a\"");
1436 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1438 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"!\"");
1439 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1441 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"!\"");
1442 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1444 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"/\"");
1445 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1447 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \" \"");
1448 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1450 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"azAZ_\"");
1451 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1453 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a[a]\"");
1454 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1456 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a[a]a\"");
1457 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1459 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a]\"");
1460 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1462 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a]a\"");
1463 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1465 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"{a}\"");
1466 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1468 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"{a\"");
1469 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1471 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a\"");
1472 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1474 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a{\"");
1475 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1477 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a]\"");
1478 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1480 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"A\"");
1481 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1483 MsiSetProperty(hpkg
, "MsiNetAssemblySupport", "1.1.4322");
1484 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322\"");
1485 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1487 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.14322\"");
1488 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1490 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.5\"");
1491 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1493 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1\"");
1494 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1496 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1\"");
1497 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1499 MsiSetProperty(hpkg
, "one", "1");
1500 r
= MsiEvaluateCondition(hpkg
, "one < \"1\"");
1501 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1503 MsiSetProperty(hpkg
, "X", "5.0");
1505 r
= MsiEvaluateCondition(hpkg
, "X != \"\"");
1506 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1508 r
= MsiEvaluateCondition(hpkg
, "X =\"5.0\"");
1509 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1511 r
= MsiEvaluateCondition(hpkg
, "X =\"5.1\"");
1512 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1514 r
= MsiEvaluateCondition(hpkg
, "X =\"6.0\"");
1515 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1517 r
= MsiEvaluateCondition(hpkg
, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1518 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1520 r
= MsiEvaluateCondition(hpkg
, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1521 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1523 r
= MsiEvaluateCondition(hpkg
, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1524 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1526 /* feature doesn't exist */
1527 r
= MsiEvaluateCondition(hpkg
, "&nofeature");
1528 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1530 MsiSetProperty(hpkg
, "A", "2");
1531 MsiSetProperty(hpkg
, "X", "50");
1533 r
= MsiEvaluateCondition(hpkg
, "2 <= X");
1534 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1536 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1537 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1539 r
= MsiEvaluateCondition(hpkg
, "A <= 50");
1540 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1542 MsiSetProperty(hpkg
, "X", "50val");
1544 r
= MsiEvaluateCondition(hpkg
, "2 <= X");
1545 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1547 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1548 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1550 MsiSetProperty(hpkg
, "A", "7");
1551 MsiSetProperty(hpkg
, "X", "50");
1553 r
= MsiEvaluateCondition(hpkg
, "7 <= X");
1554 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1556 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1557 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1559 r
= MsiEvaluateCondition(hpkg
, "A <= 50");
1560 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1562 MsiSetProperty(hpkg
, "X", "50val");
1564 r
= MsiEvaluateCondition(hpkg
, "2 <= X");
1565 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1567 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1568 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1570 MsiCloseHandle( hpkg
);
1571 DeleteFile(msifile
);
1574 static BOOL
check_prop_empty( MSIHANDLE hpkg
, const char * prop
)
1582 r
= MsiGetProperty( hpkg
, prop
, buffer
, &sz
);
1583 return r
== ERROR_SUCCESS
&& buffer
[0] == 0 && sz
== 0;
1586 static void test_props(void)
1588 MSIHANDLE hpkg
, hdb
;
1593 hdb
= create_package_db();
1595 "CREATE TABLE `Property` ( "
1596 "`Property` CHAR(255) NOT NULL, "
1597 "`Value` CHAR(255) "
1598 "PRIMARY KEY `Property`)" );
1599 ok( r
== ERROR_SUCCESS
, "Failed\n" );
1602 "INSERT INTO `Property` "
1603 "(`Property`, `Value`) "
1604 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1605 ok( r
== ERROR_SUCCESS
, "Failed\n" );
1607 hpkg
= package_from_db( hdb
);
1608 ok( hpkg
, "failed to create package\n");
1610 /* test invalid values */
1611 r
= MsiGetProperty( 0, NULL
, NULL
, NULL
);
1612 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1614 r
= MsiGetProperty( hpkg
, NULL
, NULL
, NULL
);
1615 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1617 r
= MsiGetProperty( hpkg
, "boo", NULL
, NULL
);
1618 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1620 r
= MsiGetProperty( hpkg
, "boo", buffer
, NULL
);
1621 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1623 /* test retrieving an empty/nonexistent property */
1625 r
= MsiGetProperty( hpkg
, "boo", NULL
, &sz
);
1626 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1627 ok( sz
== 0, "wrong size returned\n");
1629 check_prop_empty( hpkg
, "boo");
1632 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1633 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1634 ok( !strcmp(buffer
,"x"), "buffer was changed\n");
1635 ok( sz
== 0, "wrong size returned\n");
1639 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1640 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1641 ok( buffer
[0] == 0, "buffer was not changed\n");
1642 ok( sz
== 0, "wrong size returned\n");
1644 /* set the property to something */
1645 r
= MsiSetProperty( 0, NULL
, NULL
);
1646 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
1648 r
= MsiSetProperty( hpkg
, NULL
, NULL
);
1649 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1651 r
= MsiSetProperty( hpkg
, "", NULL
);
1652 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1654 /* try set and get some illegal property identifiers */
1655 r
= MsiSetProperty( hpkg
, "", "asdf" );
1656 ok( r
== ERROR_FUNCTION_FAILED
, "wrong return val\n");
1658 r
= MsiSetProperty( hpkg
, "=", "asdf" );
1659 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1661 r
= MsiSetProperty( hpkg
, " ", "asdf" );
1662 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1664 r
= MsiSetProperty( hpkg
, "'", "asdf" );
1665 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1669 r
= MsiGetProperty( hpkg
, "'", buffer
, &sz
);
1670 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1671 ok( !strcmp(buffer
,"asdf"), "buffer was not changed\n");
1673 /* set empty values */
1674 r
= MsiSetProperty( hpkg
, "boo", NULL
);
1675 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1676 ok( check_prop_empty( hpkg
, "boo"), "prop wasn't empty\n");
1678 r
= MsiSetProperty( hpkg
, "boo", "" );
1679 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1680 ok( check_prop_empty( hpkg
, "boo"), "prop wasn't empty\n");
1682 /* set a non-empty value */
1683 r
= MsiSetProperty( hpkg
, "boo", "xyz" );
1684 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1688 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1689 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1690 ok( buffer
[0] == 0, "buffer was not changed\n");
1691 ok( sz
== 3, "wrong size returned\n");
1695 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1696 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1697 ok( !strcmp(buffer
,"xyz"), "buffer was not changed\n");
1698 ok( sz
== 3, "wrong size returned\n");
1702 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1703 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1704 ok( !strcmp(buffer
,"xy"), "buffer was not changed\n");
1705 ok( sz
== 3, "wrong size returned\n");
1707 r
= MsiSetProperty(hpkg
, "SourceDir", "foo");
1708 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1711 r
= MsiGetProperty(hpkg
, "SOURCEDIR", buffer
, &sz
);
1712 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1713 ok( !strcmp(buffer
,""), "buffer wrong\n");
1714 ok( sz
== 0, "wrong size returned\n");
1717 r
= MsiGetProperty(hpkg
, "SOMERANDOMNAME", buffer
, &sz
);
1718 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1719 ok( !strcmp(buffer
,""), "buffer wrong\n");
1720 ok( sz
== 0, "wrong size returned\n");
1723 r
= MsiGetProperty(hpkg
, "SourceDir", buffer
, &sz
);
1724 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1725 ok( !strcmp(buffer
,"foo"), "buffer wrong\n");
1726 ok( sz
== 3, "wrong size returned\n");
1728 r
= MsiSetProperty(hpkg
, "MetadataCompName", "Photoshop.dll");
1729 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1732 r
= MsiGetProperty(hpkg
, "MetadataCompName", NULL
, &sz
);
1733 ok( r
== ERROR_SUCCESS
, "return wrong\n");
1734 ok( sz
== 13, "size wrong (%d)\n", sz
);
1737 r
= MsiGetProperty(hpkg
, "MetadataCompName", buffer
, &sz
);
1738 ok( r
== ERROR_MORE_DATA
, "return wrong\n");
1739 ok( !strcmp(buffer
,"Photoshop.dl"), "buffer wrong\n");
1741 r
= MsiSetProperty(hpkg
, "property", "value");
1742 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1745 r
= MsiGetProperty(hpkg
, "property", buffer
, &sz
);
1746 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1747 ok( !strcmp(buffer
, "value"), "Expected value, got %s\n", buffer
);
1749 r
= MsiSetProperty(hpkg
, "property", NULL
);
1750 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1753 r
= MsiGetProperty(hpkg
, "property", buffer
, &sz
);
1754 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1755 ok( !strlen(buffer
), "Expected empty string, got %s\n", buffer
);
1757 MsiCloseHandle( hpkg
);
1758 DeleteFile(msifile
);
1761 static BOOL
find_prop_in_property(MSIHANDLE hdb
, LPCSTR prop
, LPCSTR val
)
1763 MSIHANDLE hview
, hrec
;
1765 CHAR buffer
[MAX_PATH
];
1769 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Property`", &hview
);
1770 ok(r
== ERROR_SUCCESS
, "MsiDatabaseOpenView failed\n");
1771 r
= MsiViewExecute(hview
, 0);
1772 ok(r
== ERROR_SUCCESS
, "MsiViewExecute failed\n");
1775 while (r
== ERROR_SUCCESS
&& !found
)
1777 r
= MsiViewFetch(hview
, &hrec
);
1778 if (r
!= ERROR_SUCCESS
) break;
1781 r
= MsiRecordGetString(hrec
, 1, buffer
, &sz
);
1782 if (r
== ERROR_SUCCESS
&& !lstrcmpA(buffer
, prop
))
1785 r
= MsiRecordGetString(hrec
, 2, buffer
, &sz
);
1786 if (r
== ERROR_SUCCESS
&& !lstrcmpA(buffer
, val
))
1790 MsiCloseHandle(hrec
);
1793 MsiViewClose(hview
);
1794 MsiCloseHandle(hview
);
1799 static void test_property_table(void)
1803 MSIHANDLE hpkg
, hdb
, hrec
;
1804 char buffer
[MAX_PATH
];
1808 hdb
= create_package_db();
1809 ok( hdb
, "failed to create package\n");
1811 hpkg
= package_from_db(hdb
);
1812 ok( hpkg
, "failed to create package\n");
1814 MsiCloseHandle(hdb
);
1816 hdb
= MsiGetActiveDatabase(hpkg
);
1818 query
= "CREATE TABLE `_Property` ( "
1819 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1820 r
= run_query(hdb
, query
);
1821 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
1823 MsiCloseHandle(hdb
);
1824 MsiCloseHandle(hpkg
);
1825 DeleteFile(msifile
);
1827 hdb
= create_package_db();
1828 ok( hdb
, "failed to create package\n");
1830 query
= "CREATE TABLE `_Property` ( "
1831 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1832 r
= run_query(hdb
, query
);
1833 ok(r
== ERROR_SUCCESS
, "failed to create table\n");
1835 query
= "ALTER `_Property` ADD `foo` INTEGER";
1836 r
= run_query(hdb
, query
);
1837 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "failed to add column\n");
1839 query
= "ALTER TABLE `_Property` ADD `foo` INTEGER";
1840 r
= run_query(hdb
, query
);
1841 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "failed to add column\n");
1843 query
= "ALTER TABLE `_Property` ADD `extra` INTEGER";
1844 r
= run_query(hdb
, query
);
1845 ok(r
== ERROR_SUCCESS
, "failed to add column\n");
1847 hpkg
= package_from_db(hdb
);
1850 ok(!hpkg
, "package should not be created\n");
1853 MsiCloseHandle(hdb
);
1854 MsiCloseHandle(hpkg
);
1855 DeleteFile(msifile
);
1857 hdb
= create_package_db();
1858 ok (hdb
, "failed to create package database\n");
1860 r
= create_property_table(hdb
);
1861 ok(r
== ERROR_SUCCESS
, "cannot create Property table: %d\n", r
);
1863 r
= add_property_entry(hdb
, "'prop', 'val'");
1864 ok(r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
1866 hpkg
= package_from_db(hdb
);
1867 ok(hpkg
, "failed to create package\n");
1869 MsiCloseHandle(hdb
);
1872 r
= MsiGetProperty(hpkg
, "prop", buffer
, &sz
);
1873 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1874 ok(!lstrcmp(buffer
, "val"), "Expected val, got %s\n", buffer
);
1876 hdb
= MsiGetActiveDatabase(hpkg
);
1878 found
= find_prop_in_property(hdb
, "prop", "val");
1879 ok(found
, "prop should be in the _Property table\n");
1881 r
= add_property_entry(hdb
, "'dantes', 'mercedes'");
1882 ok(r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
1884 query
= "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
1885 r
= do_query(hdb
, query
, &hrec
);
1886 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
1888 found
= find_prop_in_property(hdb
, "dantes", "mercedes");
1889 ok(found
== FALSE
, "dantes should not be in the _Property table\n");
1892 lstrcpy(buffer
, "aaa");
1893 r
= MsiGetProperty(hpkg
, "dantes", buffer
, &sz
);
1894 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1895 ok(lstrlenA(buffer
) == 0, "Expected empty string, got %s\n", buffer
);
1897 r
= MsiSetProperty(hpkg
, "dantes", "mercedes");
1898 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1900 found
= find_prop_in_property(hdb
, "dantes", "mercedes");
1901 ok(found
== TRUE
, "dantes should be in the _Property table\n");
1903 MsiCloseHandle(hdb
);
1904 MsiCloseHandle(hpkg
);
1905 DeleteFile(msifile
);
1908 static UINT
try_query_param( MSIHANDLE hdb
, LPCSTR szQuery
, MSIHANDLE hrec
)
1913 res
= MsiDatabaseOpenView( hdb
, szQuery
, &htab
);
1914 if( res
== ERROR_SUCCESS
)
1918 r
= MsiViewExecute( htab
, hrec
);
1919 if( r
!= ERROR_SUCCESS
)
1922 fprintf(stderr
,"MsiViewExecute failed %08x\n", res
);
1925 r
= MsiViewClose( htab
);
1926 if( r
!= ERROR_SUCCESS
)
1929 r
= MsiCloseHandle( htab
);
1930 if( r
!= ERROR_SUCCESS
)
1936 static UINT
try_query( MSIHANDLE hdb
, LPCSTR szQuery
)
1938 return try_query_param( hdb
, szQuery
, 0 );
1941 static void set_summary_str(MSIHANDLE hdb
, DWORD pid
, LPCSTR value
)
1946 r
= MsiGetSummaryInformationA(hdb
, NULL
, 1, &summary
);
1947 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1949 r
= MsiSummaryInfoSetPropertyA(summary
, pid
, VT_LPSTR
, 0, NULL
, value
);
1950 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1952 r
= MsiSummaryInfoPersist(summary
);
1953 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1955 MsiCloseHandle(summary
);
1958 static void set_summary_dword(MSIHANDLE hdb
, DWORD pid
, DWORD value
)
1963 r
= MsiGetSummaryInformationA(hdb
, NULL
, 1, &summary
);
1964 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1966 r
= MsiSummaryInfoSetPropertyA(summary
, pid
, VT_I4
, value
, NULL
, NULL
);
1967 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1969 r
= MsiSummaryInfoPersist(summary
);
1970 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1972 MsiCloseHandle(summary
);
1975 static void test_msipackage(void)
1977 MSIHANDLE hdb
= 0, hpack
= 100;
1982 /* NULL szPackagePath */
1983 r
= MsiOpenPackage(NULL
, &hpack
);
1984 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1986 /* empty szPackagePath */
1987 r
= MsiOpenPackage("", &hpack
);
1990 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1993 if (r
== ERROR_SUCCESS
)
1994 MsiCloseHandle(hpack
);
1996 /* nonexistent szPackagePath */
1997 r
= MsiOpenPackage("nonexistent", &hpack
);
1998 ok(r
== ERROR_FILE_NOT_FOUND
, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2001 r
= MsiOpenPackage(msifile
, NULL
);
2002 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2006 r
= MsiOpenPackage(name
, &hpack
);
2007 ok(r
== ERROR_INVALID_HANDLE
, "Expected ERROR_INVALID_HANDLE, got %d\n", r
);
2009 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
2010 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2012 /* database exists, but is emtpy */
2013 sprintf(name
, "#%ld", hdb
);
2014 r
= MsiOpenPackage(name
, &hpack
);
2015 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2016 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2018 query
= "CREATE TABLE `Property` ( "
2019 "`Property` CHAR(72), `Value` CHAR(0) "
2020 "PRIMARY KEY `Property`)";
2021 r
= try_query(hdb
, query
);
2022 ok(r
== ERROR_SUCCESS
, "failed to create Properties table\n");
2024 query
= "CREATE TABLE `InstallExecuteSequence` ("
2025 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2026 "PRIMARY KEY `Action`)";
2027 r
= try_query(hdb
, query
);
2028 ok(r
== ERROR_SUCCESS
, "failed to create InstallExecuteSequence table\n");
2030 /* a few key tables exist */
2031 sprintf(name
, "#%ld", hdb
);
2032 r
= MsiOpenPackage(name
, &hpack
);
2033 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2034 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2036 MsiCloseHandle(hdb
);
2037 DeleteFile(msifile
);
2039 /* start with a clean database to show what constitutes a valid package */
2040 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
2041 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2043 sprintf(name
, "#%ld", hdb
);
2045 /* The following summary information props must exist:
2050 set_summary_dword(hdb
, PID_PAGECOUNT
, 100);
2051 r
= MsiOpenPackage(name
, &hpack
);
2052 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2053 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2055 set_summary_str(hdb
, PID_REVNUMBER
, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2056 r
= MsiOpenPackage(name
, &hpack
);
2057 ok(r
== ERROR_SUCCESS
,
2058 "Expected ERROR_SUCCESS, got %d\n", r
);
2060 MsiCloseHandle(hpack
);
2061 MsiCloseHandle(hdb
);
2062 DeleteFile(msifile
);
2065 static void test_formatrecord2(void)
2067 MSIHANDLE hpkg
, hrec
;
2072 hpkg
= package_from_db(create_package_db());
2073 ok( hpkg
, "failed to create package\n");
2075 r
= MsiSetProperty(hpkg
, "Manufacturer", " " );
2076 ok( r
== ERROR_SUCCESS
, "set property failed\n");
2078 hrec
= MsiCreateRecord(2);
2079 ok(hrec
, "create record failed\n");
2081 r
= MsiRecordSetString( hrec
, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2082 ok( r
== ERROR_SUCCESS
, "format record failed\n");
2086 r
= MsiFormatRecord( hpkg
, hrec
, buffer
, &sz
);
2088 r
= MsiRecordSetString(hrec
, 0, "[foo][1]");
2089 r
= MsiRecordSetString(hrec
, 1, "hoo");
2091 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2092 ok( sz
== 3, "size wrong\n");
2093 ok( 0 == strcmp(buffer
,"hoo"), "wrong output %s\n",buffer
);
2094 ok( r
== ERROR_SUCCESS
, "format failed\n");
2096 r
= MsiRecordSetString(hrec
, 0, "x[~]x");
2098 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2099 ok( sz
== 3, "size wrong\n");
2100 ok( 0 == strcmp(buffer
,"x"), "wrong output %s\n",buffer
);
2101 ok( r
== ERROR_SUCCESS
, "format failed\n");
2103 r
= MsiRecordSetString(hrec
, 0, "[foo.$%}][1]");
2104 r
= MsiRecordSetString(hrec
, 1, "hoo");
2106 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2107 ok( sz
== 3, "size wrong\n");
2108 ok( 0 == strcmp(buffer
,"hoo"), "wrong output %s\n",buffer
);
2109 ok( r
== ERROR_SUCCESS
, "format failed\n");
2111 r
= MsiRecordSetString(hrec
, 0, "[\\[]");
2113 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2114 ok( sz
== 1, "size wrong\n");
2115 ok( 0 == strcmp(buffer
,"["), "wrong output %s\n",buffer
);
2116 ok( r
== ERROR_SUCCESS
, "format failed\n");
2118 SetEnvironmentVariable("FOO", "BAR");
2119 r
= MsiRecordSetString(hrec
, 0, "[%FOO]");
2121 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2122 ok( sz
== 3, "size wrong\n");
2123 ok( 0 == strcmp(buffer
,"BAR"), "wrong output %s\n",buffer
);
2124 ok( r
== ERROR_SUCCESS
, "format failed\n");
2126 r
= MsiRecordSetString(hrec
, 0, "[[1]]");
2127 r
= MsiRecordSetString(hrec
, 1, "%FOO");
2129 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2130 ok( sz
== 3, "size wrong\n");
2131 ok( 0 == strcmp(buffer
,"BAR"), "wrong output %s\n",buffer
);
2132 ok( r
== ERROR_SUCCESS
, "format failed\n");
2134 MsiCloseHandle( hrec
);
2135 MsiCloseHandle( hpkg
);
2136 DeleteFile(msifile
);
2139 /* FIXME: state is INSTALLSTATE_UNKNOWN if any features are removed and the
2140 * feature in question is not in ADD*
2142 static void test_states(void)
2147 INSTALLSTATE state
, action
;
2149 hdb
= create_package_db();
2150 ok ( hdb
, "failed to create package database\n" );
2152 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
2153 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
2155 r
= create_property_table( hdb
);
2156 ok( r
== ERROR_SUCCESS
, "cannot create Property table: %d\n", r
);
2158 r
= add_property_entry( hdb
, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2159 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2161 r
= add_property_entry( hdb
, "'ProductLanguage', '1033'" );
2162 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2164 r
= add_property_entry( hdb
, "'ProductName', 'MSITEST'" );
2165 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2167 r
= add_property_entry( hdb
, "'ProductVersion', '1.1.1'" );
2168 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2170 r
= create_install_execute_sequence_table( hdb
);
2171 ok( r
== ERROR_SUCCESS
, "cannot create InstallExecuteSequence table: %d\n", r
);
2173 r
= add_install_execute_sequence_entry( hdb
, "'CostInitialize', '', '800'" );
2174 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2176 r
= add_install_execute_sequence_entry( hdb
, "'FileCost', '', '900'" );
2177 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2179 r
= add_install_execute_sequence_entry( hdb
, "'CostFinalize', '', '1000'" );
2180 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2182 r
= add_install_execute_sequence_entry( hdb
, "'InstallValidate', '', '1400'" );
2183 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2185 r
= add_install_execute_sequence_entry( hdb
, "'InstallInitialize', '', '1500'" );
2186 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2188 r
= add_install_execute_sequence_entry( hdb
, "'ProcessComponents', '', '1600'" );
2189 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2191 r
= add_install_execute_sequence_entry( hdb
, "'UnpublishFeatures', '', '1800'" );
2192 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2194 r
= add_install_execute_sequence_entry( hdb
, "'RegisterProduct', '', '6100'" );
2195 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2197 r
= add_install_execute_sequence_entry( hdb
, "'PublishFeatures', '', '6300'" );
2198 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2200 r
= add_install_execute_sequence_entry( hdb
, "'PublishProduct', '', '6400'" );
2201 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2203 r
= add_install_execute_sequence_entry( hdb
, "'InstallFinalize', '', '6600'" );
2204 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2206 r
= create_media_table( hdb
);
2207 ok( r
== ERROR_SUCCESS
, "cannot create media table: %d\n", r
);
2209 r
= add_media_entry( hdb
, "'1', '3', '', '', 'DISK1', ''");
2210 ok( r
== ERROR_SUCCESS
, "cannot add media entry: %d\n", r
);
2212 r
= create_feature_table( hdb
);
2213 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
2215 r
= create_component_table( hdb
);
2216 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
2218 /* msidbFeatureAttributesFavorLocal */
2219 r
= add_feature_entry( hdb
, "'one', '', '', '', 2, 1, '', 0" );
2220 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2222 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2223 r
= add_component_entry( hdb
, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2224 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2226 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2227 r
= add_component_entry( hdb
, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2228 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2230 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2231 r
= add_component_entry( hdb
, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2232 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2234 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2235 r
= add_component_entry( hdb
, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2236 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2238 /* msidbFeatureAttributesFavorSource */
2239 r
= add_feature_entry( hdb
, "'two', '', '', '', 2, 1, '', 1" );
2240 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2242 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2243 r
= add_component_entry( hdb
, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2244 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2246 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2247 r
= add_component_entry( hdb
, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2248 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2250 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2251 r
= add_component_entry( hdb
, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2252 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2254 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2255 r
= add_component_entry( hdb
, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2256 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2258 /* msidbFeatureAttributesFavorSource */
2259 r
= add_feature_entry( hdb
, "'three', '', '', '', 2, 1, '', 1" );
2260 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2262 /* msidbFeatureAttributesFavorLocal */
2263 r
= add_feature_entry( hdb
, "'four', '', '', '', 2, 1, '', 0" );
2264 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2267 r
= add_feature_entry( hdb
, "'five', '', '', '', 2, 0, '', 1" );
2268 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2270 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2271 r
= add_component_entry( hdb
, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2272 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2274 /* no feature parent:msidbComponentAttributesLocalOnly */
2275 r
= add_component_entry( hdb
, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2276 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2278 /* msidbFeatureAttributesFavorLocal:removed */
2279 r
= add_feature_entry( hdb
, "'six', '', '', '', 2, 1, '', 0" );
2280 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2282 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2283 r
= add_component_entry( hdb
, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2284 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2286 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2287 r
= add_component_entry( hdb
, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2288 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2290 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2291 r
= add_component_entry( hdb
, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2292 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2294 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2295 r
= add_component_entry( hdb
, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2296 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2298 /* msidbFeatureAttributesFavorSource:removed */
2299 r
= add_feature_entry( hdb
, "'seven', '', '', '', 2, 1, '', 1" );
2300 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2302 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2303 r
= add_component_entry( hdb
, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2304 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2306 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2307 r
= add_component_entry( hdb
, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2308 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2310 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2311 r
= add_component_entry( hdb
, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2312 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2314 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2315 r
= add_component_entry( hdb
, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2316 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2318 r
= create_feature_components_table( hdb
);
2319 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
2321 r
= add_feature_components_entry( hdb
, "'one', 'alpha'" );
2322 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2324 r
= add_feature_components_entry( hdb
, "'one', 'beta'" );
2325 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2327 r
= add_feature_components_entry( hdb
, "'one', 'gamma'" );
2328 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2330 r
= add_feature_components_entry( hdb
, "'one', 'theta'" );
2331 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2333 r
= add_feature_components_entry( hdb
, "'two', 'delta'" );
2334 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2336 r
= add_feature_components_entry( hdb
, "'two', 'epsilon'" );
2337 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2339 r
= add_feature_components_entry( hdb
, "'two', 'zeta'" );
2340 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2342 r
= add_feature_components_entry( hdb
, "'two', 'iota'" );
2343 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2345 r
= add_feature_components_entry( hdb
, "'three', 'eta'" );
2346 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2348 r
= add_feature_components_entry( hdb
, "'four', 'eta'" );
2349 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2351 r
= add_feature_components_entry( hdb
, "'five', 'eta'" );
2352 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2354 r
= add_feature_components_entry( hdb
, "'six', 'lambda'" );
2355 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2357 r
= add_feature_components_entry( hdb
, "'six', 'mu'" );
2358 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2360 r
= add_feature_components_entry( hdb
, "'six', 'nu'" );
2361 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2363 r
= add_feature_components_entry( hdb
, "'six', 'xi'" );
2364 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2366 r
= add_feature_components_entry( hdb
, "'seven', 'omicron'" );
2367 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2369 r
= add_feature_components_entry( hdb
, "'seven', 'pi'" );
2370 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2372 r
= add_feature_components_entry( hdb
, "'seven', 'rho'" );
2373 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2375 r
= add_feature_components_entry( hdb
, "'seven', 'sigma'" );
2376 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2378 r
= create_file_table( hdb
);
2379 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
2381 r
= add_file_entry( hdb
, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2382 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2384 r
= add_file_entry( hdb
, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2385 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2387 r
= add_file_entry( hdb
, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2388 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2390 r
= add_file_entry( hdb
, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2391 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2393 r
= add_file_entry( hdb
, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2394 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2396 r
= add_file_entry( hdb
, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2397 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2399 r
= add_file_entry( hdb
, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2400 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2402 r
= add_file_entry( hdb
, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2403 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2405 /* compressed file */
2406 r
= add_file_entry( hdb
, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2407 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2409 r
= add_file_entry( hdb
, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2410 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2412 r
= add_file_entry( hdb
, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2413 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2415 r
= add_file_entry( hdb
, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2416 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2418 r
= add_file_entry( hdb
, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2419 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2421 r
= add_file_entry( hdb
, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2422 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2424 r
= add_file_entry( hdb
, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2425 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2427 r
= add_file_entry( hdb
, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2428 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2430 r
= add_file_entry( hdb
, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2431 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2433 r
= add_file_entry( hdb
, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2434 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2436 MsiDatabaseCommit(hdb
);
2438 /* these properties must not be in the saved msi file */
2439 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,four'");
2440 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2442 r
= add_property_entry( hdb
, "'ADDSOURCE', 'two,three'");
2443 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2445 r
= add_property_entry( hdb
, "'REMOVE', 'six,seven'");
2446 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2448 hpkg
= package_from_db( hdb
);
2449 ok( hpkg
, "failed to create package\n");
2451 MsiCloseHandle(hdb
);
2455 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2456 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2457 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2458 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2462 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2463 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2464 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2465 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2469 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2470 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2471 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2472 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2476 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2477 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2478 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2479 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2483 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2484 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2485 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2486 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2490 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2491 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2492 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2493 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2497 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
2498 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2499 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2500 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2504 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2505 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2506 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2507 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2511 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2512 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2513 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2514 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2518 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2519 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2520 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2521 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2525 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2526 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2527 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2528 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2532 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2533 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2534 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2535 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2539 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
2540 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2541 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2542 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2546 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
2547 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2548 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2549 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2553 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
2554 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2555 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2556 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2560 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
2561 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2562 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2563 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2567 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
2568 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2569 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2570 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2574 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
2575 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2576 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2577 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2581 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
2582 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2583 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2584 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2588 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
2589 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2590 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2591 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2595 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
2596 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2597 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2598 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2602 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
2603 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2604 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2605 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2609 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
2610 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2611 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2612 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2616 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
2617 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2618 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2619 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2623 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
2624 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2625 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2626 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2628 r
= MsiDoAction( hpkg
, "CostInitialize");
2629 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
2633 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2634 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2635 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2636 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2640 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2641 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2642 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2643 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2647 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2648 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2649 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2650 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2654 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2655 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2656 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2657 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2661 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2662 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2663 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2664 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2668 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2669 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2670 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2671 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2675 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
2676 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2677 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2678 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2682 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2683 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2684 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2685 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2689 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2690 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2691 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2692 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2696 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2697 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2698 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2699 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2703 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2704 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2705 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2706 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2710 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2711 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2712 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2713 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2717 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
2718 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2719 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2720 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2724 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
2725 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2726 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2727 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2731 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
2732 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2733 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2734 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2738 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
2739 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2740 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2741 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2745 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
2746 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2747 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2748 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2752 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
2753 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2754 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2755 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2759 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
2760 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2761 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2762 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2766 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
2767 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2768 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2769 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2773 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
2774 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2775 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2776 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2780 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
2781 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2782 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2783 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2787 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
2788 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2789 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2790 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2794 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
2795 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2796 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2797 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2801 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
2802 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2803 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2804 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2806 r
= MsiDoAction( hpkg
, "FileCost");
2807 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
2811 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2812 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2813 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2814 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2818 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2819 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2820 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2821 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2825 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2826 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2827 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2828 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2832 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2833 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2834 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2835 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2839 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2840 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2841 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2842 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2846 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2847 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2848 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2849 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2853 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
2854 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2855 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2856 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2860 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2861 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2862 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2863 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2867 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2868 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2869 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2870 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2874 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2875 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2876 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2877 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2881 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2882 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2883 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2884 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2888 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2889 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2890 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2891 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2895 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
2896 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2897 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2898 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2902 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
2903 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2904 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2905 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2909 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
2910 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2911 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2912 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2916 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
2917 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2918 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2919 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2923 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
2924 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2925 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2926 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2930 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
2931 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2932 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2933 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2937 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
2938 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2939 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2940 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2944 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
2945 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2946 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2947 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2951 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
2952 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2953 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2954 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2958 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
2959 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2960 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2961 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2965 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
2966 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2967 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2968 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2972 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
2973 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2974 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2975 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2979 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
2980 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2981 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2982 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2984 r
= MsiDoAction( hpkg
, "CostFinalize");
2985 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
2989 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2990 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2991 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
2992 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
2996 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2997 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2998 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
2999 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3003 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3004 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3005 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3006 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3010 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3011 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3012 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3013 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3017 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3018 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3019 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3020 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3024 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3025 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3026 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3029 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3034 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3035 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3036 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3039 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3044 r
= MsiGetComponentState(hpkg
, "alpha", &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
= MsiGetComponentState(hpkg
, "beta", &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
= MsiGetComponentState(hpkg
, "gamma", &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
= MsiGetComponentState(hpkg
, "theta", &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
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3073 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3074 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3075 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3079 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3080 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3081 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3082 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3086 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3087 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3088 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3089 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3093 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3094 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3095 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3096 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3100 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3101 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3102 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3103 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3107 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3108 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3109 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3110 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3114 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3115 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3116 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3119 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3124 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3125 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3126 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3129 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3134 r
= MsiGetComponentState(hpkg
, "nu", &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
);
3139 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3144 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3145 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3146 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3149 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3154 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3155 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3156 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3159 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3164 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3165 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3166 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3169 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3174 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3175 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3176 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3179 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3184 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3185 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3186 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3189 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3192 MsiCloseHandle( hpkg
);
3194 /* publish the features and components */
3195 r
= MsiInstallProduct(msifile
, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven");
3196 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3198 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
3199 ok(r
== ERROR_SUCCESS
, "failed to open database: %d\n", r
);
3201 /* these properties must not be in the saved msi file */
3202 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,four'");
3203 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3205 r
= add_property_entry( hdb
, "'ADDSOURCE', 'two,three'");
3206 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3208 r
= add_property_entry( hdb
, "'REMOVE', 'six,seven'");
3209 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3211 hpkg
= package_from_db( hdb
);
3212 ok( hpkg
, "failed to create package\n");
3214 MsiCloseHandle(hdb
);
3218 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3219 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3220 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3221 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3225 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3226 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3227 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3228 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3232 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3233 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3234 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3235 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3239 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3240 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3241 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3242 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3246 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3247 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3248 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3249 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3253 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3254 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3255 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3256 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3260 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3261 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3262 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3263 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3267 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3268 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3269 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3270 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3274 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3275 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3276 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3277 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3281 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3282 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3283 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3284 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3288 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3289 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3290 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3291 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3295 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3296 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3297 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3298 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3302 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3303 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3304 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3305 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3309 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3310 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3311 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3312 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3316 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3317 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3318 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3319 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3323 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3324 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3325 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3326 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3330 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3331 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3332 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3333 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3337 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3338 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3339 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3340 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3344 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3345 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3346 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3347 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3351 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3352 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3353 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3354 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3358 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3359 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3360 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3361 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3365 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3366 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3367 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3368 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3372 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3373 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3374 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3375 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3379 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3380 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3381 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3382 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3386 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3387 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3388 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3389 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3391 r
= MsiDoAction( hpkg
, "CostInitialize");
3392 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
3396 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3397 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3398 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3399 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3403 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3404 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3405 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3406 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3410 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3411 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3412 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3413 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3417 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3418 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3419 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3420 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3424 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3425 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3426 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3427 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3431 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3432 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3433 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3434 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3438 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3439 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3440 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3441 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3445 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3446 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3447 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3448 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3452 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3453 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3454 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3455 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3459 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3460 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3461 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3462 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3466 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3467 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3468 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3469 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3473 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3474 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3475 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3476 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3480 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3481 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3482 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3483 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3487 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3488 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3489 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3490 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3494 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3495 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3496 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3497 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3501 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3502 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3503 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3504 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3508 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3509 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3510 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3511 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3515 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3516 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3517 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3518 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3522 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3523 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3524 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3525 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3529 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3530 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3531 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3532 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3536 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3537 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3538 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3539 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3543 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3544 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3545 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3546 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3550 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3551 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3552 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3553 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3557 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3558 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3559 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3560 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3564 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3565 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3566 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3567 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3569 r
= MsiDoAction( hpkg
, "FileCost");
3570 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
3574 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3575 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3576 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3577 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3581 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3582 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3583 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3584 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3588 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3589 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3590 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3591 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3595 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3596 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3597 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3598 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3602 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3603 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3604 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3605 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3609 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3610 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3611 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3612 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3616 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3617 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3618 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3619 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3623 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3624 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3625 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3626 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3630 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3631 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3632 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3633 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3637 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3638 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3639 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3640 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3644 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3645 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3646 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3647 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3651 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3652 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3653 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3654 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3658 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3659 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3660 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3661 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3665 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3666 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3667 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3668 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3672 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3673 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3674 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3675 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3679 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3680 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3681 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3682 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3686 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3687 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3688 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3689 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3693 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3694 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3695 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3696 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3700 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3701 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3702 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3703 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3707 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3708 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3709 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3710 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3714 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3715 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3716 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3717 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3721 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3722 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3723 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3724 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3728 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3729 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3730 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3731 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3735 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3736 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3737 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3738 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3742 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3743 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3744 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3745 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3747 r
= MsiDoAction( hpkg
, "CostFinalize");
3748 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
3752 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3753 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3756 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3758 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3762 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3763 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3766 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3768 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3772 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3773 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3776 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3778 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3782 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3783 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3786 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3788 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3792 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3793 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3794 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3795 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3799 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3800 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3801 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3804 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3809 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3810 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3811 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3814 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3819 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3820 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3823 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3825 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3829 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3830 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3833 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3835 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3839 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3840 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3843 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3845 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3849 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3850 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3853 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3855 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3859 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3860 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3863 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3865 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3869 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3870 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3873 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3874 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3879 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3880 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3883 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3884 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3889 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3890 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3893 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3895 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3899 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3900 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3903 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3905 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3909 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3910 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3911 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3912 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3916 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3917 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3918 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3921 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3926 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3927 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3928 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3931 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3936 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3937 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3938 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3941 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3946 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3947 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3948 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3951 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3956 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3957 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3958 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3961 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3966 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3967 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3968 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3971 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3976 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3977 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3978 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3981 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3986 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3987 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3988 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3991 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3994 MsiCloseHandle(hpkg
);
3996 /* uninstall the product */
3997 r
= MsiInstallProduct(msifile
, "REMOVE=ALL");
3998 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4000 DeleteFileA(msifile
);
4003 static void test_getproperty(void)
4005 MSIHANDLE hPackage
= 0;
4007 static CHAR empty
[] = "";
4011 hPackage
= package_from_db(create_package_db());
4012 ok( hPackage
!= 0, " Failed to create package\n");
4014 /* set the property */
4015 r
= MsiSetProperty(hPackage
, "Name", "Value");
4016 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4018 /* retrieve the size, NULL pointer */
4020 r
= MsiGetProperty(hPackage
, "Name", NULL
, &size
);
4021 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4022 ok( size
== 5, "Expected 5, got %d\n", size
);
4024 /* retrieve the size, empty string */
4026 r
= MsiGetProperty(hPackage
, "Name", empty
, &size
);
4027 ok( r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
4028 ok( size
== 5, "Expected 5, got %d\n", size
);
4030 /* don't change size */
4031 r
= MsiGetProperty(hPackage
, "Name", prop
, &size
);
4032 ok( r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
4033 ok( size
== 5, "Expected 5, got %d\n", size
);
4034 ok( !lstrcmp(prop
, "Valu"), "Expected Valu, got %s\n", prop
);
4036 /* increase the size by 1 */
4038 r
= MsiGetProperty(hPackage
, "Name", prop
, &size
);
4039 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4040 ok( size
== 5, "Expected 5, got %d\n", size
);
4041 ok( !lstrcmp(prop
, "Value"), "Expected Value, got %s\n", prop
);
4043 r
= MsiCloseHandle( hPackage
);
4044 ok( r
== ERROR_SUCCESS
, "Failed to close package\n" );
4045 DeleteFile(msifile
);
4048 static void test_removefiles(void)
4054 hdb
= create_package_db();
4055 ok ( hdb
, "failed to create package database\n" );
4057 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
4058 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
4060 r
= create_feature_table( hdb
);
4061 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
4063 r
= create_component_table( hdb
);
4064 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
4066 r
= add_feature_entry( hdb
, "'one', '', '', '', 2, 1, '', 0" );
4067 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4069 r
= add_component_entry( hdb
, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
4070 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4072 r
= add_component_entry( hdb
, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
4073 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4075 r
= add_component_entry( hdb
, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
4076 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4078 r
= add_component_entry( hdb
, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
4079 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4081 r
= add_component_entry( hdb
, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
4082 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4084 r
= add_component_entry( hdb
, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
4085 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4087 r
= create_feature_components_table( hdb
);
4088 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
4090 r
= add_feature_components_entry( hdb
, "'one', 'hydrogen'" );
4091 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4093 r
= add_feature_components_entry( hdb
, "'one', 'helium'" );
4094 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4096 r
= add_feature_components_entry( hdb
, "'one', 'lithium'" );
4097 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4099 r
= add_feature_components_entry( hdb
, "'one', 'beryllium'" );
4100 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4102 r
= add_feature_components_entry( hdb
, "'one', 'boron'" );
4103 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4105 r
= add_feature_components_entry( hdb
, "'one', 'carbon'" );
4106 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4108 r
= create_file_table( hdb
);
4109 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
4111 r
= add_file_entry( hdb
, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
4112 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4114 r
= add_file_entry( hdb
, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
4115 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4117 r
= add_file_entry( hdb
, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
4118 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4120 r
= add_file_entry( hdb
, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
4121 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4123 r
= add_file_entry( hdb
, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
4124 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4126 r
= add_file_entry( hdb
, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
4127 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4129 r
= create_remove_file_table( hdb
);
4130 ok( r
== ERROR_SUCCESS
, "cannot create Remove File table: %d\n", r
);
4132 hpkg
= package_from_db( hdb
);
4133 ok( hpkg
, "failed to create package\n");
4135 MsiCloseHandle( hdb
);
4137 create_test_file( "hydrogen.txt" );
4138 create_test_file( "helium.txt" );
4139 create_test_file( "lithium.txt" );
4140 create_test_file( "beryllium.txt" );
4141 create_test_file( "boron.txt" );
4142 create_test_file( "carbon.txt" );
4144 r
= MsiSetProperty( hpkg
, "TARGETDIR", CURR_DIR
);
4145 ok( r
== ERROR_SUCCESS
, "set property failed\n");
4147 r
= MsiDoAction( hpkg
, "CostInitialize");
4148 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4150 r
= MsiDoAction( hpkg
, "FileCost");
4151 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
4153 r
= MsiDoAction( hpkg
, "CostFinalize");
4154 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
4156 r
= MsiDoAction( hpkg
, "InstallValidate");
4157 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
4159 r
= MsiSetComponentState( hpkg
, "hydrogen", INSTALLSTATE_ABSENT
);
4160 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4162 r
= MsiSetComponentState( hpkg
, "helium", INSTALLSTATE_LOCAL
);
4163 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4165 r
= MsiSetComponentState( hpkg
, "lithium", INSTALLSTATE_SOURCE
);
4166 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4168 r
= MsiSetComponentState( hpkg
, "beryllium", INSTALLSTATE_ABSENT
);
4169 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4171 r
= MsiSetComponentState( hpkg
, "boron", INSTALLSTATE_LOCAL
);
4172 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4174 r
= MsiSetComponentState( hpkg
, "carbon", INSTALLSTATE_SOURCE
);
4175 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
4177 r
= MsiDoAction( hpkg
, "RemoveFiles");
4178 ok( r
== ERROR_SUCCESS
, "remove files failed\n");
4180 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
4181 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
4182 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
4183 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
4184 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
4185 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
4187 MsiCloseHandle( hpkg
);
4188 DeleteFileA(msifile
);
4191 static void test_appsearch(void)
4196 CHAR prop
[MAX_PATH
];
4197 DWORD size
= MAX_PATH
;
4199 hdb
= create_package_db();
4200 ok ( hdb
, "failed to create package database\n" );
4202 r
= create_appsearch_table( hdb
);
4203 ok( r
== ERROR_SUCCESS
, "cannot create AppSearch table: %d\n", r
);
4205 r
= add_appsearch_entry( hdb
, "'WEBBROWSERPROG', 'NewSignature1'" );
4206 ok( r
== ERROR_SUCCESS
, "cannot add entry: %d\n", r
);
4208 r
= create_reglocator_table( hdb
);
4209 ok( r
== ERROR_SUCCESS
, "cannot create RegLocator table: %d\n", r
);
4211 r
= add_reglocator_entry( hdb
, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
4212 ok( r
== ERROR_SUCCESS
, "cannot create RegLocator table: %d\n", r
);
4214 r
= create_signature_table( hdb
);
4215 ok( r
== ERROR_SUCCESS
, "cannot create Signature table: %d\n", r
);
4217 r
= add_signature_entry( hdb
, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
4218 ok( r
== ERROR_SUCCESS
, "cannot create Signature table: %d\n", r
);
4220 hpkg
= package_from_db( hdb
);
4221 ok( hpkg
, "failed to create package\n");
4223 MsiCloseHandle( hdb
);
4225 r
= MsiDoAction( hpkg
, "AppSearch" );
4226 ok( r
== ERROR_SUCCESS
, "AppSearch failed: %d\n", r
);
4228 r
= MsiGetPropertyA( hpkg
, "WEBBROWSERPROG", prop
, &size
);
4229 ok( r
== ERROR_SUCCESS
, "get property failed: %d\n", r
);
4230 ok( lstrlenA(prop
) != 0, "Expected non-zero length\n");
4232 MsiCloseHandle( hpkg
);
4233 DeleteFileA(msifile
);
4236 static void test_featureparents(void)
4241 INSTALLSTATE state
, action
;
4243 hdb
= create_package_db();
4244 ok ( hdb
, "failed to create package database\n" );
4246 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
4247 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
4249 r
= create_feature_table( hdb
);
4250 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
4252 r
= create_component_table( hdb
);
4253 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
4255 r
= create_feature_components_table( hdb
);
4256 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
4258 r
= create_file_table( hdb
);
4259 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
4261 /* msidbFeatureAttributesFavorLocal */
4262 r
= add_feature_entry( hdb
, "'zodiac', '', '', '', 2, 1, '', 0" );
4263 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4265 /* msidbFeatureAttributesFavorSource */
4266 r
= add_feature_entry( hdb
, "'perseus', '', '', '', 2, 1, '', 1" );
4267 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4269 /* msidbFeatureAttributesFavorLocal */
4270 r
= add_feature_entry( hdb
, "'orion', '', '', '', 2, 1, '', 0" );
4271 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4273 /* disabled because of install level */
4274 r
= add_feature_entry( hdb
, "'waters', '', '', '', 15, 101, '', 9" );
4275 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4277 /* child feature of disabled feature */
4278 r
= add_feature_entry( hdb
, "'bayer', 'waters', '', '', 14, 1, '', 9" );
4279 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
4281 /* component of disabled feature (install level) */
4282 r
= add_component_entry( hdb
, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
4283 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4285 /* component of disabled child feature (install level) */
4286 r
= add_component_entry( hdb
, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
4287 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4289 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
4290 r
= add_component_entry( hdb
, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
4291 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4293 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
4294 r
= add_component_entry( hdb
, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
4295 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4297 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
4298 r
= add_component_entry( hdb
, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
4299 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4301 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
4302 r
= add_component_entry( hdb
, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
4303 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4305 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
4306 r
= add_component_entry( hdb
, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
4307 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4309 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
4310 r
= add_component_entry( hdb
, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
4311 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4313 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
4314 r
= add_component_entry( hdb
, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
4315 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4317 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
4318 r
= add_component_entry( hdb
, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
4319 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
4321 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
4322 r
= add_component_entry( hdb
, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
4324 r
= add_feature_components_entry( hdb
, "'zodiac', 'leo'" );
4325 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4327 r
= add_feature_components_entry( hdb
, "'zodiac', 'virgo'" );
4328 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4330 r
= add_feature_components_entry( hdb
, "'zodiac', 'libra'" );
4331 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4333 r
= add_feature_components_entry( hdb
, "'perseus', 'cassiopeia'" );
4334 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4336 r
= add_feature_components_entry( hdb
, "'perseus', 'cepheus'" );
4337 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4339 r
= add_feature_components_entry( hdb
, "'perseus', 'andromeda'" );
4340 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4342 r
= add_feature_components_entry( hdb
, "'orion', 'leo'" );
4343 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4345 r
= add_feature_components_entry( hdb
, "'orion', 'virgo'" );
4346 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4348 r
= add_feature_components_entry( hdb
, "'orion', 'libra'" );
4349 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4351 r
= add_feature_components_entry( hdb
, "'orion', 'cassiopeia'" );
4352 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4354 r
= add_feature_components_entry( hdb
, "'orion', 'cepheus'" );
4355 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4357 r
= add_feature_components_entry( hdb
, "'orion', 'andromeda'" );
4358 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4360 r
= add_feature_components_entry( hdb
, "'orion', 'canis'" );
4361 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4363 r
= add_feature_components_entry( hdb
, "'orion', 'monoceros'" );
4364 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4366 r
= add_feature_components_entry( hdb
, "'orion', 'lepus'" );
4367 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4369 r
= add_feature_components_entry( hdb
, "'waters', 'delphinus'" );
4370 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4372 r
= add_feature_components_entry( hdb
, "'bayer', 'hydrus'" );
4373 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
4375 r
= add_file_entry( hdb
, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
4376 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4378 r
= add_file_entry( hdb
, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
4379 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4381 r
= add_file_entry( hdb
, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
4382 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4384 r
= add_file_entry( hdb
, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
4385 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4387 r
= add_file_entry( hdb
, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
4388 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4390 r
= add_file_entry( hdb
, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
4391 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4393 r
= add_file_entry( hdb
, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
4394 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4396 r
= add_file_entry( hdb
, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
4397 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4399 r
= add_file_entry( hdb
, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
4400 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4402 r
= add_file_entry( hdb
, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
4403 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4405 r
= add_file_entry( hdb
, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
4406 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
4408 hpkg
= package_from_db( hdb
);
4409 ok( hpkg
, "failed to create package\n");
4411 MsiCloseHandle( hdb
);
4413 r
= MsiDoAction( hpkg
, "CostInitialize");
4414 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4416 r
= MsiDoAction( hpkg
, "FileCost");
4417 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
4419 r
= MsiDoAction( hpkg
, "CostFinalize");
4420 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
4424 r
= MsiGetFeatureState(hpkg
, "zodiac", &state
, &action
);
4425 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4426 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4427 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4431 r
= MsiGetFeatureState(hpkg
, "perseus", &state
, &action
);
4432 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4433 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4434 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
4438 r
= MsiGetFeatureState(hpkg
, "orion", &state
, &action
);
4439 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4440 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4441 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4445 r
= MsiGetFeatureState(hpkg
, "waters", &state
, &action
);
4446 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4447 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4448 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4452 r
= MsiGetFeatureState(hpkg
, "bayer", &state
, &action
);
4453 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4454 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4455 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4459 r
= MsiGetComponentState(hpkg
, "leo", &state
, &action
);
4460 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4461 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4462 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4466 r
= MsiGetComponentState(hpkg
, "virgo", &state
, &action
);
4467 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4468 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state
);
4469 ok( action
== INSTALLSTATE_SOURCE
, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action
);
4473 r
= MsiGetComponentState(hpkg
, "libra", &state
, &action
);
4474 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4475 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state
);
4476 ok( action
== INSTALLSTATE_LOCAL
, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action
);
4480 r
= MsiGetComponentState(hpkg
, "cassiopeia", &state
, &action
);
4481 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4482 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state
);
4483 ok( action
== INSTALLSTATE_LOCAL
, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action
);
4487 r
= MsiGetComponentState(hpkg
, "cepheus", &state
, &action
);
4488 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4489 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4490 ok( action
== INSTALLSTATE_SOURCE
, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action
);
4494 r
= MsiGetComponentState(hpkg
, "andromeda", &state
, &action
);
4495 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4496 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state
);
4497 ok( action
== INSTALLSTATE_LOCAL
, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action
);
4501 r
= MsiGetComponentState(hpkg
, "canis", &state
, &action
);
4502 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4503 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state
);
4504 ok( action
== INSTALLSTATE_LOCAL
, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action
);
4508 r
= MsiGetComponentState(hpkg
, "monoceros", &state
, &action
);
4509 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4510 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state
);
4511 ok( action
== INSTALLSTATE_SOURCE
, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action
);
4515 r
= MsiGetComponentState(hpkg
, "lepus", &state
, &action
);
4516 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4517 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4518 ok( action
== INSTALLSTATE_LOCAL
, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action
);
4522 r
= MsiGetComponentState(hpkg
, "delphinus", &state
, &action
);
4523 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4524 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4525 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action
);
4529 r
= MsiGetComponentState(hpkg
, "hydrus", &state
, &action
);
4530 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4531 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4532 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action
);
4534 r
= MsiSetFeatureState(hpkg
, "orion", INSTALLSTATE_ABSENT
);
4535 ok( r
== ERROR_SUCCESS
, "failed to set feature state: %d\n", r
);
4539 r
= MsiGetFeatureState(hpkg
, "zodiac", &state
, &action
);
4540 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4541 ok( state
== INSTALLSTATE_ABSENT
, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state
);
4542 ok( action
== INSTALLSTATE_LOCAL
, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action
);
4546 r
= MsiGetFeatureState(hpkg
, "perseus", &state
, &action
);
4547 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4548 ok( state
== INSTALLSTATE_ABSENT
, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state
);
4549 ok( action
== INSTALLSTATE_SOURCE
, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action
);
4553 r
= MsiGetFeatureState(hpkg
, "orion", &state
, &action
);
4554 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4555 ok( state
== INSTALLSTATE_ABSENT
, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state
);
4556 ok( action
== INSTALLSTATE_ABSENT
, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action
);
4560 r
= MsiGetComponentState(hpkg
, "leo", &state
, &action
);
4561 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4562 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state
);
4563 ok( action
== INSTALLSTATE_LOCAL
, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action
);
4567 r
= MsiGetComponentState(hpkg
, "virgo", &state
, &action
);
4568 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4569 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state
);
4570 ok( action
== INSTALLSTATE_SOURCE
, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action
);
4574 r
= MsiGetComponentState(hpkg
, "libra", &state
, &action
);
4575 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4576 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state
);
4577 ok( action
== INSTALLSTATE_LOCAL
, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action
);
4581 r
= MsiGetComponentState(hpkg
, "cassiopeia", &state
, &action
);
4582 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4583 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state
);
4584 ok( action
== INSTALLSTATE_LOCAL
, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action
);
4588 r
= MsiGetComponentState(hpkg
, "cepheus", &state
, &action
);
4589 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4590 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4591 ok( action
== INSTALLSTATE_SOURCE
, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action
);
4595 r
= MsiGetComponentState(hpkg
, "andromeda", &state
, &action
);
4596 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4597 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state
);
4598 ok( action
== INSTALLSTATE_SOURCE
, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action
);
4602 r
= MsiGetComponentState(hpkg
, "canis", &state
, &action
);
4603 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4604 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state
);
4605 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action
);
4609 r
= MsiGetComponentState(hpkg
, "monoceros", &state
, &action
);
4610 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4611 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state
);
4612 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action
);
4616 r
= MsiGetComponentState(hpkg
, "lepus", &state
, &action
);
4617 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4618 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4619 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action
);
4623 r
= MsiGetComponentState(hpkg
, "delphinus", &state
, &action
);
4624 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4625 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4626 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action
);
4630 r
= MsiGetComponentState(hpkg
, "hydrus", &state
, &action
);
4631 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4632 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state
);
4633 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action
);
4635 MsiCloseHandle(hpkg
);
4636 DeleteFileA(msifile
);
4639 static void test_installprops(void)
4641 MSIHANDLE hpkg
, hdb
;
4642 CHAR path
[MAX_PATH
];
4650 GetCurrentDirectory(MAX_PATH
, path
);
4651 lstrcat(path
, "\\");
4652 lstrcat(path
, msifile
);
4654 hdb
= create_package_db();
4655 ok( hdb
, "failed to create database\n");
4657 hpkg
= package_from_db(hdb
);
4658 ok( hpkg
, "failed to create package\n");
4660 MsiCloseHandle(hdb
);
4663 r
= MsiGetProperty(hpkg
, "DATABASE", buf
, &size
);
4664 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4665 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
4667 RegOpenKey(HKEY_CURRENT_USER
, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1
);
4669 RegOpenKey(HKEY_LOCAL_MACHINE
, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2
);
4674 if (RegQueryValueEx(hkey1
, "DefName", NULL
, &type
, (LPBYTE
)path
, &size
) != ERROR_SUCCESS
)
4678 RegQueryValueEx(hkey2
, "RegisteredOwner", NULL
, &type
, (LPBYTE
)path
, &size
);
4681 /* win9x doesn't set this */
4685 r
= MsiGetProperty(hpkg
, "USERNAME", buf
, &size
);
4686 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4687 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
4693 if (RegQueryValueEx(hkey1
, "DefCompany", NULL
, &type
, (LPBYTE
)path
, &size
) != ERROR_SUCCESS
)
4697 RegQueryValueEx(hkey2
, "RegisteredOrganization", NULL
, &type
, (LPBYTE
)path
, &size
);
4703 r
= MsiGetProperty(hpkg
, "COMPANYNAME", buf
, &size
);
4704 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4705 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
4709 r
= MsiGetProperty(hpkg
, "VersionDatabase", buf
, &size
);
4710 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4711 trace("VersionDatabase = %s\n", buf
);
4714 r
= MsiGetProperty(hpkg
, "VersionMsi", buf
, &size
);
4715 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4716 trace("VersionMsi = %s\n", buf
);
4719 r
= MsiGetProperty(hpkg
, "Date", buf
, &size
);
4720 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4721 trace("Date = %s\n", buf
);
4724 r
= MsiGetProperty(hpkg
, "Time", buf
, &size
);
4725 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4726 trace("Time = %s\n", buf
);
4729 r
= MsiGetProperty(hpkg
, "PackageCode", buf
, &size
);
4730 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
4731 trace("PackageCode = %s\n", buf
);
4733 langid
= GetUserDefaultLangID();
4734 sprintf(path
, "%d", langid
);
4737 r
= MsiGetProperty(hpkg
, "UserLanguageID", buf
, &size
);
4738 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS< got %d\n", r
);
4739 ok( !lstrcmpA(buf
, path
), "Expected \"%s\", got \"%s\"\n", path
, buf
);
4741 res
= GetSystemMetrics(SM_CXSCREEN
);
4743 r
= MsiGetProperty(hpkg
, "ScreenX", buf
, &size
);
4744 ok(atol(buf
) == res
, "Expected %d, got %ld\n", res
, atol(buf
));
4746 res
= GetSystemMetrics(SM_CYSCREEN
);
4748 r
= MsiGetProperty(hpkg
, "ScreenY", buf
, &size
);
4749 ok(atol(buf
) == res
, "Expected %d, got %ld\n", res
, atol(buf
));
4753 MsiCloseHandle(hpkg
);
4754 DeleteFile(msifile
);
4757 static void test_launchconditions(void)
4763 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
4765 hdb
= create_package_db();
4766 ok( hdb
, "failed to create package database\n" );
4768 r
= create_launchcondition_table( hdb
);
4769 ok( r
== ERROR_SUCCESS
, "cannot create LaunchCondition table: %d\n", r
);
4771 r
= add_launchcondition_entry( hdb
, "'X = \"1\"', 'one'" );
4772 ok( r
== ERROR_SUCCESS
, "cannot add launch condition: %d\n", r
);
4774 /* invalid condition */
4775 r
= add_launchcondition_entry( hdb
, "'X != \"1\"', 'one'" );
4776 ok( r
== ERROR_SUCCESS
, "cannot add launch condition: %d\n", r
);
4778 hpkg
= package_from_db( hdb
);
4779 ok( hpkg
, "failed to create package\n");
4781 MsiCloseHandle( hdb
);
4783 r
= MsiSetProperty( hpkg
, "X", "1" );
4784 ok( r
== ERROR_SUCCESS
, "failed to set property\n" );
4786 /* invalid conditions are ignored */
4787 r
= MsiDoAction( hpkg
, "LaunchConditions" );
4788 ok( r
== ERROR_SUCCESS
, "cost init failed\n" );
4790 /* verify LaunchConditions still does some verification */
4791 r
= MsiSetProperty( hpkg
, "X", "2" );
4792 ok( r
== ERROR_SUCCESS
, "failed to set property\n" );
4794 r
= MsiDoAction( hpkg
, "LaunchConditions" );
4795 ok( r
== ERROR_INSTALL_FAILURE
, "Expected ERROR_INSTALL_FAILURE, got %d\n", r
);
4797 MsiCloseHandle( hpkg
);
4798 DeleteFile( msifile
);
4801 static void test_ccpsearch(void)
4803 MSIHANDLE hdb
, hpkg
;
4804 CHAR prop
[MAX_PATH
];
4805 DWORD size
= MAX_PATH
;
4808 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
4810 hdb
= create_package_db();
4811 ok(hdb
, "failed to create package database\n");
4813 r
= create_ccpsearch_table(hdb
);
4814 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4816 r
= add_ccpsearch_entry(hdb
, "'CCP_random'");
4817 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4819 r
= add_ccpsearch_entry(hdb
, "'RMCCP_random'");
4820 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4822 r
= create_reglocator_table(hdb
);
4823 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4825 r
= add_reglocator_entry(hdb
, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
4826 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4828 r
= create_drlocator_table(hdb
);
4829 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4831 r
= add_drlocator_entry(hdb
, "'RMCCP_random', '', 'C:\\', '0'");
4832 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4834 r
= create_signature_table(hdb
);
4835 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4837 hpkg
= package_from_db(hdb
);
4838 ok(hpkg
, "failed to create package\n");
4840 MsiCloseHandle(hdb
);
4842 r
= MsiDoAction(hpkg
, "CCPSearch");
4843 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4845 r
= MsiGetPropertyA(hpkg
, "CCP_Success", prop
, &size
);
4846 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4847 ok(!lstrcmpA(prop
, "1"), "Expected 1, got %s\n", prop
);
4849 MsiCloseHandle(hpkg
);
4850 DeleteFileA(msifile
);
4853 static BOOL
squash_guid(LPCWSTR in
, LPWSTR out
)
4858 if (FAILED(CLSIDFromString((LPOLESTR
)in
, &guid
)))
4865 out
[11-i
] = in
[n
++];
4868 out
[15-i
] = in
[n
++];
4872 out
[17+i
*2] = in
[n
++];
4873 out
[16+i
*2] = in
[n
++];
4878 out
[17+i
*2] = in
[n
++];
4879 out
[16+i
*2] = in
[n
++];
4885 static void set_component_path(LPCSTR filename
, LPCSTR guid
)
4887 WCHAR guidW
[MAX_PATH
];
4888 WCHAR squashedW
[MAX_PATH
];
4889 CHAR squashed
[MAX_PATH
];
4890 CHAR substr
[MAX_PATH
];
4891 CHAR path
[MAX_PATH
];
4894 MultiByteToWideChar(CP_ACP
, 0, guid
, -1, guidW
, MAX_PATH
);
4895 squash_guid(guidW
, squashedW
);
4896 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
4898 lstrcpyA(substr
, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
4899 "Installer\\UserData\\S-1-5-18\\Components\\");
4900 lstrcatA(substr
, squashed
);
4902 RegCreateKeyA(HKEY_LOCAL_MACHINE
, substr
, &hkey
);
4904 lstrcpyA(path
, CURR_DIR
);
4905 lstrcatA(path
, "\\");
4906 lstrcatA(path
, filename
);
4908 /* just using a random squashed product code */
4909 RegSetValueExA(hkey
, "7D2F387510109040002000060BECB6AB", 0,
4910 REG_SZ
, (LPBYTE
)path
, lstrlenA(path
));
4914 lstrcpyA(substr
, "SOFTWARE\\Classes\\Installer\\Products\\7D2F387510109040002000060BECB6AB");
4915 RegCreateKeyA(HKEY_LOCAL_MACHINE
, substr
, &hkey
);
4918 static void delete_component_path(LPCSTR guid
)
4920 WCHAR guidW
[MAX_PATH
];
4921 WCHAR squashedW
[MAX_PATH
];
4922 WCHAR substrW
[MAX_PATH
];
4923 CHAR squashed
[MAX_PATH
];
4924 CHAR substr
[MAX_PATH
];
4926 MultiByteToWideChar(CP_ACP
, 0, guid
, -1, guidW
, MAX_PATH
);
4927 squash_guid(guidW
, squashedW
);
4928 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
4930 lstrcpyA(substr
, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
4931 "Installer\\UserData\\S-1-5-18\\Components\\");
4932 lstrcatA(substr
, squashed
);
4934 MultiByteToWideChar(CP_ACP
, 0, substr
, -1, substrW
, MAX_PATH
);
4935 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE
, substrW
);
4937 lstrcpyA(substr
, "SOFTWARE\\Classes\\Installer\\Products\\7D2F387510109040002000060BECB6AB");
4938 MultiByteToWideChar(CP_ACP
, 0, substr
, -1, substrW
, MAX_PATH
);
4939 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE
, substrW
);
4942 static void test_complocator(void)
4944 MSIHANDLE hdb
, hpkg
;
4946 CHAR prop
[MAX_PATH
];
4947 CHAR expected
[MAX_PATH
];
4948 DWORD size
= MAX_PATH
;
4950 hdb
= create_package_db();
4951 ok(hdb
, "failed to create package database\n");
4953 r
= create_appsearch_table(hdb
);
4954 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4956 r
= add_appsearch_entry(hdb
, "'ABELISAURUS', 'abelisaurus'");
4957 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4959 r
= add_appsearch_entry(hdb
, "'BACTROSAURUS', 'bactrosaurus'");
4960 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4962 r
= add_appsearch_entry(hdb
, "'CAMELOTIA', 'camelotia'");
4963 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4965 r
= add_appsearch_entry(hdb
, "'DICLONIUS', 'diclonius'");
4966 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4968 r
= add_appsearch_entry(hdb
, "'ECHINODON', 'echinodon'");
4969 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4971 r
= add_appsearch_entry(hdb
, "'FALCARIUS', 'falcarius'");
4972 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4974 r
= add_appsearch_entry(hdb
, "'GALLIMIMUS', 'gallimimus'");
4975 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4977 r
= add_appsearch_entry(hdb
, "'HAGRYPHUS', 'hagryphus'");
4978 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4980 r
= add_appsearch_entry(hdb
, "'IGUANODON', 'iguanodon'");
4981 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4983 r
= add_appsearch_entry(hdb
, "'JOBARIA', 'jobaria'");
4984 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4986 r
= add_appsearch_entry(hdb
, "'KAKURU', 'kakuru'");
4987 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4989 r
= add_appsearch_entry(hdb
, "'LABOCANIA', 'labocania'");
4990 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4992 r
= add_appsearch_entry(hdb
, "'MEGARAPTOR', 'megaraptor'");
4993 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4995 r
= add_appsearch_entry(hdb
, "'NEOSODON', 'neosodon'");
4996 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4998 r
= add_appsearch_entry(hdb
, "'OLOROTITAN', 'olorotitan'");
4999 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5001 r
= add_appsearch_entry(hdb
, "'PANTYDRACO', 'pantydraco'");
5002 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5004 r
= create_complocator_table(hdb
);
5005 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5007 r
= add_complocator_entry(hdb
, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
5008 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5010 r
= add_complocator_entry(hdb
, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
5011 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5013 r
= add_complocator_entry(hdb
, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
5014 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5016 r
= add_complocator_entry(hdb
, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
5017 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5019 r
= add_complocator_entry(hdb
, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
5020 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5022 r
= add_complocator_entry(hdb
, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
5023 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5025 r
= add_complocator_entry(hdb
, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
5026 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5028 r
= add_complocator_entry(hdb
, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
5029 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5031 r
= add_complocator_entry(hdb
, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
5032 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5034 r
= add_complocator_entry(hdb
, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
5035 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5037 r
= add_complocator_entry(hdb
, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
5038 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5040 r
= add_complocator_entry(hdb
, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
5041 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5043 r
= add_complocator_entry(hdb
, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
5044 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5046 r
= add_complocator_entry(hdb
, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
5047 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5049 r
= add_complocator_entry(hdb
, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
5050 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5052 r
= add_complocator_entry(hdb
, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
5053 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5055 r
= create_signature_table(hdb
);
5056 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5058 r
= add_signature_entry(hdb
, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
5059 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5061 r
= add_signature_entry(hdb
, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
5062 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5064 r
= add_signature_entry(hdb
, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
5065 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5067 r
= add_signature_entry(hdb
, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
5068 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5070 r
= add_signature_entry(hdb
, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
5071 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5073 r
= add_signature_entry(hdb
, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
5074 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5076 r
= add_signature_entry(hdb
, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
5077 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5079 r
= add_signature_entry(hdb
, "'labocania', 'labocania', '', '', '', '', '', '', ''");
5080 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5082 hpkg
= package_from_db(hdb
);
5083 ok(hpkg
, "failed to create package\n");
5085 MsiCloseHandle(hdb
);
5087 create_test_file("abelisaurus");
5088 create_test_file("bactrosaurus");
5089 create_test_file("camelotia");
5090 create_test_file("diclonius");
5091 create_test_file("echinodon");
5092 create_test_file("falcarius");
5093 create_test_file("gallimimus");
5094 create_test_file("hagryphus");
5095 CreateDirectoryA("iguanodon", NULL
);
5096 CreateDirectoryA("jobaria", NULL
);
5097 CreateDirectoryA("kakuru", NULL
);
5098 CreateDirectoryA("labocania", NULL
);
5099 CreateDirectoryA("megaraptor", NULL
);
5100 CreateDirectoryA("neosodon", NULL
);
5101 CreateDirectoryA("olorotitan", NULL
);
5102 CreateDirectoryA("pantydraco", NULL
);
5104 set_component_path("abelisaurus", "{E3619EED-305A-418C-B9C7-F7D7377F0934}");
5105 set_component_path("bactrosaurus", "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}");
5106 set_component_path("echinodon", "{A19E16C5-C75D-4699-8111-C4338C40C3CB}");
5107 set_component_path("falcarius", "{17762FA1-A7AE-4CC6-8827-62873C35361D}");
5108 set_component_path("iguanodon", "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}");
5109 set_component_path("jobaria", "{243C22B1-8C51-4151-B9D1-1AE5265E079E}");
5110 set_component_path("megaraptor", "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}");
5111 set_component_path("neosodon", "{0B499649-197A-48EF-93D2-AF1C17ED6E90}");
5113 r
= MsiDoAction(hpkg
, "AppSearch");
5114 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5117 r
= MsiGetPropertyA(hpkg
, "ABELISAURUS", prop
, &size
);
5118 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5120 lstrcpyA(expected
, CURR_DIR
);
5121 lstrcatA(expected
, "\\abelisaurus");
5122 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
5123 "Expected %s or empty string, got %s\n", expected
, prop
);
5126 r
= MsiGetPropertyA(hpkg
, "BACTROSAURUS", prop
, &size
);
5127 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5128 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5131 r
= MsiGetPropertyA(hpkg
, "CAMELOTIA", prop
, &size
);
5132 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5133 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5136 r
= MsiGetPropertyA(hpkg
, "DICLONIUS", prop
, &size
);
5137 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5138 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5141 r
= MsiGetPropertyA(hpkg
, "ECHINODON", prop
, &size
);
5142 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5144 lstrcpyA(expected
, CURR_DIR
);
5145 lstrcatA(expected
, "\\");
5146 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
5147 "Expected %s or empty string, got %s\n", expected
, prop
);
5150 r
= MsiGetPropertyA(hpkg
, "FALCARIUS", prop
, &size
);
5151 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5152 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5155 r
= MsiGetPropertyA(hpkg
, "GALLIMIMUS", prop
, &size
);
5156 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5157 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5160 r
= MsiGetPropertyA(hpkg
, "HAGRYPHUS", prop
, &size
);
5161 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5162 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5165 r
= MsiGetPropertyA(hpkg
, "IGUANODON", prop
, &size
);
5166 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5167 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5170 r
= MsiGetPropertyA(hpkg
, "JOBARIA", prop
, &size
);
5171 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5172 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5175 r
= MsiGetPropertyA(hpkg
, "KAKURU", prop
, &size
);
5176 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5177 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5180 r
= MsiGetPropertyA(hpkg
, "LABOCANIA", prop
, &size
);
5181 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5182 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5185 r
= MsiGetPropertyA(hpkg
, "MEGARAPTOR", prop
, &size
);
5186 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5188 lstrcpyA(expected
, CURR_DIR
);
5189 lstrcatA(expected
, "\\");
5190 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
5191 "Expected %s or empty string, got %s\n", expected
, prop
);
5194 r
= MsiGetPropertyA(hpkg
, "NEOSODON", prop
, &size
);
5195 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5197 lstrcpyA(expected
, CURR_DIR
);
5198 lstrcatA(expected
, "\\neosodon\\");
5199 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
5200 "Expected %s or empty string, got %s\n", expected
, prop
);
5203 r
= MsiGetPropertyA(hpkg
, "OLOROTITAN", prop
, &size
);
5204 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5205 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5208 r
= MsiGetPropertyA(hpkg
, "PANTYDRACO", prop
, &size
);
5209 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5210 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
5212 MsiCloseHandle(hpkg
);
5213 DeleteFileA("abelisaurus");
5214 DeleteFileA("bactrosaurus");
5215 DeleteFileA("camelotia");
5216 DeleteFileA("diclonius");
5217 DeleteFileA("echinodon");
5218 DeleteFileA("falcarius");
5219 DeleteFileA("gallimimus");
5220 DeleteFileA("hagryphus");
5221 RemoveDirectoryA("iguanodon");
5222 RemoveDirectoryA("jobaria");
5223 RemoveDirectoryA("kakuru");
5224 RemoveDirectoryA("labocania");
5225 RemoveDirectoryA("megaraptor");
5226 RemoveDirectoryA("neosodon");
5227 RemoveDirectoryA("olorotitan");
5228 RemoveDirectoryA("pantydraco");
5229 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}");
5230 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}");
5231 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}");
5232 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}");
5233 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}");
5234 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}");
5235 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}");
5236 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}");
5237 DeleteFileA(msifile
);
5240 static void set_suminfo_prop(MSIHANDLE db
, DWORD prop
, DWORD val
)
5245 r
= MsiGetSummaryInformationA(db
, NULL
, 1, &summary
);
5246 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5248 r
= MsiSummaryInfoSetPropertyA(summary
, prop
, VT_I4
, val
, NULL
, NULL
);
5249 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5251 r
= MsiSummaryInfoPersist(summary
);
5252 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
5254 MsiCloseHandle(summary
);
5257 static void test_MsiGetSourcePath(void)
5259 MSIHANDLE hdb
, hpkg
;
5260 CHAR path
[MAX_PATH
];
5262 CHAR subsrc
[MAX_PATH
];
5263 CHAR sub2
[MAX_PATH
];
5267 lstrcpyA(cwd
, CURR_DIR
);
5268 lstrcatA(cwd
, "\\");
5270 lstrcpyA(subsrc
, cwd
);
5271 lstrcatA(subsrc
, "subsource");
5272 lstrcatA(subsrc
, "\\");
5274 lstrcpyA(sub2
, subsrc
);
5275 lstrcatA(sub2
, "sub2");
5276 lstrcatA(sub2
, "\\");
5278 /* uncompressed source */
5280 hdb
= create_package_db();
5281 ok( hdb
, "failed to create database\n");
5283 set_suminfo_prop(hdb
, PID_WORDCOUNT
, 0);
5285 r
= add_directory_entry(hdb
, "'TARGETDIR', '', 'SourceDir'");
5286 ok(r
== S_OK
, "failed\n");
5288 r
= add_directory_entry(hdb
, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
5289 ok(r
== S_OK
, "failed\n");
5291 r
= add_directory_entry(hdb
, "'SubDir2', 'SubDir', 'sub2'");
5292 ok(r
== S_OK
, "failed\n");
5294 r
= MsiDatabaseCommit(hdb
);
5295 ok(r
== ERROR_SUCCESS
, "Failed to commit database\n");
5297 hpkg
= package_from_db(hdb
);
5298 ok(hpkg
, "failed to create package\n");
5300 MsiCloseHandle(hdb
);
5302 /* invalid database handle */
5304 lstrcpyA(path
, "kiwi");
5305 r
= MsiGetSourcePath(-1, "TARGETDIR", path
, &size
);
5306 ok(r
== ERROR_INVALID_HANDLE
,
5307 "Expected ERROR_INVALID_HANDLE, got %d\n", r
);
5308 ok(!lstrcmpA(path
, "kiwi"),
5309 "Expected path to be unchanged, got \"%s\"\n", path
);
5310 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
5314 lstrcpyA(path
, "kiwi");
5315 r
= MsiGetSourcePath(hpkg
, NULL
, path
, &size
);
5316 ok(r
== ERROR_INVALID_PARAMETER
,
5317 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
5318 ok(!lstrcmpA(path
, "kiwi"),
5319 "Expected path to be unchanged, got \"%s\"\n", path
);
5320 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
5322 /* empty szFolder */
5324 lstrcpyA(path
, "kiwi");
5325 r
= MsiGetSourcePath(hpkg
, "", path
, &size
);
5326 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
5327 ok(!lstrcmpA(path
, "kiwi"),
5328 "Expected path to be unchanged, got \"%s\"\n", path
);
5329 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
5333 lstrcpyA(path
, "kiwi");
5334 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
5335 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
5336 ok(!lstrcmpA(path
, "kiwi"),
5337 "Expected path to be unchanged, got \"%s\"\n", path
);
5338 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
5342 lstrcpyA(path
, "kiwi");
5343 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
5344 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
5345 ok(!lstrcmpA(path
, "kiwi"),
5346 "Expected path to be unchanged, got \"%s\"\n", path
);
5347 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
5351 lstrcpyA(path
, "kiwi");
5352 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
5353 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
5354 ok(!lstrcmpA(path
, "kiwi"),
5355 "Expected path to be unchanged, got \"%s\"\n", path
);
5356 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
5358 /* source path does not exist, but the property exists */
5360 lstrcpyA(path
, "kiwi");
5361 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
5362 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5363 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
5364 ok(size
== 0, "Expected 0, got %d\n", size
);
5368 lstrcpyA(path
, "kiwi");
5369 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
5370 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
5371 ok(!lstrcmpA(path
, "kiwi"),
5372 "Expected path to be unchanged, got \"%s\"\n", path
);
5373 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
5377 lstrcpyA(path
, "kiwi");
5378 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
5379 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
5380 ok(!lstrcmpA(path
, "kiwi"),
5381 "Expected path to be unchanged, got \"%s\"\n", path
);
5382 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
5384 r
= MsiDoAction(hpkg
, "CostInitialize");
5385 ok(r
== ERROR_SUCCESS
, "cost init failed\n");
5387 /* try TARGETDIR after CostInitialize */
5389 lstrcpyA(path
, "kiwi");
5390 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
5391 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5392 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5393 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5395 /* try SourceDir after CostInitialize */
5397 lstrcpyA(path
, "kiwi");
5398 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
5399 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5400 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5401 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5403 /* try SOURCEDIR after CostInitialize */
5405 lstrcpyA(path
, "kiwi");
5406 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
5407 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
5408 ok(!lstrcmpA(path
, "kiwi"),
5409 "Expected path to be unchanged, got \"%s\"\n", path
);
5410 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
5412 /* source path does not exist, but the property exists */
5414 lstrcpyA(path
, "kiwi");
5415 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
5416 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5419 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5420 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5423 /* try SubDir after CostInitialize */
5425 lstrcpyA(path
, "kiwi");
5426 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
5427 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5428 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5429 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5431 /* try SubDir2 after CostInitialize */
5433 lstrcpyA(path
, "kiwi");
5434 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
5435 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5436 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
5437 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
5439 r
= MsiDoAction(hpkg
, "ResolveSource");
5440 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
5442 /* try TARGETDIR after ResolveSource */
5444 lstrcpyA(path
, "kiwi");
5445 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
5446 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5447 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5448 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5450 /* try SourceDir after ResolveSource */
5452 lstrcpyA(path
, "kiwi");
5453 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
5454 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5455 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5456 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5458 /* try SOURCEDIR after ResolveSource */
5460 lstrcpyA(path
, "kiwi");
5461 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
5462 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
5463 ok(!lstrcmpA(path
, "kiwi"),
5464 "Expected path to be unchanged, got \"%s\"\n", path
);
5465 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
5467 /* source path does not exist, but the property exists */
5469 lstrcpyA(path
, "kiwi");
5470 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
5471 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5472 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5473 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5475 /* try SubDir after ResolveSource */
5477 lstrcpyA(path
, "kiwi");
5478 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
5479 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5480 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5481 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5483 /* try SubDir2 after ResolveSource */
5485 lstrcpyA(path
, "kiwi");
5486 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
5487 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5488 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
5489 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
5491 r
= MsiDoAction(hpkg
, "FileCost");
5492 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
5494 /* try TARGETDIR after FileCost */
5496 lstrcpyA(path
, "kiwi");
5497 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
5498 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5499 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5500 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5502 /* try SourceDir after FileCost */
5504 lstrcpyA(path
, "kiwi");
5505 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
5506 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5507 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5508 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5510 /* try SOURCEDIR after FileCost */
5512 lstrcpyA(path
, "kiwi");
5513 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
5514 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
5515 ok(!lstrcmpA(path
, "kiwi"),
5516 "Expected path to be unchanged, got \"%s\"\n", path
);
5517 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
5519 /* try SubDir after FileCost */
5521 lstrcpyA(path
, "kiwi");
5522 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
5523 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5524 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5525 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5527 /* try SubDir2 after FileCost */
5529 lstrcpyA(path
, "kiwi");
5530 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
5531 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5532 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
5533 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
5535 r
= MsiDoAction(hpkg
, "CostFinalize");
5536 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
5538 /* try TARGETDIR after CostFinalize */
5540 lstrcpyA(path
, "kiwi");
5541 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
5542 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5543 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5544 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5546 /* try SourceDir after CostFinalize */
5548 lstrcpyA(path
, "kiwi");
5549 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
5550 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5551 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5552 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5554 /* try SOURCEDIR after CostFinalize */
5556 lstrcpyA(path
, "kiwi");
5557 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
5558 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
5559 ok(!lstrcmpA(path
, "kiwi"),
5560 "Expected path to be unchanged, got \"%s\"\n", path
);
5561 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
5563 /* try SubDir after CostFinalize */
5565 lstrcpyA(path
, "kiwi");
5566 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
5567 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5568 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5569 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5571 /* try SubDir2 after CostFinalize */
5573 lstrcpyA(path
, "kiwi");
5574 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
5575 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5576 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
5577 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
5579 /* nonexistent directory */
5581 lstrcpyA(path
, "kiwi");
5582 r
= MsiGetSourcePath(hpkg
, "IDontExist", path
, &size
);
5583 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
5584 ok(!lstrcmpA(path
, "kiwi"),
5585 "Expected path to be unchanged, got \"%s\"\n", path
);
5586 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
5588 /* NULL szPathBuf */
5590 r
= MsiGetSourcePath(hpkg
, "SourceDir", NULL
, &size
);
5591 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5592 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5594 /* NULL pcchPathBuf */
5595 lstrcpyA(path
, "kiwi");
5596 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, NULL
);
5597 ok(r
== ERROR_INVALID_PARAMETER
,
5598 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
5599 ok(!lstrcmpA(path
, "kiwi"),
5600 "Expected path to be unchanged, got \"%s\"\n", path
);
5602 /* pcchPathBuf is 0 */
5604 lstrcpyA(path
, "kiwi");
5605 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
5606 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
5607 ok(!lstrcmpA(path
, "kiwi"),
5608 "Expected path to be unchanged, got \"%s\"\n", path
);
5609 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5611 /* pcchPathBuf does not have room for NULL terminator */
5612 size
= lstrlenA(cwd
);
5613 lstrcpyA(path
, "kiwi");
5614 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
5615 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
5616 ok(!strncmp(path
, cwd
, lstrlenA(cwd
) - 1),
5617 "Expected path with no backslash, got \"%s\"\n", path
);
5618 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5620 /* pcchPathBuf has room for NULL terminator */
5621 size
= lstrlenA(cwd
) + 1;
5622 lstrcpyA(path
, "kiwi");
5623 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
5624 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5625 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5626 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5628 MsiCloseHandle(hpkg
);
5630 /* compressed source */
5632 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
5633 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5635 set_suminfo_prop(hdb
, PID_WORDCOUNT
, msidbSumInfoSourceTypeCompressed
);
5637 hpkg
= package_from_db(hdb
);
5638 ok(hpkg
, "failed to create package\n");
5640 r
= MsiDoAction(hpkg
, "CostInitialize");
5641 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5642 r
= MsiDoAction(hpkg
, "FileCost");
5643 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5644 r
= MsiDoAction(hpkg
, "CostFinalize");
5645 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5647 /* try TARGETDIR after CostFinalize */
5649 lstrcpyA(path
, "kiwi");
5650 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
5651 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5652 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5653 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5655 /* try SourceDir after CostFinalize */
5657 lstrcpyA(path
, "kiwi");
5658 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
5659 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5660 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5661 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5663 /* try SOURCEDIR after CostFinalize */
5665 lstrcpyA(path
, "kiwi");
5666 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
5669 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5670 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5671 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5674 /* try SubDir after CostFinalize */
5676 lstrcpyA(path
, "kiwi");
5677 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
5678 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5681 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5682 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5685 /* try SubDir2 after CostFinalize */
5687 lstrcpyA(path
, "kiwi");
5688 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
5689 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5692 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
5693 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
5696 MsiCloseHandle(hpkg
);
5697 DeleteFile(msifile
);
5700 static void test_shortlongsource(void)
5702 MSIHANDLE hdb
, hpkg
;
5703 CHAR path
[MAX_PATH
];
5705 CHAR subsrc
[MAX_PATH
];
5709 lstrcpyA(cwd
, CURR_DIR
);
5710 lstrcatA(cwd
, "\\");
5712 lstrcpyA(subsrc
, cwd
);
5713 lstrcatA(subsrc
, "long");
5714 lstrcatA(subsrc
, "\\");
5716 /* long file names */
5718 hdb
= create_package_db();
5719 ok( hdb
, "failed to create database\n");
5721 set_suminfo_prop(hdb
, PID_WORDCOUNT
, 0);
5723 r
= add_directory_entry(hdb
, "'TARGETDIR', '', 'SourceDir'");
5724 ok(r
== S_OK
, "failed\n");
5726 r
= add_directory_entry(hdb
, "'SubDir', 'TARGETDIR', 'short|long'");
5727 ok(r
== S_OK
, "failed\n");
5729 /* CostInitialize:short */
5730 r
= add_directory_entry(hdb
, "'SubDir2', 'TARGETDIR', 'one|two'");
5731 ok(r
== S_OK
, "failed\n");
5733 /* CostInitialize:long */
5734 r
= add_directory_entry(hdb
, "'SubDir3', 'TARGETDIR', 'three|four'");
5735 ok(r
== S_OK
, "failed\n");
5737 /* FileCost:short */
5738 r
= add_directory_entry(hdb
, "'SubDir4', 'TARGETDIR', 'five|six'");
5739 ok(r
== S_OK
, "failed\n");
5742 r
= add_directory_entry(hdb
, "'SubDir5', 'TARGETDIR', 'seven|eight'");
5743 ok(r
== S_OK
, "failed\n");
5745 /* CostFinalize:short */
5746 r
= add_directory_entry(hdb
, "'SubDir6', 'TARGETDIR', 'nine|ten'");
5747 ok(r
== S_OK
, "failed\n");
5749 /* CostFinalize:long */
5750 r
= add_directory_entry(hdb
, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
5751 ok(r
== S_OK
, "failed\n");
5753 MsiDatabaseCommit(hdb
);
5755 hpkg
= package_from_db(hdb
);
5756 ok(hpkg
, "failed to create package\n");
5758 MsiCloseHandle(hdb
);
5760 CreateDirectoryA("one", NULL
);
5761 CreateDirectoryA("four", NULL
);
5763 r
= MsiDoAction(hpkg
, "CostInitialize");
5764 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
5766 CreateDirectory("five", NULL
);
5767 CreateDirectory("eight", NULL
);
5769 r
= MsiDoAction(hpkg
, "FileCost");
5770 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
5772 CreateDirectory("nine", NULL
);
5773 CreateDirectory("twelve", NULL
);
5775 r
= MsiDoAction(hpkg
, "CostFinalize");
5776 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
5778 /* neither short nor long source directories exist */
5780 lstrcpyA(path
, "kiwi");
5781 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
5782 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5783 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5784 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5786 CreateDirectoryA("short", NULL
);
5788 /* short source directory exists */
5790 lstrcpyA(path
, "kiwi");
5791 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
5792 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5793 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5794 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5796 CreateDirectoryA("long", NULL
);
5798 /* both short and long source directories exist */
5800 lstrcpyA(path
, "kiwi");
5801 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
5802 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5803 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5804 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5806 lstrcpyA(subsrc
, cwd
);
5807 lstrcatA(subsrc
, "two");
5808 lstrcatA(subsrc
, "\\");
5810 /* short dir exists before CostInitialize */
5812 lstrcpyA(path
, "kiwi");
5813 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
5814 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5815 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5816 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5818 lstrcpyA(subsrc
, cwd
);
5819 lstrcatA(subsrc
, "four");
5820 lstrcatA(subsrc
, "\\");
5822 /* long dir exists before CostInitialize */
5824 lstrcpyA(path
, "kiwi");
5825 r
= MsiGetSourcePath(hpkg
, "SubDir3", path
, &size
);
5826 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5827 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5828 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5830 lstrcpyA(subsrc
, cwd
);
5831 lstrcatA(subsrc
, "six");
5832 lstrcatA(subsrc
, "\\");
5834 /* short dir exists before FileCost */
5836 lstrcpyA(path
, "kiwi");
5837 r
= MsiGetSourcePath(hpkg
, "SubDir4", path
, &size
);
5838 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5839 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5840 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5842 lstrcpyA(subsrc
, cwd
);
5843 lstrcatA(subsrc
, "eight");
5844 lstrcatA(subsrc
, "\\");
5846 /* long dir exists before FileCost */
5848 lstrcpyA(path
, "kiwi");
5849 r
= MsiGetSourcePath(hpkg
, "SubDir5", path
, &size
);
5850 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5851 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5852 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5854 lstrcpyA(subsrc
, cwd
);
5855 lstrcatA(subsrc
, "ten");
5856 lstrcatA(subsrc
, "\\");
5858 /* short dir exists before CostFinalize */
5860 lstrcpyA(path
, "kiwi");
5861 r
= MsiGetSourcePath(hpkg
, "SubDir6", path
, &size
);
5862 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5863 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5864 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5866 lstrcpyA(subsrc
, cwd
);
5867 lstrcatA(subsrc
, "twelve");
5868 lstrcatA(subsrc
, "\\");
5870 /* long dir exists before CostFinalize */
5872 lstrcpyA(path
, "kiwi");
5873 r
= MsiGetSourcePath(hpkg
, "SubDir7", path
, &size
);
5874 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5875 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5876 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5878 MsiCloseHandle(hpkg
);
5879 RemoveDirectoryA("short");
5880 RemoveDirectoryA("long");
5881 RemoveDirectoryA("one");
5882 RemoveDirectoryA("four");
5883 RemoveDirectoryA("five");
5884 RemoveDirectoryA("eight");
5885 RemoveDirectoryA("nine");
5886 RemoveDirectoryA("twelve");
5888 /* short file names */
5890 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
5891 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5893 set_suminfo_prop(hdb
, PID_WORDCOUNT
, msidbSumInfoSourceTypeSFN
);
5895 hpkg
= package_from_db(hdb
);
5896 ok(hpkg
, "failed to create package\n");
5898 MsiCloseHandle(hdb
);
5900 CreateDirectoryA("one", NULL
);
5901 CreateDirectoryA("four", NULL
);
5903 r
= MsiDoAction(hpkg
, "CostInitialize");
5904 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
5906 CreateDirectory("five", NULL
);
5907 CreateDirectory("eight", NULL
);
5909 r
= MsiDoAction(hpkg
, "FileCost");
5910 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
5912 CreateDirectory("nine", NULL
);
5913 CreateDirectory("twelve", NULL
);
5915 r
= MsiDoAction(hpkg
, "CostFinalize");
5916 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
5918 lstrcpyA(subsrc
, cwd
);
5919 lstrcatA(subsrc
, "short");
5920 lstrcatA(subsrc
, "\\");
5922 /* neither short nor long source directories exist */
5924 lstrcpyA(path
, "kiwi");
5925 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
5926 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5929 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5930 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5933 CreateDirectoryA("short", NULL
);
5935 /* short source directory exists */
5937 lstrcpyA(path
, "kiwi");
5938 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
5939 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5942 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5943 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5946 CreateDirectoryA("long", NULL
);
5948 /* both short and long source directories exist */
5950 lstrcpyA(path
, "kiwi");
5951 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
5952 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5955 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5956 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5959 lstrcpyA(subsrc
, cwd
);
5960 lstrcatA(subsrc
, "one");
5961 lstrcatA(subsrc
, "\\");
5963 /* short dir exists before CostInitialize */
5965 lstrcpyA(path
, "kiwi");
5966 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
5967 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5968 todo_wine
ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5969 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5971 lstrcpyA(subsrc
, cwd
);
5972 lstrcatA(subsrc
, "three");
5973 lstrcatA(subsrc
, "\\");
5975 /* long dir exists before CostInitialize */
5977 lstrcpyA(path
, "kiwi");
5978 r
= MsiGetSourcePath(hpkg
, "SubDir3", path
, &size
);
5979 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5982 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5983 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
5986 lstrcpyA(subsrc
, cwd
);
5987 lstrcatA(subsrc
, "five");
5988 lstrcatA(subsrc
, "\\");
5990 /* short dir exists before FileCost */
5992 lstrcpyA(path
, "kiwi");
5993 r
= MsiGetSourcePath(hpkg
, "SubDir4", path
, &size
);
5994 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5997 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
5998 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
6001 lstrcpyA(subsrc
, cwd
);
6002 lstrcatA(subsrc
, "seven");
6003 lstrcatA(subsrc
, "\\");
6005 /* long dir exists before FileCost */
6007 lstrcpyA(path
, "kiwi");
6008 r
= MsiGetSourcePath(hpkg
, "SubDir5", path
, &size
);
6009 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6010 todo_wine
ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
6011 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
6013 lstrcpyA(subsrc
, cwd
);
6014 lstrcatA(subsrc
, "nine");
6015 lstrcatA(subsrc
, "\\");
6017 /* short dir exists before CostFinalize */
6019 lstrcpyA(path
, "kiwi");
6020 r
= MsiGetSourcePath(hpkg
, "SubDir6", path
, &size
);
6021 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6024 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
6025 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
6028 lstrcpyA(subsrc
, cwd
);
6029 lstrcatA(subsrc
, "eleven");
6030 lstrcatA(subsrc
, "\\");
6032 /* long dir exists before CostFinalize */
6034 lstrcpyA(path
, "kiwi");
6035 r
= MsiGetSourcePath(hpkg
, "SubDir7", path
, &size
);
6036 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6037 todo_wine
ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
6038 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
6040 MsiCloseHandle(hpkg
);
6041 RemoveDirectoryA("short");
6042 RemoveDirectoryA("long");
6043 RemoveDirectoryA("one");
6044 RemoveDirectoryA("four");
6045 RemoveDirectoryA("five");
6046 RemoveDirectoryA("eight");
6047 RemoveDirectoryA("nine");
6048 RemoveDirectoryA("twelve");
6049 DeleteFileA(msifile
);
6052 static void test_sourcedir(void)
6054 MSIHANDLE hdb
, hpkg
;
6056 CHAR path
[MAX_PATH
];
6058 CHAR subsrc
[MAX_PATH
];
6062 lstrcpyA(cwd
, CURR_DIR
);
6063 lstrcatA(cwd
, "\\");
6065 lstrcpyA(subsrc
, cwd
);
6066 lstrcatA(subsrc
, "long");
6067 lstrcatA(subsrc
, "\\");
6069 hdb
= create_package_db();
6070 ok( hdb
, "failed to create database\n");
6072 r
= add_directory_entry(hdb
, "'TARGETDIR', '', 'SourceDir'");
6073 ok(r
== S_OK
, "failed\n");
6075 sprintf(package
, "#%li", hdb
);
6076 r
= MsiOpenPackage(package
, &hpkg
);
6077 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6079 /* properties only */
6081 /* SourceDir prop */
6083 lstrcpyA(path
, "kiwi");
6084 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
6085 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6086 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
6087 ok(size
== 0, "Expected 0, got %d\n", size
);
6089 /* SOURCEDIR prop */
6091 lstrcpyA(path
, "kiwi");
6092 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
6093 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6094 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
6095 ok(size
== 0, "Expected 0, got %d\n", size
);
6097 r
= MsiDoAction(hpkg
, "CostInitialize");
6098 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
6100 /* SourceDir after CostInitialize */
6102 lstrcpyA(path
, "kiwi");
6103 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
6104 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6105 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
6106 ok(size
== 0, "Expected 0, got %d\n", size
);
6108 /* SOURCEDIR after CostInitialize */
6110 lstrcpyA(path
, "kiwi");
6111 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
6112 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6113 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
6114 ok(size
== 0, "Expected 0, got %d\n", size
);
6116 r
= MsiDoAction(hpkg
, "FileCost");
6117 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
6119 /* SourceDir after FileCost */
6121 lstrcpyA(path
, "kiwi");
6122 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
6123 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6124 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
6125 ok(size
== 0, "Expected 0, got %d\n", size
);
6127 /* SOURCEDIR after FileCost */
6129 lstrcpyA(path
, "kiwi");
6130 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
6131 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6132 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
6133 ok(size
== 0, "Expected 0, got %d\n", size
);
6135 r
= MsiDoAction(hpkg
, "CostFinalize");
6136 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
6138 /* SourceDir after CostFinalize */
6140 lstrcpyA(path
, "kiwi");
6141 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
6142 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6143 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
6144 ok(size
== 0, "Expected 0, got %d\n", size
);
6146 /* SOURCEDIR after CostFinalize */
6148 lstrcpyA(path
, "kiwi");
6149 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
6150 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6151 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
6152 ok(size
== 0, "Expected 0, got %d\n", size
);
6154 r
= MsiDoAction(hpkg
, "ResolveSource");
6155 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
6157 /* SourceDir after ResolveSource */
6159 lstrcpyA(path
, "kiwi");
6160 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
6161 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6162 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
6163 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
6165 /* SOURCEDIR after ResolveSource */
6167 lstrcpyA(path
, "kiwi");
6168 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
6169 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6170 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
6171 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
6175 lstrcpyA(path
, "kiwi");
6176 r
= MsiGetProperty(hpkg
, "SoUrCeDiR", path
, &size
);
6177 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6178 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
6179 ok(size
== 0, "Expected 0, got %d\n", size
);
6181 MsiCloseHandle(hpkg
);
6183 /* reset the package state */
6184 sprintf(package
, "#%li", hdb
);
6185 r
= MsiOpenPackage(package
, &hpkg
);
6186 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6188 /* test how MsiGetSourcePath affects the properties */
6190 /* SourceDir prop */
6192 lstrcpyA(path
, "kiwi");
6193 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
6194 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6197 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
6198 ok(size
== 0, "Expected 0, got %d\n", size
);
6202 lstrcpyA(path
, "kiwi");
6203 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
6204 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
6205 ok(!lstrcmpA(path
, "kiwi"),
6206 "Expected path to be unchanged, got \"%s\"\n", path
);
6207 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
6209 /* SourceDir after MsiGetSourcePath */
6211 lstrcpyA(path
, "kiwi");
6212 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
6213 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6216 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
6217 ok(size
== 0, "Expected 0, got %d\n", size
);
6220 /* SOURCEDIR prop */
6222 lstrcpyA(path
, "kiwi");
6223 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
6224 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6227 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
6228 ok(size
== 0, "Expected 0, got %d\n", size
);
6232 lstrcpyA(path
, "kiwi");
6233 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
6234 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
6235 ok(!lstrcmpA(path
, "kiwi"),
6236 "Expected path to be unchanged, got \"%s\"\n", path
);
6237 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
6239 /* SOURCEDIR prop after MsiGetSourcePath */
6241 lstrcpyA(path
, "kiwi");
6242 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
6243 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6246 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
6247 ok(size
== 0, "Expected 0, got %d\n", size
);
6250 r
= MsiDoAction(hpkg
, "CostInitialize");
6251 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
6253 /* SourceDir after CostInitialize */
6255 lstrcpyA(path
, "kiwi");
6256 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
6257 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6260 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
6261 ok(size
== 0, "Expected 0, got %d\n", size
);
6265 lstrcpyA(path
, "kiwi");
6266 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
6267 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6268 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
6269 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
6271 /* SourceDir after MsiGetSourcePath */
6273 lstrcpyA(path
, "kiwi");
6274 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
6275 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6276 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
6277 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
6279 /* SOURCEDIR after CostInitialize */
6281 lstrcpyA(path
, "kiwi");
6282 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
6283 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6284 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
6285 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
6287 /* SOURCEDIR source path still does not exist */
6289 lstrcpyA(path
, "kiwi");
6290 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
6291 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
6292 ok(!lstrcmpA(path
, "kiwi"),
6293 "Expected path to be unchanged, got \"%s\"\n", path
);
6294 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
6296 r
= MsiDoAction(hpkg
, "FileCost");
6297 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
6299 /* SourceDir after FileCost */
6301 lstrcpyA(path
, "kiwi");
6302 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
6303 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6304 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
6305 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
6307 /* SOURCEDIR after FileCost */
6309 lstrcpyA(path
, "kiwi");
6310 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
6311 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6312 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
6313 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
6315 /* SOURCEDIR source path still does not exist */
6317 lstrcpyA(path
, "kiwi");
6318 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
6319 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
6320 ok(!lstrcmpA(path
, "kiwi"),
6321 "Expected path to be unchanged, got \"%s\"\n", path
);
6322 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
6324 r
= MsiDoAction(hpkg
, "CostFinalize");
6325 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
6327 /* SourceDir after CostFinalize */
6329 lstrcpyA(path
, "kiwi");
6330 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
6331 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6332 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
6333 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
6335 /* SOURCEDIR after CostFinalize */
6337 lstrcpyA(path
, "kiwi");
6338 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
6339 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6340 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
6341 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
6343 /* SOURCEDIR source path still does not exist */
6345 lstrcpyA(path
, "kiwi");
6346 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
6347 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
6348 ok(!lstrcmpA(path
, "kiwi"),
6349 "Expected path to be unchanged, got \"%s\"\n", path
);
6350 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
6352 r
= MsiDoAction(hpkg
, "ResolveSource");
6353 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
6355 /* SourceDir after ResolveSource */
6357 lstrcpyA(path
, "kiwi");
6358 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
6359 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6360 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
6361 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
6363 /* SOURCEDIR after ResolveSource */
6365 lstrcpyA(path
, "kiwi");
6366 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
6367 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6368 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
6369 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
6371 /* SOURCEDIR source path still does not exist */
6373 lstrcpyA(path
, "kiwi");
6374 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
6375 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
6376 ok(!lstrcmpA(path
, "kiwi"),
6377 "Expected path to be unchanged, got \"%s\"\n", path
);
6378 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
6380 MsiCloseHandle(hdb
);
6381 MsiCloseHandle(hpkg
);
6382 DeleteFileA(msifile
);
6387 GetCurrentDirectoryA(MAX_PATH
, CURR_DIR
);
6389 test_createpackage();
6391 test_gettargetpath_bad();
6392 test_settargetpath();
6394 test_property_table();
6397 test_formatrecord2();
6402 test_featureparents();
6403 test_installprops();
6404 test_launchconditions();
6407 test_MsiGetSourcePath();
6408 test_shortlongsource();