crypt32/tests: Fix some test failures on Win9x.
[wine] / dlls / msi / tests / 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 static void get_user_sid(LPSTR *usersid)
36 {
37     HANDLE token;
38     BYTE buf[1024];
39     DWORD size;
40     PTOKEN_USER user;
41     HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
42     static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
43
44     *usersid = NULL;
45     pConvertSidToStringSidA = (void *)GetProcAddress(hadvapi32, "ConvertSidToStringSidA");
46     if (!pConvertSidToStringSidA)
47         return;
48
49     OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
50     size = sizeof(buf);
51     GetTokenInformation(token, TokenUser, buf, size, &size);
52     user = (PTOKEN_USER)buf;
53     pConvertSidToStringSidA(user->User.Sid, usersid);
54     CloseHandle(token);
55 }
56
57 /* RegDeleteTreeW from dlls/advapi32/registry.c */
58 static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
59 {
60     LONG ret;
61     DWORD dwMaxSubkeyLen, dwMaxValueLen;
62     DWORD dwMaxLen, dwSize;
63     WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
64     HKEY hSubKey = hKey;
65
66     if(lpszSubKey)
67     {
68         ret = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
69         if (ret) return ret;
70     }
71
72     ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
73             &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
74     if (ret) goto cleanup;
75
76     dwMaxSubkeyLen++;
77     dwMaxValueLen++;
78     dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
79     if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
80     {
81         /* Name too big: alloc a buffer for it */
82         if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
83         {
84             ret = ERROR_NOT_ENOUGH_MEMORY;
85             goto cleanup;
86         }
87     }
88
89     /* Recursively delete all the subkeys */
90     while (TRUE)
91     {
92         dwSize = dwMaxLen;
93         if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
94                           NULL, NULL, NULL)) break;
95
96         ret = package_RegDeleteTreeW(hSubKey, lpszName);
97         if (ret) goto cleanup;
98     }
99
100     if (lpszSubKey)
101         ret = RegDeleteKeyW(hKey, lpszSubKey);
102     else
103         while (TRUE)
104         {
105             dwSize = dwMaxLen;
106             if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
107                   NULL, NULL, NULL, NULL)) break;
108
109             ret = RegDeleteValueW(hKey, lpszName);
110             if (ret) goto cleanup;
111         }
112
113 cleanup:
114     if (lpszName != szNameBuf)
115         HeapFree(GetProcessHeap(), 0, lpszName);
116     if(lpszSubKey)
117         RegCloseKey(hSubKey);
118     return ret;
119 }
120
121 static BOOL squash_guid(LPCWSTR in, LPWSTR out)
122 {
123     DWORD i,n=1;
124     GUID guid;
125
126     if (FAILED(CLSIDFromString((LPOLESTR)in, &guid)))
127         return FALSE;
128
129     for(i=0; i<8; i++)
130         out[7-i] = in[n++];
131     n++;
132     for(i=0; i<4; i++)
133         out[11-i] = in[n++];
134     n++;
135     for(i=0; i<4; i++)
136         out[15-i] = in[n++];
137     n++;
138     for(i=0; i<2; i++)
139     {
140         out[17+i*2] = in[n++];
141         out[16+i*2] = in[n++];
142     }
143     n++;
144     for( ; i<8; i++)
145     {
146         out[17+i*2] = in[n++];
147         out[16+i*2] = in[n++];
148     }
149     out[32]=0;
150     return TRUE;
151 }
152
153 static void create_test_guid(LPSTR prodcode, LPSTR squashed)
154 {
155     WCHAR guidW[MAX_PATH];
156     WCHAR squashedW[MAX_PATH];
157     GUID guid;
158     HRESULT hr;
159     int size;
160
161     hr = CoCreateGuid(&guid);
162     ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
163
164     size = StringFromGUID2(&guid, guidW, MAX_PATH);
165     ok(size == 39, "Expected 39, got %d\n", hr);
166
167     WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL);
168     squash_guid(guidW, squashedW);
169     WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
170 }
171
172 static void set_component_path(LPCSTR filename, MSIINSTALLCONTEXT context,
173                                LPCSTR guid, LPSTR usersid, BOOL dir)
174 {
175     WCHAR guidW[MAX_PATH];
176     WCHAR squashedW[MAX_PATH];
177     CHAR squashed[MAX_PATH];
178     CHAR comppath[MAX_PATH];
179     CHAR prodpath[MAX_PATH];
180     CHAR path[MAX_PATH];
181     LPCSTR prod = NULL;
182     HKEY hkey;
183
184     MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
185     squash_guid(guidW, squashedW);
186     WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
187
188     if (context == MSIINSTALLCONTEXT_MACHINE)
189     {
190         prod = "3D0DAE300FACA1300AD792060BCDAA92";
191         sprintf(comppath,
192                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
193                 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
194         lstrcpyA(prodpath,
195                  "SOFTWARE\\Classes\\Installer\\"
196                  "Products\\3D0DAE300FACA1300AD792060BCDAA92");
197     }
198     else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
199     {
200         prod = "7D2F387510109040002000060BECB6AB";
201         sprintf(comppath,
202                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
203                 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
204         sprintf(prodpath,
205                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
206                 "Installer\\%s\\Installer\\Products\\"
207                 "7D2F387510109040002000060BECB6AB", usersid);
208     }
209     else if (context == MSIINSTALLCONTEXT_USERMANAGED)
210     {
211         prod = "7D2F387510109040002000060BECB6AB";
212         sprintf(comppath,
213                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
214                 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
215         sprintf(prodpath,
216                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
217                 "Installer\\Managed\\%s\\Installer\\Products\\"
218                 "7D2F387510109040002000060BECB6AB", usersid);
219     }
220
221     RegCreateKeyA(HKEY_LOCAL_MACHINE, comppath, &hkey);
222
223     lstrcpyA(path, CURR_DIR);
224     lstrcatA(path, "\\");
225     if (!dir) lstrcatA(path, filename);
226
227     RegSetValueExA(hkey, prod, 0, REG_SZ, (LPBYTE)path, lstrlenA(path));
228     RegCloseKey(hkey);
229
230     RegCreateKeyA(HKEY_LOCAL_MACHINE, prodpath, &hkey);
231     RegCloseKey(hkey);
232 }
233
234 static void delete_component_path(LPCSTR guid, MSIINSTALLCONTEXT context, LPSTR usersid)
235 {
236     WCHAR guidW[MAX_PATH];
237     WCHAR squashedW[MAX_PATH];
238     WCHAR substrW[MAX_PATH];
239     CHAR squashed[MAX_PATH];
240     CHAR comppath[MAX_PATH];
241     CHAR prodpath[MAX_PATH];
242
243     MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
244     squash_guid(guidW, squashedW);
245     WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
246
247     if (context == MSIINSTALLCONTEXT_MACHINE)
248     {
249         sprintf(comppath,
250                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
251                 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
252         lstrcpyA(prodpath,
253                  "SOFTWARE\\Classes\\Installer\\"
254                  "Products\\3D0DAE300FACA1300AD792060BCDAA92");
255     }
256     else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
257     {
258         sprintf(comppath,
259                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
260                 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
261         sprintf(prodpath,
262                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
263                 "Installer\\%s\\Installer\\Products\\"
264                 "7D2F387510109040002000060BECB6AB", usersid);
265     }
266     else if (context == MSIINSTALLCONTEXT_USERMANAGED)
267     {
268         sprintf(comppath,
269                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
270                 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
271         sprintf(prodpath,
272                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
273                 "Installer\\Managed\\%s\\Installer\\Products\\"
274                 "7D2F387510109040002000060BECB6AB", usersid);
275     }
276
277     MultiByteToWideChar(CP_ACP, 0, comppath, -1, substrW, MAX_PATH);
278     package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW);
279
280     MultiByteToWideChar(CP_ACP, 0, prodpath, -1, substrW, MAX_PATH);
281     package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW);
282 }
283
284 static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec)
285 {
286     MSIHANDLE hview = 0;
287     UINT r, ret;
288
289     /* open a select query */
290     r = MsiDatabaseOpenView(hdb, query, &hview);
291     if (r != ERROR_SUCCESS)
292         return r;
293     r = MsiViewExecute(hview, 0);
294     if (r != ERROR_SUCCESS)
295         return r;
296     ret = MsiViewFetch(hview, phrec);
297     r = MsiViewClose(hview);
298     if (r != ERROR_SUCCESS)
299         return r;
300     r = MsiCloseHandle(hview);
301     if (r != ERROR_SUCCESS)
302         return r;
303     return ret;
304 }
305
306 static UINT run_query( MSIHANDLE hdb, const char *query )
307 {
308     MSIHANDLE hview = 0;
309     UINT r;
310
311     r = MsiDatabaseOpenView(hdb, query, &hview);
312     if( r != ERROR_SUCCESS )
313         return r;
314
315     r = MsiViewExecute(hview, 0);
316     if( r == ERROR_SUCCESS )
317         r = MsiViewClose(hview);
318     MsiCloseHandle(hview);
319     return r;
320 }
321
322 static UINT create_component_table( MSIHANDLE hdb )
323 {
324     return run_query( hdb,
325             "CREATE TABLE `Component` ( "
326             "`Component` CHAR(72) NOT NULL, "
327             "`ComponentId` CHAR(38), "
328             "`Directory_` CHAR(72) NOT NULL, "
329             "`Attributes` SHORT NOT NULL, "
330             "`Condition` CHAR(255), "
331             "`KeyPath` CHAR(72) "
332             "PRIMARY KEY `Component`)" );
333 }
334
335 static UINT create_feature_table( MSIHANDLE hdb )
336 {
337     return run_query( hdb,
338             "CREATE TABLE `Feature` ( "
339             "`Feature` CHAR(38) NOT NULL, "
340             "`Feature_Parent` CHAR(38), "
341             "`Title` CHAR(64), "
342             "`Description` CHAR(255), "
343             "`Display` SHORT NOT NULL, "
344             "`Level` SHORT NOT NULL, "
345             "`Directory_` CHAR(72), "
346             "`Attributes` SHORT NOT NULL "
347             "PRIMARY KEY `Feature`)" );
348 }
349
350 static UINT create_feature_components_table( MSIHANDLE hdb )
351 {
352     return run_query( hdb,
353             "CREATE TABLE `FeatureComponents` ( "
354             "`Feature_` CHAR(38) NOT NULL, "
355             "`Component_` CHAR(72) NOT NULL "
356             "PRIMARY KEY `Feature_`, `Component_` )" );
357 }
358
359 static UINT create_file_table( MSIHANDLE hdb )
360 {
361     return run_query( hdb,
362             "CREATE TABLE `File` ("
363             "`File` CHAR(72) NOT NULL, "
364             "`Component_` CHAR(72) NOT NULL, "
365             "`FileName` CHAR(255) NOT NULL, "
366             "`FileSize` LONG NOT NULL, "
367             "`Version` CHAR(72), "
368             "`Language` CHAR(20), "
369             "`Attributes` SHORT, "
370             "`Sequence` SHORT NOT NULL "
371             "PRIMARY KEY `File`)" );
372 }
373
374 static UINT create_remove_file_table( MSIHANDLE hdb )
375 {
376     return run_query( hdb,
377             "CREATE TABLE `RemoveFile` ("
378             "`FileKey` CHAR(72) NOT NULL, "
379             "`Component_` CHAR(72) NOT NULL, "
380             "`FileName` CHAR(255) LOCALIZABLE, "
381             "`DirProperty` CHAR(72) NOT NULL, "
382             "`InstallMode` SHORT NOT NULL "
383             "PRIMARY KEY `FileKey`)" );
384 }
385
386 static UINT create_appsearch_table( MSIHANDLE hdb )
387 {
388     return run_query( hdb,
389             "CREATE TABLE `AppSearch` ("
390             "`Property` CHAR(72) NOT NULL, "
391             "`Signature_` CHAR(72) NOT NULL "
392             "PRIMARY KEY `Property`, `Signature_`)" );
393 }
394
395 static UINT create_reglocator_table( MSIHANDLE hdb )
396 {
397     return run_query( hdb,
398             "CREATE TABLE `RegLocator` ("
399             "`Signature_` CHAR(72) NOT NULL, "
400             "`Root` SHORT NOT NULL, "
401             "`Key` CHAR(255) NOT NULL, "
402             "`Name` CHAR(255), "
403             "`Type` SHORT "
404             "PRIMARY KEY `Signature_`)" );
405 }
406
407 static UINT create_signature_table( MSIHANDLE hdb )
408 {
409     return run_query( hdb,
410             "CREATE TABLE `Signature` ("
411             "`Signature` CHAR(72) NOT NULL, "
412             "`FileName` CHAR(255) NOT NULL, "
413             "`MinVersion` CHAR(20), "
414             "`MaxVersion` CHAR(20), "
415             "`MinSize` LONG, "
416             "`MaxSize` LONG, "
417             "`MinDate` LONG, "
418             "`MaxDate` LONG, "
419             "`Languages` CHAR(255) "
420             "PRIMARY KEY `Signature`)" );
421 }
422
423 static UINT create_launchcondition_table( MSIHANDLE hdb )
424 {
425     return run_query( hdb,
426             "CREATE TABLE `LaunchCondition` ("
427             "`Condition` CHAR(255) NOT NULL, "
428             "`Description` CHAR(255) NOT NULL "
429             "PRIMARY KEY `Condition`)" );
430 }
431
432 static UINT create_property_table( MSIHANDLE hdb )
433 {
434     return run_query( hdb,
435             "CREATE TABLE `Property` ("
436             "`Property` CHAR(72) NOT NULL, "
437             "`Value` CHAR(0) "
438             "PRIMARY KEY `Property`)" );
439 }
440
441 static UINT create_install_execute_sequence_table( MSIHANDLE hdb )
442 {
443     return run_query( hdb,
444             "CREATE TABLE `InstallExecuteSequence` ("
445             "`Action` CHAR(72) NOT NULL, "
446             "`Condition` CHAR(255), "
447             "`Sequence` SHORT "
448             "PRIMARY KEY `Action`)" );
449 }
450
451 static UINT create_media_table( MSIHANDLE hdb )
452 {
453     return run_query( hdb,
454             "CREATE TABLE `Media` ("
455             "`DiskId` SHORT NOT NULL, "
456             "`LastSequence` SHORT NOT NULL, "
457             "`DiskPrompt` CHAR(64), "
458             "`Cabinet` CHAR(255), "
459             "`VolumeLabel` CHAR(32), "
460             "`Source` CHAR(72) "
461             "PRIMARY KEY `DiskId`)" );
462 }
463
464 static UINT create_ccpsearch_table( MSIHANDLE hdb )
465 {
466     return run_query( hdb,
467             "CREATE TABLE `CCPSearch` ("
468             "`Signature_` CHAR(72) NOT NULL "
469             "PRIMARY KEY `Signature_`)" );
470 }
471
472 static UINT create_drlocator_table( MSIHANDLE hdb )
473 {
474     return run_query( hdb,
475             "CREATE TABLE `DrLocator` ("
476             "`Signature_` CHAR(72) NOT NULL, "
477             "`Parent` CHAR(72), "
478             "`Path` CHAR(255), "
479             "`Depth` SHORT "
480             "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
481 }
482
483 static UINT create_complocator_table( MSIHANDLE hdb )
484 {
485     return run_query( hdb,
486             "CREATE TABLE `CompLocator` ("
487             "`Signature_` CHAR(72) NOT NULL, "
488             "`ComponentId` CHAR(38) NOT NULL, "
489             "`Type` SHORT "
490             "PRIMARY KEY `Signature_`)" );
491 }
492
493 static UINT create_inilocator_table( MSIHANDLE hdb )
494 {
495     return run_query( hdb,
496             "CREATE TABLE `IniLocator` ("
497             "`Signature_` CHAR(72) NOT NULL, "
498             "`FileName` CHAR(255) NOT NULL, "
499             "`Section` CHAR(96)NOT NULL, "
500             "`Key` CHAR(128)NOT NULL, "
501             "`Field` SHORT, "
502             "`Type` SHORT "
503             "PRIMARY KEY `Signature_`)" );
504 }
505
506 #define make_add_entry(type, qtext) \
507     static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
508     { \
509         char insert[] = qtext; \
510         char *query; \
511         UINT sz, r; \
512         sz = strlen(values) + sizeof insert; \
513         query = HeapAlloc(GetProcessHeap(),0,sz); \
514         sprintf(query,insert,values); \
515         r = run_query( hdb, query ); \
516         HeapFree(GetProcessHeap(), 0, query); \
517         return r; \
518     }
519
520 make_add_entry(component,
521                "INSERT INTO `Component`  "
522                "(`Component`, `ComponentId`, `Directory_`, "
523                "`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
524
525 make_add_entry(directory,
526                "INSERT INTO `Directory` "
527                "(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
528
529 make_add_entry(feature,
530                "INSERT INTO `Feature` "
531                "(`Feature`, `Feature_Parent`, `Title`, `Description`, "
532                "`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
533
534 make_add_entry(feature_components,
535                "INSERT INTO `FeatureComponents` "
536                "(`Feature_`, `Component_`) VALUES( %s )")
537
538 make_add_entry(file,
539                "INSERT INTO `File` "
540                "(`File`, `Component_`, `FileName`, `FileSize`, "
541                "`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
542
543 make_add_entry(appsearch,
544                "INSERT INTO `AppSearch` "
545                "(`Property`, `Signature_`) VALUES( %s )")
546
547 make_add_entry(reglocator,
548                "INSERT INTO `RegLocator` "
549                "(`Signature_`, `Root`, `Key`, `Name`, `Type`) VALUES( %s )")
550
551 make_add_entry(signature,
552                "INSERT INTO `Signature` "
553                "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
554                " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
555                "VALUES( %s )")
556
557 make_add_entry(launchcondition,
558                "INSERT INTO `LaunchCondition` "
559                "(`Condition`, `Description`) VALUES( %s )")
560
561 make_add_entry(property,
562                "INSERT INTO `Property` (`Property`, `Value`) VALUES( %s )")
563
564 make_add_entry(install_execute_sequence,
565                "INSERT INTO `InstallExecuteSequence` "
566                "(`Action`, `Condition`, `Sequence`) VALUES( %s )")
567
568 make_add_entry(media,
569                "INSERT INTO `Media` "
570                "(`DiskId`, `LastSequence`, `DiskPrompt`, "
571                "`Cabinet`, `VolumeLabel`, `Source`) VALUES( %s )")
572
573 make_add_entry(ccpsearch,
574                "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )")
575
576 make_add_entry(drlocator,
577                "INSERT INTO `DrLocator` "
578                "(`Signature_`, `Parent`, `Path`, `Depth`) VALUES( %s )")
579
580 make_add_entry(complocator,
581                "INSERT INTO `CompLocator` "
582                "(`Signature_`, `ComponentId`, `Type`) VALUES( %s )")
583
584 make_add_entry(inilocator,
585                "INSERT INTO `IniLocator` "
586                "(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) "
587                "VALUES( %s )")
588
589 static UINT set_summary_info(MSIHANDLE hdb)
590 {
591     UINT res;
592     MSIHANDLE suminfo;
593
594     /* build summary info */
595     res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
596     ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
597
598     res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
599                         "Installation Database");
600     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
601
602     res = MsiSummaryInfoSetProperty(suminfo,3, VT_LPSTR, 0,NULL,
603                         "Installation Database");
604     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
605
606     res = MsiSummaryInfoSetProperty(suminfo,4, VT_LPSTR, 0,NULL,
607                         "Wine Hackers");
608     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
609
610     res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
611                     ";1033");
612     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
613
614     res = MsiSummaryInfoSetProperty(suminfo,9, VT_LPSTR, 0,NULL,
615                     "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
616     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
617
618     res = MsiSummaryInfoSetProperty(suminfo, 14, VT_I4, 100, NULL, NULL);
619     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
620
621     res = MsiSummaryInfoSetProperty(suminfo, 15, VT_I4, 0, NULL, NULL);
622     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
623
624     res = MsiSummaryInfoPersist(suminfo);
625     ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
626
627     res = MsiCloseHandle( suminfo);
628     ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
629
630     return res;
631 }
632
633
634 static MSIHANDLE create_package_db(void)
635 {
636     MSIHANDLE hdb = 0;
637     UINT res;
638
639     DeleteFile(msifile);
640
641     /* create an empty database */
642     res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb );
643     ok( res == ERROR_SUCCESS , "Failed to create database\n" );
644     if( res != ERROR_SUCCESS )
645         return hdb;
646
647     res = MsiDatabaseCommit( hdb );
648     ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
649
650     res = set_summary_info(hdb);
651
652     res = run_query( hdb,
653             "CREATE TABLE `Directory` ( "
654             "`Directory` CHAR(255) NOT NULL, "
655             "`Directory_Parent` CHAR(255), "
656             "`DefaultDir` CHAR(255) NOT NULL "
657             "PRIMARY KEY `Directory`)" );
658     ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
659
660     return hdb;
661 }
662
663 static MSIHANDLE package_from_db(MSIHANDLE hdb)
664 {
665     UINT res;
666     CHAR szPackage[10];
667     MSIHANDLE hPackage;
668
669     sprintf(szPackage,"#%i",hdb);
670     res = MsiOpenPackage(szPackage,&hPackage);
671     if (res != ERROR_SUCCESS)
672         return 0;
673
674     res = MsiCloseHandle(hdb);
675     if (res != ERROR_SUCCESS)
676         return 0;
677
678     return hPackage;
679 }
680
681 static void create_test_file(const CHAR *name)
682 {
683     HANDLE file;
684     DWORD written;
685
686     file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
687     ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
688     WriteFile(file, name, strlen(name), &written, NULL);
689     WriteFile(file, "\n", strlen("\n"), &written, NULL);
690     CloseHandle(file);
691 }
692
693 typedef struct _tagVS_VERSIONINFO
694 {
695     WORD wLength;
696     WORD wValueLength;
697     WORD wType;
698     WCHAR szKey[1];
699     WORD wPadding1[1];
700     VS_FIXEDFILEINFO Value;
701     WORD wPadding2[1];
702     WORD wChildren[1];
703 } VS_VERSIONINFO;
704
705 #define roundoffs(a, b, r) (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))
706 #define roundpos(a, b, r) (((BYTE *)(a)) + roundoffs(a, b, r))
707
708 static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls)
709 {
710     VS_VERSIONINFO *pVerInfo;
711     VS_FIXEDFILEINFO *pFixedInfo;
712     LPBYTE buffer, ofs;
713     CHAR path[MAX_PATH];
714     DWORD handle, size;
715     HANDLE resource;
716     BOOL ret = FALSE;
717
718     GetSystemDirectory(path, MAX_PATH);
719     lstrcatA(path, "\\kernel32.dll");
720
721     CopyFileA(path, name, FALSE);
722
723     size = GetFileVersionInfoSize(path, &handle);
724     buffer = HeapAlloc(GetProcessHeap(), 0, size);
725
726     GetFileVersionInfoA(path, 0, size, buffer);
727
728     pVerInfo = (VS_VERSIONINFO *)buffer;
729     ofs = (BYTE *)&pVerInfo->szKey[lstrlenW(pVerInfo->szKey) + 1];
730     pFixedInfo = (VS_FIXEDFILEINFO *)roundpos(pVerInfo, ofs, 4);
731
732     pFixedInfo->dwFileVersionMS = ms;
733     pFixedInfo->dwFileVersionLS = ls;
734     pFixedInfo->dwProductVersionMS = ms;
735     pFixedInfo->dwProductVersionLS = ls;
736
737     resource = BeginUpdateResource(name, FALSE);
738     if (!resource)
739         goto done;
740
741     if (!UpdateResource(resource, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO),
742                    MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), buffer, size))
743         goto done;
744
745     if (!EndUpdateResource(resource, FALSE))
746         goto done;
747
748     ret = TRUE;
749
750 done:
751     HeapFree(GetProcessHeap(), 0, buffer);
752     return ret;
753 }
754
755 static void test_createpackage(void)
756 {
757     MSIHANDLE hPackage = 0;
758     UINT res;
759
760     hPackage = package_from_db(create_package_db());
761     ok( hPackage != 0, " Failed to create package\n");
762
763     res = MsiCloseHandle( hPackage);
764     ok( res == ERROR_SUCCESS , "Failed to close package\n" );
765     DeleteFile(msifile);
766 }
767
768 static void test_doaction( void )
769 {
770     MSIHANDLE hpkg;
771     UINT r;
772
773     r = MsiDoAction( -1, NULL );
774     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
775
776     hpkg = package_from_db(create_package_db());
777     ok( hpkg, "failed to create package\n");
778
779     r = MsiDoAction(hpkg, NULL);
780     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
781
782     r = MsiDoAction(0, "boo");
783     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
784
785     r = MsiDoAction(hpkg, "boo");
786     ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
787
788     MsiCloseHandle( hpkg );
789     DeleteFile(msifile);
790 }
791
792 static void test_gettargetpath_bad(void)
793 {
794     char buffer[0x80];
795     MSIHANDLE hpkg;
796     DWORD sz;
797     UINT r;
798
799     hpkg = package_from_db(create_package_db());
800     ok( hpkg, "failed to create package\n");
801
802     r = MsiGetTargetPath( 0, NULL, NULL, NULL );
803     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
804
805     r = MsiGetTargetPath( 0, NULL, NULL, &sz );
806     ok( r == ERROR_INVALID_PARAMETER, "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( 0, "boo", NULL, NULL );
812     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
813
814     r = MsiGetTargetPath( hpkg, "boo", NULL, NULL );
815     ok( r == ERROR_DIRECTORY, "wrong return val\n");
816
817     r = MsiGetTargetPath( hpkg, "boo", buffer, NULL );
818     ok( r == ERROR_DIRECTORY, "wrong return val\n");
819
820     MsiCloseHandle( hpkg );
821     DeleteFile(msifile);
822 }
823
824 static void query_file_path(MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
825 {
826     UINT r;
827     DWORD size;
828     MSIHANDLE rec;
829
830     rec = MsiCreateRecord( 1 );
831     ok(rec, "MsiCreate record failed\n");
832
833     r = MsiRecordSetString( rec, 0, file );
834     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
835
836     size = MAX_PATH;
837     r = MsiFormatRecord( hpkg, rec, buff, &size );
838     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
839
840     MsiCloseHandle( rec );
841 }
842
843 static void test_settargetpath(void)
844 {
845     char tempdir[MAX_PATH+8], buffer[MAX_PATH], file[MAX_PATH];
846     DWORD sz;
847     MSIHANDLE hpkg;
848     UINT r;
849     MSIHANDLE hdb;
850
851     hdb = create_package_db();
852     ok ( hdb, "failed to create package database\n" );
853
854     r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
855     ok( r == S_OK, "failed to add directory entry: %d\n" , r );
856
857     r = create_component_table( hdb );
858     ok( r == S_OK, "cannot create Component table: %d\n", r );
859
860     r = add_component_entry( hdb, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
861     ok( r == S_OK, "cannot add dummy component: %d\n", r );
862
863     r = add_component_entry( hdb, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
864     ok( r == S_OK, "cannot add test component: %d\n", r );
865
866     r = create_feature_table( hdb );
867     ok( r == S_OK, "cannot create Feature table: %d\n", r );
868
869     r = add_feature_entry( hdb, "'TestFeature', '', '', '', 0, 1, '', 0" );
870     ok( r == ERROR_SUCCESS, "cannot add TestFeature to Feature table: %d\n", r );
871
872     r = create_feature_components_table( hdb );
873     ok( r == S_OK, "cannot create FeatureComponents table: %d\n", r );
874
875     r = add_feature_components_entry( hdb, "'TestFeature', 'RootComp'" );
876     ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
877
878     r = add_feature_components_entry( hdb, "'TestFeature', 'TestComp'" );
879     ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
880
881     add_directory_entry( hdb, "'TestParent', 'TARGETDIR', 'TestParent'" );
882     add_directory_entry( hdb, "'TestDir', 'TestParent', 'TestDir'" );
883
884     r = create_file_table( hdb );
885     ok( r == S_OK, "cannot create File table: %d\n", r );
886
887     r = add_file_entry( hdb, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
888     ok( r == S_OK, "cannot add file to the File table: %d\n", r );
889
890     r = add_file_entry( hdb, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
891     ok( r == S_OK, "cannot add file to the File table: %d\n", r );
892
893     hpkg = package_from_db( hdb );
894     ok( hpkg, "failed to create package\n");
895
896     r = MsiDoAction( hpkg, "CostInitialize");
897     ok( r == ERROR_SUCCESS, "cost init failed\n");
898
899     r = MsiDoAction( hpkg, "FileCost");
900     ok( r == ERROR_SUCCESS, "file cost failed\n");
901
902     r = MsiDoAction( hpkg, "CostFinalize");
903     ok( r == ERROR_SUCCESS, "cost finalize failed\n");
904
905     r = MsiSetTargetPath( 0, NULL, NULL );
906     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
907
908     r = MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
909     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
910
911     r = MsiSetTargetPath( hpkg, "boo", NULL );
912     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
913
914     r = MsiSetTargetPath( hpkg, "boo", "c:\\bogusx" );
915     ok( r == ERROR_DIRECTORY, "wrong return val\n");
916
917     sz = sizeof tempdir - 1;
918     r = MsiGetTargetPath( hpkg, "TARGETDIR", tempdir, &sz );
919     sprintf( file, "%srootfile.txt", tempdir );
920     query_file_path( hpkg, "[#RootFile]", buffer );
921     ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
922     ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer );
923
924     GetTempFileName( tempdir, "_wt", 0, buffer );
925     sprintf( tempdir, "%s\\subdir", buffer );
926
927     r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
928     ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
929         "MsiSetTargetPath on file returned %d\n", r );
930
931     r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
932     ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
933         "MsiSetTargetPath on 'subdir' of file returned %d\n", r );
934
935     DeleteFile( buffer );
936
937     r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
938     ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
939
940     r = GetFileAttributes( buffer );
941     ok ( r == INVALID_FILE_ATTRIBUTES, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r );
942
943     r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
944     ok( r == ERROR_SUCCESS, "MsiSetTargetPath on subsubdir returned %d\n", r );
945
946     sz = sizeof buffer - 1;
947     lstrcat( tempdir, "\\" );
948     r = MsiGetTargetPath( hpkg, "TARGETDIR", buffer, &sz );
949     ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
950     ok( !lstrcmp(buffer, tempdir), "Expected %s, got %s\n", tempdir, buffer);
951
952     sprintf( file, "%srootfile.txt", tempdir );
953     query_file_path( hpkg, "[#RootFile]", buffer );
954     ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer);
955
956     r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two" );
957     ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
958
959     query_file_path( hpkg, "[#TestFile]", buffer );
960     ok( !lstrcmp(buffer, "C:\\one\\two\\TestDir\\testfile.txt"),
961         "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer );
962
963     sz = sizeof buffer - 1;
964     r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
965     ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
966     ok( !lstrcmp(buffer, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer);
967
968     MsiCloseHandle( hpkg );
969 }
970
971 static void test_condition(void)
972 {
973     MSICONDITION r;
974     MSIHANDLE hpkg;
975
976     hpkg = package_from_db(create_package_db());
977     ok( hpkg, "failed to create package\n");
978
979     r = MsiEvaluateCondition(0, NULL);
980     ok( r == MSICONDITION_ERROR, "wrong return val\n");
981
982     r = MsiEvaluateCondition(hpkg, NULL);
983     ok( r == MSICONDITION_NONE, "wrong return val\n");
984
985     r = MsiEvaluateCondition(hpkg, "");
986     ok( r == MSICONDITION_NONE, "wrong return val\n");
987
988     r = MsiEvaluateCondition(hpkg, "1");
989     ok( r == MSICONDITION_TRUE, "wrong return val\n");
990
991     r = MsiEvaluateCondition(hpkg, "0");
992     ok( r == MSICONDITION_FALSE, "wrong return val\n");
993
994     r = MsiEvaluateCondition(hpkg, "-1");
995     ok( r == MSICONDITION_TRUE, "wrong return val\n");
996
997     r = MsiEvaluateCondition(hpkg, "0 = 0");
998     ok( r == MSICONDITION_TRUE, "wrong return val\n");
999
1000     r = MsiEvaluateCondition(hpkg, "0 <> 0");
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, "0 ~> 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, "1 ~> 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, "0 ~>= 1");
1022     ok( r == MSICONDITION_FALSE, "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, "1 ~>= 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, "0 ~< 1");
1034     ok( r == MSICONDITION_TRUE, "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, "1 ~< 1");
1040     ok( r == MSICONDITION_FALSE, "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, "0 ~<= 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, "1 ~<= 1");
1052     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1053
1054     r = MsiEvaluateCondition(hpkg, "0 >=");
1055     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1056
1057     r = MsiEvaluateCondition(hpkg, " ");
1058     ok( r == MSICONDITION_NONE, "wrong return val\n");
1059
1060     r = MsiEvaluateCondition(hpkg, "LicView <> \"1\"");
1061     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1062
1063     r = MsiEvaluateCondition(hpkg, "LicView <> \"0\"");
1064     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1065
1066     r = MsiEvaluateCondition(hpkg, "LicView <> LicView");
1067     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1068
1069     r = MsiEvaluateCondition(hpkg, "not 0");
1070     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1071
1072     r = MsiEvaluateCondition(hpkg, "not LicView");
1073     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1074
1075     r = MsiEvaluateCondition(hpkg, "not \"A\"");
1076     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1077
1078     r = MsiEvaluateCondition(hpkg, "~not \"A\"");
1079     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1080
1081     r = MsiEvaluateCondition(hpkg, "\"0\"");
1082     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1083
1084     r = MsiEvaluateCondition(hpkg, "1 and 2");
1085     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1086
1087     r = MsiEvaluateCondition(hpkg, "not 0 and 3");
1088     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1089
1090     r = MsiEvaluateCondition(hpkg, "not 0 and 0");
1091     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1092
1093     r = MsiEvaluateCondition(hpkg, "not 0 or 1");
1094     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1095
1096     r = MsiEvaluateCondition(hpkg, "(0)");
1097     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1098
1099     r = MsiEvaluateCondition(hpkg, "(((((1))))))");
1100     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1101
1102     r = MsiEvaluateCondition(hpkg, "(((((1)))))");
1103     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1104
1105     r = MsiEvaluateCondition(hpkg, " \"A\" < \"B\" ");
1106     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1107
1108     r = MsiEvaluateCondition(hpkg, " \"A\" > \"B\" ");
1109     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1110
1111     r = MsiEvaluateCondition(hpkg, " \"1\" > \"12\" ");
1112     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1113
1114     r = MsiEvaluateCondition(hpkg, " \"100\" < \"21\" ");
1115     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1116
1117     r = MsiEvaluateCondition(hpkg, "0 < > 0");
1118     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1119
1120     r = MsiEvaluateCondition(hpkg, "(1<<1) == 2");
1121     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1122
1123     r = MsiEvaluateCondition(hpkg, " \"A\" = \"a\" ");
1124     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1125
1126     r = MsiEvaluateCondition(hpkg, " \"A\" ~ = \"a\" ");
1127     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1128
1129     r = MsiEvaluateCondition(hpkg, " \"A\" ~= \"a\" ");
1130     ok( r == MSICONDITION_TRUE, "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, " \"A\" = 1 ");
1136     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1137
1138     r = MsiEvaluateCondition(hpkg, " 1 ~= 1 ");
1139     ok( r == MSICONDITION_TRUE, "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, " 1 = \"1\" ");
1145     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1146
1147     r = MsiEvaluateCondition(hpkg, " 0 = \"1\" ");
1148     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1149
1150     r = MsiEvaluateCondition(hpkg, " 0 < \"100\" ");
1151     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1152
1153     r = MsiEvaluateCondition(hpkg, " 100 > \"0\" ");
1154     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1155
1156     r = MsiEvaluateCondition(hpkg, "1 XOR 1");
1157     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1158
1159     r = MsiEvaluateCondition(hpkg, "1 IMP 1");
1160     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1161
1162     r = MsiEvaluateCondition(hpkg, "1 IMP 0");
1163     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1164
1165     r = MsiEvaluateCondition(hpkg, "0 IMP 0");
1166     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1167
1168     r = MsiEvaluateCondition(hpkg, "0 EQV 0");
1169     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1170
1171     r = MsiEvaluateCondition(hpkg, "0 EQV 1");
1172     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1173
1174     r = MsiEvaluateCondition(hpkg, "1 IMP 1 OR 0");
1175     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1176
1177     r = MsiEvaluateCondition(hpkg, "1 IMPL 1");
1178     ok( r == MSICONDITION_ERROR, "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\" ~>< \"s\" ");
1184     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1185
1186     r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"\" ");
1187     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1188
1189     r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"sss\" ");
1190     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1191
1192     MsiSetProperty(hpkg, "mm", "5" );
1193
1194     r = MsiEvaluateCondition(hpkg, "mm = 5");
1195     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1196
1197     r = MsiEvaluateCondition(hpkg, "mm < 6");
1198     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1199
1200     r = MsiEvaluateCondition(hpkg, "mm <= 5");
1201     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1202
1203     r = MsiEvaluateCondition(hpkg, "mm > 4");
1204     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1205
1206     r = MsiEvaluateCondition(hpkg, "mm < 12");
1207     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1208
1209     r = MsiEvaluateCondition(hpkg, "mm = \"5\"");
1210     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1211
1212     r = MsiEvaluateCondition(hpkg, "0 = \"\"");
1213     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1214
1215     r = MsiEvaluateCondition(hpkg, "0 AND \"\"");
1216     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1217
1218     r = MsiEvaluateCondition(hpkg, "1 AND \"\"");
1219     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1220
1221     r = MsiEvaluateCondition(hpkg, "1 AND \"1\"");
1222     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1223
1224     r = MsiEvaluateCondition(hpkg, "3 >< 1");
1225     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1226
1227     r = MsiEvaluateCondition(hpkg, "3 >< 4");
1228     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1229
1230     r = MsiEvaluateCondition(hpkg, "NOT 0 AND 0");
1231     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1232
1233     r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1");
1234     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1235
1236     r = MsiEvaluateCondition(hpkg, "NOT 1 OR 0");
1237     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1238
1239     r = MsiEvaluateCondition(hpkg, "0 AND 1 OR 1");
1240     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1241
1242     r = MsiEvaluateCondition(hpkg, "0 AND 0 OR 1");
1243     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1244
1245     r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1 OR 0");
1246     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1247
1248     r = MsiEvaluateCondition(hpkg, "_1 = _1");
1249     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1250
1251     r = MsiEvaluateCondition(hpkg, "( 1 AND 1 ) = 2");
1252     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1253
1254     r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
1255     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1256
1257     r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1258     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1259
1260     r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
1261     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1262
1263     r = MsiEvaluateCondition(hpkg, "NOT 1 AND 0");
1264     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1265
1266     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1267     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1268
1269     r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1270     ok( r == MSICONDITION_TRUE, "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_FALSE, "wrong return val\n");
1283
1284     r = MsiEvaluateCondition(hpkg, "bandalmael~<>0");
1285     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1286
1287     MsiSetProperty(hpkg, "bandalmael", "0" );
1288     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1289     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1290
1291     MsiSetProperty(hpkg, "bandalmael", "" );
1292     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1293     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1294
1295     MsiSetProperty(hpkg, "bandalmael", "asdf" );
1296     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1297     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1298
1299     MsiSetProperty(hpkg, "bandalmael", "0asdf" );
1300     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1301     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1302
1303     MsiSetProperty(hpkg, "bandalmael", "0 " );
1304     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1305     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1306
1307     MsiSetProperty(hpkg, "bandalmael", "-0" );
1308     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1309     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1310
1311     MsiSetProperty(hpkg, "bandalmael", "0000000000000" );
1312     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1313     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1314
1315     MsiSetProperty(hpkg, "bandalmael", "--0" );
1316     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1317     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1318
1319     MsiSetProperty(hpkg, "bandalmael", "0x00" );
1320     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1321     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1322
1323     MsiSetProperty(hpkg, "bandalmael", "-" );
1324     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1325     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1326
1327     MsiSetProperty(hpkg, "bandalmael", "+0" );
1328     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1329     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1330
1331     MsiSetProperty(hpkg, "bandalmael", "0.0" );
1332     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1333     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1334     r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1335     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1336
1337     MsiSetProperty(hpkg, "one", "hi");
1338     MsiSetProperty(hpkg, "two", "hithere");
1339     r = MsiEvaluateCondition(hpkg, "one >< two");
1340     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1341
1342     MsiSetProperty(hpkg, "one", "hithere");
1343     MsiSetProperty(hpkg, "two", "hi");
1344     r = MsiEvaluateCondition(hpkg, "one >< two");
1345     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1346
1347     MsiSetProperty(hpkg, "one", "hello");
1348     MsiSetProperty(hpkg, "two", "hi");
1349     r = MsiEvaluateCondition(hpkg, "one >< two");
1350     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1351
1352     MsiSetProperty(hpkg, "one", "hellohithere");
1353     MsiSetProperty(hpkg, "two", "hi");
1354     r = MsiEvaluateCondition(hpkg, "one >< two");
1355     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1356
1357     MsiSetProperty(hpkg, "one", "");
1358     MsiSetProperty(hpkg, "two", "hi");
1359     r = MsiEvaluateCondition(hpkg, "one >< two");
1360     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1361
1362     MsiSetProperty(hpkg, "one", "hi");
1363     MsiSetProperty(hpkg, "two", "");
1364     r = MsiEvaluateCondition(hpkg, "one >< two");
1365     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1366
1367     MsiSetProperty(hpkg, "one", "");
1368     MsiSetProperty(hpkg, "two", "");
1369     r = MsiEvaluateCondition(hpkg, "one >< two");
1370     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1371
1372     MsiSetProperty(hpkg, "one", "1234");
1373     MsiSetProperty(hpkg, "two", "1");
1374     r = MsiEvaluateCondition(hpkg, "one >< two");
1375     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1376
1377     MsiSetProperty(hpkg, "one", "one 1234");
1378     MsiSetProperty(hpkg, "two", "1");
1379     r = MsiEvaluateCondition(hpkg, "one >< two");
1380     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1381
1382     MsiSetProperty(hpkg, "one", "hithere");
1383     MsiSetProperty(hpkg, "two", "hi");
1384     r = MsiEvaluateCondition(hpkg, "one << two");
1385     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1386
1387     MsiSetProperty(hpkg, "one", "hi");
1388     MsiSetProperty(hpkg, "two", "hithere");
1389     r = MsiEvaluateCondition(hpkg, "one << two");
1390     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1391
1392     MsiSetProperty(hpkg, "one", "hi");
1393     MsiSetProperty(hpkg, "two", "hi");
1394     r = MsiEvaluateCondition(hpkg, "one << two");
1395     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1396
1397     MsiSetProperty(hpkg, "one", "abcdhithere");
1398     MsiSetProperty(hpkg, "two", "hi");
1399     r = MsiEvaluateCondition(hpkg, "one << two");
1400     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1401
1402     MsiSetProperty(hpkg, "one", "");
1403     MsiSetProperty(hpkg, "two", "hi");
1404     r = MsiEvaluateCondition(hpkg, "one << two");
1405     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1406
1407     MsiSetProperty(hpkg, "one", "hithere");
1408     MsiSetProperty(hpkg, "two", "");
1409     r = MsiEvaluateCondition(hpkg, "one << two");
1410     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1411
1412     MsiSetProperty(hpkg, "one", "");
1413     MsiSetProperty(hpkg, "two", "");
1414     r = MsiEvaluateCondition(hpkg, "one << two");
1415     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1416
1417     MsiSetProperty(hpkg, "one", "1234");
1418     MsiSetProperty(hpkg, "two", "1");
1419     r = MsiEvaluateCondition(hpkg, "one << two");
1420     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1421
1422     MsiSetProperty(hpkg, "one", "1234 one");
1423     MsiSetProperty(hpkg, "two", "1");
1424     r = MsiEvaluateCondition(hpkg, "one << two");
1425     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1426
1427     MsiSetProperty(hpkg, "one", "hithere");
1428     MsiSetProperty(hpkg, "two", "there");
1429     r = MsiEvaluateCondition(hpkg, "one >> two");
1430     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1431
1432     MsiSetProperty(hpkg, "one", "hithere");
1433     MsiSetProperty(hpkg, "two", "hi");
1434     r = MsiEvaluateCondition(hpkg, "one >> two");
1435     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1436
1437     MsiSetProperty(hpkg, "one", "there");
1438     MsiSetProperty(hpkg, "two", "hithere");
1439     r = MsiEvaluateCondition(hpkg, "one >> two");
1440     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1441
1442     MsiSetProperty(hpkg, "one", "there");
1443     MsiSetProperty(hpkg, "two", "there");
1444     r = MsiEvaluateCondition(hpkg, "one >> two");
1445     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1446
1447     MsiSetProperty(hpkg, "one", "abcdhithere");
1448     MsiSetProperty(hpkg, "two", "hi");
1449     r = MsiEvaluateCondition(hpkg, "one >> two");
1450     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1451
1452     MsiSetProperty(hpkg, "one", "");
1453     MsiSetProperty(hpkg, "two", "there");
1454     r = MsiEvaluateCondition(hpkg, "one >> two");
1455     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1456
1457     MsiSetProperty(hpkg, "one", "there");
1458     MsiSetProperty(hpkg, "two", "");
1459     r = MsiEvaluateCondition(hpkg, "one >> two");
1460     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1461
1462     MsiSetProperty(hpkg, "one", "");
1463     MsiSetProperty(hpkg, "two", "");
1464     r = MsiEvaluateCondition(hpkg, "one >> two");
1465     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1466
1467     MsiSetProperty(hpkg, "one", "1234");
1468     MsiSetProperty(hpkg, "two", "4");
1469     r = MsiEvaluateCondition(hpkg, "one >> two");
1470     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1471
1472     MsiSetProperty(hpkg, "one", "one 1234");
1473     MsiSetProperty(hpkg, "two", "4");
1474     r = MsiEvaluateCondition(hpkg, "one >> two");
1475     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1476
1477     MsiSetProperty(hpkg, "MsiNetAssemblySupport", NULL);  /* make sure it's empty */
1478
1479     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1480     ok( r == MSICONDITION_TRUE, "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_FALSE, "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 ~< \"1.1.4322\"");
1495     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1496
1497     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"abcd\"");
1498     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1499
1500     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a1.1.4322\"");
1501     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1502
1503     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322a\"");
1504     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1505
1506     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1507     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1508
1509     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1510     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1511
1512     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1513     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1514
1515     r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1");
1516     ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1517
1518     r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1\"");
1519     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1520
1521     r = MsiEvaluateCondition(hpkg, "\"2\" < \"12.1\"");
1522     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1523
1524     r = MsiEvaluateCondition(hpkg, "\"02.1\" < \"2.11\"");
1525     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1526
1527     r = MsiEvaluateCondition(hpkg, "\"02.1.1\" < \"2.1\"");
1528     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1529
1530     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1531     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1532
1533     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1534     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1535
1536     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0\"");
1537     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1538
1539     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"-1\"");
1540     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1541
1542     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a\"");
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 < \" \"");
1555     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1556
1557     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"azAZ_\"");
1558     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1559
1560     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]\"");
1561     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1562
1563     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]a\"");
1564     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1565
1566     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]\"");
1567     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1568
1569     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]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     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"A\"");
1588     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1589
1590     MsiSetProperty(hpkg, "MsiNetAssemblySupport", "1.1.4322");
1591     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1592     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1593
1594     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.14322\"");
1595     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1596
1597     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.5\"");
1598     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1599
1600     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1601     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1602
1603     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1604     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1605
1606     MsiSetProperty(hpkg, "one", "1");
1607     r = MsiEvaluateCondition(hpkg, "one < \"1\"");
1608     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1609
1610     MsiSetProperty(hpkg, "X", "5.0");
1611
1612     r = MsiEvaluateCondition(hpkg, "X != \"\"");
1613     ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1614
1615     r = MsiEvaluateCondition(hpkg, "X =\"5.0\"");
1616     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1617
1618     r = MsiEvaluateCondition(hpkg, "X =\"5.1\"");
1619     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1620
1621     r = MsiEvaluateCondition(hpkg, "X =\"6.0\"");
1622     ok( r == MSICONDITION_FALSE, "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 =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1628     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1629
1630     r = MsiEvaluateCondition(hpkg, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1631     ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1632
1633     /* feature doesn't exist */
1634     r = MsiEvaluateCondition(hpkg, "&nofeature");
1635     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1636
1637     MsiSetProperty(hpkg, "A", "2");
1638     MsiSetProperty(hpkg, "X", "50");
1639
1640     r = MsiEvaluateCondition(hpkg, "2 <= X");
1641     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1642
1643     r = MsiEvaluateCondition(hpkg, "A <= X");
1644     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1645
1646     r = MsiEvaluateCondition(hpkg, "A <= 50");
1647     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1648
1649     MsiSetProperty(hpkg, "X", "50val");
1650
1651     r = MsiEvaluateCondition(hpkg, "2 <= X");
1652     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1653
1654     r = MsiEvaluateCondition(hpkg, "A <= X");
1655     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1656
1657     MsiSetProperty(hpkg, "A", "7");
1658     MsiSetProperty(hpkg, "X", "50");
1659
1660     r = MsiEvaluateCondition(hpkg, "7 <= X");
1661     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1662
1663     r = MsiEvaluateCondition(hpkg, "A <= X");
1664     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1665
1666     r = MsiEvaluateCondition(hpkg, "A <= 50");
1667     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1668
1669     MsiSetProperty(hpkg, "X", "50val");
1670
1671     r = MsiEvaluateCondition(hpkg, "2 <= X");
1672     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1673
1674     r = MsiEvaluateCondition(hpkg, "A <= X");
1675     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1676
1677     MsiCloseHandle( hpkg );
1678     DeleteFile(msifile);
1679 }
1680
1681 static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop)
1682 {
1683     UINT r;
1684     DWORD sz;
1685     char buffer[2];
1686
1687     sz = sizeof buffer;
1688     strcpy(buffer,"x");
1689     r = MsiGetProperty( hpkg, prop, buffer, &sz );
1690     return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
1691 }
1692
1693 static void test_props(void)
1694 {
1695     MSIHANDLE hpkg, hdb;
1696     UINT r;
1697     DWORD sz;
1698     char buffer[0x100];
1699
1700     hdb = create_package_db();
1701     r = run_query( hdb,
1702             "CREATE TABLE `Property` ( "
1703             "`Property` CHAR(255) NOT NULL, "
1704             "`Value` CHAR(255) "
1705             "PRIMARY KEY `Property`)" );
1706     ok( r == ERROR_SUCCESS , "Failed\n" );
1707
1708     r = run_query(hdb,
1709             "INSERT INTO `Property` "
1710             "(`Property`, `Value`) "
1711             "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1712     ok( r == ERROR_SUCCESS , "Failed\n" );
1713
1714     hpkg = package_from_db( hdb );
1715     ok( hpkg, "failed to create package\n");
1716
1717     /* test invalid values */
1718     r = MsiGetProperty( 0, NULL, NULL, NULL );
1719     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1720
1721     r = MsiGetProperty( hpkg, NULL, NULL, NULL );
1722     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1723
1724     r = MsiGetProperty( hpkg, "boo", NULL, NULL );
1725     ok( r == ERROR_SUCCESS, "wrong return val\n");
1726
1727     r = MsiGetProperty( hpkg, "boo", buffer, NULL );
1728     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1729
1730     /* test retrieving an empty/nonexistent property */
1731     sz = sizeof buffer;
1732     r = MsiGetProperty( hpkg, "boo", NULL, &sz );
1733     ok( r == ERROR_SUCCESS, "wrong return val\n");
1734     ok( sz == 0, "wrong size returned\n");
1735
1736     check_prop_empty( hpkg, "boo");
1737     sz = 0;
1738     strcpy(buffer,"x");
1739     r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1740     ok( r == ERROR_MORE_DATA, "wrong return val\n");
1741     ok( !strcmp(buffer,"x"), "buffer was changed\n");
1742     ok( sz == 0, "wrong size returned\n");
1743
1744     sz = 1;
1745     strcpy(buffer,"x");
1746     r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1747     ok( r == ERROR_SUCCESS, "wrong return val\n");
1748     ok( buffer[0] == 0, "buffer was not changed\n");
1749     ok( sz == 0, "wrong size returned\n");
1750
1751     /* set the property to something */
1752     r = MsiSetProperty( 0, NULL, NULL );
1753     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1754
1755     r = MsiSetProperty( hpkg, NULL, NULL );
1756     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1757
1758     r = MsiSetProperty( hpkg, "", NULL );
1759     ok( r == ERROR_SUCCESS, "wrong return val\n");
1760
1761     /* try set and get some illegal property identifiers */
1762     r = MsiSetProperty( hpkg, "", "asdf" );
1763     ok( r == ERROR_FUNCTION_FAILED, "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     r = MsiSetProperty( hpkg, "'", "asdf" );
1772     ok( r == ERROR_SUCCESS, "wrong return val\n");
1773
1774     sz = sizeof buffer;
1775     buffer[0]=0;
1776     r = MsiGetProperty( hpkg, "'", buffer, &sz );
1777     ok( r == ERROR_SUCCESS, "wrong return val\n");
1778     ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
1779
1780     /* set empty values */
1781     r = MsiSetProperty( hpkg, "boo", NULL );
1782     ok( r == ERROR_SUCCESS, "wrong return val\n");
1783     ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1784
1785     r = MsiSetProperty( hpkg, "boo", "" );
1786     ok( r == ERROR_SUCCESS, "wrong return val\n");
1787     ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1788
1789     /* set a non-empty value */
1790     r = MsiSetProperty( hpkg, "boo", "xyz" );
1791     ok( r == ERROR_SUCCESS, "wrong return val\n");
1792
1793     sz = 1;
1794     strcpy(buffer,"x");
1795     r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1796     ok( r == ERROR_MORE_DATA, "wrong return val\n");
1797     ok( buffer[0] == 0, "buffer was not changed\n");
1798     ok( sz == 3, "wrong size returned\n");
1799
1800     sz = 4;
1801     strcpy(buffer,"x");
1802     r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1803     ok( r == ERROR_SUCCESS, "wrong return val\n");
1804     ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
1805     ok( sz == 3, "wrong size returned\n");
1806
1807     sz = 3;
1808     strcpy(buffer,"x");
1809     r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1810     ok( r == ERROR_MORE_DATA, "wrong return val\n");
1811     ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
1812     ok( sz == 3, "wrong size returned\n");
1813
1814     r = MsiSetProperty(hpkg, "SourceDir", "foo");
1815     ok( r == ERROR_SUCCESS, "wrong return val\n");
1816
1817     sz = 4;
1818     r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
1819     ok( r == ERROR_SUCCESS, "wrong return val\n");
1820     ok( !strcmp(buffer,""), "buffer wrong\n");
1821     ok( sz == 0, "wrong size returned\n");
1822
1823     sz = 4;
1824     r = MsiGetProperty(hpkg, "SOMERANDOMNAME", buffer, &sz);
1825     ok( r == ERROR_SUCCESS, "wrong return val\n");
1826     ok( !strcmp(buffer,""), "buffer wrong\n");
1827     ok( sz == 0, "wrong size returned\n");
1828
1829     sz = 4;
1830     r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
1831     ok( r == ERROR_SUCCESS, "wrong return val\n");
1832     ok( !strcmp(buffer,"foo"), "buffer wrong\n");
1833     ok( sz == 3, "wrong size returned\n");
1834
1835     r = MsiSetProperty(hpkg, "MetadataCompName", "Photoshop.dll");
1836     ok( r == ERROR_SUCCESS, "wrong return val\n");
1837
1838     sz = 0;
1839     r = MsiGetProperty(hpkg, "MetadataCompName", NULL, &sz );
1840     ok( r == ERROR_SUCCESS, "return wrong\n");
1841     ok( sz == 13, "size wrong (%d)\n", sz);
1842
1843     sz = 13;
1844     r = MsiGetProperty(hpkg, "MetadataCompName", buffer, &sz );
1845     ok( r == ERROR_MORE_DATA, "return wrong\n");
1846     ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n");
1847
1848     r = MsiSetProperty(hpkg, "property", "value");
1849     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1850
1851     sz = 6;
1852     r = MsiGetProperty(hpkg, "property", buffer, &sz);
1853     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1854     ok( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer);
1855
1856     r = MsiSetProperty(hpkg, "property", NULL);
1857     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1858
1859     sz = 6;
1860     r = MsiGetProperty(hpkg, "property", buffer, &sz);
1861     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1862     ok( !strlen(buffer), "Expected empty string, got %s\n", buffer);
1863
1864     MsiCloseHandle( hpkg );
1865     DeleteFile(msifile);
1866 }
1867
1868 static BOOL find_prop_in_property(MSIHANDLE hdb, LPCSTR prop, LPCSTR val)
1869 {
1870     MSIHANDLE hview, hrec;
1871     BOOL found;
1872     CHAR buffer[MAX_PATH];
1873     DWORD sz;
1874     UINT r;
1875
1876     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
1877     ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
1878     r = MsiViewExecute(hview, 0);
1879     ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
1880
1881     found = FALSE;
1882     while (r == ERROR_SUCCESS && !found)
1883     {
1884         r = MsiViewFetch(hview, &hrec);
1885         if (r != ERROR_SUCCESS) break;
1886
1887         sz = MAX_PATH;
1888         r = MsiRecordGetString(hrec, 1, buffer, &sz);
1889         if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
1890         {
1891             sz = MAX_PATH;
1892             r = MsiRecordGetString(hrec, 2, buffer, &sz);
1893             if (r == ERROR_SUCCESS && !lstrcmpA(buffer, val))
1894                 found = TRUE;
1895         }
1896
1897         MsiCloseHandle(hrec);
1898     }
1899
1900     MsiViewClose(hview);
1901     MsiCloseHandle(hview);
1902
1903     return found;
1904 }
1905
1906 static void test_property_table(void)
1907 {
1908     const char *query;
1909     UINT r;
1910     MSIHANDLE hpkg, hdb, hrec;
1911     char buffer[MAX_PATH];
1912     DWORD sz;
1913     BOOL found;
1914
1915     hdb = create_package_db();
1916     ok( hdb, "failed to create package\n");
1917
1918     hpkg = package_from_db(hdb);
1919     ok( hpkg, "failed to create package\n");
1920
1921     MsiCloseHandle(hdb);
1922
1923     hdb = MsiGetActiveDatabase(hpkg);
1924
1925     query = "CREATE TABLE `_Property` ( "
1926         "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1927     r = run_query(hdb, query);
1928     ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
1929
1930     MsiCloseHandle(hdb);
1931     MsiCloseHandle(hpkg);
1932     DeleteFile(msifile);
1933
1934     hdb = create_package_db();
1935     ok( hdb, "failed to create package\n");
1936
1937     query = "CREATE TABLE `_Property` ( "
1938         "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1939     r = run_query(hdb, query);
1940     ok(r == ERROR_SUCCESS, "failed to create table\n");
1941
1942     query = "ALTER `_Property` ADD `foo` INTEGER";
1943     r = run_query(hdb, query);
1944     ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
1945
1946     query = "ALTER TABLE `_Property` ADD `foo` INTEGER";
1947     r = run_query(hdb, query);
1948     ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
1949
1950     query = "ALTER TABLE `_Property` ADD `extra` INTEGER";
1951     r = run_query(hdb, query);
1952     ok(r == ERROR_SUCCESS, "failed to add column\n");
1953
1954     hpkg = package_from_db(hdb);
1955     todo_wine
1956     {
1957         ok(!hpkg, "package should not be created\n");
1958     }
1959
1960     MsiCloseHandle(hdb);
1961     MsiCloseHandle(hpkg);
1962     DeleteFile(msifile);
1963
1964     hdb = create_package_db();
1965     ok (hdb, "failed to create package database\n");
1966
1967     r = create_property_table(hdb);
1968     ok(r == ERROR_SUCCESS, "cannot create Property table: %d\n", r);
1969
1970     r = add_property_entry(hdb, "'prop', 'val'");
1971     ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
1972
1973     hpkg = package_from_db(hdb);
1974     ok(hpkg, "failed to create package\n");
1975
1976     MsiCloseHandle(hdb);
1977
1978     sz = MAX_PATH;
1979     r = MsiGetProperty(hpkg, "prop", buffer, &sz);
1980     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1981     ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
1982
1983     hdb = MsiGetActiveDatabase(hpkg);
1984
1985     found = find_prop_in_property(hdb, "prop", "val");
1986     ok(found, "prop should be in the _Property table\n");
1987
1988     r = add_property_entry(hdb, "'dantes', 'mercedes'");
1989     ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
1990
1991     query = "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
1992     r = do_query(hdb, query, &hrec);
1993     ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
1994
1995     found = find_prop_in_property(hdb, "dantes", "mercedes");
1996     ok(found == FALSE, "dantes should not be in the _Property table\n");
1997
1998     sz = MAX_PATH;
1999     lstrcpy(buffer, "aaa");
2000     r = MsiGetProperty(hpkg, "dantes", buffer, &sz);
2001     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2002     ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer);
2003
2004     r = MsiSetProperty(hpkg, "dantes", "mercedes");
2005     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2006
2007     found = find_prop_in_property(hdb, "dantes", "mercedes");
2008     ok(found == TRUE, "dantes should be in the _Property table\n");
2009
2010     MsiCloseHandle(hdb);
2011     MsiCloseHandle(hpkg);
2012     DeleteFile(msifile);
2013 }
2014
2015 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
2016 {
2017     MSIHANDLE htab = 0;
2018     UINT res;
2019
2020     res = MsiDatabaseOpenView( hdb, szQuery, &htab );
2021     if( res == ERROR_SUCCESS )
2022     {
2023         UINT r;
2024
2025         r = MsiViewExecute( htab, hrec );
2026         if( r != ERROR_SUCCESS )
2027         {
2028             res = r;
2029             fprintf(stderr,"MsiViewExecute failed %08x\n", res);
2030         }
2031
2032         r = MsiViewClose( htab );
2033         if( r != ERROR_SUCCESS )
2034             res = r;
2035
2036         r = MsiCloseHandle( htab );
2037         if( r != ERROR_SUCCESS )
2038             res = r;
2039     }
2040     return res;
2041 }
2042
2043 static UINT try_query( MSIHANDLE hdb, LPCSTR szQuery )
2044 {
2045     return try_query_param( hdb, szQuery, 0 );
2046 }
2047
2048 static void set_summary_str(MSIHANDLE hdb, DWORD pid, LPCSTR value)
2049 {
2050     MSIHANDLE summary;
2051     UINT r;
2052
2053     r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2054     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2055
2056     r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
2057     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2058
2059     r = MsiSummaryInfoPersist(summary);
2060     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2061
2062     MsiCloseHandle(summary);
2063 }
2064
2065 static void set_summary_dword(MSIHANDLE hdb, DWORD pid, DWORD value)
2066 {
2067     MSIHANDLE summary;
2068     UINT r;
2069
2070     r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2071     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2072
2073     r = MsiSummaryInfoSetPropertyA(summary, pid, VT_I4, value, NULL, NULL);
2074     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2075
2076     r = MsiSummaryInfoPersist(summary);
2077     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2078
2079     MsiCloseHandle(summary);
2080 }
2081
2082 static void test_msipackage(void)
2083 {
2084     MSIHANDLE hdb = 0, hpack = 100;
2085     UINT r;
2086     const char *query;
2087     char name[10];
2088
2089     /* NULL szPackagePath */
2090     r = MsiOpenPackage(NULL, &hpack);
2091     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2092
2093     /* empty szPackagePath */
2094     r = MsiOpenPackage("", &hpack);
2095     todo_wine
2096     {
2097         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2098     }
2099
2100     if (r == ERROR_SUCCESS)
2101         MsiCloseHandle(hpack);
2102
2103     /* nonexistent szPackagePath */
2104     r = MsiOpenPackage("nonexistent", &hpack);
2105     ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2106
2107     /* NULL hProduct */
2108     r = MsiOpenPackage(msifile, NULL);
2109     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2110
2111     name[0]='#';
2112     name[1]=0;
2113     r = MsiOpenPackage(name, &hpack);
2114     ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r);
2115
2116     r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2117     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2118
2119     /* database exists, but is emtpy */
2120     sprintf(name, "#%d", hdb);
2121     r = MsiOpenPackage(name, &hpack);
2122     ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2123        "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2124
2125     query = "CREATE TABLE `Property` ( "
2126             "`Property` CHAR(72), `Value` CHAR(0) "
2127             "PRIMARY KEY `Property`)";
2128     r = try_query(hdb, query);
2129     ok(r == ERROR_SUCCESS, "failed to create Properties table\n");
2130
2131     query = "CREATE TABLE `InstallExecuteSequence` ("
2132             "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2133             "PRIMARY KEY `Action`)";
2134     r = try_query(hdb, query);
2135     ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n");
2136
2137     /* a few key tables exist */
2138     sprintf(name, "#%d", hdb);
2139     r = MsiOpenPackage(name, &hpack);
2140     ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2141        "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2142
2143     MsiCloseHandle(hdb);
2144     DeleteFile(msifile);
2145
2146     /* start with a clean database to show what constitutes a valid package */
2147     r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2148     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2149
2150     sprintf(name, "#%d", hdb);
2151
2152     /* The following summary information props must exist:
2153      *  - PID_REVNUMBER
2154      *  - PID_PAGECOUNT
2155      */
2156
2157     set_summary_dword(hdb, PID_PAGECOUNT, 100);
2158     r = MsiOpenPackage(name, &hpack);
2159     ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2160        "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2161
2162     set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2163     r = MsiOpenPackage(name, &hpack);
2164     ok(r == ERROR_SUCCESS,
2165        "Expected ERROR_SUCCESS, got %d\n", r);
2166
2167     MsiCloseHandle(hpack);
2168     MsiCloseHandle(hdb);
2169     DeleteFile(msifile);
2170 }
2171
2172 static void test_formatrecord2(void)
2173 {
2174     MSIHANDLE hpkg, hrec ;
2175     char buffer[0x100];
2176     DWORD sz;
2177     UINT r;
2178
2179     hpkg = package_from_db(create_package_db());
2180     ok( hpkg, "failed to create package\n");
2181
2182     r = MsiSetProperty(hpkg, "Manufacturer", " " );
2183     ok( r == ERROR_SUCCESS, "set property failed\n");
2184
2185     hrec = MsiCreateRecord(2);
2186     ok(hrec, "create record failed\n");
2187
2188     r = MsiRecordSetString( hrec, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2189     ok( r == ERROR_SUCCESS, "format record failed\n");
2190
2191     buffer[0] = 0;
2192     sz = sizeof buffer;
2193     r = MsiFormatRecord( hpkg, hrec, buffer, &sz );
2194
2195     r = MsiRecordSetString(hrec, 0, "[foo][1]");
2196     r = MsiRecordSetString(hrec, 1, "hoo");
2197     sz = sizeof buffer;
2198     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2199     ok( sz == 3, "size wrong\n");
2200     ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2201     ok( r == ERROR_SUCCESS, "format failed\n");
2202
2203     r = MsiRecordSetString(hrec, 0, "x[~]x");
2204     sz = sizeof buffer;
2205     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2206     ok( sz == 3, "size wrong\n");
2207     ok( 0 == strcmp(buffer,"x"), "wrong output %s\n",buffer);
2208     ok( r == ERROR_SUCCESS, "format failed\n");
2209
2210     r = MsiRecordSetString(hrec, 0, "[foo.$%}][1]");
2211     r = MsiRecordSetString(hrec, 1, "hoo");
2212     sz = sizeof buffer;
2213     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2214     ok( sz == 3, "size wrong\n");
2215     ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2216     ok( r == ERROR_SUCCESS, "format failed\n");
2217
2218     r = MsiRecordSetString(hrec, 0, "[\\[]");
2219     sz = sizeof buffer;
2220     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2221     ok( sz == 1, "size wrong\n");
2222     ok( 0 == strcmp(buffer,"["), "wrong output %s\n",buffer);
2223     ok( r == ERROR_SUCCESS, "format failed\n");
2224
2225     SetEnvironmentVariable("FOO", "BAR");
2226     r = MsiRecordSetString(hrec, 0, "[%FOO]");
2227     sz = sizeof buffer;
2228     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2229     ok( sz == 3, "size wrong\n");
2230     ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2231     ok( r == ERROR_SUCCESS, "format failed\n");
2232
2233     r = MsiRecordSetString(hrec, 0, "[[1]]");
2234     r = MsiRecordSetString(hrec, 1, "%FOO");
2235     sz = sizeof buffer;
2236     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2237     ok( sz == 3, "size wrong\n");
2238     ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2239     ok( r == ERROR_SUCCESS, "format failed\n");
2240
2241     MsiCloseHandle( hrec );
2242     MsiCloseHandle( hpkg );
2243     DeleteFile(msifile);
2244 }
2245
2246 static void test_states(void)
2247 {
2248     MSIHANDLE hpkg;
2249     UINT r;
2250     MSIHANDLE hdb;
2251     INSTALLSTATE state, action;
2252
2253     static const CHAR msifile2[] = "winetest2.msi";
2254     static const CHAR msifile3[] = "winetest3.msi";
2255     static const CHAR msifile4[] = "winetest4.msi";
2256
2257     hdb = create_package_db();
2258     ok ( hdb, "failed to create package database\n" );
2259
2260     r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
2261     ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
2262
2263     r = create_property_table( hdb );
2264     ok( r == ERROR_SUCCESS, "cannot create Property table: %d\n", r );
2265
2266     r = add_property_entry( hdb, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2267     ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2268
2269     r = add_property_entry( hdb, "'ProductLanguage', '1033'" );
2270     ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2271
2272     r = add_property_entry( hdb, "'ProductName', 'MSITEST'" );
2273     ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2274
2275     r = add_property_entry( hdb, "'ProductVersion', '1.1.1'" );
2276     ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2277
2278     r = create_install_execute_sequence_table( hdb );
2279     ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table: %d\n", r );
2280
2281     r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
2282     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2283
2284     r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
2285     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2286
2287     r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
2288     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2289
2290     r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" );
2291     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2292
2293     r = add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" );
2294     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2295
2296     r = add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" );
2297     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2298
2299     r = add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" );
2300     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2301
2302     r = add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" );
2303     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2304
2305     r = add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" );
2306     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2307
2308     r = add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" );
2309     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2310
2311     r = add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" );
2312     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2313
2314     r = create_media_table( hdb );
2315     ok( r == ERROR_SUCCESS, "cannot create media table: %d\n", r );
2316
2317     r = add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''");
2318     ok( r == ERROR_SUCCESS, "cannot add media entry: %d\n", r );
2319
2320     r = create_feature_table( hdb );
2321     ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
2322
2323     r = create_component_table( hdb );
2324     ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
2325
2326     /* msidbFeatureAttributesFavorLocal */
2327     r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
2328     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2329
2330     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2331     r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2332     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2333
2334     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2335     r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2336     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2337
2338     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2339     r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2340     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2341
2342     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2343     r = add_component_entry( hdb, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2344     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2345
2346     /* msidbFeatureAttributesFavorSource */
2347     r = add_feature_entry( hdb, "'two', '', '', '', 2, 1, '', 1" );
2348     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2349
2350     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2351     r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2352     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2353
2354     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2355     r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2356     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2357
2358     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2359     r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2360     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2361
2362     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2363     r = add_component_entry( hdb, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2364     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2365
2366     /* msidbFeatureAttributesFavorSource */
2367     r = add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" );
2368     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2369
2370     /* msidbFeatureAttributesFavorLocal */
2371     r = add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" );
2372     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2373
2374     /* disabled */
2375     r = add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" );
2376     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2377
2378     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2379     r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2380     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2381
2382     /* no feature parent:msidbComponentAttributesLocalOnly */
2383     r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2384     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2385
2386     /* msidbFeatureAttributesFavorLocal:removed */
2387     r = add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" );
2388     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2389
2390     /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2391     r = add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2392     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2393
2394     /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2395     r = add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2396     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2397
2398     /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2399     r = add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2400     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2401
2402     /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2403     r = add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2404     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2405
2406     /* msidbFeatureAttributesFavorSource:removed */
2407     r = add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" );
2408     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2409
2410     /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2411     r = add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2412     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2413
2414     /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2415     r = add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2416     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2417
2418     /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2419     r = add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2420     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2421
2422     /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2423     r = add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2424     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2425
2426     /* msidbFeatureAttributesFavorLocal */
2427     r = add_feature_entry( hdb, "'eight', '', '', '', 2, 1, '', 0" );
2428     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2429
2430     r = add_component_entry( hdb, "'tau', '{07DEB510-677C-4A6F-A0A6-7CD8EFEA77ED}', 'TARGETDIR', 1, '', 'tau_file'" );
2431     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2432
2433     /* msidbFeatureAttributesFavorSource */
2434     r = add_feature_entry( hdb, "'nine', '', '', '', 2, 1, '', 1" );
2435     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2436
2437     r = add_component_entry( hdb, "'phi', '{9F0594C5-35AD-43EA-94DD-8DF73FAA664D}', 'TARGETDIR', 1, '', 'phi_file'" );
2438     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2439
2440     /* msidbFeatureAttributesFavorAdvertise */
2441     r = add_feature_entry( hdb, "'ten', '', '', '', 2, 1, '', 4" );
2442     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2443
2444     r = add_component_entry( hdb, "'chi', '{E6B539AB-5DA9-4236-A2D2-E341A50B4C38}', 'TARGETDIR', 1, '', 'chi_file'" );
2445     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2446
2447     r = create_feature_components_table( hdb );
2448     ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
2449
2450     r = add_feature_components_entry( hdb, "'one', 'alpha'" );
2451     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2452
2453     r = add_feature_components_entry( hdb, "'one', 'beta'" );
2454     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2455
2456     r = add_feature_components_entry( hdb, "'one', 'gamma'" );
2457     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2458
2459     r = add_feature_components_entry( hdb, "'one', 'theta'" );
2460     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2461
2462     r = add_feature_components_entry( hdb, "'two', 'delta'" );
2463     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2464
2465     r = add_feature_components_entry( hdb, "'two', 'epsilon'" );
2466     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2467
2468     r = add_feature_components_entry( hdb, "'two', 'zeta'" );
2469     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2470
2471     r = add_feature_components_entry( hdb, "'two', 'iota'" );
2472     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2473
2474     r = add_feature_components_entry( hdb, "'three', 'eta'" );
2475     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2476
2477     r = add_feature_components_entry( hdb, "'four', 'eta'" );
2478     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2479
2480     r = add_feature_components_entry( hdb, "'five', 'eta'" );
2481     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2482
2483     r = add_feature_components_entry( hdb, "'six', 'lambda'" );
2484     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2485
2486     r = add_feature_components_entry( hdb, "'six', 'mu'" );
2487     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2488
2489     r = add_feature_components_entry( hdb, "'six', 'nu'" );
2490     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2491
2492     r = add_feature_components_entry( hdb, "'six', 'xi'" );
2493     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2494
2495     r = add_feature_components_entry( hdb, "'seven', 'omicron'" );
2496     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2497
2498     r = add_feature_components_entry( hdb, "'seven', 'pi'" );
2499     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2500
2501     r = add_feature_components_entry( hdb, "'seven', 'rho'" );
2502     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2503
2504     r = add_feature_components_entry( hdb, "'seven', 'sigma'" );
2505     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2506
2507     r = add_feature_components_entry( hdb, "'eight', 'tau'" );
2508     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2509
2510     r = add_feature_components_entry( hdb, "'nine', 'phi'" );
2511     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2512
2513     r = add_feature_components_entry( hdb, "'ten', 'chi'" );
2514     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2515
2516     r = create_file_table( hdb );
2517     ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
2518
2519     r = add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2520     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2521
2522     r = add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2523     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2524
2525     r = add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2526     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2527
2528     r = add_file_entry( hdb, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2529     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2530
2531     r = add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2532     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2533
2534     r = add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2535     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2536
2537     r = add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2538     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2539
2540     r = add_file_entry( hdb, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2541     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2542
2543     /* compressed file */
2544     r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2545     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2546
2547     r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2548     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2549
2550     r = add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2551     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2552
2553     r = add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2554     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2555
2556     r = add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2557     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2558
2559     r = add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2560     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2561
2562     r = add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2563     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2564
2565     r = add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2566     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2567
2568     r = add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2569     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2570
2571     r = add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2572     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2573
2574     r = add_file_entry( hdb, "'tau_file', 'tau', 'tau.txt', 100, '', '1033', 8192, 1" );
2575     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2576
2577     r = add_file_entry( hdb, "'phi_file', 'phi', 'phi.txt', 100, '', '1033', 8192, 1" );
2578     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2579
2580     r = add_file_entry( hdb, "'chi_file', 'chi', 'chi.txt', 100, '', '1033', 8192, 1" );
2581     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2582
2583     MsiDatabaseCommit(hdb);
2584
2585     /* these properties must not be in the saved msi file */
2586     r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
2587     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2588
2589     r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
2590     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2591
2592     r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
2593     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2594
2595     r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
2596     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2597
2598     r = add_property_entry( hdb, "'REINSTALLMODE', 'omus'");
2599     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2600
2601     hpkg = package_from_db( hdb );
2602     ok( hpkg, "failed to create package\n");
2603
2604     MsiCloseHandle(hdb);
2605
2606     CopyFileA(msifile, msifile2, FALSE);
2607     CopyFileA(msifile, msifile3, FALSE);
2608     CopyFileA(msifile, msifile4, FALSE);
2609
2610     state = 0xdeadbee;
2611     action = 0xdeadbee;
2612     r = MsiGetFeatureState(hpkg, "one", &state, &action);
2613     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2614     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2615     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2616
2617     state = 0xdeadbee;
2618     action = 0xdeadbee;
2619     r = MsiGetFeatureState(hpkg, "two", &state, &action);
2620     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2621     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2622     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2623
2624     state = 0xdeadbee;
2625     action = 0xdeadbee;
2626     r = MsiGetFeatureState(hpkg, "three", &state, &action);
2627     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2628     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2629     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2630
2631     state = 0xdeadbee;
2632     action = 0xdeadbee;
2633     r = MsiGetFeatureState(hpkg, "four", &state, &action);
2634     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2635     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2636     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2637
2638     state = 0xdeadbee;
2639     action = 0xdeadbee;
2640     r = MsiGetFeatureState(hpkg, "five", &state, &action);
2641     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2642     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2643     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2644
2645     state = 0xdeadbee;
2646     action = 0xdeadbee;
2647     r = MsiGetFeatureState(hpkg, "six", &state, &action);
2648     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2649     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2650     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2651
2652     state = 0xdeadbee;
2653     action = 0xdeadbee;
2654     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2655     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2656     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2657     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2658
2659     state = 0xdeadbee;
2660     action = 0xdeadbee;
2661     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
2662     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2663     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2664     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2665
2666     state = 0xdeadbee;
2667     action = 0xdeadbee;
2668     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
2669     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2670     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2671     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2672
2673     state = 0xdeadbee;
2674     action = 0xdeadbee;
2675     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
2676     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2677     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2678     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2679
2680     state = 0xdeadbee;
2681     action = 0xdeadbee;
2682     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2683     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2684     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2685     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2686
2687     state = 0xdeadbee;
2688     action = 0xdeadbee;
2689     r = MsiGetComponentState(hpkg, "beta", &state, &action);
2690     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2691     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2692     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2693
2694     state = 0xdeadbee;
2695     action = 0xdeadbee;
2696     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2697     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2698     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2699     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2700
2701     state = 0xdeadbee;
2702     action = 0xdeadbee;
2703     r = MsiGetComponentState(hpkg, "theta", &state, &action);
2704     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2705     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2706     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2707
2708     state = 0xdeadbee;
2709     action = 0xdeadbee;
2710     r = MsiGetComponentState(hpkg, "delta", &state, &action);
2711     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2712     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2713     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2714
2715     state = 0xdeadbee;
2716     action = 0xdeadbee;
2717     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2718     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2719     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2720     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2721
2722     state = 0xdeadbee;
2723     action = 0xdeadbee;
2724     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2725     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2726     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2727     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2728
2729     state = 0xdeadbee;
2730     action = 0xdeadbee;
2731     r = MsiGetComponentState(hpkg, "iota", &state, &action);
2732     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2733     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2734     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2735
2736     state = 0xdeadbee;
2737     action = 0xdeadbee;
2738     r = MsiGetComponentState(hpkg, "eta", &state, &action);
2739     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2740     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2741     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2742
2743     state = 0xdeadbee;
2744     action = 0xdeadbee;
2745     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2746     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2747     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2748     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2749
2750     state = 0xdeadbee;
2751     action = 0xdeadbee;
2752     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2753     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2754     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2755     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2756
2757     state = 0xdeadbee;
2758     action = 0xdeadbee;
2759     r = MsiGetComponentState(hpkg, "mu", &state, &action);
2760     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2761     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2762     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2763
2764     state = 0xdeadbee;
2765     action = 0xdeadbee;
2766     r = MsiGetComponentState(hpkg, "nu", &state, &action);
2767     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2768     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2769     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2770
2771     state = 0xdeadbee;
2772     action = 0xdeadbee;
2773     r = MsiGetComponentState(hpkg, "xi", &state, &action);
2774     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2775     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2776     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2777
2778     state = 0xdeadbee;
2779     action = 0xdeadbee;
2780     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
2781     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2782     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2783     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2784
2785     state = 0xdeadbee;
2786     action = 0xdeadbee;
2787     r = MsiGetComponentState(hpkg, "pi", &state, &action);
2788     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2789     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2790     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2791
2792     state = 0xdeadbee;
2793     action = 0xdeadbee;
2794     r = MsiGetComponentState(hpkg, "rho", &state, &action);
2795     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2796     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2797     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2798
2799     state = 0xdeadbee;
2800     action = 0xdeadbee;
2801     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
2802     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2803     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2804     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2805
2806     state = 0xdeadbee;
2807     action = 0xdeadbee;
2808     r = MsiGetComponentState(hpkg, "tau", &state, &action);
2809     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2810     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2811     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2812
2813     state = 0xdeadbee;
2814     action = 0xdeadbee;
2815     r = MsiGetComponentState(hpkg, "phi", &state, &action);
2816     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2817     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2818     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2819
2820     state = 0xdeadbee;
2821     action = 0xdeadbee;
2822     r = MsiGetComponentState(hpkg, "chi", &state, &action);
2823     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2824     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2825     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2826
2827     r = MsiDoAction( hpkg, "CostInitialize");
2828     ok( r == ERROR_SUCCESS, "cost init failed\n");
2829
2830     state = 0xdeadbee;
2831     action = 0xdeadbee;
2832     r = MsiGetFeatureState(hpkg, "one", &state, &action);
2833     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2834     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2835     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2836
2837     state = 0xdeadbee;
2838     action = 0xdeadbee;
2839     r = MsiGetFeatureState(hpkg, "two", &state, &action);
2840     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2841     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2842     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2843
2844     state = 0xdeadbee;
2845     action = 0xdeadbee;
2846     r = MsiGetFeatureState(hpkg, "three", &state, &action);
2847     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2848     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2849     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2850
2851     state = 0xdeadbee;
2852     action = 0xdeadbee;
2853     r = MsiGetFeatureState(hpkg, "four", &state, &action);
2854     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2855     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2856     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2857
2858     state = 0xdeadbee;
2859     action = 0xdeadbee;
2860     r = MsiGetFeatureState(hpkg, "five", &state, &action);
2861     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2862     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2863     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2864
2865     state = 0xdeadbee;
2866     action = 0xdeadbee;
2867     r = MsiGetFeatureState(hpkg, "six", &state, &action);
2868     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2869     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2870     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2871
2872     state = 0xdeadbee;
2873     action = 0xdeadbee;
2874     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2875     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2876     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2877     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2878
2879     state = 0xdeadbee;
2880     action = 0xdeadbee;
2881     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
2882     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2883     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2884     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2885
2886     state = 0xdeadbee;
2887     action = 0xdeadbee;
2888     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
2889     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2890     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2891     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2892
2893     state = 0xdeadbee;
2894     action = 0xdeadbee;
2895     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
2896     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2897     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2898     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2899
2900     state = 0xdeadbee;
2901     action = 0xdeadbee;
2902     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2903     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2904     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2905     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2906
2907     state = 0xdeadbee;
2908     action = 0xdeadbee;
2909     r = MsiGetComponentState(hpkg, "beta", &state, &action);
2910     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2911     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2912     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2913
2914     state = 0xdeadbee;
2915     action = 0xdeadbee;
2916     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2917     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2918     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2919     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2920
2921     state = 0xdeadbee;
2922     action = 0xdeadbee;
2923     r = MsiGetComponentState(hpkg, "theta", &state, &action);
2924     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2925     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2926     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2927
2928     state = 0xdeadbee;
2929     action = 0xdeadbee;
2930     r = MsiGetComponentState(hpkg, "delta", &state, &action);
2931     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2932     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2933     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2934
2935     state = 0xdeadbee;
2936     action = 0xdeadbee;
2937     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2938     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2939     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2940     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2941
2942     state = 0xdeadbee;
2943     action = 0xdeadbee;
2944     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2945     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2946     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2947     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2948
2949     state = 0xdeadbee;
2950     action = 0xdeadbee;
2951     r = MsiGetComponentState(hpkg, "iota", &state, &action);
2952     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2953     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2954     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2955
2956     state = 0xdeadbee;
2957     action = 0xdeadbee;
2958     r = MsiGetComponentState(hpkg, "eta", &state, &action);
2959     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2960     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2961     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2962
2963     state = 0xdeadbee;
2964     action = 0xdeadbee;
2965     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2966     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2967     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2968     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2969
2970     state = 0xdeadbee;
2971     action = 0xdeadbee;
2972     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2973     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2974     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2975     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2976
2977     state = 0xdeadbee;
2978     action = 0xdeadbee;
2979     r = MsiGetComponentState(hpkg, "mu", &state, &action);
2980     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2981     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2982     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2983
2984     state = 0xdeadbee;
2985     action = 0xdeadbee;
2986     r = MsiGetComponentState(hpkg, "nu", &state, &action);
2987     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2988     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2989     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2990
2991     state = 0xdeadbee;
2992     action = 0xdeadbee;
2993     r = MsiGetComponentState(hpkg, "xi", &state, &action);
2994     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2995     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2996     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2997
2998     state = 0xdeadbee;
2999     action = 0xdeadbee;
3000     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3001     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3002     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3003     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3004
3005     state = 0xdeadbee;
3006     action = 0xdeadbee;
3007     r = MsiGetComponentState(hpkg, "pi", &state, &action);
3008     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3009     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3010     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3011
3012     state = 0xdeadbee;
3013     action = 0xdeadbee;
3014     r = MsiGetComponentState(hpkg, "rho", &state, &action);
3015     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3016     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3017     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3018
3019     state = 0xdeadbee;
3020     action = 0xdeadbee;
3021     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3022     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3023     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3024     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3025
3026     state = 0xdeadbee;
3027     action = 0xdeadbee;
3028     r = MsiGetComponentState(hpkg, "tau", &state, &action);
3029     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3030     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3031     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3032
3033     state = 0xdeadbee;
3034     action = 0xdeadbee;
3035     r = MsiGetComponentState(hpkg, "phi", &state, &action);
3036     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3037     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3038     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3039
3040     state = 0xdeadbee;
3041     action = 0xdeadbee;
3042     r = MsiGetComponentState(hpkg, "chi", &state, &action);
3043     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3044     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3045     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3046
3047     r = MsiDoAction( hpkg, "FileCost");
3048     ok( r == ERROR_SUCCESS, "file cost failed\n");
3049
3050     state = 0xdeadbee;
3051     action = 0xdeadbee;
3052     r = MsiGetFeatureState(hpkg, "one", &state, &action);
3053     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3054     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3055     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3056
3057     state = 0xdeadbee;
3058     action = 0xdeadbee;
3059     r = MsiGetFeatureState(hpkg, "two", &state, &action);
3060     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3061     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3062     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3063
3064     state = 0xdeadbee;
3065     action = 0xdeadbee;
3066     r = MsiGetFeatureState(hpkg, "three", &state, &action);
3067     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3068     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3069     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3070
3071     state = 0xdeadbee;
3072     action = 0xdeadbee;
3073     r = MsiGetFeatureState(hpkg, "four", &state, &action);
3074     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3075     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3076     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3077
3078     state = 0xdeadbee;
3079     action = 0xdeadbee;
3080     r = MsiGetFeatureState(hpkg, "five", &state, &action);
3081     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3082     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3083     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3084
3085     state = 0xdeadbee;
3086     action = 0xdeadbee;
3087     r = MsiGetFeatureState(hpkg, "six", &state, &action);
3088     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3089     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3090     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3091
3092     state = 0xdeadbee;
3093     action = 0xdeadbee;
3094     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3095     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3096     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3097     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3098
3099     state = 0xdeadbee;
3100     action = 0xdeadbee;
3101     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3102     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3103     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3104     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3105
3106     state = 0xdeadbee;
3107     action = 0xdeadbee;
3108     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3109     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3110     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3111     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3112
3113     state = 0xdeadbee;
3114     action = 0xdeadbee;
3115     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3116     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3117     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3118     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3119
3120     state = 0xdeadbee;
3121     action = 0xdeadbee;
3122     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3123     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3124     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3125     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3126
3127     state = 0xdeadbee;
3128     action = 0xdeadbee;
3129     r = MsiGetComponentState(hpkg, "beta", &state, &action);
3130     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3131     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3132     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3133
3134     state = 0xdeadbee;
3135     action = 0xdeadbee;
3136     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3137     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3138     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3139     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3140
3141     state = 0xdeadbee;
3142     action = 0xdeadbee;
3143     r = MsiGetComponentState(hpkg, "theta", &state, &action);
3144     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3145     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3146     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3147
3148     state = 0xdeadbee;
3149     action = 0xdeadbee;
3150     r = MsiGetComponentState(hpkg, "delta", &state, &action);
3151     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3152     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3153     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3154
3155     state = 0xdeadbee;
3156     action = 0xdeadbee;
3157     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3158     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3159     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3160     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3161
3162     state = 0xdeadbee;
3163     action = 0xdeadbee;
3164     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3165     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3166     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3167     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3168
3169     state = 0xdeadbee;
3170     action = 0xdeadbee;
3171     r = MsiGetComponentState(hpkg, "iota", &state, &action);
3172     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3173     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3174     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3175
3176     state = 0xdeadbee;
3177     action = 0xdeadbee;
3178     r = MsiGetComponentState(hpkg, "eta", &state, &action);
3179     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3180     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3181     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3182
3183     state = 0xdeadbee;
3184     action = 0xdeadbee;
3185     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3186     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3187     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3188     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3189
3190     state = 0xdeadbee;
3191     action = 0xdeadbee;
3192     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3193     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3194     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3195     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3196
3197     state = 0xdeadbee;
3198     action = 0xdeadbee;
3199     r = MsiGetComponentState(hpkg, "mu", &state, &action);
3200     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3201     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3202     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3203
3204     state = 0xdeadbee;
3205     action = 0xdeadbee;
3206     r = MsiGetComponentState(hpkg, "nu", &state, &action);
3207     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3208     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3209     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3210
3211     state = 0xdeadbee;
3212     action = 0xdeadbee;
3213     r = MsiGetComponentState(hpkg, "xi", &state, &action);
3214     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3215     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3216     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3217
3218     state = 0xdeadbee;
3219     action = 0xdeadbee;
3220     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3221     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3222     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3223     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3224
3225     state = 0xdeadbee;
3226     action = 0xdeadbee;
3227     r = MsiGetComponentState(hpkg, "pi", &state, &action);
3228     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3229     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3230     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3231
3232     state = 0xdeadbee;
3233     action = 0xdeadbee;
3234     r = MsiGetComponentState(hpkg, "rho", &state, &action);
3235     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3236     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3237     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3238
3239     state = 0xdeadbee;
3240     action = 0xdeadbee;
3241     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3242     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3243     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3244     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3245
3246     state = 0xdeadbee;
3247     action = 0xdeadbee;
3248     r = MsiGetComponentState(hpkg, "tau", &state, &action);
3249     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3250     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3251     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3252
3253     state = 0xdeadbee;
3254     action = 0xdeadbee;
3255     r = MsiGetComponentState(hpkg, "phi", &state, &action);
3256     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3257     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3258     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3259
3260     state = 0xdeadbee;
3261     action = 0xdeadbee;
3262     r = MsiGetComponentState(hpkg, "chi", &state, &action);
3263     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3264     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3265     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3266
3267     r = MsiDoAction( hpkg, "CostFinalize");
3268     ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3269
3270     state = 0xdeadbee;
3271     action = 0xdeadbee;
3272     r = MsiGetFeatureState(hpkg, "one", &state, &action);
3273     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3274     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3275     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3276
3277     state = 0xdeadbee;
3278     action = 0xdeadbee;
3279     r = MsiGetFeatureState(hpkg, "two", &state, &action);
3280     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3281     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3282     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3283
3284     state = 0xdeadbee;
3285     action = 0xdeadbee;
3286     r = MsiGetFeatureState(hpkg, "three", &state, &action);
3287     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3288     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3289     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3290
3291     state = 0xdeadbee;
3292     action = 0xdeadbee;
3293     r = MsiGetFeatureState(hpkg, "four", &state, &action);
3294     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3295     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3296     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3297
3298     state = 0xdeadbee;
3299     action = 0xdeadbee;
3300     r = MsiGetFeatureState(hpkg, "five", &state, &action);
3301     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3302     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3303     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3304
3305     state = 0xdeadbee;
3306     action = 0xdeadbee;
3307     r = MsiGetFeatureState(hpkg, "six", &state, &action);
3308     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3309     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3310     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3311
3312     state = 0xdeadbee;
3313     action = 0xdeadbee;
3314     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3315     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3316     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3317     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3318
3319     state = 0xdeadbee;
3320     action = 0xdeadbee;
3321     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3322     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3323     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3324     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3325
3326     state = 0xdeadbee;
3327     action = 0xdeadbee;
3328     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3329     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3330     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3331     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3332
3333     state = 0xdeadbee;
3334     action = 0xdeadbee;
3335     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3336     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3337     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3338     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3339
3340     state = 0xdeadbee;
3341     action = 0xdeadbee;
3342     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3343     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3344     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3345     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3346
3347     state = 0xdeadbee;
3348     action = 0xdeadbee;
3349     r = MsiGetComponentState(hpkg, "beta", &state, &action);
3350     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3351     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3352     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3353
3354     state = 0xdeadbee;
3355     action = 0xdeadbee;
3356     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3357     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3358     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3359     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3360
3361     state = 0xdeadbee;
3362     action = 0xdeadbee;
3363     r = MsiGetComponentState(hpkg, "theta", &state, &action);
3364     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3365     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3366     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3367
3368     state = 0xdeadbee;
3369     action = 0xdeadbee;
3370     r = MsiGetComponentState(hpkg, "delta", &state, &action);
3371     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3372     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3373     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3374
3375     state = 0xdeadbee;
3376     action = 0xdeadbee;
3377     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3378     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3379     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3380     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3381
3382     state = 0xdeadbee;
3383     action = 0xdeadbee;
3384     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3385     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3386     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3387     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3388
3389     state = 0xdeadbee;
3390     action = 0xdeadbee;
3391     r = MsiGetComponentState(hpkg, "iota", &state, &action);
3392     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3393     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3394     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3395
3396     state = 0xdeadbee;
3397     action = 0xdeadbee;
3398     r = MsiGetComponentState(hpkg, "eta", &state, &action);
3399     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3400     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3401     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3402
3403     state = 0xdeadbee;
3404     action = 0xdeadbee;
3405     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3406     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3407     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3408     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3409
3410     state = 0xdeadbee;
3411     action = 0xdeadbee;
3412     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3413     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3414     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3415     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3416
3417     state = 0xdeadbee;
3418     action = 0xdeadbee;
3419     r = MsiGetComponentState(hpkg, "mu", &state, &action);
3420     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3421     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3422     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3423
3424     state = 0xdeadbee;
3425     action = 0xdeadbee;
3426     r = MsiGetComponentState(hpkg, "nu", &state, &action);
3427     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3428     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3429     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3430
3431     state = 0xdeadbee;
3432     action = 0xdeadbee;
3433     r = MsiGetComponentState(hpkg, "xi", &state, &action);
3434     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3435     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3436     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3437
3438     state = 0xdeadbee;
3439     action = 0xdeadbee;
3440     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3441     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3442     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3443     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3444
3445     state = 0xdeadbee;
3446     action = 0xdeadbee;
3447     r = MsiGetComponentState(hpkg, "pi", &state, &action);
3448     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3449     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3450     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3451
3452     state = 0xdeadbee;
3453     action = 0xdeadbee;
3454     r = MsiGetComponentState(hpkg, "rho", &state, &action);
3455     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3456     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3457     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3458
3459     state = 0xdeadbee;
3460     action = 0xdeadbee;
3461     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3462     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3463     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3464     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3465
3466     state = 0xdeadbee;
3467     action = 0xdeadbee;
3468     r = MsiGetComponentState(hpkg, "tau", &state, &action);
3469     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3470     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3471     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3472
3473     state = 0xdeadbee;
3474     action = 0xdeadbee;
3475     r = MsiGetComponentState(hpkg, "phi", &state, &action);
3476     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3477     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3478     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3479
3480     state = 0xdeadbee;
3481     action = 0xdeadbee;
3482     r = MsiGetComponentState(hpkg, "chi", &state, &action);
3483     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3484     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3485     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3486
3487     MsiCloseHandle( hpkg );
3488
3489     /* publish the features and components */
3490     r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven REINSTALL=eight,nine,ten");
3491     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3492
3493     r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
3494     ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
3495
3496     /* these properties must not be in the saved msi file */
3497     r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
3498     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3499
3500     r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
3501     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3502
3503     r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
3504     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3505
3506     r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
3507     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3508
3509     hpkg = package_from_db( hdb );
3510     ok( hpkg, "failed to create package\n");
3511
3512     MsiCloseHandle(hdb);
3513
3514     state = 0xdeadbee;
3515     action = 0xdeadbee;
3516     r = MsiGetFeatureState(hpkg, "one", &state, &action);
3517     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3518     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3519     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3520
3521     state = 0xdeadbee;
3522     action = 0xdeadbee;
3523     r = MsiGetFeatureState(hpkg, "two", &state, &action);
3524     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3525     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3526     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3527
3528     state = 0xdeadbee;
3529     action = 0xdeadbee;
3530     r = MsiGetFeatureState(hpkg, "three", &state, &action);
3531     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3532     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3533     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3534
3535     state = 0xdeadbee;
3536     action = 0xdeadbee;
3537     r = MsiGetFeatureState(hpkg, "four", &state, &action);
3538     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3539     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3540     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3541
3542     state = 0xdeadbee;
3543     action = 0xdeadbee;
3544     r = MsiGetFeatureState(hpkg, "five", &state, &action);
3545     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3546     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3547     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3548
3549     state = 0xdeadbee;
3550     action = 0xdeadbee;
3551     r = MsiGetFeatureState(hpkg, "six", &state, &action);
3552     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3553     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3554     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3555
3556     state = 0xdeadbee;
3557     action = 0xdeadbee;
3558     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3559     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3560     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3561     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3562
3563     state = 0xdeadbee;
3564     action = 0xdeadbee;
3565     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3566     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3567     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3568     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3569
3570     state = 0xdeadbee;
3571     action = 0xdeadbee;
3572     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3573     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3574     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3575     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3576
3577     state = 0xdeadbee;
3578     action = 0xdeadbee;
3579     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3580     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3581     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3582     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3583
3584     state = 0xdeadbee;
3585     action = 0xdeadbee;
3586     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3587     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3588     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3589     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3590
3591     state = 0xdeadbee;
3592     action = 0xdeadbee;
3593     r = MsiGetComponentState(hpkg, "beta", &state, &action);
3594     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3595     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3596     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3597
3598     state = 0xdeadbee;
3599     action = 0xdeadbee;
3600     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3601     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3602     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3603     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3604
3605     state = 0xdeadbee;
3606     action = 0xdeadbee;
3607     r = MsiGetComponentState(hpkg, "theta", &state, &action);
3608     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3609     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3610     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3611
3612     state = 0xdeadbee;
3613     action = 0xdeadbee;
3614     r = MsiGetComponentState(hpkg, "delta", &state, &action);
3615     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3616     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3617     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3618
3619     state = 0xdeadbee;
3620     action = 0xdeadbee;
3621     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3622     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3623     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3624     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3625
3626     state = 0xdeadbee;
3627     action = 0xdeadbee;
3628     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3629     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3630     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3631     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3632
3633     state = 0xdeadbee;
3634     action = 0xdeadbee;
3635     r = MsiGetComponentState(hpkg, "iota", &state, &action);
3636     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3637     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3638     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3639
3640     state = 0xdeadbee;
3641     action = 0xdeadbee;
3642     r = MsiGetComponentState(hpkg, "eta", &state, &action);
3643     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3644     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3645     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3646
3647     state = 0xdeadbee;
3648     action = 0xdeadbee;
3649     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3650     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3651     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3652     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3653
3654     state = 0xdeadbee;
3655     action = 0xdeadbee;
3656     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3657     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3658     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3659     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3660
3661     state = 0xdeadbee;
3662     action = 0xdeadbee;
3663     r = MsiGetComponentState(hpkg, "mu", &state, &action);
3664     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3665     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3666     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3667
3668     state = 0xdeadbee;
3669     action = 0xdeadbee;
3670     r = MsiGetComponentState(hpkg, "nu", &state, &action);
3671     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3672     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3673     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3674
3675     state = 0xdeadbee;
3676     action = 0xdeadbee;
3677     r = MsiGetComponentState(hpkg, "xi", &state, &action);
3678     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3679     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3680     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3681
3682     state = 0xdeadbee;
3683     action = 0xdeadbee;
3684     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3685     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3686     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3687     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3688
3689     state = 0xdeadbee;
3690     action = 0xdeadbee;
3691     r = MsiGetComponentState(hpkg, "pi", &state, &action);
3692     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3693     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3694     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3695
3696     state = 0xdeadbee;
3697     action = 0xdeadbee;
3698     r = MsiGetComponentState(hpkg, "rho", &state, &action);
3699     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3700     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3701     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3702
3703     state = 0xdeadbee;
3704     action = 0xdeadbee;
3705     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3706     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3707     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3708     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3709
3710     state = 0xdeadbee;
3711     action = 0xdeadbee;
3712     r = MsiGetComponentState(hpkg, "tau", &state, &action);
3713     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3714     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3715     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3716
3717     state = 0xdeadbee;
3718     action = 0xdeadbee;
3719     r = MsiGetComponentState(hpkg, "phi", &state, &action);
3720     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3721     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3722     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3723
3724     state = 0xdeadbee;
3725     action = 0xdeadbee;
3726     r = MsiGetComponentState(hpkg, "chi", &state, &action);
3727     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3728     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3729     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3730
3731     r = MsiDoAction( hpkg, "CostInitialize");
3732     ok( r == ERROR_SUCCESS, "cost init failed\n");
3733
3734     state = 0xdeadbee;
3735     action = 0xdeadbee;
3736     r = MsiGetFeatureState(hpkg, "one", &state, &action);
3737     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3738     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3739     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3740
3741     state = 0xdeadbee;
3742     action = 0xdeadbee;
3743     r = MsiGetFeatureState(hpkg, "two", &state, &action);
3744     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3745     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3746     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3747
3748     state = 0xdeadbee;
3749     action = 0xdeadbee;
3750     r = MsiGetFeatureState(hpkg, "three", &state, &action);
3751     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3752     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3753     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3754
3755     state = 0xdeadbee;
3756     action = 0xdeadbee;
3757     r = MsiGetFeatureState(hpkg, "four", &state, &action);
3758     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3759     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3760     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3761
3762     state = 0xdeadbee;
3763     action = 0xdeadbee;
3764     r = MsiGetFeatureState(hpkg, "five", &state, &action);
3765     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3766     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3767     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3768
3769     state = 0xdeadbee;
3770     action = 0xdeadbee;
3771     r = MsiGetFeatureState(hpkg, "six", &state, &action);
3772     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3773     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3774     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3775
3776     state = 0xdeadbee;
3777     action = 0xdeadbee;
3778     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3779     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3780     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3781     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3782
3783     state = 0xdeadbee;
3784     action = 0xdeadbee;
3785     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3786     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3787     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3788     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3789
3790     state = 0xdeadbee;
3791     action = 0xdeadbee;
3792     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3793     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3794     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3795     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3796
3797     state = 0xdeadbee;
3798     action = 0xdeadbee;
3799     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3800     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3801     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3802     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3803
3804     state = 0xdeadbee;
3805     action = 0xdeadbee;
3806     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3807     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3808     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3809     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3810
3811     state = 0xdeadbee;
3812     action = 0xdeadbee;
3813     r = MsiGetComponentState(hpkg, "beta", &state, &action);
3814     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3815     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3816     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3817
3818     state = 0xdeadbee;
3819     action = 0xdeadbee;
3820     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3821     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3822     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3823     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3824
3825     state = 0xdeadbee;
3826     action = 0xdeadbee;
3827     r = MsiGetComponentState(hpkg, "theta", &state, &action);
3828     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3829     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3830     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3831
3832     state = 0xdeadbee;
3833     action = 0xdeadbee;
3834     r = MsiGetComponentState(hpkg, "delta", &state, &action);
3835     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3836     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3837     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3838
3839     state = 0xdeadbee;
3840     action = 0xdeadbee;
3841     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3842     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3843     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3844     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3845
3846     state = 0xdeadbee;
3847     action = 0xdeadbee;
3848     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3849     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3850     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3851     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3852
3853     state = 0xdeadbee;
3854     action = 0xdeadbee;
3855     r = MsiGetComponentState(hpkg, "iota", &state, &action);
3856     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3857     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3858     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3859
3860     state = 0xdeadbee;
3861     action = 0xdeadbee;
3862     r = MsiGetComponentState(hpkg, "eta", &state, &action);
3863     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3864     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3865     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3866
3867     state = 0xdeadbee;
3868     action = 0xdeadbee;
3869     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3870     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3871     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3872     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3873
3874     state = 0xdeadbee;
3875     action = 0xdeadbee;
3876     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3877     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3878     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3879     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3880
3881     state = 0xdeadbee;
3882     action = 0xdeadbee;
3883     r = MsiGetComponentState(hpkg, "mu", &state, &action);
3884     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3885     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3886     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3887
3888     state = 0xdeadbee;
3889     action = 0xdeadbee;
3890     r = MsiGetComponentState(hpkg, "nu", &state, &action);
3891     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3892     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3893     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3894
3895     state = 0xdeadbee;
3896     action = 0xdeadbee;
3897     r = MsiGetComponentState(hpkg, "xi", &state, &action);
3898     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3899     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3900     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3901
3902     state = 0xdeadbee;
3903     action = 0xdeadbee;
3904     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3905     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3906     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3907     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3908
3909     state = 0xdeadbee;
3910     action = 0xdeadbee;
3911     r = MsiGetComponentState(hpkg, "pi", &state, &action);
3912     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3913     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3914     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3915
3916     state = 0xdeadbee;
3917     action = 0xdeadbee;
3918     r = MsiGetComponentState(hpkg, "rho", &state, &action);
3919     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3920     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3921     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3922
3923     state = 0xdeadbee;
3924     action = 0xdeadbee;
3925     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3926     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3927     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3928     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3929
3930     state = 0xdeadbee;
3931     action = 0xdeadbee;
3932     r = MsiGetComponentState(hpkg, "tau", &state, &action);
3933     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3934     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3935     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3936
3937     state = 0xdeadbee;
3938     action = 0xdeadbee;
3939     r = MsiGetComponentState(hpkg, "phi", &state, &action);
3940     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3941     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3942     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3943
3944     state = 0xdeadbee;
3945     action = 0xdeadbee;
3946     r = MsiGetComponentState(hpkg, "chi", &state, &action);
3947     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3948     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3949     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3950
3951     r = MsiDoAction( hpkg, "FileCost");
3952     ok( r == ERROR_SUCCESS, "file cost failed\n");
3953
3954     state = 0xdeadbee;
3955     action = 0xdeadbee;
3956     r = MsiGetFeatureState(hpkg, "one", &state, &action);
3957     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3958     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3959     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3960
3961     state = 0xdeadbee;
3962     action = 0xdeadbee;
3963     r = MsiGetFeatureState(hpkg, "two", &state, &action);
3964     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3965     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3966     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3967
3968     state = 0xdeadbee;
3969     action = 0xdeadbee;
3970     r = MsiGetFeatureState(hpkg, "three", &state, &action);
3971     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3972     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3973     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3974
3975     state = 0xdeadbee;
3976     action = 0xdeadbee;
3977     r = MsiGetFeatureState(hpkg, "four", &state, &action);
3978     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3979     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3980     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3981
3982     state = 0xdeadbee;
3983     action = 0xdeadbee;
3984     r = MsiGetFeatureState(hpkg, "five", &state, &action);
3985     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3986     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3987     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3988
3989     state = 0xdeadbee;
3990     action = 0xdeadbee;
3991     r = MsiGetFeatureState(hpkg, "six", &state, &action);
3992     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3993     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3994     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3995
3996     state = 0xdeadbee;
3997     action = 0xdeadbee;
3998     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3999     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4000     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4001     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4002
4003     state = 0xdeadbee;
4004     action = 0xdeadbee;
4005     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4006     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4007     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4008     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4009
4010     state = 0xdeadbee;
4011     action = 0xdeadbee;
4012     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4013     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4014     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4015     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4016
4017     state = 0xdeadbee;
4018     action = 0xdeadbee;
4019     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4020     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4021     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4022     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4023
4024     state = 0xdeadbee;
4025     action = 0xdeadbee;
4026     r = MsiGetComponentState(hpkg, "beta", &state, &action);
4027     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4028     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4029     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4030
4031     state = 0xdeadbee;
4032     action = 0xdeadbee;
4033     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4034     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4035     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4036     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4037
4038     state = 0xdeadbee;
4039     action = 0xdeadbee;
4040     r = MsiGetComponentState(hpkg, "theta", &state, &action);
4041     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4042     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4043     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4044
4045     state = 0xdeadbee;
4046     action = 0xdeadbee;
4047     r = MsiGetComponentState(hpkg, "delta", &state, &action);
4048     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4049     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4050     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4051
4052     state = 0xdeadbee;
4053     action = 0xdeadbee;
4054     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4055     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4056     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4057     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4058
4059     state = 0xdeadbee;
4060     action = 0xdeadbee;
4061     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4062     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4063     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4064     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4065
4066     state = 0xdeadbee;
4067     action = 0xdeadbee;
4068     r = MsiGetComponentState(hpkg, "iota", &state, &action);
4069     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4070     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4071     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4072
4073     state = 0xdeadbee;
4074     action = 0xdeadbee;
4075     r = MsiGetComponentState(hpkg, "eta", &state, &action);
4076     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4077     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4078     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4079
4080     state = 0xdeadbee;
4081     action = 0xdeadbee;
4082     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4083     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4084     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4085     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4086
4087     state = 0xdeadbee;
4088     action = 0xdeadbee;
4089     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4090     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4091     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4092     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4093
4094     state = 0xdeadbee;
4095     action = 0xdeadbee;
4096     r = MsiGetComponentState(hpkg, "mu", &state, &action);
4097     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4098     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4099     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4100
4101     state = 0xdeadbee;
4102     action = 0xdeadbee;
4103     r = MsiGetComponentState(hpkg, "nu", &state, &action);
4104     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4105     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4106     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4107
4108     state = 0xdeadbee;
4109     action = 0xdeadbee;
4110     r = MsiGetComponentState(hpkg, "xi", &state, &action);
4111     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4112     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4113     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4114
4115     state = 0xdeadbee;
4116     action = 0xdeadbee;
4117     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4118     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4119     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4120     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4121
4122     state = 0xdeadbee;
4123     action = 0xdeadbee;
4124     r = MsiGetComponentState(hpkg, "pi", &state, &action);
4125     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4126     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4127     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4128
4129     state = 0xdeadbee;
4130     action = 0xdeadbee;
4131     r = MsiGetComponentState(hpkg, "rho", &state, &action);
4132     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4133     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4134     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4135
4136     state = 0xdeadbee;
4137     action = 0xdeadbee;
4138     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4139     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4140     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4141     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4142
4143     state = 0xdeadbee;
4144     action = 0xdeadbee;
4145     r = MsiGetComponentState(hpkg, "tau", &state, &action);
4146     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4147     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4148     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4149
4150     state = 0xdeadbee;
4151     action = 0xdeadbee;
4152     r = MsiGetComponentState(hpkg, "phi", &state, &action);
4153     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4154     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4155     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4156
4157     state = 0xdeadbee;
4158     action = 0xdeadbee;
4159     r = MsiGetComponentState(hpkg, "chi", &state, &action);
4160     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4161     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4162     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4163
4164     r = MsiDoAction( hpkg, "CostFinalize");
4165     ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
4166
4167     state = 0xdeadbee;
4168     action = 0xdeadbee;
4169     r = MsiGetFeatureState(hpkg, "one", &state, &action);
4170     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4171     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4172     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4173
4174     state = 0xdeadbee;
4175     action = 0xdeadbee;
4176     r = MsiGetFeatureState(hpkg, "two", &state, &action);
4177     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4178     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4179     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4180
4181     state = 0xdeadbee;
4182     action = 0xdeadbee;
4183     r = MsiGetFeatureState(hpkg, "three", &state, &action);
4184     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4185     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4186     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4187
4188     state = 0xdeadbee;
4189     action = 0xdeadbee;
4190     r = MsiGetFeatureState(hpkg, "four", &state, &action);
4191     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4192     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4193     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4194
4195     state = 0xdeadbee;
4196     action = 0xdeadbee;
4197     r = MsiGetFeatureState(hpkg, "five", &state, &action);
4198     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4199     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4200     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4201
4202     state = 0xdeadbee;
4203     action = 0xdeadbee;
4204     r = MsiGetFeatureState(hpkg, "six", &state, &action);
4205     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4206     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4207     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4208
4209     state = 0xdeadbee;
4210     action = 0xdeadbee;
4211     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4212     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4213     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4214     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4215
4216     state = 0xdeadbee;
4217     action = 0xdeadbee;
4218     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4219     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4220     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4221     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4222
4223     state = 0xdeadbee;
4224     action = 0xdeadbee;
4225     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4226     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4227     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4228     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4229
4230     state = 0xdeadbee;
4231     action = 0xdeadbee;
4232     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4233     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4234     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4235     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4236
4237     state = 0xdeadbee;
4238     action = 0xdeadbee;
4239     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4240     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4241     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4242     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4243
4244     state = 0xdeadbee;
4245     action = 0xdeadbee;
4246     r = MsiGetComponentState(hpkg, "beta", &state, &action);
4247     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4248     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4249     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4250
4251     state = 0xdeadbee;
4252     action = 0xdeadbee;
4253     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4254     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4255     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4256     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4257
4258     state = 0xdeadbee;
4259     action = 0xdeadbee;
4260     r = MsiGetComponentState(hpkg, "theta", &state, &action);
4261     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4262     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4263     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4264
4265     state = 0xdeadbee;
4266     action = 0xdeadbee;
4267     r = MsiGetComponentState(hpkg, "delta", &state, &action);
4268     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4269     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4270     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4271
4272     state = 0xdeadbee;
4273     action = 0xdeadbee;
4274     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4275     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4276     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4277     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4278
4279     state = 0xdeadbee;
4280     action = 0xdeadbee;
4281     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4282     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4283     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4284     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4285
4286     state = 0xdeadbee;
4287     action = 0xdeadbee;
4288     r = MsiGetComponentState(hpkg, "iota", &state, &action);
4289     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4290     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4291     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4292
4293     state = 0xdeadbee;
4294     action = 0xdeadbee;
4295     r = MsiGetComponentState(hpkg, "eta", &state, &action);
4296     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4297     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4298     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4299
4300     state = 0xdeadbee;
4301     action = 0xdeadbee;
4302     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4303     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4304     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4305     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4306
4307     state = 0xdeadbee;
4308     action = 0xdeadbee;
4309     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4310     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4311     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4312     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4313
4314     state = 0xdeadbee;
4315     action = 0xdeadbee;
4316     r = MsiGetComponentState(hpkg, "mu", &state, &action);
4317     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4318     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4319     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4320
4321     state = 0xdeadbee;
4322     action = 0xdeadbee;
4323     r = MsiGetComponentState(hpkg, "nu", &state, &action);
4324     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4325     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4326     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4327
4328     state = 0xdeadbee;
4329     action = 0xdeadbee;
4330     r = MsiGetComponentState(hpkg, "xi", &state, &action);
4331     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4332     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4333     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4334
4335     state = 0xdeadbee;
4336     action = 0xdeadbee;
4337     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4338     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4339     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4340     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4341
4342     state = 0xdeadbee;
4343     action = 0xdeadbee;
4344     r = MsiGetComponentState(hpkg, "pi", &state, &action);
4345     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4346     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4347     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4348
4349     state = 0xdeadbee;
4350     action = 0xdeadbee;
4351     r = MsiGetComponentState(hpkg, "rho", &state, &action);
4352     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4353     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4354     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4355
4356     state = 0xdeadbee;
4357     action = 0xdeadbee;
4358     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4359     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4360     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4361     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4362
4363     state = 0xdeadbee;
4364     action = 0xdeadbee;
4365     r = MsiGetComponentState(hpkg, "tau", &state, &action);
4366     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4367     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4368     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4369
4370     state = 0xdeadbee;
4371     action = 0xdeadbee;
4372     r = MsiGetComponentState(hpkg, "phi", &state, &action);
4373     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4374     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4375     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4376
4377     state = 0xdeadbee;
4378     action = 0xdeadbee;
4379     r = MsiGetComponentState(hpkg, "chi", &state, &action);
4380     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4381     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4382     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4383
4384     MsiCloseHandle(hpkg);
4385
4386     /* uninstall the product */
4387     r = MsiInstallProduct(msifile, "REMOVE=ALL");
4388     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4389
4390     /* all features installed locally */
4391     r = MsiInstallProduct(msifile2, "ADDLOCAL=ALL");
4392     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4393
4394     r = MsiOpenDatabase(msifile2, MSIDBOPEN_DIRECT, &hdb);
4395     ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
4396
4397     /* these properties must not be in the saved msi file */
4398     r = add_property_entry( hdb, "'ADDLOCAL', 'one,two,three,four,five,six,seven,eight,nine,ten'");
4399     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
4400
4401     hpkg = package_from_db( hdb );
4402     ok( hpkg, "failed to create package\n");
4403
4404     state = 0xdeadbee;
4405     action = 0xdeadbee;
4406     r = MsiGetFeatureState(hpkg, "one", &state, &action);
4407     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4408     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4409     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4410
4411     state = 0xdeadbee;
4412     action = 0xdeadbee;
4413     r = MsiGetFeatureState(hpkg, "two", &state, &action);
4414     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4415     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4416     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4417
4418     state = 0xdeadbee;
4419     action = 0xdeadbee;
4420     r = MsiGetFeatureState(hpkg, "three", &state, &action);
4421     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4422     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4423     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4424
4425     state = 0xdeadbee;
4426     action = 0xdeadbee;
4427     r = MsiGetFeatureState(hpkg, "four", &state, &action);
4428     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4429     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4430     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4431
4432     state = 0xdeadbee;
4433     action = 0xdeadbee;
4434     r = MsiGetFeatureState(hpkg, "five", &state, &action);
4435     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4436     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4437     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4438
4439     state = 0xdeadbee;
4440     action = 0xdeadbee;
4441     r = MsiGetFeatureState(hpkg, "six", &state, &action);
4442     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4443     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4444     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4445
4446     state = 0xdeadbee;
4447     action = 0xdeadbee;
4448     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4449     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4450     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4451     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4452
4453     state = 0xdeadbee;
4454     action = 0xdeadbee;
4455     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4456     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4457     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4458     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4459
4460     state = 0xdeadbee;
4461     action = 0xdeadbee;
4462     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4463     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4464     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4465     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4466
4467     state = 0xdeadbee;
4468     action = 0xdeadbee;
4469     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4470     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4471     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4472     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4473
4474     state = 0xdeadbee;
4475     action = 0xdeadbee;
4476     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4477     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4478     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4479     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4480
4481     state = 0xdeadbee;
4482     action = 0xdeadbee;
4483     r = MsiGetComponentState(hpkg, "beta", &state, &action);
4484     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4485     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4486     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4487
4488     state = 0xdeadbee;
4489     action = 0xdeadbee;
4490     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4491     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4492     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4493     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4494
4495     state = 0xdeadbee;
4496     action = 0xdeadbee;
4497     r = MsiGetComponentState(hpkg, "theta", &state, &action);
4498     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4499     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4500     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4501
4502     state = 0xdeadbee;
4503     action = 0xdeadbee;
4504     r = MsiGetComponentState(hpkg, "delta", &state, &action);
4505     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4506     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4507     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4508
4509     state = 0xdeadbee;
4510     action = 0xdeadbee;
4511     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4512     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4513     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4514     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4515
4516     state = 0xdeadbee;
4517     action = 0xdeadbee;
4518     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4519     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4520     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4521     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4522
4523     state = 0xdeadbee;
4524     action = 0xdeadbee;
4525     r = MsiGetComponentState(hpkg, "iota", &state, &action);
4526     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4527     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4528     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4529
4530     state = 0xdeadbee;
4531     action = 0xdeadbee;
4532     r = MsiGetComponentState(hpkg, "eta", &state, &action);
4533     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4534     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4535     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4536
4537     state = 0xdeadbee;
4538     action = 0xdeadbee;
4539     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4540     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4541     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4542     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4543
4544     state = 0xdeadbee;
4545     action = 0xdeadbee;
4546     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4547     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4548     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4549     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4550
4551     state = 0xdeadbee;
4552     action = 0xdeadbee;
4553     r = MsiGetComponentState(hpkg, "mu", &state, &action);
4554     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4555     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4556     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4557
4558     state = 0xdeadbee;
4559     action = 0xdeadbee;
4560     r = MsiGetComponentState(hpkg, "nu", &state, &action);
4561     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4562     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4563     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4564
4565     state = 0xdeadbee;
4566     action = 0xdeadbee;
4567     r = MsiGetComponentState(hpkg, "xi", &state, &action);
4568     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4569     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4570     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4571
4572     state = 0xdeadbee;
4573     action = 0xdeadbee;
4574     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4575     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4576     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4577     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4578
4579     state = 0xdeadbee;
4580     action = 0xdeadbee;
4581     r = MsiGetComponentState(hpkg, "pi", &state, &action);
4582     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4583     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4584     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4585
4586     state = 0xdeadbee;
4587     action = 0xdeadbee;
4588     r = MsiGetComponentState(hpkg, "rho", &state, &action);
4589     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4590     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4591     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4592
4593     state = 0xdeadbee;
4594     action = 0xdeadbee;
4595     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4596     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4597     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4598     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4599
4600     state = 0xdeadbee;
4601     action = 0xdeadbee;
4602     r = MsiGetComponentState(hpkg, "tau", &state, &action);
4603     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4604     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4605     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4606
4607     state = 0xdeadbee;
4608     action = 0xdeadbee;
4609     r = MsiGetComponentState(hpkg, "phi", &state, &action);
4610     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4611     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4612     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4613
4614     state = 0xdeadbee;
4615     action = 0xdeadbee;
4616     r = MsiGetComponentState(hpkg, "chi", &state, &action);
4617     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4618     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4619     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4620
4621     r = MsiDoAction( hpkg, "CostInitialize");
4622     ok( r == ERROR_SUCCESS, "cost init failed\n");
4623
4624     state = 0xdeadbee;
4625     action = 0xdeadbee;
4626     r = MsiGetFeatureState(hpkg, "one", &state, &action);
4627     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4628     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4629     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4630
4631     state = 0xdeadbee;
4632     action = 0xdeadbee;
4633     r = MsiGetFeatureState(hpkg, "two", &state, &action);
4634     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4635     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4636     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4637
4638     state = 0xdeadbee;
4639     action = 0xdeadbee;
4640     r = MsiGetFeatureState(hpkg, "three", &state, &action);
4641     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4642     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4643     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4644
4645     state = 0xdeadbee;
4646     action = 0xdeadbee;
4647     r = MsiGetFeatureState(hpkg, "four", &state, &action);
4648     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4649     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4650     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4651
4652     state = 0xdeadbee;
4653     action = 0xdeadbee;
4654     r = MsiGetFeatureState(hpkg, "five", &state, &action);
4655     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4656     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4657     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4658
4659     state = 0xdeadbee;
4660     action = 0xdeadbee;
4661     r = MsiGetFeatureState(hpkg, "six", &state, &action);
4662     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4663     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4664     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4665
4666     state = 0xdeadbee;
4667     action = 0xdeadbee;
4668     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4669     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4670     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4671     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4672
4673     state = 0xdeadbee;
4674     action = 0xdeadbee;
4675     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4676     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4677     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4678     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4679
4680     state = 0xdeadbee;
4681     action = 0xdeadbee;
4682     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4683     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4684     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4685     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4686
4687     state = 0xdeadbee;
4688     action = 0xdeadbee;
4689     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4690     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4691     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4692     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4693
4694     state = 0xdeadbee;
4695     action = 0xdeadbee;
4696     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4697     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4698     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4699     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4700
4701     state = 0xdeadbee;
4702     action = 0xdeadbee;
4703     r = MsiGetComponentState(hpkg, "beta", &state, &action);
4704     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4705     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4706     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4707
4708     state = 0xdeadbee;
4709     action = 0xdeadbee;
4710     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4711     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4712     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4713     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4714
4715     state = 0xdeadbee;
4716     action = 0xdeadbee;
4717     r = MsiGetComponentState(hpkg, "theta", &state, &action);
4718     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4719     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4720     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4721
4722     state = 0xdeadbee;
4723     action = 0xdeadbee;
4724     r = MsiGetComponentState(hpkg, "delta", &state, &action);
4725     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4726     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4727     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4728
4729     state = 0xdeadbee;
4730     action = 0xdeadbee;
4731     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4732     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4733     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4734     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4735
4736     state = 0xdeadbee;
4737     action = 0xdeadbee;
4738     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4739     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4740     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4741     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4742
4743     state = 0xdeadbee;
4744     action = 0xdeadbee;
4745     r = MsiGetComponentState(hpkg, "iota", &state, &action);
4746     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4747     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4748     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4749
4750     state = 0xdeadbee;
4751     action = 0xdeadbee;
4752     r = MsiGetComponentState(hpkg, "eta", &state, &action);
4753     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4754     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4755     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4756
4757     state = 0xdeadbee;
4758     action = 0xdeadbee;
4759     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4760     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4761     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4762     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4763
4764     state = 0xdeadbee;
4765     action = 0xdeadbee;
4766     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4767     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4768     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4769     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4770
4771     state = 0xdeadbee;
4772     action = 0xdeadbee;
4773     r = MsiGetComponentState(hpkg, "mu", &state, &action);
4774     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4775     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4776     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4777
4778     state = 0xdeadbee;
4779     action = 0xdeadbee;
4780     r = MsiGetComponentState(hpkg, "nu", &state, &action);
4781     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4782     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4783     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4784
4785     state = 0xdeadbee;
4786     action = 0xdeadbee;
4787     r = MsiGetComponentState(hpkg, "xi", &state, &action);
4788     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4789     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4790     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4791
4792     state = 0xdeadbee;
4793     action = 0xdeadbee;
4794     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4795     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4796     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4797     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4798
4799     state = 0xdeadbee;
4800     action = 0xdeadbee;
4801     r = MsiGetComponentState(hpkg, "pi", &state, &action);
4802     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4803     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4804     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4805
4806     state = 0xdeadbee;
4807     action = 0xdeadbee;
4808     r = MsiGetComponentState(hpkg, "rho", &state, &action);
4809     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4810     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4811     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4812
4813     state = 0xdeadbee;
4814     action = 0xdeadbee;
4815     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4816     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4817     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4818     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4819
4820     state = 0xdeadbee;
4821     action = 0xdeadbee;
4822     r = MsiGetComponentState(hpkg, "tau", &state, &action);
4823     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4824     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4825     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4826
4827     state = 0xdeadbee;
4828     action = 0xdeadbee;
4829     r = MsiGetComponentState(hpkg, "phi", &state, &action);
4830     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4831     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4832     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4833
4834     state = 0xdeadbee;
4835     action = 0xdeadbee;
4836     r = MsiGetComponentState(hpkg, "chi", &state, &action);
4837     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4838     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4839     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4840
4841     r = MsiDoAction( hpkg, "FileCost");
4842     ok( r == ERROR_SUCCESS, "file cost failed\n");
4843
4844     state = 0xdeadbee;
4845     action = 0xdeadbee;
4846     r = MsiGetFeatureState(hpkg, "one", &state, &action);
4847     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4848     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4849     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4850
4851     state = 0xdeadbee;
4852     action = 0xdeadbee;
4853     r = MsiGetFeatureState(hpkg, "two", &state, &action);
4854     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4855     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4856     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4857
4858     state = 0xdeadbee;
4859     action = 0xdeadbee;
4860     r = MsiGetFeatureState(hpkg, "three", &state, &action);
4861     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4862     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4863     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4864
4865     state = 0xdeadbee;
4866     action = 0xdeadbee;
4867     r = MsiGetFeatureState(hpkg, "four", &state, &action);
4868     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4869     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4870     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4871
4872     state = 0xdeadbee;
4873     action = 0xdeadbee;
4874     r = MsiGetFeatureState(hpkg, "five", &state, &action);
4875     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4876     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4877     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4878
4879     state = 0xdeadbee;
4880     action = 0xdeadbee;
4881     r = MsiGetFeatureState(hpkg, "six", &state, &action);
4882     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4883     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4884     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4885
4886     state = 0xdeadbee;
4887     action = 0xdeadbee;
4888     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4889     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4890     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4891     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4892
4893     state = 0xdeadbee;
4894     action = 0xdeadbee;
4895     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4896     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4897     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4898     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4899
4900     state = 0xdeadbee;
4901     action = 0xdeadbee;
4902     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4903     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4904     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4905     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4906
4907     state = 0xdeadbee;
4908     action = 0xdeadbee;
4909     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4910     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4911     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4912     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4913
4914     state = 0xdeadbee;
4915     action = 0xdeadbee;
4916     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4917     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4918     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4919     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4920
4921     state = 0xdeadbee;
4922     action = 0xdeadbee;
4923     r = MsiGetComponentState(hpkg, "beta", &state, &action);
4924     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4925     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4926     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4927
4928     state = 0xdeadbee;
4929     action = 0xdeadbee;
4930     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4931     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4932     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4933     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4934
4935     state = 0xdeadbee;
4936     action = 0xdeadbee;
4937     r = MsiGetComponentState(hpkg, "theta", &state, &action);
4938     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4939     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4940     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4941
4942     state = 0xdeadbee;
4943     action = 0xdeadbee;
4944     r = MsiGetComponentState(hpkg, "delta", &state, &action);
4945     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4946     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4947     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4948
4949     state = 0xdeadbee;
4950     action = 0xdeadbee;
4951     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4952     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4953     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4954     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4955
4956     state = 0xdeadbee;
4957     action = 0xdeadbee;
4958     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4959     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4960     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4961     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4962
4963     state = 0xdeadbee;
4964     action = 0xdeadbee;
4965     r = MsiGetComponentState(hpkg, "iota", &state, &action);
4966     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4967     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4968     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4969
4970     state = 0xdeadbee;
4971     action = 0xdeadbee;
4972     r = MsiGetComponentState(hpkg, "eta", &state, &action);
4973     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4974     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4975     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4976
4977     state = 0xdeadbee;
4978     action = 0xdeadbee;
4979     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4980     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4981     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4982     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4983
4984     state = 0xdeadbee;
4985     action = 0xdeadbee;
4986     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4987     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4988     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4989     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4990
4991     state = 0xdeadbee;
4992     action = 0xdeadbee;
4993     r = MsiGetComponentState(hpkg, "mu", &state, &action);
4994     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4995     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4996     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4997
4998     state = 0xdeadbee;
4999     action = 0xdeadbee;
5000     r = MsiGetComponentState(hpkg, "nu", &state, &action);
5001     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5002     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5003     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5004
5005     state = 0xdeadbee;
5006     action = 0xdeadbee;
5007     r = MsiGetComponentState(hpkg, "xi", &state, &action);
5008     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5009     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5010     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5011
5012     state = 0xdeadbee;
5013     action = 0xdeadbee;
5014     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5015     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5016     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5017     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5018
5019     state = 0xdeadbee;
5020     action = 0xdeadbee;
5021     r = MsiGetComponentState(hpkg, "pi", &state, &action);
5022     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5023     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5024     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5025
5026     state = 0xdeadbee;
5027     action = 0xdeadbee;
5028     r = MsiGetComponentState(hpkg, "rho", &state, &action);
5029     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5030     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5031     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5032
5033     state = 0xdeadbee;
5034     action = 0xdeadbee;
5035     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5036     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5037     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5038     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5039
5040     state = 0xdeadbee;
5041     action = 0xdeadbee;
5042     r = MsiGetComponentState(hpkg, "tau", &state, &action);
5043     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5044     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5045     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5046
5047     state = 0xdeadbee;
5048     action = 0xdeadbee;
5049     r = MsiGetComponentState(hpkg, "phi", &state, &action);
5050     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5051     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5052     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5053
5054     state = 0xdeadbee;
5055     action = 0xdeadbee;
5056     r = MsiGetComponentState(hpkg, "chi", &state, &action);
5057     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5058     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5059     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5060
5061     r = MsiDoAction( hpkg, "CostFinalize");
5062     ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
5063
5064     state = 0xdeadbee;
5065     action = 0xdeadbee;
5066     r = MsiGetFeatureState(hpkg, "one", &state, &action);
5067     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5068     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5069     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5070
5071     state = 0xdeadbee;
5072     action = 0xdeadbee;
5073     r = MsiGetFeatureState(hpkg, "two", &state, &action);
5074     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5075     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5076     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5077
5078     state = 0xdeadbee;
5079     action = 0xdeadbee;
5080     r = MsiGetFeatureState(hpkg, "three", &state, &action);
5081     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5082     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5083     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5084
5085     state = 0xdeadbee;
5086     action = 0xdeadbee;
5087     r = MsiGetFeatureState(hpkg, "four", &state, &action);
5088     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5089     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5090     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5091
5092     state = 0xdeadbee;
5093     action = 0xdeadbee;
5094     r = MsiGetFeatureState(hpkg, "five", &state, &action);
5095     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5096     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5097     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5098
5099     state = 0xdeadbee;
5100     action = 0xdeadbee;
5101     r = MsiGetFeatureState(hpkg, "six", &state, &action);
5102     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5103     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5104     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5105
5106     state = 0xdeadbee;
5107     action = 0xdeadbee;
5108     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5109     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5110     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5111     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5112
5113     state = 0xdeadbee;
5114     action = 0xdeadbee;
5115     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5116     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5117     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5118     todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5119
5120     state = 0xdeadbee;
5121     action = 0xdeadbee;
5122     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5123     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5124     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5125     todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5126
5127     state = 0xdeadbee;
5128     action = 0xdeadbee;
5129     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5130     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5131     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5132     todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5133
5134     state = 0xdeadbee;
5135     action = 0xdeadbee;
5136     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5137     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5138     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5139     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5140
5141     state = 0xdeadbee;
5142     action = 0xdeadbee;
5143     r = MsiGetComponentState(hpkg, "beta", &state, &action);
5144     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5145     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5146     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5147
5148     state = 0xdeadbee;
5149     action = 0xdeadbee;
5150     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5151     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5152     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5153     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5154
5155     state = 0xdeadbee;
5156     action = 0xdeadbee;
5157     r = MsiGetComponentState(hpkg, "theta", &state, &action);
5158     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5159     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5160     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5161
5162     state = 0xdeadbee;
5163     action = 0xdeadbee;
5164     r = MsiGetComponentState(hpkg, "delta", &state, &action);
5165     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5166     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5167     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5168
5169     state = 0xdeadbee;
5170     action = 0xdeadbee;
5171     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5172     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5173     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5174     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5175
5176     state = 0xdeadbee;
5177     action = 0xdeadbee;
5178     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5179     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5180     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5181     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5182
5183     state = 0xdeadbee;
5184     action = 0xdeadbee;
5185     r = MsiGetComponentState(hpkg, "iota", &state, &action);
5186     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5187     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5188     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5189
5190     state = 0xdeadbee;
5191     action = 0xdeadbee;
5192     r = MsiGetComponentState(hpkg, "eta", &state, &action);
5193     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5194     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5195     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5196
5197     state = 0xdeadbee;
5198     action = 0xdeadbee;
5199     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5200     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5201     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5202     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5203
5204     state = 0xdeadbee;
5205     action = 0xdeadbee;
5206     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5207     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5208     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5209     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5210
5211     state = 0xdeadbee;
5212     action = 0xdeadbee;
5213     r = MsiGetComponentState(hpkg, "mu", &state, &action);
5214     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5215     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5216     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5217
5218     state = 0xdeadbee;
5219     action = 0xdeadbee;
5220     r = MsiGetComponentState(hpkg, "nu", &state, &action);
5221     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5222     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5223     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5224
5225     state = 0xdeadbee;
5226     action = 0xdeadbee;
5227     r = MsiGetComponentState(hpkg, "xi", &state, &action);
5228     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5229     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5230     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5231
5232     state = 0xdeadbee;
5233     action = 0xdeadbee;
5234     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5235     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5236     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5237     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5238
5239     state = 0xdeadbee;
5240     action = 0xdeadbee;
5241     r = MsiGetComponentState(hpkg, "pi", &state, &action);
5242     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5243     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5244     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5245
5246     state = 0xdeadbee;
5247     action = 0xdeadbee;
5248     r = MsiGetComponentState(hpkg, "rho", &state, &action);
5249     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5250     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5251     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5252
5253     state = 0xdeadbee;
5254     action = 0xdeadbee;
5255     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5256     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5257     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5258     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5259
5260     state = 0xdeadbee;
5261     action = 0xdeadbee;
5262     r = MsiGetComponentState(hpkg, "tau", &state, &action);
5263     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5264     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5265     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5266
5267     state = 0xdeadbee;
5268     action = 0xdeadbee;
5269     r = MsiGetComponentState(hpkg, "phi", &state, &action);
5270     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5271     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5272     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5273
5274     state = 0xdeadbee;
5275     action = 0xdeadbee;
5276     r = MsiGetComponentState(hpkg, "chi", &state, &action);
5277     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5278     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5279     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5280
5281     MsiCloseHandle(hpkg);
5282
5283     /* uninstall the product */
5284     r = MsiInstallProduct(msifile2, "REMOVE=ALL");
5285     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5286
5287     /* all features installed from source */
5288     r = MsiInstallProduct(msifile3, "ADDSOURCE=ALL");
5289     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5290
5291     r = MsiOpenDatabase(msifile3, MSIDBOPEN_DIRECT, &hdb);
5292     ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
5293
5294     /* this property must not be in the saved msi file */
5295     r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
5296     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
5297
5298     hpkg = package_from_db( hdb );
5299     ok( hpkg, "failed to create package\n");
5300
5301     state = 0xdeadbee;
5302     action = 0xdeadbee;
5303     r = MsiGetFeatureState(hpkg, "one", &state, &action);
5304     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5305     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5306     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5307
5308     state = 0xdeadbee;
5309     action = 0xdeadbee;
5310     r = MsiGetFeatureState(hpkg, "two", &state, &action);
5311     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5312     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5313     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5314
5315     state = 0xdeadbee;
5316     action = 0xdeadbee;
5317     r = MsiGetFeatureState(hpkg, "three", &state, &action);
5318     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5319     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5320     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5321
5322     state = 0xdeadbee;
5323     action = 0xdeadbee;
5324     r = MsiGetFeatureState(hpkg, "four", &state, &action);
5325     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5326     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5327     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5328
5329     state = 0xdeadbee;
5330     action = 0xdeadbee;
5331     r = MsiGetFeatureState(hpkg, "five", &state, &action);
5332     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5333     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5334     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5335
5336     state = 0xdeadbee;
5337     action = 0xdeadbee;
5338     r = MsiGetFeatureState(hpkg, "six", &state, &action);
5339     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5340     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5341     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5342
5343     state = 0xdeadbee;
5344     action = 0xdeadbee;
5345     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5346     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5347     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5348     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5349
5350     state = 0xdeadbee;
5351     action = 0xdeadbee;
5352     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5353     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5354     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5355     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5356
5357     state = 0xdeadbee;
5358     action = 0xdeadbee;
5359     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5360     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5361     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5362     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5363
5364     state = 0xdeadbee;
5365     action = 0xdeadbee;
5366     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5367     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5368     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5369     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5370
5371     state = 0xdeadbee;
5372     action = 0xdeadbee;
5373     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5374     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5375     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5376     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5377
5378     state = 0xdeadbee;
5379     action = 0xdeadbee;
5380     r = MsiGetComponentState(hpkg, "beta", &state, &action);
5381     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5382     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5383     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5384
5385     state = 0xdeadbee;
5386     action = 0xdeadbee;
5387     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5388     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5389     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5390     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5391
5392     state = 0xdeadbee;
5393     action = 0xdeadbee;
5394     r = MsiGetComponentState(hpkg, "theta", &state, &action);
5395     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5396     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5397     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5398
5399     state = 0xdeadbee;
5400     action = 0xdeadbee;
5401     r = MsiGetComponentState(hpkg, "delta", &state, &action);
5402     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5403     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5404     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5405
5406     state = 0xdeadbee;
5407     action = 0xdeadbee;
5408     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5409     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5410     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5411     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5412
5413     state = 0xdeadbee;
5414     action = 0xdeadbee;
5415     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5416     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5417     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5418     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5419
5420     state = 0xdeadbee;
5421     action = 0xdeadbee;
5422     r = MsiGetComponentState(hpkg, "iota", &state, &action);
5423     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5424     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5425     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5426
5427     state = 0xdeadbee;
5428     action = 0xdeadbee;
5429     r = MsiGetComponentState(hpkg, "eta", &state, &action);
5430     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5431     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5432     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5433
5434     state = 0xdeadbee;
5435     action = 0xdeadbee;
5436     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5437     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5438     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5439     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5440
5441     state = 0xdeadbee;
5442     action = 0xdeadbee;
5443     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5444     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5445     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5446     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5447
5448     state = 0xdeadbee;
5449     action = 0xdeadbee;
5450     r = MsiGetComponentState(hpkg, "mu", &state, &action);
5451     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5452     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5453     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5454
5455     state = 0xdeadbee;
5456     action = 0xdeadbee;
5457     r = MsiGetComponentState(hpkg, "nu", &state, &action);
5458     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5459     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5460     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5461
5462     state = 0xdeadbee;
5463     action = 0xdeadbee;
5464     r = MsiGetComponentState(hpkg, "xi", &state, &action);
5465     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5466     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5467     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5468
5469     state = 0xdeadbee;
5470     action = 0xdeadbee;
5471     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5472     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5473     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5474     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5475
5476     state = 0xdeadbee;
5477     action = 0xdeadbee;
5478     r = MsiGetComponentState(hpkg, "pi", &state, &action);
5479     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5480     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5481     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5482
5483     state = 0xdeadbee;
5484     action = 0xdeadbee;
5485     r = MsiGetComponentState(hpkg, "rho", &state, &action);
5486     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5487     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5488     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5489
5490     state = 0xdeadbee;
5491     action = 0xdeadbee;
5492     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5493     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5494     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5495     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5496
5497     state = 0xdeadbee;
5498     action = 0xdeadbee;
5499     r = MsiGetComponentState(hpkg, "tau", &state, &action);
5500     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5501     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5502     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5503
5504     state = 0xdeadbee;
5505     action = 0xdeadbee;
5506     r = MsiGetComponentState(hpkg, "phi", &state, &action);
5507     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5508     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5509     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5510
5511     state = 0xdeadbee;
5512     action = 0xdeadbee;
5513     r = MsiGetComponentState(hpkg, "chi", &state, &action);
5514     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5515     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5516     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5517
5518     r = MsiDoAction( hpkg, "CostInitialize");
5519     ok( r == ERROR_SUCCESS, "cost init failed\n");
5520
5521     state = 0xdeadbee;
5522     action = 0xdeadbee;
5523     r = MsiGetFeatureState(hpkg, "one", &state, &action);
5524     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5525     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5526     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5527
5528     state = 0xdeadbee;
5529     action = 0xdeadbee;
5530     r = MsiGetFeatureState(hpkg, "two", &state, &action);
5531     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5532     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5533     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5534
5535     state = 0xdeadbee;
5536     action = 0xdeadbee;
5537     r = MsiGetFeatureState(hpkg, "three", &state, &action);
5538     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5539     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5540     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5541
5542     state = 0xdeadbee;
5543     action = 0xdeadbee;
5544     r = MsiGetFeatureState(hpkg, "four", &state, &action);
5545     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5546     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5547     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5548
5549     state = 0xdeadbee;
5550     action = 0xdeadbee;
5551     r = MsiGetFeatureState(hpkg, "five", &state, &action);
5552     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5553     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5554     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5555
5556     state = 0xdeadbee;
5557     action = 0xdeadbee;
5558     r = MsiGetFeatureState(hpkg, "six", &state, &action);
5559     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5560     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5561     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5562
5563     state = 0xdeadbee;
5564     action = 0xdeadbee;
5565     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5566     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5567     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5568     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5569
5570     state = 0xdeadbee;
5571     action = 0xdeadbee;
5572     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5573     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5574     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5575     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5576
5577     state = 0xdeadbee;
5578     action = 0xdeadbee;
5579     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5580     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5581     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5582     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5583
5584     state = 0xdeadbee;
5585     action = 0xdeadbee;
5586     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5587     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5588     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5589     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5590
5591     state = 0xdeadbee;
5592     action = 0xdeadbee;
5593     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5594     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5595     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5596     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5597
5598     state = 0xdeadbee;
5599     action = 0xdeadbee;
5600     r = MsiGetComponentState(hpkg, "beta", &state, &action);
5601     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5602     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5603     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5604
5605     state = 0xdeadbee;
5606     action = 0xdeadbee;
5607     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5608     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5609     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5610     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5611
5612     state = 0xdeadbee;
5613     action = 0xdeadbee;
5614     r = MsiGetComponentState(hpkg, "theta", &state, &action);
5615     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5616     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5617     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5618
5619     state = 0xdeadbee;
5620     action = 0xdeadbee;
5621     r = MsiGetComponentState(hpkg, "delta", &state, &action);
5622     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5623     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5624     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5625
5626     state = 0xdeadbee;
5627     action = 0xdeadbee;
5628     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5629     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5630     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5631     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5632
5633     state = 0xdeadbee;
5634     action = 0xdeadbee;
5635     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5636     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5637     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5638     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5639
5640     state = 0xdeadbee;
5641     action = 0xdeadbee;
5642     r = MsiGetComponentState(hpkg, "iota", &state, &action);
5643     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5644     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5645     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5646
5647     state = 0xdeadbee;
5648     action = 0xdeadbee;
5649     r = MsiGetComponentState(hpkg, "eta", &state, &action);
5650     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5651     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5652     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5653
5654     state = 0xdeadbee;
5655     action = 0xdeadbee;
5656     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5657     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5658     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5659     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5660
5661     state = 0xdeadbee;
5662     action = 0xdeadbee;
5663     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5664     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5665     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5666     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5667
5668     state = 0xdeadbee;
5669     action = 0xdeadbee;
5670     r = MsiGetComponentState(hpkg, "mu", &state, &action);
5671     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5672     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5673     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5674
5675     state = 0xdeadbee;
5676     action = 0xdeadbee;
5677     r = MsiGetComponentState(hpkg, "nu", &state, &action);
5678     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5679     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5680     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5681
5682     state = 0xdeadbee;
5683     action = 0xdeadbee;
5684     r = MsiGetComponentState(hpkg, "xi", &state, &action);
5685     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5686     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5687     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5688
5689     state = 0xdeadbee;
5690     action = 0xdeadbee;
5691     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5692     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5693     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5694     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5695
5696     state = 0xdeadbee;
5697     action = 0xdeadbee;
5698     r = MsiGetComponentState(hpkg, "pi", &state, &action);
5699     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5700     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5701     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5702
5703     state = 0xdeadbee;
5704     action = 0xdeadbee;
5705     r = MsiGetComponentState(hpkg, "rho", &state, &action);
5706     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5707     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5708     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5709
5710     state = 0xdeadbee;
5711     action = 0xdeadbee;
5712     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5713     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5714     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5715     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5716
5717     state = 0xdeadbee;
5718     action = 0xdeadbee;
5719     r = MsiGetComponentState(hpkg, "tau", &state, &action);
5720     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5721     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5722     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5723
5724     state = 0xdeadbee;
5725     action = 0xdeadbee;
5726     r = MsiGetComponentState(hpkg, "phi", &state, &action);
5727     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5728     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5729     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5730
5731     state = 0xdeadbee;
5732     action = 0xdeadbee;
5733     r = MsiGetComponentState(hpkg, "chi", &state, &action);
5734     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5735     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5736     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5737
5738     r = MsiDoAction( hpkg, "FileCost");
5739     ok( r == ERROR_SUCCESS, "file cost failed\n");
5740
5741     state = 0xdeadbee;
5742     action = 0xdeadbee;
5743     r = MsiGetFeatureState(hpkg, "one", &state, &action);
5744     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5745     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5746     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5747
5748     state = 0xdeadbee;
5749     action = 0xdeadbee;
5750     r = MsiGetFeatureState(hpkg, "two", &state, &action);
5751     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5752     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5753     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5754
5755     state = 0xdeadbee;
5756     action = 0xdeadbee;
5757     r = MsiGetFeatureState(hpkg, "three", &state, &action);
5758     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5759     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5760     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5761
5762     state = 0xdeadbee;
5763     action = 0xdeadbee;
5764     r = MsiGetFeatureState(hpkg, "four", &state, &action);
5765     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5766     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5767     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5768
5769     state = 0xdeadbee;
5770     action = 0xdeadbee;
5771     r = MsiGetFeatureState(hpkg, "five", &state, &action);
5772     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5773     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5774     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5775
5776     state = 0xdeadbee;
5777     action = 0xdeadbee;
5778     r = MsiGetFeatureState(hpkg, "six", &state, &action);
5779     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5780     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5781     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5782
5783     state = 0xdeadbee;
5784     action = 0xdeadbee;
5785     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5786     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5787     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5788     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5789
5790     state = 0xdeadbee;
5791     action = 0xdeadbee;
5792     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5793     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5794     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5795     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5796
5797     state = 0xdeadbee;
5798     action = 0xdeadbee;
5799     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5800     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5801     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5802     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5803
5804     state = 0xdeadbee;
5805     action = 0xdeadbee;
5806     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5807     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5808     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5809     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5810
5811     state = 0xdeadbee;
5812     action = 0xdeadbee;
5813     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5814     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5815     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5816     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5817
5818     state = 0xdeadbee;
5819     action = 0xdeadbee;
5820     r = MsiGetComponentState(hpkg, "beta", &state, &action);
5821     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5822     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5823     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5824
5825     state = 0xdeadbee;
5826     action = 0xdeadbee;
5827     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5828     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5829     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5830     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5831
5832     state = 0xdeadbee;
5833     action = 0xdeadbee;
5834     r = MsiGetComponentState(hpkg, "theta", &state, &action);
5835     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5836     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5837     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5838
5839     state = 0xdeadbee;
5840     action = 0xdeadbee;
5841     r = MsiGetComponentState(hpkg, "delta", &state, &action);
5842     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5843     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5844     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5845
5846     state = 0xdeadbee;
5847     action = 0xdeadbee;
5848     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5849     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5850     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5851     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5852
5853     state = 0xdeadbee;
5854     action = 0xdeadbee;
5855     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5856     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5857     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5858     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5859
5860     state = 0xdeadbee;
5861     action = 0xdeadbee;
5862     r = MsiGetComponentState(hpkg, "iota", &state, &action);
5863     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5864     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5865     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5866
5867     state = 0xdeadbee;
5868     action = 0xdeadbee;
5869     r = MsiGetComponentState(hpkg, "eta", &state, &action);
5870     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5871     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5872     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5873
5874     state = 0xdeadbee;
5875     action = 0xdeadbee;
5876     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5877     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5878     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5879     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5880
5881     state = 0xdeadbee;
5882     action = 0xdeadbee;
5883     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5884     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5885     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5886     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5887
5888     state = 0xdeadbee;
5889     action = 0xdeadbee;
5890     r = MsiGetComponentState(hpkg, "mu", &state, &action);
5891     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5892     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5893     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5894
5895     state = 0xdeadbee;
5896     action = 0xdeadbee;
5897     r = MsiGetComponentState(hpkg, "nu", &state, &action);
5898     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5899     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5900     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5901
5902     state = 0xdeadbee;
5903     action = 0xdeadbee;
5904     r = MsiGetComponentState(hpkg, "xi", &state, &action);
5905     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5906     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5907     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5908
5909     state = 0xdeadbee;
5910     action = 0xdeadbee;
5911     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5912     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5913     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5914     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5915
5916     state = 0xdeadbee;
5917     action = 0xdeadbee;
5918     r = MsiGetComponentState(hpkg, "pi", &state, &action);
5919     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5920     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5921     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5922
5923     state = 0xdeadbee;
5924     action = 0xdeadbee;
5925     r = MsiGetComponentState(hpkg, "rho", &state, &action);
5926     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5927     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5928     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5929
5930     state = 0xdeadbee;
5931     action = 0xdeadbee;
5932     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5933     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5934     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5935     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5936
5937     state = 0xdeadbee;
5938     action = 0xdeadbee;
5939     r = MsiGetComponentState(hpkg, "tau", &state, &action);
5940     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5941     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5942     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5943
5944     state = 0xdeadbee;
5945     action = 0xdeadbee;
5946     r = MsiGetComponentState(hpkg, "phi", &state, &action);
5947     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5948     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5949     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5950
5951     state = 0xdeadbee;
5952     action = 0xdeadbee;
5953     r = MsiGetComponentState(hpkg, "chi", &state, &action);
5954     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5955     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5956     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5957
5958     r = MsiDoAction( hpkg, "CostFinalize");
5959     ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
5960
5961     state = 0xdeadbee;
5962     action = 0xdeadbee;
5963     r = MsiGetFeatureState(hpkg, "one", &state, &action);
5964     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5965     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5966     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5967
5968     state = 0xdeadbee;
5969     action = 0xdeadbee;
5970     r = MsiGetFeatureState(hpkg, "two", &state, &action);
5971     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5972     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5973     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5974
5975     state = 0xdeadbee;
5976     action = 0xdeadbee;
5977     r = MsiGetFeatureState(hpkg, "three", &state, &action);
5978     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5979     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5980     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5981
5982     state = 0xdeadbee;
5983     action = 0xdeadbee;
5984     r = MsiGetFeatureState(hpkg, "four", &state, &action);
5985     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5986     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5987     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5988
5989     state = 0xdeadbee;
5990     action = 0xdeadbee;
5991     r = MsiGetFeatureState(hpkg, "five", &state, &action);
5992     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5993     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5994     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5995
5996     state = 0xdeadbee;
5997     action = 0xdeadbee;
5998     r = MsiGetFeatureState(hpkg, "six", &state, &action);
5999     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6000     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6001     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6002
6003     state = 0xdeadbee;
6004     action = 0xdeadbee;
6005     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6006     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6007     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6008     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6009
6010     state = 0xdeadbee;
6011     action = 0xdeadbee;
6012     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6013     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6014     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6015     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6016
6017     state = 0xdeadbee;
6018     action = 0xdeadbee;
6019     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6020     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6021     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6022     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6023
6024     state = 0xdeadbee;
6025     action = 0xdeadbee;
6026     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6027     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6028     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6029     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6030
6031     state = 0xdeadbee;
6032     action = 0xdeadbee;
6033     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6034     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6035     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6036     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6037
6038     state = 0xdeadbee;
6039     action = 0xdeadbee;
6040     r = MsiGetComponentState(hpkg, "beta", &state, &action);
6041     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6042     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6043     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6044
6045     state = 0xdeadbee;
6046     action = 0xdeadbee;
6047     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6048     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6049     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6050     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6051
6052     state = 0xdeadbee;
6053     action = 0xdeadbee;
6054     r = MsiGetComponentState(hpkg, "theta", &state, &action);
6055     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6056     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6057     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6058
6059     state = 0xdeadbee;
6060     action = 0xdeadbee;
6061     r = MsiGetComponentState(hpkg, "delta", &state, &action);
6062     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6063     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6064     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6065
6066     state = 0xdeadbee;
6067     action = 0xdeadbee;
6068     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6069     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6070     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6071     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6072
6073     state = 0xdeadbee;
6074     action = 0xdeadbee;
6075     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6076     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6077     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6078     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6079
6080     state = 0xdeadbee;
6081     action = 0xdeadbee;
6082     r = MsiGetComponentState(hpkg, "iota", &state, &action);
6083     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6084     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6085     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6086
6087     state = 0xdeadbee;
6088     action = 0xdeadbee;
6089     r = MsiGetComponentState(hpkg, "eta", &state, &action);
6090     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6091     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6092     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6093
6094     state = 0xdeadbee;
6095     action = 0xdeadbee;
6096     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6097     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6098     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6099     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6100
6101     state = 0xdeadbee;
6102     action = 0xdeadbee;
6103     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6104     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6105     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6106     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6107
6108     state = 0xdeadbee;
6109     action = 0xdeadbee;
6110     r = MsiGetComponentState(hpkg, "mu", &state, &action);
6111     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6112     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6113     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6114
6115     state = 0xdeadbee;
6116     action = 0xdeadbee;
6117     r = MsiGetComponentState(hpkg, "nu", &state, &action);
6118     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6119     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6120     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6121
6122     state = 0xdeadbee;
6123     action = 0xdeadbee;
6124     r = MsiGetComponentState(hpkg, "xi", &state, &action);
6125     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6126     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6127     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6128
6129     state = 0xdeadbee;
6130     action = 0xdeadbee;
6131     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6132     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6133     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6134     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6135
6136     state = 0xdeadbee;
6137     action = 0xdeadbee;
6138     r = MsiGetComponentState(hpkg, "pi", &state, &action);
6139     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6140     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6141     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6142
6143     state = 0xdeadbee;
6144     action = 0xdeadbee;
6145     r = MsiGetComponentState(hpkg, "rho", &state, &action);
6146     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6147     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6148     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6149
6150     state = 0xdeadbee;
6151     action = 0xdeadbee;
6152     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6153     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6154     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6155     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6156
6157     state = 0xdeadbee;
6158     action = 0xdeadbee;
6159     r = MsiGetComponentState(hpkg, "tau", &state, &action);
6160     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6161     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6162     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6163
6164     state = 0xdeadbee;
6165     action = 0xdeadbee;
6166     r = MsiGetComponentState(hpkg, "phi", &state, &action);
6167     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6168     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6169     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6170
6171     state = 0xdeadbee;
6172     action = 0xdeadbee;
6173     r = MsiGetComponentState(hpkg, "chi", &state, &action);
6174     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6175     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6176     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6177
6178     MsiCloseHandle(hpkg);
6179
6180     /* reinstall the product */
6181     r = MsiInstallProduct(msifile3, "REINSTALL=ALL");
6182     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6183
6184     r = MsiOpenDatabase(msifile4, MSIDBOPEN_DIRECT, &hdb);
6185     ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
6186
6187     /* this property must not be in the saved msi file */
6188     r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
6189     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
6190
6191     hpkg = package_from_db( hdb );
6192     ok( hpkg, "failed to create package\n");
6193
6194     state = 0xdeadbee;
6195     action = 0xdeadbee;
6196     r = MsiGetFeatureState(hpkg, "one", &state, &action);
6197     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6198     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6199     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6200
6201     state = 0xdeadbee;
6202     action = 0xdeadbee;
6203     r = MsiGetFeatureState(hpkg, "two", &state, &action);
6204     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6205     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6206     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6207
6208     state = 0xdeadbee;
6209     action = 0xdeadbee;
6210     r = MsiGetFeatureState(hpkg, "three", &state, &action);
6211     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6212     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6213     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6214
6215     state = 0xdeadbee;
6216     action = 0xdeadbee;
6217     r = MsiGetFeatureState(hpkg, "four", &state, &action);
6218     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6219     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6220     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6221
6222     state = 0xdeadbee;
6223     action = 0xdeadbee;
6224     r = MsiGetFeatureState(hpkg, "five", &state, &action);
6225     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6226     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6227     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6228
6229     state = 0xdeadbee;
6230     action = 0xdeadbee;
6231     r = MsiGetFeatureState(hpkg, "six", &state, &action);
6232     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6233     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6234     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6235
6236     state = 0xdeadbee;
6237     action = 0xdeadbee;
6238     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6239     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6240     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6241     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6242
6243     state = 0xdeadbee;
6244     action = 0xdeadbee;
6245     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6246     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6247     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6248     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6249
6250     state = 0xdeadbee;
6251     action = 0xdeadbee;
6252     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6253     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6254     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6255     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6256
6257     state = 0xdeadbee;
6258     action = 0xdeadbee;
6259     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6260     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6261     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6262     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6263
6264     state = 0xdeadbee;
6265     action = 0xdeadbee;
6266     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6267     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6268     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6269     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6270
6271     state = 0xdeadbee;
6272     action = 0xdeadbee;
6273     r = MsiGetComponentState(hpkg, "beta", &state, &action);
6274     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6275     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6276     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6277
6278     state = 0xdeadbee;
6279     action = 0xdeadbee;
6280     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6281     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6282     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6283     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6284
6285     state = 0xdeadbee;
6286     action = 0xdeadbee;
6287     r = MsiGetComponentState(hpkg, "theta", &state, &action);
6288     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6289     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6290     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6291
6292     state = 0xdeadbee;
6293     action = 0xdeadbee;
6294     r = MsiGetComponentState(hpkg, "delta", &state, &action);
6295     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6296     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6297     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6298
6299     state = 0xdeadbee;
6300     action = 0xdeadbee;
6301     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6302     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6303     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6304     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6305
6306     state = 0xdeadbee;
6307     action = 0xdeadbee;
6308     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6309     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6310     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6311     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6312
6313     state = 0xdeadbee;
6314     action = 0xdeadbee;
6315     r = MsiGetComponentState(hpkg, "iota", &state, &action);
6316     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6317     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6318     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6319
6320     state = 0xdeadbee;
6321     action = 0xdeadbee;
6322     r = MsiGetComponentState(hpkg, "eta", &state, &action);
6323     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6324     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6325     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6326
6327     state = 0xdeadbee;
6328     action = 0xdeadbee;
6329     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6330     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6331     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6332     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6333
6334     state = 0xdeadbee;
6335     action = 0xdeadbee;
6336     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6337     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6338     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6339     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6340
6341     state = 0xdeadbee;
6342     action = 0xdeadbee;
6343     r = MsiGetComponentState(hpkg, "mu", &state, &action);
6344     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6345     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6346     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6347
6348     state = 0xdeadbee;
6349     action = 0xdeadbee;
6350     r = MsiGetComponentState(hpkg, "nu", &state, &action);
6351     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6352     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6353     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6354
6355     state = 0xdeadbee;
6356     action = 0xdeadbee;
6357     r = MsiGetComponentState(hpkg, "xi", &state, &action);
6358     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6359     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6360     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6361
6362     state = 0xdeadbee;
6363     action = 0xdeadbee;
6364     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6365     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6366     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6367     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6368
6369     state = 0xdeadbee;
6370     action = 0xdeadbee;
6371     r = MsiGetComponentState(hpkg, "pi", &state, &action);
6372     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6373     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6374     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6375
6376     state = 0xdeadbee;
6377     action = 0xdeadbee;
6378     r = MsiGetComponentState(hpkg, "rho", &state, &action);
6379     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6380     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6381     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6382
6383     state = 0xdeadbee;
6384     action = 0xdeadbee;
6385     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6386     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6387     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6388     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6389
6390     state = 0xdeadbee;
6391     action = 0xdeadbee;
6392     r = MsiGetComponentState(hpkg, "tau", &state, &action);
6393     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6394     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6395     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6396
6397     state = 0xdeadbee;
6398     action = 0xdeadbee;
6399     r = MsiGetComponentState(hpkg, "phi", &state, &action);
6400     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6401     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6402     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6403
6404     state = 0xdeadbee;
6405     action = 0xdeadbee;
6406     r = MsiGetComponentState(hpkg, "chi", &state, &action);
6407     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6408     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6409     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6410
6411     r = MsiDoAction( hpkg, "CostInitialize");
6412     ok( r == ERROR_SUCCESS, "cost init failed\n");
6413
6414     state = 0xdeadbee;
6415     action = 0xdeadbee;
6416     r = MsiGetFeatureState(hpkg, "one", &state, &action);
6417     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6418     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6419     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6420
6421     state = 0xdeadbee;
6422     action = 0xdeadbee;
6423     r = MsiGetFeatureState(hpkg, "two", &state, &action);
6424     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6425     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6426     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6427
6428     state = 0xdeadbee;
6429     action = 0xdeadbee;
6430     r = MsiGetFeatureState(hpkg, "three", &state, &action);
6431     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6432     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6433     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6434
6435     state = 0xdeadbee;
6436     action = 0xdeadbee;
6437     r = MsiGetFeatureState(hpkg, "four", &state, &action);
6438     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6439     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6440     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6441
6442     state = 0xdeadbee;
6443     action = 0xdeadbee;
6444     r = MsiGetFeatureState(hpkg, "five", &state, &action);
6445     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6446     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6447     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6448
6449     state = 0xdeadbee;
6450     action = 0xdeadbee;
6451     r = MsiGetFeatureState(hpkg, "six", &state, &action);
6452     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6453     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6454     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6455
6456     state = 0xdeadbee;
6457     action = 0xdeadbee;
6458     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6459     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6460     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6461     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6462
6463     state = 0xdeadbee;
6464     action = 0xdeadbee;
6465     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6466     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6467     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6468     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6469
6470     state = 0xdeadbee;
6471     action = 0xdeadbee;
6472     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6473     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6474     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6475     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6476
6477     state = 0xdeadbee;
6478     action = 0xdeadbee;
6479     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6480     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6481     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6482     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6483
6484     state = 0xdeadbee;
6485     action = 0xdeadbee;
6486     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6487     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6488     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6489     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6490
6491     state = 0xdeadbee;
6492     action = 0xdeadbee;
6493     r = MsiGetComponentState(hpkg, "beta", &state, &action);
6494     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6495     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6496     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6497
6498     state = 0xdeadbee;
6499     action = 0xdeadbee;
6500     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6501     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6502     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6503     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6504
6505     state = 0xdeadbee;
6506     action = 0xdeadbee;
6507     r = MsiGetComponentState(hpkg, "theta", &state, &action);
6508     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6509     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6510     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6511
6512     state = 0xdeadbee;
6513     action = 0xdeadbee;
6514     r = MsiGetComponentState(hpkg, "delta", &state, &action);
6515     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6516     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6517     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6518
6519     state = 0xdeadbee;
6520     action = 0xdeadbee;
6521     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6522     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6523     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6524     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6525
6526     state = 0xdeadbee;
6527     action = 0xdeadbee;
6528     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6529     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6530     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6531     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6532
6533     state = 0xdeadbee;
6534     action = 0xdeadbee;
6535     r = MsiGetComponentState(hpkg, "iota", &state, &action);
6536     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6537     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6538     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6539
6540     state = 0xdeadbee;
6541     action = 0xdeadbee;
6542     r = MsiGetComponentState(hpkg, "eta", &state, &action);
6543     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6544     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6545     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6546
6547     state = 0xdeadbee;
6548     action = 0xdeadbee;
6549     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6550     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6551     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6552     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6553
6554     state = 0xdeadbee;
6555     action = 0xdeadbee;
6556     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6557     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6558     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6559     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6560
6561     state = 0xdeadbee;
6562     action = 0xdeadbee;
6563     r = MsiGetComponentState(hpkg, "mu", &state, &action);
6564     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6565     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6566     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6567
6568     state = 0xdeadbee;
6569     action = 0xdeadbee;
6570     r = MsiGetComponentState(hpkg, "nu", &state, &action);
6571     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6572     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6573     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6574
6575     state = 0xdeadbee;
6576     action = 0xdeadbee;
6577     r = MsiGetComponentState(hpkg, "xi", &state, &action);
6578     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6579     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6580     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6581
6582     state = 0xdeadbee;
6583     action = 0xdeadbee;
6584     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6585     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6586     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6587     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6588
6589     state = 0xdeadbee;
6590     action = 0xdeadbee;
6591     r = MsiGetComponentState(hpkg, "pi", &state, &action);
6592     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6593     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6594     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6595
6596     state = 0xdeadbee;
6597     action = 0xdeadbee;
6598     r = MsiGetComponentState(hpkg, "rho", &state, &action);
6599     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6600     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6601     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6602
6603     state = 0xdeadbee;
6604     action = 0xdeadbee;
6605     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6606     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6607     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6608     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6609
6610     state = 0xdeadbee;
6611     action = 0xdeadbee;
6612     r = MsiGetComponentState(hpkg, "tau", &state, &action);
6613     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6614     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6615     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6616
6617     state = 0xdeadbee;
6618     action = 0xdeadbee;
6619     r = MsiGetComponentState(hpkg, "phi", &state, &action);
6620     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6621     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6622     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6623
6624     state = 0xdeadbee;
6625     action = 0xdeadbee;
6626     r = MsiGetComponentState(hpkg, "chi", &state, &action);
6627     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6628     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6629     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6630
6631     r = MsiDoAction( hpkg, "FileCost");
6632     ok( r == ERROR_SUCCESS, "file cost failed\n");
6633
6634     state = 0xdeadbee;
6635     action = 0xdeadbee;
6636     r = MsiGetFeatureState(hpkg, "one", &state, &action);
6637     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6638     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6639     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6640
6641     state = 0xdeadbee;
6642     action = 0xdeadbee;
6643     r = MsiGetFeatureState(hpkg, "two", &state, &action);
6644     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6645     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6646     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6647
6648     state = 0xdeadbee;
6649     action = 0xdeadbee;
6650     r = MsiGetFeatureState(hpkg, "three", &state, &action);
6651     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6652     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6653     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6654
6655     state = 0xdeadbee;
6656     action = 0xdeadbee;
6657     r = MsiGetFeatureState(hpkg, "four", &state, &action);
6658     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6659     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6660     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6661
6662     state = 0xdeadbee;
6663     action = 0xdeadbee;
6664     r = MsiGetFeatureState(hpkg, "five", &state, &action);
6665     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6666     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6667     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6668
6669     state = 0xdeadbee;
6670     action = 0xdeadbee;
6671     r = MsiGetFeatureState(hpkg, "six", &state, &action);
6672     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6673     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6674     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6675
6676     state = 0xdeadbee;
6677     action = 0xdeadbee;
6678     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6679     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6680     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6681     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6682
6683     state = 0xdeadbee;
6684     action = 0xdeadbee;
6685     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6686     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6687     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6688     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6689
6690     state = 0xdeadbee;
6691     action = 0xdeadbee;
6692     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6693     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6694     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6695     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6696
6697     state = 0xdeadbee;
6698     action = 0xdeadbee;
6699     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6700     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6701     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6702     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6703
6704     state = 0xdeadbee;
6705     action = 0xdeadbee;
6706     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6707     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6708     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6709     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6710
6711     state = 0xdeadbee;
6712     action = 0xdeadbee;
6713     r = MsiGetComponentState(hpkg, "beta", &state, &action);
6714     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6715     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6716     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6717
6718     state = 0xdeadbee;
6719     action = 0xdeadbee;
6720     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6721     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6722     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6723     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6724
6725     state = 0xdeadbee;
6726     action = 0xdeadbee;
6727     r = MsiGetComponentState(hpkg, "theta", &state, &action);
6728     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6729     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6730     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6731
6732     state = 0xdeadbee;
6733     action = 0xdeadbee;
6734     r = MsiGetComponentState(hpkg, "delta", &state, &action);
6735     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6736     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6737     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6738
6739     state = 0xdeadbee;
6740     action = 0xdeadbee;
6741     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6742     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6743     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6744     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6745
6746     state = 0xdeadbee;
6747     action = 0xdeadbee;
6748     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6749     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6750     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6751     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6752
6753     state = 0xdeadbee;
6754     action = 0xdeadbee;
6755     r = MsiGetComponentState(hpkg, "iota", &state, &action);
6756     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6757     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6758     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6759
6760     state = 0xdeadbee;
6761     action = 0xdeadbee;
6762     r = MsiGetComponentState(hpkg, "eta", &state, &action);
6763     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6764     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6765     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6766
6767     state = 0xdeadbee;
6768     action = 0xdeadbee;
6769     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6770     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6771     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6772     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6773
6774     state = 0xdeadbee;
6775     action = 0xdeadbee;
6776     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6777     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6778     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6779     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6780
6781     state = 0xdeadbee;
6782     action = 0xdeadbee;
6783     r = MsiGetComponentState(hpkg, "mu", &state, &action);
6784     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6785     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6786     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6787
6788     state = 0xdeadbee;
6789     action = 0xdeadbee;
6790     r = MsiGetComponentState(hpkg, "nu", &state, &action);
6791     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6792     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6793     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6794
6795     state = 0xdeadbee;
6796     action = 0xdeadbee;
6797     r = MsiGetComponentState(hpkg, "xi", &state, &action);
6798     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6799     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6800     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6801
6802     state = 0xdeadbee;
6803     action = 0xdeadbee;
6804     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6805     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6806     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6807     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6808
6809     state = 0xdeadbee;
6810     action = 0xdeadbee;
6811     r = MsiGetComponentState(hpkg, "pi", &state, &action);
6812     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6813     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6814     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6815
6816     state = 0xdeadbee;
6817     action = 0xdeadbee;
6818     r = MsiGetComponentState(hpkg, "rho", &state, &action);
6819     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6820     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6821     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6822
6823     state = 0xdeadbee;
6824     action = 0xdeadbee;
6825     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6826     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6827     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6828     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6829
6830     state = 0xdeadbee;
6831     action = 0xdeadbee;
6832     r = MsiGetComponentState(hpkg, "tau", &state, &action);
6833     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6834     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6835     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6836
6837     state = 0xdeadbee;
6838     action = 0xdeadbee;
6839     r = MsiGetComponentState(hpkg, "phi", &state, &action);
6840     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6841     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6842     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6843
6844     state = 0xdeadbee;
6845     action = 0xdeadbee;
6846     r = MsiGetComponentState(hpkg, "chi", &state, &action);
6847     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6848     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6849     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6850
6851     r = MsiDoAction( hpkg, "CostFinalize");
6852     ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
6853
6854     state = 0xdeadbee;
6855     action = 0xdeadbee;
6856     r = MsiGetFeatureState(hpkg, "one", &state, &action);
6857     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6858     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6859     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6860
6861     state = 0xdeadbee;
6862     action = 0xdeadbee;
6863     r = MsiGetFeatureState(hpkg, "two", &state, &action);
6864     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6865     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6866     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6867
6868     state = 0xdeadbee;
6869     action = 0xdeadbee;
6870     r = MsiGetFeatureState(hpkg, "three", &state, &action);
6871     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6872     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6873     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6874
6875     state = 0xdeadbee;
6876     action = 0xdeadbee;
6877     r = MsiGetFeatureState(hpkg, "four", &state, &action);
6878     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6879     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6880     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6881
6882     state = 0xdeadbee;
6883     action = 0xdeadbee;
6884     r = MsiGetFeatureState(hpkg, "five", &state, &action);
6885     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6886     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6887     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6888
6889     state = 0xdeadbee;
6890     action = 0xdeadbee;
6891     r = MsiGetFeatureState(hpkg, "six", &state, &action);
6892     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6893     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6894     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6895
6896     state = 0xdeadbee;
6897     action = 0xdeadbee;
6898     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6899     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6900     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6901     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6902
6903     state = 0xdeadbee;
6904     action = 0xdeadbee;
6905     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6906     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6907     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6908     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6909
6910     state = 0xdeadbee;
6911     action = 0xdeadbee;
6912     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6913     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6914     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6915     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6916
6917     state = 0xdeadbee;
6918     action = 0xdeadbee;
6919     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6920     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6921     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6922     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6923
6924     state = 0xdeadbee;
6925     action = 0xdeadbee;
6926     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6927     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6928     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6929     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6930
6931     state = 0xdeadbee;
6932     action = 0xdeadbee;
6933     r = MsiGetComponentState(hpkg, "beta", &state, &action);
6934     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6935     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6936     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6937
6938     state = 0xdeadbee;
6939     action = 0xdeadbee;
6940     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6941     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6942     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6943     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6944
6945     state = 0xdeadbee;
6946     action = 0xdeadbee;
6947     r = MsiGetComponentState(hpkg, "theta", &state, &action);
6948     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6949     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6950     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6951
6952     state = 0xdeadbee;
6953     action = 0xdeadbee;
6954     r = MsiGetComponentState(hpkg, "delta", &state, &action);
6955     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6956     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6957     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6958
6959     state = 0xdeadbee;
6960     action = 0xdeadbee;
6961     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6962     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6963     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6964     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6965
6966     state = 0xdeadbee;
6967     action = 0xdeadbee;
6968     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6969     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6970     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6971     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6972
6973     state = 0xdeadbee;
6974     action = 0xdeadbee;
6975     r = MsiGetComponentState(hpkg, "iota", &state, &action);
6976     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6977     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6978     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6979
6980     state = 0xdeadbee;
6981     action = 0xdeadbee;
6982     r = MsiGetComponentState(hpkg, "eta", &state, &action);
6983     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6984     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6985     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6986
6987     state = 0xdeadbee;
6988     action = 0xdeadbee;
6989     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6990     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6991     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6992     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6993
6994     state = 0xdeadbee;
6995     action = 0xdeadbee;
6996     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6997     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6998     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6999     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7000
7001     state = 0xdeadbee;
7002     action = 0xdeadbee;
7003     r = MsiGetComponentState(hpkg, "mu", &state, &action);
7004     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7005     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7006     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7007
7008     state = 0xdeadbee;
7009     action = 0xdeadbee;
7010     r = MsiGetComponentState(hpkg, "nu", &state, &action);
7011     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7012     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7013     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7014
7015     state = 0xdeadbee;
7016     action = 0xdeadbee;
7017     r = MsiGetComponentState(hpkg, "xi", &state, &action);
7018     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7019     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7020     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7021
7022     state = 0xdeadbee;
7023     action = 0xdeadbee;
7024     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
7025     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7026     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7027     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7028
7029     state = 0xdeadbee;
7030     action = 0xdeadbee;
7031     r = MsiGetComponentState(hpkg, "pi", &state, &action);
7032     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7033     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7034     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7035
7036     state = 0xdeadbee;
7037     action = 0xdeadbee;
7038     r = MsiGetComponentState(hpkg, "rho", &state, &action);
7039     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7040     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7041     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7042
7043     state = 0xdeadbee;
7044     action = 0xdeadbee;
7045     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
7046     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7047     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7048     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7049
7050     state = 0xdeadbee;
7051     action = 0xdeadbee;
7052     r = MsiGetComponentState(hpkg, "tau", &state, &action);
7053     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7054     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7055     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7056
7057     state = 0xdeadbee;
7058     action = 0xdeadbee;
7059     r = MsiGetComponentState(hpkg, "phi", &state, &action);
7060     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7061     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7062     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7063
7064     state = 0xdeadbee;
7065     action = 0xdeadbee;
7066     r = MsiGetComponentState(hpkg, "chi", &state, &action);
7067     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7068     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7069     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7070
7071     MsiCloseHandle(hpkg);
7072
7073     /* uninstall the product */
7074     r = MsiInstallProduct(msifile4, "REMOVE=ALL");
7075     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7076
7077     DeleteFileA(msifile);
7078     DeleteFileA(msifile2);
7079     DeleteFileA(msifile3);
7080     DeleteFileA(msifile4);
7081 }
7082
7083 static void test_getproperty(void)
7084 {
7085     MSIHANDLE hPackage = 0;
7086     char prop[100];
7087     static CHAR empty[] = "";
7088     DWORD size;
7089     UINT r;
7090
7091     hPackage = package_from_db(create_package_db());
7092     ok( hPackage != 0, " Failed to create package\n");
7093
7094     /* set the property */
7095     r = MsiSetProperty(hPackage, "Name", "Value");
7096     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7097
7098     /* retrieve the size, NULL pointer */
7099     size = 0;
7100     r = MsiGetProperty(hPackage, "Name", NULL, &size);
7101     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7102     ok( size == 5, "Expected 5, got %d\n", size);
7103
7104     /* retrieve the size, empty string */
7105     size = 0;
7106     r = MsiGetProperty(hPackage, "Name", empty, &size);
7107     ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7108     ok( size == 5, "Expected 5, got %d\n", size);
7109
7110     /* don't change size */
7111     r = MsiGetProperty(hPackage, "Name", prop, &size);
7112     ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7113     ok( size == 5, "Expected 5, got %d\n", size);
7114     ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
7115
7116     /* increase the size by 1 */
7117     size++;
7118     r = MsiGetProperty(hPackage, "Name", prop, &size);
7119     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7120     ok( size == 5, "Expected 5, got %d\n", size);
7121     ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
7122
7123     r = MsiCloseHandle( hPackage);
7124     ok( r == ERROR_SUCCESS , "Failed to close package\n" );
7125     DeleteFile(msifile);
7126 }
7127
7128 static void test_removefiles(void)
7129 {
7130     MSIHANDLE hpkg;
7131     UINT r;
7132     MSIHANDLE hdb;
7133
7134     hdb = create_package_db();
7135     ok ( hdb, "failed to create package database\n" );
7136
7137     r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
7138     ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
7139
7140     r = create_feature_table( hdb );
7141     ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
7142
7143     r = create_component_table( hdb );
7144     ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
7145
7146     r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
7147     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7148
7149     r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
7150     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7151
7152     r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
7153     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7154
7155     r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
7156     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7157
7158     r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
7159     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7160
7161     r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
7162     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7163
7164     r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
7165     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7166
7167     r = create_feature_components_table( hdb );
7168     ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
7169
7170     r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
7171     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7172
7173     r = add_feature_components_entry( hdb, "'one', 'helium'" );
7174     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7175
7176     r = add_feature_components_entry( hdb, "'one', 'lithium'" );
7177     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7178
7179     r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
7180     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7181
7182     r = add_feature_components_entry( hdb, "'one', 'boron'" );
7183     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7184
7185     r = add_feature_components_entry( hdb, "'one', 'carbon'" );
7186     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7187
7188     r = create_file_table( hdb );
7189     ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
7190
7191     r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
7192     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7193
7194     r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
7195     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7196
7197     r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
7198     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7199
7200     r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
7201     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7202
7203     r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
7204     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7205
7206     r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
7207     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7208
7209     r = create_remove_file_table( hdb );
7210     ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
7211
7212     hpkg = package_from_db( hdb );
7213     ok( hpkg, "failed to create package\n");
7214
7215     MsiCloseHandle( hdb );
7216
7217     create_test_file( "hydrogen.txt" );
7218     create_test_file( "helium.txt" );
7219     create_test_file( "lithium.txt" );
7220     create_test_file( "beryllium.txt" );
7221     create_test_file( "boron.txt" );
7222     create_test_file( "carbon.txt" );
7223
7224     r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
7225     ok( r == ERROR_SUCCESS, "set property failed\n");
7226
7227     r = MsiDoAction( hpkg, "CostInitialize");
7228     ok( r == ERROR_SUCCESS, "cost init failed\n");
7229
7230     r = MsiDoAction( hpkg, "FileCost");
7231     ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7232
7233     r = MsiDoAction( hpkg, "CostFinalize");
7234     ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7235
7236     r = MsiDoAction( hpkg, "InstallValidate");
7237     ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7238
7239     r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
7240     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7241
7242     r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
7243     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7244
7245     r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
7246     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7247
7248     r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
7249     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7250
7251     r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
7252     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7253
7254     r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
7255     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7256
7257     r = MsiDoAction( hpkg, "RemoveFiles");
7258     ok( r == ERROR_SUCCESS, "remove files failed\n");
7259
7260     ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
7261     ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");    
7262     ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
7263     ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
7264     ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
7265     ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
7266
7267     MsiCloseHandle( hpkg );
7268     DeleteFileA(msifile);
7269 }
7270
7271 static void test_appsearch(void)
7272 {
7273     MSIHANDLE hpkg;
7274     UINT r;
7275     MSIHANDLE hdb;
7276     CHAR prop[MAX_PATH];
7277     DWORD size = MAX_PATH;
7278
7279     hdb = create_package_db();
7280     ok ( hdb, "failed to create package database\n" );
7281
7282     r = create_appsearch_table( hdb );
7283     ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
7284
7285     r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
7286     ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
7287
7288     r = create_reglocator_table( hdb );
7289     ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7290
7291     r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
7292     ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7293
7294     r = create_signature_table( hdb );
7295     ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
7296
7297     r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
7298     ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
7299
7300     hpkg = package_from_db( hdb );
7301     ok( hpkg, "failed to create package\n");
7302
7303     MsiCloseHandle( hdb );
7304
7305     r = MsiDoAction( hpkg, "AppSearch" );
7306     ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
7307
7308     r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
7309     ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
7310     todo_wine
7311     {
7312         ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
7313     }
7314
7315     MsiCloseHandle( hpkg );
7316     DeleteFileA(msifile);
7317 }
7318
7319 static void test_appsearch_complocator(void)
7320 {
7321     MSIHANDLE hpkg, hdb;
7322     CHAR path[MAX_PATH];
7323     CHAR prop[MAX_PATH];
7324     LPSTR usersid;
7325     DWORD size;
7326     UINT r;
7327
7328     get_user_sid(&usersid);
7329     if (!usersid)
7330     {
7331         skip("ConvertSidToStringSidA is not available\n");
7332         return;
7333     }
7334
7335     create_test_file("FileName1");
7336     create_test_file("FileName4");
7337     set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE,
7338                        "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
7339
7340     create_test_file("FileName2");
7341     set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED,
7342                        "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
7343
7344     create_test_file("FileName3");
7345     set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED,
7346                        "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
7347
7348     create_test_file("FileName5");
7349     set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE,
7350                        "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
7351
7352     create_test_file("FileName6");
7353     set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE,
7354                        "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
7355
7356     create_test_file("FileName7");
7357     set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE,
7358                        "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
7359
7360     /* dir is FALSE, but we're pretending it's a directory */
7361     set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE,
7362                        "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
7363
7364     create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7365     set_component_path("FileName8.dll", MSIINSTALLCONTEXT_MACHINE,
7366                        "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
7367
7368     create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
7369     set_component_path("FileName9.dll", MSIINSTALLCONTEXT_MACHINE,
7370                        "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
7371
7372     create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7373     set_component_path("FileName10.dll", MSIINSTALLCONTEXT_MACHINE,
7374                        "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
7375
7376     hdb = create_package_db();
7377     ok(hdb, "Expected a valid database handle\n");
7378
7379     r = create_appsearch_table(hdb);
7380     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7381
7382     r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
7383     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7384
7385     r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
7386     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7387
7388     r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
7389     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7390
7391     r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
7392     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7393
7394     r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
7395     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7396
7397     r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
7398     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7399
7400     r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
7401     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7402
7403     r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
7404     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7405
7406     r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
7407     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7408
7409     r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
7410     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7411
7412     r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
7413     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7414
7415     r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
7416     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7417
7418     r = create_complocator_table(hdb);
7419     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7420
7421     /* published component, machine, file, signature, misdbLocatorTypeFile */
7422     r = add_complocator_entry(hdb, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
7423     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7424
7425     /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
7426     r = add_complocator_entry(hdb, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
7427     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7428
7429     /* published component, user-managed, file, signature, misdbLocatorTypeFile */
7430     r = add_complocator_entry(hdb, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
7431     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7432
7433     /* published component, machine, file, signature, misdbLocatorTypeDirectory */
7434     r = add_complocator_entry(hdb, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
7435     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7436
7437     /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
7438     r = add_complocator_entry(hdb, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
7439     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7440
7441     /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
7442     r = add_complocator_entry(hdb, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
7443     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7444
7445     /* published component, machine, file, no signature, misdbLocatorTypeFile */
7446     r = add_complocator_entry(hdb, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
7447     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7448
7449     /* unpublished component, no signature, misdbLocatorTypeDir */
7450     r = add_complocator_entry(hdb, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
7451     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7452
7453     /* published component, no signature, dir does not exist misdbLocatorTypeDir */
7454     r = add_complocator_entry(hdb, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
7455     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7456
7457     /* published component, signature w/ ver, misdbLocatorTypeFile */
7458     r = add_complocator_entry(hdb, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
7459     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7460
7461     /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
7462     r = add_complocator_entry(hdb, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
7463     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7464
7465     /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
7466     r = add_complocator_entry(hdb, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
7467     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7468
7469     r = create_signature_table(hdb);
7470     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7471
7472     r = add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
7473     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7474
7475     r = add_signature_entry(hdb, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
7476     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7477
7478     r = add_signature_entry(hdb, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
7479     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7480
7481     r = add_signature_entry(hdb, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
7482     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7483
7484     r = add_signature_entry(hdb, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
7485     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7486
7487     r = add_signature_entry(hdb, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7488     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7489
7490     r = add_signature_entry(hdb, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7491     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7492
7493     r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7494     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7495
7496     hpkg = package_from_db(hdb);
7497     ok(hpkg, "Expected a valid package handle\n");
7498
7499     r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
7500     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7501
7502     r = MsiDoAction(hpkg, "AppSearch");
7503     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7504
7505     size = MAX_PATH;
7506     sprintf(path, "%s\\FileName1", CURR_DIR);
7507     r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
7508     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7509     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7510
7511     size = MAX_PATH;
7512     sprintf(path, "%s\\FileName2", CURR_DIR);
7513     r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
7514     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7515     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7516
7517     size = MAX_PATH;
7518     sprintf(path, "%s\\FileName3", CURR_DIR);
7519     r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
7520     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7521     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7522
7523     size = MAX_PATH;
7524     sprintf(path, "%s\\FileName4", CURR_DIR);
7525     r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
7526     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7527     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7528
7529     size = MAX_PATH;
7530     sprintf(path, "%s\\FileName5", CURR_DIR);
7531     r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
7532     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7533     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7534
7535     size = MAX_PATH;
7536     sprintf(path, "%s\\", CURR_DIR);
7537     r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
7538     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7539     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7540
7541     size = MAX_PATH;
7542     sprintf(path, "%s\\", CURR_DIR);
7543     r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
7544     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7545     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7546
7547     size = MAX_PATH;
7548     r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
7549     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7550     ok(!lstrcmpA(prop, "october"), "Expected \"october\", got \"%s\"\n", prop);
7551
7552     size = MAX_PATH;
7553     r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
7554     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7555     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7556
7557     size = MAX_PATH;
7558     sprintf(path, "%s\\FileName8.dll", CURR_DIR);
7559     r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
7560     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7561     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7562
7563     size = MAX_PATH;
7564     r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
7565     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7566     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7567
7568     size = MAX_PATH;
7569     sprintf(path, "%s\\FileName10.dll", CURR_DIR);
7570     r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
7571     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7572     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7573
7574     delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
7575                           MSIINSTALLCONTEXT_MACHINE, NULL);
7576     delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
7577                           MSIINSTALLCONTEXT_USERUNMANAGED, usersid);
7578     delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
7579                           MSIINSTALLCONTEXT_USERMANAGED, usersid);
7580     delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
7581                           MSIINSTALLCONTEXT_MACHINE, NULL);
7582     delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
7583                           MSIINSTALLCONTEXT_MACHINE, NULL);
7584     delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
7585                           MSIINSTALLCONTEXT_MACHINE, NULL);
7586     delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
7587                           MSIINSTALLCONTEXT_MACHINE, NULL);
7588     delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
7589                           MSIINSTALLCONTEXT_MACHINE, NULL);
7590     delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
7591                           MSIINSTALLCONTEXT_MACHINE, NULL);
7592     delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
7593                           MSIINSTALLCONTEXT_MACHINE, NULL);
7594
7595     DeleteFileA("FileName1");
7596     DeleteFileA("FileName2");
7597     DeleteFileA("FileName3");
7598     DeleteFileA("FileName4");
7599     DeleteFileA("FileName5");
7600     DeleteFileA("FileName6");
7601     DeleteFileA("FileName7");
7602     DeleteFileA("FileName8.dll");
7603     DeleteFileA("FileName9.dll");
7604     DeleteFileA("FileName10.dll");
7605     MsiCloseHandle(hpkg);
7606     DeleteFileA(msifile);
7607 }
7608
7609 static void test_appsearch_reglocator(void)
7610 {
7611     MSIHANDLE hpkg, hdb;
7612     CHAR path[MAX_PATH];
7613     CHAR prop[MAX_PATH];
7614     DWORD binary[2];
7615     DWORD size, val;
7616     BOOL space, version;
7617     HKEY hklm, classes;
7618     HKEY hkcu, users;
7619     LPSTR pathdata;
7620     LPSTR pathvar;
7621     LPCSTR str;
7622     LPSTR ptr;
7623     LONG res;
7624     UINT r;
7625
7626     version = TRUE;
7627     if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
7628         version = FALSE;
7629
7630     DeleteFileA("test.dll");
7631
7632     res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
7633     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7634
7635     res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
7636                          (const BYTE *)"regszdata", 10);
7637     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7638
7639     res = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine", &hkcu);
7640     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7641
7642     res = RegSetValueExA(hkcu, "Value1", 0, REG_SZ,
7643                          (const BYTE *)"regszdata", 10);
7644     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7645
7646     users = 0;
7647     res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
7648     ok(res == ERROR_SUCCESS ||
7649        broken(res == ERROR_INVALID_PARAMETER),
7650        "Expected ERROR_SUCCESS, got %d\n", res);
7651
7652     if (res == ERROR_SUCCESS)
7653     {
7654         res = RegSetValueExA(users, "Value1", 0, REG_SZ,
7655                              (const BYTE *)"regszdata", 10);
7656         ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7657     }
7658
7659     res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine", &hklm);
7660     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7661
7662     res = RegSetValueA(hklm, NULL, REG_SZ, "defvalue", 8);
7663     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7664
7665     res = RegSetValueExA(hklm, "Value1", 0, REG_SZ,
7666                          (const BYTE *)"regszdata", 10);
7667     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7668
7669     val = 42;
7670     res = RegSetValueExA(hklm, "Value2", 0, REG_DWORD,
7671                          (const BYTE *)&val, sizeof(DWORD));
7672     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7673
7674     val = -42;
7675     res = RegSetValueExA(hklm, "Value3", 0, REG_DWORD,
7676                          (const BYTE *)&val, sizeof(DWORD));
7677     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7678
7679     res = RegSetValueExA(hklm, "Value4", 0, REG_EXPAND_SZ,
7680                          (const BYTE *)"%PATH%", 7);
7681     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7682
7683     res = RegSetValueExA(hklm, "Value5", 0, REG_EXPAND_SZ,
7684                          (const BYTE *)"my%NOVAR%", 10);
7685     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7686
7687     res = RegSetValueExA(hklm, "Value6", 0, REG_MULTI_SZ,
7688                          (const BYTE *)"one\0two\0", 9);
7689     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7690
7691     binary[0] = 0x1234abcd;
7692     binary[1] = 0x567890ef;
7693     res = RegSetValueExA(hklm, "Value7", 0, REG_BINARY,
7694                          (const BYTE *)binary, sizeof(binary));
7695     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7696
7697     res = RegSetValueExA(hklm, "Value8", 0, REG_SZ,
7698                          (const BYTE *)"#regszdata", 11);
7699     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7700
7701     create_test_file("FileName1");
7702     sprintf(path, "%s\\FileName1", CURR_DIR);
7703     res = RegSetValueExA(hklm, "Value9", 0, REG_SZ,
7704                          (const BYTE *)path, lstrlenA(path) + 1);
7705     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7706
7707     sprintf(path, "%s\\FileName2", CURR_DIR);
7708     res = RegSetValueExA(hklm, "Value10", 0, REG_SZ,
7709                          (const BYTE *)path, lstrlenA(path) + 1);
7710     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7711
7712     lstrcpyA(path, CURR_DIR);
7713     res = RegSetValueExA(hklm, "Value11", 0, REG_SZ,
7714                          (const BYTE *)path, lstrlenA(path) + 1);
7715     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7716
7717     res = RegSetValueExA(hklm, "Value12", 0, REG_SZ,
7718                          (const BYTE *)"", 1);
7719     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7720
7721     create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7722     sprintf(path, "%s\\FileName3.dll", CURR_DIR);
7723     res = RegSetValueExA(hklm, "Value13", 0, REG_SZ,
7724                          (const BYTE *)path, lstrlenA(path) + 1);
7725     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7726
7727     create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
7728     sprintf(path, "%s\\FileName4.dll", CURR_DIR);
7729     res = RegSetValueExA(hklm, "Value14", 0, REG_SZ,
7730                          (const BYTE *)path, lstrlenA(path) + 1);
7731     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7732
7733     create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7734     sprintf(path, "%s\\FileName5.dll", CURR_DIR);
7735     res = RegSetValueExA(hklm, "Value15", 0, REG_SZ,
7736                          (const BYTE *)path, lstrlenA(path) + 1);
7737     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7738
7739     sprintf(path, "\"%s\\FileName1\" -option", CURR_DIR);
7740     res = RegSetValueExA(hklm, "value16", 0, REG_SZ,
7741                          (const BYTE *)path, lstrlenA(path) + 1);
7742
7743     space = (strchr(CURR_DIR, ' ')) ? TRUE : FALSE;
7744     sprintf(path, "%s\\FileName1 -option", CURR_DIR);
7745     res = RegSetValueExA(hklm, "value17", 0, REG_SZ,
7746                          (const BYTE *)path, lstrlenA(path) + 1);
7747
7748     hdb = create_package_db();
7749     ok(hdb, "Expected a valid database handle\n");
7750
7751     r = create_appsearch_table(hdb);
7752     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7753
7754     r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
7755     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7756
7757     r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
7758     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7759
7760     r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
7761     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7762
7763     r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
7764     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7765
7766     r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
7767     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7768
7769     r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
7770     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7771
7772     r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
7773     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7774
7775     r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
7776     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7777
7778     r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
7779     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7780
7781     r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
7782     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7783
7784     r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
7785     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7786
7787     r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
7788     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7789
7790     r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
7791     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7792
7793     r = add_appsearch_entry(hdb, "'SIGPROP14', 'NewSignature14'");
7794     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7795
7796     r = add_appsearch_entry(hdb, "'SIGPROP15', 'NewSignature15'");
7797     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7798
7799     r = add_appsearch_entry(hdb, "'SIGPROP16', 'NewSignature16'");
7800     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7801
7802     r = add_appsearch_entry(hdb, "'SIGPROP17', 'NewSignature17'");
7803     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7804
7805     r = add_appsearch_entry(hdb, "'SIGPROP18', 'NewSignature18'");
7806     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7807
7808     r = add_appsearch_entry(hdb, "'SIGPROP19', 'NewSignature19'");
7809     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7810
7811     r = add_appsearch_entry(hdb, "'SIGPROP20', 'NewSignature20'");
7812     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7813
7814     r = add_appsearch_entry(hdb, "'SIGPROP21', 'NewSignature21'");
7815     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7816
7817     r = add_appsearch_entry(hdb, "'SIGPROP22', 'NewSignature22'");
7818     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7819
7820     r = add_appsearch_entry(hdb, "'SIGPROP23', 'NewSignature23'");
7821     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7822
7823     r = add_appsearch_entry(hdb, "'SIGPROP24', 'NewSignature24'");
7824     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7825
7826     r = add_appsearch_entry(hdb, "'SIGPROP25', 'NewSignature25'");
7827     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7828
7829     r = add_appsearch_entry(hdb, "'SIGPROP26', 'NewSignature26'");
7830     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7831
7832     r = add_appsearch_entry(hdb, "'SIGPROP27', 'NewSignature27'");
7833     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7834
7835     r = add_appsearch_entry(hdb, "'SIGPROP28', 'NewSignature28'");
7836     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7837
7838     r = add_appsearch_entry(hdb, "'SIGPROP29', 'NewSignature29'");
7839     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7840
7841     r = add_appsearch_entry(hdb, "'SIGPROP30', 'NewSignature30'");
7842     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7843
7844     r = create_reglocator_table(hdb);
7845     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7846
7847     /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
7848     str = "'NewSignature1', 2, 'Software\\Wine', 'Value1', 2";
7849     r = add_reglocator_entry(hdb, str);
7850     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7851
7852     /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
7853     str = "'NewSignature2', 2, 'Software\\Wine', 'Value2', 2";
7854     r = add_reglocator_entry(hdb, str);
7855     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7856
7857     /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
7858     str = "'NewSignature3', 2, 'Software\\Wine', 'Value3', 2";
7859     r = add_reglocator_entry(hdb, str);
7860     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7861
7862     /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
7863     str = "'NewSignature4', 2, 'Software\\Wine', 'Value4', 2";
7864     r = add_reglocator_entry(hdb, str);
7865     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7866
7867     /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
7868     str = "'NewSignature5', 2, 'Software\\Wine', 'Value5', 2";
7869     r = add_reglocator_entry(hdb, str);
7870     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7871
7872     /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
7873     str = "'NewSignature6', 2, 'Software\\Wine', 'Value6', 2";
7874     r = add_reglocator_entry(hdb, str);
7875     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7876
7877     /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
7878     str = "'NewSignature7', 2, 'Software\\Wine', 'Value7', 2";
7879     r = add_reglocator_entry(hdb, str);
7880     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7881
7882     /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
7883     str = "'NewSignature8', 2, 'Software\\Wine', 'Value8', 2";
7884     r = add_reglocator_entry(hdb, str);
7885     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7886
7887     /* HKLM, msidbLocatorTypeFileName, signature, file exists */
7888     str = "'NewSignature9', 2, 'Software\\Wine', 'Value9', 1";
7889     r = add_reglocator_entry(hdb, str);
7890     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7891
7892     /* HKLM, msidbLocatorTypeFileName, signature, file does not exist */
7893     str = "'NewSignature10', 2, 'Software\\Wine', 'Value10', 1";
7894     r = add_reglocator_entry(hdb, str);
7895     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7896
7897     /* HKLM, msidbLocatorTypeFileName, no signature */
7898     str = "'NewSignature11', 2, 'Software\\Wine', 'Value9', 1";
7899     r = add_reglocator_entry(hdb, str);
7900     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7901
7902     /* HKLM, msidbLocatorTypeDirectory, no signature, file exists */
7903     str = "'NewSignature12', 2, 'Software\\Wine', 'Value9', 0";
7904     r = add_reglocator_entry(hdb, str);
7905     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7906
7907     /* HKLM, msidbLocatorTypeDirectory, no signature, directory exists */
7908     str = "'NewSignature13', 2, 'Software\\Wine', 'Value11', 0";
7909     r = add_reglocator_entry(hdb, str);
7910     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7911
7912     /* HKLM, msidbLocatorTypeDirectory, signature, file exists */
7913     str = "'NewSignature14', 2, 'Software\\Wine', 'Value9', 0";
7914     r = add_reglocator_entry(hdb, str);
7915     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7916
7917     /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
7918     str = "'NewSignature15', 0, 'Software\\Wine', 'Value1', 2";
7919     r = add_reglocator_entry(hdb, str);
7920     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7921
7922     /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
7923     str = "'NewSignature16', 1, 'Software\\Wine', 'Value1', 2";
7924     r = add_reglocator_entry(hdb, str);
7925     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7926
7927     /* HKU, msidbLocatorTypeRawValue, REG_SZ */
7928     str = "'NewSignature17', 3, 'S-1-5-18\\Software\\Wine', 'Value1', 2";
7929     r = add_reglocator_entry(hdb, str);
7930     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7931
7932     /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
7933     str = "'NewSignature18', 2, 'Software\\Wine', '', 2";
7934     r = add_reglocator_entry(hdb, str);
7935     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7936
7937     /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
7938     str = "'NewSignature19', 2, 'Software\\IDontExist', '', 2";
7939     r = add_reglocator_entry(hdb, str);
7940     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7941
7942     /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
7943     str = "'NewSignature20', 2, 'Software\\Wine', 'Value12', 2";
7944     r = add_reglocator_entry(hdb, str);
7945     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7946
7947     /* HKLM, msidbLocatorTypeFileName, signature, file exists w/ version */
7948     str = "'NewSignature21', 2, 'Software\\Wine', 'Value13', 1";
7949     r = add_reglocator_entry(hdb, str);
7950     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7951
7952     /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
7953     str = "'NewSignature22', 2, 'Software\\Wine', 'Value14', 1";
7954     r = add_reglocator_entry(hdb, str);
7955     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7956
7957     /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
7958     str = "'NewSignature23', 2, 'Software\\Wine', 'Value15', 1";
7959     r = add_reglocator_entry(hdb, str);
7960     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7961
7962     /* HKLM, msidbLocatorTypeFileName, no signature, directory exists */
7963     str = "'NewSignature24', 2, 'Software\\Wine', 'Value11', 1";
7964     r = add_reglocator_entry(hdb, str);
7965     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7966
7967     /* HKLM, msidbLocatorTypeFileName, no signature, file does not exist */
7968     str = "'NewSignature25', 2, 'Software\\Wine', 'Value10', 1";
7969     r = add_reglocator_entry(hdb, str);
7970     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7971
7972     /* HKLM, msidbLocatorTypeDirectory, signature, directory exists */
7973     str = "'NewSignature26', 2, 'Software\\Wine', 'Value11', 0";
7974     r = add_reglocator_entry(hdb, str);
7975     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7976
7977     /* HKLM, msidbLocatorTypeDirectory, signature, file does not exist */
7978     str = "'NewSignature27', 2, 'Software\\Wine', 'Value10', 0";
7979     r = add_reglocator_entry(hdb, str);
7980     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7981
7982     /* HKLM, msidbLocatorTypeDirectory, no signature, file does not exist */
7983     str = "'NewSignature28', 2, 'Software\\Wine', 'Value10', 0";
7984     r = add_reglocator_entry(hdb, str);
7985     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7986
7987     /* HKLM, msidbLocatorTypeFile, file exists, in quotes */
7988     str = "'NewSignature29', 2, 'Software\\Wine', 'Value16', 1";
7989     r = add_reglocator_entry(hdb, str);
7990     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7991
7992     /* HKLM, msidbLocatorTypeFile, file exists, no quotes */
7993     str = "'NewSignature30', 2, 'Software\\Wine', 'Value17', 1";
7994     r = add_reglocator_entry(hdb, str);
7995     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7996
7997     r = create_signature_table(hdb);
7998     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7999
8000     str = "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
8001     r = add_signature_entry(hdb, str);
8002     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8003
8004     str = "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
8005     r = add_signature_entry(hdb, str);
8006     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8007
8008     str = "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
8009     r = add_signature_entry(hdb, str);
8010     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8011
8012     str = "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8013     r = add_signature_entry(hdb, str);
8014     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8015
8016     str = "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8017     r = add_signature_entry(hdb, str);
8018     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8019
8020     str = "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8021     r = add_signature_entry(hdb, str);
8022     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8023
8024     ptr = strrchr(CURR_DIR, '\\') + 1;
8025     sprintf(path, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr);
8026     r = add_signature_entry(hdb, path);
8027     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8028
8029     str = "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''";
8030     r = add_signature_entry(hdb, str);
8031     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8032
8033     str = "'NewSignature29', 'FileName1', '', '', '', '', '', '', ''";
8034     r = add_signature_entry(hdb, str);
8035     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8036
8037     str = "'NewSignature30', 'FileName1', '', '', '', '', '', '', ''";
8038     r = add_signature_entry(hdb, str);
8039     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8040
8041     hpkg = package_from_db(hdb);
8042     ok(hpkg, "Expected a valid package handle\n");
8043
8044     r = MsiDoAction(hpkg, "AppSearch");
8045     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8046
8047     size = MAX_PATH;
8048     r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8049     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8050     ok(!lstrcmpA(prop, "regszdata"),
8051        "Expected \"regszdata\", got \"%s\"\n", prop);
8052
8053     size = MAX_PATH;
8054     r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8055     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8056     ok(!lstrcmpA(prop, "#42"), "Expected \"#42\", got \"%s\"\n", prop);
8057
8058     size = MAX_PATH;
8059     r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8060     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8061     ok(!lstrcmpA(prop, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop);
8062
8063     size = ExpandEnvironmentStringsA("%PATH%", NULL, 0);
8064     if (size == 0 && GetLastError() == ERROR_INVALID_PARAMETER)
8065     {
8066         /* Workaround for Win95 */
8067         CHAR tempbuf[1];
8068         size = ExpandEnvironmentStringsA("%PATH%", tempbuf, 0);
8069     }
8070     pathvar = HeapAlloc(GetProcessHeap(), 0, size);
8071     ExpandEnvironmentStringsA("%PATH%", pathvar, size);
8072
8073     size = 0;
8074     r = MsiGetPropertyA(hpkg, "SIGPROP4", NULL, &size);
8075     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8076
8077     pathdata = HeapAlloc(GetProcessHeap(), 0, ++size);
8078     r = MsiGetPropertyA(hpkg, "SIGPROP4", pathdata, &size);
8079     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8080     ok(!lstrcmpA(pathdata, pathvar),
8081        "Expected \"%s\", got \"%s\"\n", pathvar, pathdata);
8082
8083     HeapFree(GetProcessHeap(), 0, pathvar);
8084     HeapFree(GetProcessHeap(), 0, pathdata);
8085
8086     size = MAX_PATH;
8087     r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8088     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8089     ok(!lstrcmpA(prop,
8090        "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop);
8091
8092     size = MAX_PATH;
8093     r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8094     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8095     todo_wine
8096     {
8097         ok(!memcmp(prop, "\0one\0two\0\0", 10),
8098            "Expected \"\\0one\\0two\\0\\0\"\n");
8099     }
8100
8101     size = MAX_PATH;
8102     lstrcpyA(path, "#xCDAB3412EF907856");
8103     r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8104     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8105     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8106
8107     size = MAX_PATH;
8108     r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8109     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8110     ok(!lstrcmpA(prop, "##regszdata"),
8111        "Expected \"##regszdata\", got \"%s\"\n", prop);
8112
8113     size = MAX_PATH;
8114     sprintf(path, "%s\\FileName1", CURR_DIR);
8115     r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8116     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8117     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8118
8119     size = MAX_PATH;
8120     r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8121     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8122     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8123
8124     size = MAX_PATH;
8125     sprintf(path, "%s\\", CURR_DIR);
8126     r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8127     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8128     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8129
8130     size = MAX_PATH;
8131     r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8132     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8133     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8134
8135     size = MAX_PATH;
8136     sprintf(path, "%s\\", CURR_DIR);
8137     r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
8138     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8139     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8140
8141     size = MAX_PATH;
8142     r = MsiGetPropertyA(hpkg, "SIGPROP14", prop, &size);
8143     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8144     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8145
8146     size = MAX_PATH;
8147     r = MsiGetPropertyA(hpkg, "SIGPROP15", prop, &size);
8148     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8149     ok(!lstrcmpA(prop, "regszdata"),
8150        "Expected \"regszdata\", got \"%s\"\n", prop);
8151
8152     size = MAX_PATH;
8153     r = MsiGetPropertyA(hpkg, "SIGPROP16", prop, &size);
8154     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8155     ok(!lstrcmpA(prop, "regszdata"),
8156        "Expected \"regszdata\", got \"%s\"\n", prop);
8157
8158     if (users)
8159     {
8160         size = MAX_PATH;
8161         r = MsiGetPropertyA(hpkg, "SIGPROP17", prop, &size);
8162         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8163         ok(!lstrcmpA(prop, "regszdata"),
8164            "Expected \"regszdata\", got \"%s\"\n", prop);
8165     }
8166
8167     size = MAX_PATH;
8168     r = MsiGetPropertyA(hpkg, "SIGPROP18", prop, &size);
8169     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8170     ok(!lstrcmpA(prop, "defvalue"),
8171        "Expected \"defvalue\", got \"%s\"\n", prop);
8172
8173     size = MAX_PATH;
8174     r = MsiGetPropertyA(hpkg, "SIGPROP19", prop, &size);
8175     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8176     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8177
8178     size = MAX_PATH;
8179     r = MsiGetPropertyA(hpkg, "SIGPROP20", prop, &size);
8180     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8181     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8182
8183     if (version)
8184     {
8185         size = MAX_PATH;
8186         sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8187         r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size);
8188         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8189         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8190
8191         size = MAX_PATH;
8192         r = MsiGetPropertyA(hpkg, "SIGPROP22", prop, &size);
8193         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8194         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8195
8196         size = MAX_PATH;
8197         sprintf(path, "%s\\FileName5.dll", CURR_DIR);
8198         r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size);
8199         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8200         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8201     }
8202
8203     size = MAX_PATH;
8204     lstrcpyA(path, CURR_DIR);
8205     ptr = strrchr(path, '\\') + 1;
8206     *ptr = '\0';
8207     r = MsiGetPropertyA(hpkg, "SIGPROP24", prop, &size);
8208     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8209     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8210
8211     size = MAX_PATH;
8212     sprintf(path, "%s\\", CURR_DIR);
8213     r = MsiGetPropertyA(hpkg, "SIGPROP25", prop, &size);
8214     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8215     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8216
8217     size = MAX_PATH;
8218     r = MsiGetPropertyA(hpkg, "SIGPROP26", prop, &size);
8219     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8220     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8221
8222     size = MAX_PATH;
8223     r = MsiGetPropertyA(hpkg, "SIGPROP27", prop, &size);
8224     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8225     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8226
8227     size = MAX_PATH;
8228     r = MsiGetPropertyA(hpkg, "SIGPROP28", prop, &size);
8229     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8230     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8231
8232     size = MAX_PATH;
8233     sprintf(path, "%s\\FileName1", CURR_DIR);
8234     r = MsiGetPropertyA(hpkg, "SIGPROP29", prop, &size);
8235     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8236     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8237
8238     size = MAX_PATH;
8239     sprintf(path, "%s\\FileName1", CURR_DIR);
8240     r = MsiGetPropertyA(hpkg, "SIGPROP30", prop, &size);
8241     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8242     if (space)
8243         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8244     else
8245         todo_wine ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8246
8247     RegSetValueA(hklm, NULL, REG_SZ, "", 0);
8248     RegDeleteValueA(hklm, "Value1");
8249     RegDeleteValueA(hklm, "Value2");
8250     RegDeleteValueA(hklm, "Value3");
8251     RegDeleteValueA(hklm, "Value4");
8252     RegDeleteValueA(hklm, "Value5");
8253     RegDeleteValueA(hklm, "Value6");
8254     RegDeleteValueA(hklm, "Value7");
8255     RegDeleteValueA(hklm, "Value8");
8256     RegDeleteValueA(hklm, "Value9");
8257     RegDeleteValueA(hklm, "Value10");
8258     RegDeleteValueA(hklm, "Value11");
8259     RegDeleteValueA(hklm, "Value12");
8260     RegDeleteValueA(hklm, "Value13");
8261     RegDeleteValueA(hklm, "Value14");
8262     RegDeleteValueA(hklm, "Value15");
8263     RegDeleteValueA(hklm, "Value16");
8264     RegDeleteValueA(hklm, "Value17");
8265     RegDeleteKeyA(hklm, "");
8266     RegCloseKey(hklm);
8267
8268     RegDeleteValueA(classes, "Value1");
8269     RegDeleteKeyA(classes, "");
8270     RegCloseKey(classes);
8271
8272     RegDeleteValueA(hkcu, "Value1");
8273     RegDeleteKeyA(hkcu, "");
8274     RegCloseKey(hkcu);
8275
8276     RegDeleteValueA(users, "Value1");
8277     RegDeleteKeyA(users, "");
8278     RegCloseKey(users);
8279
8280     DeleteFileA("FileName1");
8281     DeleteFileA("FileName3.dll");
8282     DeleteFileA("FileName4.dll");
8283     DeleteFileA("FileName5.dll");
8284     MsiCloseHandle(hpkg);
8285     DeleteFileA(msifile);
8286 }
8287
8288 static void delete_win_ini(LPCSTR file)
8289 {
8290     CHAR path[MAX_PATH];
8291
8292     GetWindowsDirectoryA(path, MAX_PATH);
8293     lstrcatA(path, "\\");
8294     lstrcatA(path, file);
8295
8296     DeleteFileA(path);
8297 }
8298
8299 static void test_appsearch_inilocator(void)
8300 {
8301     MSIHANDLE hpkg, hdb;
8302     CHAR path[MAX_PATH];
8303     CHAR prop[MAX_PATH];
8304     BOOL version;
8305     LPCSTR str;
8306     LPSTR ptr;
8307     DWORD size;
8308     UINT r;
8309
8310     version = TRUE;
8311     if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
8312         version = FALSE;
8313
8314     DeleteFileA("test.dll");
8315
8316     WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
8317
8318     create_test_file("FileName1");
8319     sprintf(path, "%s\\FileName1", CURR_DIR);
8320     WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
8321
8322     WritePrivateProfileStringA("Section", "Key3", CURR_DIR, "IniFile.ini");
8323
8324     sprintf(path, "%s\\IDontExist", CURR_DIR);
8325     WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
8326
8327     create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8328     sprintf(path, "%s\\FileName2.dll", CURR_DIR);
8329     WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
8330
8331     create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8332     sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8333     WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
8334
8335     create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8336     sprintf(path, "%s\\FileName4.dll", CURR_DIR);
8337     WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
8338
8339     hdb = create_package_db();
8340     ok(hdb, "Expected a valid database handle\n");
8341
8342     r = create_appsearch_table(hdb);
8343     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8344
8345     r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8346     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8347
8348     r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8349     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8350
8351     r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8352     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8353
8354     r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8355     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8356
8357     r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8358     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8359
8360     r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8361     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8362
8363     r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8364     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8365
8366     r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8367     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8368
8369     r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8370     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8371
8372     r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8373     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8374
8375     r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8376     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8377
8378     r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
8379     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8380
8381     r = create_inilocator_table(hdb);
8382     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8383
8384     /* msidbLocatorTypeRawValue, field 1 */
8385     str = "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
8386     r = add_inilocator_entry(hdb, str);
8387     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8388
8389     /* msidbLocatorTypeRawValue, field 2 */
8390     str = "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
8391     r = add_inilocator_entry(hdb, str);
8392     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8393
8394     /* msidbLocatorTypeRawValue, entire field */
8395     str = "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
8396     r = add_inilocator_entry(hdb, str);
8397     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8398
8399     /* msidbLocatorTypeFile */
8400     str = "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
8401     r = add_inilocator_entry(hdb, str);
8402     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8403
8404     /* msidbLocatorTypeDirectory, file */
8405     str = "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
8406     r = add_inilocator_entry(hdb, str);
8407     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8408
8409     /* msidbLocatorTypeDirectory, directory */
8410     str = "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
8411     r = add_inilocator_entry(hdb, str);
8412     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8413
8414     /* msidbLocatorTypeFile, file, no signature */
8415     str = "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
8416     r = add_inilocator_entry(hdb, str);
8417     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8418
8419     /* msidbLocatorTypeFile, dir, no signature */
8420     str = "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
8421     r = add_inilocator_entry(hdb, str);
8422     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8423
8424     /* msidbLocatorTypeFile, file does not exist */
8425     str = "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
8426     r = add_inilocator_entry(hdb, str);
8427     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8428
8429     /* msidbLocatorTypeFile, signature with version */
8430     str = "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1";
8431     r = add_inilocator_entry(hdb, str);
8432     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8433
8434     /* msidbLocatorTypeFile, signature with version, ver > max */
8435     str = "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1";
8436     r = add_inilocator_entry(hdb, str);
8437     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8438
8439     /* msidbLocatorTypeFile, signature with version, sig->name ignored */
8440     str = "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1";
8441     r = add_inilocator_entry(hdb, str);
8442     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8443
8444     r = create_signature_table(hdb);
8445     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8446
8447     r = add_signature_entry(hdb, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
8448     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8449
8450     r = add_signature_entry(hdb, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
8451     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8452
8453     r = add_signature_entry(hdb, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8454     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8455
8456     r = add_signature_entry(hdb, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8457     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8458
8459     r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8460     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8461
8462     hpkg = package_from_db(hdb);
8463     ok(hpkg, "Expected a valid package handle\n");
8464
8465     r = MsiDoAction(hpkg, "AppSearch");
8466     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8467
8468     size = MAX_PATH;
8469     r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8470     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8471     ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop);
8472
8473     size = MAX_PATH;
8474     r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8475     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8476     ok(!lstrcmpA(prop, "field2"), "Expected \"field2\", got \"%s\"\n", prop);
8477
8478     size = MAX_PATH;
8479     r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8480     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8481     ok(!lstrcmpA(prop, "keydata,field2"),
8482        "Expected \"keydata,field2\", got \"%s\"\n", prop);
8483
8484     size = MAX_PATH;
8485     sprintf(path, "%s\\FileName1", CURR_DIR);
8486     r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
8487     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8488     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8489
8490     size = MAX_PATH;
8491     r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8492     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8493     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8494
8495     size = MAX_PATH;
8496     sprintf(path, "%s\\", CURR_DIR);
8497     r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8498     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8499     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8500
8501     size = MAX_PATH;
8502     sprintf(path, "%s\\", CURR_DIR);
8503     r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8504     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8505     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8506
8507     size = MAX_PATH;
8508     lstrcpyA(path, CURR_DIR);
8509     ptr = strrchr(path, '\\');
8510     *(ptr + 1) = '\0';
8511     r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8512     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8513     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8514
8515     size = MAX_PATH;
8516     r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8517     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8518     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8519
8520     if (version)
8521     {
8522         size = MAX_PATH;
8523         sprintf(path, "%s\\FileName2.dll", CURR_DIR);
8524         r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8525         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8526         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8527
8528         size = MAX_PATH;
8529         r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8530         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8531         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8532
8533         size = MAX_PATH;
8534         sprintf(path, "%s\\FileName4.dll", CURR_DIR);
8535         r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8536         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8537         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8538     }
8539
8540     delete_win_ini("IniFile.ini");
8541     DeleteFileA("FileName1");
8542     DeleteFileA("FileName2.dll");
8543     DeleteFileA("FileName3.dll");
8544     DeleteFileA("FileName4.dll");
8545     MsiCloseHandle(hpkg);
8546     DeleteFileA(msifile);
8547 }
8548
8549 static void test_appsearch_drlocator(void)
8550 {
8551     MSIHANDLE hpkg, hdb;
8552     CHAR path[MAX_PATH];
8553     CHAR prop[MAX_PATH];
8554     BOOL version;
8555     LPCSTR str;
8556     DWORD size;
8557     UINT r;
8558
8559     version = TRUE;
8560     if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
8561         version = FALSE;
8562
8563     DeleteFileA("test.dll");
8564
8565     create_test_file("FileName1");
8566     CreateDirectoryA("one", NULL);
8567     CreateDirectoryA("one\\two", NULL);
8568     CreateDirectoryA("one\\two\\three", NULL);
8569     create_test_file("one\\two\\three\\FileName2");
8570     CreateDirectoryA("another", NULL);
8571     create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8572     create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8573     create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8574
8575     hdb = create_package_db();
8576     ok(hdb, "Expected a valid database handle\n");
8577
8578     r = create_appsearch_table(hdb);
8579     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8580
8581     r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8582     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8583
8584     r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8585     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8586
8587     r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8588     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8589
8590     r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8591     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8592
8593     r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8594     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8595
8596     r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8597     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8598
8599     r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8600     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8601
8602     r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8603     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8604
8605     r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8606     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8607
8608     r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8609     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8610
8611     r = create_drlocator_table(hdb);
8612     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8613
8614     /* no parent, full path, depth 0, signature */
8615     sprintf(path, "'NewSignature1', '', '%s', 0", CURR_DIR);
8616     r = add_drlocator_entry(hdb, path);
8617     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8618
8619     /* no parent, full path, depth 0, no signature */
8620     sprintf(path, "'NewSignature2', '', '%s', 0", CURR_DIR);
8621     r = add_drlocator_entry(hdb, path);
8622     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8623
8624     /* no parent, relative path, depth 0, no signature */
8625     sprintf(path, "'NewSignature3', '', '%s', 0", CURR_DIR + 3);
8626     r = add_drlocator_entry(hdb, path);
8627     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8628
8629     /* no parent, full path, depth 2, signature */
8630     sprintf(path, "'NewSignature4', '', '%s', 2", CURR_DIR);
8631     r = add_drlocator_entry(hdb, path);
8632     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8633
8634     /* no parent, full path, depth 3, signature */
8635     sprintf(path, "'NewSignature5', '', '%s', 3", CURR_DIR);
8636     r = add_drlocator_entry(hdb, path);
8637     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8638
8639     /* no parent, full path, depth 1, signature is dir */
8640     sprintf(path, "'NewSignature6', '', '%s', 1", CURR_DIR);
8641     r = add_drlocator_entry(hdb, path);
8642     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8643
8644     /* parent is in DrLocator, relative path, depth 0, signature */
8645     sprintf(path, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
8646     r = add_drlocator_entry(hdb, path);
8647     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8648
8649     /* no parent, full path, depth 0, signature w/ version */
8650     sprintf(path, "'NewSignature8', '', '%s', 0", CURR_DIR);
8651     r = add_drlocator_entry(hdb, path);
8652     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8653
8654     /* no parent, full path, depth 0, signature w/ version, ver > max */
8655     sprintf(path, "'NewSignature9', '', '%s', 0", CURR_DIR);
8656     r = add_drlocator_entry(hdb, path);
8657     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8658
8659     /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
8660     sprintf(path, "'NewSignature10', '', '%s', 0", CURR_DIR);
8661     r = add_drlocator_entry(hdb, path);
8662     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8663
8664     r = create_signature_table(hdb);
8665     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8666
8667     str = "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
8668     r = add_signature_entry(hdb, str);
8669     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8670
8671     str = "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
8672     r = add_signature_entry(hdb, str);
8673     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8674
8675     str = "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
8676     r = add_signature_entry(hdb, str);
8677     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8678
8679     str = "'NewSignature6', 'another', '', '', '', '', '', '', ''";
8680     r = add_signature_entry(hdb, str);
8681     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8682
8683     str = "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
8684     r = add_signature_entry(hdb, str);
8685     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8686
8687     str = "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8688     r = add_signature_entry(hdb, str);
8689     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8690
8691     str = "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8692     r = add_signature_entry(hdb, str);
8693     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8694
8695     str = "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8696     r = add_signature_entry(hdb, str);
8697     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8698
8699     hpkg = package_from_db(hdb);
8700     ok(hpkg, "Expected a valid package handle\n");
8701
8702     r = MsiDoAction(hpkg, "AppSearch");
8703     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8704
8705     size = MAX_PATH;
8706     sprintf(path, "%s\\FileName1", CURR_DIR);
8707     r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8708     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8709     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8710
8711     size = MAX_PATH;
8712     sprintf(path, "%s\\", CURR_DIR);
8713     r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8714     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8715     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8716
8717     size = MAX_PATH;
8718     sprintf(path, "%s\\", CURR_DIR);
8719     r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8720     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8721     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8722
8723     size = MAX_PATH;
8724     r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
8725     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8726     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8727
8728     size = MAX_PATH;
8729     sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
8730     r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8731     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8732     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8733
8734     size = MAX_PATH;
8735     r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8736     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8737     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8738
8739     size = MAX_PATH;
8740     sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
8741     r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8742     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8743     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8744
8745     if (version)
8746     {
8747         size = MAX_PATH;
8748         sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8749         r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8750         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8751         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8752
8753         size = MAX_PATH;
8754         r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8755         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8756         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8757
8758         size = MAX_PATH;
8759         r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8760         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8761         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8762     }
8763
8764     DeleteFileA("FileName1");
8765     DeleteFileA("FileName3.dll");
8766     DeleteFileA("FileName4.dll");
8767     DeleteFileA("FileName5.dll");
8768     DeleteFileA("one\\two\\three\\FileName2");
8769     RemoveDirectoryA("one\\two\\three");
8770     RemoveDirectoryA("one\\two");
8771     RemoveDirectoryA("one");
8772     RemoveDirectoryA("another");
8773     MsiCloseHandle(hpkg);
8774     DeleteFileA(msifile);
8775 }
8776
8777 static void test_featureparents(void)
8778 {
8779     MSIHANDLE hpkg;
8780     UINT r;
8781     MSIHANDLE hdb;
8782     INSTALLSTATE state, action;
8783
8784     hdb = create_package_db();
8785     ok ( hdb, "failed to create package database\n" );
8786
8787     r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
8788     ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
8789
8790     r = create_feature_table( hdb );
8791     ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
8792
8793     r = create_component_table( hdb );
8794     ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
8795
8796     r = create_feature_components_table( hdb );
8797     ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
8798
8799     r = create_file_table( hdb );
8800     ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
8801
8802     /* msidbFeatureAttributesFavorLocal */
8803     r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
8804     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
8805
8806     /* msidbFeatureAttributesFavorSource */
8807     r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
8808     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
8809
8810     /* msidbFeatureAttributesFavorLocal */
8811     r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
8812     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
8813
8814     /* disabled because of install level */
8815     r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
8816     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
8817
8818     /* child feature of disabled feature */
8819     r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
8820     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
8821
8822     /* component of disabled feature (install level) */
8823     r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
8824     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8825
8826     /* component of disabled child feature (install level) */
8827     r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
8828     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8829
8830     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
8831     r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
8832     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8833
8834     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
8835     r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
8836     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8837
8838     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
8839     r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
8840     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8841
8842     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
8843     r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
8844     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8845
8846     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
8847     r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
8848     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8849
8850     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
8851     r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
8852     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8853
8854     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
8855     r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
8856     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8857
8858     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
8859     r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
8860     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8861
8862     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
8863     r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
8864
8865     r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
8866     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8867
8868     r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
8869     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8870
8871     r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
8872     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8873
8874     r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
8875     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8876
8877     r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
8878     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8879
8880     r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
8881     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8882
8883     r = add_feature_components_entry( hdb, "'orion', 'leo'" );
8884     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8885
8886     r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
8887     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8888
8889     r = add_feature_components_entry( hdb, "'orion', 'libra'" );
8890     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8891
8892     r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
8893     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8894
8895     r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
8896     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8897
8898     r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
8899     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8900
8901     r = add_feature_components_entry( hdb, "'orion', 'canis'" );
8902     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8903
8904     r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
8905     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8906
8907     r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
8908     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8909
8910     r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
8911     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8912
8913     r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
8914     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
8915
8916     r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
8917     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
8918
8919     r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
8920     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
8921
8922     r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
8923     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
8924
8925     r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
8926     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
8927
8928     r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
8929     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
8930
8931     r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
8932     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
8933
8934     r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
8935     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
8936
8937     r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
8938     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
8939
8940     r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
8941     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
8942
8943     r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
8944     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
8945
8946     r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
8947     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
8948
8949     hpkg = package_from_db( hdb );
8950     ok( hpkg, "failed to create package\n");
8951
8952     MsiCloseHandle( hdb );
8953
8954     r = MsiDoAction( hpkg, "CostInitialize");
8955     ok( r == ERROR_SUCCESS, "cost init failed\n");
8956
8957     r = MsiDoAction( hpkg, "FileCost");
8958     ok( r == ERROR_SUCCESS, "file cost failed\n");
8959
8960     r = MsiDoAction( hpkg, "CostFinalize");
8961     ok( r == ERROR_SUCCESS, "cost finalize failed\n");
8962
8963     state = 0xdeadbee;
8964     action = 0xdeadbee;
8965     r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
8966     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
8967     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
8968     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
8969
8970     state = 0xdeadbee;
8971     action = 0xdeadbee;
8972     r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
8973     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
8974     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
8975     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
8976
8977     state = 0xdeadbee;
8978     action = 0xdeadbee;
8979     r = MsiGetFeatureState(hpkg, "orion", &state, &action);
8980     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
8981     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
8982     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
8983
8984     state = 0xdeadbee;
8985     action = 0xdeadbee;
8986     r = MsiGetFeatureState(hpkg, "waters", &state, &action);
8987     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
8988     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
8989     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
8990
8991     state = 0xdeadbee;
8992     action = 0xdeadbee;
8993     r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
8994     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
8995     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
8996     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
8997
8998     state = 0xdeadbee;
8999     action = 0xdeadbee;
9000     r = MsiGetComponentState(hpkg, "leo", &state, &action);
9001     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9002     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
9003     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9004
9005     state = 0xdeadbee;
9006     action = 0xdeadbee;
9007     r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9008     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9009     ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9010     ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9011
9012     state = 0xdeadbee;
9013     action = 0xdeadbee;
9014     r = MsiGetComponentState(hpkg, "libra", &state, &action);
9015     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9016     ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9017     ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9018
9019     state = 0xdeadbee;
9020     action = 0xdeadbee;
9021     r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9022     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9023     ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9024     ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9025
9026     state = 0xdeadbee;
9027     action = 0xdeadbee;
9028     r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9029     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9030     ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9031     ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9032
9033     state = 0xdeadbee;
9034     action = 0xdeadbee;
9035     r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9036     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9037     ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9038     ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
9039
9040     state = 0xdeadbee;
9041     action = 0xdeadbee;
9042     r = MsiGetComponentState(hpkg, "canis", &state, &action);
9043     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9044     ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9045     ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
9046
9047     state = 0xdeadbee;
9048     action = 0xdeadbee;
9049     r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9050     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9051     ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9052     ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
9053
9054     state = 0xdeadbee;
9055     action = 0xdeadbee;
9056     r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9057     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9058     ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9059     ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
9060
9061     state = 0xdeadbee;
9062     action = 0xdeadbee;
9063     r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9064     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9065     ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9066     ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9067
9068     state = 0xdeadbee;
9069     action = 0xdeadbee;
9070     r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9071     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9072     ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
9073     ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
9074
9075     r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
9076     ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
9077
9078     state = 0xdeadbee;
9079     action = 0xdeadbee;
9080     r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
9081     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9082     ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
9083     ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
9084
9085     state = 0xdeadbee;
9086     action = 0xdeadbee;
9087     r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
9088     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9089     ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
9090     ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
9091
9092     state = 0xdeadbee;
9093     action = 0xdeadbee;
9094     r = MsiGetFeatureState(hpkg, "orion", &state, &action);
9095     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9096     ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
9097     ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
9098
9099     state = 0xdeadbee;
9100     action = 0xdeadbee;
9101     r = MsiGetComponentState(hpkg, "leo", &state, &action);
9102     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9103     ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
9104     ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
9105
9106     state = 0xdeadbee;
9107     action = 0xdeadbee;
9108     r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9109     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9110     ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9111     ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9112
9113     state = 0xdeadbee;
9114     action = 0xdeadbee;
9115     r = MsiGetComponentState(hpkg, "libra", &state, &action);
9116     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9117     ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9118     ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9119
9120     state = 0xdeadbee;
9121     action = 0xdeadbee;
9122     r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9123     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9124     ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9125     ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9126
9127     state = 0xdeadbee;
9128     action = 0xdeadbee;
9129     r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9130     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9131     ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9132     ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9133
9134     state = 0xdeadbee;
9135     action = 0xdeadbee;
9136     r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9137     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9138     ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9139     ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
9140
9141     state = 0xdeadbee;
9142     action = 0xdeadbee;
9143     r = MsiGetComponentState(hpkg, "canis", &state, &action);
9144     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9145     ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9146     ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
9147
9148     state = 0xdeadbee;
9149     action = 0xdeadbee;
9150     r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9151     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9152     ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9153     ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
9154
9155     state = 0xdeadbee;
9156     action = 0xdeadbee;
9157     r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9158     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9159     ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9160     ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
9161
9162     state = 0xdeadbee;
9163     action = 0xdeadbee;
9164     r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9165     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9166     ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9167     ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9168
9169     state = 0xdeadbee;
9170     action = 0xdeadbee;
9171     r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9172     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9173     ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
9174     ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
9175     
9176     MsiCloseHandle(hpkg);
9177     DeleteFileA(msifile);
9178 }
9179
9180 static void test_installprops(void)
9181 {
9182     MSIHANDLE hpkg, hdb;
9183     CHAR path[MAX_PATH];
9184     CHAR buf[MAX_PATH];
9185     DWORD size, type;
9186     LANGID langid;
9187     HKEY hkey1, hkey2;
9188     int res;
9189     UINT r;
9190
9191     GetCurrentDirectory(MAX_PATH, path);
9192     lstrcat(path, "\\");
9193     lstrcat(path, msifile);
9194
9195     hdb = create_package_db();
9196     ok( hdb, "failed to create database\n");
9197
9198     hpkg = package_from_db(hdb);
9199     ok( hpkg, "failed to create package\n");
9200
9201     MsiCloseHandle(hdb);
9202
9203     size = MAX_PATH;
9204     r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
9205     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9206     ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9207
9208     RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
9209
9210     RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2);
9211
9212     size = MAX_PATH;
9213     type = REG_SZ;
9214     *path = '\0';
9215     if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
9216     {
9217         size = MAX_PATH;
9218         type = REG_SZ;
9219         RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
9220     }
9221
9222     /* win9x doesn't set this */
9223     if (*path)
9224     {
9225         size = MAX_PATH;
9226         r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
9227         ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9228         ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9229     }
9230
9231     size = MAX_PATH;
9232     type = REG_SZ;
9233     *path = '\0';
9234     if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
9235     {
9236         size = MAX_PATH;
9237         type = REG_SZ;
9238         RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
9239     }
9240
9241     if (*path)
9242     {
9243         size = MAX_PATH;
9244         r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
9245         ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9246         ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9247     }
9248
9249     size = MAX_PATH;
9250     r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
9251     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9252     trace("VersionDatabase = %s\n", buf);
9253
9254     size = MAX_PATH;
9255     r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
9256     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9257     trace("VersionMsi = %s\n", buf);
9258
9259     size = MAX_PATH;
9260     r = MsiGetProperty(hpkg, "Date", buf, &size);
9261     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9262     trace("Date = %s\n", buf);
9263
9264     size = MAX_PATH;
9265     r = MsiGetProperty(hpkg, "Time", buf, &size);
9266     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9267     trace("Time = %s\n", buf);
9268
9269     size = MAX_PATH;
9270     r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
9271     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9272     trace("PackageCode = %s\n", buf);
9273
9274     langid = GetUserDefaultLangID();
9275     sprintf(path, "%d", langid);
9276
9277     size = MAX_PATH;
9278     r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
9279     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
9280     ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
9281
9282     res = GetSystemMetrics(SM_CXSCREEN);
9283     size = MAX_PATH;
9284     r = MsiGetProperty(hpkg, "ScreenX", buf, &size);
9285     ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
9286
9287     res = GetSystemMetrics(SM_CYSCREEN);
9288     size = MAX_PATH;
9289     r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
9290     ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
9291
9292     CloseHandle(hkey1);
9293     CloseHandle(hkey2);
9294     MsiCloseHandle(hpkg);
9295     DeleteFile(msifile);
9296 }
9297
9298 static void test_launchconditions(void)
9299 {
9300     MSIHANDLE hpkg;
9301     MSIHANDLE hdb;
9302     UINT r;
9303
9304     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9305
9306     hdb = create_package_db();
9307     ok( hdb, "failed to create package database\n" );
9308
9309     r = create_launchcondition_table( hdb );
9310     ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
9311
9312     r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
9313     ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
9314
9315     /* invalid condition */
9316     r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
9317     ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
9318
9319     hpkg = package_from_db( hdb );
9320     ok( hpkg, "failed to create package\n");
9321
9322     MsiCloseHandle( hdb );
9323
9324     r = MsiSetProperty( hpkg, "X", "1" );
9325     ok( r == ERROR_SUCCESS, "failed to set property\n" );
9326
9327     /* invalid conditions are ignored */
9328     r = MsiDoAction( hpkg, "LaunchConditions" );
9329     ok( r == ERROR_SUCCESS, "cost init failed\n" );
9330
9331     /* verify LaunchConditions still does some verification */
9332     r = MsiSetProperty( hpkg, "X", "2" );
9333     ok( r == ERROR_SUCCESS, "failed to set property\n" );
9334
9335     r = MsiDoAction( hpkg, "LaunchConditions" );
9336     ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
9337
9338     MsiCloseHandle( hpkg );
9339     DeleteFile( msifile );
9340 }
9341
9342 static void test_ccpsearch(void)
9343 {
9344     MSIHANDLE hdb, hpkg;
9345     CHAR prop[MAX_PATH];
9346     DWORD size = MAX_PATH;
9347     UINT r;
9348
9349     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9350
9351     hdb = create_package_db();
9352     ok(hdb, "failed to create package database\n");
9353
9354     r = create_ccpsearch_table(hdb);
9355     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9356
9357     r = add_ccpsearch_entry(hdb, "'CCP_random'");
9358     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9359
9360     r = add_ccpsearch_entry(hdb, "'RMCCP_random'");
9361     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9362
9363     r = create_reglocator_table(hdb);
9364     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9365
9366     r = add_reglocator_entry(hdb, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
9367     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9368
9369     r = create_drlocator_table(hdb);
9370     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9371
9372     r = add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
9373     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9374
9375     r = create_signature_table(hdb);
9376     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9377
9378     hpkg = package_from_db(hdb);
9379     ok(hpkg, "failed to create package\n");
9380
9381     MsiCloseHandle(hdb);
9382
9383     r = MsiDoAction(hpkg, "CCPSearch");
9384     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9385
9386     r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
9387     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9388     ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
9389
9390     MsiCloseHandle(hpkg);
9391     DeleteFileA(msifile);
9392 }
9393
9394 static void test_complocator(void)
9395 {
9396     MSIHANDLE hdb, hpkg;
9397     UINT r;
9398     CHAR prop[MAX_PATH];
9399     CHAR expected[MAX_PATH];
9400     DWORD size = MAX_PATH;
9401
9402     hdb = create_package_db();
9403     ok(hdb, "failed to create package database\n");
9404
9405     r = create_appsearch_table(hdb);
9406     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9407
9408     r = add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
9409     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9410
9411     r = add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
9412     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9413
9414     r = add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
9415     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9416
9417     r = add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
9418     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9419
9420     r = add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
9421     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9422
9423     r = add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
9424     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9425
9426     r = add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
9427     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9428
9429     r = add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
9430     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9431
9432     r = add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
9433     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9434
9435     r = add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
9436     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9437
9438     r = add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
9439     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9440
9441     r = add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
9442     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9443
9444     r = add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
9445     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9446
9447     r = add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
9448     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9449
9450     r = add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
9451     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9452
9453     r = add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
9454     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9455
9456     r = create_complocator_table(hdb);
9457     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9458
9459     r = add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
9460     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9461
9462     r = add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
9463     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9464
9465     r = add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
9466     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9467
9468     r = add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
9469     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9470
9471     r = add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
9472     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9473
9474     r = add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
9475     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9476
9477     r = add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
9478     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9479
9480     r = add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
9481     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9482
9483     r = add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
9484     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9485
9486     r = add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
9487     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9488
9489     r = add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
9490     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9491
9492     r = add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
9493     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9494
9495     r = add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
9496     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9497
9498     r = add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
9499     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9500
9501     r = add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
9502     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9503
9504     r = add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
9505     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9506
9507     r = create_signature_table(hdb);
9508     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9509
9510     r = add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
9511     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9512
9513     r = add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
9514     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9515
9516     r = add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
9517     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9518
9519     r = add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
9520     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9521
9522     r = add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
9523     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9524
9525     r = add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
9526     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9527
9528     r = add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
9529     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9530
9531     r = add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
9532     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9533
9534     hpkg = package_from_db(hdb);
9535     ok(hpkg, "failed to create package\n");
9536
9537     MsiCloseHandle(hdb);
9538
9539     create_test_file("abelisaurus");
9540     create_test_file("bactrosaurus");
9541     create_test_file("camelotia");
9542     create_test_file("diclonius");
9543     create_test_file("echinodon");
9544     create_test_file("falcarius");
9545     create_test_file("gallimimus");
9546     create_test_file("hagryphus");
9547     CreateDirectoryA("iguanodon", NULL);
9548     CreateDirectoryA("jobaria", NULL);
9549     CreateDirectoryA("kakuru", NULL);
9550     CreateDirectoryA("labocania", NULL);
9551     CreateDirectoryA("megaraptor", NULL);
9552     CreateDirectoryA("neosodon", NULL);
9553     CreateDirectoryA("olorotitan", NULL);
9554     CreateDirectoryA("pantydraco", NULL);
9555
9556     set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE,
9557                        "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL, FALSE);
9558     set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE,
9559                        "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL, FALSE);
9560     set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE,
9561                        "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL, FALSE);
9562     set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE,
9563                        "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL, FALSE);
9564     set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE,
9565                        "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL, FALSE);
9566     set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE,
9567                        "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL, FALSE);
9568     set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE,
9569                        "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL, FALSE);
9570     set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE,
9571                        "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL, FALSE);
9572
9573     r = MsiDoAction(hpkg, "AppSearch");
9574     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9575
9576     size = MAX_PATH;
9577     r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
9578     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9579
9580     lstrcpyA(expected, CURR_DIR);
9581     lstrcatA(expected, "\\abelisaurus");
9582     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9583        "Expected %s or empty string, got %s\n", expected, prop);
9584
9585     size = MAX_PATH;
9586     r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
9587     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9588     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9589
9590     size = MAX_PATH;
9591     r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
9592     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9593     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9594
9595     size = MAX_PATH;
9596     r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
9597     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9598     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9599
9600     size = MAX_PATH;
9601     r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
9602     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9603
9604     lstrcpyA(expected, CURR_DIR);
9605     lstrcatA(expected, "\\");
9606     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9607        "Expected %s or empty string, got %s\n", expected, prop);
9608
9609     size = MAX_PATH;
9610     r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
9611     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9612     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9613
9614     size = MAX_PATH;
9615     r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
9616     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9617     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9618
9619     size = MAX_PATH;
9620     r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
9621     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9622     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9623
9624     size = MAX_PATH;
9625     r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
9626     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9627     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9628
9629     size = MAX_PATH;
9630     r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
9631     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9632     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9633
9634     size = MAX_PATH;
9635     r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
9636     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9637     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9638
9639     size = MAX_PATH;
9640     r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
9641     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9642     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9643
9644     size = MAX_PATH;
9645     r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
9646     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9647
9648     lstrcpyA(expected, CURR_DIR);
9649     lstrcatA(expected, "\\");
9650     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9651        "Expected %s or empty string, got %s\n", expected, prop);
9652
9653     size = MAX_PATH;
9654     r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
9655     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9656
9657     lstrcpyA(expected, CURR_DIR);
9658     lstrcatA(expected, "\\neosodon\\");
9659     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9660        "Expected %s or empty string, got %s\n", expected, prop);
9661
9662     size = MAX_PATH;
9663     r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
9664     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9665     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9666
9667     size = MAX_PATH;
9668     r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
9669     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9670     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9671
9672     MsiCloseHandle(hpkg);
9673     DeleteFileA("abelisaurus");
9674     DeleteFileA("bactrosaurus");
9675     DeleteFileA("camelotia");
9676     DeleteFileA("diclonius");
9677     DeleteFileA("echinodon");
9678     DeleteFileA("falcarius");
9679     DeleteFileA("gallimimus");
9680     DeleteFileA("hagryphus");
9681     RemoveDirectoryA("iguanodon");
9682     RemoveDirectoryA("jobaria");
9683     RemoveDirectoryA("kakuru");
9684     RemoveDirectoryA("labocania");
9685     RemoveDirectoryA("megaraptor");
9686     RemoveDirectoryA("neosodon");
9687     RemoveDirectoryA("olorotitan");
9688     RemoveDirectoryA("pantydraco");
9689     delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
9690                           MSIINSTALLCONTEXT_MACHINE, NULL);
9691     delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
9692                           MSIINSTALLCONTEXT_MACHINE, NULL);
9693     delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
9694                           MSIINSTALLCONTEXT_MACHINE, NULL);
9695     delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
9696                           MSIINSTALLCONTEXT_MACHINE, NULL);
9697     delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
9698                           MSIINSTALLCONTEXT_MACHINE, NULL);
9699     delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
9700                           MSIINSTALLCONTEXT_MACHINE, NULL);
9701     delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
9702                           MSIINSTALLCONTEXT_MACHINE, NULL);
9703     delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
9704                           MSIINSTALLCONTEXT_MACHINE, NULL);
9705     DeleteFileA(msifile);
9706 }
9707
9708 static void set_suminfo_prop(MSIHANDLE db, DWORD prop, DWORD val)
9709 {
9710     MSIHANDLE summary;
9711     UINT r;
9712
9713     r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
9714     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9715
9716     r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
9717     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9718
9719     r = MsiSummaryInfoPersist(summary);
9720     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
9721
9722     MsiCloseHandle(summary);
9723 }
9724
9725 static void test_MsiGetSourcePath(void)
9726 {
9727     MSIHANDLE hdb, hpkg;
9728     CHAR path[MAX_PATH];
9729     CHAR cwd[MAX_PATH];
9730     CHAR subsrc[MAX_PATH];
9731     CHAR sub2[MAX_PATH];
9732     DWORD size;
9733     UINT r;
9734
9735     lstrcpyA(cwd, CURR_DIR);
9736     lstrcatA(cwd, "\\");
9737
9738     lstrcpyA(subsrc, cwd);
9739     lstrcatA(subsrc, "subsource");
9740     lstrcatA(subsrc, "\\");
9741
9742     lstrcpyA(sub2, subsrc);
9743     lstrcatA(sub2, "sub2");
9744     lstrcatA(sub2, "\\");
9745
9746     /* uncompressed source */
9747
9748     hdb = create_package_db();
9749     ok( hdb, "failed to create database\n");
9750
9751     set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
9752
9753     r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
9754     ok(r == S_OK, "failed\n");
9755
9756     r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
9757     ok(r == S_OK, "failed\n");
9758
9759     r = add_directory_entry(hdb, "'SubDir2', 'SubDir', 'sub2'");
9760     ok(r == S_OK, "failed\n");
9761
9762     r = MsiDatabaseCommit(hdb);
9763     ok(r == ERROR_SUCCESS , "Failed to commit database\n");
9764
9765     hpkg = package_from_db(hdb);
9766     ok(hpkg, "failed to create package\n");
9767
9768     MsiCloseHandle(hdb);
9769
9770     /* invalid database handle */
9771     size = MAX_PATH;
9772     lstrcpyA(path, "kiwi");
9773     r = MsiGetSourcePath(-1, "TARGETDIR", path, &size);
9774     ok(r == ERROR_INVALID_HANDLE,
9775        "Expected ERROR_INVALID_HANDLE, got %d\n", r);
9776     ok(!lstrcmpA(path, "kiwi"),
9777        "Expected path to be unchanged, got \"%s\"\n", path);
9778     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9779
9780     /* NULL szFolder */
9781     size = MAX_PATH;
9782     lstrcpyA(path, "kiwi");
9783     r = MsiGetSourcePath(hpkg, NULL, path, &size);
9784     ok(r == ERROR_INVALID_PARAMETER,
9785        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
9786     ok(!lstrcmpA(path, "kiwi"),
9787        "Expected path to be unchanged, got \"%s\"\n", path);
9788     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9789
9790     /* empty szFolder */
9791     size = MAX_PATH;
9792     lstrcpyA(path, "kiwi");
9793     r = MsiGetSourcePath(hpkg, "", path, &size);
9794     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9795     ok(!lstrcmpA(path, "kiwi"),
9796        "Expected path to be unchanged, got \"%s\"\n", path);
9797     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9798
9799     /* try TARGETDIR */
9800     size = MAX_PATH;
9801     lstrcpyA(path, "kiwi");
9802     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
9803     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9804     ok(!lstrcmpA(path, "kiwi"),
9805        "Expected path to be unchanged, got \"%s\"\n", path);
9806     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9807
9808     /* try SourceDir */
9809     size = MAX_PATH;
9810     lstrcpyA(path, "kiwi");
9811     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
9812     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9813     ok(!lstrcmpA(path, "kiwi"),
9814        "Expected path to be unchanged, got \"%s\"\n", path);
9815     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9816
9817     /* try SOURCEDIR */
9818     size = MAX_PATH;
9819     lstrcpyA(path, "kiwi");
9820     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9821     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9822     ok(!lstrcmpA(path, "kiwi"),
9823        "Expected path to be unchanged, got \"%s\"\n", path);
9824     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9825
9826     /* source path does not exist, but the property exists */
9827     size = MAX_PATH;
9828     lstrcpyA(path, "kiwi");
9829     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9830     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9831     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9832     ok(size == 0, "Expected 0, got %d\n", size);
9833
9834     /* try SubDir */
9835     size = MAX_PATH;
9836     lstrcpyA(path, "kiwi");
9837     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
9838     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9839     ok(!lstrcmpA(path, "kiwi"),
9840        "Expected path to be unchanged, got \"%s\"\n", path);
9841     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9842
9843     /* try SubDir2 */
9844     size = MAX_PATH;
9845     lstrcpyA(path, "kiwi");
9846     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
9847     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9848     ok(!lstrcmpA(path, "kiwi"),
9849        "Expected path to be unchanged, got \"%s\"\n", path);
9850     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9851
9852     r = MsiDoAction(hpkg, "CostInitialize");
9853     ok(r == ERROR_SUCCESS, "cost init failed\n");
9854
9855     /* try TARGETDIR after CostInitialize */
9856     size = MAX_PATH;
9857     lstrcpyA(path, "kiwi");
9858     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
9859     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9860     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9861     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9862
9863     /* try SourceDir after CostInitialize */
9864     size = MAX_PATH;
9865     lstrcpyA(path, "kiwi");
9866     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
9867     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9868     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9869     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9870
9871     /* try SOURCEDIR after CostInitialize */
9872     size = MAX_PATH;
9873     lstrcpyA(path, "kiwi");
9874     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9875     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9876     ok(!lstrcmpA(path, "kiwi"),
9877        "Expected path to be unchanged, got \"%s\"\n", path);
9878     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9879
9880     /* source path does not exist, but the property exists */
9881     size = MAX_PATH;
9882     lstrcpyA(path, "kiwi");
9883     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9884     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9885     todo_wine
9886     {
9887         ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9888         ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9889     }
9890
9891     /* try SubDir after CostInitialize */
9892     size = MAX_PATH;
9893     lstrcpyA(path, "kiwi");
9894     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
9895     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9896     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
9897     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
9898
9899     /* try SubDir2 after CostInitialize */
9900     size = MAX_PATH;
9901     lstrcpyA(path, "kiwi");
9902     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
9903     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9904     ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
9905     ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
9906
9907     r = MsiDoAction(hpkg, "ResolveSource");
9908     ok(r == ERROR_SUCCESS, "file cost failed\n");
9909
9910     /* try TARGETDIR after ResolveSource */
9911     size = MAX_PATH;
9912     lstrcpyA(path, "kiwi");
9913     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
9914     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9915     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9916     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9917
9918     /* try SourceDir after ResolveSource */
9919     size = MAX_PATH;
9920     lstrcpyA(path, "kiwi");
9921     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
9922     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9923     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9924     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9925
9926     /* try SOURCEDIR after ResolveSource */
9927     size = MAX_PATH;
9928     lstrcpyA(path, "kiwi");
9929     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9930     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9931     ok(!lstrcmpA(path, "kiwi"),
9932        "Expected path to be unchanged, got \"%s\"\n", path);
9933     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9934
9935     /* source path does not exist, but the property exists */
9936     size = MAX_PATH;
9937     lstrcpyA(path, "kiwi");
9938     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9939     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9940     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9941     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9942
9943     /* try SubDir after ResolveSource */
9944     size = MAX_PATH;
9945     lstrcpyA(path, "kiwi");
9946     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
9947     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9948     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
9949     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
9950
9951     /* try SubDir2 after ResolveSource */
9952     size = MAX_PATH;
9953     lstrcpyA(path, "kiwi");
9954     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
9955     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9956     ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
9957     ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
9958
9959     r = MsiDoAction(hpkg, "FileCost");
9960     ok(r == ERROR_SUCCESS, "file cost failed\n");
9961
9962     /* try TARGETDIR after FileCost */
9963     size = MAX_PATH;
9964     lstrcpyA(path, "kiwi");
9965     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
9966     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9967     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9968     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9969
9970     /* try SourceDir after FileCost */
9971     size = MAX_PATH;
9972     lstrcpyA(path, "kiwi");
9973     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
9974     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9975     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9976     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9977
9978     /* try SOURCEDIR after FileCost */
9979     size = MAX_PATH;
9980     lstrcpyA(path, "kiwi");
9981     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9982     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9983     ok(!lstrcmpA(path, "kiwi"),
9984        "Expected path to be unchanged, got \"%s\"\n", path);
9985     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9986
9987     /* try SubDir after FileCost */
9988     size = MAX_PATH;
9989     lstrcpyA(path, "kiwi");
9990     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
9991     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9992     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
9993     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
9994
9995     /* try SubDir2 after FileCost */
9996     size = MAX_PATH;
9997     lstrcpyA(path, "kiwi");
9998     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
9999     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10000     ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10001     ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10002
10003     r = MsiDoAction(hpkg, "CostFinalize");
10004     ok(r == ERROR_SUCCESS, "file cost failed\n");
10005
10006     /* try TARGETDIR after CostFinalize */
10007     size = MAX_PATH;
10008     lstrcpyA(path, "kiwi");
10009     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10010     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10011     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10012     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10013
10014     /* try SourceDir after CostFinalize */
10015     size = MAX_PATH;
10016     lstrcpyA(path, "kiwi");
10017     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10018     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10019     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10020     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10021
10022     /* try SOURCEDIR after CostFinalize */
10023     size = MAX_PATH;
10024     lstrcpyA(path, "kiwi");
10025     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10026     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10027     ok(!lstrcmpA(path, "kiwi"),
10028        "Expected path to be unchanged, got \"%s\"\n", path);
10029     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10030
10031     /* try SubDir after CostFinalize */
10032     size = MAX_PATH;
10033     lstrcpyA(path, "kiwi");
10034     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10035     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10036     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10037     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10038
10039     /* try SubDir2 after CostFinalize */
10040     size = MAX_PATH;
10041     lstrcpyA(path, "kiwi");
10042     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10043     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10044     ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10045     ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10046
10047     /* nonexistent directory */
10048     size = MAX_PATH;
10049     lstrcpyA(path, "kiwi");
10050     r = MsiGetSourcePath(hpkg, "IDontExist", path, &size);
10051     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10052     ok(!lstrcmpA(path, "kiwi"),
10053        "Expected path to be unchanged, got \"%s\"\n", path);
10054     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10055
10056     /* NULL szPathBuf */
10057     size = MAX_PATH;
10058     r = MsiGetSourcePath(hpkg, "SourceDir", NULL, &size);
10059     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10060     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10061
10062     /* NULL pcchPathBuf */
10063     lstrcpyA(path, "kiwi");
10064     r = MsiGetSourcePath(hpkg, "SourceDir", path, NULL);
10065     ok(r == ERROR_INVALID_PARAMETER,
10066        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
10067     ok(!lstrcmpA(path, "kiwi"),
10068        "Expected path to be unchanged, got \"%s\"\n", path);
10069
10070     /* pcchPathBuf is 0 */
10071     size = 0;
10072     lstrcpyA(path, "kiwi");
10073     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10074     ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
10075     ok(!lstrcmpA(path, "kiwi"),
10076        "Expected path to be unchanged, got \"%s\"\n", path);
10077     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10078
10079     /* pcchPathBuf does not have room for NULL terminator */
10080     size = lstrlenA(cwd);
10081     lstrcpyA(path, "kiwi");
10082     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10083     ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
10084     ok(!strncmp(path, cwd, lstrlenA(cwd) - 1),
10085        "Expected path with no backslash, got \"%s\"\n", path);
10086     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10087
10088     /* pcchPathBuf has room for NULL terminator */
10089     size = lstrlenA(cwd) + 1;
10090     lstrcpyA(path, "kiwi");
10091     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10092     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10093     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10094     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10095
10096     MsiCloseHandle(hpkg);
10097
10098     /* compressed source */
10099
10100     r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
10101     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10102
10103     set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed);
10104
10105     hpkg = package_from_db(hdb);
10106     ok(hpkg, "failed to create package\n");
10107
10108     r = MsiDoAction(hpkg, "CostInitialize");
10109     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10110     r = MsiDoAction(hpkg, "FileCost");
10111     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10112     r = MsiDoAction(hpkg, "CostFinalize");
10113     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10114
10115     /* try TARGETDIR after CostFinalize */
10116     size = MAX_PATH;
10117     lstrcpyA(path, "kiwi");
10118     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10119     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10120     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10121     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10122
10123     /* try SourceDir after CostFinalize */
10124     size = MAX_PATH;
10125     lstrcpyA(path, "kiwi");
10126     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10127     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10128     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10129     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10130
10131     /* try SOURCEDIR after CostFinalize */
10132     size = MAX_PATH;
10133     lstrcpyA(path, "kiwi");
10134     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10135     todo_wine
10136     {
10137         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10138         ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10139         ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10140     }
10141
10142     /* try SubDir after CostFinalize */
10143     size = MAX_PATH;
10144     lstrcpyA(path, "kiwi");
10145     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10146     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10147     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10148     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10149
10150     /* try SubDir2 after CostFinalize */
10151     size = MAX_PATH;
10152     lstrcpyA(path, "kiwi");
10153     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10154     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10155     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10156     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10157
10158     MsiCloseHandle(hpkg);
10159     DeleteFile(msifile);
10160 }
10161
10162 static void test_shortlongsource(void)
10163 {
10164     MSIHANDLE hdb, hpkg;
10165     CHAR path[MAX_PATH];
10166     CHAR cwd[MAX_PATH];
10167     CHAR subsrc[MAX_PATH];
10168     DWORD size;
10169     UINT r;
10170
10171     lstrcpyA(cwd, CURR_DIR);
10172     lstrcatA(cwd, "\\");
10173
10174     lstrcpyA(subsrc, cwd);
10175     lstrcatA(subsrc, "long");
10176     lstrcatA(subsrc, "\\");
10177
10178     /* long file names */
10179
10180     hdb = create_package_db();
10181     ok( hdb, "failed to create database\n");
10182
10183     set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
10184
10185     r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
10186     ok(r == S_OK, "failed\n");
10187
10188     r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'short|long'");
10189     ok(r == S_OK, "failed\n");
10190
10191     /* CostInitialize:short */
10192     r = add_directory_entry(hdb, "'SubDir2', 'TARGETDIR', 'one|two'");
10193     ok(r == S_OK, "failed\n");
10194
10195     /* CostInitialize:long */
10196     r = add_directory_entry(hdb, "'SubDir3', 'TARGETDIR', 'three|four'");
10197     ok(r == S_OK, "failed\n");
10198
10199     /* FileCost:short */
10200     r = add_directory_entry(hdb, "'SubDir4', 'TARGETDIR', 'five|six'");
10201     ok(r == S_OK, "failed\n");
10202
10203     /* FileCost:long */
10204     r = add_directory_entry(hdb, "'SubDir5', 'TARGETDIR', 'seven|eight'");
10205     ok(r == S_OK, "failed\n");
10206
10207     /* CostFinalize:short */
10208     r = add_directory_entry(hdb, "'SubDir6', 'TARGETDIR', 'nine|ten'");
10209     ok(r == S_OK, "failed\n");
10210
10211     /* CostFinalize:long */
10212     r = add_directory_entry(hdb, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
10213     ok(r == S_OK, "failed\n");
10214
10215     MsiDatabaseCommit(hdb);
10216
10217     hpkg = package_from_db(hdb);
10218     ok(hpkg, "failed to create package\n");
10219
10220     MsiCloseHandle(hdb);
10221
10222     CreateDirectoryA("one", NULL);
10223     CreateDirectoryA("four", NULL);
10224
10225     r = MsiDoAction(hpkg, "CostInitialize");
10226     ok(r == ERROR_SUCCESS, "file cost failed\n");
10227
10228     CreateDirectory("five", NULL);
10229     CreateDirectory("eight", NULL);
10230
10231     r = MsiDoAction(hpkg, "FileCost");
10232     ok(r == ERROR_SUCCESS, "file cost failed\n");
10233
10234     CreateDirectory("nine", NULL);
10235     CreateDirectory("twelve", NULL);
10236
10237     r = MsiDoAction(hpkg, "CostFinalize");
10238     ok(r == ERROR_SUCCESS, "file cost failed\n");
10239
10240     /* neither short nor long source directories exist */
10241     size = MAX_PATH;
10242     lstrcpyA(path, "kiwi");
10243     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10244     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10245     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10246     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10247
10248     CreateDirectoryA("short", NULL);
10249
10250     /* short source directory exists */
10251     size = MAX_PATH;
10252     lstrcpyA(path, "kiwi");
10253     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10254     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10255     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10256     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10257
10258     CreateDirectoryA("long", NULL);
10259
10260     /* both short and long source directories exist */
10261     size = MAX_PATH;
10262     lstrcpyA(path, "kiwi");
10263     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10264     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10265     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10266     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10267
10268     lstrcpyA(subsrc, cwd);
10269     lstrcatA(subsrc, "two");
10270     lstrcatA(subsrc, "\\");
10271
10272     /* short dir exists before CostInitialize */
10273     size = MAX_PATH;
10274     lstrcpyA(path, "kiwi");
10275     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10276     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10277     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10278     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10279
10280     lstrcpyA(subsrc, cwd);
10281     lstrcatA(subsrc, "four");
10282     lstrcatA(subsrc, "\\");
10283
10284     /* long dir exists before CostInitialize */
10285     size = MAX_PATH;
10286     lstrcpyA(path, "kiwi");
10287     r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
10288     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10289     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10290     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10291
10292     lstrcpyA(subsrc, cwd);
10293     lstrcatA(subsrc, "six");
10294     lstrcatA(subsrc, "\\");
10295
10296     /* short dir exists before FileCost */
10297     size = MAX_PATH;
10298     lstrcpyA(path, "kiwi");
10299     r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
10300     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10301     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10302     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10303
10304     lstrcpyA(subsrc, cwd);
10305     lstrcatA(subsrc, "eight");
10306     lstrcatA(subsrc, "\\");
10307
10308     /* long dir exists before FileCost */
10309     size = MAX_PATH;
10310     lstrcpyA(path, "kiwi");
10311     r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
10312     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10313     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10314     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10315
10316     lstrcpyA(subsrc, cwd);
10317     lstrcatA(subsrc, "ten");
10318     lstrcatA(subsrc, "\\");
10319
10320     /* short dir exists before CostFinalize */
10321     size = MAX_PATH;
10322     lstrcpyA(path, "kiwi");
10323     r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
10324     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10325     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10326     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10327
10328     lstrcpyA(subsrc, cwd);
10329     lstrcatA(subsrc, "twelve");
10330     lstrcatA(subsrc, "\\");
10331
10332     /* long dir exists before CostFinalize */
10333     size = MAX_PATH;
10334     lstrcpyA(path, "kiwi");
10335     r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
10336     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10337     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10338     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10339
10340     MsiCloseHandle(hpkg);
10341     RemoveDirectoryA("short");
10342     RemoveDirectoryA("long");
10343     RemoveDirectoryA("one");
10344     RemoveDirectoryA("four");
10345     RemoveDirectoryA("five");
10346     RemoveDirectoryA("eight");
10347     RemoveDirectoryA("nine");
10348     RemoveDirectoryA("twelve");
10349
10350     /* short file names */
10351
10352     r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
10353     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10354
10355     set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
10356
10357     hpkg = package_from_db(hdb);
10358     ok(hpkg, "failed to create package\n");
10359
10360     MsiCloseHandle(hdb);
10361
10362     CreateDirectoryA("one", NULL);
10363     CreateDirectoryA("four", NULL);
10364
10365     r = MsiDoAction(hpkg, "CostInitialize");
10366     ok(r == ERROR_SUCCESS, "file cost failed\n");
10367
10368     CreateDirectory("five", NULL);
10369     CreateDirectory("eight", NULL);
10370
10371     r = MsiDoAction(hpkg, "FileCost");
10372     ok(r == ERROR_SUCCESS, "file cost failed\n");
10373
10374     CreateDirectory("nine", NULL);
10375     CreateDirectory("twelve", NULL);
10376
10377     r = MsiDoAction(hpkg, "CostFinalize");
10378     ok(r == ERROR_SUCCESS, "file cost failed\n");
10379
10380     lstrcpyA(subsrc, cwd);
10381     lstrcatA(subsrc, "short");
10382     lstrcatA(subsrc, "\\");
10383
10384     /* neither short nor long source directories exist */
10385     size = MAX_PATH;
10386     lstrcpyA(path, "kiwi");
10387     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10388     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10389     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10390     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10391
10392     CreateDirectoryA("short", NULL);
10393
10394     /* short source directory exists */
10395     size = MAX_PATH;
10396     lstrcpyA(path, "kiwi");
10397     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10398     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10399     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10400     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10401
10402     CreateDirectoryA("long", NULL);
10403
10404     /* both short and long source directories exist */
10405     size = MAX_PATH;
10406     lstrcpyA(path, "kiwi");
10407     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10408     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10409     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10410     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10411
10412     lstrcpyA(subsrc, cwd);
10413     lstrcatA(subsrc, "one");
10414     lstrcatA(subsrc, "\\");
10415
10416     /* short dir exists before CostInitialize */
10417     size = MAX_PATH;
10418     lstrcpyA(path, "kiwi");
10419     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10420     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10421     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10422     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10423
10424     lstrcpyA(subsrc, cwd);
10425     lstrcatA(subsrc, "three");
10426     lstrcatA(subsrc, "\\");
10427
10428     /* long dir exists before CostInitialize */
10429     size = MAX_PATH;
10430     lstrcpyA(path, "kiwi");
10431     r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
10432     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10433     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10434     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10435
10436     lstrcpyA(subsrc, cwd);
10437     lstrcatA(subsrc, "five");
10438     lstrcatA(subsrc, "\\");
10439
10440     /* short dir exists before FileCost */
10441     size = MAX_PATH;
10442     lstrcpyA(path, "kiwi");
10443     r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
10444     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10445     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10446     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10447
10448     lstrcpyA(subsrc, cwd);
10449     lstrcatA(subsrc, "seven");
10450     lstrcatA(subsrc, "\\");
10451
10452     /* long dir exists before FileCost */
10453     size = MAX_PATH;
10454     lstrcpyA(path, "kiwi");
10455     r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
10456     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10457     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10458     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10459
10460     lstrcpyA(subsrc, cwd);
10461     lstrcatA(subsrc, "nine");
10462     lstrcatA(subsrc, "\\");
10463
10464     /* short dir exists before CostFinalize */
10465     size = MAX_PATH;
10466     lstrcpyA(path, "kiwi");
10467     r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
10468     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10469     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10470     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10471
10472     lstrcpyA(subsrc, cwd);
10473     lstrcatA(subsrc, "eleven");
10474     lstrcatA(subsrc, "\\");
10475
10476     /* long dir exists before CostFinalize */
10477     size = MAX_PATH;
10478     lstrcpyA(path, "kiwi");
10479     r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
10480     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10481     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10482     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10483
10484     MsiCloseHandle(hpkg);
10485     RemoveDirectoryA("short");
10486     RemoveDirectoryA("long");
10487     RemoveDirectoryA("one");
10488     RemoveDirectoryA("four");
10489     RemoveDirectoryA("five");
10490     RemoveDirectoryA("eight");
10491     RemoveDirectoryA("nine");
10492     RemoveDirectoryA("twelve");
10493     DeleteFileA(msifile);
10494 }
10495
10496 static void test_sourcedir(void)
10497 {
10498     MSIHANDLE hdb, hpkg;
10499     CHAR package[10];
10500     CHAR path[MAX_PATH];
10501     CHAR cwd[MAX_PATH];
10502     CHAR subsrc[MAX_PATH];
10503     DWORD size;
10504     UINT r;
10505
10506     lstrcpyA(cwd, CURR_DIR);
10507     lstrcatA(cwd, "\\");
10508
10509     lstrcpyA(subsrc, cwd);
10510     lstrcatA(subsrc, "long");
10511     lstrcatA(subsrc, "\\");
10512
10513     hdb = create_package_db();
10514     ok( hdb, "failed to create database\n");
10515
10516     r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
10517     ok(r == S_OK, "failed\n");
10518
10519     sprintf(package, "#%i", hdb);
10520     r = MsiOpenPackage(package, &hpkg);
10521     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10522
10523     /* properties only */
10524
10525     /* SourceDir prop */
10526     size = MAX_PATH;
10527     lstrcpyA(path, "kiwi");
10528     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10529     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10530     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10531     ok(size == 0, "Expected 0, got %d\n", size);
10532
10533     /* SOURCEDIR prop */
10534     size = MAX_PATH;
10535     lstrcpyA(path, "kiwi");
10536     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10537     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10538     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10539     ok(size == 0, "Expected 0, got %d\n", size);
10540
10541     r = MsiDoAction(hpkg, "CostInitialize");
10542     ok(r == ERROR_SUCCESS, "file cost failed\n");
10543
10544     /* SourceDir after CostInitialize */
10545     size = MAX_PATH;
10546     lstrcpyA(path, "kiwi");
10547     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10548     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10549     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10550     ok(size == 0, "Expected 0, got %d\n", size);
10551
10552     /* SOURCEDIR after CostInitialize */
10553     size = MAX_PATH;
10554     lstrcpyA(path, "kiwi");
10555     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10556     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10557     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10558     ok(size == 0, "Expected 0, got %d\n", size);
10559
10560     r = MsiDoAction(hpkg, "FileCost");
10561     ok(r == ERROR_SUCCESS, "file cost failed\n");
10562
10563     /* SourceDir after FileCost */
10564     size = MAX_PATH;
10565     lstrcpyA(path, "kiwi");
10566     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10567     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10568     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10569     ok(size == 0, "Expected 0, got %d\n", size);
10570
10571     /* SOURCEDIR after FileCost */
10572     size = MAX_PATH;
10573     lstrcpyA(path, "kiwi");
10574     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10575     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10576     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10577     ok(size == 0, "Expected 0, got %d\n", size);
10578
10579     r = MsiDoAction(hpkg, "CostFinalize");
10580     ok(r == ERROR_SUCCESS, "file cost failed\n");
10581
10582     /* SourceDir after CostFinalize */
10583     size = MAX_PATH;
10584     lstrcpyA(path, "kiwi");
10585     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10586     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10587     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10588     ok(size == 0, "Expected 0, got %d\n", size);
10589
10590     /* SOURCEDIR after CostFinalize */
10591     size = MAX_PATH;
10592     lstrcpyA(path, "kiwi");
10593     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10594     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10595     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10596     ok(size == 0, "Expected 0, got %d\n", size);
10597
10598     r = MsiDoAction(hpkg, "ResolveSource");
10599     ok(r == ERROR_SUCCESS, "file cost failed\n");
10600
10601     /* SourceDir after ResolveSource */
10602     size = MAX_PATH;
10603     lstrcpyA(path, "kiwi");
10604     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10605     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10606     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10607     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10608
10609     /* SOURCEDIR after ResolveSource */
10610     size = MAX_PATH;
10611     lstrcpyA(path, "kiwi");
10612     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10613     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10614     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10615     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10616
10617     /* random casing */
10618     size = MAX_PATH;
10619     lstrcpyA(path, "kiwi");
10620     r = MsiGetProperty(hpkg, "SoUrCeDiR", path, &size);
10621     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10622     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10623     ok(size == 0, "Expected 0, got %d\n", size);
10624
10625     MsiCloseHandle(hpkg);
10626
10627     /* reset the package state */
10628     sprintf(package, "#%i", hdb);
10629     r = MsiOpenPackage(package, &hpkg);
10630     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10631
10632     /* test how MsiGetSourcePath affects the properties */
10633
10634     /* SourceDir prop */
10635     size = MAX_PATH;
10636     lstrcpyA(path, "kiwi");
10637     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10638     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10639     todo_wine
10640     {
10641         ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10642         ok(size == 0, "Expected 0, got %d\n", size);
10643     }
10644
10645     size = MAX_PATH;
10646     lstrcpyA(path, "kiwi");
10647     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10648     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10649     ok(!lstrcmpA(path, "kiwi"),
10650        "Expected path to be unchanged, got \"%s\"\n", path);
10651     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10652
10653     /* SourceDir after MsiGetSourcePath */
10654     size = MAX_PATH;
10655     lstrcpyA(path, "kiwi");
10656     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10657     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10658     todo_wine
10659     {
10660         ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10661         ok(size == 0, "Expected 0, got %d\n", size);
10662     }
10663
10664     /* SOURCEDIR prop */
10665     size = MAX_PATH;
10666     lstrcpyA(path, "kiwi");
10667     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10668     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10669     todo_wine
10670     {
10671         ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10672         ok(size == 0, "Expected 0, got %d\n", size);
10673     }
10674
10675     size = MAX_PATH;
10676     lstrcpyA(path, "kiwi");
10677     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10678     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10679     ok(!lstrcmpA(path, "kiwi"),
10680        "Expected path to be unchanged, got \"%s\"\n", path);
10681     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10682
10683     /* SOURCEDIR prop after MsiGetSourcePath */
10684     size = MAX_PATH;
10685     lstrcpyA(path, "kiwi");
10686     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10687     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10688     todo_wine
10689     {
10690         ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10691         ok(size == 0, "Expected 0, got %d\n", size);
10692     }
10693
10694     r = MsiDoAction(hpkg, "CostInitialize");
10695     ok(r == ERROR_SUCCESS, "file cost failed\n");
10696
10697     /* SourceDir after CostInitialize */
10698     size = MAX_PATH;
10699     lstrcpyA(path, "kiwi");
10700     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10701     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10702     todo_wine
10703     {
10704         ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10705         ok(size == 0, "Expected 0, got %d\n", size);
10706     }
10707
10708     size = MAX_PATH;
10709     lstrcpyA(path, "kiwi");
10710     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10711     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10712     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10713     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10714
10715     /* SourceDir after MsiGetSourcePath */
10716     size = MAX_PATH;
10717     lstrcpyA(path, "kiwi");
10718     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10719     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10720     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10721     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10722
10723     /* SOURCEDIR after CostInitialize */
10724     size = MAX_PATH;
10725     lstrcpyA(path, "kiwi");
10726     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10727     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10728     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10729     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10730
10731     /* SOURCEDIR source path still does not exist */
10732     size = MAX_PATH;
10733     lstrcpyA(path, "kiwi");
10734     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10735     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10736     ok(!lstrcmpA(path, "kiwi"),
10737        "Expected path to be unchanged, got \"%s\"\n", path);
10738     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10739
10740     r = MsiDoAction(hpkg, "FileCost");
10741     ok(r == ERROR_SUCCESS, "file cost failed\n");
10742
10743     /* SourceDir after FileCost */
10744     size = MAX_PATH;
10745     lstrcpyA(path, "kiwi");
10746     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10747     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10748     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10749     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10750
10751     /* SOURCEDIR after FileCost */
10752     size = MAX_PATH;
10753     lstrcpyA(path, "kiwi");
10754     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10755     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10756     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10757     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10758
10759     /* SOURCEDIR source path still does not exist */
10760     size = MAX_PATH;
10761     lstrcpyA(path, "kiwi");
10762     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10763     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10764     ok(!lstrcmpA(path, "kiwi"),
10765        "Expected path to be unchanged, got \"%s\"\n", path);
10766     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10767
10768     r = MsiDoAction(hpkg, "CostFinalize");
10769     ok(r == ERROR_SUCCESS, "file cost failed\n");
10770
10771     /* SourceDir after CostFinalize */
10772     size = MAX_PATH;
10773     lstrcpyA(path, "kiwi");
10774     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10775     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10776     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10777     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10778
10779     /* SOURCEDIR after CostFinalize */
10780     size = MAX_PATH;
10781     lstrcpyA(path, "kiwi");
10782     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10783     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10784     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10785     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10786
10787     /* SOURCEDIR source path still does not exist */
10788     size = MAX_PATH;
10789     lstrcpyA(path, "kiwi");
10790     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10791     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10792     ok(!lstrcmpA(path, "kiwi"),
10793        "Expected path to be unchanged, got \"%s\"\n", path);
10794     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10795
10796     r = MsiDoAction(hpkg, "ResolveSource");
10797     ok(r == ERROR_SUCCESS, "file cost failed\n");
10798
10799     /* SourceDir after ResolveSource */
10800     size = MAX_PATH;
10801     lstrcpyA(path, "kiwi");
10802     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10803     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10804     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10805     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10806
10807     /* SOURCEDIR after ResolveSource */
10808     size = MAX_PATH;
10809     lstrcpyA(path, "kiwi");
10810     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10811     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10812     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10813     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10814
10815     /* SOURCEDIR source path still does not exist */
10816     size = MAX_PATH;
10817     lstrcpyA(path, "kiwi");
10818     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10819     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10820     ok(!lstrcmpA(path, "kiwi"),
10821        "Expected path to be unchanged, got \"%s\"\n", path);
10822     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10823
10824     MsiCloseHandle(hdb);
10825     MsiCloseHandle(hpkg);
10826     DeleteFileA(msifile);
10827 }
10828
10829 struct access_res
10830 {
10831     BOOL gothandle;
10832     DWORD lasterr;
10833     BOOL ignore;
10834 };
10835
10836 static const struct access_res create[16] =
10837 {
10838     { TRUE, ERROR_SUCCESS, TRUE },
10839     { TRUE, ERROR_SUCCESS, TRUE },
10840     { TRUE, ERROR_SUCCESS, FALSE },
10841     { TRUE, ERROR_SUCCESS, FALSE },
10842     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10843     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10844     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10845     { TRUE, ERROR_SUCCESS, FALSE },
10846     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10847     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10848     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10849     { TRUE, ERROR_SUCCESS, TRUE },
10850     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10851     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10852     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10853     { TRUE, ERROR_SUCCESS, TRUE }
10854 };
10855
10856 static const struct access_res create_commit[16] =
10857 {
10858     { TRUE, ERROR_SUCCESS, TRUE },
10859     { TRUE, ERROR_SUCCESS, TRUE },
10860     { TRUE, ERROR_SUCCESS, FALSE },
10861     { TRUE, ERROR_SUCCESS, FALSE },
10862     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10863     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10864     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10865     { TRUE, ERROR_SUCCESS, FALSE },
10866     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10867     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10868     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10869     { TRUE, ERROR_SUCCESS, TRUE },
10870     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10871     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10872     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
10873     { TRUE, ERROR_SUCCESS, TRUE }
10874 };
10875
10876 static const struct access_res create_close[16] =
10877 {
10878     { TRUE, ERROR_SUCCESS, FALSE },
10879     { TRUE, ERROR_SUCCESS, FALSE },
10880     { TRUE, ERROR_SUCCESS, FALSE },
10881     { TRUE, ERROR_SUCCESS, FALSE },
10882     { TRUE, ERROR_SUCCESS, FALSE },
10883     { TRUE, ERROR_SUCCESS, FALSE },
10884     { TRUE, ERROR_SUCCESS, FALSE },
10885     { TRUE, ERROR_SUCCESS, FALSE },
10886     { TRUE, ERROR_SUCCESS, FALSE },
10887     { TRUE, ERROR_SUCCESS, FALSE },
10888     { TRUE, ERROR_SUCCESS, FALSE },
10889     { TRUE, ERROR_SUCCESS, FALSE },
10890     { TRUE, ERROR_SUCCESS, FALSE },
10891     { TRUE, ERROR_SUCCESS, FALSE },
10892     { TRUE, ERROR_SUCCESS, FALSE },
10893     { TRUE, ERROR_SUCCESS }
10894 };
10895
10896 static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line)
10897 {
10898     DWORD access = 0, share = 0;
10899     DWORD lasterr;
10900     HANDLE hfile;
10901     int i, j, idx = 0;
10902
10903     for (i = 0; i < 4; i++)
10904     {
10905         if (i == 0) access = 0;
10906         if (i == 1) access = GENERIC_READ;
10907         if (i == 2) access = GENERIC_WRITE;
10908         if (i == 3) access = GENERIC_READ | GENERIC_WRITE;
10909
10910         for (j = 0; j < 4; j++)
10911         {
10912             if (ares[idx].ignore)
10913                 continue;
10914
10915             if (j == 0) share = 0;
10916             if (j == 1) share = FILE_SHARE_READ;
10917             if (j == 2) share = FILE_SHARE_WRITE;
10918             if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE;
10919
10920             SetLastError(0xdeadbeef);
10921             hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
10922                                 FILE_ATTRIBUTE_NORMAL, 0);
10923             lasterr = GetLastError();
10924
10925             ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
10926                "(%d, handle, %d): Expected %d, got %d\n",
10927                line, idx, ares[idx].gothandle,
10928                (hfile != INVALID_HANDLE_VALUE));
10929
10930             ok(lasterr == ares[idx].lasterr ||
10931                lasterr == 0xdeadbeef, /* win9x */
10932                "(%d, lasterr, %d): Expected %d, got %d\n",
10933                line, idx, ares[idx].lasterr, lasterr);
10934
10935             CloseHandle(hfile);
10936             idx++;
10937         }
10938     }
10939 }
10940
10941 #define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
10942
10943 static void test_access(void)
10944 {
10945     MSIHANDLE hdb;
10946     UINT r;
10947
10948     r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
10949     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10950
10951     test_file_access(msifile, create);
10952
10953     r = MsiDatabaseCommit(hdb);
10954     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10955
10956     test_file_access(msifile, create_commit);
10957
10958     MsiCloseHandle(hdb);
10959
10960     test_file_access(msifile, create_close);
10961
10962     DeleteFileA(msifile);
10963
10964     r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATEDIRECT, &hdb);
10965     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10966
10967     test_file_access(msifile, create);
10968
10969     r = MsiDatabaseCommit(hdb);
10970     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10971
10972     test_file_access(msifile, create_commit);
10973
10974     MsiCloseHandle(hdb);
10975
10976     test_file_access(msifile, create_close);
10977
10978     DeleteFileA(msifile);
10979 }
10980
10981 static void test_emptypackage(void)
10982 {
10983     MSIHANDLE hpkg, hdb, hsuminfo;
10984     MSIHANDLE hview, hrec;
10985     MSICONDITION condition;
10986     CHAR buffer[MAX_PATH];
10987     DWORD size;
10988     UINT r;
10989
10990     r = MsiOpenPackageA("", &hpkg);
10991     todo_wine
10992     {
10993         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10994     }
10995
10996     hdb = MsiGetActiveDatabase(hpkg);
10997     todo_wine
10998     {
10999         ok(hdb != 0, "Expected a valid database handle\n");
11000     }
11001
11002     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Tables`", &hview);
11003     todo_wine
11004     {
11005         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11006     }
11007     r = MsiViewExecute(hview, 0);
11008     todo_wine
11009     {
11010         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11011     }
11012
11013     r = MsiViewFetch(hview, &hrec);
11014     todo_wine
11015     {
11016         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11017     }
11018
11019     size = MAX_PATH;
11020     r = MsiRecordGetString(hrec, 1, buffer, &size);
11021     todo_wine
11022     {
11023         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11024         ok(!lstrcmpA(buffer, "_Property"),
11025            "Expected \"_Property\", got \"%s\"\n", buffer);
11026     }
11027
11028     MsiCloseHandle(hrec);
11029
11030     r = MsiViewFetch(hview, &hrec);
11031     todo_wine
11032     {
11033         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11034     }
11035
11036     size = MAX_PATH;
11037     r = MsiRecordGetString(hrec, 1, buffer, &size);
11038     todo_wine
11039     {
11040         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11041         ok(!lstrcmpA(buffer, "#_FolderCache"),
11042            "Expected \"_Property\", got \"%s\"\n", buffer);
11043     }
11044
11045     MsiCloseHandle(hrec);
11046     MsiViewClose(hview);
11047     MsiCloseHandle(hview);
11048
11049     condition = MsiDatabaseIsTablePersistentA(hdb, "_Property");
11050     todo_wine
11051     {
11052         ok(condition == MSICONDITION_FALSE,
11053            "Expected MSICONDITION_FALSE, got %d\n", condition);
11054     }
11055
11056     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
11057     todo_wine
11058     {
11059         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11060     }
11061     r = MsiViewExecute(hview, 0);
11062     todo_wine
11063     {
11064         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11065     }
11066
11067     /* _Property table is not empty */
11068     r = MsiViewFetch(hview, &hrec);
11069     todo_wine
11070     {
11071         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11072     }
11073
11074     MsiCloseHandle(hrec);
11075     MsiViewClose(hview);
11076     MsiCloseHandle(hview);
11077
11078     condition = MsiDatabaseIsTablePersistentA(hdb, "#_FolderCache");
11079     todo_wine
11080     {
11081         ok(condition == MSICONDITION_FALSE,
11082            "Expected MSICONDITION_FALSE, got %d\n", condition);
11083     }
11084
11085     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `#_FolderCache`", &hview);
11086     todo_wine
11087     {
11088         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11089     }
11090     r = MsiViewExecute(hview, 0);
11091     todo_wine
11092     {
11093         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11094     }
11095
11096     /* #_FolderCache is not empty */
11097     r = MsiViewFetch(hview, &hrec);
11098     todo_wine
11099     {
11100         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11101     }
11102
11103     MsiCloseHandle(hrec);
11104     MsiViewClose(hview);
11105     MsiCloseHandle(hview);
11106
11107     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Streams`", &hview);
11108     todo_wine
11109     {
11110         ok(r == ERROR_BAD_QUERY_SYNTAX,
11111            "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11112     }
11113
11114     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Storages`", &hview);
11115     todo_wine
11116     {
11117         ok(r == ERROR_BAD_QUERY_SYNTAX,
11118            "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11119     }
11120
11121     r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsuminfo);
11122     todo_wine
11123     {
11124         ok(r == ERROR_INSTALL_PACKAGE_INVALID,
11125            "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
11126     }
11127
11128     MsiCloseHandle(hsuminfo);
11129
11130     r = MsiDatabaseCommit(hdb);
11131     todo_wine
11132     {
11133         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11134     }
11135
11136     MsiCloseHandle(hdb);
11137     MsiCloseHandle(hpkg);
11138 }
11139
11140 static void test_MsiGetProductProperty(void)
11141 {
11142     MSIHANDLE hprod, hdb;
11143     CHAR val[MAX_PATH];
11144     CHAR path[MAX_PATH];
11145     CHAR query[MAX_PATH];
11146     CHAR keypath[MAX_PATH*2];
11147     CHAR prodcode[MAX_PATH];
11148     CHAR prod_squashed[MAX_PATH];
11149     HKEY prodkey, userkey, props;
11150     LPSTR usersid;
11151     DWORD size;
11152     LONG res;
11153     UINT r;
11154     SC_HANDLE scm;
11155
11156     scm = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
11157     if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
11158     {
11159         win_skip("Different registry keys on Win9x and WinMe\n");
11160         return;
11161     }
11162     CloseServiceHandle(scm);
11163
11164     GetCurrentDirectoryA(MAX_PATH, path);
11165     lstrcatA(path, "\\");
11166
11167     create_test_guid(prodcode, prod_squashed);
11168     get_user_sid(&usersid);
11169
11170     r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
11171     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11172
11173     r = MsiDatabaseCommit(hdb);
11174     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11175
11176     r = set_summary_info(hdb);
11177     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11178
11179     r = run_query(hdb,
11180             "CREATE TABLE `Directory` ( "
11181             "`Directory` CHAR(255) NOT NULL, "
11182             "`Directory_Parent` CHAR(255), "
11183             "`DefaultDir` CHAR(255) NOT NULL "
11184             "PRIMARY KEY `Directory`)");
11185     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11186
11187     r = run_query(hdb,
11188             "CREATE TABLE `Property` ( "
11189             "`Property` CHAR(72) NOT NULL, "
11190             "`Value` CHAR(255) "
11191             "PRIMARY KEY `Property`)");
11192     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11193
11194     sprintf(query, "INSERT INTO `Property` "
11195             "(`Property`, `Value`) "
11196             "VALUES( 'ProductCode', '%s' )", prodcode);
11197     r = run_query(hdb, query);
11198     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11199
11200     r = MsiDatabaseCommit(hdb);
11201     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11202
11203     MsiCloseHandle(hdb);
11204
11205     lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
11206     lstrcatA(keypath, prod_squashed);
11207
11208     res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
11209     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11210
11211     lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
11212     lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
11213     lstrcatA(keypath, prod_squashed);
11214
11215     res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
11216     if (res == ERROR_ACCESS_DENIED)
11217     {
11218         skip("Not enough rights to perform tests\n");
11219         RegDeleteKeyA(prodkey, "");
11220         RegCloseKey(prodkey);
11221         return;
11222     }
11223     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11224
11225     res = RegCreateKeyA(userkey, "InstallProperties", &props);
11226     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11227
11228     lstrcpyA(val, path);
11229     lstrcatA(val, "\\winetest.msi");
11230     res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
11231                          (const BYTE *)val, lstrlenA(val) + 1);
11232     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11233
11234     hprod = 0xdeadbeef;
11235     r = MsiOpenProductA(prodcode, &hprod);
11236     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11237     ok(hprod != 0 && hprod != 0xdeadbeef, "Expected a valid product handle\n");
11238
11239     /* hProduct is invalid */
11240     size = MAX_PATH;
11241     lstrcpyA(val, "apple");
11242     r = MsiGetProductPropertyA(0xdeadbeef, "ProductCode", val, &size);
11243     ok(r == ERROR_INVALID_HANDLE,
11244        "Expected ERROR_INVALID_HANDLE, got %d\n", r);
11245     ok(!lstrcmpA(val, "apple"),
11246        "Expected val to be unchanged, got \"%s\"\n", val);
11247     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11248
11249     /* szProperty is NULL */
11250     size = MAX_PATH;
11251     lstrcpyA(val, "apple");
11252     r = MsiGetProductPropertyA(hprod, NULL, val, &size);
11253     ok(r == ERROR_INVALID_PARAMETER,
11254        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11255     ok(!lstrcmpA(val, "apple"),
11256        "Expected val to be unchanged, got \"%s\"\n", val);
11257     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11258
11259     /* szProperty is empty */
11260     size = MAX_PATH;
11261     lstrcpyA(val, "apple");
11262     r = MsiGetProductPropertyA(hprod, "", val, &size);
11263     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11264     ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
11265     ok(size == 0, "Expected 0, got %d\n", size);
11266
11267     /* get the property */
11268     size = MAX_PATH;
11269     lstrcpyA(val, "apple");
11270     r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11271     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11272     ok(!lstrcmpA(val, prodcode),
11273        "Expected \"%s\", got \"%s\"\n", prodcode, val);
11274     ok(size == lstrlenA(prodcode),
11275        "Expected %d, got %d\n", lstrlenA(prodcode), size);
11276
11277     /* lpValueBuf is NULL */
11278     size = MAX_PATH;
11279     r = MsiGetProductPropertyA(hprod, "ProductCode", NULL, &size);
11280     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11281     ok(size == lstrlenA(prodcode),
11282        "Expected %d, got %d\n", lstrlenA(prodcode), size);
11283
11284     /* pcchValueBuf is NULL */
11285     lstrcpyA(val, "apple");
11286     r = MsiGetProductPropertyA(hprod, "ProductCode", val, NULL);
11287     ok(r == ERROR_INVALID_PARAMETER,
11288        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11289     ok(!lstrcmpA(val, "apple"),
11290        "Expected val to be unchanged, got \"%s\"\n", val);
11291     ok(size == lstrlenA(prodcode),
11292        "Expected %d, got %d\n", lstrlenA(prodcode), size);
11293
11294     /* pcchValueBuf is too small */
11295     size = 4;
11296     lstrcpyA(val, "apple");
11297     r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11298     ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
11299     ok(!strncmp(val, prodcode, 3),
11300        "Expected first 3 chars of \"%s\", got \"%s\"\n", prodcode, val);
11301     ok(size == lstrlenA(prodcode),
11302        "Expected %d, got %d\n", lstrlenA(prodcode), size);
11303
11304     /* pcchValueBuf does not leave room for NULL terminator */
11305     size = lstrlenA(prodcode);
11306     lstrcpyA(val, "apple");
11307     r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11308     ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
11309     ok(!strncmp(val, prodcode, lstrlenA(prodcode) - 1),
11310        "Expected first 37 chars of \"%s\", got \"%s\"\n", prodcode, val);
11311     ok(size == lstrlenA(prodcode),
11312        "Expected %d, got %d\n", lstrlenA(prodcode), size);
11313
11314     /* pcchValueBuf has enough room for NULL terminator */
11315     size = lstrlenA(prodcode) + 1;
11316     lstrcpyA(val, "apple");
11317     r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11318     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11319     ok(!lstrcmpA(val, prodcode),
11320        "Expected \"%s\", got \"%s\"\n", prodcode, val);
11321     ok(size == lstrlenA(prodcode),
11322        "Expected %d, got %d\n", lstrlenA(prodcode), size);
11323
11324     /* nonexistent property */
11325     size = MAX_PATH;
11326     lstrcpyA(val, "apple");
11327     r = MsiGetProductPropertyA(hprod, "IDontExist", val, &size);
11328     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11329     ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
11330     ok(size == 0, "Expected 0, got %d\n", size);
11331
11332     r = MsiSetPropertyA(hprod, "NewProperty", "value");
11333     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11334
11335     /* non-product property set */
11336     size = MAX_PATH;
11337     lstrcpyA(val, "apple");
11338     r = MsiGetProductPropertyA(hprod, "NewProperty", val, &size);
11339     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11340     ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
11341     ok(size == 0, "Expected 0, got %d\n", size);
11342
11343     r = MsiSetPropertyA(hprod, "ProductCode", "value");
11344     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11345
11346     /* non-product property that is also a product property set */
11347     size = MAX_PATH;
11348     lstrcpyA(val, "apple");
11349     r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11350     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11351     ok(!lstrcmpA(val, prodcode),
11352        "Expected \"%s\", got \"%s\"\n", prodcode, val);
11353     ok(size == lstrlenA(prodcode),
11354        "Expected %d, got %d\n", lstrlenA(prodcode), size);
11355
11356     MsiCloseHandle(hprod);
11357
11358     RegDeleteValueA(props, "LocalPackage");
11359     RegDeleteKeyA(props, "");
11360     RegCloseKey(props);
11361     RegDeleteKeyA(userkey, "");
11362     RegCloseKey(userkey);
11363     RegDeleteKeyA(prodkey, "");
11364     RegCloseKey(prodkey);
11365     DeleteFileA(msifile);
11366 }
11367
11368 START_TEST(package)
11369 {
11370     GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
11371
11372     test_createpackage();
11373     test_doaction();
11374     test_gettargetpath_bad();
11375     test_settargetpath();
11376     test_props();
11377     test_property_table();
11378     test_condition();
11379     test_msipackage();
11380     test_formatrecord2();
11381     test_states();
11382     test_getproperty();
11383     test_removefiles();
11384     test_appsearch();
11385     test_appsearch_complocator();
11386     test_appsearch_reglocator();
11387     test_appsearch_inilocator();
11388     test_appsearch_drlocator();
11389     test_featureparents();
11390     test_installprops();
11391     test_launchconditions();
11392     test_ccpsearch();
11393     test_complocator();
11394     test_MsiGetSourcePath();
11395     test_shortlongsource();
11396     test_sourcedir();
11397     test_access();
11398     test_emptypackage();
11399     test_MsiGetProductProperty();
11400 }