msi: Fix a few test failures on win9x.
[wine/wine-gecko.git] / dlls / msi / tests / package.c
blob0857d1bffbc9f6664364618e2882716b9d4d2b8b
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_feature_entry( MSIHANDLE hdb, const char *values )
326 char insert[] = "INSERT INTO `Feature` (`Feature`, `Feature_Parent`, "
327 "`Title`, `Description`, `Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )";
328 char *query;
329 UINT sz, r;
331 sz = strlen(values) + sizeof insert;
332 query = HeapAlloc(GetProcessHeap(),0,sz);
333 sprintf(query,insert,values);
334 r = run_query( hdb, query );
335 HeapFree(GetProcessHeap(), 0, query);
336 return r;
339 static UINT add_feature_components_entry( MSIHANDLE hdb, const char *values )
341 char insert[] = "INSERT INTO `FeatureComponents` "
342 "(`Feature_`, `Component_`) "
343 "VALUES( %s )";
344 char *query;
345 UINT sz, r;
347 sz = strlen(values) + sizeof insert;
348 query = HeapAlloc(GetProcessHeap(),0,sz);
349 sprintf(query,insert,values);
350 r = run_query( hdb, query );
351 HeapFree(GetProcessHeap(), 0, query);
352 return r;
355 static UINT add_file_entry( MSIHANDLE hdb, const char *values )
357 char insert[] = "INSERT INTO `File` "
358 "(`File`, `Component_`, `FileName`, `FileSize`, `Version`, `Language`, `Attributes`, `Sequence`) "
359 "VALUES( %s )";
360 char *query;
361 UINT sz, r;
363 sz = strlen(values) + sizeof insert;
364 query = HeapAlloc(GetProcessHeap(),0,sz);
365 sprintf(query,insert,values);
366 r = run_query( hdb, query );
367 HeapFree(GetProcessHeap(), 0, query);
368 return r;
371 static UINT add_appsearch_entry( MSIHANDLE hdb, const char *values )
373 char insert[] = "INSERT INTO `AppSearch` "
374 "(`Property`, `Signature_`) "
375 "VALUES( %s )";
376 char *query;
377 UINT sz, r;
379 sz = strlen(values) + sizeof insert;
380 query = HeapAlloc(GetProcessHeap(),0,sz);
381 sprintf(query,insert,values);
382 r = run_query( hdb, query );
383 HeapFree(GetProcessHeap(), 0, query);
384 return r;
387 static UINT add_reglocator_entry( MSIHANDLE hdb, const char *values )
389 char insert[] = "INSERT INTO `RegLocator` "
390 "(`Signature_`, `Root`, `Key`, `Name`, `Type`) "
391 "VALUES( %s )";
392 char *query;
393 UINT sz, r;
395 sz = strlen(values) + sizeof insert;
396 query = HeapAlloc(GetProcessHeap(),0,sz);
397 sprintf(query,insert,values);
398 r = run_query( hdb, query );
399 HeapFree(GetProcessHeap(), 0, query);
400 return r;
403 static UINT add_signature_entry( MSIHANDLE hdb, const char *values )
405 char insert[] = "INSERT INTO `Signature` "
406 "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
407 " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
408 "VALUES( %s )";
409 char *query;
410 UINT sz, r;
412 sz = strlen(values) + sizeof insert;
413 query = HeapAlloc(GetProcessHeap(),0,sz);
414 sprintf(query,insert,values);
415 r = run_query( hdb, query );
416 HeapFree(GetProcessHeap(), 0, query);
417 return r;
420 static UINT add_launchcondition_entry( MSIHANDLE hdb, const char *values )
422 char insert[] = "INSERT INTO `LaunchCondition` "
423 "(`Condition`, `Description`) "
424 "VALUES( %s )";
425 char *query;
426 UINT sz, r;
428 sz = strlen(values) + sizeof insert;
429 query = HeapAlloc(GetProcessHeap(),0,sz);
430 sprintf(query,insert,values);
431 r = run_query( hdb, query );
432 HeapFree(GetProcessHeap(), 0, query);
433 return r;
436 static UINT add_property_entry( MSIHANDLE hdb, const char *values )
438 char insert[] = "INSERT INTO `Property` "
439 "(`Property`, `Value`) "
440 "VALUES( %s )";
441 char *query;
442 UINT sz, r;
444 sz = strlen(values) + sizeof insert;
445 query = HeapAlloc(GetProcessHeap(),0,sz);
446 sprintf(query,insert,values);
447 r = run_query( hdb, query );
448 HeapFree(GetProcessHeap(), 0, query);
449 return r;
452 static UINT add_install_execute_sequence_entry( MSIHANDLE hdb, const char *values )
454 char insert[] = "INSERT INTO `InstallExecuteSequence` "
455 "(`Action`, `Condition`, `Sequence`) "
456 "VALUES( %s )";
457 char *query;
458 UINT sz, r;
460 sz = strlen(values) + sizeof insert;
461 query = HeapAlloc(GetProcessHeap(),0,sz);
462 sprintf(query,insert,values);
463 r = run_query( hdb, query );
464 HeapFree(GetProcessHeap(), 0, query);
465 return r;
468 static UINT add_media_entry( MSIHANDLE hdb, const char *values )
470 char insert[] = "INSERT INTO `Media` "
471 "(`DiskId`, `LastSequence`, `DiskPrompt`, `Cabinet`, `VolumeLabel`, `Source`) "
472 "VALUES( %s )";
473 char *query;
474 UINT sz, r;
476 sz = strlen(values) + sizeof insert;
477 query = HeapAlloc(GetProcessHeap(),0,sz);
478 sprintf(query,insert,values);
479 r = run_query( hdb, query );
480 HeapFree(GetProcessHeap(), 0, query);
481 return r;
484 static UINT add_ccpsearch_entry( MSIHANDLE hdb, const char *values )
486 char insert[] = "INSERT INTO `CCPSearch` (`Signature_`) 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_drlocator_entry( MSIHANDLE hdb, const char *values )
500 char insert[] = "INSERT INTO `DrLocator` "
501 "(`Signature_`, `Parent`, `Path`, `Depth`) "
502 "VALUES( %s )";
503 char *query;
504 UINT sz, r;
506 sz = strlen(values) + sizeof insert;
507 query = HeapAlloc(GetProcessHeap(),0,sz);
508 sprintf(query,insert,values);
509 r = run_query( hdb, query );
510 HeapFree(GetProcessHeap(), 0, query);
511 return r;
514 static UINT add_complocator_entry( MSIHANDLE hdb, const char *values )
516 char insert[] = "INSERT INTO `CompLocator` "
517 "(`Signature_`, `ComponentId`, `Type`) "
518 "VALUES( %s )";
519 char *query;
520 UINT sz, r;
522 sz = strlen(values) + sizeof insert;
523 query = HeapAlloc(GetProcessHeap(),0,sz);
524 sprintf(query,insert,values);
525 r = run_query( hdb, query );
526 HeapFree(GetProcessHeap(), 0, query);
527 return r;
530 static UINT set_summary_info(MSIHANDLE hdb)
532 UINT res;
533 MSIHANDLE suminfo;
535 /* build summmary info */
536 res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
537 ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
539 res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
540 "Installation Database");
541 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
543 res = MsiSummaryInfoSetProperty(suminfo,3, VT_LPSTR, 0,NULL,
544 "Installation Database");
545 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
547 res = MsiSummaryInfoSetProperty(suminfo,4, VT_LPSTR, 0,NULL,
548 "Wine Hackers");
549 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
551 res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
552 ";1033");
553 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
555 res = MsiSummaryInfoSetProperty(suminfo,9, VT_LPSTR, 0,NULL,
556 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
557 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
559 res = MsiSummaryInfoSetProperty(suminfo, 14, VT_I4, 100, NULL, NULL);
560 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
562 res = MsiSummaryInfoSetProperty(suminfo, 15, VT_I4, 0, NULL, NULL);
563 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
565 res = MsiSummaryInfoPersist(suminfo);
566 ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
568 res = MsiCloseHandle( suminfo);
569 ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
571 return res;
575 static MSIHANDLE create_package_db(void)
577 MSIHANDLE hdb = 0;
578 UINT res;
580 DeleteFile(msifile);
582 /* create an empty database */
583 res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb );
584 ok( res == ERROR_SUCCESS , "Failed to create database\n" );
585 if( res != ERROR_SUCCESS )
586 return hdb;
588 res = MsiDatabaseCommit( hdb );
589 ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
591 res = set_summary_info(hdb);
593 res = run_query( hdb,
594 "CREATE TABLE `Directory` ( "
595 "`Directory` CHAR(255) NOT NULL, "
596 "`Directory_Parent` CHAR(255), "
597 "`DefaultDir` CHAR(255) NOT NULL "
598 "PRIMARY KEY `Directory`)" );
599 ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
601 return hdb;
604 static MSIHANDLE package_from_db(MSIHANDLE hdb)
606 UINT res;
607 CHAR szPackage[10];
608 MSIHANDLE hPackage;
610 sprintf(szPackage,"#%li",hdb);
611 res = MsiOpenPackage(szPackage,&hPackage);
612 if (res != ERROR_SUCCESS)
613 return 0;
615 res = MsiCloseHandle(hdb);
616 if (res != ERROR_SUCCESS)
617 return 0;
619 return hPackage;
622 static void create_test_file(const CHAR *name)
624 HANDLE file;
625 DWORD written;
627 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
628 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
629 WriteFile(file, name, strlen(name), &written, NULL);
630 WriteFile(file, "\n", strlen("\n"), &written, NULL);
631 CloseHandle(file);
634 static void test_createpackage(void)
636 MSIHANDLE hPackage = 0;
637 UINT res;
639 hPackage = package_from_db(create_package_db());
640 ok( hPackage != 0, " Failed to create package\n");
642 res = MsiCloseHandle( hPackage);
643 ok( res == ERROR_SUCCESS , "Failed to close package\n" );
644 DeleteFile(msifile);
647 static void test_getsourcepath_bad( void )
649 static const char str[] = { 0 };
650 char buffer[0x80];
651 DWORD sz;
652 UINT r;
654 r = MsiGetSourcePath( -1, NULL, NULL, NULL );
655 ok( r == ERROR_INVALID_PARAMETER, "return value wrong\n");
657 sz = 0;
658 r = MsiGetSourcePath( -1, NULL, buffer, &sz );
659 ok( r == ERROR_INVALID_PARAMETER, "return value wrong\n");
661 sz = 0;
662 r = MsiGetSourcePath( -1, str, NULL, &sz );
663 ok( r == ERROR_INVALID_HANDLE, "return value wrong\n");
665 sz = 0;
666 r = MsiGetSourcePath( -1, str, NULL, NULL );
667 ok( r == ERROR_INVALID_HANDLE, "return value wrong\n");
669 sz = 0;
670 r = MsiGetSourcePath( -1, str, buffer, &sz );
671 ok( r == ERROR_INVALID_HANDLE, "return value wrong\n");
674 static UINT add_directory_entry( MSIHANDLE hdb, const char *values )
676 char insert[] = "INSERT INTO `Directory` (`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )";
677 char *query;
678 UINT sz, r;
680 sz = strlen(values) + sizeof insert;
681 query = HeapAlloc(GetProcessHeap(),0,sz);
682 sprintf(query,insert,values);
683 r = run_query( hdb, query );
684 HeapFree(GetProcessHeap(), 0, query);
685 return r;
688 static void test_getsourcepath( void )
690 static const char str[] = { 0 };
691 char buffer[0x80];
692 DWORD sz;
693 UINT r;
694 MSIHANDLE hpkg, hdb;
696 hpkg = package_from_db(create_package_db());
697 ok( hpkg, "failed to create package\n");
699 sz = 0;
700 buffer[0] = 'x';
701 r = MsiGetSourcePath( hpkg, str, buffer, &sz );
702 ok( r == ERROR_DIRECTORY, "return value wrong\n");
703 ok( buffer[0] == 'x', "buffer modified\n");
705 sz = 1;
706 buffer[0] = 'x';
707 r = MsiGetSourcePath( hpkg, str, buffer, &sz );
708 ok( r == ERROR_DIRECTORY, "return value wrong\n");
709 ok( buffer[0] == 'x', "buffer modified\n");
711 MsiCloseHandle( hpkg );
714 /* another test but try create a directory this time */
715 hdb = create_package_db();
716 ok( hdb, "failed to create database\n");
718 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
719 ok( r == S_OK, "failed\n");
721 hpkg = package_from_db(hdb);
722 ok( hpkg, "failed to create package\n");
724 sz = sizeof buffer -1;
725 strcpy(buffer,"x bad");
726 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, &sz );
727 ok( r == ERROR_DIRECTORY, "return value wrong\n");
729 r = MsiDoAction( hpkg, "CostInitialize");
730 ok( r == ERROR_SUCCESS, "cost init failed\n");
731 r = MsiDoAction( hpkg, "CostFinalize");
732 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
734 sz = sizeof buffer -1;
735 buffer[0] = 'x';
736 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, &sz );
737 ok( r == ERROR_SUCCESS, "return value wrong\n");
738 ok( sz == strlen(buffer), "returned length wrong\n");
740 sz = 0;
741 strcpy(buffer,"x bad");
742 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, &sz );
743 ok( r == ERROR_MORE_DATA, "return value wrong\n");
744 ok( buffer[0] == 'x', "buffer modified\n");
746 r = MsiGetSourcePath( hpkg, "TARGETDIR", NULL, NULL );
747 ok( r == ERROR_SUCCESS, "return value wrong\n");
749 r = MsiGetSourcePath( hpkg, "TARGETDIR ", NULL, NULL );
750 ok( r == ERROR_DIRECTORY, "return value wrong\n");
752 r = MsiGetSourcePath( hpkg, "targetdir", NULL, NULL );
753 ok( r == ERROR_DIRECTORY, "return value wrong\n");
755 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, NULL );
756 ok( r == ERROR_INVALID_PARAMETER, "return value wrong\n");
758 r = MsiGetSourcePath( hpkg, "TARGETDIR", NULL, &sz );
759 ok( r == ERROR_SUCCESS, "return value wrong\n");
761 MsiCloseHandle( hpkg );
762 DeleteFile(msifile);
765 static void test_doaction( void )
767 MSIHANDLE hpkg;
768 UINT r;
770 r = MsiDoAction( -1, NULL );
771 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
773 hpkg = package_from_db(create_package_db());
774 ok( hpkg, "failed to create package\n");
776 r = MsiDoAction(hpkg, NULL);
777 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
779 r = MsiDoAction(0, "boo");
780 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
782 r = MsiDoAction(hpkg, "boo");
783 ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
785 MsiCloseHandle( hpkg );
786 DeleteFile(msifile);
789 static void test_gettargetpath_bad(void)
791 char buffer[0x80];
792 MSIHANDLE hpkg;
793 DWORD sz;
794 UINT r;
796 hpkg = package_from_db(create_package_db());
797 ok( hpkg, "failed to create package\n");
799 r = MsiGetTargetPath( 0, NULL, NULL, NULL );
800 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
802 r = MsiGetTargetPath( 0, NULL, NULL, &sz );
803 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
805 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
806 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
808 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
809 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
811 r = MsiGetTargetPath( hpkg, "boo", NULL, NULL );
812 ok( r == ERROR_DIRECTORY, "wrong return val\n");
814 r = MsiGetTargetPath( hpkg, "boo", buffer, NULL );
815 ok( r == ERROR_DIRECTORY, "wrong return val\n");
817 MsiCloseHandle( hpkg );
818 DeleteFile(msifile);
821 static void query_file_path(MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
823 UINT r;
824 DWORD size;
825 MSIHANDLE rec;
827 rec = MsiCreateRecord( 1 );
828 ok(rec, "MsiCreate record failed\n");
830 r = MsiRecordSetString( rec, 0, file );
831 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
833 size = MAX_PATH;
834 r = MsiFormatRecord( hpkg, rec, buff, &size );
835 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
837 MsiCloseHandle( rec );
840 static void test_settargetpath(void)
842 char tempdir[MAX_PATH+8], buffer[MAX_PATH], file[MAX_PATH];
843 DWORD sz;
844 MSIHANDLE hpkg;
845 UINT r;
846 MSIHANDLE hdb;
848 hdb = create_package_db();
849 ok ( hdb, "failed to create package database\n" );
851 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
852 ok( r == S_OK, "failed to add directory entry: %d\n" , r );
854 r = create_component_table( hdb );
855 ok( r == S_OK, "cannot create Component table: %d\n", r );
857 r = add_component_entry( hdb, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
858 ok( r == S_OK, "cannot add dummy component: %d\n", r );
860 r = add_component_entry( hdb, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
861 ok( r == S_OK, "cannot add test component: %d\n", r );
863 r = create_feature_table( hdb );
864 ok( r == S_OK, "cannot create Feature table: %d\n", r );
866 r = add_feature_entry( hdb, "'TestFeature', '', '', '', 0, 1, '', 0" );
867 ok( r == ERROR_SUCCESS, "cannot add TestFeature to Feature table: %d\n", r );
869 r = create_feature_components_table( hdb );
870 ok( r == S_OK, "cannot create FeatureComponents table: %d\n", r );
872 r = add_feature_components_entry( hdb, "'TestFeature', 'RootComp'" );
873 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
875 r = add_feature_components_entry( hdb, "'TestFeature', 'TestComp'" );
876 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
878 add_directory_entry( hdb, "'TestParent', 'TARGETDIR', 'TestParent'" );
879 add_directory_entry( hdb, "'TestDir', 'TestParent', 'TestDir'" );
881 r = create_file_table( hdb );
882 ok( r == S_OK, "cannot create File table: %d\n", r );
884 r = add_file_entry( hdb, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
885 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
887 r = add_file_entry( hdb, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
888 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
890 hpkg = package_from_db( hdb );
891 ok( hpkg, "failed to create package\n");
893 r = MsiDoAction( hpkg, "CostInitialize");
894 ok( r == ERROR_SUCCESS, "cost init failed\n");
896 r = MsiDoAction( hpkg, "FileCost");
897 ok( r == ERROR_SUCCESS, "file cost failed\n");
899 r = MsiDoAction( hpkg, "CostFinalize");
900 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
902 r = MsiSetTargetPath( 0, NULL, NULL );
903 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
905 r = MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
906 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
908 r = MsiSetTargetPath( hpkg, "boo", NULL );
909 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
911 r = MsiSetTargetPath( hpkg, "boo", "c:\\bogusx" );
912 ok( r == ERROR_DIRECTORY, "wrong return val\n");
914 sz = sizeof tempdir - 1;
915 r = MsiGetTargetPath( hpkg, "TARGETDIR", tempdir, &sz );
916 sprintf( file, "%srootfile.txt", tempdir );
917 query_file_path( hpkg, "[#RootFile]", buffer );
918 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
919 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer );
921 GetTempFileName( tempdir, "_wt", 0, buffer );
922 sprintf( tempdir, "%s\\subdir", buffer );
924 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
925 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
926 "MsiSetTargetPath on file returned %d\n", r );
928 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
929 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
930 "MsiSetTargetPath on 'subdir' of file returned %d\n", r );
932 DeleteFile( buffer );
934 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
935 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
937 r = GetFileAttributes( buffer );
938 ok ( r == INVALID_FILE_ATTRIBUTES, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r );
940 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
941 ok( r == ERROR_SUCCESS, "MsiSetTargetPath on subsubdir returned %d\n", r );
943 sz = sizeof buffer - 1;
944 lstrcat( tempdir, "\\" );
945 r = MsiGetTargetPath( hpkg, "TARGETDIR", buffer, &sz );
946 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
947 ok( !lstrcmp(buffer, tempdir), "Expected %s, got %s\n", tempdir, buffer);
949 sprintf( file, "%srootfile.txt", tempdir );
950 query_file_path( hpkg, "[#RootFile]", buffer );
951 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer);
953 r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two" );
954 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
956 query_file_path( hpkg, "[#TestFile]", buffer );
957 ok( !lstrcmp(buffer, "C:\\one\\two\\TestDir\\testfile.txt"),
958 "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer );
960 sz = sizeof buffer - 1;
961 r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
962 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
963 ok( !lstrcmp(buffer, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer);
965 MsiCloseHandle( hpkg );
968 static void test_condition(void)
970 MSICONDITION r;
971 MSIHANDLE hpkg;
973 hpkg = package_from_db(create_package_db());
974 ok( hpkg, "failed to create package\n");
976 r = MsiEvaluateCondition(0, NULL);
977 ok( r == MSICONDITION_ERROR, "wrong return val\n");
979 r = MsiEvaluateCondition(hpkg, NULL);
980 ok( r == MSICONDITION_NONE, "wrong return val\n");
982 r = MsiEvaluateCondition(hpkg, "");
983 ok( r == MSICONDITION_NONE, "wrong return val\n");
985 r = MsiEvaluateCondition(hpkg, "1");
986 ok( r == MSICONDITION_TRUE, "wrong return val\n");
988 r = MsiEvaluateCondition(hpkg, "0");
989 ok( r == MSICONDITION_FALSE, "wrong return val\n");
991 r = MsiEvaluateCondition(hpkg, "-1");
992 ok( r == MSICONDITION_TRUE, "wrong return val\n");
994 r = MsiEvaluateCondition(hpkg, "0 = 0");
995 ok( r == MSICONDITION_TRUE, "wrong return val\n");
997 r = MsiEvaluateCondition(hpkg, "0 <> 0");
998 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1000 r = MsiEvaluateCondition(hpkg, "0 = 1");
1001 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1003 r = MsiEvaluateCondition(hpkg, "0 > 1");
1004 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1006 r = MsiEvaluateCondition(hpkg, "0 ~> 1");
1007 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1009 r = MsiEvaluateCondition(hpkg, "1 > 1");
1010 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1012 r = MsiEvaluateCondition(hpkg, "1 ~> 1");
1013 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1015 r = MsiEvaluateCondition(hpkg, "0 >= 1");
1016 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1018 r = MsiEvaluateCondition(hpkg, "0 ~>= 1");
1019 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1021 r = MsiEvaluateCondition(hpkg, "1 >= 1");
1022 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1024 r = MsiEvaluateCondition(hpkg, "1 ~>= 1");
1025 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1027 r = MsiEvaluateCondition(hpkg, "0 < 1");
1028 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1030 r = MsiEvaluateCondition(hpkg, "0 ~< 1");
1031 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1033 r = MsiEvaluateCondition(hpkg, "1 < 1");
1034 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1036 r = MsiEvaluateCondition(hpkg, "1 ~< 1");
1037 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1039 r = MsiEvaluateCondition(hpkg, "0 <= 1");
1040 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1042 r = MsiEvaluateCondition(hpkg, "0 ~<= 1");
1043 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1045 r = MsiEvaluateCondition(hpkg, "1 <= 1");
1046 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1048 r = MsiEvaluateCondition(hpkg, "1 ~<= 1");
1049 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1051 r = MsiEvaluateCondition(hpkg, "0 >=");
1052 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1054 r = MsiEvaluateCondition(hpkg, " ");
1055 ok( r == MSICONDITION_NONE, "wrong return val\n");
1057 r = MsiEvaluateCondition(hpkg, "LicView <> \"1\"");
1058 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1060 r = MsiEvaluateCondition(hpkg, "LicView <> \"0\"");
1061 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1063 r = MsiEvaluateCondition(hpkg, "LicView <> LicView");
1064 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1066 r = MsiEvaluateCondition(hpkg, "not 0");
1067 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1069 r = MsiEvaluateCondition(hpkg, "not LicView");
1070 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1072 r = MsiEvaluateCondition(hpkg, "not \"A\"");
1073 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1075 r = MsiEvaluateCondition(hpkg, "~not \"A\"");
1076 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1078 r = MsiEvaluateCondition(hpkg, "\"0\"");
1079 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1081 r = MsiEvaluateCondition(hpkg, "1 and 2");
1082 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1084 r = MsiEvaluateCondition(hpkg, "not 0 and 3");
1085 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1087 r = MsiEvaluateCondition(hpkg, "not 0 and 0");
1088 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1090 r = MsiEvaluateCondition(hpkg, "not 0 or 1");
1091 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1093 r = MsiEvaluateCondition(hpkg, "(0)");
1094 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1096 r = MsiEvaluateCondition(hpkg, "(((((1))))))");
1097 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1099 r = MsiEvaluateCondition(hpkg, "(((((1)))))");
1100 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1102 r = MsiEvaluateCondition(hpkg, " \"A\" < \"B\" ");
1103 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1105 r = MsiEvaluateCondition(hpkg, " \"A\" > \"B\" ");
1106 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1108 r = MsiEvaluateCondition(hpkg, " \"1\" > \"12\" ");
1109 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1111 r = MsiEvaluateCondition(hpkg, " \"100\" < \"21\" ");
1112 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1114 r = MsiEvaluateCondition(hpkg, "0 < > 0");
1115 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1117 r = MsiEvaluateCondition(hpkg, "(1<<1) == 2");
1118 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1120 r = MsiEvaluateCondition(hpkg, " \"A\" = \"a\" ");
1121 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1123 r = MsiEvaluateCondition(hpkg, " \"A\" ~ = \"a\" ");
1124 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1126 r = MsiEvaluateCondition(hpkg, " \"A\" ~= \"a\" ");
1127 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1129 r = MsiEvaluateCondition(hpkg, " \"A\" ~= 1 ");
1130 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1132 r = MsiEvaluateCondition(hpkg, " \"A\" = 1 ");
1133 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1135 r = MsiEvaluateCondition(hpkg, " 1 ~= 1 ");
1136 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1138 r = MsiEvaluateCondition(hpkg, " 1 ~= \"1\" ");
1139 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1141 r = MsiEvaluateCondition(hpkg, " 1 = \"1\" ");
1142 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1144 r = MsiEvaluateCondition(hpkg, " 0 = \"1\" ");
1145 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1147 r = MsiEvaluateCondition(hpkg, " 0 < \"100\" ");
1148 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1150 r = MsiEvaluateCondition(hpkg, " 100 > \"0\" ");
1151 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1153 r = MsiEvaluateCondition(hpkg, "1 XOR 1");
1154 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1156 r = MsiEvaluateCondition(hpkg, "1 IMP 1");
1157 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1159 r = MsiEvaluateCondition(hpkg, "1 IMP 0");
1160 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1162 r = MsiEvaluateCondition(hpkg, "0 IMP 0");
1163 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1165 r = MsiEvaluateCondition(hpkg, "0 EQV 0");
1166 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1168 r = MsiEvaluateCondition(hpkg, "0 EQV 1");
1169 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1171 r = MsiEvaluateCondition(hpkg, "1 IMP 1 OR 0");
1172 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1174 r = MsiEvaluateCondition(hpkg, "1 IMPL 1");
1175 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1177 r = MsiEvaluateCondition(hpkg, "\"ASFD\" >< \"S\" ");
1178 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1180 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"s\" ");
1181 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1183 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"\" ");
1184 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1186 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"sss\" ");
1187 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1189 MsiSetProperty(hpkg, "mm", "5" );
1191 r = MsiEvaluateCondition(hpkg, "mm = 5");
1192 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1194 r = MsiEvaluateCondition(hpkg, "mm < 6");
1195 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1197 r = MsiEvaluateCondition(hpkg, "mm <= 5");
1198 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1200 r = MsiEvaluateCondition(hpkg, "mm > 4");
1201 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1203 r = MsiEvaluateCondition(hpkg, "mm < 12");
1204 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1206 r = MsiEvaluateCondition(hpkg, "mm = \"5\"");
1207 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1209 r = MsiEvaluateCondition(hpkg, "0 = \"\"");
1210 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1212 r = MsiEvaluateCondition(hpkg, "0 AND \"\"");
1213 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1215 r = MsiEvaluateCondition(hpkg, "1 AND \"\"");
1216 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1218 r = MsiEvaluateCondition(hpkg, "1 AND \"1\"");
1219 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1221 r = MsiEvaluateCondition(hpkg, "3 >< 1");
1222 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1224 r = MsiEvaluateCondition(hpkg, "3 >< 4");
1225 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1227 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 0");
1228 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1230 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1");
1231 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1233 r = MsiEvaluateCondition(hpkg, "NOT 1 OR 0");
1234 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1236 r = MsiEvaluateCondition(hpkg, "0 AND 1 OR 1");
1237 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1239 r = MsiEvaluateCondition(hpkg, "0 AND 0 OR 1");
1240 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1242 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1 OR 0");
1243 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1245 r = MsiEvaluateCondition(hpkg, "_1 = _1");
1246 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1248 r = MsiEvaluateCondition(hpkg, "( 1 AND 1 ) = 2");
1249 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1251 r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
1252 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1254 r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1255 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1257 r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
1258 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1260 r = MsiEvaluateCondition(hpkg, "NOT 1 AND 0");
1261 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1263 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1264 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1266 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1267 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1269 r = MsiEvaluateCondition(hpkg, "bandalmael<0");
1270 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1272 r = MsiEvaluateCondition(hpkg, "bandalmael>0");
1273 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1275 r = MsiEvaluateCondition(hpkg, "bandalmael>=0");
1276 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1278 r = MsiEvaluateCondition(hpkg, "bandalmael<=0");
1279 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1281 r = MsiEvaluateCondition(hpkg, "bandalmael~<>0");
1282 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1284 MsiSetProperty(hpkg, "bandalmael", "0" );
1285 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1286 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1288 MsiSetProperty(hpkg, "bandalmael", "" );
1289 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1290 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1292 MsiSetProperty(hpkg, "bandalmael", "asdf" );
1293 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1294 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1296 MsiSetProperty(hpkg, "bandalmael", "0asdf" );
1297 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1298 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1300 MsiSetProperty(hpkg, "bandalmael", "0 " );
1301 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1302 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1304 MsiSetProperty(hpkg, "bandalmael", "-0" );
1305 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1306 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1308 MsiSetProperty(hpkg, "bandalmael", "0000000000000" );
1309 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1310 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1312 MsiSetProperty(hpkg, "bandalmael", "--0" );
1313 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1314 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1316 MsiSetProperty(hpkg, "bandalmael", "0x00" );
1317 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1318 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1320 MsiSetProperty(hpkg, "bandalmael", "-" );
1321 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1322 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1324 MsiSetProperty(hpkg, "bandalmael", "+0" );
1325 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1326 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1328 MsiSetProperty(hpkg, "bandalmael", "0.0" );
1329 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1330 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1331 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1332 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1334 MsiSetProperty(hpkg, "one", "hi");
1335 MsiSetProperty(hpkg, "two", "hithere");
1336 r = MsiEvaluateCondition(hpkg, "one >< two");
1337 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1339 MsiSetProperty(hpkg, "one", "hithere");
1340 MsiSetProperty(hpkg, "two", "hi");
1341 r = MsiEvaluateCondition(hpkg, "one >< two");
1342 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1344 MsiSetProperty(hpkg, "one", "hello");
1345 MsiSetProperty(hpkg, "two", "hi");
1346 r = MsiEvaluateCondition(hpkg, "one >< two");
1347 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1349 MsiSetProperty(hpkg, "one", "hellohithere");
1350 MsiSetProperty(hpkg, "two", "hi");
1351 r = MsiEvaluateCondition(hpkg, "one >< two");
1352 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1354 MsiSetProperty(hpkg, "one", "");
1355 MsiSetProperty(hpkg, "two", "hi");
1356 r = MsiEvaluateCondition(hpkg, "one >< two");
1357 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1359 MsiSetProperty(hpkg, "one", "hi");
1360 MsiSetProperty(hpkg, "two", "");
1361 r = MsiEvaluateCondition(hpkg, "one >< two");
1362 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1364 MsiSetProperty(hpkg, "one", "");
1365 MsiSetProperty(hpkg, "two", "");
1366 r = MsiEvaluateCondition(hpkg, "one >< two");
1367 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1369 MsiSetProperty(hpkg, "one", "1234");
1370 MsiSetProperty(hpkg, "two", "1");
1371 r = MsiEvaluateCondition(hpkg, "one >< two");
1372 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1374 MsiSetProperty(hpkg, "one", "one 1234");
1375 MsiSetProperty(hpkg, "two", "1");
1376 r = MsiEvaluateCondition(hpkg, "one >< two");
1377 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1379 MsiSetProperty(hpkg, "one", "hithere");
1380 MsiSetProperty(hpkg, "two", "hi");
1381 r = MsiEvaluateCondition(hpkg, "one << two");
1382 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1384 MsiSetProperty(hpkg, "one", "hi");
1385 MsiSetProperty(hpkg, "two", "hithere");
1386 r = MsiEvaluateCondition(hpkg, "one << two");
1387 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1389 MsiSetProperty(hpkg, "one", "hi");
1390 MsiSetProperty(hpkg, "two", "hi");
1391 r = MsiEvaluateCondition(hpkg, "one << two");
1392 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1394 MsiSetProperty(hpkg, "one", "abcdhithere");
1395 MsiSetProperty(hpkg, "two", "hi");
1396 r = MsiEvaluateCondition(hpkg, "one << two");
1397 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1399 MsiSetProperty(hpkg, "one", "");
1400 MsiSetProperty(hpkg, "two", "hi");
1401 r = MsiEvaluateCondition(hpkg, "one << two");
1402 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1404 MsiSetProperty(hpkg, "one", "hithere");
1405 MsiSetProperty(hpkg, "two", "");
1406 r = MsiEvaluateCondition(hpkg, "one << two");
1407 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1409 MsiSetProperty(hpkg, "one", "");
1410 MsiSetProperty(hpkg, "two", "");
1411 r = MsiEvaluateCondition(hpkg, "one << two");
1412 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1414 MsiSetProperty(hpkg, "one", "1234");
1415 MsiSetProperty(hpkg, "two", "1");
1416 r = MsiEvaluateCondition(hpkg, "one << two");
1417 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1419 MsiSetProperty(hpkg, "one", "1234 one");
1420 MsiSetProperty(hpkg, "two", "1");
1421 r = MsiEvaluateCondition(hpkg, "one << two");
1422 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1424 MsiSetProperty(hpkg, "one", "hithere");
1425 MsiSetProperty(hpkg, "two", "there");
1426 r = MsiEvaluateCondition(hpkg, "one >> two");
1427 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1429 MsiSetProperty(hpkg, "one", "hithere");
1430 MsiSetProperty(hpkg, "two", "hi");
1431 r = MsiEvaluateCondition(hpkg, "one >> two");
1432 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1434 MsiSetProperty(hpkg, "one", "there");
1435 MsiSetProperty(hpkg, "two", "hithere");
1436 r = MsiEvaluateCondition(hpkg, "one >> two");
1437 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1439 MsiSetProperty(hpkg, "one", "there");
1440 MsiSetProperty(hpkg, "two", "there");
1441 r = MsiEvaluateCondition(hpkg, "one >> two");
1442 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1444 MsiSetProperty(hpkg, "one", "abcdhithere");
1445 MsiSetProperty(hpkg, "two", "hi");
1446 r = MsiEvaluateCondition(hpkg, "one >> two");
1447 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1449 MsiSetProperty(hpkg, "one", "");
1450 MsiSetProperty(hpkg, "two", "there");
1451 r = MsiEvaluateCondition(hpkg, "one >> two");
1452 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1454 MsiSetProperty(hpkg, "one", "there");
1455 MsiSetProperty(hpkg, "two", "");
1456 r = MsiEvaluateCondition(hpkg, "one >> two");
1457 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1459 MsiSetProperty(hpkg, "one", "");
1460 MsiSetProperty(hpkg, "two", "");
1461 r = MsiEvaluateCondition(hpkg, "one >> two");
1462 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1464 MsiSetProperty(hpkg, "one", "1234");
1465 MsiSetProperty(hpkg, "two", "4");
1466 r = MsiEvaluateCondition(hpkg, "one >> two");
1467 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1469 MsiSetProperty(hpkg, "one", "one 1234");
1470 MsiSetProperty(hpkg, "two", "4");
1471 r = MsiEvaluateCondition(hpkg, "one >> two");
1472 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1474 MsiSetProperty(hpkg, "MsiNetAssemblySupport", NULL); /* make sure it's empty */
1476 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1477 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1479 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport > \"1.1.4322\"");
1480 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1482 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport >= \"1.1.4322\"");
1483 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1485 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <= \"1.1.4322\"");
1486 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1488 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <> \"1.1.4322\"");
1489 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1491 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1492 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1494 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"abcd\"");
1495 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1497 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a1.1.4322\"");
1498 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1500 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322a\"");
1501 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1503 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1504 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1506 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1507 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1509 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1510 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1512 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1");
1513 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1515 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1\"");
1516 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1518 r = MsiEvaluateCondition(hpkg, "\"2\" < \"12.1\"");
1519 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1521 r = MsiEvaluateCondition(hpkg, "\"02.1\" < \"2.11\"");
1522 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1524 r = MsiEvaluateCondition(hpkg, "\"02.1.1\" < \"2.1\"");
1525 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1527 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1528 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1530 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1531 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1533 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0\"");
1534 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1536 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"-1\"");
1537 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1539 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a\"");
1540 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1542 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1543 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1545 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1546 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1548 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"/\"");
1549 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1551 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \" \"");
1552 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1554 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"azAZ_\"");
1555 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1557 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]\"");
1558 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1560 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]a\"");
1561 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1563 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]\"");
1564 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1566 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]a\"");
1567 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1569 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a}\"");
1570 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1572 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a\"");
1573 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1575 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a\"");
1576 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1578 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a{\"");
1579 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1581 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a]\"");
1582 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1584 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"A\"");
1585 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1587 MsiSetProperty(hpkg, "MsiNetAssemblySupport", "1.1.4322");
1588 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1589 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1591 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.14322\"");
1592 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1594 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.5\"");
1595 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1597 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1598 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1600 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1601 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1603 MsiSetProperty(hpkg, "one", "1");
1604 r = MsiEvaluateCondition(hpkg, "one < \"1\"");
1605 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1607 MsiSetProperty(hpkg, "X", "5.0");
1609 r = MsiEvaluateCondition(hpkg, "X != \"\"");
1610 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1612 r = MsiEvaluateCondition(hpkg, "X =\"5.0\"");
1613 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1615 r = MsiEvaluateCondition(hpkg, "X =\"5.1\"");
1616 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1618 r = MsiEvaluateCondition(hpkg, "X =\"6.0\"");
1619 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1621 r = MsiEvaluateCondition(hpkg, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1622 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1624 r = MsiEvaluateCondition(hpkg, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1625 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1627 r = MsiEvaluateCondition(hpkg, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1628 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1630 /* feature doesn't exist */
1631 r = MsiEvaluateCondition(hpkg, "&nofeature");
1632 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1634 MsiCloseHandle( hpkg );
1635 DeleteFile(msifile);
1638 static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop)
1640 UINT r;
1641 DWORD sz;
1642 char buffer[2];
1644 sz = sizeof buffer;
1645 strcpy(buffer,"x");
1646 r = MsiGetProperty( hpkg, prop, buffer, &sz );
1647 return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
1650 static void test_props(void)
1652 MSIHANDLE hpkg, hdb;
1653 UINT r;
1654 DWORD sz;
1655 char buffer[0x100];
1657 hdb = create_package_db();
1658 r = run_query( hdb,
1659 "CREATE TABLE `Property` ( "
1660 "`Property` CHAR(255) NOT NULL, "
1661 "`Value` CHAR(255) "
1662 "PRIMARY KEY `Property`)" );
1663 ok( r == ERROR_SUCCESS , "Failed\n" );
1665 r = run_query(hdb,
1666 "INSERT INTO `Property` "
1667 "(`Property`, `Value`) "
1668 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1669 ok( r == ERROR_SUCCESS , "Failed\n" );
1671 hpkg = package_from_db( hdb );
1672 ok( hpkg, "failed to create package\n");
1674 /* test invalid values */
1675 r = MsiGetProperty( 0, NULL, NULL, NULL );
1676 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1678 r = MsiGetProperty( hpkg, NULL, NULL, NULL );
1679 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1681 r = MsiGetProperty( hpkg, "boo", NULL, NULL );
1682 ok( r == ERROR_SUCCESS, "wrong return val\n");
1684 r = MsiGetProperty( hpkg, "boo", buffer, NULL );
1685 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1687 /* test retrieving an empty/nonexistent property */
1688 sz = sizeof buffer;
1689 r = MsiGetProperty( hpkg, "boo", NULL, &sz );
1690 ok( r == ERROR_SUCCESS, "wrong return val\n");
1691 ok( sz == 0, "wrong size returned\n");
1693 check_prop_empty( hpkg, "boo");
1694 sz = 0;
1695 strcpy(buffer,"x");
1696 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1697 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1698 ok( !strcmp(buffer,"x"), "buffer was changed\n");
1699 ok( sz == 0, "wrong size returned\n");
1701 sz = 1;
1702 strcpy(buffer,"x");
1703 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1704 ok( r == ERROR_SUCCESS, "wrong return val\n");
1705 ok( buffer[0] == 0, "buffer was not changed\n");
1706 ok( sz == 0, "wrong size returned\n");
1708 /* set the property to something */
1709 r = MsiSetProperty( 0, NULL, NULL );
1710 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1712 r = MsiSetProperty( hpkg, NULL, NULL );
1713 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1715 r = MsiSetProperty( hpkg, "", NULL );
1716 ok( r == ERROR_SUCCESS, "wrong return val\n");
1718 /* try set and get some illegal property identifiers */
1719 r = MsiSetProperty( hpkg, "", "asdf" );
1720 ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n");
1722 r = MsiSetProperty( hpkg, "=", "asdf" );
1723 ok( r == ERROR_SUCCESS, "wrong return val\n");
1725 r = MsiSetProperty( hpkg, " ", "asdf" );
1726 ok( r == ERROR_SUCCESS, "wrong return val\n");
1728 r = MsiSetProperty( hpkg, "'", "asdf" );
1729 ok( r == ERROR_SUCCESS, "wrong return val\n");
1731 sz = sizeof buffer;
1732 buffer[0]=0;
1733 r = MsiGetProperty( hpkg, "'", buffer, &sz );
1734 ok( r == ERROR_SUCCESS, "wrong return val\n");
1735 ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
1737 /* set empty values */
1738 r = MsiSetProperty( hpkg, "boo", NULL );
1739 ok( r == ERROR_SUCCESS, "wrong return val\n");
1740 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1742 r = MsiSetProperty( hpkg, "boo", "" );
1743 ok( r == ERROR_SUCCESS, "wrong return val\n");
1744 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1746 /* set a non-empty value */
1747 r = MsiSetProperty( hpkg, "boo", "xyz" );
1748 ok( r == ERROR_SUCCESS, "wrong return val\n");
1750 sz = 1;
1751 strcpy(buffer,"x");
1752 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1753 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1754 ok( buffer[0] == 0, "buffer was not changed\n");
1755 ok( sz == 3, "wrong size returned\n");
1757 sz = 4;
1758 strcpy(buffer,"x");
1759 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1760 ok( r == ERROR_SUCCESS, "wrong return val\n");
1761 ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
1762 ok( sz == 3, "wrong size returned\n");
1764 sz = 3;
1765 strcpy(buffer,"x");
1766 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1767 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1768 ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
1769 ok( sz == 3, "wrong size returned\n");
1771 r = MsiSetProperty(hpkg, "SourceDir", "foo");
1772 ok( r == ERROR_SUCCESS, "wrong return val\n");
1774 sz = 4;
1775 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
1776 ok( r == ERROR_SUCCESS, "wrong return val\n");
1777 ok( !strcmp(buffer,""), "buffer wrong\n");
1778 ok( sz == 0, "wrong size returned\n");
1780 sz = 4;
1781 r = MsiGetProperty(hpkg, "SOMERANDOMNAME", buffer, &sz);
1782 ok( r == ERROR_SUCCESS, "wrong return val\n");
1783 ok( !strcmp(buffer,""), "buffer wrong\n");
1784 ok( sz == 0, "wrong size returned\n");
1786 sz = 4;
1787 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
1788 ok( r == ERROR_SUCCESS, "wrong return val\n");
1789 ok( !strcmp(buffer,"foo"), "buffer wrong\n");
1790 ok( sz == 3, "wrong size returned\n");
1792 r = MsiSetProperty(hpkg, "MetadataCompName", "Photoshop.dll");
1793 ok( r == ERROR_SUCCESS, "wrong return val\n");
1795 sz = 0;
1796 r = MsiGetProperty(hpkg, "MetadataCompName", NULL, &sz );
1797 ok( r == ERROR_SUCCESS, "return wrong\n");
1798 ok( sz == 13, "size wrong (%d)\n", sz);
1800 sz = 13;
1801 r = MsiGetProperty(hpkg, "MetadataCompName", buffer, &sz );
1802 ok( r == ERROR_MORE_DATA, "return wrong\n");
1803 ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n");
1805 r = MsiSetProperty(hpkg, "property", "value");
1806 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1808 sz = 6;
1809 r = MsiGetProperty(hpkg, "property", buffer, &sz);
1810 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1811 ok( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer);
1813 r = MsiSetProperty(hpkg, "property", NULL);
1814 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1816 sz = 6;
1817 r = MsiGetProperty(hpkg, "property", buffer, &sz);
1818 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1819 ok( !strlen(buffer), "Expected empty string, got %s\n", buffer);
1821 MsiCloseHandle( hpkg );
1822 DeleteFile(msifile);
1825 static BOOL find_prop_in_property(MSIHANDLE hdb, LPCSTR prop, LPCSTR val)
1827 MSIHANDLE hview, hrec;
1828 BOOL found;
1829 CHAR buffer[MAX_PATH];
1830 DWORD sz;
1831 UINT r;
1833 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
1834 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
1835 r = MsiViewExecute(hview, 0);
1836 ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
1838 found = FALSE;
1839 while (r == ERROR_SUCCESS && !found)
1841 r = MsiViewFetch(hview, &hrec);
1842 if (r != ERROR_SUCCESS) break;
1844 sz = MAX_PATH;
1845 r = MsiRecordGetString(hrec, 1, buffer, &sz);
1846 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
1848 sz = MAX_PATH;
1849 r = MsiRecordGetString(hrec, 2, buffer, &sz);
1850 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, val))
1851 found = TRUE;
1854 MsiCloseHandle(hrec);
1857 MsiViewClose(hview);
1858 MsiCloseHandle(hview);
1860 return found;
1863 static void test_property_table(void)
1865 const char *query;
1866 UINT r;
1867 MSIHANDLE hpkg, hdb, hrec;
1868 char buffer[MAX_PATH];
1869 DWORD sz;
1870 BOOL found;
1872 hdb = create_package_db();
1873 ok( hdb, "failed to create package\n");
1875 hpkg = package_from_db(hdb);
1876 ok( hpkg, "failed to create package\n");
1878 MsiCloseHandle(hdb);
1880 hdb = MsiGetActiveDatabase(hpkg);
1882 query = "CREATE TABLE `_Property` ( "
1883 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1884 r = run_query(hdb, query);
1885 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
1887 MsiCloseHandle(hdb);
1888 MsiCloseHandle(hpkg);
1889 DeleteFile(msifile);
1891 hdb = create_package_db();
1892 ok( hdb, "failed to create package\n");
1894 query = "CREATE TABLE `_Property` ( "
1895 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1896 r = run_query(hdb, query);
1897 ok(r == ERROR_SUCCESS, "failed to create table\n");
1899 query = "ALTER `_Property` ADD `foo` INTEGER";
1900 r = run_query(hdb, query);
1901 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
1903 query = "ALTER TABLE `_Property` ADD `foo` INTEGER";
1904 r = run_query(hdb, query);
1905 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
1907 query = "ALTER TABLE `_Property` ADD `extra` INTEGER";
1908 r = run_query(hdb, query);
1909 ok(r == ERROR_SUCCESS, "failed to add column\n");
1911 hpkg = package_from_db(hdb);
1912 todo_wine
1914 ok(!hpkg, "package should not be created\n");
1917 MsiCloseHandle(hdb);
1918 MsiCloseHandle(hpkg);
1919 DeleteFile(msifile);
1921 hdb = create_package_db();
1922 ok (hdb, "failed to create package database\n");
1924 r = create_property_table(hdb);
1925 ok(r == ERROR_SUCCESS, "cannot create Property table: %d\n", r);
1927 r = add_property_entry(hdb, "'prop', 'val'");
1928 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
1930 hpkg = package_from_db(hdb);
1931 ok(hpkg, "failed to create package\n");
1933 MsiCloseHandle(hdb);
1935 sz = MAX_PATH;
1936 r = MsiGetProperty(hpkg, "prop", buffer, &sz);
1937 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1938 ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
1940 hdb = MsiGetActiveDatabase(hpkg);
1942 found = find_prop_in_property(hdb, "prop", "val");
1943 ok(found, "prop should be in the _Property table\n");
1945 r = add_property_entry(hdb, "'dantes', 'mercedes'");
1946 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
1948 query = "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
1949 r = do_query(hdb, query, &hrec);
1950 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
1952 found = find_prop_in_property(hdb, "dantes", "mercedes");
1953 ok(found == FALSE, "dantes should not be in the _Property table\n");
1955 sz = MAX_PATH;
1956 lstrcpy(buffer, "aaa");
1957 r = MsiGetProperty(hpkg, "dantes", buffer, &sz);
1958 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1959 ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer);
1961 r = MsiSetProperty(hpkg, "dantes", "mercedes");
1962 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1964 found = find_prop_in_property(hdb, "dantes", "mercedes");
1965 ok(found == TRUE, "dantes should be in the _Property table\n");
1967 MsiCloseHandle(hdb);
1968 MsiCloseHandle(hpkg);
1969 DeleteFile(msifile);
1972 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
1974 MSIHANDLE htab = 0;
1975 UINT res;
1977 res = MsiDatabaseOpenView( hdb, szQuery, &htab );
1978 if( res == ERROR_SUCCESS )
1980 UINT r;
1982 r = MsiViewExecute( htab, hrec );
1983 if( r != ERROR_SUCCESS )
1985 res = r;
1986 fprintf(stderr,"MsiViewExecute failed %08x\n", res);
1989 r = MsiViewClose( htab );
1990 if( r != ERROR_SUCCESS )
1991 res = r;
1993 r = MsiCloseHandle( htab );
1994 if( r != ERROR_SUCCESS )
1995 res = r;
1997 return res;
2000 static UINT try_query( MSIHANDLE hdb, LPCSTR szQuery )
2002 return try_query_param( hdb, szQuery, 0 );
2005 static void set_summary_str(MSIHANDLE hdb, DWORD pid, LPCSTR value)
2007 MSIHANDLE summary;
2008 UINT r;
2010 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2011 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2013 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
2014 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2016 r = MsiSummaryInfoPersist(summary);
2017 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2019 MsiCloseHandle(summary);
2022 static void set_summary_dword(MSIHANDLE hdb, DWORD pid, DWORD value)
2024 MSIHANDLE summary;
2025 UINT r;
2027 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2028 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2030 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_I4, value, NULL, NULL);
2031 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2033 r = MsiSummaryInfoPersist(summary);
2034 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2036 MsiCloseHandle(summary);
2039 static void test_msipackage(void)
2041 MSIHANDLE hdb = 0, hpack = 100;
2042 UINT r;
2043 const char *query;
2044 char name[10];
2046 /* NULL szPackagePath */
2047 r = MsiOpenPackage(NULL, &hpack);
2048 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2050 /* empty szPackagePath */
2051 r = MsiOpenPackage("", &hpack);
2052 todo_wine
2054 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2057 if (r == ERROR_SUCCESS)
2058 MsiCloseHandle(hpack);
2060 /* nonexistent szPackagePath */
2061 r = MsiOpenPackage("nonexistent", &hpack);
2062 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2064 /* NULL hProduct */
2065 r = MsiOpenPackage(msifile, NULL);
2066 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2068 name[0]='#';
2069 name[1]=0;
2070 r = MsiOpenPackage(name, &hpack);
2071 ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r);
2073 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2074 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2076 /* database exists, but is emtpy */
2077 sprintf(name, "#%ld", hdb);
2078 r = MsiOpenPackage(name, &hpack);
2079 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2080 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2082 query = "CREATE TABLE `Property` ( "
2083 "`Property` CHAR(72), `Value` CHAR(0) "
2084 "PRIMARY KEY `Property`)";
2085 r = try_query(hdb, query);
2086 ok(r == ERROR_SUCCESS, "failed to create Properties table\n");
2088 query = "CREATE TABLE `InstallExecuteSequence` ("
2089 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2090 "PRIMARY KEY `Action`)";
2091 r = try_query(hdb, query);
2092 ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n");
2094 /* a few key tables exist */
2095 sprintf(name, "#%ld", hdb);
2096 r = MsiOpenPackage(name, &hpack);
2097 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2098 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2100 MsiCloseHandle(hdb);
2101 DeleteFile(msifile);
2103 /* start with a clean database to show what constitutes a valid package */
2104 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2105 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2107 sprintf(name, "#%ld", hdb);
2109 /* The following summary information props must exist:
2110 * - PID_REVNUMBER
2111 * - PID_PAGECOUNT
2114 set_summary_dword(hdb, PID_PAGECOUNT, 100);
2115 r = MsiOpenPackage(name, &hpack);
2116 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2117 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2119 set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2120 r = MsiOpenPackage(name, &hpack);
2121 ok(r == ERROR_SUCCESS,
2122 "Expected ERROR_SUCCESS, got %d\n", r);
2124 MsiCloseHandle(hpack);
2125 MsiCloseHandle(hdb);
2126 DeleteFile(msifile);
2129 static void test_formatrecord2(void)
2131 MSIHANDLE hpkg, hrec ;
2132 char buffer[0x100];
2133 DWORD sz;
2134 UINT r;
2136 hpkg = package_from_db(create_package_db());
2137 ok( hpkg, "failed to create package\n");
2139 r = MsiSetProperty(hpkg, "Manufacturer", " " );
2140 ok( r == ERROR_SUCCESS, "set property failed\n");
2142 hrec = MsiCreateRecord(2);
2143 ok(hrec, "create record failed\n");
2145 r = MsiRecordSetString( hrec, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2146 ok( r == ERROR_SUCCESS, "format record failed\n");
2148 buffer[0] = 0;
2149 sz = sizeof buffer;
2150 r = MsiFormatRecord( hpkg, hrec, buffer, &sz );
2152 r = MsiRecordSetString(hrec, 0, "[foo][1]");
2153 r = MsiRecordSetString(hrec, 1, "hoo");
2154 sz = sizeof buffer;
2155 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2156 ok( sz == 3, "size wrong\n");
2157 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2158 ok( r == ERROR_SUCCESS, "format failed\n");
2160 r = MsiRecordSetString(hrec, 0, "x[~]x");
2161 sz = sizeof buffer;
2162 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2163 ok( sz == 3, "size wrong\n");
2164 ok( 0 == strcmp(buffer,"x"), "wrong output %s\n",buffer);
2165 ok( r == ERROR_SUCCESS, "format failed\n");
2167 r = MsiRecordSetString(hrec, 0, "[foo.$%}][1]");
2168 r = MsiRecordSetString(hrec, 1, "hoo");
2169 sz = sizeof buffer;
2170 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2171 ok( sz == 3, "size wrong\n");
2172 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2173 ok( r == ERROR_SUCCESS, "format failed\n");
2175 r = MsiRecordSetString(hrec, 0, "[\\[]");
2176 sz = sizeof buffer;
2177 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2178 ok( sz == 1, "size wrong\n");
2179 ok( 0 == strcmp(buffer,"["), "wrong output %s\n",buffer);
2180 ok( r == ERROR_SUCCESS, "format failed\n");
2182 SetEnvironmentVariable("FOO", "BAR");
2183 r = MsiRecordSetString(hrec, 0, "[%FOO]");
2184 sz = sizeof buffer;
2185 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2186 ok( sz == 3, "size wrong\n");
2187 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2188 ok( r == ERROR_SUCCESS, "format failed\n");
2190 r = MsiRecordSetString(hrec, 0, "[[1]]");
2191 r = MsiRecordSetString(hrec, 1, "%FOO");
2192 sz = sizeof buffer;
2193 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2194 ok( sz == 3, "size wrong\n");
2195 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2196 ok( r == ERROR_SUCCESS, "format failed\n");
2198 MsiCloseHandle( hrec );
2199 MsiCloseHandle( hpkg );
2200 DeleteFile(msifile);
2203 /* FIXME: state is INSTALLSTATE_UNKNOWN if any features are removed and the
2204 * feature in question is not in ADD*
2206 static void test_states(void)
2208 MSIHANDLE hpkg;
2209 UINT r;
2210 MSIHANDLE hdb;
2211 INSTALLSTATE state, action;
2213 hdb = create_package_db();
2214 ok ( hdb, "failed to create package database\n" );
2216 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
2217 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
2219 r = create_property_table( hdb );
2220 ok( r == ERROR_SUCCESS, "cannot create Property table: %d\n", r );
2222 r = add_property_entry( hdb, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2223 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2225 r = add_property_entry( hdb, "'ProductLanguage', '1033'" );
2226 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2228 r = add_property_entry( hdb, "'ProductName', 'MSITEST'" );
2229 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2231 r = add_property_entry( hdb, "'ProductVersion', '1.1.1'" );
2232 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2234 r = create_install_execute_sequence_table( hdb );
2235 ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table: %d\n", r );
2237 r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
2238 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2240 r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
2241 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2243 r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
2244 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2246 r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" );
2247 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2249 r = add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" );
2250 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2252 r = add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" );
2253 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2255 r = add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" );
2256 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2258 r = add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" );
2259 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2261 r = add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" );
2262 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2264 r = add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" );
2265 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2267 r = add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" );
2268 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2270 r = create_media_table( hdb );
2271 ok( r == ERROR_SUCCESS, "cannot create media table: %d\n", r );
2273 r = add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''");
2274 ok( r == ERROR_SUCCESS, "cannot add media entry: %d\n", r );
2276 r = create_feature_table( hdb );
2277 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
2279 r = create_component_table( hdb );
2280 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
2282 /* msidbFeatureAttributesFavorLocal */
2283 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
2284 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2286 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2287 r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2288 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2290 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2291 r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2292 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2294 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2295 r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2296 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2298 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2299 r = add_component_entry( hdb, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2300 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2302 /* msidbFeatureAttributesFavorSource */
2303 r = add_feature_entry( hdb, "'two', '', '', '', 2, 1, '', 1" );
2304 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2306 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2307 r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2308 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2310 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2311 r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2312 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2314 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2315 r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2316 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2318 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2319 r = add_component_entry( hdb, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2320 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2322 /* msidbFeatureAttributesFavorSource */
2323 r = add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" );
2324 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2326 /* msidbFeatureAttributesFavorLocal */
2327 r = add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" );
2328 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2330 /* disabled */
2331 r = add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" );
2332 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2334 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2335 r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2336 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2338 /* no feature parent:msidbComponentAttributesLocalOnly */
2339 r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2340 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2342 /* msidbFeatureAttributesFavorLocal:removed */
2343 r = add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" );
2344 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2346 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2347 r = add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2348 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2350 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2351 r = add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2352 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2354 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2355 r = add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2356 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2358 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2359 r = add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2360 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2362 /* msidbFeatureAttributesFavorSource:removed */
2363 r = add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" );
2364 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2366 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2367 r = add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2368 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2370 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2371 r = add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2372 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2374 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2375 r = add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2376 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2378 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2379 r = add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2380 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2382 r = create_feature_components_table( hdb );
2383 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
2385 r = add_feature_components_entry( hdb, "'one', 'alpha'" );
2386 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2388 r = add_feature_components_entry( hdb, "'one', 'beta'" );
2389 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2391 r = add_feature_components_entry( hdb, "'one', 'gamma'" );
2392 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2394 r = add_feature_components_entry( hdb, "'one', 'theta'" );
2395 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2397 r = add_feature_components_entry( hdb, "'two', 'delta'" );
2398 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2400 r = add_feature_components_entry( hdb, "'two', 'epsilon'" );
2401 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2403 r = add_feature_components_entry( hdb, "'two', 'zeta'" );
2404 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2406 r = add_feature_components_entry( hdb, "'two', 'iota'" );
2407 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2409 r = add_feature_components_entry( hdb, "'three', 'eta'" );
2410 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2412 r = add_feature_components_entry( hdb, "'four', 'eta'" );
2413 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2415 r = add_feature_components_entry( hdb, "'five', 'eta'" );
2416 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2418 r = add_feature_components_entry( hdb, "'six', 'lambda'" );
2419 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2421 r = add_feature_components_entry( hdb, "'six', 'mu'" );
2422 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2424 r = add_feature_components_entry( hdb, "'six', 'nu'" );
2425 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2427 r = add_feature_components_entry( hdb, "'six', 'xi'" );
2428 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2430 r = add_feature_components_entry( hdb, "'seven', 'omicron'" );
2431 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2433 r = add_feature_components_entry( hdb, "'seven', 'pi'" );
2434 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2436 r = add_feature_components_entry( hdb, "'seven', 'rho'" );
2437 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2439 r = add_feature_components_entry( hdb, "'seven', 'sigma'" );
2440 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2442 r = create_file_table( hdb );
2443 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
2445 r = add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2446 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2448 r = add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2449 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2451 r = add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2452 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2454 r = add_file_entry( hdb, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2455 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2457 r = add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2458 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2460 r = add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2461 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2463 r = add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2464 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2466 r = add_file_entry( hdb, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2467 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2469 /* compressed file */
2470 r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2471 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2473 r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2474 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2476 r = add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2477 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2479 r = add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2480 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2482 r = add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2483 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2485 r = add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2486 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2488 r = add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2489 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2491 r = add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2492 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2494 r = add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2495 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2497 r = add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2498 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2500 MsiDatabaseCommit(hdb);
2502 /* these properties must not be in the saved msi file */
2503 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
2504 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2506 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
2507 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2509 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
2510 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2512 hpkg = package_from_db( hdb );
2513 ok( hpkg, "failed to create package\n");
2515 MsiCloseHandle(hdb);
2517 state = 0xdeadbee;
2518 action = 0xdeadbee;
2519 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2520 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2521 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2522 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2524 state = 0xdeadbee;
2525 action = 0xdeadbee;
2526 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2527 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2528 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2529 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2531 state = 0xdeadbee;
2532 action = 0xdeadbee;
2533 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2534 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2535 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2536 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2538 state = 0xdeadbee;
2539 action = 0xdeadbee;
2540 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2541 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2542 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2543 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2545 state = 0xdeadbee;
2546 action = 0xdeadbee;
2547 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2548 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2549 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2550 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2552 state = 0xdeadbee;
2553 action = 0xdeadbee;
2554 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2555 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2556 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2557 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2559 state = 0xdeadbee;
2560 action = 0xdeadbee;
2561 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2562 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2563 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2564 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2566 state = 0xdeadbee;
2567 action = 0xdeadbee;
2568 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2569 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2570 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2571 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2573 state = 0xdeadbee;
2574 action = 0xdeadbee;
2575 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2576 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2577 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2578 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2580 state = 0xdeadbee;
2581 action = 0xdeadbee;
2582 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2583 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2584 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2585 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2587 state = 0xdeadbee;
2588 action = 0xdeadbee;
2589 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2590 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2591 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2592 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2594 state = 0xdeadbee;
2595 action = 0xdeadbee;
2596 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2597 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2598 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2599 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2601 state = 0xdeadbee;
2602 action = 0xdeadbee;
2603 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2604 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2605 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2606 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2608 state = 0xdeadbee;
2609 action = 0xdeadbee;
2610 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2611 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2612 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2613 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2615 state = 0xdeadbee;
2616 action = 0xdeadbee;
2617 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2618 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2619 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2620 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2622 state = 0xdeadbee;
2623 action = 0xdeadbee;
2624 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2625 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2626 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2627 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2629 state = 0xdeadbee;
2630 action = 0xdeadbee;
2631 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2632 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2633 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2634 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2636 state = 0xdeadbee;
2637 action = 0xdeadbee;
2638 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2639 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2640 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2641 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2643 state = 0xdeadbee;
2644 action = 0xdeadbee;
2645 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2646 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2647 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2648 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2650 state = 0xdeadbee;
2651 action = 0xdeadbee;
2652 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2653 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2654 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2655 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2657 state = 0xdeadbee;
2658 action = 0xdeadbee;
2659 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2660 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2661 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2662 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2664 state = 0xdeadbee;
2665 action = 0xdeadbee;
2666 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
2667 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2668 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2669 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2671 state = 0xdeadbee;
2672 action = 0xdeadbee;
2673 r = MsiGetComponentState(hpkg, "pi", &state, &action);
2674 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2675 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2676 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2678 state = 0xdeadbee;
2679 action = 0xdeadbee;
2680 r = MsiGetComponentState(hpkg, "rho", &state, &action);
2681 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2682 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2683 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2685 state = 0xdeadbee;
2686 action = 0xdeadbee;
2687 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
2688 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2689 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2690 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2692 r = MsiDoAction( hpkg, "CostInitialize");
2693 ok( r == ERROR_SUCCESS, "cost init failed\n");
2695 state = 0xdeadbee;
2696 action = 0xdeadbee;
2697 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2698 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2699 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2700 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2702 state = 0xdeadbee;
2703 action = 0xdeadbee;
2704 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2705 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2706 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2707 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2709 state = 0xdeadbee;
2710 action = 0xdeadbee;
2711 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2712 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2713 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2714 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2716 state = 0xdeadbee;
2717 action = 0xdeadbee;
2718 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2719 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2720 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2721 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2723 state = 0xdeadbee;
2724 action = 0xdeadbee;
2725 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2726 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2727 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2728 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2730 state = 0xdeadbee;
2731 action = 0xdeadbee;
2732 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2733 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2734 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2735 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2737 state = 0xdeadbee;
2738 action = 0xdeadbee;
2739 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2740 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2741 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2742 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2744 state = 0xdeadbee;
2745 action = 0xdeadbee;
2746 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2747 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2748 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2749 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2751 state = 0xdeadbee;
2752 action = 0xdeadbee;
2753 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2754 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2755 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2756 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2758 state = 0xdeadbee;
2759 action = 0xdeadbee;
2760 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2761 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2762 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2763 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2765 state = 0xdeadbee;
2766 action = 0xdeadbee;
2767 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2768 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2769 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2770 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2772 state = 0xdeadbee;
2773 action = 0xdeadbee;
2774 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2775 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2776 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2777 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2779 state = 0xdeadbee;
2780 action = 0xdeadbee;
2781 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2782 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2783 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2784 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2786 state = 0xdeadbee;
2787 action = 0xdeadbee;
2788 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2789 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2790 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2791 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2793 state = 0xdeadbee;
2794 action = 0xdeadbee;
2795 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2796 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2797 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2798 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2800 state = 0xdeadbee;
2801 action = 0xdeadbee;
2802 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2803 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2804 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2805 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2807 state = 0xdeadbee;
2808 action = 0xdeadbee;
2809 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2810 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2811 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2812 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2814 state = 0xdeadbee;
2815 action = 0xdeadbee;
2816 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2817 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2818 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2819 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2821 state = 0xdeadbee;
2822 action = 0xdeadbee;
2823 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2824 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2825 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2826 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2828 state = 0xdeadbee;
2829 action = 0xdeadbee;
2830 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2831 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2832 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2833 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2835 state = 0xdeadbee;
2836 action = 0xdeadbee;
2837 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2838 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2839 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2840 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2842 state = 0xdeadbee;
2843 action = 0xdeadbee;
2844 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
2845 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2846 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2847 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2849 state = 0xdeadbee;
2850 action = 0xdeadbee;
2851 r = MsiGetComponentState(hpkg, "pi", &state, &action);
2852 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2853 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2854 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2856 state = 0xdeadbee;
2857 action = 0xdeadbee;
2858 r = MsiGetComponentState(hpkg, "rho", &state, &action);
2859 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2860 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2861 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2863 state = 0xdeadbee;
2864 action = 0xdeadbee;
2865 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
2866 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2867 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2868 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2870 r = MsiDoAction( hpkg, "FileCost");
2871 ok( r == ERROR_SUCCESS, "file cost failed\n");
2873 state = 0xdeadbee;
2874 action = 0xdeadbee;
2875 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2876 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2877 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2878 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2880 state = 0xdeadbee;
2881 action = 0xdeadbee;
2882 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2883 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2884 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2885 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2887 state = 0xdeadbee;
2888 action = 0xdeadbee;
2889 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2890 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2891 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2892 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2894 state = 0xdeadbee;
2895 action = 0xdeadbee;
2896 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2897 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2898 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2899 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2901 state = 0xdeadbee;
2902 action = 0xdeadbee;
2903 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2904 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2905 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2906 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2908 state = 0xdeadbee;
2909 action = 0xdeadbee;
2910 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2911 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2912 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2913 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2915 state = 0xdeadbee;
2916 action = 0xdeadbee;
2917 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2918 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2919 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2920 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2922 state = 0xdeadbee;
2923 action = 0xdeadbee;
2924 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2925 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2926 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2927 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2929 state = 0xdeadbee;
2930 action = 0xdeadbee;
2931 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2932 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2933 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2934 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2936 state = 0xdeadbee;
2937 action = 0xdeadbee;
2938 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2939 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2940 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2941 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2943 state = 0xdeadbee;
2944 action = 0xdeadbee;
2945 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2946 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2947 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2948 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2950 state = 0xdeadbee;
2951 action = 0xdeadbee;
2952 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2953 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2954 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2955 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2957 state = 0xdeadbee;
2958 action = 0xdeadbee;
2959 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2960 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2961 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2962 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2964 state = 0xdeadbee;
2965 action = 0xdeadbee;
2966 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2967 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2968 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2969 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2971 state = 0xdeadbee;
2972 action = 0xdeadbee;
2973 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2974 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2975 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2976 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2978 state = 0xdeadbee;
2979 action = 0xdeadbee;
2980 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2981 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2982 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2983 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2985 state = 0xdeadbee;
2986 action = 0xdeadbee;
2987 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2988 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2989 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2990 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2992 state = 0xdeadbee;
2993 action = 0xdeadbee;
2994 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2995 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2996 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2997 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2999 state = 0xdeadbee;
3000 action = 0xdeadbee;
3001 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3002 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3003 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3004 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3006 state = 0xdeadbee;
3007 action = 0xdeadbee;
3008 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3009 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3010 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3011 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3013 state = 0xdeadbee;
3014 action = 0xdeadbee;
3015 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3016 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3017 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3018 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3020 state = 0xdeadbee;
3021 action = 0xdeadbee;
3022 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3023 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3024 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3025 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3027 state = 0xdeadbee;
3028 action = 0xdeadbee;
3029 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3030 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3031 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3032 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3034 state = 0xdeadbee;
3035 action = 0xdeadbee;
3036 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3037 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3038 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3039 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3041 state = 0xdeadbee;
3042 action = 0xdeadbee;
3043 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3044 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3045 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3046 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3048 r = MsiDoAction( hpkg, "CostFinalize");
3049 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3051 state = 0xdeadbee;
3052 action = 0xdeadbee;
3053 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3054 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3055 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3056 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3058 state = 0xdeadbee;
3059 action = 0xdeadbee;
3060 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3061 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3062 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3063 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3065 state = 0xdeadbee;
3066 action = 0xdeadbee;
3067 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3068 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3069 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3070 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3072 state = 0xdeadbee;
3073 action = 0xdeadbee;
3074 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3075 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3076 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3077 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3079 state = 0xdeadbee;
3080 action = 0xdeadbee;
3081 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3082 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3083 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3084 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3086 state = 0xdeadbee;
3087 action = 0xdeadbee;
3088 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3089 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3090 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3091 todo_wine
3093 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3096 state = 0xdeadbee;
3097 action = 0xdeadbee;
3098 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3099 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3100 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3101 todo_wine
3103 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3106 state = 0xdeadbee;
3107 action = 0xdeadbee;
3108 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3109 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3110 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3111 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3113 state = 0xdeadbee;
3114 action = 0xdeadbee;
3115 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3116 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3117 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3118 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3120 state = 0xdeadbee;
3121 action = 0xdeadbee;
3122 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3123 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3124 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3125 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3127 state = 0xdeadbee;
3128 action = 0xdeadbee;
3129 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3130 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3131 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3132 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3134 state = 0xdeadbee;
3135 action = 0xdeadbee;
3136 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3137 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3138 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3139 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3141 state = 0xdeadbee;
3142 action = 0xdeadbee;
3143 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3144 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3145 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3146 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3148 state = 0xdeadbee;
3149 action = 0xdeadbee;
3150 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3151 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3152 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3153 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3155 state = 0xdeadbee;
3156 action = 0xdeadbee;
3157 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3158 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3159 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3160 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3162 state = 0xdeadbee;
3163 action = 0xdeadbee;
3164 r = MsiGetComponentState(hpkg, "eta", &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 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3169 state = 0xdeadbee;
3170 action = 0xdeadbee;
3171 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3172 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3173 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3174 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3176 state = 0xdeadbee;
3177 action = 0xdeadbee;
3178 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3179 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3180 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3181 todo_wine
3183 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3186 state = 0xdeadbee;
3187 action = 0xdeadbee;
3188 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3189 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3190 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3191 todo_wine
3193 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3196 state = 0xdeadbee;
3197 action = 0xdeadbee;
3198 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3199 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3200 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3201 todo_wine
3203 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3206 state = 0xdeadbee;
3207 action = 0xdeadbee;
3208 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3209 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3210 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3211 todo_wine
3213 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3216 state = 0xdeadbee;
3217 action = 0xdeadbee;
3218 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3219 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3220 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3221 todo_wine
3223 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3226 state = 0xdeadbee;
3227 action = 0xdeadbee;
3228 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3229 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3230 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3231 todo_wine
3233 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3236 state = 0xdeadbee;
3237 action = 0xdeadbee;
3238 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3239 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3240 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3241 todo_wine
3243 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3246 state = 0xdeadbee;
3247 action = 0xdeadbee;
3248 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3249 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3250 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3251 todo_wine
3253 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3256 MsiCloseHandle( hpkg );
3258 /* publish the features and components */
3259 r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven");
3260 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3262 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
3263 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
3265 /* these properties must not be in the saved msi file */
3266 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
3267 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3269 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
3270 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3272 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
3273 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3275 hpkg = package_from_db( hdb );
3276 ok( hpkg, "failed to create package\n");
3278 MsiCloseHandle(hdb);
3280 state = 0xdeadbee;
3281 action = 0xdeadbee;
3282 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3283 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3284 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3285 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3287 state = 0xdeadbee;
3288 action = 0xdeadbee;
3289 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3290 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3291 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3292 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3294 state = 0xdeadbee;
3295 action = 0xdeadbee;
3296 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3297 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3298 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3299 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3301 state = 0xdeadbee;
3302 action = 0xdeadbee;
3303 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3304 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3305 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3306 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3308 state = 0xdeadbee;
3309 action = 0xdeadbee;
3310 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3311 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3312 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3313 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3315 state = 0xdeadbee;
3316 action = 0xdeadbee;
3317 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3318 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3319 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3320 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3322 state = 0xdeadbee;
3323 action = 0xdeadbee;
3324 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3325 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3326 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3327 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3329 state = 0xdeadbee;
3330 action = 0xdeadbee;
3331 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3332 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3333 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3334 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3336 state = 0xdeadbee;
3337 action = 0xdeadbee;
3338 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3339 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3340 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3341 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3343 state = 0xdeadbee;
3344 action = 0xdeadbee;
3345 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3346 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3347 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3348 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3350 state = 0xdeadbee;
3351 action = 0xdeadbee;
3352 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3353 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3354 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3355 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3357 state = 0xdeadbee;
3358 action = 0xdeadbee;
3359 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3360 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3361 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3362 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3364 state = 0xdeadbee;
3365 action = 0xdeadbee;
3366 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3367 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3368 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3369 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3371 state = 0xdeadbee;
3372 action = 0xdeadbee;
3373 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3374 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3375 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3376 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3378 state = 0xdeadbee;
3379 action = 0xdeadbee;
3380 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3381 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3382 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3383 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3385 state = 0xdeadbee;
3386 action = 0xdeadbee;
3387 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3388 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3389 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3390 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3392 state = 0xdeadbee;
3393 action = 0xdeadbee;
3394 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3395 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3396 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3397 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3399 state = 0xdeadbee;
3400 action = 0xdeadbee;
3401 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3402 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3403 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3404 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3406 state = 0xdeadbee;
3407 action = 0xdeadbee;
3408 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3409 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3410 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3411 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3413 state = 0xdeadbee;
3414 action = 0xdeadbee;
3415 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3416 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3417 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3418 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3420 state = 0xdeadbee;
3421 action = 0xdeadbee;
3422 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3423 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3424 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3425 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3427 state = 0xdeadbee;
3428 action = 0xdeadbee;
3429 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3430 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3431 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3432 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3434 state = 0xdeadbee;
3435 action = 0xdeadbee;
3436 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3437 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3438 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3439 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3441 state = 0xdeadbee;
3442 action = 0xdeadbee;
3443 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3444 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3445 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3446 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3448 state = 0xdeadbee;
3449 action = 0xdeadbee;
3450 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3451 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3452 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3453 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3455 r = MsiDoAction( hpkg, "CostInitialize");
3456 ok( r == ERROR_SUCCESS, "cost init failed\n");
3458 state = 0xdeadbee;
3459 action = 0xdeadbee;
3460 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3461 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3462 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3463 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3465 state = 0xdeadbee;
3466 action = 0xdeadbee;
3467 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3468 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3469 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3470 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3472 state = 0xdeadbee;
3473 action = 0xdeadbee;
3474 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3475 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3476 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3477 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3479 state = 0xdeadbee;
3480 action = 0xdeadbee;
3481 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3482 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3483 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3484 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3486 state = 0xdeadbee;
3487 action = 0xdeadbee;
3488 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3489 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3490 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3491 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3493 state = 0xdeadbee;
3494 action = 0xdeadbee;
3495 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3496 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3497 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3498 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3500 state = 0xdeadbee;
3501 action = 0xdeadbee;
3502 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3503 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3504 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3505 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3507 state = 0xdeadbee;
3508 action = 0xdeadbee;
3509 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3510 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3511 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3512 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3514 state = 0xdeadbee;
3515 action = 0xdeadbee;
3516 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3517 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3518 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3519 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3521 state = 0xdeadbee;
3522 action = 0xdeadbee;
3523 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3524 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3525 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3526 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3528 state = 0xdeadbee;
3529 action = 0xdeadbee;
3530 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3531 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3532 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3533 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3535 state = 0xdeadbee;
3536 action = 0xdeadbee;
3537 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3538 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3539 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3540 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3542 state = 0xdeadbee;
3543 action = 0xdeadbee;
3544 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3545 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3546 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3547 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3549 state = 0xdeadbee;
3550 action = 0xdeadbee;
3551 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3552 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3553 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3554 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3556 state = 0xdeadbee;
3557 action = 0xdeadbee;
3558 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3559 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3560 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3561 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3563 state = 0xdeadbee;
3564 action = 0xdeadbee;
3565 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3566 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3567 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3568 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3570 state = 0xdeadbee;
3571 action = 0xdeadbee;
3572 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3573 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3574 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3575 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3577 state = 0xdeadbee;
3578 action = 0xdeadbee;
3579 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3580 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3581 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3582 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3584 state = 0xdeadbee;
3585 action = 0xdeadbee;
3586 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3587 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3588 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3589 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3591 state = 0xdeadbee;
3592 action = 0xdeadbee;
3593 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3594 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3595 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3596 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3598 state = 0xdeadbee;
3599 action = 0xdeadbee;
3600 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3601 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3602 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3603 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3605 state = 0xdeadbee;
3606 action = 0xdeadbee;
3607 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3608 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3609 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3610 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3612 state = 0xdeadbee;
3613 action = 0xdeadbee;
3614 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3615 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3616 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3617 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3619 state = 0xdeadbee;
3620 action = 0xdeadbee;
3621 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3622 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3623 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3624 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3626 state = 0xdeadbee;
3627 action = 0xdeadbee;
3628 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3629 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3630 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3631 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3633 r = MsiDoAction( hpkg, "FileCost");
3634 ok( r == ERROR_SUCCESS, "file cost failed\n");
3636 state = 0xdeadbee;
3637 action = 0xdeadbee;
3638 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3639 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3640 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3641 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3643 state = 0xdeadbee;
3644 action = 0xdeadbee;
3645 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3646 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3647 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3648 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3650 state = 0xdeadbee;
3651 action = 0xdeadbee;
3652 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3653 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3654 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3655 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3657 state = 0xdeadbee;
3658 action = 0xdeadbee;
3659 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3660 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3661 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3662 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3664 state = 0xdeadbee;
3665 action = 0xdeadbee;
3666 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3667 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3668 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3669 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3671 state = 0xdeadbee;
3672 action = 0xdeadbee;
3673 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3674 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3675 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3676 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3678 state = 0xdeadbee;
3679 action = 0xdeadbee;
3680 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3681 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3682 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3683 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3685 state = 0xdeadbee;
3686 action = 0xdeadbee;
3687 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3688 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3689 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3690 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3692 state = 0xdeadbee;
3693 action = 0xdeadbee;
3694 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3695 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3696 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3697 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3699 state = 0xdeadbee;
3700 action = 0xdeadbee;
3701 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3702 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3703 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3704 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3706 state = 0xdeadbee;
3707 action = 0xdeadbee;
3708 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3709 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3710 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3711 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3713 state = 0xdeadbee;
3714 action = 0xdeadbee;
3715 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3716 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3717 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3718 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3720 state = 0xdeadbee;
3721 action = 0xdeadbee;
3722 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3723 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3724 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3725 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3727 state = 0xdeadbee;
3728 action = 0xdeadbee;
3729 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3730 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3731 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3732 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3734 state = 0xdeadbee;
3735 action = 0xdeadbee;
3736 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3737 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3738 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3739 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3741 state = 0xdeadbee;
3742 action = 0xdeadbee;
3743 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3744 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3745 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3746 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3748 state = 0xdeadbee;
3749 action = 0xdeadbee;
3750 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3751 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3752 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3753 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3755 state = 0xdeadbee;
3756 action = 0xdeadbee;
3757 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3758 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3759 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3760 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3762 state = 0xdeadbee;
3763 action = 0xdeadbee;
3764 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3765 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3766 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3767 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3769 state = 0xdeadbee;
3770 action = 0xdeadbee;
3771 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3772 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3773 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3774 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3776 state = 0xdeadbee;
3777 action = 0xdeadbee;
3778 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3779 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3780 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3781 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3783 state = 0xdeadbee;
3784 action = 0xdeadbee;
3785 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3786 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3787 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3788 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3790 state = 0xdeadbee;
3791 action = 0xdeadbee;
3792 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3793 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3794 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3795 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3797 state = 0xdeadbee;
3798 action = 0xdeadbee;
3799 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3800 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3801 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3802 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3804 state = 0xdeadbee;
3805 action = 0xdeadbee;
3806 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3807 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3808 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3809 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3811 r = MsiDoAction( hpkg, "CostFinalize");
3812 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3814 state = 0xdeadbee;
3815 action = 0xdeadbee;
3816 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3817 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3818 todo_wine
3820 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3822 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3824 state = 0xdeadbee;
3825 action = 0xdeadbee;
3826 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3827 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3828 todo_wine
3830 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3832 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3834 state = 0xdeadbee;
3835 action = 0xdeadbee;
3836 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3837 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3838 todo_wine
3840 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3842 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3844 state = 0xdeadbee;
3845 action = 0xdeadbee;
3846 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3847 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3848 todo_wine
3850 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3852 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3854 state = 0xdeadbee;
3855 action = 0xdeadbee;
3856 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3857 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3858 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3859 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3861 state = 0xdeadbee;
3862 action = 0xdeadbee;
3863 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3864 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3865 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3866 todo_wine
3868 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3871 state = 0xdeadbee;
3872 action = 0xdeadbee;
3873 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3874 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3875 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3876 todo_wine
3878 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3881 state = 0xdeadbee;
3882 action = 0xdeadbee;
3883 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3884 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3885 todo_wine
3887 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3889 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3891 state = 0xdeadbee;
3892 action = 0xdeadbee;
3893 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3894 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3895 todo_wine
3897 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3899 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3901 state = 0xdeadbee;
3902 action = 0xdeadbee;
3903 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3904 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3905 todo_wine
3907 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3909 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3911 state = 0xdeadbee;
3912 action = 0xdeadbee;
3913 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3914 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3915 todo_wine
3917 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3919 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3921 state = 0xdeadbee;
3922 action = 0xdeadbee;
3923 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3924 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3925 todo_wine
3927 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3929 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3931 state = 0xdeadbee;
3932 action = 0xdeadbee;
3933 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3934 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3935 todo_wine
3937 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3938 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3941 state = 0xdeadbee;
3942 action = 0xdeadbee;
3943 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3944 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3945 todo_wine
3947 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3948 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3951 state = 0xdeadbee;
3952 action = 0xdeadbee;
3953 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3954 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3955 todo_wine
3957 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3959 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3961 state = 0xdeadbee;
3962 action = 0xdeadbee;
3963 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3964 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3965 todo_wine
3967 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3969 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3971 state = 0xdeadbee;
3972 action = 0xdeadbee;
3973 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3974 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3975 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3976 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3978 state = 0xdeadbee;
3979 action = 0xdeadbee;
3980 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3981 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3982 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3983 todo_wine
3985 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3988 state = 0xdeadbee;
3989 action = 0xdeadbee;
3990 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3991 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3992 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3993 todo_wine
3995 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3998 state = 0xdeadbee;
3999 action = 0xdeadbee;
4000 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4001 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4002 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4003 todo_wine
4005 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4008 state = 0xdeadbee;
4009 action = 0xdeadbee;
4010 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4011 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4012 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4013 todo_wine
4015 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4018 state = 0xdeadbee;
4019 action = 0xdeadbee;
4020 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4021 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4022 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4023 todo_wine
4025 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4028 state = 0xdeadbee;
4029 action = 0xdeadbee;
4030 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4031 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4032 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4033 todo_wine
4035 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4038 state = 0xdeadbee;
4039 action = 0xdeadbee;
4040 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4041 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4042 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4043 todo_wine
4045 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4048 state = 0xdeadbee;
4049 action = 0xdeadbee;
4050 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4051 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4052 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4053 todo_wine
4055 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4058 MsiCloseHandle(hpkg);
4060 /* uninstall the product */
4061 r = MsiInstallProduct(msifile, "REMOVE=ALL");
4062 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4064 DeleteFileA(msifile);
4067 static void test_getproperty(void)
4069 MSIHANDLE hPackage = 0;
4070 char prop[100];
4071 static CHAR empty[] = "";
4072 DWORD size;
4073 UINT r;
4075 hPackage = package_from_db(create_package_db());
4076 ok( hPackage != 0, " Failed to create package\n");
4078 /* set the property */
4079 r = MsiSetProperty(hPackage, "Name", "Value");
4080 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4082 /* retrieve the size, NULL pointer */
4083 size = 0;
4084 r = MsiGetProperty(hPackage, "Name", NULL, &size);
4085 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4086 ok( size == 5, "Expected 5, got %d\n", size);
4088 /* retrieve the size, empty string */
4089 size = 0;
4090 r = MsiGetProperty(hPackage, "Name", empty, &size);
4091 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
4092 ok( size == 5, "Expected 5, got %d\n", size);
4094 /* don't change size */
4095 r = MsiGetProperty(hPackage, "Name", prop, &size);
4096 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
4097 ok( size == 5, "Expected 5, got %d\n", size);
4098 ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
4100 /* increase the size by 1 */
4101 size++;
4102 r = MsiGetProperty(hPackage, "Name", prop, &size);
4103 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4104 ok( size == 5, "Expected 5, got %d\n", size);
4105 ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
4107 r = MsiCloseHandle( hPackage);
4108 ok( r == ERROR_SUCCESS , "Failed to close package\n" );
4109 DeleteFile(msifile);
4112 static void test_removefiles(void)
4114 MSIHANDLE hpkg;
4115 UINT r;
4116 MSIHANDLE hdb;
4118 hdb = create_package_db();
4119 ok ( hdb, "failed to create package database\n" );
4121 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
4122 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4124 r = create_feature_table( hdb );
4125 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
4127 r = create_component_table( hdb );
4128 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
4130 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
4131 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4133 r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
4134 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4136 r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
4137 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4139 r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
4140 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4142 r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
4143 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4145 r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
4146 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4148 r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
4149 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4151 r = create_feature_components_table( hdb );
4152 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
4154 r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
4155 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4157 r = add_feature_components_entry( hdb, "'one', 'helium'" );
4158 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4160 r = add_feature_components_entry( hdb, "'one', 'lithium'" );
4161 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4163 r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
4164 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4166 r = add_feature_components_entry( hdb, "'one', 'boron'" );
4167 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4169 r = add_feature_components_entry( hdb, "'one', 'carbon'" );
4170 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4172 r = create_file_table( hdb );
4173 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
4175 r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
4176 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4178 r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
4179 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4181 r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
4182 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4184 r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
4185 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4187 r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
4188 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4190 r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
4191 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4193 r = create_remove_file_table( hdb );
4194 ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
4196 hpkg = package_from_db( hdb );
4197 ok( hpkg, "failed to create package\n");
4199 MsiCloseHandle( hdb );
4201 create_test_file( "hydrogen.txt" );
4202 create_test_file( "helium.txt" );
4203 create_test_file( "lithium.txt" );
4204 create_test_file( "beryllium.txt" );
4205 create_test_file( "boron.txt" );
4206 create_test_file( "carbon.txt" );
4208 r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
4209 ok( r == ERROR_SUCCESS, "set property failed\n");
4211 r = MsiDoAction( hpkg, "CostInitialize");
4212 ok( r == ERROR_SUCCESS, "cost init failed\n");
4214 r = MsiDoAction( hpkg, "FileCost");
4215 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4217 r = MsiDoAction( hpkg, "CostFinalize");
4218 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4220 r = MsiDoAction( hpkg, "InstallValidate");
4221 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4223 r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
4224 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4226 r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
4227 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4229 r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
4230 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4232 r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
4233 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4235 r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
4236 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4238 r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
4239 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4241 r = MsiDoAction( hpkg, "RemoveFiles");
4242 ok( r == ERROR_SUCCESS, "remove files failed\n");
4244 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
4245 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
4246 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
4247 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
4248 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
4249 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
4251 MsiCloseHandle( hpkg );
4252 DeleteFileA(msifile);
4255 static void test_appsearch(void)
4257 MSIHANDLE hpkg;
4258 UINT r;
4259 MSIHANDLE hdb;
4260 CHAR prop[MAX_PATH];
4261 DWORD size = MAX_PATH;
4263 hdb = create_package_db();
4264 ok ( hdb, "failed to create package database\n" );
4266 r = create_appsearch_table( hdb );
4267 ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
4269 r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
4270 ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
4272 r = create_reglocator_table( hdb );
4273 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
4275 r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
4276 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
4278 r = create_signature_table( hdb );
4279 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
4281 r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
4282 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
4284 hpkg = package_from_db( hdb );
4285 ok( hpkg, "failed to create package\n");
4287 MsiCloseHandle( hdb );
4289 r = MsiDoAction( hpkg, "AppSearch" );
4290 ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
4292 r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
4293 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4294 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
4296 MsiCloseHandle( hpkg );
4297 DeleteFileA(msifile);
4300 static void test_featureparents(void)
4302 MSIHANDLE hpkg;
4303 UINT r;
4304 MSIHANDLE hdb;
4305 INSTALLSTATE state, action;
4307 hdb = create_package_db();
4308 ok ( hdb, "failed to create package database\n" );
4310 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
4311 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4313 r = create_feature_table( hdb );
4314 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
4316 r = create_component_table( hdb );
4317 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
4319 r = create_feature_components_table( hdb );
4320 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
4322 r = create_file_table( hdb );
4323 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
4325 /* msidbFeatureAttributesFavorLocal */
4326 r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
4327 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4329 /* msidbFeatureAttributesFavorSource */
4330 r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
4331 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4333 /* msidbFeatureAttributesFavorLocal */
4334 r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
4335 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4337 /* disabled because of install level */
4338 r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
4339 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4341 /* child feature of disabled feature */
4342 r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
4343 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4345 /* component of disabled feature (install level) */
4346 r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
4347 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4349 /* component of disabled child feature (install level) */
4350 r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
4351 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4353 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
4354 r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
4355 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4357 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
4358 r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
4359 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4361 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
4362 r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
4363 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4365 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
4366 r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
4367 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4369 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
4370 r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
4371 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4373 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
4374 r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
4375 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4377 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
4378 r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
4379 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4381 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
4382 r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
4383 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4385 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
4386 r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
4388 r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
4389 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4391 r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
4392 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4394 r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
4395 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4397 r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
4398 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4400 r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
4401 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4403 r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
4404 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4406 r = add_feature_components_entry( hdb, "'orion', 'leo'" );
4407 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4409 r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
4410 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4412 r = add_feature_components_entry( hdb, "'orion', 'libra'" );
4413 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4415 r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
4416 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4418 r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
4419 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4421 r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
4422 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4424 r = add_feature_components_entry( hdb, "'orion', 'canis'" );
4425 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4427 r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
4428 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4430 r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
4431 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4433 r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
4434 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4436 r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
4437 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4439 r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
4440 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4442 r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
4443 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4445 r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
4446 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4448 r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
4449 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4451 r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
4452 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4454 r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
4455 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4457 r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
4458 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4460 r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
4461 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4463 r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
4464 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4466 r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
4467 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4469 r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
4470 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4472 hpkg = package_from_db( hdb );
4473 ok( hpkg, "failed to create package\n");
4475 MsiCloseHandle( hdb );
4477 r = MsiDoAction( hpkg, "CostInitialize");
4478 ok( r == ERROR_SUCCESS, "cost init failed\n");
4480 r = MsiDoAction( hpkg, "FileCost");
4481 ok( r == ERROR_SUCCESS, "file cost failed\n");
4483 r = MsiDoAction( hpkg, "CostFinalize");
4484 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4486 state = 0xdeadbee;
4487 action = 0xdeadbee;
4488 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
4489 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4490 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4491 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4493 state = 0xdeadbee;
4494 action = 0xdeadbee;
4495 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
4496 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4497 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4498 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4500 state = 0xdeadbee;
4501 action = 0xdeadbee;
4502 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
4503 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4504 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4505 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4507 state = 0xdeadbee;
4508 action = 0xdeadbee;
4509 r = MsiGetFeatureState(hpkg, "waters", &state, &action);
4510 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4511 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4512 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4514 state = 0xdeadbee;
4515 action = 0xdeadbee;
4516 r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
4517 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4518 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4519 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4521 state = 0xdeadbee;
4522 action = 0xdeadbee;
4523 r = MsiGetComponentState(hpkg, "leo", &state, &action);
4524 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4525 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4526 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4528 state = 0xdeadbee;
4529 action = 0xdeadbee;
4530 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
4531 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4532 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
4533 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
4535 state = 0xdeadbee;
4536 action = 0xdeadbee;
4537 r = MsiGetComponentState(hpkg, "libra", &state, &action);
4538 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4539 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
4540 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
4542 state = 0xdeadbee;
4543 action = 0xdeadbee;
4544 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
4545 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4546 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
4547 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
4549 state = 0xdeadbee;
4550 action = 0xdeadbee;
4551 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
4552 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4553 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
4554 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
4556 state = 0xdeadbee;
4557 action = 0xdeadbee;
4558 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
4559 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4560 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
4561 ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
4563 state = 0xdeadbee;
4564 action = 0xdeadbee;
4565 r = MsiGetComponentState(hpkg, "canis", &state, &action);
4566 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4567 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
4568 ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
4570 state = 0xdeadbee;
4571 action = 0xdeadbee;
4572 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
4573 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4574 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
4575 ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
4577 state = 0xdeadbee;
4578 action = 0xdeadbee;
4579 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
4580 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4581 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
4582 ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
4584 state = 0xdeadbee;
4585 action = 0xdeadbee;
4586 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
4587 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4588 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
4589 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
4591 state = 0xdeadbee;
4592 action = 0xdeadbee;
4593 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
4594 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4595 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
4596 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
4598 r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
4599 ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
4601 state = 0xdeadbee;
4602 action = 0xdeadbee;
4603 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
4604 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4605 ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
4606 ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
4608 state = 0xdeadbee;
4609 action = 0xdeadbee;
4610 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
4611 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4612 ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
4613 ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
4615 state = 0xdeadbee;
4616 action = 0xdeadbee;
4617 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
4618 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4619 ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
4620 ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
4622 state = 0xdeadbee;
4623 action = 0xdeadbee;
4624 r = MsiGetComponentState(hpkg, "leo", &state, &action);
4625 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4626 ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
4627 ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
4629 state = 0xdeadbee;
4630 action = 0xdeadbee;
4631 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
4632 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4633 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
4634 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
4636 state = 0xdeadbee;
4637 action = 0xdeadbee;
4638 r = MsiGetComponentState(hpkg, "libra", &state, &action);
4639 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4640 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
4641 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
4643 state = 0xdeadbee;
4644 action = 0xdeadbee;
4645 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
4646 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4647 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
4648 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
4650 state = 0xdeadbee;
4651 action = 0xdeadbee;
4652 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
4653 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4654 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
4655 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
4657 state = 0xdeadbee;
4658 action = 0xdeadbee;
4659 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
4660 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4661 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
4662 ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
4664 state = 0xdeadbee;
4665 action = 0xdeadbee;
4666 r = MsiGetComponentState(hpkg, "canis", &state, &action);
4667 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4668 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
4669 ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
4671 state = 0xdeadbee;
4672 action = 0xdeadbee;
4673 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
4674 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4675 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
4676 ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
4678 state = 0xdeadbee;
4679 action = 0xdeadbee;
4680 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
4681 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4682 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
4683 ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
4685 state = 0xdeadbee;
4686 action = 0xdeadbee;
4687 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
4688 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4689 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
4690 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
4692 state = 0xdeadbee;
4693 action = 0xdeadbee;
4694 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
4695 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4696 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
4697 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
4699 MsiCloseHandle(hpkg);
4700 DeleteFileA(msifile);
4703 static void test_installprops(void)
4705 MSIHANDLE hpkg, hdb;
4706 CHAR path[MAX_PATH];
4707 CHAR buf[MAX_PATH];
4708 DWORD size, type;
4709 LANGID langid;
4710 HKEY hkey1, hkey2;
4711 UINT r;
4713 GetCurrentDirectory(MAX_PATH, path);
4714 lstrcat(path, "\\");
4715 lstrcat(path, msifile);
4717 hdb = create_package_db();
4718 ok( hdb, "failed to create database\n");
4720 hpkg = package_from_db(hdb);
4721 ok( hpkg, "failed to create package\n");
4723 MsiCloseHandle(hdb);
4725 size = MAX_PATH;
4726 r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
4727 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4728 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
4730 RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
4732 RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2);
4734 size = MAX_PATH;
4735 type = REG_SZ;
4736 *path = '\0';
4737 if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
4739 size = MAX_PATH;
4740 type = REG_SZ;
4741 RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
4744 /* win9x doesn't set this */
4745 if (*path)
4747 size = MAX_PATH;
4748 r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
4749 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4750 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
4753 size = MAX_PATH;
4754 type = REG_SZ;
4755 *path = '\0';
4756 if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
4758 size = MAX_PATH;
4759 type = REG_SZ;
4760 RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
4763 if (*path)
4765 size = MAX_PATH;
4766 r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
4767 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4768 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
4771 size = MAX_PATH;
4772 r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
4773 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4774 trace("VersionDatabase = %s\n", buf);
4776 size = MAX_PATH;
4777 r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
4778 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4779 trace("VersionMsi = %s\n", buf);
4781 size = MAX_PATH;
4782 r = MsiGetProperty(hpkg, "Date", buf, &size);
4783 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4784 trace("Date = %s\n", buf);
4786 size = MAX_PATH;
4787 r = MsiGetProperty(hpkg, "Time", buf, &size);
4788 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4789 trace("Time = %s\n", buf);
4791 size = MAX_PATH;
4792 r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
4793 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4794 trace("PackageCode = %s\n", buf);
4796 langid = GetUserDefaultLangID();
4797 sprintf(path, "%d", langid);
4799 size = MAX_PATH;
4800 r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
4801 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
4802 ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
4804 CloseHandle(hkey1);
4805 CloseHandle(hkey2);
4806 MsiCloseHandle(hpkg);
4807 DeleteFile(msifile);
4810 static void test_sourcedirprop(void)
4812 MSIHANDLE hpkg, hdb;
4813 CHAR source_dir[MAX_PATH];
4814 CHAR path[MAX_PATH];
4815 DWORD size;
4816 UINT r;
4818 hdb = create_package_db();
4819 ok ( hdb, "failed to create package database\n" );
4821 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
4822 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4824 hpkg = package_from_db( hdb );
4825 ok( hpkg, "failed to create package\n");
4827 MsiCloseHandle( hdb );
4829 size = MAX_PATH;
4830 r = MsiGetProperty( hpkg, "SourceDir", source_dir, &size );
4831 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4832 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4834 size = MAX_PATH;
4835 r = MsiGetProperty( hpkg, "SOURCEDIR", source_dir, &size );
4836 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4837 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4839 r = MsiDoAction( hpkg, "CostInitialize");
4840 ok( r == ERROR_SUCCESS, "cost init failed\n");
4842 size = MAX_PATH;
4843 r = MsiGetProperty( hpkg, "SourceDir", source_dir, &size );
4844 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4845 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4847 size = MAX_PATH;
4848 r = MsiGetProperty( hpkg, "SOURCEDIR", source_dir, &size );
4849 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4850 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4852 r = MsiDoAction( hpkg, "ResolveSource");
4853 ok( r == ERROR_SUCCESS, "file cost failed\n");
4855 GetCurrentDirectory(MAX_PATH, path);
4856 lstrcatA(path, "\\");
4858 size = MAX_PATH;
4859 r = MsiGetProperty( hpkg, "SourceDir", source_dir, &size );
4860 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4861 ok( !lstrcmpA(source_dir, path), "Expected %s, got %s\n", path, source_dir);
4863 size = MAX_PATH;
4864 r = MsiGetProperty( hpkg, "SOURCEDIR", source_dir, &size );
4865 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4866 ok( !lstrcmpA(source_dir, path), "Expected %s, got %s\n", path, source_dir);
4868 size = MAX_PATH;
4869 r = MsiGetProperty( hpkg, "SoUrCeDiR", source_dir, &size );
4870 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4871 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4873 MsiCloseHandle(hpkg);
4874 DeleteFileA(msifile);
4877 static void test_prop_path(void)
4879 MSIHANDLE hpkg, hdb;
4880 char buffer[MAX_PATH], cwd[MAX_PATH];
4881 DWORD sz;
4882 UINT r;
4884 GetCurrentDirectory(MAX_PATH, cwd);
4885 strcat(cwd, "\\");
4887 hdb = create_package_db();
4888 ok( hdb, "failed to create database\n");
4890 r = add_directory_entry( hdb, "'TARGETDIR','','SourceDir'" );
4891 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4893 r = add_directory_entry( hdb, "'foo','TARGETDIR','foosrc:footgt'" );
4894 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4896 hpkg = package_from_db(hdb);
4897 ok( hpkg, "failed to create package\n");
4899 r = MsiGetSourcePath(hpkg, "SourceDir", buffer, &sz );
4900 ok( r == ERROR_DIRECTORY, "failed to get source path\n");
4902 r = MsiGetSourcePath(hpkg, "SOURCEDIR", buffer, &sz );
4903 ok( r == ERROR_DIRECTORY, "failed to get source path\n");
4905 r = MsiDoAction( hpkg, "CostInitialize");
4906 ok( r == ERROR_SUCCESS, "cost init failed\n");
4908 sz = sizeof buffer;
4909 buffer[0] = 0;
4910 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
4911 ok( r == ERROR_SUCCESS, "property not set\n");
4912 ok( !buffer[0], "SourceDir should be empty\n");
4914 sz = sizeof buffer;
4915 buffer[0] = 0;
4916 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
4917 ok( r == ERROR_SUCCESS, "property not set\n");
4918 ok( !buffer[0], "SourceDir should be empty\n");
4920 sz = sizeof buffer;
4921 buffer[0] = 0;
4922 r = MsiGetSourcePath(hpkg, "SourceDir", buffer, &sz );
4923 ok( r == ERROR_SUCCESS, "failed to get source path\n");
4924 ok( !lstrcmpi(cwd, buffer), "SourceDir (%s) should be current dir (%s)\n", buffer, cwd);
4926 sz = sizeof buffer;
4927 buffer[0] = 0;
4928 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
4929 ok( r == ERROR_SUCCESS, "property not set\n");
4930 todo_wine {
4931 ok( !lstrcmpi(cwd, buffer), "SourceDir (%s) should be current dir (%s)\n", buffer, cwd);
4934 sz = sizeof buffer;
4935 buffer[0] = 0;
4936 r = MsiGetSourcePath(hpkg, "SOURCEDIR", buffer, &sz );
4937 ok( r == ERROR_DIRECTORY, "failed to get source path\n");
4939 sz = sizeof buffer;
4940 buffer[0] = 0;
4941 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
4942 ok( r == ERROR_SUCCESS, "property not set\n");
4943 todo_wine {
4944 ok( !lstrcmpi(cwd, buffer), "SourceDir (%s) should be current dir (%s)\n", buffer, cwd);
4947 r = MsiSetProperty(hpkg, "SourceDir", "goo");
4948 ok( r == ERROR_SUCCESS, "property not set\n");
4950 sz = sizeof buffer;
4951 buffer[0] = 0;
4952 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
4953 ok( r == ERROR_SUCCESS, "property not set\n");
4954 ok( !lstrcmpi(buffer, "goo"), "SourceDir (%s) should be goo\n", buffer);
4956 sz = sizeof buffer;
4957 buffer[0] = 0;
4958 r = MsiGetSourcePath(hpkg, "SourceDir", buffer, &sz );
4959 ok( r == ERROR_SUCCESS, "failed to get source path\n");
4960 ok( !lstrcmpi(buffer, cwd), "SourceDir (%s) should be goo\n", buffer);
4962 sz = sizeof buffer;
4963 buffer[0] = 0;
4964 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
4965 ok( r == ERROR_SUCCESS, "property not set\n");
4966 ok( !lstrcmpi(buffer, "goo"), "SourceDir (%s) should be goo\n", buffer);
4968 MsiCloseHandle( hpkg );
4969 DeleteFile(msifile);
4972 static void test_launchconditions(void)
4974 MSIHANDLE hpkg;
4975 MSIHANDLE hdb;
4976 UINT r;
4978 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4980 hdb = create_package_db();
4981 ok( hdb, "failed to create package database\n" );
4983 r = create_launchcondition_table( hdb );
4984 ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
4986 r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
4987 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
4989 /* invalid condition */
4990 r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
4991 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
4993 hpkg = package_from_db( hdb );
4994 ok( hpkg, "failed to create package\n");
4996 MsiCloseHandle( hdb );
4998 r = MsiSetProperty( hpkg, "X", "1" );
4999 ok( r == ERROR_SUCCESS, "failed to set property\n" );
5001 /* invalid conditions are ignored */
5002 r = MsiDoAction( hpkg, "LaunchConditions" );
5003 ok( r == ERROR_SUCCESS, "cost init failed\n" );
5005 /* verify LaunchConditions still does some verification */
5006 r = MsiSetProperty( hpkg, "X", "2" );
5007 ok( r == ERROR_SUCCESS, "failed to set property\n" );
5009 r = MsiDoAction( hpkg, "LaunchConditions" );
5010 ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
5012 MsiCloseHandle( hpkg );
5013 DeleteFile( msifile );
5016 static void test_ccpsearch(void)
5018 MSIHANDLE hdb, hpkg;
5019 CHAR prop[MAX_PATH];
5020 DWORD size = MAX_PATH;
5021 UINT r;
5023 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5025 hdb = create_package_db();
5026 ok(hdb, "failed to create package database\n");
5028 r = create_ccpsearch_table(hdb);
5029 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5031 r = add_ccpsearch_entry(hdb, "'CCP_random'");
5032 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5034 r = add_ccpsearch_entry(hdb, "'RMCCP_random'");
5035 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5037 r = create_reglocator_table(hdb);
5038 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5040 r = add_reglocator_entry(hdb, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
5041 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5043 r = create_drlocator_table(hdb);
5044 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5046 r = add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
5047 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5049 r = create_signature_table(hdb);
5050 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5052 hpkg = package_from_db(hdb);
5053 ok(hpkg, "failed to create package\n");
5055 MsiCloseHandle(hdb);
5057 r = MsiDoAction(hpkg, "CCPSearch");
5058 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5060 r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
5061 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5062 ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
5064 MsiCloseHandle(hpkg);
5065 DeleteFileA(msifile);
5068 static BOOL squash_guid(LPCWSTR in, LPWSTR out)
5070 DWORD i,n=1;
5071 GUID guid;
5073 if (FAILED(CLSIDFromString((LPOLESTR)in, &guid)))
5074 return FALSE;
5076 for(i=0; i<8; i++)
5077 out[7-i] = in[n++];
5078 n++;
5079 for(i=0; i<4; i++)
5080 out[11-i] = in[n++];
5081 n++;
5082 for(i=0; i<4; i++)
5083 out[15-i] = in[n++];
5084 n++;
5085 for(i=0; i<2; i++)
5087 out[17+i*2] = in[n++];
5088 out[16+i*2] = in[n++];
5090 n++;
5091 for( ; i<8; i++)
5093 out[17+i*2] = in[n++];
5094 out[16+i*2] = in[n++];
5096 out[32]=0;
5097 return TRUE;
5100 static void set_component_path(LPCSTR filename, LPCSTR guid)
5102 WCHAR guidW[MAX_PATH];
5103 WCHAR squashedW[MAX_PATH];
5104 CHAR squashed[MAX_PATH];
5105 CHAR substr[MAX_PATH];
5106 CHAR path[MAX_PATH];
5107 HKEY hkey;
5109 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
5110 squash_guid(guidW, squashedW);
5111 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
5113 lstrcpyA(substr, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
5114 "Installer\\UserData\\S-1-5-18\\Components\\");
5115 lstrcatA(substr, squashed);
5117 RegCreateKeyA(HKEY_LOCAL_MACHINE, substr, &hkey);
5119 lstrcpyA(path, CURR_DIR);
5120 lstrcatA(path, "\\");
5121 lstrcatA(path, filename);
5123 /* just using a random squashed product code */
5124 RegSetValueExA(hkey, "7D2F387510109040002000060BECB6AB", 0,
5125 REG_SZ, (LPBYTE)path, lstrlenA(path));
5127 RegCloseKey(hkey);
5129 lstrcpyA(substr, "SOFTWARE\\Classes\\Installer\\Products\\7D2F387510109040002000060BECB6AB");
5130 RegCreateKeyA(HKEY_LOCAL_MACHINE, substr, &hkey);
5133 static void delete_component_path(LPCSTR guid)
5135 WCHAR guidW[MAX_PATH];
5136 WCHAR squashedW[MAX_PATH];
5137 WCHAR substrW[MAX_PATH];
5138 CHAR squashed[MAX_PATH];
5139 CHAR substr[MAX_PATH];
5141 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
5142 squash_guid(guidW, squashedW);
5143 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
5145 lstrcpyA(substr, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
5146 "Installer\\UserData\\S-1-5-18\\Components\\");
5147 lstrcatA(substr, squashed);
5149 MultiByteToWideChar(CP_ACP, 0, substr, -1, substrW, MAX_PATH);
5150 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW);
5152 lstrcpyA(substr, "SOFTWARE\\Classes\\Installer\\Products\\7D2F387510109040002000060BECB6AB");
5153 MultiByteToWideChar(CP_ACP, 0, substr, -1, substrW, MAX_PATH);
5154 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW);
5157 static void test_complocator(void)
5159 MSIHANDLE hdb, hpkg;
5160 UINT r;
5161 CHAR prop[MAX_PATH];
5162 CHAR expected[MAX_PATH];
5163 DWORD size = MAX_PATH;
5165 hdb = create_package_db();
5166 ok(hdb, "failed to create package database\n");
5168 r = create_appsearch_table(hdb);
5169 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5171 r = add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
5172 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5174 r = add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
5175 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5177 r = add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
5178 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5180 r = add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
5181 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5183 r = add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
5184 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5186 r = add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
5187 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5189 r = add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
5190 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5192 r = add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
5193 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5195 r = add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
5196 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5198 r = add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
5199 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5201 r = add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
5202 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5204 r = add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
5205 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5207 r = add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
5208 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5210 r = add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
5211 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5213 r = add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
5214 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5216 r = add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
5217 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5219 r = create_complocator_table(hdb);
5220 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5222 r = add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
5223 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5225 r = add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
5226 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5228 r = add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
5229 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5231 r = add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
5232 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5234 r = add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
5235 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5237 r = add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
5238 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5240 r = add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
5241 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5243 r = add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
5244 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5246 r = add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
5247 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5249 r = add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
5250 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5252 r = add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
5253 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5255 r = add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
5256 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5258 r = add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
5259 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5261 r = add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
5262 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5264 r = add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
5265 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5267 r = add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
5268 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5270 r = create_signature_table(hdb);
5271 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5273 r = add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
5274 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5276 r = add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
5277 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5279 r = add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
5280 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5282 r = add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
5283 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5285 r = add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
5286 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5288 r = add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
5289 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5291 r = add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
5292 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5294 r = add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
5295 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5297 hpkg = package_from_db(hdb);
5298 ok(hpkg, "failed to create package\n");
5300 MsiCloseHandle(hdb);
5302 create_test_file("abelisaurus");
5303 create_test_file("bactrosaurus");
5304 create_test_file("camelotia");
5305 create_test_file("diclonius");
5306 create_test_file("echinodon");
5307 create_test_file("falcarius");
5308 create_test_file("gallimimus");
5309 create_test_file("hagryphus");
5310 CreateDirectoryA("iguanodon", NULL);
5311 CreateDirectoryA("jobaria", NULL);
5312 CreateDirectoryA("kakuru", NULL);
5313 CreateDirectoryA("labocania", NULL);
5314 CreateDirectoryA("megaraptor", NULL);
5315 CreateDirectoryA("neosodon", NULL);
5316 CreateDirectoryA("olorotitan", NULL);
5317 CreateDirectoryA("pantydraco", NULL);
5319 set_component_path("abelisaurus", "{E3619EED-305A-418C-B9C7-F7D7377F0934}");
5320 set_component_path("bactrosaurus", "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}");
5321 set_component_path("echinodon", "{A19E16C5-C75D-4699-8111-C4338C40C3CB}");
5322 set_component_path("falcarius", "{17762FA1-A7AE-4CC6-8827-62873C35361D}");
5323 set_component_path("iguanodon", "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}");
5324 set_component_path("jobaria", "{243C22B1-8C51-4151-B9D1-1AE5265E079E}");
5325 set_component_path("megaraptor", "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}");
5326 set_component_path("neosodon", "{0B499649-197A-48EF-93D2-AF1C17ED6E90}");
5328 r = MsiDoAction(hpkg, "AppSearch");
5329 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5331 size = MAX_PATH;
5332 r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
5333 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5335 lstrcpyA(expected, CURR_DIR);
5336 lstrcatA(expected, "\\abelisaurus");
5337 ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
5339 size = MAX_PATH;
5340 r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
5341 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5342 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5344 size = MAX_PATH;
5345 r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
5346 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5347 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5349 size = MAX_PATH;
5350 r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
5351 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5352 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5354 size = MAX_PATH;
5355 r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
5356 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5358 lstrcpyA(expected, CURR_DIR);
5359 lstrcatA(expected, "\\");
5360 ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
5362 size = MAX_PATH;
5363 r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
5364 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5365 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5367 size = MAX_PATH;
5368 r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
5369 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5370 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5372 size = MAX_PATH;
5373 r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
5374 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5375 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5377 size = MAX_PATH;
5378 r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
5379 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5380 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5382 size = MAX_PATH;
5383 r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
5384 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5385 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5387 size = MAX_PATH;
5388 r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
5389 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5390 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5392 size = MAX_PATH;
5393 r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
5394 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5395 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5397 size = MAX_PATH;
5398 r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
5399 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5401 lstrcpyA(expected, CURR_DIR);
5402 lstrcatA(expected, "\\");
5403 ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
5405 size = MAX_PATH;
5406 r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
5407 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5409 lstrcpyA(expected, CURR_DIR);
5410 lstrcatA(expected, "\\neosodon\\");
5411 ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
5413 size = MAX_PATH;
5414 r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
5415 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5416 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5418 size = MAX_PATH;
5419 r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
5420 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5421 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5423 MsiCloseHandle(hpkg);
5424 DeleteFileA("abelisaurus");
5425 DeleteFileA("bactrosaurus");
5426 DeleteFileA("camelotia");
5427 DeleteFileA("diclonius");
5428 DeleteFileA("echinodon");
5429 DeleteFileA("falcarius");
5430 DeleteFileA("gallimimus");
5431 DeleteFileA("hagryphus");
5432 RemoveDirectoryA("iguanodon");
5433 RemoveDirectoryA("jobaria");
5434 RemoveDirectoryA("kakuru");
5435 RemoveDirectoryA("labocania");
5436 RemoveDirectoryA("megaraptor");
5437 RemoveDirectoryA("neosodon");
5438 RemoveDirectoryA("olorotitan");
5439 RemoveDirectoryA("pantydraco");
5440 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}");
5441 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}");
5442 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}");
5443 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}");
5444 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}");
5445 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}");
5446 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}");
5447 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}");
5448 DeleteFileA(msifile);
5451 START_TEST(package)
5453 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
5455 test_createpackage();
5456 test_getsourcepath_bad();
5457 test_getsourcepath();
5458 test_doaction();
5459 test_gettargetpath_bad();
5460 test_settargetpath();
5461 test_props();
5462 test_property_table();
5463 test_condition();
5464 test_msipackage();
5465 test_formatrecord2();
5466 test_states();
5467 test_getproperty();
5468 test_removefiles();
5469 test_appsearch();
5470 test_featureparents();
5471 test_installprops();
5472 test_sourcedirprop();
5473 test_prop_path();
5474 test_launchconditions();
5475 test_ccpsearch();
5476 test_complocator();