comctl32: Remove unused parameter from _read_bitmap().
[wine/wine-gecko.git] / dlls / msi / tests / package.c
blob3eca2286cfe677683d167792c6b207c9d616c4db
1 /*
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
22 #define COBJMACROS
24 #include <stdio.h>
25 #include <windows.h>
26 #include <msidefs.h>
27 #include <msi.h>
28 #include <msiquery.h>
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)
38 LONG ret;
39 DWORD dwMaxSubkeyLen, dwMaxValueLen;
40 DWORD dwMaxLen, dwSize;
41 WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
42 HKEY hSubKey = hKey;
44 if(lpszSubKey)
46 ret = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
47 if (ret) return ret;
50 ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
51 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
52 if (ret) goto cleanup;
54 dwMaxSubkeyLen++;
55 dwMaxValueLen++;
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;
63 goto cleanup;
67 /* Recursively delete all the subkeys */
68 while (TRUE)
70 dwSize = dwMaxLen;
71 if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
72 NULL, NULL, NULL)) break;
74 ret = package_RegDeleteTreeW(hSubKey, lpszName);
75 if (ret) goto cleanup;
78 if (lpszSubKey)
79 ret = RegDeleteKeyW(hKey, lpszSubKey);
80 else
81 while (TRUE)
83 dwSize = dwMaxLen;
84 if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
85 NULL, NULL, NULL, NULL)) break;
87 ret = RegDeleteValueW(hKey, lpszName);
88 if (ret) goto cleanup;
91 cleanup:
92 if (lpszName != szNameBuf)
93 HeapFree(GetProcessHeap(), 0, lpszName);
94 if(lpszSubKey)
95 RegCloseKey(hSubKey);
96 return ret;
99 static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec)
101 MSIHANDLE hview = 0;
102 UINT r, ret;
104 /* open a select query */
105 r = MsiDatabaseOpenView(hdb, query, &hview);
106 if (r != ERROR_SUCCESS)
107 return r;
108 r = MsiViewExecute(hview, 0);
109 if (r != ERROR_SUCCESS)
110 return r;
111 ret = MsiViewFetch(hview, phrec);
112 r = MsiViewClose(hview);
113 if (r != ERROR_SUCCESS)
114 return r;
115 r = MsiCloseHandle(hview);
116 if (r != ERROR_SUCCESS)
117 return r;
118 return ret;
121 static UINT run_query( MSIHANDLE hdb, const char *query )
123 MSIHANDLE hview = 0;
124 UINT r;
126 r = MsiDatabaseOpenView(hdb, query, &hview);
127 if( r != ERROR_SUCCESS )
128 return r;
130 r = MsiViewExecute(hview, 0);
131 if( r == ERROR_SUCCESS )
132 r = MsiViewClose(hview);
133 MsiCloseHandle(hview);
134 return r;
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), "
156 "`Title` CHAR(64), "
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, "
217 "`Name` CHAR(255), "
218 "`Type` SHORT "
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), "
230 "`MinSize` LONG, "
231 "`MaxSize` LONG, "
232 "`MinDate` LONG, "
233 "`MaxDate` LONG, "
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, "
252 "`Value` CHAR(0) "
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), "
262 "`Sequence` SHORT "
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), "
275 "`Source` CHAR(72) "
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), "
293 "`Path` CHAR(255), "
294 "`Depth` SHORT "
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, "
304 "`Type` SHORT "
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`) "
312 "VALUES( %s )";
313 char *query;
314 UINT sz, r;
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);
321 return r;
324 static UINT add_directory_entry( MSIHANDLE hdb, const char *values )
326 char insert[] = "INSERT INTO `Directory` (`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )";
327 char *query;
328 UINT sz, r;
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);
335 return r;
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 )";
342 char *query;
343 UINT sz, r;
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);
350 return r;
353 static UINT add_feature_components_entry( MSIHANDLE hdb, const char *values )
355 char insert[] = "INSERT INTO `FeatureComponents` "
356 "(`Feature_`, `Component_`) "
357 "VALUES( %s )";
358 char *query;
359 UINT sz, r;
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);
366 return r;
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`) "
373 "VALUES( %s )";
374 char *query;
375 UINT sz, r;
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);
382 return r;
385 static UINT add_appsearch_entry( MSIHANDLE hdb, const char *values )
387 char insert[] = "INSERT INTO `AppSearch` "
388 "(`Property`, `Signature_`) "
389 "VALUES( %s )";
390 char *query;
391 UINT sz, r;
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);
398 return r;
401 static UINT add_reglocator_entry( MSIHANDLE hdb, const char *values )
403 char insert[] = "INSERT INTO `RegLocator` "
404 "(`Signature_`, `Root`, `Key`, `Name`, `Type`) "
405 "VALUES( %s )";
406 char *query;
407 UINT sz, r;
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);
414 return r;
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`) "
422 "VALUES( %s )";
423 char *query;
424 UINT sz, r;
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);
431 return r;
434 static UINT add_launchcondition_entry( MSIHANDLE hdb, const char *values )
436 char insert[] = "INSERT INTO `LaunchCondition` "
437 "(`Condition`, `Description`) "
438 "VALUES( %s )";
439 char *query;
440 UINT sz, r;
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);
447 return r;
450 static UINT add_property_entry( MSIHANDLE hdb, const char *values )
452 char insert[] = "INSERT INTO `Property` "
453 "(`Property`, `Value`) "
454 "VALUES( %s )";
455 char *query;
456 UINT sz, r;
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);
463 return r;
466 static UINT add_install_execute_sequence_entry( MSIHANDLE hdb, const char *values )
468 char insert[] = "INSERT INTO `InstallExecuteSequence` "
469 "(`Action`, `Condition`, `Sequence`) "
470 "VALUES( %s )";
471 char *query;
472 UINT sz, r;
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);
479 return r;
482 static UINT add_media_entry( MSIHANDLE hdb, const char *values )
484 char insert[] = "INSERT INTO `Media` "
485 "(`DiskId`, `LastSequence`, `DiskPrompt`, `Cabinet`, `VolumeLabel`, `Source`) "
486 "VALUES( %s )";
487 char *query;
488 UINT sz, r;
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);
495 return r;
498 static UINT add_ccpsearch_entry( MSIHANDLE hdb, const char *values )
500 char insert[] = "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )";
501 char *query;
502 UINT sz, r;
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);
509 return r;
512 static UINT add_drlocator_entry( MSIHANDLE hdb, const char *values )
514 char insert[] = "INSERT INTO `DrLocator` "
515 "(`Signature_`, `Parent`, `Path`, `Depth`) "
516 "VALUES( %s )";
517 char *query;
518 UINT sz, r;
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);
525 return r;
528 static UINT add_complocator_entry( MSIHANDLE hdb, const char *values )
530 char insert[] = "INSERT INTO `CompLocator` "
531 "(`Signature_`, `ComponentId`, `Type`) "
532 "VALUES( %s )";
533 char *query;
534 UINT sz, r;
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);
541 return r;
544 static UINT set_summary_info(MSIHANDLE hdb)
546 UINT res;
547 MSIHANDLE suminfo;
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,
562 "Wine Hackers");
563 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
565 res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
566 ";1033");
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" );
585 return res;
589 static MSIHANDLE create_package_db(void)
591 MSIHANDLE hdb = 0;
592 UINT res;
594 DeleteFile(msifile);
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 )
600 return hdb;
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" );
615 return hdb;
618 static MSIHANDLE package_from_db(MSIHANDLE hdb)
620 UINT res;
621 CHAR szPackage[10];
622 MSIHANDLE hPackage;
624 sprintf(szPackage,"#%li",hdb);
625 res = MsiOpenPackage(szPackage,&hPackage);
626 if (res != ERROR_SUCCESS)
627 return 0;
629 res = MsiCloseHandle(hdb);
630 if (res != ERROR_SUCCESS)
631 return 0;
633 return hPackage;
636 static void create_test_file(const CHAR *name)
638 HANDLE file;
639 DWORD written;
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);
645 CloseHandle(file);
648 static void test_createpackage(void)
650 MSIHANDLE hPackage = 0;
651 UINT res;
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" );
658 DeleteFile(msifile);
661 static void test_doaction( void )
663 MSIHANDLE hpkg;
664 UINT r;
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 );
682 DeleteFile(msifile);
685 static void test_gettargetpath_bad(void)
687 char buffer[0x80];
688 MSIHANDLE hpkg;
689 DWORD sz;
690 UINT r;
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 );
714 DeleteFile(msifile);
717 static void query_file_path(MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
719 UINT r;
720 DWORD size;
721 MSIHANDLE rec;
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 );
729 size = MAX_PATH;
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];
739 DWORD sz;
740 MSIHANDLE hpkg;
741 UINT r;
742 MSIHANDLE hdb;
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)
866 MSICONDITION r;
867 MSIHANDLE hpkg;
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)
1576 UINT r;
1577 DWORD sz;
1578 char buffer[2];
1580 sz = sizeof buffer;
1581 strcpy(buffer,"x");
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;
1589 UINT r;
1590 DWORD sz;
1591 char buffer[0x100];
1593 hdb = create_package_db();
1594 r = run_query( hdb,
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" );
1601 r = run_query(hdb,
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 */
1624 sz = sizeof buffer;
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");
1630 sz = 0;
1631 strcpy(buffer,"x");
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");
1637 sz = 1;
1638 strcpy(buffer,"x");
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");
1667 sz = sizeof buffer;
1668 buffer[0]=0;
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");
1686 sz = 1;
1687 strcpy(buffer,"x");
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");
1693 sz = 4;
1694 strcpy(buffer,"x");
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");
1700 sz = 3;
1701 strcpy(buffer,"x");
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");
1710 sz = 4;
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");
1716 sz = 4;
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");
1722 sz = 4;
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");
1731 sz = 0;
1732 r = MsiGetProperty(hpkg, "MetadataCompName", NULL, &sz );
1733 ok( r == ERROR_SUCCESS, "return wrong\n");
1734 ok( sz == 13, "size wrong (%d)\n", sz);
1736 sz = 13;
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);
1744 sz = 6;
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);
1752 sz = 6;
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;
1764 BOOL found;
1765 CHAR buffer[MAX_PATH];
1766 DWORD sz;
1767 UINT r;
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");
1774 found = FALSE;
1775 while (r == ERROR_SUCCESS && !found)
1777 r = MsiViewFetch(hview, &hrec);
1778 if (r != ERROR_SUCCESS) break;
1780 sz = MAX_PATH;
1781 r = MsiRecordGetString(hrec, 1, buffer, &sz);
1782 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
1784 sz = MAX_PATH;
1785 r = MsiRecordGetString(hrec, 2, buffer, &sz);
1786 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, val))
1787 found = TRUE;
1790 MsiCloseHandle(hrec);
1793 MsiViewClose(hview);
1794 MsiCloseHandle(hview);
1796 return found;
1799 static void test_property_table(void)
1801 const char *query;
1802 UINT r;
1803 MSIHANDLE hpkg, hdb, hrec;
1804 char buffer[MAX_PATH];
1805 DWORD sz;
1806 BOOL found;
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);
1848 todo_wine
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);
1871 sz = MAX_PATH;
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");
1891 sz = MAX_PATH;
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 )
1910 MSIHANDLE htab = 0;
1911 UINT res;
1913 res = MsiDatabaseOpenView( hdb, szQuery, &htab );
1914 if( res == ERROR_SUCCESS )
1916 UINT r;
1918 r = MsiViewExecute( htab, hrec );
1919 if( r != ERROR_SUCCESS )
1921 res = r;
1922 fprintf(stderr,"MsiViewExecute failed %08x\n", res);
1925 r = MsiViewClose( htab );
1926 if( r != ERROR_SUCCESS )
1927 res = r;
1929 r = MsiCloseHandle( htab );
1930 if( r != ERROR_SUCCESS )
1931 res = r;
1933 return res;
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)
1943 MSIHANDLE summary;
1944 UINT r;
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)
1960 MSIHANDLE summary;
1961 UINT r;
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;
1978 UINT r;
1979 const char *query;
1980 char name[10];
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);
1988 todo_wine
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);
2000 /* NULL hProduct */
2001 r = MsiOpenPackage(msifile, NULL);
2002 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2004 name[0]='#';
2005 name[1]=0;
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:
2046 * - PID_REVNUMBER
2047 * - PID_PAGECOUNT
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 ;
2068 char buffer[0x100];
2069 DWORD sz;
2070 UINT r;
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");
2084 buffer[0] = 0;
2085 sz = sizeof buffer;
2086 r = MsiFormatRecord( hpkg, hrec, buffer, &sz );
2088 r = MsiRecordSetString(hrec, 0, "[foo][1]");
2089 r = MsiRecordSetString(hrec, 1, "hoo");
2090 sz = sizeof buffer;
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");
2097 sz = sizeof buffer;
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");
2105 sz = sizeof buffer;
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, "[\\[]");
2112 sz = sizeof buffer;
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]");
2120 sz = sizeof buffer;
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");
2128 sz = sizeof buffer;
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)
2144 MSIHANDLE hpkg;
2145 UINT r;
2146 MSIHANDLE hdb;
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 );
2266 /* disabled */
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);
2453 state = 0xdeadbee;
2454 action = 0xdeadbee;
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);
2460 state = 0xdeadbee;
2461 action = 0xdeadbee;
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);
2467 state = 0xdeadbee;
2468 action = 0xdeadbee;
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);
2474 state = 0xdeadbee;
2475 action = 0xdeadbee;
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);
2481 state = 0xdeadbee;
2482 action = 0xdeadbee;
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);
2488 state = 0xdeadbee;
2489 action = 0xdeadbee;
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);
2495 state = 0xdeadbee;
2496 action = 0xdeadbee;
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);
2502 state = 0xdeadbee;
2503 action = 0xdeadbee;
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);
2509 state = 0xdeadbee;
2510 action = 0xdeadbee;
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);
2516 state = 0xdeadbee;
2517 action = 0xdeadbee;
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);
2523 state = 0xdeadbee;
2524 action = 0xdeadbee;
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);
2530 state = 0xdeadbee;
2531 action = 0xdeadbee;
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);
2537 state = 0xdeadbee;
2538 action = 0xdeadbee;
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);
2544 state = 0xdeadbee;
2545 action = 0xdeadbee;
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);
2551 state = 0xdeadbee;
2552 action = 0xdeadbee;
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);
2558 state = 0xdeadbee;
2559 action = 0xdeadbee;
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);
2565 state = 0xdeadbee;
2566 action = 0xdeadbee;
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);
2572 state = 0xdeadbee;
2573 action = 0xdeadbee;
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);
2579 state = 0xdeadbee;
2580 action = 0xdeadbee;
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);
2586 state = 0xdeadbee;
2587 action = 0xdeadbee;
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);
2593 state = 0xdeadbee;
2594 action = 0xdeadbee;
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);
2600 state = 0xdeadbee;
2601 action = 0xdeadbee;
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);
2607 state = 0xdeadbee;
2608 action = 0xdeadbee;
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);
2614 state = 0xdeadbee;
2615 action = 0xdeadbee;
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);
2621 state = 0xdeadbee;
2622 action = 0xdeadbee;
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");
2631 state = 0xdeadbee;
2632 action = 0xdeadbee;
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);
2638 state = 0xdeadbee;
2639 action = 0xdeadbee;
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);
2645 state = 0xdeadbee;
2646 action = 0xdeadbee;
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);
2652 state = 0xdeadbee;
2653 action = 0xdeadbee;
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);
2659 state = 0xdeadbee;
2660 action = 0xdeadbee;
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);
2666 state = 0xdeadbee;
2667 action = 0xdeadbee;
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);
2673 state = 0xdeadbee;
2674 action = 0xdeadbee;
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);
2680 state = 0xdeadbee;
2681 action = 0xdeadbee;
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);
2687 state = 0xdeadbee;
2688 action = 0xdeadbee;
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);
2694 state = 0xdeadbee;
2695 action = 0xdeadbee;
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);
2701 state = 0xdeadbee;
2702 action = 0xdeadbee;
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);
2708 state = 0xdeadbee;
2709 action = 0xdeadbee;
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);
2715 state = 0xdeadbee;
2716 action = 0xdeadbee;
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);
2722 state = 0xdeadbee;
2723 action = 0xdeadbee;
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);
2729 state = 0xdeadbee;
2730 action = 0xdeadbee;
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);
2736 state = 0xdeadbee;
2737 action = 0xdeadbee;
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);
2743 state = 0xdeadbee;
2744 action = 0xdeadbee;
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);
2750 state = 0xdeadbee;
2751 action = 0xdeadbee;
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);
2757 state = 0xdeadbee;
2758 action = 0xdeadbee;
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);
2764 state = 0xdeadbee;
2765 action = 0xdeadbee;
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);
2771 state = 0xdeadbee;
2772 action = 0xdeadbee;
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);
2778 state = 0xdeadbee;
2779 action = 0xdeadbee;
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);
2785 state = 0xdeadbee;
2786 action = 0xdeadbee;
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);
2792 state = 0xdeadbee;
2793 action = 0xdeadbee;
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);
2799 state = 0xdeadbee;
2800 action = 0xdeadbee;
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");
2809 state = 0xdeadbee;
2810 action = 0xdeadbee;
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);
2816 state = 0xdeadbee;
2817 action = 0xdeadbee;
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);
2823 state = 0xdeadbee;
2824 action = 0xdeadbee;
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);
2830 state = 0xdeadbee;
2831 action = 0xdeadbee;
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);
2837 state = 0xdeadbee;
2838 action = 0xdeadbee;
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);
2844 state = 0xdeadbee;
2845 action = 0xdeadbee;
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);
2851 state = 0xdeadbee;
2852 action = 0xdeadbee;
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);
2858 state = 0xdeadbee;
2859 action = 0xdeadbee;
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);
2865 state = 0xdeadbee;
2866 action = 0xdeadbee;
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);
2872 state = 0xdeadbee;
2873 action = 0xdeadbee;
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);
2879 state = 0xdeadbee;
2880 action = 0xdeadbee;
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);
2886 state = 0xdeadbee;
2887 action = 0xdeadbee;
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);
2893 state = 0xdeadbee;
2894 action = 0xdeadbee;
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);
2900 state = 0xdeadbee;
2901 action = 0xdeadbee;
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);
2907 state = 0xdeadbee;
2908 action = 0xdeadbee;
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);
2914 state = 0xdeadbee;
2915 action = 0xdeadbee;
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);
2921 state = 0xdeadbee;
2922 action = 0xdeadbee;
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);
2928 state = 0xdeadbee;
2929 action = 0xdeadbee;
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);
2935 state = 0xdeadbee;
2936 action = 0xdeadbee;
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);
2942 state = 0xdeadbee;
2943 action = 0xdeadbee;
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);
2949 state = 0xdeadbee;
2950 action = 0xdeadbee;
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);
2956 state = 0xdeadbee;
2957 action = 0xdeadbee;
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);
2963 state = 0xdeadbee;
2964 action = 0xdeadbee;
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);
2970 state = 0xdeadbee;
2971 action = 0xdeadbee;
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);
2977 state = 0xdeadbee;
2978 action = 0xdeadbee;
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);
2987 state = 0xdeadbee;
2988 action = 0xdeadbee;
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);
2994 state = 0xdeadbee;
2995 action = 0xdeadbee;
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);
3001 state = 0xdeadbee;
3002 action = 0xdeadbee;
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);
3008 state = 0xdeadbee;
3009 action = 0xdeadbee;
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);
3015 state = 0xdeadbee;
3016 action = 0xdeadbee;
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);
3022 state = 0xdeadbee;
3023 action = 0xdeadbee;
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);
3027 todo_wine
3029 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3032 state = 0xdeadbee;
3033 action = 0xdeadbee;
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);
3037 todo_wine
3039 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3042 state = 0xdeadbee;
3043 action = 0xdeadbee;
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);
3049 state = 0xdeadbee;
3050 action = 0xdeadbee;
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);
3056 state = 0xdeadbee;
3057 action = 0xdeadbee;
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);
3063 state = 0xdeadbee;
3064 action = 0xdeadbee;
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);
3070 state = 0xdeadbee;
3071 action = 0xdeadbee;
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);
3077 state = 0xdeadbee;
3078 action = 0xdeadbee;
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);
3084 state = 0xdeadbee;
3085 action = 0xdeadbee;
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);
3091 state = 0xdeadbee;
3092 action = 0xdeadbee;
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);
3098 state = 0xdeadbee;
3099 action = 0xdeadbee;
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);
3105 state = 0xdeadbee;
3106 action = 0xdeadbee;
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);
3112 state = 0xdeadbee;
3113 action = 0xdeadbee;
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);
3117 todo_wine
3119 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3122 state = 0xdeadbee;
3123 action = 0xdeadbee;
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);
3127 todo_wine
3129 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3132 state = 0xdeadbee;
3133 action = 0xdeadbee;
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);
3137 todo_wine
3139 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3142 state = 0xdeadbee;
3143 action = 0xdeadbee;
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);
3147 todo_wine
3149 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3152 state = 0xdeadbee;
3153 action = 0xdeadbee;
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);
3157 todo_wine
3159 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3162 state = 0xdeadbee;
3163 action = 0xdeadbee;
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);
3167 todo_wine
3169 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3172 state = 0xdeadbee;
3173 action = 0xdeadbee;
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);
3177 todo_wine
3179 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3182 state = 0xdeadbee;
3183 action = 0xdeadbee;
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);
3187 todo_wine
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);
3216 state = 0xdeadbee;
3217 action = 0xdeadbee;
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);
3223 state = 0xdeadbee;
3224 action = 0xdeadbee;
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);
3230 state = 0xdeadbee;
3231 action = 0xdeadbee;
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);
3237 state = 0xdeadbee;
3238 action = 0xdeadbee;
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);
3244 state = 0xdeadbee;
3245 action = 0xdeadbee;
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);
3251 state = 0xdeadbee;
3252 action = 0xdeadbee;
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);
3258 state = 0xdeadbee;
3259 action = 0xdeadbee;
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);
3265 state = 0xdeadbee;
3266 action = 0xdeadbee;
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);
3272 state = 0xdeadbee;
3273 action = 0xdeadbee;
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);
3279 state = 0xdeadbee;
3280 action = 0xdeadbee;
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);
3286 state = 0xdeadbee;
3287 action = 0xdeadbee;
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);
3293 state = 0xdeadbee;
3294 action = 0xdeadbee;
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);
3300 state = 0xdeadbee;
3301 action = 0xdeadbee;
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);
3307 state = 0xdeadbee;
3308 action = 0xdeadbee;
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);
3314 state = 0xdeadbee;
3315 action = 0xdeadbee;
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);
3321 state = 0xdeadbee;
3322 action = 0xdeadbee;
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);
3328 state = 0xdeadbee;
3329 action = 0xdeadbee;
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);
3335 state = 0xdeadbee;
3336 action = 0xdeadbee;
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);
3342 state = 0xdeadbee;
3343 action = 0xdeadbee;
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);
3349 state = 0xdeadbee;
3350 action = 0xdeadbee;
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);
3356 state = 0xdeadbee;
3357 action = 0xdeadbee;
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);
3363 state = 0xdeadbee;
3364 action = 0xdeadbee;
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);
3370 state = 0xdeadbee;
3371 action = 0xdeadbee;
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);
3377 state = 0xdeadbee;
3378 action = 0xdeadbee;
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);
3384 state = 0xdeadbee;
3385 action = 0xdeadbee;
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");
3394 state = 0xdeadbee;
3395 action = 0xdeadbee;
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);
3401 state = 0xdeadbee;
3402 action = 0xdeadbee;
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);
3408 state = 0xdeadbee;
3409 action = 0xdeadbee;
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);
3415 state = 0xdeadbee;
3416 action = 0xdeadbee;
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);
3422 state = 0xdeadbee;
3423 action = 0xdeadbee;
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);
3429 state = 0xdeadbee;
3430 action = 0xdeadbee;
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);
3436 state = 0xdeadbee;
3437 action = 0xdeadbee;
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);
3443 state = 0xdeadbee;
3444 action = 0xdeadbee;
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);
3450 state = 0xdeadbee;
3451 action = 0xdeadbee;
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);
3457 state = 0xdeadbee;
3458 action = 0xdeadbee;
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);
3464 state = 0xdeadbee;
3465 action = 0xdeadbee;
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);
3471 state = 0xdeadbee;
3472 action = 0xdeadbee;
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);
3478 state = 0xdeadbee;
3479 action = 0xdeadbee;
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);
3485 state = 0xdeadbee;
3486 action = 0xdeadbee;
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);
3492 state = 0xdeadbee;
3493 action = 0xdeadbee;
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);
3499 state = 0xdeadbee;
3500 action = 0xdeadbee;
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);
3506 state = 0xdeadbee;
3507 action = 0xdeadbee;
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);
3513 state = 0xdeadbee;
3514 action = 0xdeadbee;
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);
3520 state = 0xdeadbee;
3521 action = 0xdeadbee;
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);
3527 state = 0xdeadbee;
3528 action = 0xdeadbee;
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);
3534 state = 0xdeadbee;
3535 action = 0xdeadbee;
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);
3541 state = 0xdeadbee;
3542 action = 0xdeadbee;
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);
3548 state = 0xdeadbee;
3549 action = 0xdeadbee;
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);
3555 state = 0xdeadbee;
3556 action = 0xdeadbee;
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);
3562 state = 0xdeadbee;
3563 action = 0xdeadbee;
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");
3572 state = 0xdeadbee;
3573 action = 0xdeadbee;
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);
3579 state = 0xdeadbee;
3580 action = 0xdeadbee;
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);
3586 state = 0xdeadbee;
3587 action = 0xdeadbee;
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);
3593 state = 0xdeadbee;
3594 action = 0xdeadbee;
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);
3600 state = 0xdeadbee;
3601 action = 0xdeadbee;
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);
3607 state = 0xdeadbee;
3608 action = 0xdeadbee;
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);
3614 state = 0xdeadbee;
3615 action = 0xdeadbee;
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);
3621 state = 0xdeadbee;
3622 action = 0xdeadbee;
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);
3628 state = 0xdeadbee;
3629 action = 0xdeadbee;
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);
3635 state = 0xdeadbee;
3636 action = 0xdeadbee;
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);
3642 state = 0xdeadbee;
3643 action = 0xdeadbee;
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);
3649 state = 0xdeadbee;
3650 action = 0xdeadbee;
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);
3656 state = 0xdeadbee;
3657 action = 0xdeadbee;
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);
3663 state = 0xdeadbee;
3664 action = 0xdeadbee;
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);
3670 state = 0xdeadbee;
3671 action = 0xdeadbee;
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);
3677 state = 0xdeadbee;
3678 action = 0xdeadbee;
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);
3684 state = 0xdeadbee;
3685 action = 0xdeadbee;
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);
3691 state = 0xdeadbee;
3692 action = 0xdeadbee;
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);
3698 state = 0xdeadbee;
3699 action = 0xdeadbee;
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);
3705 state = 0xdeadbee;
3706 action = 0xdeadbee;
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);
3712 state = 0xdeadbee;
3713 action = 0xdeadbee;
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);
3719 state = 0xdeadbee;
3720 action = 0xdeadbee;
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);
3726 state = 0xdeadbee;
3727 action = 0xdeadbee;
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);
3733 state = 0xdeadbee;
3734 action = 0xdeadbee;
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);
3740 state = 0xdeadbee;
3741 action = 0xdeadbee;
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);
3750 state = 0xdeadbee;
3751 action = 0xdeadbee;
3752 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3753 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3754 todo_wine
3756 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3758 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3760 state = 0xdeadbee;
3761 action = 0xdeadbee;
3762 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3763 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3764 todo_wine
3766 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3768 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3770 state = 0xdeadbee;
3771 action = 0xdeadbee;
3772 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3773 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3774 todo_wine
3776 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3778 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3780 state = 0xdeadbee;
3781 action = 0xdeadbee;
3782 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3783 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3784 todo_wine
3786 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3788 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3790 state = 0xdeadbee;
3791 action = 0xdeadbee;
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);
3797 state = 0xdeadbee;
3798 action = 0xdeadbee;
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);
3802 todo_wine
3804 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3807 state = 0xdeadbee;
3808 action = 0xdeadbee;
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);
3812 todo_wine
3814 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3817 state = 0xdeadbee;
3818 action = 0xdeadbee;
3819 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3820 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3821 todo_wine
3823 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3825 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3827 state = 0xdeadbee;
3828 action = 0xdeadbee;
3829 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3830 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3831 todo_wine
3833 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3835 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3837 state = 0xdeadbee;
3838 action = 0xdeadbee;
3839 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3840 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3841 todo_wine
3843 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3845 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3847 state = 0xdeadbee;
3848 action = 0xdeadbee;
3849 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3850 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3851 todo_wine
3853 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3855 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3857 state = 0xdeadbee;
3858 action = 0xdeadbee;
3859 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3860 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3861 todo_wine
3863 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3865 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3867 state = 0xdeadbee;
3868 action = 0xdeadbee;
3869 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3870 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3871 todo_wine
3873 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3874 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3877 state = 0xdeadbee;
3878 action = 0xdeadbee;
3879 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3880 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3881 todo_wine
3883 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3884 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3887 state = 0xdeadbee;
3888 action = 0xdeadbee;
3889 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3890 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3891 todo_wine
3893 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3895 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3897 state = 0xdeadbee;
3898 action = 0xdeadbee;
3899 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3900 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3901 todo_wine
3903 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3905 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3907 state = 0xdeadbee;
3908 action = 0xdeadbee;
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);
3914 state = 0xdeadbee;
3915 action = 0xdeadbee;
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);
3919 todo_wine
3921 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3924 state = 0xdeadbee;
3925 action = 0xdeadbee;
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);
3929 todo_wine
3931 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3934 state = 0xdeadbee;
3935 action = 0xdeadbee;
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);
3939 todo_wine
3941 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3944 state = 0xdeadbee;
3945 action = 0xdeadbee;
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);
3949 todo_wine
3951 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3954 state = 0xdeadbee;
3955 action = 0xdeadbee;
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);
3959 todo_wine
3961 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3964 state = 0xdeadbee;
3965 action = 0xdeadbee;
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);
3969 todo_wine
3971 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3974 state = 0xdeadbee;
3975 action = 0xdeadbee;
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);
3979 todo_wine
3981 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3984 state = 0xdeadbee;
3985 action = 0xdeadbee;
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);
3989 todo_wine
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;
4006 char prop[100];
4007 static CHAR empty[] = "";
4008 DWORD size;
4009 UINT r;
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 */
4019 size = 0;
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 */
4025 size = 0;
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 */
4037 size++;
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)
4050 MSIHANDLE hpkg;
4051 UINT r;
4052 MSIHANDLE hdb;
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)
4193 MSIHANDLE hpkg;
4194 UINT r;
4195 MSIHANDLE hdb;
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)
4238 MSIHANDLE hpkg;
4239 UINT r;
4240 MSIHANDLE hdb;
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");
4422 state = 0xdeadbee;
4423 action = 0xdeadbee;
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);
4429 state = 0xdeadbee;
4430 action = 0xdeadbee;
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);
4436 state = 0xdeadbee;
4437 action = 0xdeadbee;
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);
4443 state = 0xdeadbee;
4444 action = 0xdeadbee;
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);
4450 state = 0xdeadbee;
4451 action = 0xdeadbee;
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);
4457 state = 0xdeadbee;
4458 action = 0xdeadbee;
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);
4464 state = 0xdeadbee;
4465 action = 0xdeadbee;
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);
4471 state = 0xdeadbee;
4472 action = 0xdeadbee;
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);
4478 state = 0xdeadbee;
4479 action = 0xdeadbee;
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);
4485 state = 0xdeadbee;
4486 action = 0xdeadbee;
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);
4492 state = 0xdeadbee;
4493 action = 0xdeadbee;
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);
4499 state = 0xdeadbee;
4500 action = 0xdeadbee;
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);
4506 state = 0xdeadbee;
4507 action = 0xdeadbee;
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);
4513 state = 0xdeadbee;
4514 action = 0xdeadbee;
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);
4520 state = 0xdeadbee;
4521 action = 0xdeadbee;
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);
4527 state = 0xdeadbee;
4528 action = 0xdeadbee;
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);
4537 state = 0xdeadbee;
4538 action = 0xdeadbee;
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);
4544 state = 0xdeadbee;
4545 action = 0xdeadbee;
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);
4551 state = 0xdeadbee;
4552 action = 0xdeadbee;
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);
4558 state = 0xdeadbee;
4559 action = 0xdeadbee;
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);
4565 state = 0xdeadbee;
4566 action = 0xdeadbee;
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);
4572 state = 0xdeadbee;
4573 action = 0xdeadbee;
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);
4579 state = 0xdeadbee;
4580 action = 0xdeadbee;
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);
4586 state = 0xdeadbee;
4587 action = 0xdeadbee;
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);
4593 state = 0xdeadbee;
4594 action = 0xdeadbee;
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);
4600 state = 0xdeadbee;
4601 action = 0xdeadbee;
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);
4607 state = 0xdeadbee;
4608 action = 0xdeadbee;
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);
4614 state = 0xdeadbee;
4615 action = 0xdeadbee;
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);
4621 state = 0xdeadbee;
4622 action = 0xdeadbee;
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);
4628 state = 0xdeadbee;
4629 action = 0xdeadbee;
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];
4643 CHAR buf[MAX_PATH];
4644 DWORD size, type;
4645 LANGID langid;
4646 HKEY hkey1, hkey2;
4647 int res;
4648 UINT r;
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);
4662 size = MAX_PATH;
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);
4671 size = MAX_PATH;
4672 type = REG_SZ;
4673 *path = '\0';
4674 if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
4676 size = MAX_PATH;
4677 type = REG_SZ;
4678 RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
4681 /* win9x doesn't set this */
4682 if (*path)
4684 size = MAX_PATH;
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);
4690 size = MAX_PATH;
4691 type = REG_SZ;
4692 *path = '\0';
4693 if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
4695 size = MAX_PATH;
4696 type = REG_SZ;
4697 RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
4700 if (*path)
4702 size = MAX_PATH;
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);
4708 size = MAX_PATH;
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);
4713 size = MAX_PATH;
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);
4718 size = MAX_PATH;
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);
4723 size = MAX_PATH;
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);
4728 size = MAX_PATH;
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);
4736 size = MAX_PATH;
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);
4742 size = MAX_PATH;
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);
4747 size = MAX_PATH;
4748 r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
4749 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
4751 CloseHandle(hkey1);
4752 CloseHandle(hkey2);
4753 MsiCloseHandle(hpkg);
4754 DeleteFile(msifile);
4757 static void test_launchconditions(void)
4759 MSIHANDLE hpkg;
4760 MSIHANDLE hdb;
4761 UINT r;
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;
4806 UINT r;
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)
4855 DWORD i,n=1;
4856 GUID guid;
4858 if (FAILED(CLSIDFromString((LPOLESTR)in, &guid)))
4859 return FALSE;
4861 for(i=0; i<8; i++)
4862 out[7-i] = in[n++];
4863 n++;
4864 for(i=0; i<4; i++)
4865 out[11-i] = in[n++];
4866 n++;
4867 for(i=0; i<4; i++)
4868 out[15-i] = in[n++];
4869 n++;
4870 for(i=0; i<2; i++)
4872 out[17+i*2] = in[n++];
4873 out[16+i*2] = in[n++];
4875 n++;
4876 for( ; i<8; i++)
4878 out[17+i*2] = in[n++];
4879 out[16+i*2] = in[n++];
4881 out[32]=0;
4882 return TRUE;
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];
4892 HKEY hkey;
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));
4912 RegCloseKey(hkey);
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;
4945 UINT r;
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);
5116 size = MAX_PATH;
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);
5125 size = MAX_PATH;
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);
5130 size = MAX_PATH;
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);
5135 size = MAX_PATH;
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);
5140 size = MAX_PATH;
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);
5149 size = MAX_PATH;
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);
5154 size = MAX_PATH;
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);
5159 size = MAX_PATH;
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);
5164 size = MAX_PATH;
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);
5169 size = MAX_PATH;
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);
5174 size = MAX_PATH;
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);
5179 size = MAX_PATH;
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);
5184 size = MAX_PATH;
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);
5193 size = MAX_PATH;
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);
5202 size = MAX_PATH;
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);
5207 size = MAX_PATH;
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)
5242 MSIHANDLE summary;
5243 UINT r;
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];
5261 CHAR cwd[MAX_PATH];
5262 CHAR subsrc[MAX_PATH];
5263 CHAR sub2[MAX_PATH];
5264 DWORD size;
5265 UINT r;
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 */
5303 size = MAX_PATH;
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);
5312 /* NULL szFolder */
5313 size = MAX_PATH;
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 */
5323 size = MAX_PATH;
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);
5331 /* try TARGETDIR */
5332 size = MAX_PATH;
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);
5340 /* try SourceDir */
5341 size = MAX_PATH;
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);
5349 /* try SOURCEDIR */
5350 size = MAX_PATH;
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 */
5359 size = MAX_PATH;
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);
5366 /* try SubDir */
5367 size = MAX_PATH;
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);
5375 /* try SubDir2 */
5376 size = MAX_PATH;
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 */
5388 size = MAX_PATH;
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 */
5396 size = MAX_PATH;
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 */
5404 size = MAX_PATH;
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 */
5413 size = MAX_PATH;
5414 lstrcpyA(path, "kiwi");
5415 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
5416 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5417 todo_wine
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 */
5424 size = MAX_PATH;
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 */
5432 size = MAX_PATH;
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 */
5443 size = MAX_PATH;
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 */
5451 size = MAX_PATH;
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 */
5459 size = MAX_PATH;
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 */
5468 size = MAX_PATH;
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 */
5476 size = MAX_PATH;
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 */
5484 size = MAX_PATH;
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 */
5495 size = MAX_PATH;
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 */
5503 size = MAX_PATH;
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 */
5511 size = MAX_PATH;
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 */
5520 size = MAX_PATH;
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 */
5528 size = MAX_PATH;
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 */
5539 size = MAX_PATH;
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 */
5547 size = MAX_PATH;
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 */
5555 size = MAX_PATH;
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 */
5564 size = MAX_PATH;
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 */
5572 size = MAX_PATH;
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 */
5580 size = MAX_PATH;
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 */
5589 size = MAX_PATH;
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 */
5603 size = 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 */
5648 size = MAX_PATH;
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 */
5656 size = MAX_PATH;
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 */
5664 size = MAX_PATH;
5665 lstrcpyA(path, "kiwi");
5666 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
5667 todo_wine
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 */
5675 size = MAX_PATH;
5676 lstrcpyA(path, "kiwi");
5677 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
5678 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5679 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
5680 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
5682 /* try SubDir2 after CostFinalize */
5683 size = MAX_PATH;
5684 lstrcpyA(path, "kiwi");
5685 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
5686 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5687 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
5688 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
5690 MsiCloseHandle(hpkg);
5691 DeleteFile(msifile);
5694 static void test_shortlongsource(void)
5696 MSIHANDLE hdb, hpkg;
5697 CHAR path[MAX_PATH];
5698 CHAR cwd[MAX_PATH];
5699 CHAR subsrc[MAX_PATH];
5700 DWORD size;
5701 UINT r;
5703 lstrcpyA(cwd, CURR_DIR);
5704 lstrcatA(cwd, "\\");
5706 lstrcpyA(subsrc, cwd);
5707 lstrcatA(subsrc, "long");
5708 lstrcatA(subsrc, "\\");
5710 /* long file names */
5712 hdb = create_package_db();
5713 ok( hdb, "failed to create database\n");
5715 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
5717 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
5718 ok(r == S_OK, "failed\n");
5720 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'short|long'");
5721 ok(r == S_OK, "failed\n");
5723 /* CostInitialize:short */
5724 r = add_directory_entry(hdb, "'SubDir2', 'TARGETDIR', 'one|two'");
5725 ok(r == S_OK, "failed\n");
5727 /* CostInitialize:long */
5728 r = add_directory_entry(hdb, "'SubDir3', 'TARGETDIR', 'three|four'");
5729 ok(r == S_OK, "failed\n");
5731 /* FileCost:short */
5732 r = add_directory_entry(hdb, "'SubDir4', 'TARGETDIR', 'five|six'");
5733 ok(r == S_OK, "failed\n");
5735 /* FileCost:long */
5736 r = add_directory_entry(hdb, "'SubDir5', 'TARGETDIR', 'seven|eight'");
5737 ok(r == S_OK, "failed\n");
5739 /* CostFinalize:short */
5740 r = add_directory_entry(hdb, "'SubDir6', 'TARGETDIR', 'nine|ten'");
5741 ok(r == S_OK, "failed\n");
5743 /* CostFinalize:long */
5744 r = add_directory_entry(hdb, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
5745 ok(r == S_OK, "failed\n");
5747 MsiDatabaseCommit(hdb);
5749 hpkg = package_from_db(hdb);
5750 ok(hpkg, "failed to create package\n");
5752 MsiCloseHandle(hdb);
5754 CreateDirectoryA("one", NULL);
5755 CreateDirectoryA("four", NULL);
5757 r = MsiDoAction(hpkg, "CostInitialize");
5758 ok(r == ERROR_SUCCESS, "file cost failed\n");
5760 CreateDirectory("five", NULL);
5761 CreateDirectory("eight", NULL);
5763 r = MsiDoAction(hpkg, "FileCost");
5764 ok(r == ERROR_SUCCESS, "file cost failed\n");
5766 CreateDirectory("nine", NULL);
5767 CreateDirectory("twelve", NULL);
5769 r = MsiDoAction(hpkg, "CostFinalize");
5770 ok(r == ERROR_SUCCESS, "file cost failed\n");
5772 /* neither short nor long source directories exist */
5773 size = MAX_PATH;
5774 lstrcpyA(path, "kiwi");
5775 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
5776 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5777 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5778 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5780 CreateDirectoryA("short", NULL);
5782 /* short source directory exists */
5783 size = MAX_PATH;
5784 lstrcpyA(path, "kiwi");
5785 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
5786 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5787 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5788 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5790 CreateDirectoryA("long", NULL);
5792 /* both short and long source directories exist */
5793 size = MAX_PATH;
5794 lstrcpyA(path, "kiwi");
5795 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
5796 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5797 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5798 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5800 lstrcpyA(subsrc, cwd);
5801 lstrcatA(subsrc, "two");
5802 lstrcatA(subsrc, "\\");
5804 /* short dir exists before CostInitialize */
5805 size = MAX_PATH;
5806 lstrcpyA(path, "kiwi");
5807 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
5808 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5809 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5810 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5812 lstrcpyA(subsrc, cwd);
5813 lstrcatA(subsrc, "four");
5814 lstrcatA(subsrc, "\\");
5816 /* long dir exists before CostInitialize */
5817 size = MAX_PATH;
5818 lstrcpyA(path, "kiwi");
5819 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
5820 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5821 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5822 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5824 lstrcpyA(subsrc, cwd);
5825 lstrcatA(subsrc, "six");
5826 lstrcatA(subsrc, "\\");
5828 /* short dir exists before FileCost */
5829 size = MAX_PATH;
5830 lstrcpyA(path, "kiwi");
5831 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
5832 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5833 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5834 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5836 lstrcpyA(subsrc, cwd);
5837 lstrcatA(subsrc, "eight");
5838 lstrcatA(subsrc, "\\");
5840 /* long dir exists before FileCost */
5841 size = MAX_PATH;
5842 lstrcpyA(path, "kiwi");
5843 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
5844 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5845 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5846 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5848 lstrcpyA(subsrc, cwd);
5849 lstrcatA(subsrc, "ten");
5850 lstrcatA(subsrc, "\\");
5852 /* short dir exists before CostFinalize */
5853 size = MAX_PATH;
5854 lstrcpyA(path, "kiwi");
5855 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
5856 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5857 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5858 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5860 lstrcpyA(subsrc, cwd);
5861 lstrcatA(subsrc, "twelve");
5862 lstrcatA(subsrc, "\\");
5864 /* long dir exists before CostFinalize */
5865 size = MAX_PATH;
5866 lstrcpyA(path, "kiwi");
5867 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
5868 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5869 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5870 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5872 MsiCloseHandle(hpkg);
5873 RemoveDirectoryA("short");
5874 RemoveDirectoryA("long");
5875 RemoveDirectoryA("one");
5876 RemoveDirectoryA("four");
5877 RemoveDirectoryA("five");
5878 RemoveDirectoryA("eight");
5879 RemoveDirectoryA("nine");
5880 RemoveDirectoryA("twelve");
5882 /* short file names */
5884 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
5885 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5887 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
5889 hpkg = package_from_db(hdb);
5890 ok(hpkg, "failed to create package\n");
5892 MsiCloseHandle(hdb);
5894 CreateDirectoryA("one", NULL);
5895 CreateDirectoryA("four", NULL);
5897 r = MsiDoAction(hpkg, "CostInitialize");
5898 ok(r == ERROR_SUCCESS, "file cost failed\n");
5900 CreateDirectory("five", NULL);
5901 CreateDirectory("eight", NULL);
5903 r = MsiDoAction(hpkg, "FileCost");
5904 ok(r == ERROR_SUCCESS, "file cost failed\n");
5906 CreateDirectory("nine", NULL);
5907 CreateDirectory("twelve", NULL);
5909 r = MsiDoAction(hpkg, "CostFinalize");
5910 ok(r == ERROR_SUCCESS, "file cost failed\n");
5912 lstrcpyA(subsrc, cwd);
5913 lstrcatA(subsrc, "short");
5914 lstrcatA(subsrc, "\\");
5916 /* neither short nor long source directories exist */
5917 size = MAX_PATH;
5918 lstrcpyA(path, "kiwi");
5919 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
5920 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5921 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5922 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5924 CreateDirectoryA("short", NULL);
5926 /* short source directory exists */
5927 size = MAX_PATH;
5928 lstrcpyA(path, "kiwi");
5929 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
5930 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5931 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5932 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5934 CreateDirectoryA("long", NULL);
5936 /* both short and long source directories exist */
5937 size = MAX_PATH;
5938 lstrcpyA(path, "kiwi");
5939 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
5940 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5941 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5942 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5944 lstrcpyA(subsrc, cwd);
5945 lstrcatA(subsrc, "one");
5946 lstrcatA(subsrc, "\\");
5948 /* short dir exists before CostInitialize */
5949 size = MAX_PATH;
5950 lstrcpyA(path, "kiwi");
5951 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
5952 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5953 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5954 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5956 lstrcpyA(subsrc, cwd);
5957 lstrcatA(subsrc, "three");
5958 lstrcatA(subsrc, "\\");
5960 /* long dir exists before CostInitialize */
5961 size = MAX_PATH;
5962 lstrcpyA(path, "kiwi");
5963 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
5964 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5965 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5966 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5968 lstrcpyA(subsrc, cwd);
5969 lstrcatA(subsrc, "five");
5970 lstrcatA(subsrc, "\\");
5972 /* short dir exists before FileCost */
5973 size = MAX_PATH;
5974 lstrcpyA(path, "kiwi");
5975 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
5976 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5977 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5978 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5980 lstrcpyA(subsrc, cwd);
5981 lstrcatA(subsrc, "seven");
5982 lstrcatA(subsrc, "\\");
5984 /* long dir exists before FileCost */
5985 size = MAX_PATH;
5986 lstrcpyA(path, "kiwi");
5987 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
5988 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5989 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
5990 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
5992 lstrcpyA(subsrc, cwd);
5993 lstrcatA(subsrc, "nine");
5994 lstrcatA(subsrc, "\\");
5996 /* short dir exists before CostFinalize */
5997 size = MAX_PATH;
5998 lstrcpyA(path, "kiwi");
5999 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
6000 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6001 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
6002 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
6004 lstrcpyA(subsrc, cwd);
6005 lstrcatA(subsrc, "eleven");
6006 lstrcatA(subsrc, "\\");
6008 /* long dir exists before CostFinalize */
6009 size = MAX_PATH;
6010 lstrcpyA(path, "kiwi");
6011 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
6012 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6013 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
6014 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
6016 MsiCloseHandle(hpkg);
6017 RemoveDirectoryA("short");
6018 RemoveDirectoryA("long");
6019 RemoveDirectoryA("one");
6020 RemoveDirectoryA("four");
6021 RemoveDirectoryA("five");
6022 RemoveDirectoryA("eight");
6023 RemoveDirectoryA("nine");
6024 RemoveDirectoryA("twelve");
6025 DeleteFileA(msifile);
6028 static void test_sourcedir(void)
6030 MSIHANDLE hdb, hpkg;
6031 CHAR package[10];
6032 CHAR path[MAX_PATH];
6033 CHAR cwd[MAX_PATH];
6034 CHAR subsrc[MAX_PATH];
6035 DWORD size;
6036 UINT r;
6038 lstrcpyA(cwd, CURR_DIR);
6039 lstrcatA(cwd, "\\");
6041 lstrcpyA(subsrc, cwd);
6042 lstrcatA(subsrc, "long");
6043 lstrcatA(subsrc, "\\");
6045 hdb = create_package_db();
6046 ok( hdb, "failed to create database\n");
6048 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
6049 ok(r == S_OK, "failed\n");
6051 sprintf(package, "#%li", hdb);
6052 r = MsiOpenPackage(package, &hpkg);
6053 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6055 /* properties only */
6057 /* SourceDir prop */
6058 size = MAX_PATH;
6059 lstrcpyA(path, "kiwi");
6060 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
6061 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6062 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
6063 ok(size == 0, "Expected 0, got %d\n", size);
6065 /* SOURCEDIR prop */
6066 size = MAX_PATH;
6067 lstrcpyA(path, "kiwi");
6068 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
6069 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6070 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
6071 ok(size == 0, "Expected 0, got %d\n", size);
6073 r = MsiDoAction(hpkg, "CostInitialize");
6074 ok(r == ERROR_SUCCESS, "file cost failed\n");
6076 /* SourceDir after CostInitialize */
6077 size = MAX_PATH;
6078 lstrcpyA(path, "kiwi");
6079 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
6080 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6081 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
6082 ok(size == 0, "Expected 0, got %d\n", size);
6084 /* SOURCEDIR after CostInitialize */
6085 size = MAX_PATH;
6086 lstrcpyA(path, "kiwi");
6087 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
6088 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6089 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
6090 ok(size == 0, "Expected 0, got %d\n", size);
6092 r = MsiDoAction(hpkg, "FileCost");
6093 ok(r == ERROR_SUCCESS, "file cost failed\n");
6095 /* SourceDir after FileCost */
6096 size = MAX_PATH;
6097 lstrcpyA(path, "kiwi");
6098 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
6099 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6100 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
6101 ok(size == 0, "Expected 0, got %d\n", size);
6103 /* SOURCEDIR after FileCost */
6104 size = MAX_PATH;
6105 lstrcpyA(path, "kiwi");
6106 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
6107 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6108 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
6109 ok(size == 0, "Expected 0, got %d\n", size);
6111 r = MsiDoAction(hpkg, "CostFinalize");
6112 ok(r == ERROR_SUCCESS, "file cost failed\n");
6114 /* SourceDir after CostFinalize */
6115 size = MAX_PATH;
6116 lstrcpyA(path, "kiwi");
6117 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
6118 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6119 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
6120 ok(size == 0, "Expected 0, got %d\n", size);
6122 /* SOURCEDIR after CostFinalize */
6123 size = MAX_PATH;
6124 lstrcpyA(path, "kiwi");
6125 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
6126 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6127 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
6128 ok(size == 0, "Expected 0, got %d\n", size);
6130 r = MsiDoAction(hpkg, "ResolveSource");
6131 ok(r == ERROR_SUCCESS, "file cost failed\n");
6133 /* SourceDir after ResolveSource */
6134 size = MAX_PATH;
6135 lstrcpyA(path, "kiwi");
6136 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
6137 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6138 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
6139 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
6141 /* SOURCEDIR after ResolveSource */
6142 size = MAX_PATH;
6143 lstrcpyA(path, "kiwi");
6144 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
6145 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6146 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
6147 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
6149 /* random casing */
6150 size = MAX_PATH;
6151 lstrcpyA(path, "kiwi");
6152 r = MsiGetProperty(hpkg, "SoUrCeDiR", path, &size);
6153 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6154 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
6155 ok(size == 0, "Expected 0, got %d\n", size);
6157 MsiCloseHandle(hpkg);
6159 /* reset the package state */
6160 sprintf(package, "#%li", hdb);
6161 r = MsiOpenPackage(package, &hpkg);
6162 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6164 /* test how MsiGetSourcePath affects the properties */
6166 /* SourceDir prop */
6167 size = MAX_PATH;
6168 lstrcpyA(path, "kiwi");
6169 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
6170 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6171 todo_wine
6173 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
6174 ok(size == 0, "Expected 0, got %d\n", size);
6177 size = MAX_PATH;
6178 lstrcpyA(path, "kiwi");
6179 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
6180 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
6181 ok(!lstrcmpA(path, "kiwi"),
6182 "Expected path to be unchanged, got \"%s\"\n", path);
6183 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
6185 /* SourceDir after MsiGetSourcePath */
6186 size = MAX_PATH;
6187 lstrcpyA(path, "kiwi");
6188 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
6189 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6190 todo_wine
6192 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
6193 ok(size == 0, "Expected 0, got %d\n", size);
6196 /* SOURCEDIR prop */
6197 size = MAX_PATH;
6198 lstrcpyA(path, "kiwi");
6199 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
6200 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6201 todo_wine
6203 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
6204 ok(size == 0, "Expected 0, got %d\n", size);
6207 size = MAX_PATH;
6208 lstrcpyA(path, "kiwi");
6209 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
6210 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
6211 ok(!lstrcmpA(path, "kiwi"),
6212 "Expected path to be unchanged, got \"%s\"\n", path);
6213 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
6215 /* SOURCEDIR prop after MsiGetSourcePath */
6216 size = MAX_PATH;
6217 lstrcpyA(path, "kiwi");
6218 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
6219 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6220 todo_wine
6222 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
6223 ok(size == 0, "Expected 0, got %d\n", size);
6226 r = MsiDoAction(hpkg, "CostInitialize");
6227 ok(r == ERROR_SUCCESS, "file cost failed\n");
6229 /* SourceDir after CostInitialize */
6230 size = MAX_PATH;
6231 lstrcpyA(path, "kiwi");
6232 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
6233 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6234 todo_wine
6236 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
6237 ok(size == 0, "Expected 0, got %d\n", size);
6240 size = MAX_PATH;
6241 lstrcpyA(path, "kiwi");
6242 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
6243 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6244 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
6245 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
6247 /* SourceDir after MsiGetSourcePath */
6248 size = MAX_PATH;
6249 lstrcpyA(path, "kiwi");
6250 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
6251 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6252 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
6253 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
6255 /* SOURCEDIR after CostInitialize */
6256 size = MAX_PATH;
6257 lstrcpyA(path, "kiwi");
6258 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
6259 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6260 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
6261 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
6263 /* SOURCEDIR source path still does not exist */
6264 size = MAX_PATH;
6265 lstrcpyA(path, "kiwi");
6266 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
6267 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
6268 ok(!lstrcmpA(path, "kiwi"),
6269 "Expected path to be unchanged, got \"%s\"\n", path);
6270 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
6272 r = MsiDoAction(hpkg, "FileCost");
6273 ok(r == ERROR_SUCCESS, "file cost failed\n");
6275 /* SourceDir after FileCost */
6276 size = MAX_PATH;
6277 lstrcpyA(path, "kiwi");
6278 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
6279 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6280 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
6281 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
6283 /* SOURCEDIR after FileCost */
6284 size = MAX_PATH;
6285 lstrcpyA(path, "kiwi");
6286 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
6287 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6288 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
6289 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
6291 /* SOURCEDIR source path still does not exist */
6292 size = MAX_PATH;
6293 lstrcpyA(path, "kiwi");
6294 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
6295 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
6296 ok(!lstrcmpA(path, "kiwi"),
6297 "Expected path to be unchanged, got \"%s\"\n", path);
6298 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
6300 r = MsiDoAction(hpkg, "CostFinalize");
6301 ok(r == ERROR_SUCCESS, "file cost failed\n");
6303 /* SourceDir after CostFinalize */
6304 size = MAX_PATH;
6305 lstrcpyA(path, "kiwi");
6306 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
6307 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6308 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
6309 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
6311 /* SOURCEDIR after CostFinalize */
6312 size = MAX_PATH;
6313 lstrcpyA(path, "kiwi");
6314 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
6315 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6316 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
6317 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
6319 /* SOURCEDIR source path still does not exist */
6320 size = MAX_PATH;
6321 lstrcpyA(path, "kiwi");
6322 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
6323 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
6324 ok(!lstrcmpA(path, "kiwi"),
6325 "Expected path to be unchanged, got \"%s\"\n", path);
6326 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
6328 r = MsiDoAction(hpkg, "ResolveSource");
6329 ok(r == ERROR_SUCCESS, "file cost failed\n");
6331 /* SourceDir after ResolveSource */
6332 size = MAX_PATH;
6333 lstrcpyA(path, "kiwi");
6334 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
6335 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6336 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
6337 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
6339 /* SOURCEDIR after ResolveSource */
6340 size = MAX_PATH;
6341 lstrcpyA(path, "kiwi");
6342 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
6343 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6344 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
6345 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
6347 /* SOURCEDIR source path still does not exist */
6348 size = MAX_PATH;
6349 lstrcpyA(path, "kiwi");
6350 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
6351 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
6352 ok(!lstrcmpA(path, "kiwi"),
6353 "Expected path to be unchanged, got \"%s\"\n", path);
6354 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
6356 MsiCloseHandle(hdb);
6357 MsiCloseHandle(hpkg);
6358 DeleteFileA(msifile);
6361 START_TEST(package)
6363 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
6365 test_createpackage();
6366 test_doaction();
6367 test_gettargetpath_bad();
6368 test_settargetpath();
6369 test_props();
6370 test_property_table();
6371 test_condition();
6372 test_msipackage();
6373 test_formatrecord2();
6374 test_states();
6375 test_getproperty();
6376 test_removefiles();
6377 test_appsearch();
6378 test_featureparents();
6379 test_installprops();
6380 test_launchconditions();
6381 test_ccpsearch();
6382 test_complocator();
6383 test_MsiGetSourcePath();
6384 test_shortlongsource();
6385 test_sourcedir();