Merging r37048, r37051, r37052, r37055 from the-real-msvc branch
[reactos.git] / rostests / winetests / msi / package.c
1 /*
2 * tests for Microsoft Installer functionality
3 *
4 * Copyright 2005 Mike McCormack for CodeWeavers
5 * Copyright 2005 Aric Stewart for CodeWeavers
6 *
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.
11 *
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.
16 *
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
20 */
21
22 #define COBJMACROS
23
24 #include <stdio.h>
25 #include <windows.h>
26 #include <msidefs.h>
27 #include <msi.h>
28 #include <msiquery.h>
29
30 #include "wine/test.h"
31
32 static const char msifile[] = "winetest.msi";
33 char CURR_DIR[MAX_PATH];
34
35 /* RegDeleteTreeW from dlls/advapi32/registry.c */
36 LSTATUS WINAPI package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
37 {
38 LONG ret;
39 DWORD dwMaxSubkeyLen, dwMaxValueLen;
40 DWORD dwMaxLen, dwSize;
41 WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
42 HKEY hSubKey = hKey;
43
44 if(lpszSubKey)
45 {
46 ret = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
47 if (ret) return ret;
48 }
49
50 ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
51 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
52 if (ret) goto cleanup;
53
54 dwMaxSubkeyLen++;
55 dwMaxValueLen++;
56 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
57 if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
58 {
59 /* Name too big: alloc a buffer for it */
60 if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
61 {
62 ret = ERROR_NOT_ENOUGH_MEMORY;
63 goto cleanup;
64 }
65 }
66
67 /* Recursively delete all the subkeys */
68 while (TRUE)
69 {
70 dwSize = dwMaxLen;
71 if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
72 NULL, NULL, NULL)) break;
73
74 ret = package_RegDeleteTreeW(hSubKey, lpszName);
75 if (ret) goto cleanup;
76 }
77
78 if (lpszSubKey)
79 ret = RegDeleteKeyW(hKey, lpszSubKey);
80 else
81 while (TRUE)
82 {
83 dwSize = dwMaxLen;
84 if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
85 NULL, NULL, NULL, NULL)) break;
86
87 ret = RegDeleteValueW(hKey, lpszName);
88 if (ret) goto cleanup;
89 }
90
91 cleanup:
92 if (lpszName != szNameBuf)
93 HeapFree(GetProcessHeap(), 0, lpszName);
94 if(lpszSubKey)
95 RegCloseKey(hSubKey);
96 return ret;
97 }
98
99 static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec)
100 {
101 MSIHANDLE hview = 0;
102 UINT r, ret;
103
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;
119 }
120
121 static UINT run_query( MSIHANDLE hdb, const char *query )
122 {
123 MSIHANDLE hview = 0;
124 UINT r;
125
126 r = MsiDatabaseOpenView(hdb, query, &hview);
127 if( r != ERROR_SUCCESS )
128 return r;
129
130 r = MsiViewExecute(hview, 0);
131 if( r == ERROR_SUCCESS )
132 r = MsiViewClose(hview);
133 MsiCloseHandle(hview);
134 return r;
135 }
136
137 static UINT create_component_table( MSIHANDLE hdb )
138 {
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`)" );
148 }
149
150 static UINT create_feature_table( MSIHANDLE hdb )
151 {
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`)" );
163 }
164
165 static UINT create_feature_components_table( MSIHANDLE hdb )
166 {
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_` )" );
172 }
173
174 static UINT create_file_table( MSIHANDLE hdb )
175 {
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`)" );
187 }
188
189 static UINT create_remove_file_table( MSIHANDLE hdb )
190 {
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`)" );
199 }
200
201 static UINT create_appsearch_table( MSIHANDLE hdb )
202 {
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_`)" );
208 }
209
210 static UINT create_reglocator_table( MSIHANDLE hdb )
211 {
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_`)" );
220 }
221
222 static UINT create_signature_table( MSIHANDLE hdb )
223 {
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`)" );
236 }
237
238 static UINT create_launchcondition_table( MSIHANDLE hdb )
239 {
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`)" );
245 }
246
247 static UINT create_property_table( MSIHANDLE hdb )
248 {
249 return run_query( hdb,
250 "CREATE TABLE `Property` ("
251 "`Property` CHAR(72) NOT NULL, "
252 "`Value` CHAR(0) "
253 "PRIMARY KEY `Property`)" );
254 }
255
256 static UINT create_install_execute_sequence_table( MSIHANDLE hdb )
257 {
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`)" );
264 }
265
266 static UINT create_media_table( MSIHANDLE hdb )
267 {
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`)" );
277 }
278
279 static UINT create_ccpsearch_table( MSIHANDLE hdb )
280 {
281 return run_query( hdb,
282 "CREATE TABLE `CCPSearch` ("
283 "`Signature_` CHAR(72) NOT NULL "
284 "PRIMARY KEY `Signature_`)" );
285 }
286
287 static UINT create_drlocator_table( MSIHANDLE hdb )
288 {
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`)" );
296 }
297
298 static UINT create_complocator_table( MSIHANDLE hdb )
299 {
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_`)" );
306 }
307
308 static UINT add_component_entry( MSIHANDLE hdb, const char *values )
309 {
310 char insert[] = "INSERT INTO `Component` "
311 "(`Component`, `ComponentId`, `Directory_`, `Attributes`, `Condition`, `KeyPath`) "
312 "VALUES( %s )";
313 char *query;
314 UINT sz, r;
315
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;
322 }
323
324 static UINT add_feature_entry( MSIHANDLE hdb, const char *values )
325 {
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;
330
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;
337 }
338
339 static UINT add_feature_components_entry( MSIHANDLE hdb, const char *values )
340 {
341 char insert[] = "INSERT INTO `FeatureComponents` "
342 "(`Feature_`, `Component_`) "
343 "VALUES( %s )";
344 char *query;
345 UINT sz, r;
346
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;
353 }
354
355 static UINT add_file_entry( MSIHANDLE hdb, const char *values )
356 {
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;
362
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;
369 }
370
371 static UINT add_appsearch_entry( MSIHANDLE hdb, const char *values )
372 {
373 char insert[] = "INSERT INTO `AppSearch` "
374 "(`Property`, `Signature_`) "
375 "VALUES( %s )";
376 char *query;
377 UINT sz, r;
378
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;
385 }
386
387 static UINT add_reglocator_entry( MSIHANDLE hdb, const char *values )
388 {
389 char insert[] = "INSERT INTO `RegLocator` "
390 "(`Signature_`, `Root`, `Key`, `Name`, `Type`) "
391 "VALUES( %s )";
392 char *query;
393 UINT sz, r;
394
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;
401 }
402
403 static UINT add_signature_entry( MSIHANDLE hdb, const char *values )
404 {
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;
411
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;
418 }
419
420 static UINT add_launchcondition_entry( MSIHANDLE hdb, const char *values )
421 {
422 char insert[] = "INSERT INTO `LaunchCondition` "
423 "(`Condition`, `Description`) "
424 "VALUES( %s )";
425 char *query;
426 UINT sz, r;
427
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;
434 }
435
436 static UINT add_property_entry( MSIHANDLE hdb, const char *values )
437 {
438 char insert[] = "INSERT INTO `Property` "
439 "(`Property`, `Value`) "
440 "VALUES( %s )";
441 char *query;
442 UINT sz, r;
443
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;
450 }
451
452 static UINT add_install_execute_sequence_entry( MSIHANDLE hdb, const char *values )
453 {
454 char insert[] = "INSERT INTO `InstallExecuteSequence` "
455 "(`Action`, `Condition`, `Sequence`) "
456 "VALUES( %s )";
457 char *query;
458 UINT sz, r;
459
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;
466 }
467
468 static UINT add_media_entry( MSIHANDLE hdb, const char *values )
469 {
470 char insert[] = "INSERT INTO `Media` "
471 "(`DiskId`, `LastSequence`, `DiskPrompt`, `Cabinet`, `VolumeLabel`, `Source`) "
472 "VALUES( %s )";
473 char *query;
474 UINT sz, r;
475
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;
482 }
483
484 static UINT add_ccpsearch_entry( MSIHANDLE hdb, const char *values )
485 {
486 char insert[] = "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )";
487 char *query;
488 UINT sz, r;
489
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;
496 }
497
498 static UINT add_drlocator_entry( MSIHANDLE hdb, const char *values )
499 {
500 char insert[] = "INSERT INTO `DrLocator` "
501 "(`Signature_`, `Parent`, `Path`, `Depth`) "
502 "VALUES( %s )";
503 char *query;
504 UINT sz, r;
505
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;
512 }
513
514 static UINT add_complocator_entry( MSIHANDLE hdb, const char *values )
515 {
516 char insert[] = "INSERT INTO `CompLocator` "
517 "(`Signature_`, `ComponentId`, `Type`) "
518 "VALUES( %s )";
519 char *query;
520 UINT sz, r;
521
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;
528 }
529
530 static UINT set_summary_info(MSIHANDLE hdb)
531 {
532 UINT res;
533 MSIHANDLE suminfo;
534
535 /* build summary info */
536 res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
537 ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
538
539 res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
540 "Installation Database");
541 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
542
543 res = MsiSummaryInfoSetProperty(suminfo,3, VT_LPSTR, 0,NULL,
544 "Installation Database");
545 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
546
547 res = MsiSummaryInfoSetProperty(suminfo,4, VT_LPSTR, 0,NULL,
548 "Wine Hackers");
549 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
550
551 res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
552 ";1033");
553 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
554
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" );
558
559 res = MsiSummaryInfoSetProperty(suminfo, 14, VT_I4, 100, NULL, NULL);
560 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
561
562 res = MsiSummaryInfoSetProperty(suminfo, 15, VT_I4, 0, NULL, NULL);
563 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
564
565 res = MsiSummaryInfoPersist(suminfo);
566 ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
567
568 res = MsiCloseHandle( suminfo);
569 ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
570
571 return res;
572 }
573
574
575 static MSIHANDLE create_package_db(void)
576 {
577 MSIHANDLE hdb = 0;
578 UINT res;
579
580 DeleteFile(msifile);
581
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;
587
588 res = MsiDatabaseCommit( hdb );
589 ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
590
591 res = set_summary_info(hdb);
592
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" );
600
601 return hdb;
602 }
603
604 static MSIHANDLE package_from_db(MSIHANDLE hdb)
605 {
606 UINT res;
607 CHAR szPackage[10];
608 MSIHANDLE hPackage;
609
610 sprintf(szPackage,"#%li",hdb);
611 res = MsiOpenPackage(szPackage,&hPackage);
612 if (res != ERROR_SUCCESS)
613 return 0;
614
615 res = MsiCloseHandle(hdb);
616 if (res != ERROR_SUCCESS)
617 return 0;
618
619 return hPackage;
620 }
621
622 static void create_test_file(const CHAR *name)
623 {
624 HANDLE file;
625 DWORD written;
626
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);
632 }
633
634 static void test_createpackage(void)
635 {
636 MSIHANDLE hPackage = 0;
637 UINT res;
638
639 hPackage = package_from_db(create_package_db());
640 ok( hPackage != 0, " Failed to create package\n");
641
642 res = MsiCloseHandle( hPackage);
643 ok( res == ERROR_SUCCESS , "Failed to close package\n" );
644 DeleteFile(msifile);
645 }
646
647 static void test_getsourcepath_bad( void )
648 {
649 static const char str[] = { 0 };
650 char buffer[0x80];
651 DWORD sz;
652 UINT r;
653
654 r = MsiGetSourcePath( -1, NULL, NULL, NULL );
655 ok( r == ERROR_INVALID_PARAMETER, "return value wrong\n");
656
657 sz = 0;
658 r = MsiGetSourcePath( -1, NULL, buffer, &sz );
659 ok( r == ERROR_INVALID_PARAMETER, "return value wrong\n");
660
661 sz = 0;
662 r = MsiGetSourcePath( -1, str, NULL, &sz );
663 ok( r == ERROR_INVALID_HANDLE, "return value wrong\n");
664
665 sz = 0;
666 r = MsiGetSourcePath( -1, str, NULL, NULL );
667 ok( r == ERROR_INVALID_HANDLE, "return value wrong\n");
668
669 sz = 0;
670 r = MsiGetSourcePath( -1, str, buffer, &sz );
671 ok( r == ERROR_INVALID_HANDLE, "return value wrong\n");
672 }
673
674 static UINT add_directory_entry( MSIHANDLE hdb, const char *values )
675 {
676 char insert[] = "INSERT INTO `Directory` (`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )";
677 char *query;
678 UINT sz, r;
679
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;
686 }
687
688 static void test_getsourcepath( void )
689 {
690 static const char str[] = { 0 };
691 char buffer[0x80];
692 DWORD sz;
693 UINT r;
694 MSIHANDLE hpkg, hdb;
695
696 hpkg = package_from_db(create_package_db());
697 ok( hpkg, "failed to create package\n");
698
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");
704
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");
710
711 MsiCloseHandle( hpkg );
712
713
714 /* another test but try create a directory this time */
715 hdb = create_package_db();
716 ok( hdb, "failed to create database\n");
717
718 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
719 ok( r == S_OK, "failed\n");
720
721 hpkg = package_from_db(hdb);
722 ok( hpkg, "failed to create package\n");
723
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");
728
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");
733
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");
739
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");
745
746 r = MsiGetSourcePath( hpkg, "TARGETDIR", NULL, NULL );
747 ok( r == ERROR_SUCCESS, "return value wrong\n");
748
749 r = MsiGetSourcePath( hpkg, "TARGETDIR ", NULL, NULL );
750 ok( r == ERROR_DIRECTORY, "return value wrong\n");
751
752 r = MsiGetSourcePath( hpkg, "targetdir", NULL, NULL );
753 ok( r == ERROR_DIRECTORY, "return value wrong\n");
754
755 r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, NULL );
756 ok( r == ERROR_INVALID_PARAMETER, "return value wrong\n");
757
758 r = MsiGetSourcePath( hpkg, "TARGETDIR", NULL, &sz );
759 ok( r == ERROR_SUCCESS, "return value wrong\n");
760
761 MsiCloseHandle( hpkg );
762 DeleteFile(msifile);
763 }
764
765 static void test_doaction( void )
766 {
767 MSIHANDLE hpkg;
768 UINT r;
769
770 r = MsiDoAction( -1, NULL );
771 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
772
773 hpkg = package_from_db(create_package_db());
774 ok( hpkg, "failed to create package\n");
775
776 r = MsiDoAction(hpkg, NULL);
777 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
778
779 r = MsiDoAction(0, "boo");
780 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
781
782 r = MsiDoAction(hpkg, "boo");
783 ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
784
785 MsiCloseHandle( hpkg );
786 DeleteFile(msifile);
787 }
788
789 static void test_gettargetpath_bad(void)
790 {
791 char buffer[0x80];
792 MSIHANDLE hpkg;
793 DWORD sz;
794 UINT r;
795
796 hpkg = package_from_db(create_package_db());
797 ok( hpkg, "failed to create package\n");
798
799 r = MsiGetTargetPath( 0, NULL, NULL, NULL );
800 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
801
802 r = MsiGetTargetPath( 0, NULL, NULL, &sz );
803 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
804
805 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
806 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
807
808 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
809 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
810
811 r = MsiGetTargetPath( hpkg, "boo", NULL, NULL );
812 ok( r == ERROR_DIRECTORY, "wrong return val\n");
813
814 r = MsiGetTargetPath( hpkg, "boo", buffer, NULL );
815 ok( r == ERROR_DIRECTORY, "wrong return val\n");
816
817 MsiCloseHandle( hpkg );
818 DeleteFile(msifile);
819 }
820
821 static void query_file_path(MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
822 {
823 UINT r;
824 DWORD size;
825 MSIHANDLE rec;
826
827 rec = MsiCreateRecord( 1 );
828 ok(rec, "MsiCreate record failed\n");
829
830 r = MsiRecordSetString( rec, 0, file );
831 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
832
833 size = MAX_PATH;
834 r = MsiFormatRecord( hpkg, rec, buff, &size );
835 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
836
837 MsiCloseHandle( rec );
838 }
839
840 static void test_settargetpath(void)
841 {
842 char tempdir[MAX_PATH+8], buffer[MAX_PATH], file[MAX_PATH];
843 DWORD sz;
844 MSIHANDLE hpkg;
845 UINT r;
846 MSIHANDLE hdb;
847
848 hdb = create_package_db();
849 ok ( hdb, "failed to create package database\n" );
850
851 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
852 ok( r == S_OK, "failed to add directory entry: %d\n" , r );
853
854 r = create_component_table( hdb );
855 ok( r == S_OK, "cannot create Component table: %d\n", r );
856
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 );
859
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 );
862
863 r = create_feature_table( hdb );
864 ok( r == S_OK, "cannot create Feature table: %d\n", r );
865
866 r = add_feature_entry( hdb, "'TestFeature', '', '', '', 0, 1, '', 0" );
867 ok( r == ERROR_SUCCESS, "cannot add TestFeature to Feature table: %d\n", r );
868
869 r = create_feature_components_table( hdb );
870 ok( r == S_OK, "cannot create FeatureComponents table: %d\n", r );
871
872 r = add_feature_components_entry( hdb, "'TestFeature', 'RootComp'" );
873 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
874
875 r = add_feature_components_entry( hdb, "'TestFeature', 'TestComp'" );
876 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
877
878 add_directory_entry( hdb, "'TestParent', 'TARGETDIR', 'TestParent'" );
879 add_directory_entry( hdb, "'TestDir', 'TestParent', 'TestDir'" );
880
881 r = create_file_table( hdb );
882 ok( r == S_OK, "cannot create File table: %d\n", r );
883
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 );
886
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 );
889
890 hpkg = package_from_db( hdb );
891 ok( hpkg, "failed to create package\n");
892
893 r = MsiDoAction( hpkg, "CostInitialize");
894 ok( r == ERROR_SUCCESS, "cost init failed\n");
895
896 r = MsiDoAction( hpkg, "FileCost");
897 ok( r == ERROR_SUCCESS, "file cost failed\n");
898
899 r = MsiDoAction( hpkg, "CostFinalize");
900 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
901
902 r = MsiSetTargetPath( 0, NULL, NULL );
903 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
904
905 r = MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
906 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
907
908 r = MsiSetTargetPath( hpkg, "boo", NULL );
909 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
910
911 r = MsiSetTargetPath( hpkg, "boo", "c:\\bogusx" );
912 ok( r == ERROR_DIRECTORY, "wrong return val\n");
913
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 );
920
921 GetTempFileName( tempdir, "_wt", 0, buffer );
922 sprintf( tempdir, "%s\\subdir", buffer );
923
924 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
925 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
926 "MsiSetTargetPath on file returned %d\n", r );
927
928 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
929 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
930 "MsiSetTargetPath on 'subdir' of file returned %d\n", r );
931
932 DeleteFile( buffer );
933
934 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
935 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
936
937 r = GetFileAttributes( buffer );
938 ok ( r == INVALID_FILE_ATTRIBUTES, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r );
939
940 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
941 ok( r == ERROR_SUCCESS, "MsiSetTargetPath on subsubdir returned %d\n", r );
942
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);
948
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);
952
953 r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two" );
954 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
955
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 );
959
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);
964
965 MsiCloseHandle( hpkg );
966 }
967
968 static void test_condition(void)
969 {
970 MSICONDITION r;
971 MSIHANDLE hpkg;
972
973 hpkg = package_from_db(create_package_db());
974 ok( hpkg, "failed to create package\n");
975
976 r = MsiEvaluateCondition(0, NULL);
977 ok( r == MSICONDITION_ERROR, "wrong return val\n");
978
979 r = MsiEvaluateCondition(hpkg, NULL);
980 ok( r == MSICONDITION_NONE, "wrong return val\n");
981
982 r = MsiEvaluateCondition(hpkg, "");
983 ok( r == MSICONDITION_NONE, "wrong return val\n");
984
985 r = MsiEvaluateCondition(hpkg, "1");
986 ok( r == MSICONDITION_TRUE, "wrong return val\n");
987
988 r = MsiEvaluateCondition(hpkg, "0");
989 ok( r == MSICONDITION_FALSE, "wrong return val\n");
990
991 r = MsiEvaluateCondition(hpkg, "-1");
992 ok( r == MSICONDITION_TRUE, "wrong return val\n");
993
994 r = MsiEvaluateCondition(hpkg, "0 = 0");
995 ok( r == MSICONDITION_TRUE, "wrong return val\n");
996
997 r = MsiEvaluateCondition(hpkg, "0 <> 0");
998 ok( r == MSICONDITION_FALSE, "wrong return val\n");
999
1000 r = MsiEvaluateCondition(hpkg, "0 = 1");
1001 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1002
1003 r = MsiEvaluateCondition(hpkg, "0 > 1");
1004 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1005
1006 r = MsiEvaluateCondition(hpkg, "0 ~> 1");
1007 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1008
1009 r = MsiEvaluateCondition(hpkg, "1 > 1");
1010 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1011
1012 r = MsiEvaluateCondition(hpkg, "1 ~> 1");
1013 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1014
1015 r = MsiEvaluateCondition(hpkg, "0 >= 1");
1016 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1017
1018 r = MsiEvaluateCondition(hpkg, "0 ~>= 1");
1019 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1020
1021 r = MsiEvaluateCondition(hpkg, "1 >= 1");
1022 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1023
1024 r = MsiEvaluateCondition(hpkg, "1 ~>= 1");
1025 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1026
1027 r = MsiEvaluateCondition(hpkg, "0 < 1");
1028 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1029
1030 r = MsiEvaluateCondition(hpkg, "0 ~< 1");
1031 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1032
1033 r = MsiEvaluateCondition(hpkg, "1 < 1");
1034 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1035
1036 r = MsiEvaluateCondition(hpkg, "1 ~< 1");
1037 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1038
1039 r = MsiEvaluateCondition(hpkg, "0 <= 1");
1040 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1041
1042 r = MsiEvaluateCondition(hpkg, "0 ~<= 1");
1043 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1044
1045 r = MsiEvaluateCondition(hpkg, "1 <= 1");
1046 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1047
1048 r = MsiEvaluateCondition(hpkg, "1 ~<= 1");
1049 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1050
1051 r = MsiEvaluateCondition(hpkg, "0 >=");
1052 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1053
1054 r = MsiEvaluateCondition(hpkg, " ");
1055 ok( r == MSICONDITION_NONE, "wrong return val\n");
1056
1057 r = MsiEvaluateCondition(hpkg, "LicView <> \"1\"");
1058 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1059
1060 r = MsiEvaluateCondition(hpkg, "LicView <> \"0\"");
1061 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1062
1063 r = MsiEvaluateCondition(hpkg, "LicView <> LicView");
1064 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1065
1066 r = MsiEvaluateCondition(hpkg, "not 0");
1067 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1068
1069 r = MsiEvaluateCondition(hpkg, "not LicView");
1070 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1071
1072 r = MsiEvaluateCondition(hpkg, "not \"A\"");
1073 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1074
1075 r = MsiEvaluateCondition(hpkg, "~not \"A\"");
1076 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1077
1078 r = MsiEvaluateCondition(hpkg, "\"0\"");
1079 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1080
1081 r = MsiEvaluateCondition(hpkg, "1 and 2");
1082 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1083
1084 r = MsiEvaluateCondition(hpkg, "not 0 and 3");
1085 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1086
1087 r = MsiEvaluateCondition(hpkg, "not 0 and 0");
1088 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1089
1090 r = MsiEvaluateCondition(hpkg, "not 0 or 1");
1091 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1092
1093 r = MsiEvaluateCondition(hpkg, "(0)");
1094 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1095
1096 r = MsiEvaluateCondition(hpkg, "(((((1))))))");
1097 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1098
1099 r = MsiEvaluateCondition(hpkg, "(((((1)))))");
1100 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1101
1102 r = MsiEvaluateCondition(hpkg, " \"A\" < \"B\" ");
1103 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1104
1105 r = MsiEvaluateCondition(hpkg, " \"A\" > \"B\" ");
1106 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1107
1108 r = MsiEvaluateCondition(hpkg, " \"1\" > \"12\" ");
1109 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1110
1111 r = MsiEvaluateCondition(hpkg, " \"100\" < \"21\" ");
1112 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1113
1114 r = MsiEvaluateCondition(hpkg, "0 < > 0");
1115 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1116
1117 r = MsiEvaluateCondition(hpkg, "(1<<1) == 2");
1118 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1119
1120 r = MsiEvaluateCondition(hpkg, " \"A\" = \"a\" ");
1121 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1122
1123 r = MsiEvaluateCondition(hpkg, " \"A\" ~ = \"a\" ");
1124 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1125
1126 r = MsiEvaluateCondition(hpkg, " \"A\" ~= \"a\" ");
1127 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1128
1129 r = MsiEvaluateCondition(hpkg, " \"A\" ~= 1 ");
1130 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1131
1132 r = MsiEvaluateCondition(hpkg, " \"A\" = 1 ");
1133 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1134
1135 r = MsiEvaluateCondition(hpkg, " 1 ~= 1 ");
1136 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1137
1138 r = MsiEvaluateCondition(hpkg, " 1 ~= \"1\" ");
1139 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1140
1141 r = MsiEvaluateCondition(hpkg, " 1 = \"1\" ");
1142 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1143
1144 r = MsiEvaluateCondition(hpkg, " 0 = \"1\" ");
1145 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1146
1147 r = MsiEvaluateCondition(hpkg, " 0 < \"100\" ");
1148 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1149
1150 r = MsiEvaluateCondition(hpkg, " 100 > \"0\" ");
1151 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1152
1153 r = MsiEvaluateCondition(hpkg, "1 XOR 1");
1154 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1155
1156 r = MsiEvaluateCondition(hpkg, "1 IMP 1");
1157 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1158
1159 r = MsiEvaluateCondition(hpkg, "1 IMP 0");
1160 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1161
1162 r = MsiEvaluateCondition(hpkg, "0 IMP 0");
1163 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1164
1165 r = MsiEvaluateCondition(hpkg, "0 EQV 0");
1166 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1167
1168 r = MsiEvaluateCondition(hpkg, "0 EQV 1");
1169 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1170
1171 r = MsiEvaluateCondition(hpkg, "1 IMP 1 OR 0");
1172 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1173
1174 r = MsiEvaluateCondition(hpkg, "1 IMPL 1");
1175 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1176
1177 r = MsiEvaluateCondition(hpkg, "\"ASFD\" >< \"S\" ");
1178 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1179
1180 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"s\" ");
1181 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1182
1183 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"\" ");
1184 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1185
1186 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"sss\" ");
1187 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1188
1189 MsiSetProperty(hpkg, "mm", "5" );
1190
1191 r = MsiEvaluateCondition(hpkg, "mm = 5");
1192 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1193
1194 r = MsiEvaluateCondition(hpkg, "mm < 6");
1195 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1196
1197 r = MsiEvaluateCondition(hpkg, "mm <= 5");
1198 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1199
1200 r = MsiEvaluateCondition(hpkg, "mm > 4");
1201 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1202
1203 r = MsiEvaluateCondition(hpkg, "mm < 12");
1204 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1205
1206 r = MsiEvaluateCondition(hpkg, "mm = \"5\"");
1207 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1208
1209 r = MsiEvaluateCondition(hpkg, "0 = \"\"");
1210 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1211
1212 r = MsiEvaluateCondition(hpkg, "0 AND \"\"");
1213 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1214
1215 r = MsiEvaluateCondition(hpkg, "1 AND \"\"");
1216 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1217
1218 r = MsiEvaluateCondition(hpkg, "1 AND \"1\"");
1219 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1220
1221 r = MsiEvaluateCondition(hpkg, "3 >< 1");
1222 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1223
1224 r = MsiEvaluateCondition(hpkg, "3 >< 4");
1225 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1226
1227 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 0");
1228 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1229
1230 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1");
1231 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1232
1233 r = MsiEvaluateCondition(hpkg, "NOT 1 OR 0");
1234 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1235
1236 r = MsiEvaluateCondition(hpkg, "0 AND 1 OR 1");
1237 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1238
1239 r = MsiEvaluateCondition(hpkg, "0 AND 0 OR 1");
1240 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1241
1242 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1 OR 0");
1243 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1244
1245 r = MsiEvaluateCondition(hpkg, "_1 = _1");
1246 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1247
1248 r = MsiEvaluateCondition(hpkg, "( 1 AND 1 ) = 2");
1249 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1250
1251 r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
1252 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1253
1254 r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1255 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1256
1257 r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
1258 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1259
1260 r = MsiEvaluateCondition(hpkg, "NOT 1 AND 0");
1261 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1262
1263 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1264 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1265
1266 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1267 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1268
1269 r = MsiEvaluateCondition(hpkg, "bandalmael<0");
1270 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1271
1272 r = MsiEvaluateCondition(hpkg, "bandalmael>0");
1273 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1274
1275 r = MsiEvaluateCondition(hpkg, "bandalmael>=0");
1276 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1277
1278 r = MsiEvaluateCondition(hpkg, "bandalmael<=0");
1279 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1280
1281 r = MsiEvaluateCondition(hpkg, "bandalmael~<>0");
1282 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1283
1284 MsiSetProperty(hpkg, "bandalmael", "0" );
1285 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1286 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1287
1288 MsiSetProperty(hpkg, "bandalmael", "" );
1289 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1290 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1291
1292 MsiSetProperty(hpkg, "bandalmael", "asdf" );
1293 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1294 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1295
1296 MsiSetProperty(hpkg, "bandalmael", "0asdf" );
1297 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1298 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1299
1300 MsiSetProperty(hpkg, "bandalmael", "0 " );
1301 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1302 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1303
1304 MsiSetProperty(hpkg, "bandalmael", "-0" );
1305 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1306 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1307
1308 MsiSetProperty(hpkg, "bandalmael", "0000000000000" );
1309 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1310 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1311
1312 MsiSetProperty(hpkg, "bandalmael", "--0" );
1313 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1314 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1315
1316 MsiSetProperty(hpkg, "bandalmael", "0x00" );
1317 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1318 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1319
1320 MsiSetProperty(hpkg, "bandalmael", "-" );
1321 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1322 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1323
1324 MsiSetProperty(hpkg, "bandalmael", "+0" );
1325 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1326 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1327
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");
1333
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");
1338
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");
1343
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");
1348
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");
1353
1354 MsiSetProperty(hpkg, "one", "");
1355 MsiSetProperty(hpkg, "two", "hi");
1356 r = MsiEvaluateCondition(hpkg, "one >< two");
1357 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1358
1359 MsiSetProperty(hpkg, "one", "hi");
1360 MsiSetProperty(hpkg, "two", "");
1361 r = MsiEvaluateCondition(hpkg, "one >< two");
1362 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1363
1364 MsiSetProperty(hpkg, "one", "");
1365 MsiSetProperty(hpkg, "two", "");
1366 r = MsiEvaluateCondition(hpkg, "one >< two");
1367 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1368
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");
1373
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");
1378
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");
1383
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");
1388
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");
1393
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");
1398
1399 MsiSetProperty(hpkg, "one", "");
1400 MsiSetProperty(hpkg, "two", "hi");
1401 r = MsiEvaluateCondition(hpkg, "one << two");
1402 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1403
1404 MsiSetProperty(hpkg, "one", "hithere");
1405 MsiSetProperty(hpkg, "two", "");
1406 r = MsiEvaluateCondition(hpkg, "one << two");
1407 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1408
1409 MsiSetProperty(hpkg, "one", "");
1410 MsiSetProperty(hpkg, "two", "");
1411 r = MsiEvaluateCondition(hpkg, "one << two");
1412 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1413
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");
1418
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");
1423
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");
1428
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");
1433
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");
1438
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");
1443
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");
1448
1449 MsiSetProperty(hpkg, "one", "");
1450 MsiSetProperty(hpkg, "two", "there");
1451 r = MsiEvaluateCondition(hpkg, "one >> two");
1452 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1453
1454 MsiSetProperty(hpkg, "one", "there");
1455 MsiSetProperty(hpkg, "two", "");
1456 r = MsiEvaluateCondition(hpkg, "one >> two");
1457 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1458
1459 MsiSetProperty(hpkg, "one", "");
1460 MsiSetProperty(hpkg, "two", "");
1461 r = MsiEvaluateCondition(hpkg, "one >> two");
1462 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1463
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");
1468
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");
1473
1474 MsiSetProperty(hpkg, "MsiNetAssemblySupport", NULL); /* make sure it's empty */
1475
1476 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1477 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1478
1479 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport > \"1.1.4322\"");
1480 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1481
1482 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport >= \"1.1.4322\"");
1483 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1484
1485 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <= \"1.1.4322\"");
1486 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1487
1488 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <> \"1.1.4322\"");
1489 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1490
1491 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1492 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1493
1494 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"abcd\"");
1495 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1496
1497 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a1.1.4322\"");
1498 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1499
1500 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322a\"");
1501 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1502
1503 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1504 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1505
1506 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1507 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1508
1509 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1510 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1511
1512 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1");
1513 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1514
1515 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1\"");
1516 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1517
1518 r = MsiEvaluateCondition(hpkg, "\"2\" < \"12.1\"");
1519 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1520
1521 r = MsiEvaluateCondition(hpkg, "\"02.1\" < \"2.11\"");
1522 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1523
1524 r = MsiEvaluateCondition(hpkg, "\"02.1.1\" < \"2.1\"");
1525 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1526
1527 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1528 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1529
1530 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1531 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1532
1533 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0\"");
1534 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1535
1536 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"-1\"");
1537 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1538
1539 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a\"");
1540 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1541
1542 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1543 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1544
1545 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1546 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1547
1548 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"/\"");
1549 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1550
1551 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \" \"");
1552 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1553
1554 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"azAZ_\"");
1555 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1556
1557 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]\"");
1558 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1559
1560 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]a\"");
1561 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1562
1563 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]\"");
1564 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1565
1566 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]a\"");
1567 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1568
1569 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a}\"");
1570 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1571
1572 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a\"");
1573 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1574
1575 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a\"");
1576 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1577
1578 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a{\"");
1579 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1580
1581 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a]\"");
1582 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1583
1584 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"A\"");
1585 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1586
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);
1590
1591 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.14322\"");
1592 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1593
1594 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.5\"");
1595 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1596
1597 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1598 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1599
1600 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1601 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1602
1603 MsiSetProperty(hpkg, "one", "1");
1604 r = MsiEvaluateCondition(hpkg, "one < \"1\"");
1605 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1606
1607 MsiSetProperty(hpkg, "X", "5.0");
1608
1609 r = MsiEvaluateCondition(hpkg, "X != \"\"");
1610 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1611
1612 r = MsiEvaluateCondition(hpkg, "X =\"5.0\"");
1613 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1614
1615 r = MsiEvaluateCondition(hpkg, "X =\"5.1\"");
1616 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1617
1618 r = MsiEvaluateCondition(hpkg, "X =\"6.0\"");
1619 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1620
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);
1623
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);
1626
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);
1629
1630 /* feature doesn't exist */
1631 r = MsiEvaluateCondition(hpkg, "&nofeature");
1632 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1633
1634 MsiSetProperty(hpkg, "A", "2");
1635 MsiSetProperty(hpkg, "X", "50");
1636
1637 r = MsiEvaluateCondition(hpkg, "2 <= X");
1638 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1639
1640 r = MsiEvaluateCondition(hpkg, "A <= X");
1641 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1642
1643 r = MsiEvaluateCondition(hpkg, "A <= 50");
1644 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1645
1646 MsiSetProperty(hpkg, "X", "50val");
1647
1648 r = MsiEvaluateCondition(hpkg, "2 <= X");
1649 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1650
1651 r = MsiEvaluateCondition(hpkg, "A <= X");
1652 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1653
1654 MsiSetProperty(hpkg, "A", "7");
1655 MsiSetProperty(hpkg, "X", "50");
1656
1657 r = MsiEvaluateCondition(hpkg, "7 <= X");
1658 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1659
1660 r = MsiEvaluateCondition(hpkg, "A <= X");
1661 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1662
1663 r = MsiEvaluateCondition(hpkg, "A <= 50");
1664 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1665
1666 MsiSetProperty(hpkg, "X", "50val");
1667
1668 r = MsiEvaluateCondition(hpkg, "2 <= X");
1669 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1670
1671 r = MsiEvaluateCondition(hpkg, "A <= X");
1672 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1673
1674 MsiCloseHandle( hpkg );
1675 DeleteFile(msifile);
1676 }
1677
1678 static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop)
1679 {
1680 UINT r;
1681 DWORD sz;
1682 char buffer[2];
1683
1684 sz = sizeof buffer;
1685 strcpy(buffer,"x");
1686 r = MsiGetProperty( hpkg, prop, buffer, &sz );
1687 return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
1688 }
1689
1690 static void test_props(void)
1691 {
1692 MSIHANDLE hpkg, hdb;
1693 UINT r;
1694 DWORD sz;
1695 char buffer[0x100];
1696
1697 hdb = create_package_db();
1698 r = run_query( hdb,
1699 "CREATE TABLE `Property` ( "
1700 "`Property` CHAR(255) NOT NULL, "
1701 "`Value` CHAR(255) "
1702 "PRIMARY KEY `Property`)" );
1703 ok( r == ERROR_SUCCESS , "Failed\n" );
1704
1705 r = run_query(hdb,
1706 "INSERT INTO `Property` "
1707 "(`Property`, `Value`) "
1708 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1709 ok( r == ERROR_SUCCESS , "Failed\n" );
1710
1711 hpkg = package_from_db( hdb );
1712 ok( hpkg, "failed to create package\n");
1713
1714 /* test invalid values */
1715 r = MsiGetProperty( 0, NULL, NULL, NULL );
1716 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1717
1718 r = MsiGetProperty( hpkg, NULL, NULL, NULL );
1719 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1720
1721 r = MsiGetProperty( hpkg, "boo", NULL, NULL );
1722 ok( r == ERROR_SUCCESS, "wrong return val\n");
1723
1724 r = MsiGetProperty( hpkg, "boo", buffer, NULL );
1725 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1726
1727 /* test retrieving an empty/nonexistent property */
1728 sz = sizeof buffer;
1729 r = MsiGetProperty( hpkg, "boo", NULL, &sz );
1730 ok( r == ERROR_SUCCESS, "wrong return val\n");
1731 ok( sz == 0, "wrong size returned\n");
1732
1733 check_prop_empty( hpkg, "boo");
1734 sz = 0;
1735 strcpy(buffer,"x");
1736 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1737 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1738 ok( !strcmp(buffer,"x"), "buffer was changed\n");
1739 ok( sz == 0, "wrong size returned\n");
1740
1741 sz = 1;
1742 strcpy(buffer,"x");
1743 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1744 ok( r == ERROR_SUCCESS, "wrong return val\n");
1745 ok( buffer[0] == 0, "buffer was not changed\n");
1746 ok( sz == 0, "wrong size returned\n");
1747
1748 /* set the property to something */
1749 r = MsiSetProperty( 0, NULL, NULL );
1750 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1751
1752 r = MsiSetProperty( hpkg, NULL, NULL );
1753 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1754
1755 r = MsiSetProperty( hpkg, "", NULL );
1756 ok( r == ERROR_SUCCESS, "wrong return val\n");
1757
1758 /* try set and get some illegal property identifiers */
1759 r = MsiSetProperty( hpkg, "", "asdf" );
1760 ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n");
1761
1762 r = MsiSetProperty( hpkg, "=", "asdf" );
1763 ok( r == ERROR_SUCCESS, "wrong return val\n");
1764
1765 r = MsiSetProperty( hpkg, " ", "asdf" );
1766 ok( r == ERROR_SUCCESS, "wrong return val\n");
1767
1768 r = MsiSetProperty( hpkg, "'", "asdf" );
1769 ok( r == ERROR_SUCCESS, "wrong return val\n");
1770
1771 sz = sizeof buffer;
1772 buffer[0]=0;
1773 r = MsiGetProperty( hpkg, "'", buffer, &sz );
1774 ok( r == ERROR_SUCCESS, "wrong return val\n");
1775 ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
1776
1777 /* set empty values */
1778 r = MsiSetProperty( hpkg, "boo", NULL );
1779 ok( r == ERROR_SUCCESS, "wrong return val\n");
1780 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1781
1782 r = MsiSetProperty( hpkg, "boo", "" );
1783 ok( r == ERROR_SUCCESS, "wrong return val\n");
1784 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1785
1786 /* set a non-empty value */
1787 r = MsiSetProperty( hpkg, "boo", "xyz" );
1788 ok( r == ERROR_SUCCESS, "wrong return val\n");
1789
1790 sz = 1;
1791 strcpy(buffer,"x");
1792 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1793 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1794 ok( buffer[0] == 0, "buffer was not changed\n");
1795 ok( sz == 3, "wrong size returned\n");
1796
1797 sz = 4;
1798 strcpy(buffer,"x");
1799 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1800 ok( r == ERROR_SUCCESS, "wrong return val\n");
1801 ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
1802 ok( sz == 3, "wrong size returned\n");
1803
1804 sz = 3;
1805 strcpy(buffer,"x");
1806 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1807 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1808 ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
1809 ok( sz == 3, "wrong size returned\n");
1810
1811 r = MsiSetProperty(hpkg, "SourceDir", "foo");
1812 ok( r == ERROR_SUCCESS, "wrong return val\n");
1813
1814 sz = 4;
1815 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
1816 ok( r == ERROR_SUCCESS, "wrong return val\n");
1817 ok( !strcmp(buffer,""), "buffer wrong\n");
1818 ok( sz == 0, "wrong size returned\n");
1819
1820 sz = 4;
1821 r = MsiGetProperty(hpkg, "SOMERANDOMNAME", buffer, &sz);
1822 ok( r == ERROR_SUCCESS, "wrong return val\n");
1823 ok( !strcmp(buffer,""), "buffer wrong\n");
1824 ok( sz == 0, "wrong size returned\n");
1825
1826 sz = 4;
1827 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
1828 ok( r == ERROR_SUCCESS, "wrong return val\n");
1829 ok( !strcmp(buffer,"foo"), "buffer wrong\n");
1830 ok( sz == 3, "wrong size returned\n");
1831
1832 r = MsiSetProperty(hpkg, "MetadataCompName", "Photoshop.dll");
1833 ok( r == ERROR_SUCCESS, "wrong return val\n");
1834
1835 sz = 0;
1836 r = MsiGetProperty(hpkg, "MetadataCompName", NULL, &sz );
1837 ok( r == ERROR_SUCCESS, "return wrong\n");
1838 ok( sz == 13, "size wrong (%d)\n", sz);
1839
1840 sz = 13;
1841 r = MsiGetProperty(hpkg, "MetadataCompName", buffer, &sz );
1842 ok( r == ERROR_MORE_DATA, "return wrong\n");
1843 ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n");
1844
1845 r = MsiSetProperty(hpkg, "property", "value");
1846 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1847
1848 sz = 6;
1849 r = MsiGetProperty(hpkg, "property", buffer, &sz);
1850 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1851 ok( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer);
1852
1853 r = MsiSetProperty(hpkg, "property", NULL);
1854 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1855
1856 sz = 6;
1857 r = MsiGetProperty(hpkg, "property", buffer, &sz);
1858 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1859 ok( !strlen(buffer), "Expected empty string, got %s\n", buffer);
1860
1861 MsiCloseHandle( hpkg );
1862 DeleteFile(msifile);
1863 }
1864
1865 static BOOL find_prop_in_property(MSIHANDLE hdb, LPCSTR prop, LPCSTR val)
1866 {
1867 MSIHANDLE hview, hrec;
1868 BOOL found;
1869 CHAR buffer[MAX_PATH];
1870 DWORD sz;
1871 UINT r;
1872
1873 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
1874 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
1875 r = MsiViewExecute(hview, 0);
1876 ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
1877
1878 found = FALSE;
1879 while (r == ERROR_SUCCESS && !found)
1880 {
1881 r = MsiViewFetch(hview, &hrec);
1882 if (r != ERROR_SUCCESS) break;
1883
1884 sz = MAX_PATH;
1885 r = MsiRecordGetString(hrec, 1, buffer, &sz);
1886 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
1887 {
1888 sz = MAX_PATH;
1889 r = MsiRecordGetString(hrec, 2, buffer, &sz);
1890 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, val))
1891 found = TRUE;
1892 }
1893
1894 MsiCloseHandle(hrec);
1895 }
1896
1897 MsiViewClose(hview);
1898 MsiCloseHandle(hview);
1899
1900 return found;
1901 }
1902
1903 static void test_property_table(void)
1904 {
1905 const char *query;
1906 UINT r;
1907 MSIHANDLE hpkg, hdb, hrec;
1908 char buffer[MAX_PATH];
1909 DWORD sz;
1910 BOOL found;
1911
1912 hdb = create_package_db();
1913 ok( hdb, "failed to create package\n");
1914
1915 hpkg = package_from_db(hdb);
1916 ok( hpkg, "failed to create package\n");
1917
1918 MsiCloseHandle(hdb);
1919
1920 hdb = MsiGetActiveDatabase(hpkg);
1921
1922 query = "CREATE TABLE `_Property` ( "
1923 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1924 r = run_query(hdb, query);
1925 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
1926
1927 MsiCloseHandle(hdb);
1928 MsiCloseHandle(hpkg);
1929 DeleteFile(msifile);
1930
1931 hdb = create_package_db();
1932 ok( hdb, "failed to create package\n");
1933
1934 query = "CREATE TABLE `_Property` ( "
1935 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1936 r = run_query(hdb, query);
1937 ok(r == ERROR_SUCCESS, "failed to create table\n");
1938
1939 query = "ALTER `_Property` ADD `foo` INTEGER";
1940 r = run_query(hdb, query);
1941 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
1942
1943 query = "ALTER TABLE `_Property` ADD `foo` INTEGER";
1944 r = run_query(hdb, query);
1945 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
1946
1947 query = "ALTER TABLE `_Property` ADD `extra` INTEGER";
1948 r = run_query(hdb, query);
1949 ok(r == ERROR_SUCCESS, "failed to add column\n");
1950
1951 hpkg = package_from_db(hdb);
1952 todo_wine
1953 {
1954 ok(!hpkg, "package should not be created\n");
1955 }
1956
1957 MsiCloseHandle(hdb);
1958 MsiCloseHandle(hpkg);
1959 DeleteFile(msifile);
1960
1961 hdb = create_package_db();
1962 ok (hdb, "failed to create package database\n");
1963
1964 r = create_property_table(hdb);
1965 ok(r == ERROR_SUCCESS, "cannot create Property table: %d\n", r);
1966
1967 r = add_property_entry(hdb, "'prop', 'val'");
1968 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
1969
1970 hpkg = package_from_db(hdb);
1971 ok(hpkg, "failed to create package\n");
1972
1973 MsiCloseHandle(hdb);
1974
1975 sz = MAX_PATH;
1976 r = MsiGetProperty(hpkg, "prop", buffer, &sz);
1977 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1978 ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
1979
1980 hdb = MsiGetActiveDatabase(hpkg);
1981
1982 found = find_prop_in_property(hdb, "prop", "val");
1983 ok(found, "prop should be in the _Property table\n");
1984
1985 r = add_property_entry(hdb, "'dantes', 'mercedes'");
1986 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
1987
1988 query = "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
1989 r = do_query(hdb, query, &hrec);
1990 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
1991
1992 found = find_prop_in_property(hdb, "dantes", "mercedes");
1993 ok(found == FALSE, "dantes should not be in the _Property table\n");
1994
1995 sz = MAX_PATH;
1996 lstrcpy(buffer, "aaa");
1997 r = MsiGetProperty(hpkg, "dantes", buffer, &sz);
1998 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1999 ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer);
2000
2001 r = MsiSetProperty(hpkg, "dantes", "mercedes");
2002 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2003
2004 found = find_prop_in_property(hdb, "dantes", "mercedes");
2005 ok(found == TRUE, "dantes should be in the _Property table\n");
2006
2007 MsiCloseHandle(hdb);
2008 MsiCloseHandle(hpkg);
2009 DeleteFile(msifile);
2010 }
2011
2012 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
2013 {
2014 MSIHANDLE htab = 0;
2015 UINT res;
2016
2017 res = MsiDatabaseOpenView( hdb, szQuery, &htab );
2018 if( res == ERROR_SUCCESS )
2019 {
2020 UINT r;
2021
2022 r = MsiViewExecute( htab, hrec );
2023 if( r != ERROR_SUCCESS )
2024 {
2025 res = r;
2026 fprintf(stderr,"MsiViewExecute failed %08x\n", res);
2027 }
2028
2029 r = MsiViewClose( htab );
2030 if( r != ERROR_SUCCESS )
2031 res = r;
2032
2033 r = MsiCloseHandle( htab );
2034 if( r != ERROR_SUCCESS )
2035 res = r;
2036 }
2037 return res;
2038 }
2039
2040 static UINT try_query( MSIHANDLE hdb, LPCSTR szQuery )
2041 {
2042 return try_query_param( hdb, szQuery, 0 );
2043 }
2044
2045 static void set_summary_str(MSIHANDLE hdb, DWORD pid, LPCSTR value)
2046 {
2047 MSIHANDLE summary;
2048 UINT r;
2049
2050 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2051 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2052
2053 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
2054 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2055
2056 r = MsiSummaryInfoPersist(summary);
2057 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2058
2059 MsiCloseHandle(summary);
2060 }
2061
2062 static void set_summary_dword(MSIHANDLE hdb, DWORD pid, DWORD value)
2063 {
2064 MSIHANDLE summary;
2065 UINT r;
2066
2067 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2068 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2069
2070 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_I4, value, NULL, NULL);
2071 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2072
2073 r = MsiSummaryInfoPersist(summary);
2074 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2075
2076 MsiCloseHandle(summary);
2077 }
2078
2079 static void test_msipackage(void)
2080 {
2081 MSIHANDLE hdb = 0, hpack = 100;
2082 UINT r;
2083 const char *query;
2084 char name[10];
2085
2086 /* NULL szPackagePath */
2087 r = MsiOpenPackage(NULL, &hpack);
2088 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2089
2090 /* empty szPackagePath */
2091 r = MsiOpenPackage("", &hpack);
2092 todo_wine
2093 {
2094 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2095 }
2096
2097 if (r == ERROR_SUCCESS)
2098 MsiCloseHandle(hpack);
2099
2100 /* nonexistent szPackagePath */
2101 r = MsiOpenPackage("nonexistent", &hpack);
2102 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2103
2104 /* NULL hProduct */
2105 r = MsiOpenPackage(msifile, NULL);
2106 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2107
2108 name[0]='#';
2109 name[1]=0;
2110 r = MsiOpenPackage(name, &hpack);
2111 ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r);
2112
2113 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2114 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2115
2116 /* database exists, but is emtpy */
2117 sprintf(name, "#%ld", hdb);
2118 r = MsiOpenPackage(name, &hpack);
2119 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2120 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2121
2122 query = "CREATE TABLE `Property` ( "
2123 "`Property` CHAR(72), `Value` CHAR(0) "
2124 "PRIMARY KEY `Property`)";
2125 r = try_query(hdb, query);
2126 ok(r == ERROR_SUCCESS, "failed to create Properties table\n");
2127
2128 query = "CREATE TABLE `InstallExecuteSequence` ("
2129 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2130 "PRIMARY KEY `Action`)";
2131 r = try_query(hdb, query);
2132 ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n");
2133
2134 /* a few key tables exist */
2135 sprintf(name, "#%ld", hdb);
2136 r = MsiOpenPackage(name, &hpack);
2137 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2138 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2139
2140 MsiCloseHandle(hdb);
2141 DeleteFile(msifile);
2142
2143 /* start with a clean database to show what constitutes a valid package */
2144 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2145 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2146
2147 sprintf(name, "#%ld", hdb);
2148
2149 /* The following summary information props must exist:
2150 * - PID_REVNUMBER
2151 * - PID_PAGECOUNT
2152 */
2153
2154 set_summary_dword(hdb, PID_PAGECOUNT, 100);
2155 r = MsiOpenPackage(name, &hpack);
2156 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2157 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2158
2159 set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2160 r = MsiOpenPackage(name, &hpack);
2161 ok(r == ERROR_SUCCESS,
2162 "Expected ERROR_SUCCESS, got %d\n", r);
2163
2164 MsiCloseHandle(hpack);
2165 MsiCloseHandle(hdb);
2166 DeleteFile(msifile);
2167 }
2168
2169 static void test_formatrecord2(void)
2170 {
2171 MSIHANDLE hpkg, hrec ;
2172 char buffer[0x100];
2173 DWORD sz;
2174 UINT r;
2175
2176 hpkg = package_from_db(create_package_db());
2177 ok( hpkg, "failed to create package\n");
2178
2179 r = MsiSetProperty(hpkg, "Manufacturer", " " );
2180 ok( r == ERROR_SUCCESS, "set property failed\n");
2181
2182 hrec = MsiCreateRecord(2);
2183 ok(hrec, "create record failed\n");
2184
2185 r = MsiRecordSetString( hrec, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2186 ok( r == ERROR_SUCCESS, "format record failed\n");
2187
2188 buffer[0] = 0;
2189 sz = sizeof buffer;
2190 r = MsiFormatRecord( hpkg, hrec, buffer, &sz );
2191
2192 r = MsiRecordSetString(hrec, 0, "[foo][1]");
2193 r = MsiRecordSetString(hrec, 1, "hoo");
2194 sz = sizeof buffer;
2195 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2196 ok( sz == 3, "size wrong\n");
2197 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2198 ok( r == ERROR_SUCCESS, "format failed\n");
2199
2200 r = MsiRecordSetString(hrec, 0, "x[~]x");
2201 sz = sizeof buffer;
2202 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2203 ok( sz == 3, "size wrong\n");
2204 ok( 0 == strcmp(buffer,"x"), "wrong output %s\n",buffer);
2205 ok( r == ERROR_SUCCESS, "format failed\n");
2206
2207 r = MsiRecordSetString(hrec, 0, "[foo.$%}][1]");
2208 r = MsiRecordSetString(hrec, 1, "hoo");
2209 sz = sizeof buffer;
2210 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2211 ok( sz == 3, "size wrong\n");
2212 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2213 ok( r == ERROR_SUCCESS, "format failed\n");
2214
2215 r = MsiRecordSetString(hrec, 0, "[\\[]");
2216 sz = sizeof buffer;
2217 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2218 ok( sz == 1, "size wrong\n");
2219 ok( 0 == strcmp(buffer,"["), "wrong output %s\n",buffer);
2220 ok( r == ERROR_SUCCESS, "format failed\n");
2221
2222 SetEnvironmentVariable("FOO", "BAR");
2223 r = MsiRecordSetString(hrec, 0, "[%FOO]");
2224 sz = sizeof buffer;
2225 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2226 ok( sz == 3, "size wrong\n");
2227 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2228 ok( r == ERROR_SUCCESS, "format failed\n");
2229
2230 r = MsiRecordSetString(hrec, 0, "[[1]]");
2231 r = MsiRecordSetString(hrec, 1, "%FOO");
2232 sz = sizeof buffer;
2233 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2234 ok( sz == 3, "size wrong\n");
2235 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2236 ok( r == ERROR_SUCCESS, "format failed\n");
2237
2238 MsiCloseHandle( hrec );
2239 MsiCloseHandle( hpkg );
2240 DeleteFile(msifile);
2241 }
2242
2243 /* FIXME: state is INSTALLSTATE_UNKNOWN if any features are removed and the
2244 * feature in question is not in ADD*
2245 */
2246 static void test_states(void)
2247 {
2248 MSIHANDLE hpkg;
2249 UINT r;
2250 MSIHANDLE hdb;
2251 INSTALLSTATE state, action;
2252
2253 hdb = create_package_db();
2254 ok ( hdb, "failed to create package database\n" );
2255
2256 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
2257 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
2258
2259 r = create_property_table( hdb );
2260 ok( r == ERROR_SUCCESS, "cannot create Property table: %d\n", r );
2261
2262 r = add_property_entry( hdb, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2263 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2264
2265 r = add_property_entry( hdb, "'ProductLanguage', '1033'" );
2266 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2267
2268 r = add_property_entry( hdb, "'ProductName', 'MSITEST'" );
2269 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2270
2271 r = add_property_entry( hdb, "'ProductVersion', '1.1.1'" );
2272 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2273
2274 r = create_install_execute_sequence_table( hdb );
2275 ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table: %d\n", r );
2276
2277 r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
2278 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2279
2280 r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
2281 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2282
2283 r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
2284 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2285
2286 r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" );
2287 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2288
2289 r = add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" );
2290 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2291
2292 r = add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" );
2293 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2294
2295 r = add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" );
2296 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2297
2298 r = add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" );
2299 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2300
2301 r = add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" );
2302 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2303
2304 r = add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" );
2305 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2306
2307 r = add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" );
2308 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2309
2310 r = create_media_table( hdb );
2311 ok( r == ERROR_SUCCESS, "cannot create media table: %d\n", r );
2312
2313 r = add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''");
2314 ok( r == ERROR_SUCCESS, "cannot add media entry: %d\n", r );
2315
2316 r = create_feature_table( hdb );
2317 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
2318
2319 r = create_component_table( hdb );
2320 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
2321
2322 /* msidbFeatureAttributesFavorLocal */
2323 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
2324 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2325
2326 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2327 r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2328 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2329
2330 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2331 r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2332 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2333
2334 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2335 r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2336 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2337
2338 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2339 r = add_component_entry( hdb, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2340 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2341
2342 /* msidbFeatureAttributesFavorSource */
2343 r = add_feature_entry( hdb, "'two', '', '', '', 2, 1, '', 1" );
2344 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2345
2346 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2347 r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2348 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2349
2350 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2351 r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2352 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2353
2354 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2355 r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2356 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2357
2358 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2359 r = add_component_entry( hdb, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2360 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2361
2362 /* msidbFeatureAttributesFavorSource */
2363 r = add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" );
2364 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2365
2366 /* msidbFeatureAttributesFavorLocal */
2367 r = add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" );
2368 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2369
2370 /* disabled */
2371 r = add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" );
2372 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2373
2374 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2375 r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2376 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2377
2378 /* no feature parent:msidbComponentAttributesLocalOnly */
2379 r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2380 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2381
2382 /* msidbFeatureAttributesFavorLocal:removed */
2383 r = add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" );
2384 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2385
2386 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2387 r = add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2388 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2389
2390 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2391 r = add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2392 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2393
2394 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2395 r = add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2396 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2397
2398 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2399 r = add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2400 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2401
2402 /* msidbFeatureAttributesFavorSource:removed */
2403 r = add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" );
2404 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2405
2406 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2407 r = add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2408 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2409
2410 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2411 r = add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2412 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2413
2414 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2415 r = add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2416 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2417
2418 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2419 r = add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2420 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2421
2422 r = create_feature_components_table( hdb );
2423 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
2424
2425 r = add_feature_components_entry( hdb, "'one', 'alpha'" );
2426 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2427
2428 r = add_feature_components_entry( hdb, "'one', 'beta'" );
2429 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2430
2431 r = add_feature_components_entry( hdb, "'one', 'gamma'" );
2432 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2433
2434 r = add_feature_components_entry( hdb, "'one', 'theta'" );
2435 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2436
2437 r = add_feature_components_entry( hdb, "'two', 'delta'" );
2438 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2439
2440 r = add_feature_components_entry( hdb, "'two', 'epsilon'" );
2441 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2442
2443 r = add_feature_components_entry( hdb, "'two', 'zeta'" );
2444 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2445
2446 r = add_feature_components_entry( hdb, "'two', 'iota'" );
2447 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2448
2449 r = add_feature_components_entry( hdb, "'three', 'eta'" );
2450 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2451
2452 r = add_feature_components_entry( hdb, "'four', 'eta'" );
2453 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2454
2455 r = add_feature_components_entry( hdb, "'five', 'eta'" );
2456 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2457
2458 r = add_feature_components_entry( hdb, "'six', 'lambda'" );
2459 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2460
2461 r = add_feature_components_entry( hdb, "'six', 'mu'" );
2462 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2463
2464 r = add_feature_components_entry( hdb, "'six', 'nu'" );
2465 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2466
2467 r = add_feature_components_entry( hdb, "'six', 'xi'" );
2468 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2469
2470 r = add_feature_components_entry( hdb, "'seven', 'omicron'" );
2471 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2472
2473 r = add_feature_components_entry( hdb, "'seven', 'pi'" );
2474 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2475
2476 r = add_feature_components_entry( hdb, "'seven', 'rho'" );
2477 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2478
2479 r = add_feature_components_entry( hdb, "'seven', 'sigma'" );
2480 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2481
2482 r = create_file_table( hdb );
2483 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
2484
2485 r = add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2486 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2487
2488 r = add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2489 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2490
2491 r = add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2492 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2493
2494 r = add_file_entry( hdb, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2495 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2496
2497 r = add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2498 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2499
2500 r = add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2501 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2502
2503 r = add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2504 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2505
2506 r = add_file_entry( hdb, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2507 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2508
2509 /* compressed file */
2510 r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2511 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2512
2513 r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2514 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2515
2516 r = add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2517 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2518
2519 r = add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2520 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2521
2522 r = add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2523 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2524
2525 r = add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2526 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2527
2528 r = add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2529 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2530
2531 r = add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2532 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2533
2534 r = add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2535 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2536
2537 r = add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2538 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2539
2540 MsiDatabaseCommit(hdb);
2541
2542 /* these properties must not be in the saved msi file */
2543 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
2544 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2545
2546 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
2547 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2548
2549 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
2550 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2551
2552 hpkg = package_from_db( hdb );
2553 ok( hpkg, "failed to create package\n");
2554
2555 MsiCloseHandle(hdb);
2556
2557 state = 0xdeadbee;
2558 action = 0xdeadbee;
2559 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2560 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2561 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2562 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2563
2564 state = 0xdeadbee;
2565 action = 0xdeadbee;
2566 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2567 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2568 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2569 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2570
2571 state = 0xdeadbee;
2572 action = 0xdeadbee;
2573 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2574 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2575 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2576 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2577
2578 state = 0xdeadbee;
2579 action = 0xdeadbee;
2580 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2581 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2582 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2583 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2584
2585 state = 0xdeadbee;
2586 action = 0xdeadbee;
2587 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2588 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2589 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2590 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2591
2592 state = 0xdeadbee;
2593 action = 0xdeadbee;
2594 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2595 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2596 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2597 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2598
2599 state = 0xdeadbee;
2600 action = 0xdeadbee;
2601 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2602 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2603 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2604 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2605
2606 state = 0xdeadbee;
2607 action = 0xdeadbee;
2608 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2609 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2610 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2611 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2612
2613 state = 0xdeadbee;
2614 action = 0xdeadbee;
2615 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2616 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2617 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2618 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2619
2620 state = 0xdeadbee;
2621 action = 0xdeadbee;
2622 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2623 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2624 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2625 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2626
2627 state = 0xdeadbee;
2628 action = 0xdeadbee;
2629 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2630 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2631 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2632 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2633
2634 state = 0xdeadbee;
2635 action = 0xdeadbee;
2636 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2637 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2638 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2639 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2640
2641 state = 0xdeadbee;
2642 action = 0xdeadbee;
2643 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2644 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2645 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2646 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2647
2648 state = 0xdeadbee;
2649 action = 0xdeadbee;
2650 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2651 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2652 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2653 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2654
2655 state = 0xdeadbee;
2656 action = 0xdeadbee;
2657 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2658 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2659 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2660 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2661
2662 state = 0xdeadbee;
2663 action = 0xdeadbee;
2664 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2665 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2666 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2667 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2668
2669 state = 0xdeadbee;
2670 action = 0xdeadbee;
2671 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2672 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2673 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2674 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2675
2676 state = 0xdeadbee;
2677 action = 0xdeadbee;
2678 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2679 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2680 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2681 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2682
2683 state = 0xdeadbee;
2684 action = 0xdeadbee;
2685 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2686 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2687 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2688 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2689
2690 state = 0xdeadbee;
2691 action = 0xdeadbee;
2692 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2693 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2694 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2695 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2696
2697 state = 0xdeadbee;
2698 action = 0xdeadbee;
2699 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2700 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2701 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2702 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2703
2704 state = 0xdeadbee;
2705 action = 0xdeadbee;
2706 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
2707 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2708 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2709 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2710
2711 state = 0xdeadbee;
2712 action = 0xdeadbee;
2713 r = MsiGetComponentState(hpkg, "pi", &state, &action);
2714 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2715 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2716 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2717
2718 state = 0xdeadbee;
2719 action = 0xdeadbee;
2720 r = MsiGetComponentState(hpkg, "rho", &state, &action);
2721 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2722 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2723 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2724
2725 state = 0xdeadbee;
2726 action = 0xdeadbee;
2727 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
2728 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2729 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2730 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2731
2732 r = MsiDoAction( hpkg, "CostInitialize");
2733 ok( r == ERROR_SUCCESS, "cost init failed\n");
2734
2735 state = 0xdeadbee;
2736 action = 0xdeadbee;
2737 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2738 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2739 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2740 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2741
2742 state = 0xdeadbee;
2743 action = 0xdeadbee;
2744 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2745 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2746 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2747 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2748
2749 state = 0xdeadbee;
2750 action = 0xdeadbee;
2751 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2752 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2753 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2754 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2755
2756 state = 0xdeadbee;
2757 action = 0xdeadbee;
2758 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2759 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2760 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2761 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2762
2763 state = 0xdeadbee;
2764 action = 0xdeadbee;
2765 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2766 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2767 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2768 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2769
2770 state = 0xdeadbee;
2771 action = 0xdeadbee;
2772 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2773 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2774 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2775 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2776
2777 state = 0xdeadbee;
2778 action = 0xdeadbee;
2779 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2780 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2781 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2782 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2783
2784 state = 0xdeadbee;
2785 action = 0xdeadbee;
2786 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2787 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2788 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2789 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2790
2791 state = 0xdeadbee;
2792 action = 0xdeadbee;
2793 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2794 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2795 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2796 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2797
2798 state = 0xdeadbee;
2799 action = 0xdeadbee;
2800 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2801 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2802 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2803 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2804
2805 state = 0xdeadbee;
2806 action = 0xdeadbee;
2807 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2808 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2809 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2810 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2811
2812 state = 0xdeadbee;
2813 action = 0xdeadbee;
2814 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2815 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2816 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2817 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2818
2819 state = 0xdeadbee;
2820 action = 0xdeadbee;
2821 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2822 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2823 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2824 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2825
2826 state = 0xdeadbee;
2827 action = 0xdeadbee;
2828 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2829 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2830 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2831 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2832
2833 state = 0xdeadbee;
2834 action = 0xdeadbee;
2835 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2836 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2837 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2838 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2839
2840 state = 0xdeadbee;
2841 action = 0xdeadbee;
2842 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2843 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2844 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2845 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2846
2847 state = 0xdeadbee;
2848 action = 0xdeadbee;
2849 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2850 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2851 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2852 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2853
2854 state = 0xdeadbee;
2855 action = 0xdeadbee;
2856 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2857 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2858 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2859 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2860
2861 state = 0xdeadbee;
2862 action = 0xdeadbee;
2863 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2864 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2865 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2866 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2867
2868 state = 0xdeadbee;
2869 action = 0xdeadbee;
2870 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2871 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2872 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2873 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2874
2875 state = 0xdeadbee;
2876 action = 0xdeadbee;
2877 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2878 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2879 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2880 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2881
2882 state = 0xdeadbee;
2883 action = 0xdeadbee;
2884 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
2885 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2886 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2887 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2888
2889 state = 0xdeadbee;
2890 action = 0xdeadbee;
2891 r = MsiGetComponentState(hpkg, "pi", &state, &action);
2892 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2893 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2894 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2895
2896 state = 0xdeadbee;
2897 action = 0xdeadbee;
2898 r = MsiGetComponentState(hpkg, "rho", &state, &action);
2899 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2900 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2901 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2902
2903 state = 0xdeadbee;
2904 action = 0xdeadbee;
2905 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
2906 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2907 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2908 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2909
2910 r = MsiDoAction( hpkg, "FileCost");
2911 ok( r == ERROR_SUCCESS, "file cost failed\n");
2912
2913 state = 0xdeadbee;
2914 action = 0xdeadbee;
2915 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2916 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2917 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2918 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2919
2920 state = 0xdeadbee;
2921 action = 0xdeadbee;
2922 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2923 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2924 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2925 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2926
2927 state = 0xdeadbee;
2928 action = 0xdeadbee;
2929 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2930 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2931 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2932 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2933
2934 state = 0xdeadbee;
2935 action = 0xdeadbee;
2936 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2937 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2938 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2939 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2940
2941 state = 0xdeadbee;
2942 action = 0xdeadbee;
2943 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2944 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2945 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2946 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2947
2948 state = 0xdeadbee;
2949 action = 0xdeadbee;
2950 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2951 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2952 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2953 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2954
2955 state = 0xdeadbee;
2956 action = 0xdeadbee;
2957 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2958 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2959 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2960 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2961
2962 state = 0xdeadbee;
2963 action = 0xdeadbee;
2964 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2965 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2966 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2967 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2968
2969 state = 0xdeadbee;
2970 action = 0xdeadbee;
2971 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2972 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2973 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2974 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2975
2976 state = 0xdeadbee;
2977 action = 0xdeadbee;
2978 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2979 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2980 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2981 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2982
2983 state = 0xdeadbee;
2984 action = 0xdeadbee;
2985 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2986 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2987 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2988 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2989
2990 state = 0xdeadbee;
2991 action = 0xdeadbee;
2992 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2993 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2994 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2995 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2996
2997 state = 0xdeadbee;
2998 action = 0xdeadbee;
2999 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3000 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3001 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3002 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3003
3004 state = 0xdeadbee;
3005 action = 0xdeadbee;
3006 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3007 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3008 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3009 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3010
3011 state = 0xdeadbee;
3012 action = 0xdeadbee;
3013 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3014 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3015 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3016 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3017
3018 state = 0xdeadbee;
3019 action = 0xdeadbee;
3020 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3021 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3022 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3023 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3024
3025 state = 0xdeadbee;
3026 action = 0xdeadbee;
3027 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3028 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3029 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3030 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3031
3032 state = 0xdeadbee;
3033 action = 0xdeadbee;
3034 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3035 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3036 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3037 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3038
3039 state = 0xdeadbee;
3040 action = 0xdeadbee;
3041 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3042 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3043 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3044 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3045
3046 state = 0xdeadbee;
3047 action = 0xdeadbee;
3048 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3049 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3050 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3051 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3052
3053 state = 0xdeadbee;
3054 action = 0xdeadbee;
3055 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3056 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3057 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3058 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3059
3060 state = 0xdeadbee;
3061 action = 0xdeadbee;
3062 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3063 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3064 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3065 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3066
3067 state = 0xdeadbee;
3068 action = 0xdeadbee;
3069 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3070 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3071 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3072 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3073
3074 state = 0xdeadbee;
3075 action = 0xdeadbee;
3076 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3077 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3078 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3079 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3080
3081 state = 0xdeadbee;
3082 action = 0xdeadbee;
3083 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3084 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3085 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3086 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3087
3088 r = MsiDoAction( hpkg, "CostFinalize");
3089 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3090
3091 state = 0xdeadbee;
3092 action = 0xdeadbee;
3093 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3094 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3095 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3096 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3097
3098 state = 0xdeadbee;
3099 action = 0xdeadbee;
3100 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3101 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3102 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3103 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3104
3105 state = 0xdeadbee;
3106 action = 0xdeadbee;
3107 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3108 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3109 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3110 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3111
3112 state = 0xdeadbee;
3113 action = 0xdeadbee;
3114 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3115 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3116 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3117 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3118
3119 state = 0xdeadbee;
3120 action = 0xdeadbee;
3121 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3122 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3123 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3124 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3125
3126 state = 0xdeadbee;
3127 action = 0xdeadbee;
3128 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3129 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3130 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3131 todo_wine
3132 {
3133 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3134 }
3135
3136 state = 0xdeadbee;
3137 action = 0xdeadbee;
3138 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3139 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3140 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3141 todo_wine
3142 {
3143 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3144 }
3145
3146 state = 0xdeadbee;
3147 action = 0xdeadbee;
3148 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3149 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3150 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3151 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3152
3153 state = 0xdeadbee;
3154 action = 0xdeadbee;
3155 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3156 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3157 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3158 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3159
3160 state = 0xdeadbee;
3161 action = 0xdeadbee;
3162 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3163 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3164 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3165 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3166
3167 state = 0xdeadbee;
3168 action = 0xdeadbee;
3169 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3170 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3171 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3172 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3173
3174 state = 0xdeadbee;
3175 action = 0xdeadbee;
3176 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3177 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3178 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3179 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3180
3181 state = 0xdeadbee;
3182 action = 0xdeadbee;
3183 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3184 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3185 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3186 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3187
3188 state = 0xdeadbee;
3189 action = 0xdeadbee;
3190 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3191 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3192 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3193 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3194
3195 state = 0xdeadbee;
3196 action = 0xdeadbee;
3197 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3198 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3199 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3200 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3201
3202 state = 0xdeadbee;
3203 action = 0xdeadbee;
3204 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3205 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3206 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3207 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3208
3209 state = 0xdeadbee;
3210 action = 0xdeadbee;
3211 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3212 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3213 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3214 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3215
3216 state = 0xdeadbee;
3217 action = 0xdeadbee;
3218 r = MsiGetComponentState(hpkg, "lambda", &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
3222 {
3223 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3224 }
3225
3226 state = 0xdeadbee;
3227 action = 0xdeadbee;
3228 r = MsiGetComponentState(hpkg, "mu", &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
3232 {
3233 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3234 }
3235
3236 state = 0xdeadbee;
3237 action = 0xdeadbee;
3238 r = MsiGetComponentState(hpkg, "nu", &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
3242 {
3243 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3244 }
3245
3246 state = 0xdeadbee;
3247 action = 0xdeadbee;
3248 r = MsiGetComponentState(hpkg, "xi", &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
3252 {
3253 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3254 }
3255
3256 state = 0xdeadbee;
3257 action = 0xdeadbee;
3258 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3259 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3260 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3261 todo_wine
3262 {
3263 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3264 }
3265
3266 state = 0xdeadbee;
3267 action = 0xdeadbee;
3268 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3269 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3270 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3271 todo_wine
3272 {
3273 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3274 }
3275
3276 state = 0xdeadbee;
3277 action = 0xdeadbee;
3278 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3279 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3280 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3281 todo_wine
3282 {
3283 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3284 }
3285
3286 state = 0xdeadbee;
3287 action = 0xdeadbee;
3288 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3289 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3290 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3291 todo_wine
3292 {
3293 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3294 }
3295
3296 MsiCloseHandle( hpkg );
3297
3298 /* publish the features and components */
3299 r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven");
3300 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3301
3302 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
3303 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
3304
3305 /* these properties must not be in the saved msi file */
3306 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
3307 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3308
3309 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
3310 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3311
3312 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
3313 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3314
3315 hpkg = package_from_db( hdb );
3316 ok( hpkg, "failed to create package\n");
3317
3318 MsiCloseHandle(hdb);
3319
3320 state = 0xdeadbee;
3321 action = 0xdeadbee;
3322 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3323 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3324 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3325 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3326
3327 state = 0xdeadbee;
3328 action = 0xdeadbee;
3329 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3330 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3331 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3332 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3333
3334 state = 0xdeadbee;
3335 action = 0xdeadbee;
3336 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3337 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3338 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3339 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3340
3341 state = 0xdeadbee;
3342 action = 0xdeadbee;
3343 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3344 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3345 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3346 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3347
3348 state = 0xdeadbee;
3349 action = 0xdeadbee;
3350 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3351 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3352 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3353 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3354
3355 state = 0xdeadbee;
3356 action = 0xdeadbee;
3357 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3358 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3359 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3360 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3361
3362 state = 0xdeadbee;
3363 action = 0xdeadbee;
3364 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3365 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3366 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3367 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3368
3369 state = 0xdeadbee;
3370 action = 0xdeadbee;
3371 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3372 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3373 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3374 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3375
3376 state = 0xdeadbee;
3377 action = 0xdeadbee;
3378 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3379 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3380 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3381 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3382
3383 state = 0xdeadbee;
3384 action = 0xdeadbee;
3385 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3386 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3387 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3388 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3389
3390 state = 0xdeadbee;
3391 action = 0xdeadbee;
3392 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3393 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3394 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3395 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3396
3397 state = 0xdeadbee;
3398 action = 0xdeadbee;
3399 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3400 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3401 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3402 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3403
3404 state = 0xdeadbee;
3405 action = 0xdeadbee;
3406 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3407 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3408 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3409 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3410
3411 state = 0xdeadbee;
3412 action = 0xdeadbee;
3413 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3414 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3415 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3416 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3417
3418 state = 0xdeadbee;
3419 action = 0xdeadbee;
3420 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3421 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3422 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3423 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3424
3425 state = 0xdeadbee;
3426 action = 0xdeadbee;
3427 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3428 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3429 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3430 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3431
3432 state = 0xdeadbee;
3433 action = 0xdeadbee;
3434 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3435 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3436 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3437 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3438
3439 state = 0xdeadbee;
3440 action = 0xdeadbee;
3441 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3442 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3443 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3444 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3445
3446 state = 0xdeadbee;
3447 action = 0xdeadbee;
3448 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3449 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3450 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3451 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3452
3453 state = 0xdeadbee;
3454 action = 0xdeadbee;
3455 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3456 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3457 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3458 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3459
3460 state = 0xdeadbee;
3461 action = 0xdeadbee;
3462 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3463 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3464 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3465 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3466
3467 state = 0xdeadbee;
3468 action = 0xdeadbee;
3469 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3470 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3471 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3472 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3473
3474 state = 0xdeadbee;
3475 action = 0xdeadbee;
3476 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3477 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3478 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3479 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3480
3481 state = 0xdeadbee;
3482 action = 0xdeadbee;
3483 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3484 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3485 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3486 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3487
3488 state = 0xdeadbee;
3489 action = 0xdeadbee;
3490 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3491 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3492 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3493 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3494
3495 r = MsiDoAction( hpkg, "CostInitialize");
3496 ok( r == ERROR_SUCCESS, "cost init failed\n");
3497
3498 state = 0xdeadbee;
3499 action = 0xdeadbee;
3500 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3501 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3502 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3503 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3504
3505 state = 0xdeadbee;
3506 action = 0xdeadbee;
3507 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3508 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3509 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3510 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3511
3512 state = 0xdeadbee;
3513 action = 0xdeadbee;
3514 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3515 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3516 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3517 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3518
3519 state = 0xdeadbee;
3520 action = 0xdeadbee;
3521 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3522 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3523 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3524 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3525
3526 state = 0xdeadbee;
3527 action = 0xdeadbee;
3528 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3529 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3530 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3531 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3532
3533 state = 0xdeadbee;
3534 action = 0xdeadbee;
3535 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3536 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3537 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3538 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3539
3540 state = 0xdeadbee;
3541 action = 0xdeadbee;
3542 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3543 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3544 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3545 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3546
3547 state = 0xdeadbee;
3548 action = 0xdeadbee;
3549 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3550 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3551 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3552 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3553
3554 state = 0xdeadbee;
3555 action = 0xdeadbee;
3556 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3557 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3558 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3559 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3560
3561 state = 0xdeadbee;
3562 action = 0xdeadbee;
3563 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3564 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3565 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3566 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3567
3568 state = 0xdeadbee;
3569 action = 0xdeadbee;
3570 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3571 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3572 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3573 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3574
3575 state = 0xdeadbee;
3576 action = 0xdeadbee;
3577 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3578 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3579 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3580 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3581
3582 state = 0xdeadbee;
3583 action = 0xdeadbee;
3584 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3585 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3586 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3587 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3588
3589 state = 0xdeadbee;
3590 action = 0xdeadbee;
3591 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3592 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3593 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3594 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3595
3596 state = 0xdeadbee;
3597 action = 0xdeadbee;
3598 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3599 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3600 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3601 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3602
3603 state = 0xdeadbee;
3604 action = 0xdeadbee;
3605 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3606 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3607 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3608 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3609
3610 state = 0xdeadbee;
3611 action = 0xdeadbee;
3612 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3613 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3614 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3615 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3616
3617 state = 0xdeadbee;
3618 action = 0xdeadbee;
3619 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3620 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3621 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3622 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3623
3624 state = 0xdeadbee;
3625 action = 0xdeadbee;
3626 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3627 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3628 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3629 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3630
3631 state = 0xdeadbee;
3632 action = 0xdeadbee;
3633 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3634 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3635 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3636 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3637
3638 state = 0xdeadbee;
3639 action = 0xdeadbee;
3640 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3641 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3642 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3643 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3644
3645 state = 0xdeadbee;
3646 action = 0xdeadbee;
3647 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3648 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3649 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3650 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3651
3652 state = 0xdeadbee;
3653 action = 0xdeadbee;
3654 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3655 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3656 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3657 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3658
3659 state = 0xdeadbee;
3660 action = 0xdeadbee;
3661 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3662 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3663 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3664 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3665
3666 state = 0xdeadbee;
3667 action = 0xdeadbee;
3668 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3669 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3670 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3671 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3672
3673 r = MsiDoAction( hpkg, "FileCost");
3674 ok( r == ERROR_SUCCESS, "file cost failed\n");
3675
3676 state = 0xdeadbee;
3677 action = 0xdeadbee;
3678 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3679 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3680 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3681 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3682
3683 state = 0xdeadbee;
3684 action = 0xdeadbee;
3685 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3686 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3687 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3688 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3689
3690 state = 0xdeadbee;
3691 action = 0xdeadbee;
3692 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3693 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3694 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3695 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3696
3697 state = 0xdeadbee;
3698 action = 0xdeadbee;
3699 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3700 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3701 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3702 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3703
3704 state = 0xdeadbee;
3705 action = 0xdeadbee;
3706 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3707 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3708 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3709 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3710
3711 state = 0xdeadbee;
3712 action = 0xdeadbee;
3713 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3714 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3715 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3716 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3717
3718 state = 0xdeadbee;
3719 action = 0xdeadbee;
3720 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3721 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3722 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3723 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3724
3725 state = 0xdeadbee;
3726 action = 0xdeadbee;
3727 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3728 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3729 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3730 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3731
3732 state = 0xdeadbee;
3733 action = 0xdeadbee;
3734 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3735 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3736 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3737 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3738
3739 state = 0xdeadbee;
3740 action = 0xdeadbee;
3741 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3742 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3743 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3744 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3745
3746 state = 0xdeadbee;
3747 action = 0xdeadbee;
3748 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3749 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3750 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3751 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3752
3753 state = 0xdeadbee;
3754 action = 0xdeadbee;
3755 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3756 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3757 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3758 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3759
3760 state = 0xdeadbee;
3761 action = 0xdeadbee;
3762 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3763 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3764 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3765 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3766
3767 state = 0xdeadbee;
3768 action = 0xdeadbee;
3769 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3770 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3771 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3772 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3773
3774 state = 0xdeadbee;
3775 action = 0xdeadbee;
3776 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3777 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3778 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3779 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3780
3781 state = 0xdeadbee;
3782 action = 0xdeadbee;
3783 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3784 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3785 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3786 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3787
3788 state = 0xdeadbee;
3789 action = 0xdeadbee;
3790 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3791 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3792 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3793 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3794
3795 state = 0xdeadbee;
3796 action = 0xdeadbee;
3797 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3798 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3799 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3800 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3801
3802 state = 0xdeadbee;
3803 action = 0xdeadbee;
3804 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3805 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3806 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3807 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3808
3809 state = 0xdeadbee;
3810 action = 0xdeadbee;
3811 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3812 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3813 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3814 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3815
3816 state = 0xdeadbee;
3817 action = 0xdeadbee;
3818 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3819 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3820 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3821 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3822
3823 state = 0xdeadbee;
3824 action = 0xdeadbee;
3825 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3826 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3827 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3828 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3829
3830 state = 0xdeadbee;
3831 action = 0xdeadbee;
3832 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3833 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3834 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3835 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3836
3837 state = 0xdeadbee;
3838 action = 0xdeadbee;
3839 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3840 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3841 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3842 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3843
3844 state = 0xdeadbee;
3845 action = 0xdeadbee;
3846 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3847 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3848 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3849 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3850
3851 r = MsiDoAction( hpkg, "CostFinalize");
3852 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3853
3854 state = 0xdeadbee;
3855 action = 0xdeadbee;
3856 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3857 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3858 todo_wine
3859 {
3860 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3861 }
3862 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3863
3864 state = 0xdeadbee;
3865 action = 0xdeadbee;
3866 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3867 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3868 todo_wine
3869 {
3870 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3871 }
3872 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3873
3874 state = 0xdeadbee;
3875 action = 0xdeadbee;
3876 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3877 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3878 todo_wine
3879 {
3880 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3881 }
3882 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3883
3884 state = 0xdeadbee;
3885 action = 0xdeadbee;
3886 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3887 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3888 todo_wine
3889 {
3890 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3891 }
3892 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3893
3894 state = 0xdeadbee;
3895 action = 0xdeadbee;
3896 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3897 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3898 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3899 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3900
3901 state = 0xdeadbee;
3902 action = 0xdeadbee;
3903 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3904 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3905 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3906 todo_wine
3907 {
3908 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3909 }
3910
3911 state = 0xdeadbee;
3912 action = 0xdeadbee;
3913 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3914 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3915 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3916 todo_wine
3917 {
3918 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3919 }
3920
3921 state = 0xdeadbee;
3922 action = 0xdeadbee;
3923 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3924 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3925 todo_wine
3926 {
3927 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3928 }
3929 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3930
3931 state = 0xdeadbee;
3932 action = 0xdeadbee;
3933 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3934 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3935 todo_wine
3936 {
3937 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3938 }
3939 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3940
3941 state = 0xdeadbee;
3942 action = 0xdeadbee;
3943 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3944 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3945 todo_wine
3946 {
3947 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3948 }
3949 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3950
3951 state = 0xdeadbee;
3952 action = 0xdeadbee;
3953 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3954 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3955 todo_wine
3956 {
3957 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3958 }
3959 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3960
3961 state = 0xdeadbee;
3962 action = 0xdeadbee;
3963 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3964 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3965 todo_wine
3966 {
3967 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3968 }
3969 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3970
3971 state = 0xdeadbee;
3972 action = 0xdeadbee;
3973 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3974 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3975 todo_wine
3976 {
3977 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3978 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3979 }
3980
3981 state = 0xdeadbee;
3982 action = 0xdeadbee;
3983 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3984 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3985 todo_wine
3986 {
3987 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3988 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3989 }
3990
3991 state = 0xdeadbee;
3992 action = 0xdeadbee;
3993 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3994 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3995 todo_wine
3996 {
3997 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3998 }
3999 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4000
4001 state = 0xdeadbee;
4002 action = 0xdeadbee;
4003 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4004 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4005 todo_wine
4006 {
4007 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4008 }
4009 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4010
4011 state = 0xdeadbee;
4012 action = 0xdeadbee;
4013 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4014 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4015 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4016 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4017
4018 state = 0xdeadbee;
4019 action = 0xdeadbee;
4020 r = MsiGetComponentState(hpkg, "lambda", &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
4024 {
4025 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4026 }
4027
4028 state = 0xdeadbee;
4029 action = 0xdeadbee;
4030 r = MsiGetComponentState(hpkg, "mu", &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
4034 {
4035 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4036 }
4037
4038 state = 0xdeadbee;
4039 action = 0xdeadbee;
4040 r = MsiGetComponentState(hpkg, "nu", &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
4044 {
4045 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4046 }
4047
4048 state = 0xdeadbee;
4049 action = 0xdeadbee;
4050 r = MsiGetComponentState(hpkg, "xi", &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
4054 {
4055 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4056 }
4057
4058 state = 0xdeadbee;
4059 action = 0xdeadbee;
4060 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4061 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4062 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4063 todo_wine
4064 {
4065 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4066 }
4067
4068 state = 0xdeadbee;
4069 action = 0xdeadbee;
4070 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4071 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4072 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4073 todo_wine
4074 {
4075 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4076 }
4077
4078 state = 0xdeadbee;
4079 action = 0xdeadbee;
4080 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4081 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4082 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4083 todo_wine
4084 {
4085 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4086 }
4087
4088 state = 0xdeadbee;
4089 action = 0xdeadbee;
4090 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4091 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4092 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4093 todo_wine
4094 {
4095 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4096 }
4097
4098 MsiCloseHandle(hpkg);
4099
4100 /* uninstall the product */
4101 r = MsiInstallProduct(msifile, "REMOVE=ALL");
4102 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4103
4104 DeleteFileA(msifile);
4105 }
4106
4107 static void test_getproperty(void)
4108 {
4109 MSIHANDLE hPackage = 0;
4110 char prop[100];
4111 static CHAR empty[] = "";
4112 DWORD size;
4113 UINT r;
4114
4115 hPackage = package_from_db(create_package_db());
4116 ok( hPackage != 0, " Failed to create package\n");
4117
4118 /* set the property */
4119 r = MsiSetProperty(hPackage, "Name", "Value");
4120 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4121
4122 /* retrieve the size, NULL pointer */
4123 size = 0;
4124 r = MsiGetProperty(hPackage, "Name", NULL, &size);
4125 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4126 ok( size == 5, "Expected 5, got %d\n", size);
4127
4128 /* retrieve the size, empty string */
4129 size = 0;
4130 r = MsiGetProperty(hPackage, "Name", empty, &size);
4131 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
4132 ok( size == 5, "Expected 5, got %d\n", size);
4133
4134 /* don't change size */
4135 r = MsiGetProperty(hPackage, "Name", prop, &size);
4136 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
4137 ok( size == 5, "Expected 5, got %d\n", size);
4138 ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
4139
4140 /* increase the size by 1 */
4141 size++;
4142 r = MsiGetProperty(hPackage, "Name", prop, &size);
4143 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4144 ok( size == 5, "Expected 5, got %d\n", size);
4145 ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
4146
4147 r = MsiCloseHandle( hPackage);
4148 ok( r == ERROR_SUCCESS , "Failed to close package\n" );
4149 DeleteFile(msifile);
4150 }
4151
4152 static void test_removefiles(void)
4153 {
4154 MSIHANDLE hpkg;
4155 UINT r;
4156 MSIHANDLE hdb;
4157
4158 hdb = create_package_db();
4159 ok ( hdb, "failed to create package database\n" );
4160
4161 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
4162 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4163
4164 r = create_feature_table( hdb );
4165 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
4166
4167 r = create_component_table( hdb );
4168 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
4169
4170 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
4171 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4172
4173 r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
4174 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4175
4176 r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
4177 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4178
4179 r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
4180 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4181
4182 r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
4183 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4184
4185 r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
4186 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4187
4188 r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
4189 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4190
4191 r = create_feature_components_table( hdb );
4192 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
4193
4194 r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
4195 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4196
4197 r = add_feature_components_entry( hdb, "'one', 'helium'" );
4198 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4199
4200 r = add_feature_components_entry( hdb, "'one', 'lithium'" );
4201 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4202
4203 r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
4204 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4205
4206 r = add_feature_components_entry( hdb, "'one', 'boron'" );
4207 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4208
4209 r = add_feature_components_entry( hdb, "'one', 'carbon'" );
4210 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4211
4212 r = create_file_table( hdb );
4213 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
4214
4215 r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
4216 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4217
4218 r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
4219 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4220
4221 r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
4222 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4223
4224 r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
4225 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4226
4227 r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
4228 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4229
4230 r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
4231 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4232
4233 r = create_remove_file_table( hdb );
4234 ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
4235
4236 hpkg = package_from_db( hdb );
4237 ok( hpkg, "failed to create package\n");
4238
4239 MsiCloseHandle( hdb );
4240
4241 create_test_file( "hydrogen.txt" );
4242 create_test_file( "helium.txt" );
4243 create_test_file( "lithium.txt" );
4244 create_test_file( "beryllium.txt" );
4245 create_test_file( "boron.txt" );
4246 create_test_file( "carbon.txt" );
4247
4248 r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
4249 ok( r == ERROR_SUCCESS, "set property failed\n");
4250
4251 r = MsiDoAction( hpkg, "CostInitialize");
4252 ok( r == ERROR_SUCCESS, "cost init failed\n");
4253
4254 r = MsiDoAction( hpkg, "FileCost");
4255 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4256
4257 r = MsiDoAction( hpkg, "CostFinalize");
4258 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4259
4260 r = MsiDoAction( hpkg, "InstallValidate");
4261 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4262
4263 r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
4264 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4265
4266 r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
4267 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4268
4269 r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
4270 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4271
4272 r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
4273 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4274
4275 r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
4276 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4277
4278 r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
4279 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
4280
4281 r = MsiDoAction( hpkg, "RemoveFiles");
4282 ok( r == ERROR_SUCCESS, "remove files failed\n");
4283
4284 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
4285 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
4286 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
4287 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
4288 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
4289 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
4290
4291 MsiCloseHandle( hpkg );
4292 DeleteFileA(msifile);
4293 }
4294
4295 static void test_appsearch(void)
4296 {
4297 MSIHANDLE hpkg;
4298 UINT r;
4299 MSIHANDLE hdb;
4300 CHAR prop[MAX_PATH];
4301 DWORD size = MAX_PATH;
4302
4303 hdb = create_package_db();
4304 ok ( hdb, "failed to create package database\n" );
4305
4306 r = create_appsearch_table( hdb );
4307 ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
4308
4309 r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
4310 ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
4311
4312 r = create_reglocator_table( hdb );
4313 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
4314
4315 r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
4316 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
4317
4318 r = create_signature_table( hdb );
4319 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
4320
4321 r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
4322 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
4323
4324 hpkg = package_from_db( hdb );
4325 ok( hpkg, "failed to create package\n");
4326
4327 MsiCloseHandle( hdb );
4328
4329 r = MsiDoAction( hpkg, "AppSearch" );
4330 ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
4331
4332 r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
4333 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
4334 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
4335
4336 MsiCloseHandle( hpkg );
4337 DeleteFileA(msifile);
4338 }
4339
4340 static void test_featureparents(void)
4341 {
4342 MSIHANDLE hpkg;
4343 UINT r;
4344 MSIHANDLE hdb;
4345 INSTALLSTATE state, action;
4346
4347 hdb = create_package_db();
4348 ok ( hdb, "failed to create package database\n" );
4349
4350 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
4351 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4352
4353 r = create_feature_table( hdb );
4354 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
4355
4356 r = create_component_table( hdb );
4357 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
4358
4359 r = create_feature_components_table( hdb );
4360 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
4361
4362 r = create_file_table( hdb );
4363 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
4364
4365 /* msidbFeatureAttributesFavorLocal */
4366 r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
4367 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4368
4369 /* msidbFeatureAttributesFavorSource */
4370 r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
4371 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4372
4373 /* msidbFeatureAttributesFavorLocal */
4374 r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
4375 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4376
4377 /* disabled because of install level */
4378 r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
4379 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4380
4381 /* child feature of disabled feature */
4382 r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
4383 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
4384
4385 /* component of disabled feature (install level) */
4386 r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
4387 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4388
4389 /* component of disabled child feature (install level) */
4390 r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
4391 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4392
4393 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
4394 r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
4395 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4396
4397 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
4398 r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
4399 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4400
4401 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
4402 r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
4403 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4404
4405 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
4406 r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
4407 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4408
4409 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
4410 r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
4411 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4412
4413 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
4414 r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
4415 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4416
4417 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
4418 r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
4419 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4420
4421 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
4422 r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
4423 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
4424
4425 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
4426 r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
4427
4428 r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
4429 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4430
4431 r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
4432 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4433
4434 r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
4435 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4436
4437 r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
4438 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4439
4440 r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
4441 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4442
4443 r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
4444 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4445
4446 r = add_feature_components_entry( hdb, "'orion', 'leo'" );
4447 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4448
4449 r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
4450 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4451
4452 r = add_feature_components_entry( hdb, "'orion', 'libra'" );
4453 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4454
4455 r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
4456 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4457
4458 r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
4459 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4460
4461 r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
4462 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4463
4464 r = add_feature_components_entry( hdb, "'orion', 'canis'" );
4465 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4466
4467 r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
4468 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4469
4470 r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
4471 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4472
4473 r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
4474 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4475
4476 r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
4477 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
4478
4479 r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
4480 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4481
4482 r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
4483 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4484
4485 r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
4486 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4487
4488 r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
4489 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4490
4491 r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
4492 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4493
4494 r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
4495 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4496
4497 r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
4498 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4499
4500 r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
4501 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4502
4503 r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
4504 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4505
4506 r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
4507 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4508
4509 r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
4510 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
4511
4512 hpkg = package_from_db( hdb );
4513 ok( hpkg, "failed to create package\n");
4514
4515 MsiCloseHandle( hdb );
4516
4517 r = MsiDoAction( hpkg, "CostInitialize");
4518 ok( r == ERROR_SUCCESS, "cost init failed\n");
4519
4520 r = MsiDoAction( hpkg, "FileCost");
4521 ok( r == ERROR_SUCCESS, "file cost failed\n");
4522
4523 r = MsiDoAction( hpkg, "CostFinalize");
4524 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
4525
4526 state = 0xdeadbee;
4527 action = 0xdeadbee;
4528 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
4529 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4530 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4531 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4532
4533 state = 0xdeadbee;
4534 action = 0xdeadbee;
4535 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
4536 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4537 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4538 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4539
4540 state = 0xdeadbee;
4541 action = 0xdeadbee;
4542 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
4543 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4544 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4545 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4546
4547 state = 0xdeadbee;
4548 action = 0xdeadbee;
4549 r = MsiGetFeatureState(hpkg, "waters", &state, &action);
4550 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4551 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4552 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4553
4554 state = 0xdeadbee;
4555 action = 0xdeadbee;
4556 r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
4557 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4558 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4559 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4560
4561 state = 0xdeadbee;
4562 action = 0xdeadbee;
4563 r = MsiGetComponentState(hpkg, "leo", &state, &action);
4564 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4565 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4566 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4567
4568 state = 0xdeadbee;
4569 action = 0xdeadbee;
4570 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
4571 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4572 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
4573 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
4574
4575 state = 0xdeadbee;
4576 action = 0xdeadbee;
4577 r = MsiGetComponentState(hpkg, "libra", &state, &action);
4578 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4579 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
4580 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
4581
4582 state = 0xdeadbee;
4583 action = 0xdeadbee;
4584 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
4585 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4586 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
4587 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
4588
4589 state = 0xdeadbee;
4590 action = 0xdeadbee;
4591 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
4592 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4593 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
4594 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
4595
4596 state = 0xdeadbee;
4597 action = 0xdeadbee;
4598 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
4599 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4600 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
4601 ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
4602
4603 state = 0xdeadbee;
4604 action = 0xdeadbee;
4605 r = MsiGetComponentState(hpkg, "canis", &state, &action);
4606 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4607 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
4608 ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
4609
4610 state = 0xdeadbee;
4611 action = 0xdeadbee;
4612 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
4613 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4614 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
4615 ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
4616
4617 state = 0xdeadbee;
4618 action = 0xdeadbee;
4619 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
4620 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4621 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
4622 ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
4623
4624 state = 0xdeadbee;
4625 action = 0xdeadbee;
4626 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
4627 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4628 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
4629 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
4630
4631 state = 0xdeadbee;
4632 action = 0xdeadbee;
4633 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
4634 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4635 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
4636 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
4637
4638 r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
4639 ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
4640
4641 state = 0xdeadbee;
4642 action = 0xdeadbee;
4643 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
4644 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4645 ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
4646 ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
4647
4648 state = 0xdeadbee;
4649 action = 0xdeadbee;
4650 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
4651 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4652 ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
4653 ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
4654
4655 state = 0xdeadbee;
4656 action = 0xdeadbee;
4657 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
4658 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4659 ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
4660 ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
4661
4662 state = 0xdeadbee;
4663 action = 0xdeadbee;
4664 r = MsiGetComponentState(hpkg, "leo", &state, &action);
4665 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4666 ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
4667 ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
4668
4669 state = 0xdeadbee;
4670 action = 0xdeadbee;
4671 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
4672 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4673 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
4674 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
4675
4676 state = 0xdeadbee;
4677 action = 0xdeadbee;
4678 r = MsiGetComponentState(hpkg, "libra", &state, &action);
4679 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4680 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
4681 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
4682
4683 state = 0xdeadbee;
4684 action = 0xdeadbee;
4685 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
4686 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4687 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
4688 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
4689
4690 state = 0xdeadbee;
4691 action = 0xdeadbee;
4692 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
4693 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4694 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
4695 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
4696
4697 state = 0xdeadbee;
4698 action = 0xdeadbee;
4699 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
4700 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4701 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
4702 ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
4703
4704 state = 0xdeadbee;
4705 action = 0xdeadbee;
4706 r = MsiGetComponentState(hpkg, "canis", &state, &action);
4707 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4708 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
4709 ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
4710
4711 state = 0xdeadbee;
4712 action = 0xdeadbee;
4713 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
4714 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4715 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
4716 ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
4717
4718 state = 0xdeadbee;
4719 action = 0xdeadbee;
4720 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
4721 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4722 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
4723 ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
4724
4725 state = 0xdeadbee;
4726 action = 0xdeadbee;
4727 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
4728 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4729 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
4730 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
4731
4732 state = 0xdeadbee;
4733 action = 0xdeadbee;
4734 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
4735 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4736 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
4737 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
4738
4739 MsiCloseHandle(hpkg);
4740 DeleteFileA(msifile);
4741 }
4742
4743 static void test_installprops(void)
4744 {
4745 MSIHANDLE hpkg, hdb;
4746 CHAR path[MAX_PATH];
4747 CHAR buf[MAX_PATH];
4748 DWORD size, type;
4749 LANGID langid;
4750 HKEY hkey1, hkey2;
4751 int res;
4752 UINT r;
4753
4754 GetCurrentDirectory(MAX_PATH, path);
4755 lstrcat(path, "\\");
4756 lstrcat(path, msifile);
4757
4758 hdb = create_package_db();
4759 ok( hdb, "failed to create database\n");
4760
4761 hpkg = package_from_db(hdb);
4762 ok( hpkg, "failed to create package\n");
4763
4764 MsiCloseHandle(hdb);
4765
4766 size = MAX_PATH;
4767 r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
4768 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4769 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
4770
4771 RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
4772
4773 RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2);
4774
4775 size = MAX_PATH;
4776 type = REG_SZ;
4777 *path = '\0';
4778 if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
4779 {
4780 size = MAX_PATH;
4781 type = REG_SZ;
4782 RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
4783 }
4784
4785 /* win9x doesn't set this */
4786 if (*path)
4787 {
4788 size = MAX_PATH;
4789 r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
4790 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4791 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
4792 }
4793
4794 size = MAX_PATH;
4795 type = REG_SZ;
4796 *path = '\0';
4797 if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
4798 {
4799 size = MAX_PATH;
4800 type = REG_SZ;
4801 RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
4802 }
4803
4804 if (*path)
4805 {
4806 size = MAX_PATH;
4807 r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
4808 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4809 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
4810 }
4811
4812 size = MAX_PATH;
4813 r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
4814 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4815 trace("VersionDatabase = %s\n", buf);
4816
4817 size = MAX_PATH;
4818 r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
4819 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4820 trace("VersionMsi = %s\n", buf);
4821
4822 size = MAX_PATH;
4823 r = MsiGetProperty(hpkg, "Date", buf, &size);
4824 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4825 trace("Date = %s\n", buf);
4826
4827 size = MAX_PATH;
4828 r = MsiGetProperty(hpkg, "Time", buf, &size);
4829 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4830 trace("Time = %s\n", buf);
4831
4832 size = MAX_PATH;
4833 r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
4834 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4835 trace("PackageCode = %s\n", buf);
4836
4837 langid = GetUserDefaultLangID();
4838 sprintf(path, "%d", langid);
4839
4840 size = MAX_PATH;
4841 r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
4842 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
4843 ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
4844
4845 res = GetSystemMetrics(SM_CXSCREEN);
4846 size = MAX_PATH;
4847 r = MsiGetProperty(hpkg, "ScreenX", buf, &size);
4848 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
4849
4850 res = GetSystemMetrics(SM_CYSCREEN);
4851 size = MAX_PATH;
4852 r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
4853 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
4854
4855 CloseHandle(hkey1);
4856 CloseHandle(hkey2);
4857 MsiCloseHandle(hpkg);
4858 DeleteFile(msifile);
4859 }
4860
4861 static void test_sourcedirprop(void)
4862 {
4863 MSIHANDLE hpkg, hdb;
4864 CHAR source_dir[MAX_PATH];
4865 CHAR path[MAX_PATH];
4866 DWORD size;
4867 UINT r;
4868
4869 hdb = create_package_db();
4870 ok ( hdb, "failed to create package database\n" );
4871
4872 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
4873 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4874
4875 hpkg = package_from_db( hdb );
4876 ok( hpkg, "failed to create package\n");
4877
4878 MsiCloseHandle( hdb );
4879
4880 size = MAX_PATH;
4881 r = MsiGetProperty( hpkg, "SourceDir", source_dir, &size );
4882 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4883 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4884
4885 size = MAX_PATH;
4886 r = MsiGetProperty( hpkg, "SOURCEDIR", source_dir, &size );
4887 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4888 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4889
4890 r = MsiDoAction( hpkg, "CostInitialize");
4891 ok( r == ERROR_SUCCESS, "cost init failed\n");
4892
4893 size = MAX_PATH;
4894 r = MsiGetProperty( hpkg, "SourceDir", source_dir, &size );
4895 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4896 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4897
4898 size = MAX_PATH;
4899 r = MsiGetProperty( hpkg, "SOURCEDIR", source_dir, &size );
4900 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4901 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4902
4903 r = MsiDoAction( hpkg, "ResolveSource");
4904 ok( r == ERROR_SUCCESS, "file cost failed\n");
4905
4906 GetCurrentDirectory(MAX_PATH, path);
4907 lstrcatA(path, "\\");
4908
4909 size = MAX_PATH;
4910 r = MsiGetProperty( hpkg, "SourceDir", source_dir, &size );
4911 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4912 ok( !lstrcmpA(source_dir, path), "Expected %s, got %s\n", path, source_dir);
4913
4914 size = MAX_PATH;
4915 r = MsiGetProperty( hpkg, "SOURCEDIR", source_dir, &size );
4916 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4917 ok( !lstrcmpA(source_dir, path), "Expected %s, got %s\n", path, source_dir);
4918
4919 size = MAX_PATH;
4920 r = MsiGetProperty( hpkg, "SoUrCeDiR", source_dir, &size );
4921 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
4922 ok( !lstrlenA(source_dir), "Expected emtpy source dir, got %s\n", source_dir);
4923
4924 MsiCloseHandle(hpkg);
4925 DeleteFileA(msifile);
4926 }
4927
4928 static void test_prop_path(void)
4929 {
4930 MSIHANDLE hpkg, hdb;
4931 char buffer[MAX_PATH], cwd[MAX_PATH];
4932 DWORD sz;
4933 UINT r;
4934
4935 GetCurrentDirectory(MAX_PATH, cwd);
4936 strcat(cwd, "\\");
4937
4938 hdb = create_package_db();
4939 ok( hdb, "failed to create database\n");
4940
4941 r = add_directory_entry( hdb, "'TARGETDIR','','SourceDir'" );
4942 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4943
4944 r = add_directory_entry( hdb, "'foo','TARGETDIR','foosrc:footgt'" );
4945 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
4946
4947 hpkg = package_from_db(hdb);
4948 ok( hpkg, "failed to create package\n");
4949
4950 r = MsiGetSourcePath(hpkg, "SourceDir", buffer, &sz );
4951 ok( r == ERROR_DIRECTORY, "failed to get source path\n");
4952
4953 r = MsiGetSourcePath(hpkg, "SOURCEDIR", buffer, &sz );
4954 ok( r == ERROR_DIRECTORY, "failed to get source path\n");
4955
4956 r = MsiDoAction( hpkg, "CostInitialize");
4957 ok( r == ERROR_SUCCESS, "cost init failed\n");
4958
4959 sz = sizeof buffer;
4960 buffer[0] = 0;
4961 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
4962 ok( r == ERROR_SUCCESS, "property not set\n");
4963 ok( !buffer[0], "SourceDir should be empty\n");
4964
4965 sz = sizeof buffer;
4966 buffer[0] = 0;
4967 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
4968 ok( r == ERROR_SUCCESS, "property not set\n");
4969 ok( !buffer[0], "SourceDir should be empty\n");
4970
4971 sz = sizeof buffer;
4972 buffer[0] = 0;
4973 r = MsiGetSourcePath(hpkg, "SourceDir", buffer, &sz );
4974 ok( r == ERROR_SUCCESS, "failed to get source path\n");
4975 ok( !lstrcmpi(cwd, buffer), "SourceDir (%s) should be current dir (%s)\n", buffer, cwd);
4976
4977 sz = sizeof buffer;
4978 buffer[0] = 0;
4979 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
4980 ok( r == ERROR_SUCCESS, "property not set\n");
4981 todo_wine {
4982 ok( !lstrcmpi(cwd, buffer), "SourceDir (%s) should be current dir (%s)\n", buffer, cwd);
4983 }
4984
4985 sz = sizeof buffer;
4986 buffer[0] = 0;
4987 r = MsiGetSourcePath(hpkg, "SOURCEDIR", buffer, &sz );
4988 ok( r == ERROR_DIRECTORY, "failed to get source path\n");
4989
4990 sz = sizeof buffer;
4991 buffer[0] = 0;
4992 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
4993 ok( r == ERROR_SUCCESS, "property not set\n");
4994 todo_wine {
4995 ok( !lstrcmpi(cwd, buffer), "SourceDir (%s) should be current dir (%s)\n", buffer, cwd);
4996 }
4997
4998 r = MsiSetProperty(hpkg, "SourceDir", "goo");
4999 ok( r == ERROR_SUCCESS, "property not set\n");
5000
5001 sz = sizeof buffer;
5002 buffer[0] = 0;
5003 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
5004 ok( r == ERROR_SUCCESS, "property not set\n");
5005 ok( !lstrcmpi(buffer, "goo"), "SourceDir (%s) should be goo\n", buffer);
5006
5007 sz = sizeof buffer;
5008 buffer[0] = 0;
5009 r = MsiGetSourcePath(hpkg, "SourceDir", buffer, &sz );
5010 ok( r == ERROR_SUCCESS, "failed to get source path\n");
5011 ok( !lstrcmpi(buffer, cwd), "SourceDir (%s) should be goo\n", buffer);
5012
5013 sz = sizeof buffer;
5014 buffer[0] = 0;
5015 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
5016 ok( r == ERROR_SUCCESS, "property not set\n");
5017 ok( !lstrcmpi(buffer, "goo"), "SourceDir (%s) should be goo\n", buffer);
5018
5019 MsiCloseHandle( hpkg );
5020 DeleteFile(msifile);
5021 }
5022
5023 static void test_launchconditions(void)
5024 {
5025 MSIHANDLE hpkg;
5026 MSIHANDLE hdb;
5027 UINT r;
5028
5029 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5030
5031 hdb = create_package_db();
5032 ok( hdb, "failed to create package database\n" );
5033
5034 r = create_launchcondition_table( hdb );
5035 ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
5036
5037 r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
5038 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
5039
5040 /* invalid condition */
5041 r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
5042 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
5043
5044 hpkg = package_from_db( hdb );
5045 ok( hpkg, "failed to create package\n");
5046
5047 MsiCloseHandle( hdb );
5048
5049 r = MsiSetProperty( hpkg, "X", "1" );
5050 ok( r == ERROR_SUCCESS, "failed to set property\n" );
5051
5052 /* invalid conditions are ignored */
5053 r = MsiDoAction( hpkg, "LaunchConditions" );
5054 ok( r == ERROR_SUCCESS, "cost init failed\n" );
5055
5056 /* verify LaunchConditions still does some verification */
5057 r = MsiSetProperty( hpkg, "X", "2" );
5058 ok( r == ERROR_SUCCESS, "failed to set property\n" );
5059
5060 r = MsiDoAction( hpkg, "LaunchConditions" );
5061 ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
5062
5063 MsiCloseHandle( hpkg );
5064 DeleteFile( msifile );
5065 }
5066
5067 static void test_ccpsearch(void)
5068 {
5069 MSIHANDLE hdb, hpkg;
5070 CHAR prop[MAX_PATH];
5071 DWORD size = MAX_PATH;
5072 UINT r;
5073
5074 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5075
5076 hdb = create_package_db();
5077 ok(hdb, "failed to create package database\n");
5078
5079 r = create_ccpsearch_table(hdb);
5080 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5081
5082 r = add_ccpsearch_entry(hdb, "'CCP_random'");
5083 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5084
5085 r = add_ccpsearch_entry(hdb, "'RMCCP_random'");
5086 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5087
5088 r = create_reglocator_table(hdb);
5089 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5090
5091 r = add_reglocator_entry(hdb, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
5092 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5093
5094 r = create_drlocator_table(hdb);
5095 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5096
5097 r = add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
5098 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5099
5100 r = create_signature_table(hdb);
5101 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5102
5103 hpkg = package_from_db(hdb);
5104 ok(hpkg, "failed to create package\n");
5105
5106 MsiCloseHandle(hdb);
5107
5108 r = MsiDoAction(hpkg, "CCPSearch");
5109 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5110
5111 r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
5112 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5113 ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
5114
5115 MsiCloseHandle(hpkg);
5116 DeleteFileA(msifile);
5117 }
5118
5119 static BOOL squash_guid(LPCWSTR in, LPWSTR out)
5120 {
5121 DWORD i,n=1;
5122 GUID guid;
5123
5124 if (FAILED(CLSIDFromString((LPOLESTR)in, &guid)))
5125 return FALSE;
5126
5127 for(i=0; i<8; i++)
5128 out[7-i] = in[n++];
5129 n++;
5130 for(i=0; i<4; i++)
5131 out[11-i] = in[n++];
5132 n++;
5133 for(i=0; i<4; i++)
5134 out[15-i] = in[n++];
5135 n++;
5136 for(i=0; i<2; i++)
5137 {
5138 out[17+i*2] = in[n++];
5139 out[16+i*2] = in[n++];
5140 }
5141 n++;
5142 for( ; i<8; i++)
5143 {
5144 out[17+i*2] = in[n++];
5145 out[16+i*2] = in[n++];
5146 }
5147 out[32]=0;
5148 return TRUE;
5149 }
5150
5151 static void set_component_path(LPCSTR filename, LPCSTR guid)
5152 {
5153 WCHAR guidW[MAX_PATH];
5154 WCHAR squashedW[MAX_PATH];
5155 CHAR squashed[MAX_PATH];
5156 CHAR substr[MAX_PATH];
5157 CHAR path[MAX_PATH];
5158 HKEY hkey;
5159
5160 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
5161 squash_guid(guidW, squashedW);
5162 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
5163
5164 lstrcpyA(substr, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
5165 "Installer\\UserData\\S-1-5-18\\Components\\");
5166 lstrcatA(substr, squashed);
5167
5168 RegCreateKeyA(HKEY_LOCAL_MACHINE, substr, &hkey);
5169
5170 lstrcpyA(path, CURR_DIR);
5171 lstrcatA(path, "\\");
5172 lstrcatA(path, filename);
5173
5174 /* just using a random squashed product code */
5175 RegSetValueExA(hkey, "7D2F387510109040002000060BECB6AB", 0,
5176 REG_SZ, (LPBYTE)path, lstrlenA(path));
5177
5178 RegCloseKey(hkey);
5179
5180 lstrcpyA(substr, "SOFTWARE\\Classes\\Installer\\Products\\7D2F387510109040002000060BECB6AB");
5181 RegCreateKeyA(HKEY_LOCAL_MACHINE, substr, &hkey);
5182 }
5183
5184 static void delete_component_path(LPCSTR guid)
5185 {
5186 WCHAR guidW[MAX_PATH];
5187 WCHAR squashedW[MAX_PATH];
5188 WCHAR substrW[MAX_PATH];
5189 CHAR squashed[MAX_PATH];
5190 CHAR substr[MAX_PATH];
5191
5192 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
5193 squash_guid(guidW, squashedW);
5194 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
5195
5196 lstrcpyA(substr, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
5197 "Installer\\UserData\\S-1-5-18\\Components\\");
5198 lstrcatA(substr, squashed);
5199
5200 MultiByteToWideChar(CP_ACP, 0, substr, -1, substrW, MAX_PATH);
5201 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW);
5202
5203 lstrcpyA(substr, "SOFTWARE\\Classes\\Installer\\Products\\7D2F387510109040002000060BECB6AB");
5204 MultiByteToWideChar(CP_ACP, 0, substr, -1, substrW, MAX_PATH);
5205 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW);
5206 }
5207
5208 static void test_complocator(void)
5209 {
5210 MSIHANDLE hdb, hpkg;
5211 UINT r;
5212 CHAR prop[MAX_PATH];
5213 CHAR expected[MAX_PATH];
5214 DWORD size = MAX_PATH;
5215
5216 hdb = create_package_db();
5217 ok(hdb, "failed to create package database\n");
5218
5219 r = create_appsearch_table(hdb);
5220 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5221
5222 r = add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
5223 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5224
5225 r = add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
5226 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5227
5228 r = add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
5229 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5230
5231 r = add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
5232 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5233
5234 r = add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
5235 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5236
5237 r = add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
5238 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5239
5240 r = add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
5241 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5242
5243 r = add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
5244 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5245
5246 r = add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
5247 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5248
5249 r = add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
5250 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5251
5252 r = add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
5253 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5254
5255 r = add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
5256 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5257
5258 r = add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
5259 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5260
5261 r = add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
5262 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5263
5264 r = add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
5265 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5266
5267 r = add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
5268 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5269
5270 r = create_complocator_table(hdb);
5271 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5272
5273 r = add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
5274 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5275
5276 r = add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
5277 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5278
5279 r = add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
5280 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5281
5282 r = add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
5283 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5284
5285 r = add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
5286 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5287
5288 r = add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
5289 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5290
5291 r = add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
5292 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5293
5294 r = add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
5295 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5296
5297 r = add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
5298 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5299
5300 r = add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
5301 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5302
5303 r = add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
5304 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5305
5306 r = add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
5307 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5308
5309 r = add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
5310 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5311
5312 r = add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
5313 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5314
5315 r = add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
5316 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5317
5318 r = add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
5319 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5320
5321 r = create_signature_table(hdb);
5322 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5323
5324 r = add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
5325 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5326
5327 r = add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
5328 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5329
5330 r = add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
5331 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5332
5333 r = add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
5334 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5335
5336 r = add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
5337 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5338
5339 r = add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
5340 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5341
5342 r = add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
5343 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5344
5345 r = add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
5346 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5347
5348 hpkg = package_from_db(hdb);
5349 ok(hpkg, "failed to create package\n");
5350
5351 MsiCloseHandle(hdb);
5352
5353 create_test_file("abelisaurus");
5354 create_test_file("bactrosaurus");
5355 create_test_file("camelotia");
5356 create_test_file("diclonius");
5357 create_test_file("echinodon");
5358 create_test_file("falcarius");
5359 create_test_file("gallimimus");
5360 create_test_file("hagryphus");
5361 CreateDirectoryA("iguanodon", NULL);
5362 CreateDirectoryA("jobaria", NULL);
5363 CreateDirectoryA("kakuru", NULL);
5364 CreateDirectoryA("labocania", NULL);
5365 CreateDirectoryA("megaraptor", NULL);
5366 CreateDirectoryA("neosodon", NULL);
5367 CreateDirectoryA("olorotitan", NULL);
5368 CreateDirectoryA("pantydraco", NULL);
5369
5370 set_component_path("abelisaurus", "{E3619EED-305A-418C-B9C7-F7D7377F0934}");
5371 set_component_path("bactrosaurus", "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}");
5372 set_component_path("echinodon", "{A19E16C5-C75D-4699-8111-C4338C40C3CB}");
5373 set_component_path("falcarius", "{17762FA1-A7AE-4CC6-8827-62873C35361D}");
5374 set_component_path("iguanodon", "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}");
5375 set_component_path("jobaria", "{243C22B1-8C51-4151-B9D1-1AE5265E079E}");
5376 set_component_path("megaraptor", "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}");
5377 set_component_path("neosodon", "{0B499649-197A-48EF-93D2-AF1C17ED6E90}");
5378
5379 r = MsiDoAction(hpkg, "AppSearch");
5380 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5381
5382 size = MAX_PATH;
5383 r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
5384 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5385
5386 lstrcpyA(expected, CURR_DIR);
5387 lstrcatA(expected, "\\abelisaurus");
5388 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
5389 "Expected %s or empty string, got %s\n", expected, prop);
5390
5391 size = MAX_PATH;
5392 r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
5393 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5394 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5395
5396 size = MAX_PATH;
5397 r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
5398 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5399 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5400
5401 size = MAX_PATH;
5402 r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
5403 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5404 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5405
5406 size = MAX_PATH;
5407 r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
5408 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5409
5410 lstrcpyA(expected, CURR_DIR);
5411 lstrcatA(expected, "\\");
5412 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
5413 "Expected %s or empty string, got %s\n", expected, prop);
5414
5415 size = MAX_PATH;
5416 r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
5417 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5418 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5419
5420 size = MAX_PATH;
5421 r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
5422 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5423 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5424
5425 size = MAX_PATH;
5426 r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
5427 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5428 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5429
5430 size = MAX_PATH;
5431 r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
5432 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5433 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5434
5435 size = MAX_PATH;
5436 r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
5437 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5438 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5439
5440 size = MAX_PATH;
5441 r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
5442 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5443 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5444
5445 size = MAX_PATH;
5446 r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
5447 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5448 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5449
5450 size = MAX_PATH;
5451 r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
5452 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5453
5454 lstrcpyA(expected, CURR_DIR);
5455 lstrcatA(expected, "\\");
5456 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
5457 "Expected %s or empty string, got %s\n", expected, prop);
5458
5459 size = MAX_PATH;
5460 r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
5461 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5462
5463 lstrcpyA(expected, CURR_DIR);
5464 lstrcatA(expected, "\\neosodon\\");
5465 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
5466 "Expected %s or empty string, got %s\n", expected, prop);
5467
5468 size = MAX_PATH;
5469 r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
5470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5471 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5472
5473 size = MAX_PATH;
5474 r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
5475 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5476 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
5477
5478 MsiCloseHandle(hpkg);
5479 DeleteFileA("abelisaurus");
5480 DeleteFileA("bactrosaurus");
5481 DeleteFileA("camelotia");
5482 DeleteFileA("diclonius");
5483 DeleteFileA("echinodon");
5484 DeleteFileA("falcarius");
5485 DeleteFileA("gallimimus");
5486 DeleteFileA("hagryphus");
5487 RemoveDirectoryA("iguanodon");
5488 RemoveDirectoryA("jobaria");
5489 RemoveDirectoryA("kakuru");
5490 RemoveDirectoryA("labocania");
5491 RemoveDirectoryA("megaraptor");
5492 RemoveDirectoryA("neosodon");
5493 RemoveDirectoryA("olorotitan");
5494 RemoveDirectoryA("pantydraco");
5495 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}");
5496 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}");
5497 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}");
5498 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}");
5499 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}");
5500 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}");
5501 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}");
5502 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}");
5503 DeleteFileA(msifile);
5504 }
5505
5506 START_TEST(package)
5507 {
5508 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
5509
5510 test_createpackage();
5511 test_getsourcepath_bad();
5512 test_getsourcepath();
5513 test_doaction();
5514 test_gettargetpath_bad();
5515 test_settargetpath();
5516 test_props();
5517 test_property_table();
5518 test_condition();
5519 test_msipackage();
5520 test_formatrecord2();
5521 test_states();
5522 test_getproperty();
5523 test_removefiles();
5524 test_appsearch();
5525 test_featureparents();
5526 test_installprops();
5527 test_sourcedirprop();
5528 test_prop_path();
5529 test_launchconditions();
5530 test_ccpsearch();
5531 test_complocator();
5532 }