hlink: Implement HLINKGETREF flags handling.
[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 #include <srrestoreptapi.h>
30
31 #include "wine/test.h"
32
33 static const char msifile[] = "winetest-package.msi";
34 char CURR_DIR[MAX_PATH];
35
36 static UINT (WINAPI *pMsiApplyMultiplePatchesA)(LPCSTR, LPCSTR, LPCSTR);
37
38 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
39 static BOOL (WINAPI *pGetTokenInformation)( HANDLE, TOKEN_INFORMATION_CLASS, LPVOID, DWORD, PDWORD );
40 static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE );
41 static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
42 static LONG (WINAPI *pRegDeleteKeyExW)(HKEY, LPCWSTR, REGSAM, DWORD);
43 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
44
45 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
46 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
47
48 static void init_functionpointers(void)
49 {
50     HMODULE hmsi = GetModuleHandleA("msi.dll");
51     HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
52     HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
53     HMODULE hsrclient;
54
55 #define GET_PROC(mod, func) \
56     p ## func = (void*)GetProcAddress(mod, #func);
57
58     GET_PROC(hmsi, MsiApplyMultiplePatchesA);
59
60     GET_PROC(hadvapi32, ConvertSidToStringSidA);
61     GET_PROC(hadvapi32, GetTokenInformation);
62     GET_PROC(hadvapi32, OpenProcessToken);
63     GET_PROC(hadvapi32, RegDeleteKeyExA)
64     GET_PROC(hadvapi32, RegDeleteKeyExW)
65     GET_PROC(hkernel32, IsWow64Process)
66
67     hsrclient = LoadLibraryA("srclient.dll");
68     GET_PROC(hsrclient, SRRemoveRestorePoint);
69     GET_PROC(hsrclient, SRSetRestorePointA);
70 #undef GET_PROC
71 }
72
73 static BOOL is_process_limited(void)
74 {
75     HANDLE token;
76
77     if (!pOpenProcessToken || !pGetTokenInformation) return FALSE;
78
79     if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
80     {
81         BOOL ret;
82         TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
83         DWORD size;
84
85         ret = pGetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
86         CloseHandle(token);
87         return (ret && type == TokenElevationTypeLimited);
88     }
89     return FALSE;
90 }
91
92 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
93 {
94     if (pRegDeleteKeyExA)
95         return pRegDeleteKeyExA( key, subkey, access, 0 );
96     return RegDeleteKeyA( key, subkey );
97 }
98
99 static LPSTR get_user_sid(LPSTR *usersid)
100 {
101     HANDLE token;
102     BYTE buf[1024];
103     DWORD size;
104     PTOKEN_USER user;
105
106     if (!pConvertSidToStringSidA)
107     {
108         win_skip("ConvertSidToStringSidA is not available\n");
109         return NULL;
110     }
111
112     *usersid = NULL;
113     OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
114     size = sizeof(buf);
115     GetTokenInformation(token, TokenUser, buf, size, &size);
116     user = (PTOKEN_USER)buf;
117     pConvertSidToStringSidA(user->User.Sid, usersid);
118     ok(*usersid != NULL, "pConvertSidToStringSidA failed lre=%d\n", GetLastError());
119     CloseHandle(token);
120     return *usersid;
121 }
122
123 /* RegDeleteTreeW from dlls/advapi32/registry.c */
124 static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM access)
125 {
126     LONG ret;
127     DWORD dwMaxSubkeyLen, dwMaxValueLen;
128     DWORD dwMaxLen, dwSize;
129     WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
130     HKEY hSubKey = hKey;
131
132     if(lpszSubKey)
133     {
134         ret = RegOpenKeyExW(hKey, lpszSubKey, 0, access, &hSubKey);
135         if (ret) return ret;
136     }
137
138     ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
139             &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
140     if (ret) goto cleanup;
141
142     dwMaxSubkeyLen++;
143     dwMaxValueLen++;
144     dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
145     if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
146     {
147         /* Name too big: alloc a buffer for it */
148         if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
149         {
150             ret = ERROR_NOT_ENOUGH_MEMORY;
151             goto cleanup;
152         }
153     }
154
155     /* Recursively delete all the subkeys */
156     while (TRUE)
157     {
158         dwSize = dwMaxLen;
159         if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
160                           NULL, NULL, NULL)) break;
161
162         ret = package_RegDeleteTreeW(hSubKey, lpszName, access);
163         if (ret) goto cleanup;
164     }
165
166     if (lpszSubKey)
167     {
168         if (pRegDeleteKeyExW)
169             ret = pRegDeleteKeyExW(hKey, lpszSubKey, access, 0);
170         else
171             ret = RegDeleteKeyW(hKey, lpszSubKey);
172     }
173     else
174         while (TRUE)
175         {
176             dwSize = dwMaxLen;
177             if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
178                   NULL, NULL, NULL, NULL)) break;
179
180             ret = RegDeleteValueW(hKey, lpszName);
181             if (ret) goto cleanup;
182         }
183
184 cleanup:
185     if (lpszName != szNameBuf)
186         HeapFree(GetProcessHeap(), 0, lpszName);
187     if(lpszSubKey)
188         RegCloseKey(hSubKey);
189     return ret;
190 }
191
192 static BOOL squash_guid(LPCWSTR in, LPWSTR out)
193 {
194     DWORD i,n=1;
195     GUID guid;
196
197     if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid)))
198         return FALSE;
199
200     for(i=0; i<8; i++)
201         out[7-i] = in[n++];
202     n++;
203     for(i=0; i<4; i++)
204         out[11-i] = in[n++];
205     n++;
206     for(i=0; i<4; i++)
207         out[15-i] = in[n++];
208     n++;
209     for(i=0; i<2; i++)
210     {
211         out[17+i*2] = in[n++];
212         out[16+i*2] = in[n++];
213     }
214     n++;
215     for( ; i<8; i++)
216     {
217         out[17+i*2] = in[n++];
218         out[16+i*2] = in[n++];
219     }
220     out[32]=0;
221     return TRUE;
222 }
223
224 static void create_test_guid(LPSTR prodcode, LPSTR squashed)
225 {
226     WCHAR guidW[MAX_PATH];
227     WCHAR squashedW[MAX_PATH];
228     GUID guid;
229     HRESULT hr;
230     int size;
231
232     hr = CoCreateGuid(&guid);
233     ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
234
235     size = StringFromGUID2(&guid, guidW, MAX_PATH);
236     ok(size == 39, "Expected 39, got %d\n", hr);
237
238     WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL);
239     squash_guid(guidW, squashedW);
240     WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
241 }
242
243 static void set_component_path(LPCSTR filename, MSIINSTALLCONTEXT context,
244                                LPCSTR guid, LPSTR usersid, BOOL dir)
245 {
246     WCHAR guidW[MAX_PATH];
247     WCHAR squashedW[MAX_PATH];
248     CHAR squashed[MAX_PATH];
249     CHAR comppath[MAX_PATH];
250     CHAR prodpath[MAX_PATH];
251     CHAR path[MAX_PATH];
252     LPCSTR prod = NULL;
253     HKEY hkey;
254     REGSAM access = KEY_ALL_ACCESS;
255     BOOL wow64;
256
257     if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
258         access |= KEY_WOW64_64KEY;
259
260     MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
261     squash_guid(guidW, squashedW);
262     WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
263
264     if (context == MSIINSTALLCONTEXT_MACHINE)
265     {
266         prod = "3D0DAE300FACA1300AD792060BCDAA92";
267         sprintf(comppath,
268                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
269                 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
270         lstrcpyA(prodpath,
271                  "SOFTWARE\\Classes\\Installer\\"
272                  "Products\\3D0DAE300FACA1300AD792060BCDAA92");
273     }
274     else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
275     {
276         prod = "7D2F387510109040002000060BECB6AB";
277         sprintf(comppath,
278                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
279                 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
280         sprintf(prodpath,
281                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
282                 "Installer\\%s\\Installer\\Products\\"
283                 "7D2F387510109040002000060BECB6AB", usersid);
284     }
285     else if (context == MSIINSTALLCONTEXT_USERMANAGED)
286     {
287         prod = "7D2F387510109040002000060BECB6AB";
288         sprintf(comppath,
289                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
290                 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
291         sprintf(prodpath,
292                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
293                 "Installer\\Managed\\%s\\Installer\\Products\\"
294                 "7D2F387510109040002000060BECB6AB", usersid);
295     }
296
297     RegCreateKeyExA(HKEY_LOCAL_MACHINE, comppath, 0, NULL, 0, access, NULL, &hkey, NULL);
298
299     lstrcpyA(path, CURR_DIR);
300     lstrcatA(path, "\\");
301     if (!dir) lstrcatA(path, filename);
302
303     RegSetValueExA(hkey, prod, 0, REG_SZ, (LPBYTE)path, lstrlenA(path));
304     RegCloseKey(hkey);
305
306     RegCreateKeyExA(HKEY_LOCAL_MACHINE, prodpath, 0, NULL, 0, access, NULL, &hkey, NULL);
307     RegCloseKey(hkey);
308 }
309
310 static void delete_component_path(LPCSTR guid, MSIINSTALLCONTEXT context, LPSTR usersid)
311 {
312     WCHAR guidW[MAX_PATH];
313     WCHAR squashedW[MAX_PATH];
314     WCHAR substrW[MAX_PATH];
315     CHAR squashed[MAX_PATH];
316     CHAR comppath[MAX_PATH];
317     CHAR prodpath[MAX_PATH];
318     REGSAM access = KEY_ALL_ACCESS;
319     BOOL wow64;
320
321     if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
322         access |= KEY_WOW64_64KEY;
323
324     MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
325     squash_guid(guidW, squashedW);
326     WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
327
328     if (context == MSIINSTALLCONTEXT_MACHINE)
329     {
330         sprintf(comppath,
331                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
332                 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
333         lstrcpyA(prodpath,
334                  "SOFTWARE\\Classes\\Installer\\"
335                  "Products\\3D0DAE300FACA1300AD792060BCDAA92");
336     }
337     else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
338     {
339         sprintf(comppath,
340                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
341                 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
342         sprintf(prodpath,
343                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
344                 "Installer\\%s\\Installer\\Products\\"
345                 "7D2F387510109040002000060BECB6AB", usersid);
346     }
347     else if (context == MSIINSTALLCONTEXT_USERMANAGED)
348     {
349         sprintf(comppath,
350                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
351                 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
352         sprintf(prodpath,
353                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
354                 "Installer\\Managed\\%s\\Installer\\Products\\"
355                 "7D2F387510109040002000060BECB6AB", usersid);
356     }
357
358     MultiByteToWideChar(CP_ACP, 0, comppath, -1, substrW, MAX_PATH);
359     package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW, access);
360
361     MultiByteToWideChar(CP_ACP, 0, prodpath, -1, substrW, MAX_PATH);
362     package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW, access);
363 }
364
365 static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec)
366 {
367     MSIHANDLE hview = 0;
368     UINT r, ret;
369
370     /* open a select query */
371     r = MsiDatabaseOpenView(hdb, query, &hview);
372     if (r != ERROR_SUCCESS)
373         return r;
374     r = MsiViewExecute(hview, 0);
375     if (r != ERROR_SUCCESS)
376         return r;
377     ret = MsiViewFetch(hview, phrec);
378     r = MsiViewClose(hview);
379     if (r != ERROR_SUCCESS)
380         return r;
381     r = MsiCloseHandle(hview);
382     if (r != ERROR_SUCCESS)
383         return r;
384     return ret;
385 }
386
387 static UINT run_query( MSIHANDLE hdb, const char *query )
388 {
389     MSIHANDLE hview = 0;
390     UINT r;
391
392     r = MsiDatabaseOpenView(hdb, query, &hview);
393     if( r != ERROR_SUCCESS )
394         return r;
395
396     r = MsiViewExecute(hview, 0);
397     if( r == ERROR_SUCCESS )
398         r = MsiViewClose(hview);
399     MsiCloseHandle(hview);
400     return r;
401 }
402
403 static UINT create_component_table( MSIHANDLE hdb )
404 {
405     return run_query( hdb,
406             "CREATE TABLE `Component` ( "
407             "`Component` CHAR(72) NOT NULL, "
408             "`ComponentId` CHAR(38), "
409             "`Directory_` CHAR(72) NOT NULL, "
410             "`Attributes` SHORT NOT NULL, "
411             "`Condition` CHAR(255), "
412             "`KeyPath` CHAR(72) "
413             "PRIMARY KEY `Component`)" );
414 }
415
416 static UINT create_feature_table( MSIHANDLE hdb )
417 {
418     return run_query( hdb,
419             "CREATE TABLE `Feature` ( "
420             "`Feature` CHAR(38) NOT NULL, "
421             "`Feature_Parent` CHAR(38), "
422             "`Title` CHAR(64), "
423             "`Description` CHAR(255), "
424             "`Display` SHORT NOT NULL, "
425             "`Level` SHORT NOT NULL, "
426             "`Directory_` CHAR(72), "
427             "`Attributes` SHORT NOT NULL "
428             "PRIMARY KEY `Feature`)" );
429 }
430
431 static UINT create_feature_components_table( MSIHANDLE hdb )
432 {
433     return run_query( hdb,
434             "CREATE TABLE `FeatureComponents` ( "
435             "`Feature_` CHAR(38) NOT NULL, "
436             "`Component_` CHAR(72) NOT NULL "
437             "PRIMARY KEY `Feature_`, `Component_` )" );
438 }
439
440 static UINT create_file_table( MSIHANDLE hdb )
441 {
442     return run_query( hdb,
443             "CREATE TABLE `File` ("
444             "`File` CHAR(72) NOT NULL, "
445             "`Component_` CHAR(72) NOT NULL, "
446             "`FileName` CHAR(255) NOT NULL, "
447             "`FileSize` LONG NOT NULL, "
448             "`Version` CHAR(72), "
449             "`Language` CHAR(20), "
450             "`Attributes` SHORT, "
451             "`Sequence` SHORT NOT NULL "
452             "PRIMARY KEY `File`)" );
453 }
454
455 static UINT create_remove_file_table( MSIHANDLE hdb )
456 {
457     return run_query( hdb,
458             "CREATE TABLE `RemoveFile` ("
459             "`FileKey` CHAR(72) NOT NULL, "
460             "`Component_` CHAR(72) NOT NULL, "
461             "`FileName` CHAR(255) LOCALIZABLE, "
462             "`DirProperty` CHAR(72) NOT NULL, "
463             "`InstallMode` SHORT NOT NULL "
464             "PRIMARY KEY `FileKey`)" );
465 }
466
467 static UINT create_appsearch_table( MSIHANDLE hdb )
468 {
469     return run_query( hdb,
470             "CREATE TABLE `AppSearch` ("
471             "`Property` CHAR(72) NOT NULL, "
472             "`Signature_` CHAR(72) NOT NULL "
473             "PRIMARY KEY `Property`, `Signature_`)" );
474 }
475
476 static UINT create_reglocator_table( MSIHANDLE hdb )
477 {
478     return run_query( hdb,
479             "CREATE TABLE `RegLocator` ("
480             "`Signature_` CHAR(72) NOT NULL, "
481             "`Root` SHORT NOT NULL, "
482             "`Key` CHAR(255) NOT NULL, "
483             "`Name` CHAR(255), "
484             "`Type` SHORT "
485             "PRIMARY KEY `Signature_`)" );
486 }
487
488 static UINT create_signature_table( MSIHANDLE hdb )
489 {
490     return run_query( hdb,
491             "CREATE TABLE `Signature` ("
492             "`Signature` CHAR(72) NOT NULL, "
493             "`FileName` CHAR(255) NOT NULL, "
494             "`MinVersion` CHAR(20), "
495             "`MaxVersion` CHAR(20), "
496             "`MinSize` LONG, "
497             "`MaxSize` LONG, "
498             "`MinDate` LONG, "
499             "`MaxDate` LONG, "
500             "`Languages` CHAR(255) "
501             "PRIMARY KEY `Signature`)" );
502 }
503
504 static UINT create_launchcondition_table( MSIHANDLE hdb )
505 {
506     return run_query( hdb,
507             "CREATE TABLE `LaunchCondition` ("
508             "`Condition` CHAR(255) NOT NULL, "
509             "`Description` CHAR(255) NOT NULL "
510             "PRIMARY KEY `Condition`)" );
511 }
512
513 static UINT create_property_table( MSIHANDLE hdb )
514 {
515     return run_query( hdb,
516             "CREATE TABLE `Property` ("
517             "`Property` CHAR(72) NOT NULL, "
518             "`Value` CHAR(0) "
519             "PRIMARY KEY `Property`)" );
520 }
521
522 static UINT create_install_execute_sequence_table( MSIHANDLE hdb )
523 {
524     return run_query( hdb,
525             "CREATE TABLE `InstallExecuteSequence` ("
526             "`Action` CHAR(72) NOT NULL, "
527             "`Condition` CHAR(255), "
528             "`Sequence` SHORT "
529             "PRIMARY KEY `Action`)" );
530 }
531
532 static UINT create_media_table( MSIHANDLE hdb )
533 {
534     return run_query( hdb,
535             "CREATE TABLE `Media` ("
536             "`DiskId` SHORT NOT NULL, "
537             "`LastSequence` SHORT NOT NULL, "
538             "`DiskPrompt` CHAR(64), "
539             "`Cabinet` CHAR(255), "
540             "`VolumeLabel` CHAR(32), "
541             "`Source` CHAR(72) "
542             "PRIMARY KEY `DiskId`)" );
543 }
544
545 static UINT create_ccpsearch_table( MSIHANDLE hdb )
546 {
547     return run_query( hdb,
548             "CREATE TABLE `CCPSearch` ("
549             "`Signature_` CHAR(72) NOT NULL "
550             "PRIMARY KEY `Signature_`)" );
551 }
552
553 static UINT create_drlocator_table( MSIHANDLE hdb )
554 {
555     return run_query( hdb,
556             "CREATE TABLE `DrLocator` ("
557             "`Signature_` CHAR(72) NOT NULL, "
558             "`Parent` CHAR(72), "
559             "`Path` CHAR(255), "
560             "`Depth` SHORT "
561             "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
562 }
563
564 static UINT create_complocator_table( MSIHANDLE hdb )
565 {
566     return run_query( hdb,
567             "CREATE TABLE `CompLocator` ("
568             "`Signature_` CHAR(72) NOT NULL, "
569             "`ComponentId` CHAR(38) NOT NULL, "
570             "`Type` SHORT "
571             "PRIMARY KEY `Signature_`)" );
572 }
573
574 static UINT create_inilocator_table( MSIHANDLE hdb )
575 {
576     return run_query( hdb,
577             "CREATE TABLE `IniLocator` ("
578             "`Signature_` CHAR(72) NOT NULL, "
579             "`FileName` CHAR(255) NOT NULL, "
580             "`Section` CHAR(96)NOT NULL, "
581             "`Key` CHAR(128)NOT NULL, "
582             "`Field` SHORT, "
583             "`Type` SHORT "
584             "PRIMARY KEY `Signature_`)" );
585 }
586
587 #define make_add_entry(type, qtext) \
588     static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
589     { \
590         char insert[] = qtext; \
591         char *query; \
592         UINT sz, r; \
593         sz = strlen(values) + sizeof insert; \
594         query = HeapAlloc(GetProcessHeap(),0,sz); \
595         sprintf(query,insert,values); \
596         r = run_query( hdb, query ); \
597         HeapFree(GetProcessHeap(), 0, query); \
598         return r; \
599     }
600
601 make_add_entry(component,
602                "INSERT INTO `Component`  "
603                "(`Component`, `ComponentId`, `Directory_`, "
604                "`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
605
606 make_add_entry(directory,
607                "INSERT INTO `Directory` "
608                "(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
609
610 make_add_entry(feature,
611                "INSERT INTO `Feature` "
612                "(`Feature`, `Feature_Parent`, `Title`, `Description`, "
613                "`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
614
615 make_add_entry(feature_components,
616                "INSERT INTO `FeatureComponents` "
617                "(`Feature_`, `Component_`) VALUES( %s )")
618
619 make_add_entry(file,
620                "INSERT INTO `File` "
621                "(`File`, `Component_`, `FileName`, `FileSize`, "
622                "`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
623
624 make_add_entry(appsearch,
625                "INSERT INTO `AppSearch` "
626                "(`Property`, `Signature_`) VALUES( %s )")
627
628 make_add_entry(reglocator,
629                "INSERT INTO `RegLocator` "
630                "(`Signature_`, `Root`, `Key`, `Name`, `Type`) VALUES( %s )")
631
632 make_add_entry(signature,
633                "INSERT INTO `Signature` "
634                "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
635                " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
636                "VALUES( %s )")
637
638 make_add_entry(launchcondition,
639                "INSERT INTO `LaunchCondition` "
640                "(`Condition`, `Description`) VALUES( %s )")
641
642 make_add_entry(property,
643                "INSERT INTO `Property` (`Property`, `Value`) VALUES( %s )")
644
645 make_add_entry(install_execute_sequence,
646                "INSERT INTO `InstallExecuteSequence` "
647                "(`Action`, `Condition`, `Sequence`) VALUES( %s )")
648
649 make_add_entry(media,
650                "INSERT INTO `Media` "
651                "(`DiskId`, `LastSequence`, `DiskPrompt`, "
652                "`Cabinet`, `VolumeLabel`, `Source`) VALUES( %s )")
653
654 make_add_entry(ccpsearch,
655                "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )")
656
657 make_add_entry(drlocator,
658                "INSERT INTO `DrLocator` "
659                "(`Signature_`, `Parent`, `Path`, `Depth`) VALUES( %s )")
660
661 make_add_entry(complocator,
662                "INSERT INTO `CompLocator` "
663                "(`Signature_`, `ComponentId`, `Type`) VALUES( %s )")
664
665 make_add_entry(inilocator,
666                "INSERT INTO `IniLocator` "
667                "(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) "
668                "VALUES( %s )")
669
670 static UINT set_summary_info(MSIHANDLE hdb)
671 {
672     UINT res;
673     MSIHANDLE suminfo;
674
675     /* build summary info */
676     res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
677     ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
678
679     res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
680                         "Installation Database");
681     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
682
683     res = MsiSummaryInfoSetProperty(suminfo,3, VT_LPSTR, 0,NULL,
684                         "Installation Database");
685     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
686
687     res = MsiSummaryInfoSetProperty(suminfo,4, VT_LPSTR, 0,NULL,
688                         "Wine Hackers");
689     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
690
691     res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
692                     ";1033");
693     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
694
695     res = MsiSummaryInfoSetProperty(suminfo,9, VT_LPSTR, 0,NULL,
696                     "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
697     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
698
699     res = MsiSummaryInfoSetProperty(suminfo, 14, VT_I4, 100, NULL, NULL);
700     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
701
702     res = MsiSummaryInfoSetProperty(suminfo, 15, VT_I4, 0, NULL, NULL);
703     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
704
705     res = MsiSummaryInfoPersist(suminfo);
706     ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
707
708     res = MsiCloseHandle( suminfo);
709     ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
710
711     return res;
712 }
713
714
715 static MSIHANDLE create_package_db(void)
716 {
717     MSIHANDLE hdb = 0;
718     UINT res;
719
720     DeleteFile(msifile);
721
722     /* create an empty database */
723     res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb );
724     ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
725     if( res != ERROR_SUCCESS )
726         return hdb;
727
728     res = MsiDatabaseCommit( hdb );
729     ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
730
731     res = set_summary_info(hdb);
732
733     res = run_query( hdb,
734             "CREATE TABLE `Directory` ( "
735             "`Directory` CHAR(255) NOT NULL, "
736             "`Directory_Parent` CHAR(255), "
737             "`DefaultDir` CHAR(255) NOT NULL "
738             "PRIMARY KEY `Directory`)" );
739     ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
740
741     return hdb;
742 }
743
744 static UINT package_from_db(MSIHANDLE hdb, MSIHANDLE *handle)
745 {
746     UINT res;
747     CHAR szPackage[12];
748     MSIHANDLE hPackage;
749
750     sprintf(szPackage, "#%u", hdb);
751     res = MsiOpenPackage(szPackage, &hPackage);
752     if (res != ERROR_SUCCESS)
753     {
754         MsiCloseHandle(hdb);
755         return res;
756     }
757
758     res = MsiCloseHandle(hdb);
759     if (res != ERROR_SUCCESS)
760     {
761         MsiCloseHandle(hPackage);
762         return res;
763     }
764
765     *handle = hPackage;
766     return ERROR_SUCCESS;
767 }
768
769 static void create_test_file(const CHAR *name)
770 {
771     HANDLE file;
772     DWORD written;
773
774     file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
775     ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
776     WriteFile(file, name, strlen(name), &written, NULL);
777     WriteFile(file, "\n", strlen("\n"), &written, NULL);
778     CloseHandle(file);
779 }
780
781 typedef struct _tagVS_VERSIONINFO
782 {
783     WORD wLength;
784     WORD wValueLength;
785     WORD wType;
786     WCHAR szKey[1];
787     WORD wPadding1[1];
788     VS_FIXEDFILEINFO Value;
789     WORD wPadding2[1];
790     WORD wChildren[1];
791 } VS_VERSIONINFO;
792
793 #define roundoffs(a, b, r) (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))
794 #define roundpos(a, b, r) (((BYTE *)(a)) + roundoffs(a, b, r))
795
796 static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls)
797 {
798     VS_VERSIONINFO *pVerInfo;
799     VS_FIXEDFILEINFO *pFixedInfo;
800     LPBYTE buffer, ofs;
801     CHAR path[MAX_PATH];
802     DWORD handle, size;
803     HANDLE resource;
804     BOOL ret = FALSE;
805
806     GetSystemDirectory(path, MAX_PATH);
807     /* Some dlls can't be updated on Vista/W2K8 */
808     lstrcatA(path, "\\version.dll");
809
810     CopyFileA(path, name, FALSE);
811
812     size = GetFileVersionInfoSize(path, &handle);
813     buffer = HeapAlloc(GetProcessHeap(), 0, size);
814
815     GetFileVersionInfoA(path, 0, size, buffer);
816
817     pVerInfo = (VS_VERSIONINFO *)buffer;
818     ofs = (BYTE *)&pVerInfo->szKey[lstrlenW(pVerInfo->szKey) + 1];
819     pFixedInfo = (VS_FIXEDFILEINFO *)roundpos(pVerInfo, ofs, 4);
820
821     pFixedInfo->dwFileVersionMS = ms;
822     pFixedInfo->dwFileVersionLS = ls;
823     pFixedInfo->dwProductVersionMS = ms;
824     pFixedInfo->dwProductVersionLS = ls;
825
826     resource = BeginUpdateResource(name, FALSE);
827     if (!resource)
828         goto done;
829
830     if (!UpdateResource(resource, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO),
831                    MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), buffer, size))
832         goto done;
833
834     if (!EndUpdateResource(resource, FALSE))
835         goto done;
836
837     ret = TRUE;
838
839 done:
840     HeapFree(GetProcessHeap(), 0, buffer);
841     return ret;
842 }
843
844 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
845 {
846     RESTOREPOINTINFOA spec;
847
848     spec.dwEventType = event_type;
849     spec.dwRestorePtType = APPLICATION_INSTALL;
850     spec.llSequenceNumber = status->llSequenceNumber;
851     lstrcpyA(spec.szDescription, "msitest restore point");
852
853     return pSRSetRestorePointA(&spec, status);
854 }
855
856 static void remove_restore_point(DWORD seq_number)
857 {
858     DWORD res;
859
860     res = pSRRemoveRestorePoint(seq_number);
861     if (res != ERROR_SUCCESS)
862         trace("Failed to remove the restore point : %08x\n", res);
863 }
864
865 static void test_createpackage(void)
866 {
867     MSIHANDLE hPackage = 0;
868     UINT res;
869
870     res = package_from_db(create_package_db(), &hPackage);
871     if (res == ERROR_INSTALL_PACKAGE_REJECTED)
872     {
873         skip("Not enough rights to perform tests\n");
874         DeleteFile(msifile);
875         return;
876     }
877     ok( res == ERROR_SUCCESS, " Failed to create package %u\n", res );
878
879     res = MsiCloseHandle( hPackage);
880     ok( res == ERROR_SUCCESS , "Failed to close package\n" );
881     DeleteFile(msifile);
882 }
883
884 static void test_doaction( void )
885 {
886     MSIHANDLE hpkg;
887     UINT r;
888
889     r = MsiDoAction( -1, NULL );
890     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
891
892     r = package_from_db(create_package_db(), &hpkg);
893     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
894     {
895         skip("Not enough rights to perform tests\n");
896         DeleteFile(msifile);
897         return;
898     }
899     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
900
901     r = MsiDoAction(hpkg, NULL);
902     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
903
904     r = MsiDoAction(0, "boo");
905     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
906
907     r = MsiDoAction(hpkg, "boo");
908     ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
909
910     MsiCloseHandle( hpkg );
911     DeleteFile(msifile);
912 }
913
914 static void test_gettargetpath_bad(void)
915 {
916     static const WCHAR boo[] = {'b','o','o',0};
917     static const WCHAR empty[] = {0};
918     char buffer[0x80];
919     WCHAR bufferW[0x80];
920     MSIHANDLE hpkg;
921     DWORD sz;
922     UINT r;
923
924     r = package_from_db(create_package_db(), &hpkg);
925     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
926     {
927         skip("Not enough rights to perform tests\n");
928         DeleteFile(msifile);
929         return;
930     }
931     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
932
933     r = MsiGetTargetPath( 0, NULL, NULL, NULL );
934     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
935
936     r = MsiGetTargetPath( 0, NULL, NULL, &sz );
937     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
938
939     r = MsiGetTargetPath( 0, "boo", NULL, NULL );
940     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
941
942     r = MsiGetTargetPath( 0, "boo", NULL, NULL );
943     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
944
945     r = MsiGetTargetPath( hpkg, "boo", NULL, NULL );
946     ok( r == ERROR_DIRECTORY, "wrong return val\n");
947
948     r = MsiGetTargetPath( hpkg, "boo", buffer, NULL );
949     ok( r == ERROR_DIRECTORY, "wrong return val\n");
950
951     sz = 0;
952     r = MsiGetTargetPath( hpkg, "", buffer, &sz );
953     ok( r == ERROR_DIRECTORY, "wrong return val\n");
954
955     r = MsiGetTargetPathW( 0, NULL, NULL, NULL );
956     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
957
958     r = MsiGetTargetPathW( 0, NULL, NULL, &sz );
959     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
960
961     r = MsiGetTargetPathW( 0, boo, NULL, NULL );
962     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
963
964     r = MsiGetTargetPathW( 0, boo, NULL, NULL );
965     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
966
967     r = MsiGetTargetPathW( hpkg, boo, NULL, NULL );
968     ok( r == ERROR_DIRECTORY, "wrong return val\n");
969
970     r = MsiGetTargetPathW( hpkg, boo, bufferW, NULL );
971     ok( r == ERROR_DIRECTORY, "wrong return val\n");
972
973     sz = 0;
974     r = MsiGetTargetPathW( hpkg, empty, bufferW, &sz );
975     ok( r == ERROR_DIRECTORY, "wrong return val\n");
976
977     MsiCloseHandle( hpkg );
978     DeleteFile(msifile);
979 }
980
981 static void query_file_path(MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
982 {
983     UINT r;
984     DWORD size;
985     MSIHANDLE rec;
986
987     rec = MsiCreateRecord( 1 );
988     ok(rec, "MsiCreate record failed\n");
989
990     r = MsiRecordSetString( rec, 0, file );
991     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
992
993     size = MAX_PATH;
994     r = MsiFormatRecord( hpkg, rec, buff, &size );
995     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
996
997     MsiCloseHandle( rec );
998 }
999
1000 static void test_settargetpath(void)
1001 {
1002     char tempdir[MAX_PATH+8], buffer[MAX_PATH], file[MAX_PATH];
1003     DWORD sz;
1004     MSIHANDLE hpkg;
1005     UINT r;
1006     MSIHANDLE hdb;
1007
1008     hdb = create_package_db();
1009     ok ( hdb, "failed to create package database\n" );
1010
1011     r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
1012     ok( r == S_OK, "failed to add directory entry: %d\n" , r );
1013
1014     r = create_component_table( hdb );
1015     ok( r == S_OK, "cannot create Component table: %d\n", r );
1016
1017     r = add_component_entry( hdb, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
1018     ok( r == S_OK, "cannot add dummy component: %d\n", r );
1019
1020     r = add_component_entry( hdb, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
1021     ok( r == S_OK, "cannot add test component: %d\n", r );
1022
1023     r = create_feature_table( hdb );
1024     ok( r == S_OK, "cannot create Feature table: %d\n", r );
1025
1026     r = add_feature_entry( hdb, "'TestFeature', '', '', '', 0, 1, '', 0" );
1027     ok( r == ERROR_SUCCESS, "cannot add TestFeature to Feature table: %d\n", r );
1028
1029     r = create_feature_components_table( hdb );
1030     ok( r == S_OK, "cannot create FeatureComponents table: %d\n", r );
1031
1032     r = add_feature_components_entry( hdb, "'TestFeature', 'RootComp'" );
1033     ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
1034
1035     r = add_feature_components_entry( hdb, "'TestFeature', 'TestComp'" );
1036     ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
1037
1038     add_directory_entry( hdb, "'TestParent', 'TARGETDIR', 'TestParent'" );
1039     add_directory_entry( hdb, "'TestDir', 'TestParent', 'TestDir'" );
1040
1041     r = create_file_table( hdb );
1042     ok( r == S_OK, "cannot create File table: %d\n", r );
1043
1044     r = add_file_entry( hdb, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
1045     ok( r == S_OK, "cannot add file to the File table: %d\n", r );
1046
1047     r = add_file_entry( hdb, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
1048     ok( r == S_OK, "cannot add file to the File table: %d\n", r );
1049
1050     r = package_from_db( hdb, &hpkg );
1051     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
1052     {
1053         skip("Not enough rights to perform tests\n");
1054         DeleteFile(msifile);
1055         return;
1056     }
1057     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
1058
1059     r = MsiDoAction( hpkg, "CostInitialize");
1060     ok( r == ERROR_SUCCESS, "cost init failed\n");
1061
1062     r = MsiDoAction( hpkg, "FileCost");
1063     ok( r == ERROR_SUCCESS, "file cost failed\n");
1064
1065     r = MsiDoAction( hpkg, "CostFinalize");
1066     ok( r == ERROR_SUCCESS, "cost finalize failed\n");
1067
1068     r = MsiSetTargetPath( 0, NULL, NULL );
1069     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1070
1071     r = MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
1072     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1073
1074     r = MsiSetTargetPath( hpkg, "boo", NULL );
1075     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1076
1077     r = MsiSetTargetPath( hpkg, "boo", "c:\\bogusx" );
1078     ok( r == ERROR_DIRECTORY, "wrong return val\n");
1079
1080     sz = sizeof tempdir - 1;
1081     r = MsiGetTargetPath( hpkg, "TARGETDIR", tempdir, &sz );
1082     sprintf( file, "%srootfile.txt", tempdir );
1083     buffer[0] = 0;
1084     query_file_path( hpkg, "[#RootFile]", buffer );
1085     ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1086     ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer );
1087
1088     GetTempFileName( tempdir, "_wt", 0, buffer );
1089     sprintf( tempdir, "%s\\subdir", buffer );
1090
1091     r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1092     ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1093         "MsiSetTargetPath on file returned %d\n", r );
1094
1095     r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1096     ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1097         "MsiSetTargetPath on 'subdir' of file returned %d\n", r );
1098
1099     DeleteFile( buffer );
1100
1101     r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1102     ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1103
1104     r = GetFileAttributes( buffer );
1105     ok ( r == INVALID_FILE_ATTRIBUTES, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r );
1106
1107     r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1108     ok( r == ERROR_SUCCESS, "MsiSetTargetPath on subsubdir returned %d\n", r );
1109
1110     sz = sizeof buffer - 1;
1111     lstrcat( tempdir, "\\" );
1112     r = MsiGetTargetPath( hpkg, "TARGETDIR", buffer, &sz );
1113     ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1114     ok( !lstrcmp(buffer, tempdir), "Expected %s, got %s\n", tempdir, buffer);
1115
1116     sprintf( file, "%srootfile.txt", tempdir );
1117     query_file_path( hpkg, "[#RootFile]", buffer );
1118     ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer);
1119
1120     r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two" );
1121     ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1122
1123     query_file_path( hpkg, "[#TestFile]", buffer );
1124     ok( !lstrcmpi(buffer, "C:\\one\\two\\TestDir\\testfile.txt"),
1125         "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer );
1126
1127     sz = sizeof buffer - 1;
1128     r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
1129     ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1130     ok( !lstrcmpi(buffer, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer);
1131
1132     r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two\\three" );
1133     ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1134
1135     sz = sizeof buffer - 1;
1136     r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
1137     ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1138     ok( !lstrcmpi(buffer, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", buffer);
1139
1140     MsiCloseHandle( hpkg );
1141 }
1142
1143 static void test_condition(void)
1144 {
1145     MSICONDITION r;
1146     MSIHANDLE hpkg;
1147
1148     r = package_from_db(create_package_db(), &hpkg);
1149     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
1150     {
1151         skip("Not enough rights to perform tests\n");
1152         DeleteFile(msifile);
1153         return;
1154     }
1155     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
1156
1157     r = MsiEvaluateCondition(0, NULL);
1158     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1159
1160     r = MsiEvaluateCondition(hpkg, NULL);
1161     ok( r == MSICONDITION_NONE, "wrong return val\n");
1162
1163     r = MsiEvaluateCondition(hpkg, "");
1164     ok( r == MSICONDITION_NONE, "wrong return val\n");
1165
1166     r = MsiEvaluateCondition(hpkg, "1");
1167     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1168
1169     r = MsiEvaluateCondition(hpkg, "0");
1170     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1171
1172     r = MsiEvaluateCondition(hpkg, "-1");
1173     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1174
1175     r = MsiEvaluateCondition(hpkg, "0 = 0");
1176     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1177
1178     r = MsiEvaluateCondition(hpkg, "0 <> 0");
1179     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1180
1181     r = MsiEvaluateCondition(hpkg, "0 = 1");
1182     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1183
1184     r = MsiEvaluateCondition(hpkg, "0 > 1");
1185     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1186
1187     r = MsiEvaluateCondition(hpkg, "0 ~> 1");
1188     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1189
1190     r = MsiEvaluateCondition(hpkg, "1 > 1");
1191     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1192
1193     r = MsiEvaluateCondition(hpkg, "1 ~> 1");
1194     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1195
1196     r = MsiEvaluateCondition(hpkg, "0 >= 1");
1197     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1198
1199     r = MsiEvaluateCondition(hpkg, "0 ~>= 1");
1200     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1201
1202     r = MsiEvaluateCondition(hpkg, "1 >= 1");
1203     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1204
1205     r = MsiEvaluateCondition(hpkg, "1 ~>= 1");
1206     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1207
1208     r = MsiEvaluateCondition(hpkg, "0 < 1");
1209     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1210
1211     r = MsiEvaluateCondition(hpkg, "0 ~< 1");
1212     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1213
1214     r = MsiEvaluateCondition(hpkg, "1 < 1");
1215     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1216
1217     r = MsiEvaluateCondition(hpkg, "1 ~< 1");
1218     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1219
1220     r = MsiEvaluateCondition(hpkg, "0 <= 1");
1221     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1222
1223     r = MsiEvaluateCondition(hpkg, "0 ~<= 1");
1224     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1225
1226     r = MsiEvaluateCondition(hpkg, "1 <= 1");
1227     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1228
1229     r = MsiEvaluateCondition(hpkg, "1 ~<= 1");
1230     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1231
1232     r = MsiEvaluateCondition(hpkg, "0 >=");
1233     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1234
1235     r = MsiEvaluateCondition(hpkg, " ");
1236     ok( r == MSICONDITION_NONE, "wrong return val\n");
1237
1238     r = MsiEvaluateCondition(hpkg, "LicView <> \"1\"");
1239     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1240
1241     r = MsiEvaluateCondition(hpkg, "LicView <> \"0\"");
1242     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1243
1244     r = MsiEvaluateCondition(hpkg, "LicView <> LicView");
1245     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1246
1247     r = MsiEvaluateCondition(hpkg, "not 0");
1248     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1249
1250     r = MsiEvaluateCondition(hpkg, "not LicView");
1251     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1252
1253     r = MsiEvaluateCondition(hpkg, "\"Testing\" ~<< \"Testing\"");
1254     ok (r == MSICONDITION_TRUE, "wrong return val\n");
1255
1256     r = MsiEvaluateCondition(hpkg, "LicView ~<< \"Testing\"");
1257     ok (r == MSICONDITION_FALSE, "wrong return val\n");
1258
1259     r = MsiEvaluateCondition(hpkg, "Not LicView ~<< \"Testing\"");
1260     ok (r == MSICONDITION_TRUE, "wrong return val\n");
1261
1262     r = MsiEvaluateCondition(hpkg, "not \"A\"");
1263     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1264
1265     r = MsiEvaluateCondition(hpkg, "~not \"A\"");
1266     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1267
1268     r = MsiEvaluateCondition(hpkg, "\"0\"");
1269     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1270
1271     r = MsiEvaluateCondition(hpkg, "1 and 2");
1272     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1273
1274     r = MsiEvaluateCondition(hpkg, "not 0 and 3");
1275     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1276
1277     r = MsiEvaluateCondition(hpkg, "not 0 and 0");
1278     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1279
1280     r = MsiEvaluateCondition(hpkg, "not 0 or 1");
1281     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1282
1283     r = MsiEvaluateCondition(hpkg, "(0)");
1284     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1285
1286     r = MsiEvaluateCondition(hpkg, "(((((1))))))");
1287     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1288
1289     r = MsiEvaluateCondition(hpkg, "(((((1)))))");
1290     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1291
1292     r = MsiEvaluateCondition(hpkg, " \"A\" < \"B\" ");
1293     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1294
1295     r = MsiEvaluateCondition(hpkg, " \"A\" > \"B\" ");
1296     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1297
1298     r = MsiEvaluateCondition(hpkg, " \"1\" > \"12\" ");
1299     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1300
1301     r = MsiEvaluateCondition(hpkg, " \"100\" < \"21\" ");
1302     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1303
1304     r = MsiEvaluateCondition(hpkg, "0 < > 0");
1305     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1306
1307     r = MsiEvaluateCondition(hpkg, "(1<<1) == 2");
1308     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1309
1310     r = MsiEvaluateCondition(hpkg, " \"A\" = \"a\" ");
1311     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1312
1313     r = MsiEvaluateCondition(hpkg, " \"A\" ~ = \"a\" ");
1314     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1315
1316     r = MsiEvaluateCondition(hpkg, " \"A\" ~= \"a\" ");
1317     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1318
1319     r = MsiEvaluateCondition(hpkg, " \"A\" ~= 1 ");
1320     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1321
1322     r = MsiEvaluateCondition(hpkg, " \"A\" = 1 ");
1323     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1324
1325     r = MsiEvaluateCondition(hpkg, " 1 ~= 1 ");
1326     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1327
1328     r = MsiEvaluateCondition(hpkg, " 1 ~= \"1\" ");
1329     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1330
1331     r = MsiEvaluateCondition(hpkg, " 1 = \"1\" ");
1332     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1333
1334     r = MsiEvaluateCondition(hpkg, " 0 = \"1\" ");
1335     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1336
1337     r = MsiEvaluateCondition(hpkg, " 0 < \"100\" ");
1338     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1339
1340     r = MsiEvaluateCondition(hpkg, " 100 > \"0\" ");
1341     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1342
1343     r = MsiEvaluateCondition(hpkg, "1 XOR 1");
1344     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1345
1346     r = MsiEvaluateCondition(hpkg, "1 IMP 1");
1347     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1348
1349     r = MsiEvaluateCondition(hpkg, "1 IMP 0");
1350     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1351
1352     r = MsiEvaluateCondition(hpkg, "0 IMP 0");
1353     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1354
1355     r = MsiEvaluateCondition(hpkg, "0 EQV 0");
1356     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1357
1358     r = MsiEvaluateCondition(hpkg, "0 EQV 1");
1359     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1360
1361     r = MsiEvaluateCondition(hpkg, "1 IMP 1 OR 0");
1362     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1363
1364     r = MsiEvaluateCondition(hpkg, "1 IMPL 1");
1365     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1366
1367     r = MsiEvaluateCondition(hpkg, "\"ASFD\" >< \"S\" ");
1368     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1369
1370     r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"s\" ");
1371     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1372
1373     r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"\" ");
1374     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1375
1376     r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"sss\" ");
1377     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1378
1379     MsiSetProperty(hpkg, "mm", "5" );
1380
1381     r = MsiEvaluateCondition(hpkg, "mm = 5");
1382     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1383
1384     r = MsiEvaluateCondition(hpkg, "mm < 6");
1385     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1386
1387     r = MsiEvaluateCondition(hpkg, "mm <= 5");
1388     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1389
1390     r = MsiEvaluateCondition(hpkg, "mm > 4");
1391     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1392
1393     r = MsiEvaluateCondition(hpkg, "mm < 12");
1394     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1395
1396     r = MsiEvaluateCondition(hpkg, "mm = \"5\"");
1397     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1398
1399     r = MsiEvaluateCondition(hpkg, "0 = \"\"");
1400     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1401
1402     r = MsiEvaluateCondition(hpkg, "0 AND \"\"");
1403     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1404
1405     r = MsiEvaluateCondition(hpkg, "1 AND \"\"");
1406     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1407
1408     r = MsiEvaluateCondition(hpkg, "1 AND \"1\"");
1409     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1410
1411     r = MsiEvaluateCondition(hpkg, "3 >< 1");
1412     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1413
1414     r = MsiEvaluateCondition(hpkg, "3 >< 4");
1415     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1416
1417     r = MsiEvaluateCondition(hpkg, "NOT 0 AND 0");
1418     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1419
1420     r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1");
1421     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1422
1423     r = MsiEvaluateCondition(hpkg, "NOT 1 OR 0");
1424     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1425
1426     r = MsiEvaluateCondition(hpkg, "0 AND 1 OR 1");
1427     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1428
1429     r = MsiEvaluateCondition(hpkg, "0 AND 0 OR 1");
1430     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1431
1432     r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1 OR 0");
1433     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1434
1435     r = MsiEvaluateCondition(hpkg, "_1 = _1");
1436     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1437
1438     r = MsiEvaluateCondition(hpkg, "( 1 AND 1 ) = 2");
1439     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1440
1441     r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
1442     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1443
1444     r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1445     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1446
1447     r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
1448     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1449
1450     r = MsiEvaluateCondition(hpkg, "NOT 1 AND 0");
1451     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1452
1453     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1454     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1455
1456     r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1457     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1458
1459     r = MsiEvaluateCondition(hpkg, "bandalmael<0");
1460     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1461
1462     r = MsiEvaluateCondition(hpkg, "bandalmael>0");
1463     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1464
1465     r = MsiEvaluateCondition(hpkg, "bandalmael>=0");
1466     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1467
1468     r = MsiEvaluateCondition(hpkg, "bandalmael<=0");
1469     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1470
1471     r = MsiEvaluateCondition(hpkg, "bandalmael~<>0");
1472     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1473
1474     MsiSetProperty(hpkg, "bandalmael", "0" );
1475     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1476     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1477
1478     MsiSetProperty(hpkg, "bandalmael", "" );
1479     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1480     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1481
1482     MsiSetProperty(hpkg, "bandalmael", "asdf" );
1483     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1484     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1485
1486     MsiSetProperty(hpkg, "bandalmael", "0asdf" );
1487     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1488     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1489
1490     MsiSetProperty(hpkg, "bandalmael", "0 " );
1491     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1492     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1493
1494     MsiSetProperty(hpkg, "bandalmael", "-0" );
1495     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1496     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1497
1498     MsiSetProperty(hpkg, "bandalmael", "0000000000000" );
1499     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1500     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1501
1502     MsiSetProperty(hpkg, "bandalmael", "--0" );
1503     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1504     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1505
1506     MsiSetProperty(hpkg, "bandalmael", "0x00" );
1507     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1508     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1509
1510     MsiSetProperty(hpkg, "bandalmael", "-" );
1511     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1512     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1513
1514     MsiSetProperty(hpkg, "bandalmael", "+0" );
1515     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1516     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1517
1518     MsiSetProperty(hpkg, "bandalmael", "0.0" );
1519     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1520     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1521     r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1522     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1523
1524     MsiSetProperty(hpkg, "one", "hi");
1525     MsiSetProperty(hpkg, "two", "hithere");
1526     r = MsiEvaluateCondition(hpkg, "one >< two");
1527     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1528
1529     MsiSetProperty(hpkg, "one", "hithere");
1530     MsiSetProperty(hpkg, "two", "hi");
1531     r = MsiEvaluateCondition(hpkg, "one >< two");
1532     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1533
1534     MsiSetProperty(hpkg, "one", "hello");
1535     MsiSetProperty(hpkg, "two", "hi");
1536     r = MsiEvaluateCondition(hpkg, "one >< two");
1537     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1538
1539     MsiSetProperty(hpkg, "one", "hellohithere");
1540     MsiSetProperty(hpkg, "two", "hi");
1541     r = MsiEvaluateCondition(hpkg, "one >< two");
1542     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1543
1544     MsiSetProperty(hpkg, "one", "");
1545     MsiSetProperty(hpkg, "two", "hi");
1546     r = MsiEvaluateCondition(hpkg, "one >< two");
1547     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1548
1549     MsiSetProperty(hpkg, "one", "hi");
1550     MsiSetProperty(hpkg, "two", "");
1551     r = MsiEvaluateCondition(hpkg, "one >< two");
1552     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1553
1554     MsiSetProperty(hpkg, "one", "");
1555     MsiSetProperty(hpkg, "two", "");
1556     r = MsiEvaluateCondition(hpkg, "one >< two");
1557     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1558
1559     MsiSetProperty(hpkg, "one", "1234");
1560     MsiSetProperty(hpkg, "two", "1");
1561     r = MsiEvaluateCondition(hpkg, "one >< two");
1562     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1563
1564     MsiSetProperty(hpkg, "one", "one 1234");
1565     MsiSetProperty(hpkg, "two", "1");
1566     r = MsiEvaluateCondition(hpkg, "one >< two");
1567     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1568
1569     MsiSetProperty(hpkg, "one", "hithere");
1570     MsiSetProperty(hpkg, "two", "hi");
1571     r = MsiEvaluateCondition(hpkg, "one << two");
1572     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1573
1574     MsiSetProperty(hpkg, "one", "hi");
1575     MsiSetProperty(hpkg, "two", "hithere");
1576     r = MsiEvaluateCondition(hpkg, "one << two");
1577     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1578
1579     MsiSetProperty(hpkg, "one", "hi");
1580     MsiSetProperty(hpkg, "two", "hi");
1581     r = MsiEvaluateCondition(hpkg, "one << two");
1582     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1583
1584     MsiSetProperty(hpkg, "one", "abcdhithere");
1585     MsiSetProperty(hpkg, "two", "hi");
1586     r = MsiEvaluateCondition(hpkg, "one << two");
1587     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1588
1589     MsiSetProperty(hpkg, "one", "");
1590     MsiSetProperty(hpkg, "two", "hi");
1591     r = MsiEvaluateCondition(hpkg, "one << two");
1592     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1593
1594     MsiSetProperty(hpkg, "one", "hithere");
1595     MsiSetProperty(hpkg, "two", "");
1596     r = MsiEvaluateCondition(hpkg, "one << two");
1597     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1598
1599     MsiSetProperty(hpkg, "one", "");
1600     MsiSetProperty(hpkg, "two", "");
1601     r = MsiEvaluateCondition(hpkg, "one << two");
1602     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1603
1604     MsiSetProperty(hpkg, "one", "1234");
1605     MsiSetProperty(hpkg, "two", "1");
1606     r = MsiEvaluateCondition(hpkg, "one << two");
1607     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1608
1609     MsiSetProperty(hpkg, "one", "1234 one");
1610     MsiSetProperty(hpkg, "two", "1");
1611     r = MsiEvaluateCondition(hpkg, "one << two");
1612     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1613
1614     MsiSetProperty(hpkg, "one", "hithere");
1615     MsiSetProperty(hpkg, "two", "there");
1616     r = MsiEvaluateCondition(hpkg, "one >> two");
1617     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1618
1619     MsiSetProperty(hpkg, "one", "hithere");
1620     MsiSetProperty(hpkg, "two", "hi");
1621     r = MsiEvaluateCondition(hpkg, "one >> two");
1622     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1623
1624     MsiSetProperty(hpkg, "one", "there");
1625     MsiSetProperty(hpkg, "two", "hithere");
1626     r = MsiEvaluateCondition(hpkg, "one >> two");
1627     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1628
1629     MsiSetProperty(hpkg, "one", "there");
1630     MsiSetProperty(hpkg, "two", "there");
1631     r = MsiEvaluateCondition(hpkg, "one >> two");
1632     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1633
1634     MsiSetProperty(hpkg, "one", "abcdhithere");
1635     MsiSetProperty(hpkg, "two", "hi");
1636     r = MsiEvaluateCondition(hpkg, "one >> two");
1637     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1638
1639     MsiSetProperty(hpkg, "one", "");
1640     MsiSetProperty(hpkg, "two", "there");
1641     r = MsiEvaluateCondition(hpkg, "one >> two");
1642     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1643
1644     MsiSetProperty(hpkg, "one", "there");
1645     MsiSetProperty(hpkg, "two", "");
1646     r = MsiEvaluateCondition(hpkg, "one >> two");
1647     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1648
1649     MsiSetProperty(hpkg, "one", "");
1650     MsiSetProperty(hpkg, "two", "");
1651     r = MsiEvaluateCondition(hpkg, "one >> two");
1652     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1653
1654     MsiSetProperty(hpkg, "one", "1234");
1655     MsiSetProperty(hpkg, "two", "4");
1656     r = MsiEvaluateCondition(hpkg, "one >> two");
1657     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1658
1659     MsiSetProperty(hpkg, "one", "one 1234");
1660     MsiSetProperty(hpkg, "two", "4");
1661     r = MsiEvaluateCondition(hpkg, "one >> two");
1662     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1663
1664     MsiSetProperty(hpkg, "MsiNetAssemblySupport", NULL);  /* make sure it's empty */
1665
1666     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1667     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1668
1669     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport > \"1.1.4322\"");
1670     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1671
1672     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport >= \"1.1.4322\"");
1673     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1674
1675     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <= \"1.1.4322\"");
1676     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1677
1678     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <> \"1.1.4322\"");
1679     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1680
1681     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1682     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1683
1684     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"abcd\"");
1685     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1686
1687     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a1.1.4322\"");
1688     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1689
1690     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322a\"");
1691     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1692
1693     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1694     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1695
1696     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1697     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1698
1699     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1700     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1701
1702     r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1");
1703     ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1704
1705     r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1\"");
1706     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1707
1708     r = MsiEvaluateCondition(hpkg, "\"2\" < \"12.1\"");
1709     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1710
1711     r = MsiEvaluateCondition(hpkg, "\"02.1\" < \"2.11\"");
1712     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1713
1714     r = MsiEvaluateCondition(hpkg, "\"02.1.1\" < \"2.1\"");
1715     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1716
1717     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1718     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1719
1720     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1721     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1722
1723     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0\"");
1724     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1725
1726     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"-1\"");
1727     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1728
1729     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a\"");
1730     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1731
1732     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1733     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1734
1735     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1736     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1737
1738     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"/\"");
1739     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1740
1741     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \" \"");
1742     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1743
1744     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"azAZ_\"");
1745     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1746
1747     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]\"");
1748     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1749
1750     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]a\"");
1751     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1752
1753     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]\"");
1754     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1755
1756     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]a\"");
1757     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1758
1759     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a}\"");
1760     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1761
1762     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a\"");
1763     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1764
1765     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a\"");
1766     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1767
1768     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a{\"");
1769     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1770
1771     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a]\"");
1772     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1773
1774     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"A\"");
1775     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1776
1777     MsiSetProperty(hpkg, "MsiNetAssemblySupport", "1.1.4322");
1778     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1779     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1780
1781     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.14322\"");
1782     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1783
1784     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.5\"");
1785     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1786
1787     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1788     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1789
1790     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1791     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1792
1793     MsiSetProperty(hpkg, "one", "1");
1794     r = MsiEvaluateCondition(hpkg, "one < \"1\"");
1795     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1796
1797     MsiSetProperty(hpkg, "X", "5.0");
1798
1799     r = MsiEvaluateCondition(hpkg, "X != \"\"");
1800     ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1801
1802     r = MsiEvaluateCondition(hpkg, "X =\"5.0\"");
1803     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1804
1805     r = MsiEvaluateCondition(hpkg, "X =\"5.1\"");
1806     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1807
1808     r = MsiEvaluateCondition(hpkg, "X =\"6.0\"");
1809     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1810
1811     r = MsiEvaluateCondition(hpkg, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1812     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1813
1814     r = MsiEvaluateCondition(hpkg, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1815     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1816
1817     r = MsiEvaluateCondition(hpkg, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1818     ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1819
1820     /* feature doesn't exist */
1821     r = MsiEvaluateCondition(hpkg, "&nofeature");
1822     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1823
1824     MsiSetProperty(hpkg, "A", "2");
1825     MsiSetProperty(hpkg, "X", "50");
1826
1827     r = MsiEvaluateCondition(hpkg, "2 <= X");
1828     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1829
1830     r = MsiEvaluateCondition(hpkg, "A <= X");
1831     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1832
1833     r = MsiEvaluateCondition(hpkg, "A <= 50");
1834     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1835
1836     MsiSetProperty(hpkg, "X", "50val");
1837
1838     r = MsiEvaluateCondition(hpkg, "2 <= X");
1839     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1840
1841     r = MsiEvaluateCondition(hpkg, "A <= X");
1842     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1843
1844     MsiSetProperty(hpkg, "A", "7");
1845     MsiSetProperty(hpkg, "X", "50");
1846
1847     r = MsiEvaluateCondition(hpkg, "7 <= X");
1848     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1849
1850     r = MsiEvaluateCondition(hpkg, "A <= X");
1851     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1852
1853     r = MsiEvaluateCondition(hpkg, "A <= 50");
1854     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1855
1856     MsiSetProperty(hpkg, "X", "50val");
1857
1858     r = MsiEvaluateCondition(hpkg, "2 <= X");
1859     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1860
1861     r = MsiEvaluateCondition(hpkg, "A <= X");
1862     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1863
1864     MsiCloseHandle( hpkg );
1865     DeleteFile(msifile);
1866 }
1867
1868 static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop)
1869 {
1870     UINT r;
1871     DWORD sz;
1872     char buffer[2];
1873
1874     sz = sizeof buffer;
1875     strcpy(buffer,"x");
1876     r = MsiGetProperty( hpkg, prop, buffer, &sz );
1877     return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
1878 }
1879
1880 static void test_props(void)
1881 {
1882     MSIHANDLE hpkg, hdb;
1883     UINT r;
1884     DWORD sz;
1885     char buffer[0x100];
1886
1887     hdb = create_package_db();
1888     r = run_query( hdb,
1889             "CREATE TABLE `Property` ( "
1890             "`Property` CHAR(255) NOT NULL, "
1891             "`Value` CHAR(255) "
1892             "PRIMARY KEY `Property`)" );
1893     ok( r == ERROR_SUCCESS , "Failed\n" );
1894
1895     r = run_query(hdb,
1896             "INSERT INTO `Property` "
1897             "(`Property`, `Value`) "
1898             "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1899     ok( r == ERROR_SUCCESS , "Failed\n" );
1900
1901     r = package_from_db( hdb, &hpkg );
1902     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
1903     {
1904         skip("Not enough rights to perform tests\n");
1905         DeleteFile(msifile);
1906         return;
1907     }
1908     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
1909
1910     /* test invalid values */
1911     r = MsiGetProperty( 0, NULL, NULL, NULL );
1912     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1913
1914     r = MsiGetProperty( hpkg, NULL, NULL, NULL );
1915     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1916
1917     r = MsiGetProperty( hpkg, "boo", NULL, NULL );
1918     ok( r == ERROR_SUCCESS, "wrong return val\n");
1919
1920     r = MsiGetProperty( hpkg, "boo", buffer, NULL );
1921     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1922
1923     /* test retrieving an empty/nonexistent property */
1924     sz = sizeof buffer;
1925     r = MsiGetProperty( hpkg, "boo", NULL, &sz );
1926     ok( r == ERROR_SUCCESS, "wrong return val\n");
1927     ok( sz == 0, "wrong size returned\n");
1928
1929     check_prop_empty( hpkg, "boo");
1930     sz = 0;
1931     strcpy(buffer,"x");
1932     r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1933     ok( r == ERROR_MORE_DATA, "wrong return val\n");
1934     ok( !strcmp(buffer,"x"), "buffer was changed\n");
1935     ok( sz == 0, "wrong size returned\n");
1936
1937     sz = 1;
1938     strcpy(buffer,"x");
1939     r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1940     ok( r == ERROR_SUCCESS, "wrong return val\n");
1941     ok( buffer[0] == 0, "buffer was not changed\n");
1942     ok( sz == 0, "wrong size returned\n");
1943
1944     /* set the property to something */
1945     r = MsiSetProperty( 0, NULL, NULL );
1946     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1947
1948     r = MsiSetProperty( hpkg, NULL, NULL );
1949     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1950
1951     r = MsiSetProperty( hpkg, "", NULL );
1952     ok( r == ERROR_SUCCESS, "wrong return val\n");
1953
1954     /* try set and get some illegal property identifiers */
1955     r = MsiSetProperty( hpkg, "", "asdf" );
1956     ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n");
1957
1958     r = MsiSetProperty( hpkg, "=", "asdf" );
1959     ok( r == ERROR_SUCCESS, "wrong return val\n");
1960
1961     r = MsiSetProperty( hpkg, " ", "asdf" );
1962     ok( r == ERROR_SUCCESS, "wrong return val\n");
1963
1964     r = MsiSetProperty( hpkg, "'", "asdf" );
1965     ok( r == ERROR_SUCCESS, "wrong return val\n");
1966
1967     sz = sizeof buffer;
1968     buffer[0]=0;
1969     r = MsiGetProperty( hpkg, "'", buffer, &sz );
1970     ok( r == ERROR_SUCCESS, "wrong return val\n");
1971     ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
1972
1973     /* set empty values */
1974     r = MsiSetProperty( hpkg, "boo", NULL );
1975     ok( r == ERROR_SUCCESS, "wrong return val\n");
1976     ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1977
1978     r = MsiSetProperty( hpkg, "boo", "" );
1979     ok( r == ERROR_SUCCESS, "wrong return val\n");
1980     ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1981
1982     /* set a non-empty value */
1983     r = MsiSetProperty( hpkg, "boo", "xyz" );
1984     ok( r == ERROR_SUCCESS, "wrong return val\n");
1985
1986     sz = 1;
1987     strcpy(buffer,"x");
1988     r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1989     ok( r == ERROR_MORE_DATA, "wrong return val\n");
1990     ok( buffer[0] == 0, "buffer was not changed\n");
1991     ok( sz == 3, "wrong size returned\n");
1992
1993     sz = 4;
1994     strcpy(buffer,"x");
1995     r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1996     ok( r == ERROR_SUCCESS, "wrong return val\n");
1997     ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
1998     ok( sz == 3, "wrong size returned\n");
1999
2000     sz = 3;
2001     strcpy(buffer,"x");
2002     r = MsiGetProperty( hpkg, "boo", buffer, &sz );
2003     ok( r == ERROR_MORE_DATA, "wrong return val\n");
2004     ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
2005     ok( sz == 3, "wrong size returned\n");
2006
2007     r = MsiSetProperty(hpkg, "SourceDir", "foo");
2008     ok( r == ERROR_SUCCESS, "wrong return val\n");
2009
2010     sz = 4;
2011     r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
2012     ok( r == ERROR_SUCCESS, "wrong return val\n");
2013     ok( !strcmp(buffer,""), "buffer wrong\n");
2014     ok( sz == 0, "wrong size returned\n");
2015
2016     sz = 4;
2017     r = MsiGetProperty(hpkg, "SOMERANDOMNAME", buffer, &sz);
2018     ok( r == ERROR_SUCCESS, "wrong return val\n");
2019     ok( !strcmp(buffer,""), "buffer wrong\n");
2020     ok( sz == 0, "wrong size returned\n");
2021
2022     sz = 4;
2023     r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
2024     ok( r == ERROR_SUCCESS, "wrong return val\n");
2025     ok( !strcmp(buffer,"foo"), "buffer wrong\n");
2026     ok( sz == 3, "wrong size returned\n");
2027
2028     r = MsiSetProperty(hpkg, "MetadataCompName", "Photoshop.dll");
2029     ok( r == ERROR_SUCCESS, "wrong return val\n");
2030
2031     sz = 0;
2032     r = MsiGetProperty(hpkg, "MetadataCompName", NULL, &sz );
2033     ok( r == ERROR_SUCCESS, "return wrong\n");
2034     ok( sz == 13, "size wrong (%d)\n", sz);
2035
2036     sz = 13;
2037     r = MsiGetProperty(hpkg, "MetadataCompName", buffer, &sz );
2038     ok( r == ERROR_MORE_DATA, "return wrong\n");
2039     ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n");
2040
2041     r = MsiSetProperty(hpkg, "property", "value");
2042     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2043
2044     sz = 6;
2045     r = MsiGetProperty(hpkg, "property", buffer, &sz);
2046     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2047     ok( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer);
2048
2049     r = MsiSetProperty(hpkg, "property", NULL);
2050     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2051
2052     sz = 6;
2053     r = MsiGetProperty(hpkg, "property", buffer, &sz);
2054     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2055     ok( !strlen(buffer), "Expected empty string, got %s\n", buffer);
2056
2057     MsiCloseHandle( hpkg );
2058     DeleteFile(msifile);
2059 }
2060
2061 static BOOL find_prop_in_property(MSIHANDLE hdb, LPCSTR prop, LPCSTR val)
2062 {
2063     MSIHANDLE hview, hrec;
2064     BOOL found;
2065     CHAR buffer[MAX_PATH];
2066     DWORD sz;
2067     UINT r;
2068
2069     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
2070     ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2071     r = MsiViewExecute(hview, 0);
2072     ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
2073
2074     found = FALSE;
2075     while (r == ERROR_SUCCESS && !found)
2076     {
2077         r = MsiViewFetch(hview, &hrec);
2078         if (r != ERROR_SUCCESS) break;
2079
2080         sz = MAX_PATH;
2081         r = MsiRecordGetString(hrec, 1, buffer, &sz);
2082         if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
2083         {
2084             sz = MAX_PATH;
2085             r = MsiRecordGetString(hrec, 2, buffer, &sz);
2086             if (r == ERROR_SUCCESS && !lstrcmpA(buffer, val))
2087                 found = TRUE;
2088         }
2089
2090         MsiCloseHandle(hrec);
2091     }
2092
2093     MsiViewClose(hview);
2094     MsiCloseHandle(hview);
2095
2096     return found;
2097 }
2098
2099 static void test_property_table(void)
2100 {
2101     const char *query;
2102     UINT r;
2103     MSIHANDLE hpkg, hdb, hrec;
2104     char buffer[MAX_PATH], package[10];
2105     DWORD sz;
2106     BOOL found;
2107
2108     hdb = create_package_db();
2109     ok( hdb, "failed to create package\n");
2110
2111     r = package_from_db(hdb, &hpkg);
2112     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2113     {
2114         skip("Not enough rights to perform tests\n");
2115         DeleteFile(msifile);
2116         return;
2117     }
2118     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
2119
2120     MsiCloseHandle(hdb);
2121
2122     hdb = MsiGetActiveDatabase(hpkg);
2123
2124     query = "CREATE TABLE `_Property` ( "
2125         "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2126     r = run_query(hdb, query);
2127     ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2128
2129     MsiCloseHandle(hdb);
2130     MsiCloseHandle(hpkg);
2131     DeleteFile(msifile);
2132
2133     hdb = create_package_db();
2134     ok( hdb, "failed to create package\n");
2135
2136     query = "CREATE TABLE `_Property` ( "
2137         "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2138     r = run_query(hdb, query);
2139     ok(r == ERROR_SUCCESS, "failed to create table\n");
2140
2141     query = "ALTER `_Property` ADD `foo` INTEGER";
2142     r = run_query(hdb, query);
2143     ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2144
2145     query = "ALTER TABLE `_Property` ADD `foo` INTEGER";
2146     r = run_query(hdb, query);
2147     ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2148
2149     query = "ALTER TABLE `_Property` ADD `extra` INTEGER";
2150     r = run_query(hdb, query);
2151     ok(r == ERROR_SUCCESS, "failed to add column\n");
2152
2153     sprintf(package, "#%i", hdb);
2154     r = MsiOpenPackage(package, &hpkg);
2155     todo_wine ok(r != ERROR_SUCCESS, "MsiOpenPackage succeeded\n");
2156     if (r == ERROR_SUCCESS)
2157         MsiCloseHandle(hpkg);
2158
2159     r = MsiCloseHandle(hdb);
2160     ok(r == ERROR_SUCCESS, "MsiCloseHandle failed %u\n", r);
2161
2162     hdb = create_package_db();
2163     ok (hdb, "failed to create package database\n");
2164
2165     r = create_property_table(hdb);
2166     ok(r == ERROR_SUCCESS, "cannot create Property table: %d\n", r);
2167
2168     r = add_property_entry(hdb, "'prop', 'val'");
2169     ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2170
2171     r = package_from_db(hdb, &hpkg);
2172     ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
2173
2174     MsiCloseHandle(hdb);
2175
2176     sz = MAX_PATH;
2177     r = MsiGetProperty(hpkg, "prop", buffer, &sz);
2178     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2179     ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
2180
2181     hdb = MsiGetActiveDatabase(hpkg);
2182
2183     found = find_prop_in_property(hdb, "prop", "val");
2184     ok(found, "prop should be in the _Property table\n");
2185
2186     r = add_property_entry(hdb, "'dantes', 'mercedes'");
2187     ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2188
2189     query = "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
2190     r = do_query(hdb, query, &hrec);
2191     ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2192
2193     found = find_prop_in_property(hdb, "dantes", "mercedes");
2194     ok(found == FALSE, "dantes should not be in the _Property table\n");
2195
2196     sz = MAX_PATH;
2197     lstrcpy(buffer, "aaa");
2198     r = MsiGetProperty(hpkg, "dantes", buffer, &sz);
2199     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2200     ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer);
2201
2202     r = MsiSetProperty(hpkg, "dantes", "mercedes");
2203     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2204
2205     found = find_prop_in_property(hdb, "dantes", "mercedes");
2206     ok(found == TRUE, "dantes should be in the _Property table\n");
2207
2208     MsiCloseHandle(hdb);
2209     MsiCloseHandle(hpkg);
2210     DeleteFile(msifile);
2211 }
2212
2213 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
2214 {
2215     MSIHANDLE htab = 0;
2216     UINT res;
2217
2218     res = MsiDatabaseOpenView( hdb, szQuery, &htab );
2219     if( res == ERROR_SUCCESS )
2220     {
2221         UINT r;
2222
2223         r = MsiViewExecute( htab, hrec );
2224         if( r != ERROR_SUCCESS )
2225         {
2226             res = r;
2227             fprintf(stderr,"MsiViewExecute failed %08x\n", res);
2228         }
2229
2230         r = MsiViewClose( htab );
2231         if( r != ERROR_SUCCESS )
2232             res = r;
2233
2234         r = MsiCloseHandle( htab );
2235         if( r != ERROR_SUCCESS )
2236             res = r;
2237     }
2238     return res;
2239 }
2240
2241 static UINT try_query( MSIHANDLE hdb, LPCSTR szQuery )
2242 {
2243     return try_query_param( hdb, szQuery, 0 );
2244 }
2245
2246 static void set_summary_str(MSIHANDLE hdb, DWORD pid, LPCSTR value)
2247 {
2248     MSIHANDLE summary;
2249     UINT r;
2250
2251     r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2252     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2253
2254     r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
2255     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2256
2257     r = MsiSummaryInfoPersist(summary);
2258     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2259
2260     MsiCloseHandle(summary);
2261 }
2262
2263 static void set_summary_dword(MSIHANDLE hdb, DWORD pid, DWORD value)
2264 {
2265     MSIHANDLE summary;
2266     UINT r;
2267
2268     r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2269     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2270
2271     r = MsiSummaryInfoSetPropertyA(summary, pid, VT_I4, value, NULL, NULL);
2272     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2273
2274     r = MsiSummaryInfoPersist(summary);
2275     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2276
2277     MsiCloseHandle(summary);
2278 }
2279
2280 static void test_msipackage(void)
2281 {
2282     MSIHANDLE hdb = 0, hpack = 100;
2283     UINT r;
2284     const char *query;
2285     char name[10];
2286
2287     /* NULL szPackagePath */
2288     r = MsiOpenPackage(NULL, &hpack);
2289     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2290
2291     /* empty szPackagePath */
2292     r = MsiOpenPackage("", &hpack);
2293     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2294     {
2295         skip("Not enough rights to perform tests\n");
2296         return;
2297     }
2298     todo_wine
2299     {
2300         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2301     }
2302
2303     if (r == ERROR_SUCCESS)
2304         MsiCloseHandle(hpack);
2305
2306     /* nonexistent szPackagePath */
2307     r = MsiOpenPackage("nonexistent", &hpack);
2308     ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2309
2310     /* NULL hProduct */
2311     r = MsiOpenPackage(msifile, NULL);
2312     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2313
2314     name[0]='#';
2315     name[1]=0;
2316     r = MsiOpenPackage(name, &hpack);
2317     ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r);
2318
2319     r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2320     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2321
2322     /* database exists, but is emtpy */
2323     sprintf(name, "#%d", hdb);
2324     r = MsiOpenPackage(name, &hpack);
2325     ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2326        "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2327
2328     query = "CREATE TABLE `Property` ( "
2329             "`Property` CHAR(72), `Value` CHAR(0) "
2330             "PRIMARY KEY `Property`)";
2331     r = try_query(hdb, query);
2332     ok(r == ERROR_SUCCESS, "failed to create Properties table\n");
2333
2334     query = "CREATE TABLE `InstallExecuteSequence` ("
2335             "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2336             "PRIMARY KEY `Action`)";
2337     r = try_query(hdb, query);
2338     ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n");
2339
2340     /* a few key tables exist */
2341     sprintf(name, "#%d", hdb);
2342     r = MsiOpenPackage(name, &hpack);
2343     ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2344        "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2345
2346     MsiCloseHandle(hdb);
2347     DeleteFile(msifile);
2348
2349     /* start with a clean database to show what constitutes a valid package */
2350     r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2351     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2352
2353     sprintf(name, "#%d", hdb);
2354
2355     /* The following summary information props must exist:
2356      *  - PID_REVNUMBER
2357      *  - PID_PAGECOUNT
2358      */
2359
2360     set_summary_dword(hdb, PID_PAGECOUNT, 100);
2361     r = MsiOpenPackage(name, &hpack);
2362     ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2363        "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2364
2365     set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2366     r = MsiOpenPackage(name, &hpack);
2367     ok(r == ERROR_SUCCESS,
2368        "Expected ERROR_SUCCESS, got %d\n", r);
2369
2370     MsiCloseHandle(hpack);
2371     MsiCloseHandle(hdb);
2372     DeleteFile(msifile);
2373 }
2374
2375 static void test_formatrecord2(void)
2376 {
2377     MSIHANDLE hpkg, hrec ;
2378     char buffer[0x100];
2379     DWORD sz;
2380     UINT r;
2381
2382     r = package_from_db(create_package_db(), &hpkg);
2383     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2384     {
2385         skip("Not enough rights to perform tests\n");
2386         DeleteFile(msifile);
2387         return;
2388     }
2389     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
2390
2391     r = MsiSetProperty(hpkg, "Manufacturer", " " );
2392     ok( r == ERROR_SUCCESS, "set property failed\n");
2393
2394     hrec = MsiCreateRecord(2);
2395     ok(hrec, "create record failed\n");
2396
2397     r = MsiRecordSetString( hrec, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2398     ok( r == ERROR_SUCCESS, "format record failed\n");
2399
2400     buffer[0] = 0;
2401     sz = sizeof buffer;
2402     r = MsiFormatRecord( hpkg, hrec, buffer, &sz );
2403
2404     r = MsiRecordSetString(hrec, 0, "[foo][1]");
2405     r = MsiRecordSetString(hrec, 1, "hoo");
2406     sz = sizeof buffer;
2407     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2408     ok( sz == 3, "size wrong\n");
2409     ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2410     ok( r == ERROR_SUCCESS, "format failed\n");
2411
2412     r = MsiRecordSetString(hrec, 0, "x[~]x");
2413     sz = sizeof buffer;
2414     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2415     ok( sz == 3, "size wrong\n");
2416     ok( 0 == strcmp(buffer,"x"), "wrong output %s\n",buffer);
2417     ok( r == ERROR_SUCCESS, "format failed\n");
2418
2419     r = MsiRecordSetString(hrec, 0, "[foo.$%}][1]");
2420     r = MsiRecordSetString(hrec, 1, "hoo");
2421     sz = sizeof buffer;
2422     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2423     ok( sz == 3, "size wrong\n");
2424     ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2425     ok( r == ERROR_SUCCESS, "format failed\n");
2426
2427     r = MsiRecordSetString(hrec, 0, "[\\[]");
2428     sz = sizeof buffer;
2429     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2430     ok( sz == 1, "size wrong\n");
2431     ok( 0 == strcmp(buffer,"["), "wrong output %s\n",buffer);
2432     ok( r == ERROR_SUCCESS, "format failed\n");
2433
2434     SetEnvironmentVariable("FOO", "BAR");
2435     r = MsiRecordSetString(hrec, 0, "[%FOO]");
2436     sz = sizeof buffer;
2437     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2438     ok( sz == 3, "size wrong\n");
2439     ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2440     ok( r == ERROR_SUCCESS, "format failed\n");
2441
2442     r = MsiRecordSetString(hrec, 0, "[[1]]");
2443     r = MsiRecordSetString(hrec, 1, "%FOO");
2444     sz = sizeof buffer;
2445     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2446     ok( sz == 3, "size wrong\n");
2447     ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2448     ok( r == ERROR_SUCCESS, "format failed\n");
2449
2450     MsiCloseHandle( hrec );
2451     MsiCloseHandle( hpkg );
2452     DeleteFile(msifile);
2453 }
2454
2455 static void test_states(void)
2456 {
2457     MSIHANDLE hpkg;
2458     UINT r;
2459     MSIHANDLE hdb;
2460     INSTALLSTATE state, action;
2461
2462     static const CHAR msifile2[] = "winetest2-package.msi";
2463     static const CHAR msifile3[] = "winetest3-package.msi";
2464     static const CHAR msifile4[] = "winetest4-package.msi";
2465
2466     if (is_process_limited())
2467     {
2468         skip("process is limited\n");
2469         return;
2470     }
2471
2472     hdb = create_package_db();
2473     ok ( hdb, "failed to create package database\n" );
2474
2475     r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
2476     ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
2477
2478     r = create_property_table( hdb );
2479     ok( r == ERROR_SUCCESS, "cannot create Property table: %d\n", r );
2480
2481     r = add_property_entry( hdb, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2482     ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2483
2484     r = add_property_entry( hdb, "'ProductLanguage', '1033'" );
2485     ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2486
2487     r = add_property_entry( hdb, "'ProductName', 'MSITEST'" );
2488     ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2489
2490     r = add_property_entry( hdb, "'ProductVersion', '1.1.1'" );
2491     ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2492
2493     r = create_install_execute_sequence_table( hdb );
2494     ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table: %d\n", r );
2495
2496     r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
2497     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2498
2499     r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
2500     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2501
2502     r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
2503     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2504
2505     r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" );
2506     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2507
2508     r = add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" );
2509     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2510
2511     r = add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" );
2512     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2513
2514     r = add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" );
2515     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2516
2517     r = add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" );
2518     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2519
2520     r = add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" );
2521     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2522
2523     r = add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" );
2524     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2525
2526     r = add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" );
2527     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2528
2529     r = create_media_table( hdb );
2530     ok( r == ERROR_SUCCESS, "cannot create media table: %d\n", r );
2531
2532     r = add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''");
2533     ok( r == ERROR_SUCCESS, "cannot add media entry: %d\n", r );
2534
2535     r = create_feature_table( hdb );
2536     ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
2537
2538     r = create_component_table( hdb );
2539     ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
2540
2541     /* msidbFeatureAttributesFavorLocal */
2542     r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
2543     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2544
2545     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2546     r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2547     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2548
2549     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2550     r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2551     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2552
2553     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2554     r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2555     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2556
2557     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2558     r = add_component_entry( hdb, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2559     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2560
2561     /* msidbFeatureAttributesFavorSource */
2562     r = add_feature_entry( hdb, "'two', '', '', '', 2, 1, '', 1" );
2563     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2564
2565     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2566     r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2567     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2568
2569     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2570     r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2571     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2572
2573     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2574     r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2575     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2576
2577     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2578     r = add_component_entry( hdb, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2579     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2580
2581     /* msidbFeatureAttributesFavorSource */
2582     r = add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" );
2583     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2584
2585     /* msidbFeatureAttributesFavorLocal */
2586     r = add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" );
2587     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2588
2589     /* disabled */
2590     r = add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" );
2591     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2592
2593     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2594     r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2595     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2596
2597     /* no feature parent:msidbComponentAttributesLocalOnly */
2598     r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2599     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2600
2601     /* msidbFeatureAttributesFavorLocal:removed */
2602     r = add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" );
2603     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2604
2605     /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2606     r = add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2607     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2608
2609     /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2610     r = add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2611     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2612
2613     /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2614     r = add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2615     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2616
2617     /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2618     r = add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2619     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2620
2621     /* msidbFeatureAttributesFavorSource:removed */
2622     r = add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" );
2623     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2624
2625     /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2626     r = add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2627     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2628
2629     /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2630     r = add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2631     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2632
2633     /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2634     r = add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2635     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2636
2637     /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2638     r = add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2639     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2640
2641     /* msidbFeatureAttributesFavorLocal */
2642     r = add_feature_entry( hdb, "'eight', '', '', '', 2, 1, '', 0" );
2643     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2644
2645     r = add_component_entry( hdb, "'tau', '{07DEB510-677C-4A6F-A0A6-7CD8EFEA77ED}', 'TARGETDIR', 1, '', 'tau_file'" );
2646     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2647
2648     /* msidbFeatureAttributesFavorSource */
2649     r = add_feature_entry( hdb, "'nine', '', '', '', 2, 1, '', 1" );
2650     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2651
2652     r = add_component_entry( hdb, "'phi', '{9F0594C5-35AD-43EA-94DD-8DF73FAA664D}', 'TARGETDIR', 1, '', 'phi_file'" );
2653     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2654
2655     /* msidbFeatureAttributesFavorAdvertise */
2656     r = add_feature_entry( hdb, "'ten', '', '', '', 2, 1, '', 4" );
2657     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2658
2659     r = add_component_entry( hdb, "'chi', '{E6B539AB-5DA9-4236-A2D2-E341A50B4C38}', 'TARGETDIR', 1, '', 'chi_file'" );
2660     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2661
2662     r = create_feature_components_table( hdb );
2663     ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
2664
2665     r = add_feature_components_entry( hdb, "'one', 'alpha'" );
2666     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2667
2668     r = add_feature_components_entry( hdb, "'one', 'beta'" );
2669     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2670
2671     r = add_feature_components_entry( hdb, "'one', 'gamma'" );
2672     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2673
2674     r = add_feature_components_entry( hdb, "'one', 'theta'" );
2675     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2676
2677     r = add_feature_components_entry( hdb, "'two', 'delta'" );
2678     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2679
2680     r = add_feature_components_entry( hdb, "'two', 'epsilon'" );
2681     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2682
2683     r = add_feature_components_entry( hdb, "'two', 'zeta'" );
2684     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2685
2686     r = add_feature_components_entry( hdb, "'two', 'iota'" );
2687     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2688
2689     r = add_feature_components_entry( hdb, "'three', 'eta'" );
2690     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2691
2692     r = add_feature_components_entry( hdb, "'four', 'eta'" );
2693     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2694
2695     r = add_feature_components_entry( hdb, "'five', 'eta'" );
2696     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2697
2698     r = add_feature_components_entry( hdb, "'six', 'lambda'" );
2699     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2700
2701     r = add_feature_components_entry( hdb, "'six', 'mu'" );
2702     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2703
2704     r = add_feature_components_entry( hdb, "'six', 'nu'" );
2705     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2706
2707     r = add_feature_components_entry( hdb, "'six', 'xi'" );
2708     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2709
2710     r = add_feature_components_entry( hdb, "'seven', 'omicron'" );
2711     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2712
2713     r = add_feature_components_entry( hdb, "'seven', 'pi'" );
2714     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2715
2716     r = add_feature_components_entry( hdb, "'seven', 'rho'" );
2717     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2718
2719     r = add_feature_components_entry( hdb, "'seven', 'sigma'" );
2720     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2721
2722     r = add_feature_components_entry( hdb, "'eight', 'tau'" );
2723     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2724
2725     r = add_feature_components_entry( hdb, "'nine', 'phi'" );
2726     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2727
2728     r = add_feature_components_entry( hdb, "'ten', 'chi'" );
2729     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2730
2731     r = create_file_table( hdb );
2732     ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
2733
2734     r = add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2735     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2736
2737     r = add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2738     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2739
2740     r = add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2741     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2742
2743     r = add_file_entry( hdb, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2744     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2745
2746     r = add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2747     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2748
2749     r = add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2750     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2751
2752     r = add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2753     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2754
2755     r = add_file_entry( hdb, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2756     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2757
2758     /* compressed file */
2759     r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2760     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2761
2762     r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2763     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2764
2765     r = add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2766     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2767
2768     r = add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2769     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2770
2771     r = add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2772     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2773
2774     r = add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2775     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2776
2777     r = add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2778     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2779
2780     r = add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2781     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2782
2783     r = add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2784     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2785
2786     r = add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2787     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2788
2789     r = add_file_entry( hdb, "'tau_file', 'tau', 'tau.txt', 100, '', '1033', 8192, 1" );
2790     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2791
2792     r = add_file_entry( hdb, "'phi_file', 'phi', 'phi.txt', 100, '', '1033', 8192, 1" );
2793     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2794
2795     r = add_file_entry( hdb, "'chi_file', 'chi', 'chi.txt', 100, '', '1033', 8192, 1" );
2796     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2797
2798     MsiDatabaseCommit(hdb);
2799
2800     /* these properties must not be in the saved msi file */
2801     r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
2802     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2803
2804     r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
2805     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2806
2807     r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
2808     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2809
2810     r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
2811     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2812
2813     r = add_property_entry( hdb, "'REINSTALLMODE', 'omus'");
2814     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2815
2816     r = package_from_db( hdb, &hpkg );
2817     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2818     {
2819         skip("Not enough rights to perform tests\n");
2820         DeleteFile(msifile);
2821         return;
2822     }
2823     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
2824
2825     MsiCloseHandle(hdb);
2826
2827     CopyFileA(msifile, msifile2, FALSE);
2828     CopyFileA(msifile, msifile3, FALSE);
2829     CopyFileA(msifile, msifile4, FALSE);
2830
2831     state = 0xdeadbee;
2832     action = 0xdeadbee;
2833     r = MsiGetFeatureState(hpkg, "one", &state, &action);
2834     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2835     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2836     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2837
2838     state = 0xdeadbee;
2839     action = 0xdeadbee;
2840     r = MsiGetFeatureState(hpkg, "two", &state, &action);
2841     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2842     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2843     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2844
2845     state = 0xdeadbee;
2846     action = 0xdeadbee;
2847     r = MsiGetFeatureState(hpkg, "three", &state, &action);
2848     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2849     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2850     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2851
2852     state = 0xdeadbee;
2853     action = 0xdeadbee;
2854     r = MsiGetFeatureState(hpkg, "four", &state, &action);
2855     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2856     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2857     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2858
2859     state = 0xdeadbee;
2860     action = 0xdeadbee;
2861     r = MsiGetFeatureState(hpkg, "five", &state, &action);
2862     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2863     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2864     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2865
2866     state = 0xdeadbee;
2867     action = 0xdeadbee;
2868     r = MsiGetFeatureState(hpkg, "six", &state, &action);
2869     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2870     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2871     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2872
2873     state = 0xdeadbee;
2874     action = 0xdeadbee;
2875     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2876     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2877     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2878     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2879
2880     state = 0xdeadbee;
2881     action = 0xdeadbee;
2882     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
2883     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2884     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2885     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2886
2887     state = 0xdeadbee;
2888     action = 0xdeadbee;
2889     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
2890     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2891     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2892     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2893
2894     state = 0xdeadbee;
2895     action = 0xdeadbee;
2896     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
2897     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2898     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2899     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2900
2901     state = 0xdeadbee;
2902     action = 0xdeadbee;
2903     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2904     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2905     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2906     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2907
2908     state = 0xdeadbee;
2909     action = 0xdeadbee;
2910     r = MsiGetComponentState(hpkg, "beta", &state, &action);
2911     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2912     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2913     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2914
2915     state = 0xdeadbee;
2916     action = 0xdeadbee;
2917     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2918     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2919     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2920     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2921
2922     state = 0xdeadbee;
2923     action = 0xdeadbee;
2924     r = MsiGetComponentState(hpkg, "theta", &state, &action);
2925     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2926     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2927     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2928
2929     state = 0xdeadbee;
2930     action = 0xdeadbee;
2931     r = MsiGetComponentState(hpkg, "delta", &state, &action);
2932     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2933     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2934     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2935
2936     state = 0xdeadbee;
2937     action = 0xdeadbee;
2938     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2939     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2940     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2941     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2942
2943     state = 0xdeadbee;
2944     action = 0xdeadbee;
2945     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2946     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2947     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2948     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2949
2950     state = 0xdeadbee;
2951     action = 0xdeadbee;
2952     r = MsiGetComponentState(hpkg, "iota", &state, &action);
2953     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2954     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2955     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2956
2957     state = 0xdeadbee;
2958     action = 0xdeadbee;
2959     r = MsiGetComponentState(hpkg, "eta", &state, &action);
2960     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2961     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2962     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2963
2964     state = 0xdeadbee;
2965     action = 0xdeadbee;
2966     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2967     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2968     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2969     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2970
2971     state = 0xdeadbee;
2972     action = 0xdeadbee;
2973     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2974     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2975     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2976     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2977
2978     state = 0xdeadbee;
2979     action = 0xdeadbee;
2980     r = MsiGetComponentState(hpkg, "mu", &state, &action);
2981     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2982     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2983     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2984
2985     state = 0xdeadbee;
2986     action = 0xdeadbee;
2987     r = MsiGetComponentState(hpkg, "nu", &state, &action);
2988     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2989     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2990     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2991
2992     state = 0xdeadbee;
2993     action = 0xdeadbee;
2994     r = MsiGetComponentState(hpkg, "xi", &state, &action);
2995     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2996     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2997     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2998
2999     state = 0xdeadbee;
3000     action = 0xdeadbee;
3001     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3002     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3003     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3004     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3005
3006     state = 0xdeadbee;
3007     action = 0xdeadbee;
3008     r = MsiGetComponentState(hpkg, "pi", &state, &action);
3009     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3010     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3011     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3012
3013     state = 0xdeadbee;
3014     action = 0xdeadbee;
3015     r = MsiGetComponentState(hpkg, "rho", &state, &action);
3016     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3017     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3018     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3019
3020     state = 0xdeadbee;
3021     action = 0xdeadbee;
3022     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3023     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3024     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3025     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3026
3027     state = 0xdeadbee;
3028     action = 0xdeadbee;
3029     r = MsiGetComponentState(hpkg, "tau", &state, &action);
3030     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3031     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3032     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3033
3034     state = 0xdeadbee;
3035     action = 0xdeadbee;
3036     r = MsiGetComponentState(hpkg, "phi", &state, &action);
3037     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3038     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3039     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3040
3041     state = 0xdeadbee;
3042     action = 0xdeadbee;
3043     r = MsiGetComponentState(hpkg, "chi", &state, &action);
3044     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3045     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3046     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3047
3048     r = MsiDoAction( hpkg, "CostInitialize");
3049     ok( r == ERROR_SUCCESS, "cost init failed\n");
3050
3051     state = 0xdeadbee;
3052     action = 0xdeadbee;
3053     r = MsiGetFeatureState(hpkg, "one", &state, &action);
3054     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3055     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3056     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3057
3058     state = 0xdeadbee;
3059     action = 0xdeadbee;
3060     r = MsiGetFeatureState(hpkg, "two", &state, &action);
3061     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3062     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3063     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3064
3065     state = 0xdeadbee;
3066     action = 0xdeadbee;
3067     r = MsiGetFeatureState(hpkg, "three", &state, &action);
3068     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3069     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3070     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3071
3072     state = 0xdeadbee;
3073     action = 0xdeadbee;
3074     r = MsiGetFeatureState(hpkg, "four", &state, &action);
3075     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3076     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3077     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3078
3079     state = 0xdeadbee;
3080     action = 0xdeadbee;
3081     r = MsiGetFeatureState(hpkg, "five", &state, &action);
3082     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3083     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3084     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3085
3086     state = 0xdeadbee;
3087     action = 0xdeadbee;
3088     r = MsiGetFeatureState(hpkg, "six", &state, &action);
3089     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3090     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3091     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3092
3093     state = 0xdeadbee;
3094     action = 0xdeadbee;
3095     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3096     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3097     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3098     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3099
3100     state = 0xdeadbee;
3101     action = 0xdeadbee;
3102     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3103     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3104     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3105     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3106
3107     state = 0xdeadbee;
3108     action = 0xdeadbee;
3109     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3110     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3111     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3112     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3113
3114     state = 0xdeadbee;
3115     action = 0xdeadbee;
3116     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3117     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3118     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3119     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3120
3121     state = 0xdeadbee;
3122     action = 0xdeadbee;
3123     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3124     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3125     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3126     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3127
3128     state = 0xdeadbee;
3129     action = 0xdeadbee;
3130     r = MsiGetComponentState(hpkg, "beta", &state, &action);
3131     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3132     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3133     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3134
3135     state = 0xdeadbee;
3136     action = 0xdeadbee;
3137     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3138     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3139     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3140     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3141
3142     state = 0xdeadbee;
3143     action = 0xdeadbee;
3144     r = MsiGetComponentState(hpkg, "theta", &state, &action);
3145     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3146     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3147     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3148
3149     state = 0xdeadbee;
3150     action = 0xdeadbee;
3151     r = MsiGetComponentState(hpkg, "delta", &state, &action);
3152     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3153     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3154     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3155
3156     state = 0xdeadbee;
3157     action = 0xdeadbee;
3158     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3159     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3160     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3161     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3162
3163     state = 0xdeadbee;
3164     action = 0xdeadbee;
3165     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3166     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3167     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3168     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3169
3170     state = 0xdeadbee;
3171     action = 0xdeadbee;
3172     r = MsiGetComponentState(hpkg, "iota", &state, &action);
3173     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3174     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3175     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3176
3177     state = 0xdeadbee;
3178     action = 0xdeadbee;
3179     r = MsiGetComponentState(hpkg, "eta", &state, &action);
3180     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3181     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3182     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3183
3184     state = 0xdeadbee;
3185     action = 0xdeadbee;
3186     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3187     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3188     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3189     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3190
3191     state = 0xdeadbee;
3192     action = 0xdeadbee;
3193     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3194     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3195     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3196     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3197
3198     state = 0xdeadbee;
3199     action = 0xdeadbee;
3200     r = MsiGetComponentState(hpkg, "mu", &state, &action);
3201     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3202     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3203     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3204
3205     state = 0xdeadbee;
3206     action = 0xdeadbee;
3207     r = MsiGetComponentState(hpkg, "nu", &state, &action);
3208     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3209     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3210     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3211
3212     state = 0xdeadbee;
3213     action = 0xdeadbee;
3214     r = MsiGetComponentState(hpkg, "xi", &state, &action);
3215     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3216     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3217     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3218
3219     state = 0xdeadbee;
3220     action = 0xdeadbee;
3221     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3222     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3223     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3224     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3225
3226     state = 0xdeadbee;
3227     action = 0xdeadbee;
3228     r = MsiGetComponentState(hpkg, "pi", &state, &action);
3229     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3230     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3231     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3232
3233     state = 0xdeadbee;
3234     action = 0xdeadbee;
3235     r = MsiGetComponentState(hpkg, "rho", &state, &action);
3236     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3237     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3238     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3239
3240     state = 0xdeadbee;
3241     action = 0xdeadbee;
3242     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3243     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3244     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3245     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3246
3247     state = 0xdeadbee;
3248     action = 0xdeadbee;
3249     r = MsiGetComponentState(hpkg, "tau", &state, &action);
3250     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3251     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3252     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3253
3254     state = 0xdeadbee;
3255     action = 0xdeadbee;
3256     r = MsiGetComponentState(hpkg, "phi", &state, &action);
3257     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3258     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3259     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3260
3261     state = 0xdeadbee;
3262     action = 0xdeadbee;
3263     r = MsiGetComponentState(hpkg, "chi", &state, &action);
3264     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3265     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3266     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3267
3268     r = MsiDoAction( hpkg, "FileCost");
3269     ok( r == ERROR_SUCCESS, "file cost failed\n");
3270
3271     state = 0xdeadbee;
3272     action = 0xdeadbee;
3273     r = MsiGetFeatureState(hpkg, "one", &state, &action);
3274     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3275     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3276     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3277
3278     state = 0xdeadbee;
3279     action = 0xdeadbee;
3280     r = MsiGetFeatureState(hpkg, "two", &state, &action);
3281     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3282     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3283     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3284
3285     state = 0xdeadbee;
3286     action = 0xdeadbee;
3287     r = MsiGetFeatureState(hpkg, "three", &state, &action);
3288     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3289     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3290     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3291
3292     state = 0xdeadbee;
3293     action = 0xdeadbee;
3294     r = MsiGetFeatureState(hpkg, "four", &state, &action);
3295     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3296     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3297     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3298
3299     state = 0xdeadbee;
3300     action = 0xdeadbee;
3301     r = MsiGetFeatureState(hpkg, "five", &state, &action);
3302     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3303     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3304     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3305
3306     state = 0xdeadbee;
3307     action = 0xdeadbee;
3308     r = MsiGetFeatureState(hpkg, "six", &state, &action);
3309     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3310     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3311     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3312
3313     state = 0xdeadbee;
3314     action = 0xdeadbee;
3315     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3316     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3317     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3318     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3319
3320     state = 0xdeadbee;
3321     action = 0xdeadbee;
3322     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3323     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3324     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3325     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3326
3327     state = 0xdeadbee;
3328     action = 0xdeadbee;
3329     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3330     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3331     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3332     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3333
3334     state = 0xdeadbee;
3335     action = 0xdeadbee;
3336     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3337     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3338     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3339     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3340
3341     state = 0xdeadbee;
3342     action = 0xdeadbee;
3343     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3344     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3345     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3346     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3347
3348     state = 0xdeadbee;
3349     action = 0xdeadbee;
3350     r = MsiGetComponentState(hpkg, "beta", &state, &action);
3351     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3352     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3353     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3354
3355     state = 0xdeadbee;
3356     action = 0xdeadbee;
3357     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3358     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3359     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3360     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3361
3362     state = 0xdeadbee;
3363     action = 0xdeadbee;
3364     r = MsiGetComponentState(hpkg, "theta", &state, &action);
3365     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3366     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3367     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3368
3369     state = 0xdeadbee;
3370     action = 0xdeadbee;
3371     r = MsiGetComponentState(hpkg, "delta", &state, &action);
3372     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3373     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3374     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3375
3376     state = 0xdeadbee;
3377     action = 0xdeadbee;
3378     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3379     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3380     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3381     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3382
3383     state = 0xdeadbee;
3384     action = 0xdeadbee;
3385     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3386     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3387     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3388     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3389
3390     state = 0xdeadbee;
3391     action = 0xdeadbee;
3392     r = MsiGetComponentState(hpkg, "iota", &state, &action);
3393     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3394     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3395     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3396
3397     state = 0xdeadbee;
3398     action = 0xdeadbee;
3399     r = MsiGetComponentState(hpkg, "eta", &state, &action);
3400     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3401     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3402     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3403
3404     state = 0xdeadbee;
3405     action = 0xdeadbee;
3406     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3407     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3408     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3409     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3410
3411     state = 0xdeadbee;
3412     action = 0xdeadbee;
3413     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3414     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3415     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3416     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3417
3418     state = 0xdeadbee;
3419     action = 0xdeadbee;
3420     r = MsiGetComponentState(hpkg, "mu", &state, &action);
3421     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3422     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3423     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3424
3425     state = 0xdeadbee;
3426     action = 0xdeadbee;
3427     r = MsiGetComponentState(hpkg, "nu", &state, &action);
3428     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3429     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3430     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3431
3432     state = 0xdeadbee;
3433     action = 0xdeadbee;
3434     r = MsiGetComponentState(hpkg, "xi", &state, &action);
3435     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3436     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3437     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3438
3439     state = 0xdeadbee;
3440     action = 0xdeadbee;
3441     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3442     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3443     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3444     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3445
3446     state = 0xdeadbee;
3447     action = 0xdeadbee;
3448     r = MsiGetComponentState(hpkg, "pi", &state, &action);
3449     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3450     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3451     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3452
3453     state = 0xdeadbee;
3454     action = 0xdeadbee;
3455     r = MsiGetComponentState(hpkg, "rho", &state, &action);
3456     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3457     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3458     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3459
3460     state = 0xdeadbee;
3461     action = 0xdeadbee;
3462     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3463     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3464     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3465     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3466
3467     state = 0xdeadbee;
3468     action = 0xdeadbee;
3469     r = MsiGetComponentState(hpkg, "tau", &state, &action);
3470     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3471     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3472     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3473
3474     state = 0xdeadbee;
3475     action = 0xdeadbee;
3476     r = MsiGetComponentState(hpkg, "phi", &state, &action);
3477     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3478     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3479     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3480
3481     state = 0xdeadbee;
3482     action = 0xdeadbee;
3483     r = MsiGetComponentState(hpkg, "chi", &state, &action);
3484     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3485     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3486     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3487
3488     r = MsiDoAction( hpkg, "CostFinalize");
3489     ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3490
3491     state = 0xdeadbee;
3492     action = 0xdeadbee;
3493     r = MsiGetFeatureState(hpkg, "one", &state, &action);
3494     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3495     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3496     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3497
3498     state = 0xdeadbee;
3499     action = 0xdeadbee;
3500     r = MsiGetFeatureState(hpkg, "two", &state, &action);
3501     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3502     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3503     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3504
3505     state = 0xdeadbee;
3506     action = 0xdeadbee;
3507     r = MsiGetFeatureState(hpkg, "three", &state, &action);
3508     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3509     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3510     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3511
3512     state = 0xdeadbee;
3513     action = 0xdeadbee;
3514     r = MsiGetFeatureState(hpkg, "four", &state, &action);
3515     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3516     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3517     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3518
3519     state = 0xdeadbee;
3520     action = 0xdeadbee;
3521     r = MsiGetFeatureState(hpkg, "five", &state, &action);
3522     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3523     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3524     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3525
3526     state = 0xdeadbee;
3527     action = 0xdeadbee;
3528     r = MsiGetFeatureState(hpkg, "six", &state, &action);
3529     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3530     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3531     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3532
3533     state = 0xdeadbee;
3534     action = 0xdeadbee;
3535     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3536     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3537     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3538     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3539
3540     state = 0xdeadbee;
3541     action = 0xdeadbee;
3542     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3543     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3544     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3545     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3546
3547     state = 0xdeadbee;
3548     action = 0xdeadbee;
3549     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3550     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3551     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3552     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3553
3554     state = 0xdeadbee;
3555     action = 0xdeadbee;
3556     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3557     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3558     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3559     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3560
3561     state = 0xdeadbee;
3562     action = 0xdeadbee;
3563     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3564     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3565     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3566     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3567
3568     state = 0xdeadbee;
3569     action = 0xdeadbee;
3570     r = MsiGetComponentState(hpkg, "beta", &state, &action);
3571     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3572     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3573     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3574
3575     state = 0xdeadbee;
3576     action = 0xdeadbee;
3577     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3578     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3579     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3580     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3581
3582     state = 0xdeadbee;
3583     action = 0xdeadbee;
3584     r = MsiGetComponentState(hpkg, "theta", &state, &action);
3585     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3586     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3587     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3588
3589     state = 0xdeadbee;
3590     action = 0xdeadbee;
3591     r = MsiGetComponentState(hpkg, "delta", &state, &action);
3592     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3593     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3594     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3595
3596     state = 0xdeadbee;
3597     action = 0xdeadbee;
3598     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3599     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3600     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3601     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3602
3603     state = 0xdeadbee;
3604     action = 0xdeadbee;
3605     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3606     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3607     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3608     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3609
3610     state = 0xdeadbee;
3611     action = 0xdeadbee;
3612     r = MsiGetComponentState(hpkg, "iota", &state, &action);
3613     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3614     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3615     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3616
3617     state = 0xdeadbee;
3618     action = 0xdeadbee;
3619     r = MsiGetComponentState(hpkg, "eta", &state, &action);
3620     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3621     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3622     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3623
3624     state = 0xdeadbee;
3625     action = 0xdeadbee;
3626     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3627     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3628     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3629     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3630
3631     state = 0xdeadbee;
3632     action = 0xdeadbee;
3633     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3634     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3635     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3636     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3637
3638     state = 0xdeadbee;
3639     action = 0xdeadbee;
3640     r = MsiGetComponentState(hpkg, "mu", &state, &action);
3641     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3642     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3643     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3644
3645     state = 0xdeadbee;
3646     action = 0xdeadbee;
3647     r = MsiGetComponentState(hpkg, "nu", &state, &action);
3648     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3649     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3650     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3651
3652     state = 0xdeadbee;
3653     action = 0xdeadbee;
3654     r = MsiGetComponentState(hpkg, "xi", &state, &action);
3655     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3656     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3657     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3658
3659     state = 0xdeadbee;
3660     action = 0xdeadbee;
3661     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3662     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3663     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3664     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3665
3666     state = 0xdeadbee;
3667     action = 0xdeadbee;
3668     r = MsiGetComponentState(hpkg, "pi", &state, &action);
3669     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3670     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3671     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3672
3673     state = 0xdeadbee;
3674     action = 0xdeadbee;
3675     r = MsiGetComponentState(hpkg, "rho", &state, &action);
3676     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3677     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3678     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3679
3680     state = 0xdeadbee;
3681     action = 0xdeadbee;
3682     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3683     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3684     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3685     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3686
3687     state = 0xdeadbee;
3688     action = 0xdeadbee;
3689     r = MsiGetComponentState(hpkg, "tau", &state, &action);
3690     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3691     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3692     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3693
3694     state = 0xdeadbee;
3695     action = 0xdeadbee;
3696     r = MsiGetComponentState(hpkg, "phi", &state, &action);
3697     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3698     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3699     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3700
3701     state = 0xdeadbee;
3702     action = 0xdeadbee;
3703     r = MsiGetComponentState(hpkg, "chi", &state, &action);
3704     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3705     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3706     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3707
3708     MsiCloseHandle( hpkg );
3709
3710     /* publish the features and components */
3711     r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven REINSTALL=eight,nine,ten");
3712     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3713
3714     r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
3715     ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
3716
3717     /* these properties must not be in the saved msi file */
3718     r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
3719     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3720
3721     r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
3722     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3723
3724     r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
3725     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3726
3727     r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
3728     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3729
3730     r = package_from_db( hdb, &hpkg );
3731     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
3732
3733     MsiCloseHandle(hdb);
3734
3735     state = 0xdeadbee;
3736     action = 0xdeadbee;
3737     r = MsiGetFeatureState(hpkg, "one", &state, &action);
3738     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3739     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3740     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3741
3742     state = 0xdeadbee;
3743     action = 0xdeadbee;
3744     r = MsiGetFeatureState(hpkg, "two", &state, &action);
3745     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3746     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3747     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3748
3749     state = 0xdeadbee;
3750     action = 0xdeadbee;
3751     r = MsiGetFeatureState(hpkg, "three", &state, &action);
3752     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3753     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3754     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3755
3756     state = 0xdeadbee;
3757     action = 0xdeadbee;
3758     r = MsiGetFeatureState(hpkg, "four", &state, &action);
3759     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3760     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3761     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3762
3763     state = 0xdeadbee;
3764     action = 0xdeadbee;
3765     r = MsiGetFeatureState(hpkg, "five", &state, &action);
3766     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3767     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3768     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3769
3770     state = 0xdeadbee;
3771     action = 0xdeadbee;
3772     r = MsiGetFeatureState(hpkg, "six", &state, &action);
3773     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3774     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3775     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3776
3777     state = 0xdeadbee;
3778     action = 0xdeadbee;
3779     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3780     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3781     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3782     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3783
3784     state = 0xdeadbee;
3785     action = 0xdeadbee;
3786     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3787     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3788     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3789     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3790
3791     state = 0xdeadbee;
3792     action = 0xdeadbee;
3793     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3794     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3795     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3796     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3797
3798     state = 0xdeadbee;
3799     action = 0xdeadbee;
3800     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3801     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3802     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3803     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3804
3805     state = 0xdeadbee;
3806     action = 0xdeadbee;
3807     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3808     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3809     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3810     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3811
3812     state = 0xdeadbee;
3813     action = 0xdeadbee;
3814     r = MsiGetComponentState(hpkg, "beta", &state, &action);
3815     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3816     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3817     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3818
3819     state = 0xdeadbee;
3820     action = 0xdeadbee;
3821     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3822     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3823     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3824     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3825
3826     state = 0xdeadbee;
3827     action = 0xdeadbee;
3828     r = MsiGetComponentState(hpkg, "theta", &state, &action);
3829     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3830     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3831     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3832
3833     state = 0xdeadbee;
3834     action = 0xdeadbee;
3835     r = MsiGetComponentState(hpkg, "delta", &state, &action);
3836     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3837     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3838     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3839
3840     state = 0xdeadbee;
3841     action = 0xdeadbee;
3842     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3843     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3844     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3845     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3846
3847     state = 0xdeadbee;
3848     action = 0xdeadbee;
3849     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3850     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3851     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3852     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3853
3854     state = 0xdeadbee;
3855     action = 0xdeadbee;
3856     r = MsiGetComponentState(hpkg, "iota", &state, &action);
3857     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3858     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3859     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3860
3861     state = 0xdeadbee;
3862     action = 0xdeadbee;
3863     r = MsiGetComponentState(hpkg, "eta", &state, &action);
3864     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3865     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3866     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3867
3868     state = 0xdeadbee;
3869     action = 0xdeadbee;
3870     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3871     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3872     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3873     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3874
3875     state = 0xdeadbee;
3876     action = 0xdeadbee;
3877     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3878     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3879     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3880     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3881
3882     state = 0xdeadbee;
3883     action = 0xdeadbee;
3884     r = MsiGetComponentState(hpkg, "mu", &state, &action);
3885     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3886     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3887     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3888
3889     state = 0xdeadbee;
3890     action = 0xdeadbee;
3891     r = MsiGetComponentState(hpkg, "nu", &state, &action);
3892     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3893     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3894     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3895
3896     state = 0xdeadbee;
3897     action = 0xdeadbee;
3898     r = MsiGetComponentState(hpkg, "xi", &state, &action);
3899     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3900     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3901     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3902
3903     state = 0xdeadbee;
3904     action = 0xdeadbee;
3905     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3906     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3907     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3908     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3909
3910     state = 0xdeadbee;
3911     action = 0xdeadbee;
3912     r = MsiGetComponentState(hpkg, "pi", &state, &action);
3913     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3914     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3915     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3916
3917     state = 0xdeadbee;
3918     action = 0xdeadbee;
3919     r = MsiGetComponentState(hpkg, "rho", &state, &action);
3920     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3921     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3922     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3923
3924     state = 0xdeadbee;
3925     action = 0xdeadbee;
3926     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3927     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3928     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3929     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3930
3931     state = 0xdeadbee;
3932     action = 0xdeadbee;
3933     r = MsiGetComponentState(hpkg, "tau", &state, &action);
3934     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3935     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3936     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3937
3938     state = 0xdeadbee;
3939     action = 0xdeadbee;
3940     r = MsiGetComponentState(hpkg, "phi", &state, &action);
3941     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3942     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3943     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3944
3945     state = 0xdeadbee;
3946     action = 0xdeadbee;
3947     r = MsiGetComponentState(hpkg, "chi", &state, &action);
3948     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3949     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3950     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3951
3952     r = MsiDoAction( hpkg, "CostInitialize");
3953     ok( r == ERROR_SUCCESS, "cost init failed\n");
3954
3955     state = 0xdeadbee;
3956     action = 0xdeadbee;
3957     r = MsiGetFeatureState(hpkg, "one", &state, &action);
3958     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3959     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3960     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3961
3962     state = 0xdeadbee;
3963     action = 0xdeadbee;
3964     r = MsiGetFeatureState(hpkg, "two", &state, &action);
3965     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3966     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3967     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3968
3969     state = 0xdeadbee;
3970     action = 0xdeadbee;
3971     r = MsiGetFeatureState(hpkg, "three", &state, &action);
3972     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3973     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3974     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3975
3976     state = 0xdeadbee;
3977     action = 0xdeadbee;
3978     r = MsiGetFeatureState(hpkg, "four", &state, &action);
3979     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3980     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3981     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3982
3983     state = 0xdeadbee;
3984     action = 0xdeadbee;
3985     r = MsiGetFeatureState(hpkg, "five", &state, &action);
3986     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3987     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3988     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3989
3990     state = 0xdeadbee;
3991     action = 0xdeadbee;
3992     r = MsiGetFeatureState(hpkg, "six", &state, &action);
3993     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3994     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3995     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3996
3997     state = 0xdeadbee;
3998     action = 0xdeadbee;
3999     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4000     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4001     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4002     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4003
4004     state = 0xdeadbee;
4005     action = 0xdeadbee;
4006     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4007     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4008     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4009     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4010
4011     state = 0xdeadbee;
4012     action = 0xdeadbee;
4013     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4014     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4015     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4016     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4017
4018     state = 0xdeadbee;
4019     action = 0xdeadbee;
4020     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4021     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4022     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4023     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4024
4025     state = 0xdeadbee;
4026     action = 0xdeadbee;
4027     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4028     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4029     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4030     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4031
4032     state = 0xdeadbee;
4033     action = 0xdeadbee;
4034     r = MsiGetComponentState(hpkg, "beta", &state, &action);
4035     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4036     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4037     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4038
4039     state = 0xdeadbee;
4040     action = 0xdeadbee;
4041     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4042     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4043     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4044     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4045
4046     state = 0xdeadbee;
4047     action = 0xdeadbee;
4048     r = MsiGetComponentState(hpkg, "theta", &state, &action);
4049     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4050     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4051     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4052
4053     state = 0xdeadbee;
4054     action = 0xdeadbee;
4055     r = MsiGetComponentState(hpkg, "delta", &state, &action);
4056     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4057     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4058     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4059
4060     state = 0xdeadbee;
4061     action = 0xdeadbee;
4062     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4063     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4064     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4065     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4066
4067     state = 0xdeadbee;
4068     action = 0xdeadbee;
4069     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4070     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4071     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4072     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4073
4074     state = 0xdeadbee;
4075     action = 0xdeadbee;
4076     r = MsiGetComponentState(hpkg, "iota", &state, &action);
4077     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4078     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4079     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4080
4081     state = 0xdeadbee;
4082     action = 0xdeadbee;
4083     r = MsiGetComponentState(hpkg, "eta", &state, &action);
4084     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4085     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4086     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4087
4088     state = 0xdeadbee;
4089     action = 0xdeadbee;
4090     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4091     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4092     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4093     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4094
4095     state = 0xdeadbee;
4096     action = 0xdeadbee;
4097     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4098     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4099     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4100     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4101
4102     state = 0xdeadbee;
4103     action = 0xdeadbee;
4104     r = MsiGetComponentState(hpkg, "mu", &state, &action);
4105     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4106     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4107     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4108
4109     state = 0xdeadbee;
4110     action = 0xdeadbee;
4111     r = MsiGetComponentState(hpkg, "nu", &state, &action);
4112     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4113     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4114     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4115
4116     state = 0xdeadbee;
4117     action = 0xdeadbee;
4118     r = MsiGetComponentState(hpkg, "xi", &state, &action);
4119     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4120     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4121     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4122
4123     state = 0xdeadbee;
4124     action = 0xdeadbee;
4125     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4126     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4127     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4128     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4129
4130     state = 0xdeadbee;
4131     action = 0xdeadbee;
4132     r = MsiGetComponentState(hpkg, "pi", &state, &action);
4133     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4134     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4135     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4136
4137     state = 0xdeadbee;
4138     action = 0xdeadbee;
4139     r = MsiGetComponentState(hpkg, "rho", &state, &action);
4140     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4141     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4142     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4143
4144     state = 0xdeadbee;
4145     action = 0xdeadbee;
4146     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4147     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4148     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4149     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4150
4151     state = 0xdeadbee;
4152     action = 0xdeadbee;
4153     r = MsiGetComponentState(hpkg, "tau", &state, &action);
4154     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4155     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4156     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4157
4158     state = 0xdeadbee;
4159     action = 0xdeadbee;
4160     r = MsiGetComponentState(hpkg, "phi", &state, &action);
4161     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4162     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4163     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4164
4165     state = 0xdeadbee;
4166     action = 0xdeadbee;
4167     r = MsiGetComponentState(hpkg, "chi", &state, &action);
4168     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4169     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4170     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4171
4172     r = MsiDoAction( hpkg, "FileCost");
4173     ok( r == ERROR_SUCCESS, "file cost failed\n");
4174
4175     state = 0xdeadbee;
4176     action = 0xdeadbee;
4177     r = MsiGetFeatureState(hpkg, "one", &state, &action);
4178     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4179     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4180     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4181
4182     state = 0xdeadbee;
4183     action = 0xdeadbee;
4184     r = MsiGetFeatureState(hpkg, "two", &state, &action);
4185     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4186     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4187     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4188
4189     state = 0xdeadbee;
4190     action = 0xdeadbee;
4191     r = MsiGetFeatureState(hpkg, "three", &state, &action);
4192     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4193     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4194     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4195
4196     state = 0xdeadbee;
4197     action = 0xdeadbee;
4198     r = MsiGetFeatureState(hpkg, "four", &state, &action);
4199     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4200     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4201     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4202
4203     state = 0xdeadbee;
4204     action = 0xdeadbee;
4205     r = MsiGetFeatureState(hpkg, "five", &state, &action);
4206     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4207     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4208     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4209
4210     state = 0xdeadbee;
4211     action = 0xdeadbee;
4212     r = MsiGetFeatureState(hpkg, "six", &state, &action);
4213     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4214     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4215     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4216
4217     state = 0xdeadbee;
4218     action = 0xdeadbee;
4219     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4220     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4221     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4222     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4223
4224     state = 0xdeadbee;
4225     action = 0xdeadbee;
4226     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4227     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4228     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4229     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4230
4231     state = 0xdeadbee;
4232     action = 0xdeadbee;
4233     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4234     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4235     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4236     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4237
4238     state = 0xdeadbee;
4239     action = 0xdeadbee;
4240     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4241     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4242     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4243     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4244
4245     state = 0xdeadbee;
4246     action = 0xdeadbee;
4247     r = MsiGetComponentState(hpkg, "beta", &state, &action);
4248     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4249     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4250     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4251
4252     state = 0xdeadbee;
4253     action = 0xdeadbee;
4254     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4255     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4256     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4257     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4258
4259     state = 0xdeadbee;
4260     action = 0xdeadbee;
4261     r = MsiGetComponentState(hpkg, "theta", &state, &action);
4262     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4263     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4264     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4265
4266     state = 0xdeadbee;
4267     action = 0xdeadbee;
4268     r = MsiGetComponentState(hpkg, "delta", &state, &action);
4269     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4270     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4271     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4272
4273     state = 0xdeadbee;
4274     action = 0xdeadbee;
4275     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4276     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4277     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4278     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4279
4280     state = 0xdeadbee;
4281     action = 0xdeadbee;
4282     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4283     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4284     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4285     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4286
4287     state = 0xdeadbee;
4288     action = 0xdeadbee;
4289     r = MsiGetComponentState(hpkg, "iota", &state, &action);
4290     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4291     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4292     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4293
4294     state = 0xdeadbee;
4295     action = 0xdeadbee;
4296     r = MsiGetComponentState(hpkg, "eta", &state, &action);
4297     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4298     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4299     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4300
4301     state = 0xdeadbee;
4302     action = 0xdeadbee;
4303     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4304     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4305     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4306     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4307
4308     state = 0xdeadbee;
4309     action = 0xdeadbee;
4310     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4311     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4312     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4313     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4314
4315     state = 0xdeadbee;
4316     action = 0xdeadbee;
4317     r = MsiGetComponentState(hpkg, "mu", &state, &action);
4318     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4319     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4320     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4321
4322     state = 0xdeadbee;
4323     action = 0xdeadbee;
4324     r = MsiGetComponentState(hpkg, "nu", &state, &action);
4325     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4326     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4327     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4328
4329     state = 0xdeadbee;
4330     action = 0xdeadbee;
4331     r = MsiGetComponentState(hpkg, "xi", &state, &action);
4332     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4333     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4334     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4335
4336     state = 0xdeadbee;
4337     action = 0xdeadbee;
4338     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4339     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4340     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4341     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4342
4343     state = 0xdeadbee;
4344     action = 0xdeadbee;
4345     r = MsiGetComponentState(hpkg, "pi", &state, &action);
4346     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4347     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4348     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4349
4350     state = 0xdeadbee;
4351     action = 0xdeadbee;
4352     r = MsiGetComponentState(hpkg, "rho", &state, &action);
4353     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4354     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4355     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4356
4357     state = 0xdeadbee;
4358     action = 0xdeadbee;
4359     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4360     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4361     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4362     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4363
4364     state = 0xdeadbee;
4365     action = 0xdeadbee;
4366     r = MsiGetComponentState(hpkg, "tau", &state, &action);
4367     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4368     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4369     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4370
4371     state = 0xdeadbee;
4372     action = 0xdeadbee;
4373     r = MsiGetComponentState(hpkg, "phi", &state, &action);
4374     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4375     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4376     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4377
4378     state = 0xdeadbee;
4379     action = 0xdeadbee;
4380     r = MsiGetComponentState(hpkg, "chi", &state, &action);
4381     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4382     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4383     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4384
4385     r = MsiDoAction( hpkg, "CostFinalize");
4386     ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
4387
4388     state = 0xdeadbee;
4389     action = 0xdeadbee;
4390     r = MsiGetFeatureState(hpkg, "one", &state, &action);
4391     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4392     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4393     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4394
4395     state = 0xdeadbee;
4396     action = 0xdeadbee;
4397     r = MsiGetFeatureState(hpkg, "two", &state, &action);
4398     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4399     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4400     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4401
4402     state = 0xdeadbee;
4403     action = 0xdeadbee;
4404     r = MsiGetFeatureState(hpkg, "three", &state, &action);
4405     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4406     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4407     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4408
4409     state = 0xdeadbee;
4410     action = 0xdeadbee;
4411     r = MsiGetFeatureState(hpkg, "four", &state, &action);
4412     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4413     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4414     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4415
4416     state = 0xdeadbee;
4417     action = 0xdeadbee;
4418     r = MsiGetFeatureState(hpkg, "five", &state, &action);
4419     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4420     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4421     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4422
4423     state = 0xdeadbee;
4424     action = 0xdeadbee;
4425     r = MsiGetFeatureState(hpkg, "six", &state, &action);
4426     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4427     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4428     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4429
4430     state = 0xdeadbee;
4431     action = 0xdeadbee;
4432     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4433     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4434     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4435     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4436
4437     state = 0xdeadbee;
4438     action = 0xdeadbee;
4439     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4440     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4441     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4442     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4443
4444     state = 0xdeadbee;
4445     action = 0xdeadbee;
4446     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4447     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4448     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4449     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4450
4451     state = 0xdeadbee;
4452     action = 0xdeadbee;
4453     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4454     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4455     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4456     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4457
4458     state = 0xdeadbee;
4459     action = 0xdeadbee;
4460     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4461     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4462     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4463     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4464
4465     state = 0xdeadbee;
4466     action = 0xdeadbee;
4467     r = MsiGetComponentState(hpkg, "beta", &state, &action);
4468     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4469     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4470     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4471
4472     state = 0xdeadbee;
4473     action = 0xdeadbee;
4474     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4475     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4476     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4477     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4478
4479     state = 0xdeadbee;
4480     action = 0xdeadbee;
4481     r = MsiGetComponentState(hpkg, "theta", &state, &action);
4482     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4483     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4484     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4485
4486     state = 0xdeadbee;
4487     action = 0xdeadbee;
4488     r = MsiGetComponentState(hpkg, "delta", &state, &action);
4489     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4490     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4491     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4492
4493     state = 0xdeadbee;
4494     action = 0xdeadbee;
4495     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4496     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4497     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4498     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4499
4500     state = 0xdeadbee;
4501     action = 0xdeadbee;
4502     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4503     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4504     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4505     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4506
4507     state = 0xdeadbee;
4508     action = 0xdeadbee;
4509     r = MsiGetComponentState(hpkg, "iota", &state, &action);
4510     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4511     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4512     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4513
4514     state = 0xdeadbee;
4515     action = 0xdeadbee;
4516     r = MsiGetComponentState(hpkg, "eta", &state, &action);
4517     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4518     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4519     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4520
4521     state = 0xdeadbee;
4522     action = 0xdeadbee;
4523     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4524     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4525     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4526     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4527
4528     state = 0xdeadbee;
4529     action = 0xdeadbee;
4530     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4531     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4532     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4533     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4534
4535     state = 0xdeadbee;
4536     action = 0xdeadbee;
4537     r = MsiGetComponentState(hpkg, "mu", &state, &action);
4538     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4539     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4540     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4541
4542     state = 0xdeadbee;
4543     action = 0xdeadbee;
4544     r = MsiGetComponentState(hpkg, "nu", &state, &action);
4545     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4546     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4547     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4548
4549     state = 0xdeadbee;
4550     action = 0xdeadbee;
4551     r = MsiGetComponentState(hpkg, "xi", &state, &action);
4552     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4553     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4554     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4555
4556     state = 0xdeadbee;
4557     action = 0xdeadbee;
4558     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4559     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4560     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4561     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4562
4563     state = 0xdeadbee;
4564     action = 0xdeadbee;
4565     r = MsiGetComponentState(hpkg, "pi", &state, &action);
4566     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4567     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4568     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4569
4570     state = 0xdeadbee;
4571     action = 0xdeadbee;
4572     r = MsiGetComponentState(hpkg, "rho", &state, &action);
4573     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4574     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4575     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4576
4577     state = 0xdeadbee;
4578     action = 0xdeadbee;
4579     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4580     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4581     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4582     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4583
4584     state = 0xdeadbee;
4585     action = 0xdeadbee;
4586     r = MsiGetComponentState(hpkg, "tau", &state, &action);
4587     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4588     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4589     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4590
4591     state = 0xdeadbee;
4592     action = 0xdeadbee;
4593     r = MsiGetComponentState(hpkg, "phi", &state, &action);
4594     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4595     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4596     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4597
4598     state = 0xdeadbee;
4599     action = 0xdeadbee;
4600     r = MsiGetComponentState(hpkg, "chi", &state, &action);
4601     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4602     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4603     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4604
4605     MsiCloseHandle(hpkg);
4606
4607     /* uninstall the product */
4608     r = MsiInstallProduct(msifile, "REMOVE=ALL");
4609     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4610
4611     /* all features installed locally */
4612     r = MsiInstallProduct(msifile2, "ADDLOCAL=ALL");
4613     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4614
4615     r = MsiOpenDatabase(msifile2, MSIDBOPEN_DIRECT, &hdb);
4616     ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
4617
4618     /* these properties must not be in the saved msi file */
4619     r = add_property_entry( hdb, "'ADDLOCAL', 'one,two,three,four,five,six,seven,eight,nine,ten'");
4620     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
4621
4622     r = package_from_db( hdb, &hpkg );
4623     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
4624
4625     state = 0xdeadbee;
4626     action = 0xdeadbee;
4627     r = MsiGetFeatureState(hpkg, "one", &state, &action);
4628     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4629     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4630     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4631
4632     state = 0xdeadbee;
4633     action = 0xdeadbee;
4634     r = MsiGetFeatureState(hpkg, "two", &state, &action);
4635     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4636     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4637     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4638
4639     state = 0xdeadbee;
4640     action = 0xdeadbee;
4641     r = MsiGetFeatureState(hpkg, "three", &state, &action);
4642     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4643     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4644     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4645
4646     state = 0xdeadbee;
4647     action = 0xdeadbee;
4648     r = MsiGetFeatureState(hpkg, "four", &state, &action);
4649     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4650     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4651     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4652
4653     state = 0xdeadbee;
4654     action = 0xdeadbee;
4655     r = MsiGetFeatureState(hpkg, "five", &state, &action);
4656     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4657     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4658     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4659
4660     state = 0xdeadbee;
4661     action = 0xdeadbee;
4662     r = MsiGetFeatureState(hpkg, "six", &state, &action);
4663     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4664     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4665     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4666
4667     state = 0xdeadbee;
4668     action = 0xdeadbee;
4669     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4670     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4671     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4672     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4673
4674     state = 0xdeadbee;
4675     action = 0xdeadbee;
4676     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4677     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4678     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4679     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4680
4681     state = 0xdeadbee;
4682     action = 0xdeadbee;
4683     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4684     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4685     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4686     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4687
4688     state = 0xdeadbee;
4689     action = 0xdeadbee;
4690     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4691     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4692     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4693     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4694
4695     state = 0xdeadbee;
4696     action = 0xdeadbee;
4697     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4698     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4699     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4700     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4701
4702     state = 0xdeadbee;
4703     action = 0xdeadbee;
4704     r = MsiGetComponentState(hpkg, "beta", &state, &action);
4705     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4706     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4707     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4708
4709     state = 0xdeadbee;
4710     action = 0xdeadbee;
4711     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4712     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4713     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4714     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4715
4716     state = 0xdeadbee;
4717     action = 0xdeadbee;
4718     r = MsiGetComponentState(hpkg, "theta", &state, &action);
4719     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4720     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4721     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4722
4723     state = 0xdeadbee;
4724     action = 0xdeadbee;
4725     r = MsiGetComponentState(hpkg, "delta", &state, &action);
4726     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4727     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4728     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4729
4730     state = 0xdeadbee;
4731     action = 0xdeadbee;
4732     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4733     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4734     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4735     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4736
4737     state = 0xdeadbee;
4738     action = 0xdeadbee;
4739     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4740     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4741     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4742     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4743
4744     state = 0xdeadbee;
4745     action = 0xdeadbee;
4746     r = MsiGetComponentState(hpkg, "iota", &state, &action);
4747     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4748     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4749     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4750
4751     state = 0xdeadbee;
4752     action = 0xdeadbee;
4753     r = MsiGetComponentState(hpkg, "eta", &state, &action);
4754     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4755     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4756     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4757
4758     state = 0xdeadbee;
4759     action = 0xdeadbee;
4760     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4761     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4762     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4763     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4764
4765     state = 0xdeadbee;
4766     action = 0xdeadbee;
4767     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4768     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4769     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4770     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4771
4772     state = 0xdeadbee;
4773     action = 0xdeadbee;
4774     r = MsiGetComponentState(hpkg, "mu", &state, &action);
4775     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4776     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4777     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4778
4779     state = 0xdeadbee;
4780     action = 0xdeadbee;
4781     r = MsiGetComponentState(hpkg, "nu", &state, &action);
4782     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4783     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4784     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4785
4786     state = 0xdeadbee;
4787     action = 0xdeadbee;
4788     r = MsiGetComponentState(hpkg, "xi", &state, &action);
4789     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4790     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4791     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4792
4793     state = 0xdeadbee;
4794     action = 0xdeadbee;
4795     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4796     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4797     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4798     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4799
4800     state = 0xdeadbee;
4801     action = 0xdeadbee;
4802     r = MsiGetComponentState(hpkg, "pi", &state, &action);
4803     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4804     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4805     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4806
4807     state = 0xdeadbee;
4808     action = 0xdeadbee;
4809     r = MsiGetComponentState(hpkg, "rho", &state, &action);
4810     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4811     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4812     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4813
4814     state = 0xdeadbee;
4815     action = 0xdeadbee;
4816     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4817     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4818     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4819     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4820
4821     state = 0xdeadbee;
4822     action = 0xdeadbee;
4823     r = MsiGetComponentState(hpkg, "tau", &state, &action);
4824     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4825     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4826     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4827
4828     state = 0xdeadbee;
4829     action = 0xdeadbee;
4830     r = MsiGetComponentState(hpkg, "phi", &state, &action);
4831     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4832     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4833     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4834
4835     state = 0xdeadbee;
4836     action = 0xdeadbee;
4837     r = MsiGetComponentState(hpkg, "chi", &state, &action);
4838     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4839     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4840     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4841
4842     r = MsiDoAction( hpkg, "CostInitialize");
4843     ok( r == ERROR_SUCCESS, "cost init failed\n");
4844
4845     state = 0xdeadbee;
4846     action = 0xdeadbee;
4847     r = MsiGetFeatureState(hpkg, "one", &state, &action);
4848     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4849     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4850     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4851
4852     state = 0xdeadbee;
4853     action = 0xdeadbee;
4854     r = MsiGetFeatureState(hpkg, "two", &state, &action);
4855     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4856     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4857     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4858
4859     state = 0xdeadbee;
4860     action = 0xdeadbee;
4861     r = MsiGetFeatureState(hpkg, "three", &state, &action);
4862     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4863     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4864     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4865
4866     state = 0xdeadbee;
4867     action = 0xdeadbee;
4868     r = MsiGetFeatureState(hpkg, "four", &state, &action);
4869     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4870     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4871     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4872
4873     state = 0xdeadbee;
4874     action = 0xdeadbee;
4875     r = MsiGetFeatureState(hpkg, "five", &state, &action);
4876     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4877     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4878     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4879
4880     state = 0xdeadbee;
4881     action = 0xdeadbee;
4882     r = MsiGetFeatureState(hpkg, "six", &state, &action);
4883     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4884     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4885     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4886
4887     state = 0xdeadbee;
4888     action = 0xdeadbee;
4889     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4890     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4891     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4892     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4893
4894     state = 0xdeadbee;
4895     action = 0xdeadbee;
4896     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4897     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4898     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4899     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4900
4901     state = 0xdeadbee;
4902     action = 0xdeadbee;
4903     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4904     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4905     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4906     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4907
4908     state = 0xdeadbee;
4909     action = 0xdeadbee;
4910     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4911     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4912     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4913     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4914
4915     state = 0xdeadbee;
4916     action = 0xdeadbee;
4917     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4918     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4919     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4920     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4921
4922     state = 0xdeadbee;
4923     action = 0xdeadbee;
4924     r = MsiGetComponentState(hpkg, "beta", &state, &action);
4925     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4926     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4927     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4928
4929     state = 0xdeadbee;
4930     action = 0xdeadbee;
4931     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4932     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4933     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4934     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4935
4936     state = 0xdeadbee;
4937     action = 0xdeadbee;
4938     r = MsiGetComponentState(hpkg, "theta", &state, &action);
4939     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4940     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4941     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4942
4943     state = 0xdeadbee;
4944     action = 0xdeadbee;
4945     r = MsiGetComponentState(hpkg, "delta", &state, &action);
4946     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4947     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4948     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4949
4950     state = 0xdeadbee;
4951     action = 0xdeadbee;
4952     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4953     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4954     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4955     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4956
4957     state = 0xdeadbee;
4958     action = 0xdeadbee;
4959     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4960     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4961     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4962     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4963
4964     state = 0xdeadbee;
4965     action = 0xdeadbee;
4966     r = MsiGetComponentState(hpkg, "iota", &state, &action);
4967     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4968     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4969     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4970
4971     state = 0xdeadbee;
4972     action = 0xdeadbee;
4973     r = MsiGetComponentState(hpkg, "eta", &state, &action);
4974     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4975     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4976     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4977
4978     state = 0xdeadbee;
4979     action = 0xdeadbee;
4980     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4981     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4982     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4983     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4984
4985     state = 0xdeadbee;
4986     action = 0xdeadbee;
4987     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4988     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4989     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4990     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4991
4992     state = 0xdeadbee;
4993     action = 0xdeadbee;
4994     r = MsiGetComponentState(hpkg, "mu", &state, &action);
4995     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4996     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4997     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4998
4999     state = 0xdeadbee;
5000     action = 0xdeadbee;
5001     r = MsiGetComponentState(hpkg, "nu", &state, &action);
5002     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5003     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5004     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5005
5006     state = 0xdeadbee;
5007     action = 0xdeadbee;
5008     r = MsiGetComponentState(hpkg, "xi", &state, &action);
5009     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5010     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5011     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5012
5013     state = 0xdeadbee;
5014     action = 0xdeadbee;
5015     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5016     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5017     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5018     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5019
5020     state = 0xdeadbee;
5021     action = 0xdeadbee;
5022     r = MsiGetComponentState(hpkg, "pi", &state, &action);
5023     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5024     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5025     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5026
5027     state = 0xdeadbee;
5028     action = 0xdeadbee;
5029     r = MsiGetComponentState(hpkg, "rho", &state, &action);
5030     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5031     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5032     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5033
5034     state = 0xdeadbee;
5035     action = 0xdeadbee;
5036     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5037     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5038     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5039     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5040
5041     state = 0xdeadbee;
5042     action = 0xdeadbee;
5043     r = MsiGetComponentState(hpkg, "tau", &state, &action);
5044     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5045     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5046     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5047
5048     state = 0xdeadbee;
5049     action = 0xdeadbee;
5050     r = MsiGetComponentState(hpkg, "phi", &state, &action);
5051     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5052     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5053     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5054
5055     state = 0xdeadbee;
5056     action = 0xdeadbee;
5057     r = MsiGetComponentState(hpkg, "chi", &state, &action);
5058     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5059     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5060     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5061
5062     r = MsiDoAction( hpkg, "FileCost");
5063     ok( r == ERROR_SUCCESS, "file cost failed\n");
5064
5065     state = 0xdeadbee;
5066     action = 0xdeadbee;
5067     r = MsiGetFeatureState(hpkg, "one", &state, &action);
5068     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5069     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5070     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5071
5072     state = 0xdeadbee;
5073     action = 0xdeadbee;
5074     r = MsiGetFeatureState(hpkg, "two", &state, &action);
5075     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5076     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5077     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5078
5079     state = 0xdeadbee;
5080     action = 0xdeadbee;
5081     r = MsiGetFeatureState(hpkg, "three", &state, &action);
5082     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5083     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5084     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5085
5086     state = 0xdeadbee;
5087     action = 0xdeadbee;
5088     r = MsiGetFeatureState(hpkg, "four", &state, &action);
5089     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5090     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5091     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5092
5093     state = 0xdeadbee;
5094     action = 0xdeadbee;
5095     r = MsiGetFeatureState(hpkg, "five", &state, &action);
5096     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5097     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5098     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5099
5100     state = 0xdeadbee;
5101     action = 0xdeadbee;
5102     r = MsiGetFeatureState(hpkg, "six", &state, &action);
5103     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5104     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5105     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5106
5107     state = 0xdeadbee;
5108     action = 0xdeadbee;
5109     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5110     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5111     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5112     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5113
5114     state = 0xdeadbee;
5115     action = 0xdeadbee;
5116     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5117     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5118     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5119     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5120
5121     state = 0xdeadbee;
5122     action = 0xdeadbee;
5123     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5124     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5125     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5126     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5127
5128     state = 0xdeadbee;
5129     action = 0xdeadbee;
5130     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5131     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5132     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5133     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5134
5135     state = 0xdeadbee;
5136     action = 0xdeadbee;
5137     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5138     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5139     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5140     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5141
5142     state = 0xdeadbee;
5143     action = 0xdeadbee;
5144     r = MsiGetComponentState(hpkg, "beta", &state, &action);
5145     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5146     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5147     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5148
5149     state = 0xdeadbee;
5150     action = 0xdeadbee;
5151     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5152     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5153     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5154     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5155
5156     state = 0xdeadbee;
5157     action = 0xdeadbee;
5158     r = MsiGetComponentState(hpkg, "theta", &state, &action);
5159     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5160     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5161     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5162
5163     state = 0xdeadbee;
5164     action = 0xdeadbee;
5165     r = MsiGetComponentState(hpkg, "delta", &state, &action);
5166     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5167     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5168     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5169
5170     state = 0xdeadbee;
5171     action = 0xdeadbee;
5172     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5173     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5174     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5175     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5176
5177     state = 0xdeadbee;
5178     action = 0xdeadbee;
5179     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5180     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5181     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5182     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5183
5184     state = 0xdeadbee;
5185     action = 0xdeadbee;
5186     r = MsiGetComponentState(hpkg, "iota", &state, &action);
5187     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5188     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5189     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5190
5191     state = 0xdeadbee;
5192     action = 0xdeadbee;
5193     r = MsiGetComponentState(hpkg, "eta", &state, &action);
5194     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5195     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5196     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5197
5198     state = 0xdeadbee;
5199     action = 0xdeadbee;
5200     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5201     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5202     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5203     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5204
5205     state = 0xdeadbee;
5206     action = 0xdeadbee;
5207     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5208     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5209     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5210     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5211
5212     state = 0xdeadbee;
5213     action = 0xdeadbee;
5214     r = MsiGetComponentState(hpkg, "mu", &state, &action);
5215     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5216     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5217     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5218
5219     state = 0xdeadbee;
5220     action = 0xdeadbee;
5221     r = MsiGetComponentState(hpkg, "nu", &state, &action);
5222     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5223     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5224     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5225
5226     state = 0xdeadbee;
5227     action = 0xdeadbee;
5228     r = MsiGetComponentState(hpkg, "xi", &state, &action);
5229     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5230     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5231     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5232
5233     state = 0xdeadbee;
5234     action = 0xdeadbee;
5235     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5236     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5237     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5238     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5239
5240     state = 0xdeadbee;
5241     action = 0xdeadbee;
5242     r = MsiGetComponentState(hpkg, "pi", &state, &action);
5243     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5244     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5245     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5246
5247     state = 0xdeadbee;
5248     action = 0xdeadbee;
5249     r = MsiGetComponentState(hpkg, "rho", &state, &action);
5250     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5251     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5252     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5253
5254     state = 0xdeadbee;
5255     action = 0xdeadbee;
5256     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5257     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5258     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5259     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5260
5261     state = 0xdeadbee;
5262     action = 0xdeadbee;
5263     r = MsiGetComponentState(hpkg, "tau", &state, &action);
5264     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5265     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5266     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5267
5268     state = 0xdeadbee;
5269     action = 0xdeadbee;
5270     r = MsiGetComponentState(hpkg, "phi", &state, &action);
5271     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5272     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5273     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5274
5275     state = 0xdeadbee;
5276     action = 0xdeadbee;
5277     r = MsiGetComponentState(hpkg, "chi", &state, &action);
5278     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5279     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5280     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5281
5282     r = MsiDoAction( hpkg, "CostFinalize");
5283     ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
5284
5285     state = 0xdeadbee;
5286     action = 0xdeadbee;
5287     r = MsiGetFeatureState(hpkg, "one", &state, &action);
5288     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5289     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5290     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5291
5292     state = 0xdeadbee;
5293     action = 0xdeadbee;
5294     r = MsiGetFeatureState(hpkg, "two", &state, &action);
5295     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5296     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5297     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5298
5299     state = 0xdeadbee;
5300     action = 0xdeadbee;
5301     r = MsiGetFeatureState(hpkg, "three", &state, &action);
5302     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5303     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5304     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5305
5306     state = 0xdeadbee;
5307     action = 0xdeadbee;
5308     r = MsiGetFeatureState(hpkg, "four", &state, &action);
5309     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5310     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5311     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5312
5313     state = 0xdeadbee;
5314     action = 0xdeadbee;
5315     r = MsiGetFeatureState(hpkg, "five", &state, &action);
5316     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5317     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5318     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5319
5320     state = 0xdeadbee;
5321     action = 0xdeadbee;
5322     r = MsiGetFeatureState(hpkg, "six", &state, &action);
5323     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5324     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5325     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5326
5327     state = 0xdeadbee;
5328     action = 0xdeadbee;
5329     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5330     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5331     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5332     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5333
5334     state = 0xdeadbee;
5335     action = 0xdeadbee;
5336     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5337     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5338     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5339     todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5340
5341     state = 0xdeadbee;
5342     action = 0xdeadbee;
5343     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5344     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5345     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5346     todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5347
5348     state = 0xdeadbee;
5349     action = 0xdeadbee;
5350     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5351     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5352     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5353     todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5354
5355     state = 0xdeadbee;
5356     action = 0xdeadbee;
5357     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5358     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5359     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5360     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5361
5362     state = 0xdeadbee;
5363     action = 0xdeadbee;
5364     r = MsiGetComponentState(hpkg, "beta", &state, &action);
5365     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5366     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5367     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5368
5369     state = 0xdeadbee;
5370     action = 0xdeadbee;
5371     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5372     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5373     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5374     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5375
5376     state = 0xdeadbee;
5377     action = 0xdeadbee;
5378     r = MsiGetComponentState(hpkg, "theta", &state, &action);
5379     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5380     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5381     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5382
5383     state = 0xdeadbee;
5384     action = 0xdeadbee;
5385     r = MsiGetComponentState(hpkg, "delta", &state, &action);
5386     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5387     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5388     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5389
5390     state = 0xdeadbee;
5391     action = 0xdeadbee;
5392     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5393     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5394     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5395     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5396
5397     state = 0xdeadbee;
5398     action = 0xdeadbee;
5399     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5400     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5401     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5402     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5403
5404     state = 0xdeadbee;
5405     action = 0xdeadbee;
5406     r = MsiGetComponentState(hpkg, "iota", &state, &action);
5407     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5408     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5409     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5410
5411     state = 0xdeadbee;
5412     action = 0xdeadbee;
5413     r = MsiGetComponentState(hpkg, "eta", &state, &action);
5414     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5415     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5416     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5417
5418     state = 0xdeadbee;
5419     action = 0xdeadbee;
5420     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5421     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5422     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5423     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5424
5425     state = 0xdeadbee;
5426     action = 0xdeadbee;
5427     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5428     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5429     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5430     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5431
5432     state = 0xdeadbee;
5433     action = 0xdeadbee;
5434     r = MsiGetComponentState(hpkg, "mu", &state, &action);
5435     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5436     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5437     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5438
5439     state = 0xdeadbee;
5440     action = 0xdeadbee;
5441     r = MsiGetComponentState(hpkg, "nu", &state, &action);
5442     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5443     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5444     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5445
5446     state = 0xdeadbee;
5447     action = 0xdeadbee;
5448     r = MsiGetComponentState(hpkg, "xi", &state, &action);
5449     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5450     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5451     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5452
5453     state = 0xdeadbee;
5454     action = 0xdeadbee;
5455     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5456     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5457     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5458     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5459
5460     state = 0xdeadbee;
5461     action = 0xdeadbee;
5462     r = MsiGetComponentState(hpkg, "pi", &state, &action);
5463     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5464     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5465     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5466
5467     state = 0xdeadbee;
5468     action = 0xdeadbee;
5469     r = MsiGetComponentState(hpkg, "rho", &state, &action);
5470     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5471     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5472     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5473
5474     state = 0xdeadbee;
5475     action = 0xdeadbee;
5476     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5477     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5478     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5479     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5480
5481     state = 0xdeadbee;
5482     action = 0xdeadbee;
5483     r = MsiGetComponentState(hpkg, "tau", &state, &action);
5484     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5485     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5486     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5487
5488     state = 0xdeadbee;
5489     action = 0xdeadbee;
5490     r = MsiGetComponentState(hpkg, "phi", &state, &action);
5491     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5492     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5493     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5494
5495     state = 0xdeadbee;
5496     action = 0xdeadbee;
5497     r = MsiGetComponentState(hpkg, "chi", &state, &action);
5498     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5499     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5500     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5501
5502     MsiCloseHandle(hpkg);
5503
5504     /* uninstall the product */
5505     r = MsiInstallProduct(msifile2, "REMOVE=ALL");
5506     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5507
5508     /* all features installed from source */
5509     r = MsiInstallProduct(msifile3, "ADDSOURCE=ALL");
5510     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5511
5512     r = MsiOpenDatabase(msifile3, MSIDBOPEN_DIRECT, &hdb);
5513     ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
5514
5515     /* this property must not be in the saved msi file */
5516     r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
5517     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
5518
5519     r = package_from_db( hdb, &hpkg );
5520     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
5521
5522     state = 0xdeadbee;
5523     action = 0xdeadbee;
5524     r = MsiGetFeatureState(hpkg, "one", &state, &action);
5525     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5526     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5527     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5528
5529     state = 0xdeadbee;
5530     action = 0xdeadbee;
5531     r = MsiGetFeatureState(hpkg, "two", &state, &action);
5532     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5533     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5534     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5535
5536     state = 0xdeadbee;
5537     action = 0xdeadbee;
5538     r = MsiGetFeatureState(hpkg, "three", &state, &action);
5539     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5540     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5541     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5542
5543     state = 0xdeadbee;
5544     action = 0xdeadbee;
5545     r = MsiGetFeatureState(hpkg, "four", &state, &action);
5546     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5547     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5548     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5549
5550     state = 0xdeadbee;
5551     action = 0xdeadbee;
5552     r = MsiGetFeatureState(hpkg, "five", &state, &action);
5553     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5554     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5555     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5556
5557     state = 0xdeadbee;
5558     action = 0xdeadbee;
5559     r = MsiGetFeatureState(hpkg, "six", &state, &action);
5560     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5561     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5562     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5563
5564     state = 0xdeadbee;
5565     action = 0xdeadbee;
5566     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5567     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5568     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5569     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5570
5571     state = 0xdeadbee;
5572     action = 0xdeadbee;
5573     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5574     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5575     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5576     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5577
5578     state = 0xdeadbee;
5579     action = 0xdeadbee;
5580     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5581     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5582     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5583     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5584
5585     state = 0xdeadbee;
5586     action = 0xdeadbee;
5587     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5588     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5589     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5590     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5591
5592     state = 0xdeadbee;
5593     action = 0xdeadbee;
5594     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5595     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5596     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5597     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5598
5599     state = 0xdeadbee;
5600     action = 0xdeadbee;
5601     r = MsiGetComponentState(hpkg, "beta", &state, &action);
5602     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5603     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5604     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5605
5606     state = 0xdeadbee;
5607     action = 0xdeadbee;
5608     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5609     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5610     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5611     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5612
5613     state = 0xdeadbee;
5614     action = 0xdeadbee;
5615     r = MsiGetComponentState(hpkg, "theta", &state, &action);
5616     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5617     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5618     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5619
5620     state = 0xdeadbee;
5621     action = 0xdeadbee;
5622     r = MsiGetComponentState(hpkg, "delta", &state, &action);
5623     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5624     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5625     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5626
5627     state = 0xdeadbee;
5628     action = 0xdeadbee;
5629     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5630     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5631     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5632     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5633
5634     state = 0xdeadbee;
5635     action = 0xdeadbee;
5636     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5637     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5638     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5639     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5640
5641     state = 0xdeadbee;
5642     action = 0xdeadbee;
5643     r = MsiGetComponentState(hpkg, "iota", &state, &action);
5644     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5645     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5646     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5647
5648     state = 0xdeadbee;
5649     action = 0xdeadbee;
5650     r = MsiGetComponentState(hpkg, "eta", &state, &action);
5651     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5652     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5653     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5654
5655     state = 0xdeadbee;
5656     action = 0xdeadbee;
5657     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5658     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5659     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5660     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5661
5662     state = 0xdeadbee;
5663     action = 0xdeadbee;
5664     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5665     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5666     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5667     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5668
5669     state = 0xdeadbee;
5670     action = 0xdeadbee;
5671     r = MsiGetComponentState(hpkg, "mu", &state, &action);
5672     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5673     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5674     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5675
5676     state = 0xdeadbee;
5677     action = 0xdeadbee;
5678     r = MsiGetComponentState(hpkg, "nu", &state, &action);
5679     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5680     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5681     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5682
5683     state = 0xdeadbee;
5684     action = 0xdeadbee;
5685     r = MsiGetComponentState(hpkg, "xi", &state, &action);
5686     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5687     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5688     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5689
5690     state = 0xdeadbee;
5691     action = 0xdeadbee;
5692     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5693     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5694     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5695     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5696
5697     state = 0xdeadbee;
5698     action = 0xdeadbee;
5699     r = MsiGetComponentState(hpkg, "pi", &state, &action);
5700     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5701     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5702     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5703
5704     state = 0xdeadbee;
5705     action = 0xdeadbee;
5706     r = MsiGetComponentState(hpkg, "rho", &state, &action);
5707     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5708     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5709     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5710
5711     state = 0xdeadbee;
5712     action = 0xdeadbee;
5713     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5714     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5715     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5716     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5717
5718     state = 0xdeadbee;
5719     action = 0xdeadbee;
5720     r = MsiGetComponentState(hpkg, "tau", &state, &action);
5721     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5722     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5723     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5724
5725     state = 0xdeadbee;
5726     action = 0xdeadbee;
5727     r = MsiGetComponentState(hpkg, "phi", &state, &action);
5728     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5729     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5730     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5731
5732     state = 0xdeadbee;
5733     action = 0xdeadbee;
5734     r = MsiGetComponentState(hpkg, "chi", &state, &action);
5735     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5736     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5737     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5738
5739     r = MsiDoAction( hpkg, "CostInitialize");
5740     ok( r == ERROR_SUCCESS, "cost init failed\n");
5741
5742     state = 0xdeadbee;
5743     action = 0xdeadbee;
5744     r = MsiGetFeatureState(hpkg, "one", &state, &action);
5745     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5746     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5747     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5748
5749     state = 0xdeadbee;
5750     action = 0xdeadbee;
5751     r = MsiGetFeatureState(hpkg, "two", &state, &action);
5752     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5753     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5754     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5755
5756     state = 0xdeadbee;
5757     action = 0xdeadbee;
5758     r = MsiGetFeatureState(hpkg, "three", &state, &action);
5759     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5760     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5761     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5762
5763     state = 0xdeadbee;
5764     action = 0xdeadbee;
5765     r = MsiGetFeatureState(hpkg, "four", &state, &action);
5766     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5767     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5768     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5769
5770     state = 0xdeadbee;
5771     action = 0xdeadbee;
5772     r = MsiGetFeatureState(hpkg, "five", &state, &action);
5773     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5774     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5775     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5776
5777     state = 0xdeadbee;
5778     action = 0xdeadbee;
5779     r = MsiGetFeatureState(hpkg, "six", &state, &action);
5780     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5781     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5782     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5783
5784     state = 0xdeadbee;
5785     action = 0xdeadbee;
5786     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5787     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5788     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5789     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5790
5791     state = 0xdeadbee;
5792     action = 0xdeadbee;
5793     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5794     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5795     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5796     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5797
5798     state = 0xdeadbee;
5799     action = 0xdeadbee;
5800     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5801     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5802     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5803     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5804
5805     state = 0xdeadbee;
5806     action = 0xdeadbee;
5807     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5808     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5809     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5810     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5811
5812     state = 0xdeadbee;
5813     action = 0xdeadbee;
5814     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5815     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5816     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5817     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5818
5819     state = 0xdeadbee;
5820     action = 0xdeadbee;
5821     r = MsiGetComponentState(hpkg, "beta", &state, &action);
5822     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5823     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5824     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5825
5826     state = 0xdeadbee;
5827     action = 0xdeadbee;
5828     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5829     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5830     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5831     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5832
5833     state = 0xdeadbee;
5834     action = 0xdeadbee;
5835     r = MsiGetComponentState(hpkg, "theta", &state, &action);
5836     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5837     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5838     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5839
5840     state = 0xdeadbee;
5841     action = 0xdeadbee;
5842     r = MsiGetComponentState(hpkg, "delta", &state, &action);
5843     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5844     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5845     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5846
5847     state = 0xdeadbee;
5848     action = 0xdeadbee;
5849     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5850     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5851     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5852     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5853
5854     state = 0xdeadbee;
5855     action = 0xdeadbee;
5856     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5857     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5858     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5859     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5860
5861     state = 0xdeadbee;
5862     action = 0xdeadbee;
5863     r = MsiGetComponentState(hpkg, "iota", &state, &action);
5864     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5865     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5866     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5867
5868     state = 0xdeadbee;
5869     action = 0xdeadbee;
5870     r = MsiGetComponentState(hpkg, "eta", &state, &action);
5871     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5872     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5873     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5874
5875     state = 0xdeadbee;
5876     action = 0xdeadbee;
5877     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5878     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5879     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5880     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5881
5882     state = 0xdeadbee;
5883     action = 0xdeadbee;
5884     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5885     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5886     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5887     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5888
5889     state = 0xdeadbee;
5890     action = 0xdeadbee;
5891     r = MsiGetComponentState(hpkg, "mu", &state, &action);
5892     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5893     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5894     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5895
5896     state = 0xdeadbee;
5897     action = 0xdeadbee;
5898     r = MsiGetComponentState(hpkg, "nu", &state, &action);
5899     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5900     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5901     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5902
5903     state = 0xdeadbee;
5904     action = 0xdeadbee;
5905     r = MsiGetComponentState(hpkg, "xi", &state, &action);
5906     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5907     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5908     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5909
5910     state = 0xdeadbee;
5911     action = 0xdeadbee;
5912     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5913     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5914     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5915     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5916
5917     state = 0xdeadbee;
5918     action = 0xdeadbee;
5919     r = MsiGetComponentState(hpkg, "pi", &state, &action);
5920     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5921     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5922     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5923
5924     state = 0xdeadbee;
5925     action = 0xdeadbee;
5926     r = MsiGetComponentState(hpkg, "rho", &state, &action);
5927     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5928     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5929     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5930
5931     state = 0xdeadbee;
5932     action = 0xdeadbee;
5933     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5934     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5935     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5936     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5937
5938     state = 0xdeadbee;
5939     action = 0xdeadbee;
5940     r = MsiGetComponentState(hpkg, "tau", &state, &action);
5941     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5942     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5943     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5944
5945     state = 0xdeadbee;
5946     action = 0xdeadbee;
5947     r = MsiGetComponentState(hpkg, "phi", &state, &action);
5948     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5949     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5950     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5951
5952     state = 0xdeadbee;
5953     action = 0xdeadbee;
5954     r = MsiGetComponentState(hpkg, "chi", &state, &action);
5955     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5956     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5957     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5958
5959     r = MsiDoAction( hpkg, "FileCost");
5960     ok( r == ERROR_SUCCESS, "file cost failed\n");
5961
5962     state = 0xdeadbee;
5963     action = 0xdeadbee;
5964     r = MsiGetFeatureState(hpkg, "one", &state, &action);
5965     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5966     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5967     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5968
5969     state = 0xdeadbee;
5970     action = 0xdeadbee;
5971     r = MsiGetFeatureState(hpkg, "two", &state, &action);
5972     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5973     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5974     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5975
5976     state = 0xdeadbee;
5977     action = 0xdeadbee;
5978     r = MsiGetFeatureState(hpkg, "three", &state, &action);
5979     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5980     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5981     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5982
5983     state = 0xdeadbee;
5984     action = 0xdeadbee;
5985     r = MsiGetFeatureState(hpkg, "four", &state, &action);
5986     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5987     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5988     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5989
5990     state = 0xdeadbee;
5991     action = 0xdeadbee;
5992     r = MsiGetFeatureState(hpkg, "five", &state, &action);
5993     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5994     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5995     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5996
5997     state = 0xdeadbee;
5998     action = 0xdeadbee;
5999     r = MsiGetFeatureState(hpkg, "six", &state, &action);
6000     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6001     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6002     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6003
6004     state = 0xdeadbee;
6005     action = 0xdeadbee;
6006     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6007     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6008     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6009     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6010
6011     state = 0xdeadbee;
6012     action = 0xdeadbee;
6013     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6014     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6015     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6016     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6017
6018     state = 0xdeadbee;
6019     action = 0xdeadbee;
6020     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6021     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6022     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6023     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6024
6025     state = 0xdeadbee;
6026     action = 0xdeadbee;
6027     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6028     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6029     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6030     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6031
6032     state = 0xdeadbee;
6033     action = 0xdeadbee;
6034     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6035     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6036     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6037     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6038
6039     state = 0xdeadbee;
6040     action = 0xdeadbee;
6041     r = MsiGetComponentState(hpkg, "beta", &state, &action);
6042     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6043     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6044     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6045
6046     state = 0xdeadbee;
6047     action = 0xdeadbee;
6048     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6049     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6050     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6051     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6052
6053     state = 0xdeadbee;
6054     action = 0xdeadbee;
6055     r = MsiGetComponentState(hpkg, "theta", &state, &action);
6056     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6057     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6058     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6059
6060     state = 0xdeadbee;
6061     action = 0xdeadbee;
6062     r = MsiGetComponentState(hpkg, "delta", &state, &action);
6063     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6064     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6065     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6066
6067     state = 0xdeadbee;
6068     action = 0xdeadbee;
6069     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6070     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6071     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6072     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6073
6074     state = 0xdeadbee;
6075     action = 0xdeadbee;
6076     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6077     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6078     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6079     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6080
6081     state = 0xdeadbee;
6082     action = 0xdeadbee;
6083     r = MsiGetComponentState(hpkg, "iota", &state, &action);
6084     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6085     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6086     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6087
6088     state = 0xdeadbee;
6089     action = 0xdeadbee;
6090     r = MsiGetComponentState(hpkg, "eta", &state, &action);
6091     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6092     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6093     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6094
6095     state = 0xdeadbee;
6096     action = 0xdeadbee;
6097     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6098     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6099     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6100     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6101
6102     state = 0xdeadbee;
6103     action = 0xdeadbee;
6104     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6105     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6106     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6107     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6108
6109     state = 0xdeadbee;
6110     action = 0xdeadbee;
6111     r = MsiGetComponentState(hpkg, "mu", &state, &action);
6112     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6113     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6114     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6115
6116     state = 0xdeadbee;
6117     action = 0xdeadbee;
6118     r = MsiGetComponentState(hpkg, "nu", &state, &action);
6119     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6120     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6121     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6122
6123     state = 0xdeadbee;
6124     action = 0xdeadbee;
6125     r = MsiGetComponentState(hpkg, "xi", &state, &action);
6126     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6127     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6128     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6129
6130     state = 0xdeadbee;
6131     action = 0xdeadbee;
6132     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6133     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6134     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6135     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6136
6137     state = 0xdeadbee;
6138     action = 0xdeadbee;
6139     r = MsiGetComponentState(hpkg, "pi", &state, &action);
6140     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6141     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6142     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6143
6144     state = 0xdeadbee;
6145     action = 0xdeadbee;
6146     r = MsiGetComponentState(hpkg, "rho", &state, &action);
6147     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6148     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6149     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6150
6151     state = 0xdeadbee;
6152     action = 0xdeadbee;
6153     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6154     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6155     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6156     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6157
6158     state = 0xdeadbee;
6159     action = 0xdeadbee;
6160     r = MsiGetComponentState(hpkg, "tau", &state, &action);
6161     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6162     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6163     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6164
6165     state = 0xdeadbee;
6166     action = 0xdeadbee;
6167     r = MsiGetComponentState(hpkg, "phi", &state, &action);
6168     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6169     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6170     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6171
6172     state = 0xdeadbee;
6173     action = 0xdeadbee;
6174     r = MsiGetComponentState(hpkg, "chi", &state, &action);
6175     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6176     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6177     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6178
6179     r = MsiDoAction( hpkg, "CostFinalize");
6180     ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
6181
6182     state = 0xdeadbee;
6183     action = 0xdeadbee;
6184     r = MsiGetFeatureState(hpkg, "one", &state, &action);
6185     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6186     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6187     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6188
6189     state = 0xdeadbee;
6190     action = 0xdeadbee;
6191     r = MsiGetFeatureState(hpkg, "two", &state, &action);
6192     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6193     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6194     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6195
6196     state = 0xdeadbee;
6197     action = 0xdeadbee;
6198     r = MsiGetFeatureState(hpkg, "three", &state, &action);
6199     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6200     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6201     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6202
6203     state = 0xdeadbee;
6204     action = 0xdeadbee;
6205     r = MsiGetFeatureState(hpkg, "four", &state, &action);
6206     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6207     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6208     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6209
6210     state = 0xdeadbee;
6211     action = 0xdeadbee;
6212     r = MsiGetFeatureState(hpkg, "five", &state, &action);
6213     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6214     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6215     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6216
6217     state = 0xdeadbee;
6218     action = 0xdeadbee;
6219     r = MsiGetFeatureState(hpkg, "six", &state, &action);
6220     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6221     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6222     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6223
6224     state = 0xdeadbee;
6225     action = 0xdeadbee;
6226     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6227     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6228     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6229     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6230
6231     state = 0xdeadbee;
6232     action = 0xdeadbee;
6233     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6234     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6235     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6236     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6237
6238     state = 0xdeadbee;
6239     action = 0xdeadbee;
6240     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6241     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6242     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6243     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6244
6245     state = 0xdeadbee;
6246     action = 0xdeadbee;
6247     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6248     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6249     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6250     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6251
6252     state = 0xdeadbee;
6253     action = 0xdeadbee;
6254     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6255     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6256     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6257     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6258
6259     state = 0xdeadbee;
6260     action = 0xdeadbee;
6261     r = MsiGetComponentState(hpkg, "beta", &state, &action);
6262     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6263     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6264     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6265
6266     state = 0xdeadbee;
6267     action = 0xdeadbee;
6268     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6269     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6270     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6271     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6272
6273     state = 0xdeadbee;
6274     action = 0xdeadbee;
6275     r = MsiGetComponentState(hpkg, "theta", &state, &action);
6276     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6277     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6278     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6279
6280     state = 0xdeadbee;
6281     action = 0xdeadbee;
6282     r = MsiGetComponentState(hpkg, "delta", &state, &action);
6283     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6284     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6285     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6286
6287     state = 0xdeadbee;
6288     action = 0xdeadbee;
6289     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6290     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6291     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6292     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6293
6294     state = 0xdeadbee;
6295     action = 0xdeadbee;
6296     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6297     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6298     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6299     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6300
6301     state = 0xdeadbee;
6302     action = 0xdeadbee;
6303     r = MsiGetComponentState(hpkg, "iota", &state, &action);
6304     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6305     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6306     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6307
6308     state = 0xdeadbee;
6309     action = 0xdeadbee;
6310     r = MsiGetComponentState(hpkg, "eta", &state, &action);
6311     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6312     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6313     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6314
6315     state = 0xdeadbee;
6316     action = 0xdeadbee;
6317     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6318     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6319     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6320     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6321
6322     state = 0xdeadbee;
6323     action = 0xdeadbee;
6324     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6325     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6326     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6327     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6328
6329     state = 0xdeadbee;
6330     action = 0xdeadbee;
6331     r = MsiGetComponentState(hpkg, "mu", &state, &action);
6332     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6333     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6334     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6335
6336     state = 0xdeadbee;
6337     action = 0xdeadbee;
6338     r = MsiGetComponentState(hpkg, "nu", &state, &action);
6339     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6340     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6341     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6342
6343     state = 0xdeadbee;
6344     action = 0xdeadbee;
6345     r = MsiGetComponentState(hpkg, "xi", &state, &action);
6346     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6347     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6348     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6349
6350     state = 0xdeadbee;
6351     action = 0xdeadbee;
6352     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6353     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6354     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6355     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6356
6357     state = 0xdeadbee;
6358     action = 0xdeadbee;
6359     r = MsiGetComponentState(hpkg, "pi", &state, &action);
6360     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6361     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6362     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6363
6364     state = 0xdeadbee;
6365     action = 0xdeadbee;
6366     r = MsiGetComponentState(hpkg, "rho", &state, &action);
6367     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6368     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6369     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6370
6371     state = 0xdeadbee;
6372     action = 0xdeadbee;
6373     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6374     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6375     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6376     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6377
6378     state = 0xdeadbee;
6379     action = 0xdeadbee;
6380     r = MsiGetComponentState(hpkg, "tau", &state, &action);
6381     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6382     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6383     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6384
6385     state = 0xdeadbee;
6386     action = 0xdeadbee;
6387     r = MsiGetComponentState(hpkg, "phi", &state, &action);
6388     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6389     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6390     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6391
6392     state = 0xdeadbee;
6393     action = 0xdeadbee;
6394     r = MsiGetComponentState(hpkg, "chi", &state, &action);
6395     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6396     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6397     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6398
6399     MsiCloseHandle(hpkg);
6400
6401     /* reinstall the product */
6402     r = MsiInstallProduct(msifile3, "REINSTALL=ALL");
6403     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6404
6405     r = MsiOpenDatabase(msifile4, MSIDBOPEN_DIRECT, &hdb);
6406     ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
6407
6408     /* this property must not be in the saved msi file */
6409     r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
6410     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
6411
6412     r = package_from_db( hdb, &hpkg );
6413     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
6414
6415     state = 0xdeadbee;
6416     action = 0xdeadbee;
6417     r = MsiGetFeatureState(hpkg, "one", &state, &action);
6418     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6419     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6420     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6421
6422     state = 0xdeadbee;
6423     action = 0xdeadbee;
6424     r = MsiGetFeatureState(hpkg, "two", &state, &action);
6425     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6426     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6427     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6428
6429     state = 0xdeadbee;
6430     action = 0xdeadbee;
6431     r = MsiGetFeatureState(hpkg, "three", &state, &action);
6432     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6433     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6434     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6435
6436     state = 0xdeadbee;
6437     action = 0xdeadbee;
6438     r = MsiGetFeatureState(hpkg, "four", &state, &action);
6439     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6440     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6441     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6442
6443     state = 0xdeadbee;
6444     action = 0xdeadbee;
6445     r = MsiGetFeatureState(hpkg, "five", &state, &action);
6446     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6447     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6448     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6449
6450     state = 0xdeadbee;
6451     action = 0xdeadbee;
6452     r = MsiGetFeatureState(hpkg, "six", &state, &action);
6453     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6454     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6455     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6456
6457     state = 0xdeadbee;
6458     action = 0xdeadbee;
6459     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6460     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6461     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6462     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6463
6464     state = 0xdeadbee;
6465     action = 0xdeadbee;
6466     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6467     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6468     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6469     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6470
6471     state = 0xdeadbee;
6472     action = 0xdeadbee;
6473     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6474     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6475     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6476     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6477
6478     state = 0xdeadbee;
6479     action = 0xdeadbee;
6480     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6481     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6482     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6483     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6484
6485     state = 0xdeadbee;
6486     action = 0xdeadbee;
6487     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6488     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6489     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6490     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6491
6492     state = 0xdeadbee;
6493     action = 0xdeadbee;
6494     r = MsiGetComponentState(hpkg, "beta", &state, &action);
6495     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6496     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6497     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6498
6499     state = 0xdeadbee;
6500     action = 0xdeadbee;
6501     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6502     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6503     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6504     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6505
6506     state = 0xdeadbee;
6507     action = 0xdeadbee;
6508     r = MsiGetComponentState(hpkg, "theta", &state, &action);
6509     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6510     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6511     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6512
6513     state = 0xdeadbee;
6514     action = 0xdeadbee;
6515     r = MsiGetComponentState(hpkg, "delta", &state, &action);
6516     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6517     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6518     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6519
6520     state = 0xdeadbee;
6521     action = 0xdeadbee;
6522     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6523     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6524     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6525     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6526
6527     state = 0xdeadbee;
6528     action = 0xdeadbee;
6529     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6530     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6531     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6532     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6533
6534     state = 0xdeadbee;
6535     action = 0xdeadbee;
6536     r = MsiGetComponentState(hpkg, "iota", &state, &action);
6537     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6538     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6539     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6540
6541     state = 0xdeadbee;
6542     action = 0xdeadbee;
6543     r = MsiGetComponentState(hpkg, "eta", &state, &action);
6544     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6545     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6546     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6547
6548     state = 0xdeadbee;
6549     action = 0xdeadbee;
6550     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6551     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6552     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6553     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6554
6555     state = 0xdeadbee;
6556     action = 0xdeadbee;
6557     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6558     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6559     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6560     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6561
6562     state = 0xdeadbee;
6563     action = 0xdeadbee;
6564     r = MsiGetComponentState(hpkg, "mu", &state, &action);
6565     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6566     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6567     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6568
6569     state = 0xdeadbee;
6570     action = 0xdeadbee;
6571     r = MsiGetComponentState(hpkg, "nu", &state, &action);
6572     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6573     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6574     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6575
6576     state = 0xdeadbee;
6577     action = 0xdeadbee;
6578     r = MsiGetComponentState(hpkg, "xi", &state, &action);
6579     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6580     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6581     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6582
6583     state = 0xdeadbee;
6584     action = 0xdeadbee;
6585     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6586     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6587     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6588     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6589
6590     state = 0xdeadbee;
6591     action = 0xdeadbee;
6592     r = MsiGetComponentState(hpkg, "pi", &state, &action);
6593     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6594     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6595     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6596
6597     state = 0xdeadbee;
6598     action = 0xdeadbee;
6599     r = MsiGetComponentState(hpkg, "rho", &state, &action);
6600     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6601     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6602     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6603
6604     state = 0xdeadbee;
6605     action = 0xdeadbee;
6606     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6607     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6608     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6609     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6610
6611     state = 0xdeadbee;
6612     action = 0xdeadbee;
6613     r = MsiGetComponentState(hpkg, "tau", &state, &action);
6614     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6615     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6616     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6617
6618     state = 0xdeadbee;
6619     action = 0xdeadbee;
6620     r = MsiGetComponentState(hpkg, "phi", &state, &action);
6621     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6622     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6623     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6624
6625     state = 0xdeadbee;
6626     action = 0xdeadbee;
6627     r = MsiGetComponentState(hpkg, "chi", &state, &action);
6628     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6629     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6630     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6631
6632     r = MsiDoAction( hpkg, "CostInitialize");
6633     ok( r == ERROR_SUCCESS, "cost init failed\n");
6634
6635     state = 0xdeadbee;
6636     action = 0xdeadbee;
6637     r = MsiGetFeatureState(hpkg, "one", &state, &action);
6638     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6639     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6640     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6641
6642     state = 0xdeadbee;
6643     action = 0xdeadbee;
6644     r = MsiGetFeatureState(hpkg, "two", &state, &action);
6645     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6646     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6647     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6648
6649     state = 0xdeadbee;
6650     action = 0xdeadbee;
6651     r = MsiGetFeatureState(hpkg, "three", &state, &action);
6652     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6653     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6654     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6655
6656     state = 0xdeadbee;
6657     action = 0xdeadbee;
6658     r = MsiGetFeatureState(hpkg, "four", &state, &action);
6659     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6660     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6661     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6662
6663     state = 0xdeadbee;
6664     action = 0xdeadbee;
6665     r = MsiGetFeatureState(hpkg, "five", &state, &action);
6666     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6667     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6668     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6669
6670     state = 0xdeadbee;
6671     action = 0xdeadbee;
6672     r = MsiGetFeatureState(hpkg, "six", &state, &action);
6673     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6674     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6675     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6676
6677     state = 0xdeadbee;
6678     action = 0xdeadbee;
6679     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6680     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6681     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6682     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6683
6684     state = 0xdeadbee;
6685     action = 0xdeadbee;
6686     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6687     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6688     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6689     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6690
6691     state = 0xdeadbee;
6692     action = 0xdeadbee;
6693     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6694     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6695     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6696     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6697
6698     state = 0xdeadbee;
6699     action = 0xdeadbee;
6700     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6701     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6702     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6703     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6704
6705     state = 0xdeadbee;
6706     action = 0xdeadbee;
6707     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6708     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6709     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6710     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6711
6712     state = 0xdeadbee;
6713     action = 0xdeadbee;
6714     r = MsiGetComponentState(hpkg, "beta", &state, &action);
6715     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6716     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6717     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6718
6719     state = 0xdeadbee;
6720     action = 0xdeadbee;
6721     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6722     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6723     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6724     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6725
6726     state = 0xdeadbee;
6727     action = 0xdeadbee;
6728     r = MsiGetComponentState(hpkg, "theta", &state, &action);
6729     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6730     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6731     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6732
6733     state = 0xdeadbee;
6734     action = 0xdeadbee;
6735     r = MsiGetComponentState(hpkg, "delta", &state, &action);
6736     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6737     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6738     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6739
6740     state = 0xdeadbee;
6741     action = 0xdeadbee;
6742     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6743     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6744     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6745     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6746
6747     state = 0xdeadbee;
6748     action = 0xdeadbee;
6749     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6750     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6751     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6752     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6753
6754     state = 0xdeadbee;
6755     action = 0xdeadbee;
6756     r = MsiGetComponentState(hpkg, "iota", &state, &action);
6757     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6758     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6759     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6760
6761     state = 0xdeadbee;
6762     action = 0xdeadbee;
6763     r = MsiGetComponentState(hpkg, "eta", &state, &action);
6764     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6765     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6766     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6767
6768     state = 0xdeadbee;
6769     action = 0xdeadbee;
6770     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6771     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6772     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6773     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6774
6775     state = 0xdeadbee;
6776     action = 0xdeadbee;
6777     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6778     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6779     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6780     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6781
6782     state = 0xdeadbee;
6783     action = 0xdeadbee;
6784     r = MsiGetComponentState(hpkg, "mu", &state, &action);
6785     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6786     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6787     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6788
6789     state = 0xdeadbee;
6790     action = 0xdeadbee;
6791     r = MsiGetComponentState(hpkg, "nu", &state, &action);
6792     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6793     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6794     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6795
6796     state = 0xdeadbee;
6797     action = 0xdeadbee;
6798     r = MsiGetComponentState(hpkg, "xi", &state, &action);
6799     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6800     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6801     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6802
6803     state = 0xdeadbee;
6804     action = 0xdeadbee;
6805     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6806     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6807     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6808     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6809
6810     state = 0xdeadbee;
6811     action = 0xdeadbee;
6812     r = MsiGetComponentState(hpkg, "pi", &state, &action);
6813     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6814     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6815     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6816
6817     state = 0xdeadbee;
6818     action = 0xdeadbee;
6819     r = MsiGetComponentState(hpkg, "rho", &state, &action);
6820     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6821     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6822     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6823
6824     state = 0xdeadbee;
6825     action = 0xdeadbee;
6826     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6827     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6828     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6829     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6830
6831     state = 0xdeadbee;
6832     action = 0xdeadbee;
6833     r = MsiGetComponentState(hpkg, "tau", &state, &action);
6834     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6835     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6836     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6837
6838     state = 0xdeadbee;
6839     action = 0xdeadbee;
6840     r = MsiGetComponentState(hpkg, "phi", &state, &action);
6841     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6842     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6843     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6844
6845     state = 0xdeadbee;
6846     action = 0xdeadbee;
6847     r = MsiGetComponentState(hpkg, "chi", &state, &action);
6848     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6849     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6850     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6851
6852     r = MsiDoAction( hpkg, "FileCost");
6853     ok( r == ERROR_SUCCESS, "file cost failed\n");
6854
6855     state = 0xdeadbee;
6856     action = 0xdeadbee;
6857     r = MsiGetFeatureState(hpkg, "one", &state, &action);
6858     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6859     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6860     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6861
6862     state = 0xdeadbee;
6863     action = 0xdeadbee;
6864     r = MsiGetFeatureState(hpkg, "two", &state, &action);
6865     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6866     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6867     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6868
6869     state = 0xdeadbee;
6870     action = 0xdeadbee;
6871     r = MsiGetFeatureState(hpkg, "three", &state, &action);
6872     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6873     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6874     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6875
6876     state = 0xdeadbee;
6877     action = 0xdeadbee;
6878     r = MsiGetFeatureState(hpkg, "four", &state, &action);
6879     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6880     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6881     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6882
6883     state = 0xdeadbee;
6884     action = 0xdeadbee;
6885     r = MsiGetFeatureState(hpkg, "five", &state, &action);
6886     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6887     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6888     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6889
6890     state = 0xdeadbee;
6891     action = 0xdeadbee;
6892     r = MsiGetFeatureState(hpkg, "six", &state, &action);
6893     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6894     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6895     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6896
6897     state = 0xdeadbee;
6898     action = 0xdeadbee;
6899     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6900     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6901     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6902     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6903
6904     state = 0xdeadbee;
6905     action = 0xdeadbee;
6906     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6907     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6908     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6909     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6910
6911     state = 0xdeadbee;
6912     action = 0xdeadbee;
6913     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6914     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6915     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6916     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6917
6918     state = 0xdeadbee;
6919     action = 0xdeadbee;
6920     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6921     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6922     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6923     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6924
6925     state = 0xdeadbee;
6926     action = 0xdeadbee;
6927     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6928     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6929     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6930     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6931
6932     state = 0xdeadbee;
6933     action = 0xdeadbee;
6934     r = MsiGetComponentState(hpkg, "beta", &state, &action);
6935     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6936     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6937     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6938
6939     state = 0xdeadbee;
6940     action = 0xdeadbee;
6941     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6942     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6943     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6944     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6945
6946     state = 0xdeadbee;
6947     action = 0xdeadbee;
6948     r = MsiGetComponentState(hpkg, "theta", &state, &action);
6949     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6950     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6951     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6952
6953     state = 0xdeadbee;
6954     action = 0xdeadbee;
6955     r = MsiGetComponentState(hpkg, "delta", &state, &action);
6956     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6957     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6958     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6959
6960     state = 0xdeadbee;
6961     action = 0xdeadbee;
6962     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6963     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6964     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6965     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6966
6967     state = 0xdeadbee;
6968     action = 0xdeadbee;
6969     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6970     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6971     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6972     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6973
6974     state = 0xdeadbee;
6975     action = 0xdeadbee;
6976     r = MsiGetComponentState(hpkg, "iota", &state, &action);
6977     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6978     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6979     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6980
6981     state = 0xdeadbee;
6982     action = 0xdeadbee;
6983     r = MsiGetComponentState(hpkg, "eta", &state, &action);
6984     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6985     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6986     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6987
6988     state = 0xdeadbee;
6989     action = 0xdeadbee;
6990     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6991     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6992     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6993     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6994
6995     state = 0xdeadbee;
6996     action = 0xdeadbee;
6997     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6998     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6999     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7000     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7001
7002     state = 0xdeadbee;
7003     action = 0xdeadbee;
7004     r = MsiGetComponentState(hpkg, "mu", &state, &action);
7005     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7006     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7007     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7008
7009     state = 0xdeadbee;
7010     action = 0xdeadbee;
7011     r = MsiGetComponentState(hpkg, "nu", &state, &action);
7012     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7013     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7014     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7015
7016     state = 0xdeadbee;
7017     action = 0xdeadbee;
7018     r = MsiGetComponentState(hpkg, "xi", &state, &action);
7019     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7020     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7021     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7022
7023     state = 0xdeadbee;
7024     action = 0xdeadbee;
7025     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
7026     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7027     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7028     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7029
7030     state = 0xdeadbee;
7031     action = 0xdeadbee;
7032     r = MsiGetComponentState(hpkg, "pi", &state, &action);
7033     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7034     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7035     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7036
7037     state = 0xdeadbee;
7038     action = 0xdeadbee;
7039     r = MsiGetComponentState(hpkg, "rho", &state, &action);
7040     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7041     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7042     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7043
7044     state = 0xdeadbee;
7045     action = 0xdeadbee;
7046     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
7047     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7048     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7049     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7050
7051     state = 0xdeadbee;
7052     action = 0xdeadbee;
7053     r = MsiGetComponentState(hpkg, "tau", &state, &action);
7054     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7055     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7056     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7057
7058     state = 0xdeadbee;
7059     action = 0xdeadbee;
7060     r = MsiGetComponentState(hpkg, "phi", &state, &action);
7061     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7062     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7063     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7064
7065     state = 0xdeadbee;
7066     action = 0xdeadbee;
7067     r = MsiGetComponentState(hpkg, "chi", &state, &action);
7068     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7069     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7070     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7071
7072     r = MsiDoAction( hpkg, "CostFinalize");
7073     ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
7074
7075     state = 0xdeadbee;
7076     action = 0xdeadbee;
7077     r = MsiGetFeatureState(hpkg, "one", &state, &action);
7078     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7079     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7080     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7081
7082     state = 0xdeadbee;
7083     action = 0xdeadbee;
7084     r = MsiGetFeatureState(hpkg, "two", &state, &action);
7085     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7086     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7087     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7088
7089     state = 0xdeadbee;
7090     action = 0xdeadbee;
7091     r = MsiGetFeatureState(hpkg, "three", &state, &action);
7092     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7093     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7094     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7095
7096     state = 0xdeadbee;
7097     action = 0xdeadbee;
7098     r = MsiGetFeatureState(hpkg, "four", &state, &action);
7099     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7100     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7101     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7102
7103     state = 0xdeadbee;
7104     action = 0xdeadbee;
7105     r = MsiGetFeatureState(hpkg, "five", &state, &action);
7106     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7107     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7108     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7109
7110     state = 0xdeadbee;
7111     action = 0xdeadbee;
7112     r = MsiGetFeatureState(hpkg, "six", &state, &action);
7113     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7114     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7115     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7116
7117     state = 0xdeadbee;
7118     action = 0xdeadbee;
7119     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
7120     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7121     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7122     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7123
7124     state = 0xdeadbee;
7125     action = 0xdeadbee;
7126     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
7127     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7128     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7129     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7130
7131     state = 0xdeadbee;
7132     action = 0xdeadbee;
7133     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
7134     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7135     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7136     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7137
7138     state = 0xdeadbee;
7139     action = 0xdeadbee;
7140     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
7141     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7142     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7143     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7144
7145     state = 0xdeadbee;
7146     action = 0xdeadbee;
7147     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
7148     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7149     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7150     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7151
7152     state = 0xdeadbee;
7153     action = 0xdeadbee;
7154     r = MsiGetComponentState(hpkg, "beta", &state, &action);
7155     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7156     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7157     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7158
7159     state = 0xdeadbee;
7160     action = 0xdeadbee;
7161     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
7162     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7163     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7164     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7165
7166     state = 0xdeadbee;
7167     action = 0xdeadbee;
7168     r = MsiGetComponentState(hpkg, "theta", &state, &action);
7169     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7170     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7171     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7172
7173     state = 0xdeadbee;
7174     action = 0xdeadbee;
7175     r = MsiGetComponentState(hpkg, "delta", &state, &action);
7176     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7177     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7178     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7179
7180     state = 0xdeadbee;
7181     action = 0xdeadbee;
7182     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
7183     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7184     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7185     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7186
7187     state = 0xdeadbee;
7188     action = 0xdeadbee;
7189     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
7190     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7191     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7192     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7193
7194     state = 0xdeadbee;
7195     action = 0xdeadbee;
7196     r = MsiGetComponentState(hpkg, "iota", &state, &action);
7197     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7198     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7199     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7200
7201     state = 0xdeadbee;
7202     action = 0xdeadbee;
7203     r = MsiGetComponentState(hpkg, "eta", &state, &action);
7204     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7205     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7206     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7207
7208     state = 0xdeadbee;
7209     action = 0xdeadbee;
7210     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
7211     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7212     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7213     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7214
7215     state = 0xdeadbee;
7216     action = 0xdeadbee;
7217     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
7218     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7219     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7220     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7221
7222     state = 0xdeadbee;
7223     action = 0xdeadbee;
7224     r = MsiGetComponentState(hpkg, "mu", &state, &action);
7225     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7226     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7227     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7228
7229     state = 0xdeadbee;
7230     action = 0xdeadbee;
7231     r = MsiGetComponentState(hpkg, "nu", &state, &action);
7232     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7233     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7234     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7235
7236     state = 0xdeadbee;
7237     action = 0xdeadbee;
7238     r = MsiGetComponentState(hpkg, "xi", &state, &action);
7239     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7240     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7241     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7242
7243     state = 0xdeadbee;
7244     action = 0xdeadbee;
7245     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
7246     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7247     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7248     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7249
7250     state = 0xdeadbee;
7251     action = 0xdeadbee;
7252     r = MsiGetComponentState(hpkg, "pi", &state, &action);
7253     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7254     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7255     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7256
7257     state = 0xdeadbee;
7258     action = 0xdeadbee;
7259     r = MsiGetComponentState(hpkg, "rho", &state, &action);
7260     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7261     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7262     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7263
7264     state = 0xdeadbee;
7265     action = 0xdeadbee;
7266     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
7267     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7268     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7269     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7270
7271     state = 0xdeadbee;
7272     action = 0xdeadbee;
7273     r = MsiGetComponentState(hpkg, "tau", &state, &action);
7274     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7275     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7276     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7277
7278     state = 0xdeadbee;
7279     action = 0xdeadbee;
7280     r = MsiGetComponentState(hpkg, "phi", &state, &action);
7281     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7282     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7283     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7284
7285     state = 0xdeadbee;
7286     action = 0xdeadbee;
7287     r = MsiGetComponentState(hpkg, "chi", &state, &action);
7288     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7289     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7290     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7291
7292     MsiCloseHandle(hpkg);
7293
7294     /* uninstall the product */
7295     r = MsiInstallProduct(msifile4, "REMOVE=ALL");
7296     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7297
7298     DeleteFileA(msifile);
7299     DeleteFileA(msifile2);
7300     DeleteFileA(msifile3);
7301     DeleteFileA(msifile4);
7302 }
7303
7304 static void test_getproperty(void)
7305 {
7306     MSIHANDLE hPackage = 0;
7307     char prop[100];
7308     static CHAR empty[] = "";
7309     DWORD size;
7310     UINT r;
7311
7312     r = package_from_db(create_package_db(), &hPackage);
7313     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7314     {
7315         skip("Not enough rights to perform tests\n");
7316         DeleteFile(msifile);
7317         return;
7318     }
7319     ok( r == ERROR_SUCCESS, "Failed to create package %u\n", r );
7320
7321     /* set the property */
7322     r = MsiSetProperty(hPackage, "Name", "Value");
7323     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7324
7325     /* retrieve the size, NULL pointer */
7326     size = 0;
7327     r = MsiGetProperty(hPackage, "Name", NULL, &size);
7328     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7329     ok( size == 5, "Expected 5, got %d\n", size);
7330
7331     /* retrieve the size, empty string */
7332     size = 0;
7333     r = MsiGetProperty(hPackage, "Name", empty, &size);
7334     ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7335     ok( size == 5, "Expected 5, got %d\n", size);
7336
7337     /* don't change size */
7338     r = MsiGetProperty(hPackage, "Name", prop, &size);
7339     ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7340     ok( size == 5, "Expected 5, got %d\n", size);
7341     ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
7342
7343     /* increase the size by 1 */
7344     size++;
7345     r = MsiGetProperty(hPackage, "Name", prop, &size);
7346     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7347     ok( size == 5, "Expected 5, got %d\n", size);
7348     ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
7349
7350     r = MsiCloseHandle( hPackage);
7351     ok( r == ERROR_SUCCESS , "Failed to close package\n" );
7352     DeleteFile(msifile);
7353 }
7354
7355 static void test_removefiles(void)
7356 {
7357     MSIHANDLE hpkg;
7358     UINT r;
7359     MSIHANDLE hdb;
7360
7361     hdb = create_package_db();
7362     ok ( hdb, "failed to create package database\n" );
7363
7364     r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
7365     ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
7366
7367     r = create_feature_table( hdb );
7368     ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
7369
7370     r = create_component_table( hdb );
7371     ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
7372
7373     r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
7374     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7375
7376     r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
7377     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7378
7379     r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
7380     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7381
7382     r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
7383     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7384
7385     r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
7386     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7387
7388     r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
7389     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7390
7391     r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
7392     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7393
7394     r = create_feature_components_table( hdb );
7395     ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
7396
7397     r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
7398     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7399
7400     r = add_feature_components_entry( hdb, "'one', 'helium'" );
7401     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7402
7403     r = add_feature_components_entry( hdb, "'one', 'lithium'" );
7404     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7405
7406     r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
7407     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7408
7409     r = add_feature_components_entry( hdb, "'one', 'boron'" );
7410     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7411
7412     r = add_feature_components_entry( hdb, "'one', 'carbon'" );
7413     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7414
7415     r = create_file_table( hdb );
7416     ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
7417
7418     r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
7419     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7420
7421     r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
7422     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7423
7424     r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
7425     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7426
7427     r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
7428     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7429
7430     r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
7431     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7432
7433     r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
7434     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7435
7436     r = create_remove_file_table( hdb );
7437     ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
7438
7439     r = package_from_db( hdb, &hpkg );
7440     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7441     {
7442         skip("Not enough rights to perform tests\n");
7443         DeleteFile(msifile);
7444         return;
7445     }
7446     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
7447
7448     MsiCloseHandle( hdb );
7449
7450     create_test_file( "hydrogen.txt" );
7451     create_test_file( "helium.txt" );
7452     create_test_file( "lithium.txt" );
7453     create_test_file( "beryllium.txt" );
7454     create_test_file( "boron.txt" );
7455     create_test_file( "carbon.txt" );
7456
7457     r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
7458     ok( r == ERROR_SUCCESS, "set property failed\n");
7459
7460     r = MsiDoAction( hpkg, "CostInitialize");
7461     ok( r == ERROR_SUCCESS, "cost init failed\n");
7462
7463     r = MsiDoAction( hpkg, "FileCost");
7464     ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7465
7466     r = MsiDoAction( hpkg, "CostFinalize");
7467     ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7468
7469     r = MsiDoAction( hpkg, "InstallValidate");
7470     ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7471
7472     r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
7473     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7474
7475     r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
7476     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7477
7478     r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
7479     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7480
7481     r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
7482     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7483
7484     r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
7485     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7486
7487     r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
7488     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7489
7490     r = MsiDoAction( hpkg, "RemoveFiles");
7491     ok( r == ERROR_SUCCESS, "remove files failed\n");
7492
7493     ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
7494     ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");    
7495     ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
7496     ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
7497     ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
7498     ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
7499
7500     MsiCloseHandle( hpkg );
7501     DeleteFileA(msifile);
7502 }
7503
7504 static void test_appsearch(void)
7505 {
7506     MSIHANDLE hpkg;
7507     UINT r;
7508     MSIHANDLE hdb;
7509     CHAR prop[MAX_PATH];
7510     DWORD size = MAX_PATH;
7511
7512     hdb = create_package_db();
7513     ok ( hdb, "failed to create package database\n" );
7514
7515     r = create_appsearch_table( hdb );
7516     ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
7517
7518     r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
7519     ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
7520
7521     r = create_reglocator_table( hdb );
7522     ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7523
7524     r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
7525     ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7526
7527     r = create_signature_table( hdb );
7528     ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
7529
7530     r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
7531     ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
7532
7533     r = package_from_db( hdb, &hpkg );
7534     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7535     {
7536         skip("Not enough rights to perform tests\n");
7537         DeleteFile(msifile);
7538         return;
7539     }
7540     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
7541
7542     MsiCloseHandle( hdb );
7543
7544     r = MsiDoAction( hpkg, "AppSearch" );
7545     ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
7546
7547     r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
7548     ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
7549     todo_wine
7550     {
7551         ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
7552     }
7553
7554     MsiCloseHandle( hpkg );
7555     DeleteFileA(msifile);
7556 }
7557
7558 static void test_appsearch_complocator(void)
7559 {
7560     MSIHANDLE hpkg, hdb;
7561     CHAR path[MAX_PATH];
7562     CHAR prop[MAX_PATH];
7563     LPSTR usersid;
7564     DWORD size;
7565     UINT r;
7566
7567     if (!get_user_sid(&usersid))
7568         return;
7569
7570     if (is_process_limited())
7571     {
7572         skip("process is limited\n");
7573         return;
7574     }
7575
7576     create_test_file("FileName1");
7577     create_test_file("FileName4");
7578     set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE,
7579                        "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
7580
7581     create_test_file("FileName2");
7582     set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED,
7583                        "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
7584
7585     create_test_file("FileName3");
7586     set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED,
7587                        "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
7588
7589     create_test_file("FileName5");
7590     set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE,
7591                        "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
7592
7593     create_test_file("FileName6");
7594     set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE,
7595                        "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
7596
7597     create_test_file("FileName7");
7598     set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE,
7599                        "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
7600
7601     /* dir is FALSE, but we're pretending it's a directory */
7602     set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE,
7603                        "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
7604
7605     create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7606     set_component_path("FileName8.dll", MSIINSTALLCONTEXT_MACHINE,
7607                        "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
7608
7609     create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
7610     set_component_path("FileName9.dll", MSIINSTALLCONTEXT_MACHINE,
7611                        "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
7612
7613     create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7614     set_component_path("FileName10.dll", MSIINSTALLCONTEXT_MACHINE,
7615                        "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
7616
7617     hdb = create_package_db();
7618     ok(hdb, "Expected a valid database handle\n");
7619
7620     r = create_appsearch_table(hdb);
7621     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7622
7623     r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
7624     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7625
7626     r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
7627     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7628
7629     r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
7630     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7631
7632     r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
7633     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7634
7635     r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
7636     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7637
7638     r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
7639     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7640
7641     r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
7642     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7643
7644     r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
7645     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7646
7647     r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
7648     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7649
7650     r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
7651     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7652
7653     r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
7654     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7655
7656     r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
7657     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7658
7659     r = create_complocator_table(hdb);
7660     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7661
7662     /* published component, machine, file, signature, misdbLocatorTypeFile */
7663     r = add_complocator_entry(hdb, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
7664     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7665
7666     /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
7667     r = add_complocator_entry(hdb, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
7668     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7669
7670     /* published component, user-managed, file, signature, misdbLocatorTypeFile */
7671     r = add_complocator_entry(hdb, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
7672     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7673
7674     /* published component, machine, file, signature, misdbLocatorTypeDirectory */
7675     r = add_complocator_entry(hdb, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
7676     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7677
7678     /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
7679     r = add_complocator_entry(hdb, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
7680     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7681
7682     /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
7683     r = add_complocator_entry(hdb, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
7684     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7685
7686     /* published component, machine, file, no signature, misdbLocatorTypeFile */
7687     r = add_complocator_entry(hdb, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
7688     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7689
7690     /* unpublished component, no signature, misdbLocatorTypeDir */
7691     r = add_complocator_entry(hdb, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
7692     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7693
7694     /* published component, no signature, dir does not exist misdbLocatorTypeDir */
7695     r = add_complocator_entry(hdb, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
7696     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7697
7698     /* published component, signature w/ ver, misdbLocatorTypeFile */
7699     r = add_complocator_entry(hdb, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
7700     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7701
7702     /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
7703     r = add_complocator_entry(hdb, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
7704     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7705
7706     /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
7707     r = add_complocator_entry(hdb, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
7708     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7709
7710     r = create_signature_table(hdb);
7711     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7712
7713     r = add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
7714     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7715
7716     r = add_signature_entry(hdb, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
7717     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7718
7719     r = add_signature_entry(hdb, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
7720     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7721
7722     r = add_signature_entry(hdb, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
7723     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7724
7725     r = add_signature_entry(hdb, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
7726     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7727
7728     r = add_signature_entry(hdb, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7729     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7730
7731     r = add_signature_entry(hdb, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7732     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7733
7734     r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7735     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7736
7737     r = package_from_db(hdb, &hpkg);
7738     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7739     {
7740         skip("Not enough rights to perform tests\n");
7741         goto error;
7742     }
7743     ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
7744
7745     r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
7746     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7747
7748     r = MsiDoAction(hpkg, "AppSearch");
7749     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7750
7751     size = MAX_PATH;
7752     sprintf(path, "%s\\FileName1", CURR_DIR);
7753     r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
7754     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7755     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7756
7757     size = MAX_PATH;
7758     sprintf(path, "%s\\FileName2", CURR_DIR);
7759     r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
7760     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7761     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7762
7763     size = MAX_PATH;
7764     sprintf(path, "%s\\FileName3", CURR_DIR);
7765     r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
7766     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7767     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7768
7769     size = MAX_PATH;
7770     sprintf(path, "%s\\FileName4", CURR_DIR);
7771     r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
7772     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7773     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7774
7775     size = MAX_PATH;
7776     sprintf(path, "%s\\FileName5", CURR_DIR);
7777     r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
7778     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7779     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7780
7781     size = MAX_PATH;
7782     sprintf(path, "%s\\", CURR_DIR);
7783     r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
7784     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7785     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7786
7787     size = MAX_PATH;
7788     sprintf(path, "%s\\", CURR_DIR);
7789     r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
7790     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7791     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7792
7793     size = MAX_PATH;
7794     r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
7795     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7796     ok(!lstrcmpA(prop, "october"), "Expected \"october\", got \"%s\"\n", prop);
7797
7798     size = MAX_PATH;
7799     r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
7800     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7801     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7802
7803     size = MAX_PATH;
7804     sprintf(path, "%s\\FileName8.dll", CURR_DIR);
7805     r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
7806     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7807     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7808
7809     size = MAX_PATH;
7810     r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
7811     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7812     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7813
7814     size = MAX_PATH;
7815     sprintf(path, "%s\\FileName10.dll", CURR_DIR);
7816     r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
7817     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7818     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7819
7820     delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
7821                           MSIINSTALLCONTEXT_MACHINE, NULL);
7822     delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
7823                           MSIINSTALLCONTEXT_USERUNMANAGED, usersid);
7824     delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
7825                           MSIINSTALLCONTEXT_USERMANAGED, usersid);
7826     delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
7827                           MSIINSTALLCONTEXT_MACHINE, NULL);
7828     delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
7829                           MSIINSTALLCONTEXT_MACHINE, NULL);
7830     delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
7831                           MSIINSTALLCONTEXT_MACHINE, NULL);
7832     delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
7833                           MSIINSTALLCONTEXT_MACHINE, NULL);
7834     delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
7835                           MSIINSTALLCONTEXT_MACHINE, NULL);
7836     delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
7837                           MSIINSTALLCONTEXT_MACHINE, NULL);
7838     delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
7839                           MSIINSTALLCONTEXT_MACHINE, NULL);
7840
7841     MsiCloseHandle(hpkg);
7842
7843 error:
7844     DeleteFileA("FileName1");
7845     DeleteFileA("FileName2");
7846     DeleteFileA("FileName3");
7847     DeleteFileA("FileName4");
7848     DeleteFileA("FileName5");
7849     DeleteFileA("FileName6");
7850     DeleteFileA("FileName7");
7851     DeleteFileA("FileName8.dll");
7852     DeleteFileA("FileName9.dll");
7853     DeleteFileA("FileName10.dll");
7854     DeleteFileA(msifile);
7855     LocalFree(usersid);
7856 }
7857
7858 static void test_appsearch_reglocator(void)
7859 {
7860     MSIHANDLE hpkg, hdb;
7861     CHAR path[MAX_PATH], prop[MAX_PATH];
7862     DWORD binary[2], size, val;
7863     BOOL space, version;
7864     HKEY hklm, classes, hkcu, users;
7865     LPSTR pathdata, pathvar, ptr;
7866     LPCSTR str;
7867     LONG res;
7868     UINT r;
7869     REGSAM access = KEY_ALL_ACCESS;
7870     BOOL wow64;
7871
7872     if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
7873         access |= KEY_WOW64_64KEY;
7874
7875     version = TRUE;
7876     if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
7877         version = FALSE;
7878
7879     DeleteFileA("test.dll");
7880
7881     res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
7882     if (res == ERROR_ACCESS_DENIED)
7883     {
7884         skip("Not enough rights to perform tests\n");
7885         return;
7886     }
7887     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7888
7889     res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
7890                          (const BYTE *)"regszdata", 10);
7891     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7892
7893     res = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine", &hkcu);
7894     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7895
7896     res = RegSetValueExA(hkcu, "Value1", 0, REG_SZ,
7897                          (const BYTE *)"regszdata", 10);
7898     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7899
7900     users = 0;
7901     res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
7902     ok(res == ERROR_SUCCESS ||
7903        broken(res == ERROR_INVALID_PARAMETER),
7904        "Expected ERROR_SUCCESS, got %d\n", res);
7905
7906     if (res == ERROR_SUCCESS)
7907     {
7908         res = RegSetValueExA(users, "Value1", 0, REG_SZ,
7909                              (const BYTE *)"regszdata", 10);
7910         ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7911     }
7912
7913     res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine", 0, NULL, 0, access, NULL, &hklm, NULL);
7914     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7915
7916     res = RegSetValueA(hklm, NULL, REG_SZ, "defvalue", 8);
7917     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7918
7919     res = RegSetValueExA(hklm, "Value1", 0, REG_SZ,
7920                          (const BYTE *)"regszdata", 10);
7921     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7922
7923     val = 42;
7924     res = RegSetValueExA(hklm, "Value2", 0, REG_DWORD,
7925                          (const BYTE *)&val, sizeof(DWORD));
7926     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7927
7928     val = -42;
7929     res = RegSetValueExA(hklm, "Value3", 0, REG_DWORD,
7930                          (const BYTE *)&val, sizeof(DWORD));
7931     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7932
7933     res = RegSetValueExA(hklm, "Value4", 0, REG_EXPAND_SZ,
7934                          (const BYTE *)"%PATH%", 7);
7935     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7936
7937     res = RegSetValueExA(hklm, "Value5", 0, REG_EXPAND_SZ,
7938                          (const BYTE *)"my%NOVAR%", 10);
7939     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7940
7941     res = RegSetValueExA(hklm, "Value6", 0, REG_MULTI_SZ,
7942                          (const BYTE *)"one\0two\0", 9);
7943     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7944
7945     binary[0] = 0x1234abcd;
7946     binary[1] = 0x567890ef;
7947     res = RegSetValueExA(hklm, "Value7", 0, REG_BINARY,
7948                          (const BYTE *)binary, sizeof(binary));
7949     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7950
7951     res = RegSetValueExA(hklm, "Value8", 0, REG_SZ,
7952                          (const BYTE *)"#regszdata", 11);
7953     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7954
7955     create_test_file("FileName1");
7956     sprintf(path, "%s\\FileName1", CURR_DIR);
7957     res = RegSetValueExA(hklm, "Value9", 0, REG_SZ,
7958                          (const BYTE *)path, lstrlenA(path) + 1);
7959     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7960
7961     sprintf(path, "%s\\FileName2", CURR_DIR);
7962     res = RegSetValueExA(hklm, "Value10", 0, REG_SZ,
7963                          (const BYTE *)path, lstrlenA(path) + 1);
7964     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7965
7966     lstrcpyA(path, CURR_DIR);
7967     res = RegSetValueExA(hklm, "Value11", 0, REG_SZ,
7968                          (const BYTE *)path, lstrlenA(path) + 1);
7969     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7970
7971     res = RegSetValueExA(hklm, "Value12", 0, REG_SZ,
7972                          (const BYTE *)"", 1);
7973     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7974
7975     create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7976     sprintf(path, "%s\\FileName3.dll", CURR_DIR);
7977     res = RegSetValueExA(hklm, "Value13", 0, REG_SZ,
7978                          (const BYTE *)path, lstrlenA(path) + 1);
7979     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7980
7981     create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
7982     sprintf(path, "%s\\FileName4.dll", CURR_DIR);
7983     res = RegSetValueExA(hklm, "Value14", 0, REG_SZ,
7984                          (const BYTE *)path, lstrlenA(path) + 1);
7985     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7986
7987     create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7988     sprintf(path, "%s\\FileName5.dll", CURR_DIR);
7989     res = RegSetValueExA(hklm, "Value15", 0, REG_SZ,
7990                          (const BYTE *)path, lstrlenA(path) + 1);
7991     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7992
7993     sprintf(path, "\"%s\\FileName1\" -option", CURR_DIR);
7994     res = RegSetValueExA(hklm, "value16", 0, REG_SZ,
7995                          (const BYTE *)path, lstrlenA(path) + 1);
7996
7997     space = (strchr(CURR_DIR, ' ')) ? TRUE : FALSE;
7998     sprintf(path, "%s\\FileName1 -option", CURR_DIR);
7999     res = RegSetValueExA(hklm, "value17", 0, REG_SZ,
8000                          (const BYTE *)path, lstrlenA(path) + 1);
8001
8002     hdb = create_package_db();
8003     ok(hdb, "Expected a valid database handle\n");
8004
8005     r = create_appsearch_table(hdb);
8006     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8007
8008     r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8009     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8010
8011     r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8012     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8013
8014     r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8015     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8016
8017     r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8018     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8019
8020     r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8021     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8022
8023     r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8024     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8025
8026     r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8027     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8028
8029     r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8030     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8031
8032     r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8033     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8034
8035     r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8036     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8037
8038     r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8039     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8040
8041     r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
8042     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8043
8044     r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
8045     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8046
8047     r = add_appsearch_entry(hdb, "'SIGPROP14', 'NewSignature14'");
8048     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8049
8050     r = add_appsearch_entry(hdb, "'SIGPROP15', 'NewSignature15'");
8051     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8052
8053     r = add_appsearch_entry(hdb, "'SIGPROP16', 'NewSignature16'");
8054     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8055
8056     r = add_appsearch_entry(hdb, "'SIGPROP17', 'NewSignature17'");
8057     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8058
8059     r = add_appsearch_entry(hdb, "'SIGPROP18', 'NewSignature18'");
8060     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8061
8062     r = add_appsearch_entry(hdb, "'SIGPROP19', 'NewSignature19'");
8063     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8064
8065     r = add_appsearch_entry(hdb, "'SIGPROP20', 'NewSignature20'");
8066     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8067
8068     r = add_appsearch_entry(hdb, "'SIGPROP21', 'NewSignature21'");
8069     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8070
8071     r = add_appsearch_entry(hdb, "'SIGPROP22', 'NewSignature22'");
8072     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8073
8074     r = add_appsearch_entry(hdb, "'SIGPROP23', 'NewSignature23'");
8075     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8076
8077     r = add_appsearch_entry(hdb, "'SIGPROP24', 'NewSignature24'");
8078     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8079
8080     r = add_appsearch_entry(hdb, "'SIGPROP25', 'NewSignature25'");
8081     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8082
8083     r = add_appsearch_entry(hdb, "'SIGPROP26', 'NewSignature26'");
8084     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8085
8086     r = add_appsearch_entry(hdb, "'SIGPROP27', 'NewSignature27'");
8087     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8088
8089     r = add_appsearch_entry(hdb, "'SIGPROP28', 'NewSignature28'");
8090     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8091
8092     r = add_appsearch_entry(hdb, "'SIGPROP29', 'NewSignature29'");
8093     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8094
8095     r = add_appsearch_entry(hdb, "'SIGPROP30', 'NewSignature30'");
8096     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8097
8098     r = create_reglocator_table(hdb);
8099     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8100
8101     /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
8102     str = "'NewSignature1', 2, 'Software\\Wine', 'Value1', 2";
8103     r = add_reglocator_entry(hdb, str);
8104     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8105
8106     /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
8107     str = "'NewSignature2', 2, 'Software\\Wine', 'Value2', 2";
8108     r = add_reglocator_entry(hdb, str);
8109     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8110
8111     /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
8112     str = "'NewSignature3', 2, 'Software\\Wine', 'Value3', 2";
8113     r = add_reglocator_entry(hdb, str);
8114     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8115
8116     /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
8117     str = "'NewSignature4', 2, 'Software\\Wine', 'Value4', 2";
8118     r = add_reglocator_entry(hdb, str);
8119     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8120
8121     /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
8122     str = "'NewSignature5', 2, 'Software\\Wine', 'Value5', 2";
8123     r = add_reglocator_entry(hdb, str);
8124     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8125
8126     /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
8127     str = "'NewSignature6', 2, 'Software\\Wine', 'Value6', 2";
8128     r = add_reglocator_entry(hdb, str);
8129     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8130
8131     /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
8132     str = "'NewSignature7', 2, 'Software\\Wine', 'Value7', 2";
8133     r = add_reglocator_entry(hdb, str);
8134     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8135
8136     /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
8137     str = "'NewSignature8', 2, 'Software\\Wine', 'Value8', 2";
8138     r = add_reglocator_entry(hdb, str);
8139     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8140
8141     /* HKLM, msidbLocatorTypeFileName, signature, file exists */
8142     str = "'NewSignature9', 2, 'Software\\Wine', 'Value9', 1";
8143     r = add_reglocator_entry(hdb, str);
8144     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8145
8146     /* HKLM, msidbLocatorTypeFileName, signature, file does not exist */
8147     str = "'NewSignature10', 2, 'Software\\Wine', 'Value10', 1";
8148     r = add_reglocator_entry(hdb, str);
8149     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8150
8151     /* HKLM, msidbLocatorTypeFileName, no signature */
8152     str = "'NewSignature11', 2, 'Software\\Wine', 'Value9', 1";
8153     r = add_reglocator_entry(hdb, str);
8154     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8155
8156     /* HKLM, msidbLocatorTypeDirectory, no signature, file exists */
8157     str = "'NewSignature12', 2, 'Software\\Wine', 'Value9', 0";
8158     r = add_reglocator_entry(hdb, str);
8159     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8160
8161     /* HKLM, msidbLocatorTypeDirectory, no signature, directory exists */
8162     str = "'NewSignature13', 2, 'Software\\Wine', 'Value11', 0";
8163     r = add_reglocator_entry(hdb, str);
8164     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8165
8166     /* HKLM, msidbLocatorTypeDirectory, signature, file exists */
8167     str = "'NewSignature14', 2, 'Software\\Wine', 'Value9', 0";
8168     r = add_reglocator_entry(hdb, str);
8169     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8170
8171     /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
8172     str = "'NewSignature15', 0, 'Software\\Wine', 'Value1', 2";
8173     r = add_reglocator_entry(hdb, str);
8174     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8175
8176     /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
8177     str = "'NewSignature16', 1, 'Software\\Wine', 'Value1', 2";
8178     r = add_reglocator_entry(hdb, str);
8179     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8180
8181     /* HKU, msidbLocatorTypeRawValue, REG_SZ */
8182     str = "'NewSignature17', 3, 'S-1-5-18\\Software\\Wine', 'Value1', 2";
8183     r = add_reglocator_entry(hdb, str);
8184     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8185
8186     /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
8187     str = "'NewSignature18', 2, 'Software\\Wine', '', 2";
8188     r = add_reglocator_entry(hdb, str);
8189     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8190
8191     /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
8192     str = "'NewSignature19', 2, 'Software\\IDontExist', '', 2";
8193     r = add_reglocator_entry(hdb, str);
8194     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8195
8196     /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
8197     str = "'NewSignature20', 2, 'Software\\Wine', 'Value12', 2";
8198     r = add_reglocator_entry(hdb, str);
8199     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8200
8201     /* HKLM, msidbLocatorTypeFileName, signature, file exists w/ version */
8202     str = "'NewSignature21', 2, 'Software\\Wine', 'Value13', 1";
8203     r = add_reglocator_entry(hdb, str);
8204     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8205
8206     /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
8207     str = "'NewSignature22', 2, 'Software\\Wine', 'Value14', 1";
8208     r = add_reglocator_entry(hdb, str);
8209     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8210
8211     /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
8212     str = "'NewSignature23', 2, 'Software\\Wine', 'Value15', 1";
8213     r = add_reglocator_entry(hdb, str);
8214     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8215
8216     /* HKLM, msidbLocatorTypeFileName, no signature, directory exists */
8217     str = "'NewSignature24', 2, 'Software\\Wine', 'Value11', 1";
8218     r = add_reglocator_entry(hdb, str);
8219     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8220
8221     /* HKLM, msidbLocatorTypeFileName, no signature, file does not exist */
8222     str = "'NewSignature25', 2, 'Software\\Wine', 'Value10', 1";
8223     r = add_reglocator_entry(hdb, str);
8224     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8225
8226     /* HKLM, msidbLocatorTypeDirectory, signature, directory exists */
8227     str = "'NewSignature26', 2, 'Software\\Wine', 'Value11', 0";
8228     r = add_reglocator_entry(hdb, str);
8229     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8230
8231     /* HKLM, msidbLocatorTypeDirectory, signature, file does not exist */
8232     str = "'NewSignature27', 2, 'Software\\Wine', 'Value10', 0";
8233     r = add_reglocator_entry(hdb, str);
8234     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8235
8236     /* HKLM, msidbLocatorTypeDirectory, no signature, file does not exist */
8237     str = "'NewSignature28', 2, 'Software\\Wine', 'Value10', 0";
8238     r = add_reglocator_entry(hdb, str);
8239     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8240
8241     /* HKLM, msidbLocatorTypeFile, file exists, in quotes */
8242     str = "'NewSignature29', 2, 'Software\\Wine', 'Value16', 1";
8243     r = add_reglocator_entry(hdb, str);
8244     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8245
8246     /* HKLM, msidbLocatorTypeFile, file exists, no quotes */
8247     str = "'NewSignature30', 2, 'Software\\Wine', 'Value17', 1";
8248     r = add_reglocator_entry(hdb, str);
8249     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8250
8251     r = create_signature_table(hdb);
8252     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8253
8254     str = "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
8255     r = add_signature_entry(hdb, str);
8256     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8257
8258     str = "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
8259     r = add_signature_entry(hdb, str);
8260     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8261
8262     str = "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
8263     r = add_signature_entry(hdb, str);
8264     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8265
8266     str = "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8267     r = add_signature_entry(hdb, str);
8268     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8269
8270     str = "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8271     r = add_signature_entry(hdb, str);
8272     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8273
8274     str = "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8275     r = add_signature_entry(hdb, str);
8276     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8277
8278     ptr = strrchr(CURR_DIR, '\\') + 1;
8279     sprintf(path, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr);
8280     r = add_signature_entry(hdb, path);
8281     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8282
8283     str = "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''";
8284     r = add_signature_entry(hdb, str);
8285     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8286
8287     str = "'NewSignature29', 'FileName1', '', '', '', '', '', '', ''";
8288     r = add_signature_entry(hdb, str);
8289     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8290
8291     str = "'NewSignature30', 'FileName1', '', '', '', '', '', '', ''";
8292     r = add_signature_entry(hdb, str);
8293     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8294
8295     r = package_from_db(hdb, &hpkg);
8296     ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
8297
8298     r = MsiDoAction(hpkg, "AppSearch");
8299     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8300
8301     size = MAX_PATH;
8302     r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8303     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8304     ok(!lstrcmpA(prop, "regszdata"),
8305        "Expected \"regszdata\", got \"%s\"\n", prop);
8306
8307     size = MAX_PATH;
8308     r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8309     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8310     ok(!lstrcmpA(prop, "#42"), "Expected \"#42\", got \"%s\"\n", prop);
8311
8312     size = MAX_PATH;
8313     r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8314     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8315     ok(!lstrcmpA(prop, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop);
8316
8317     size = ExpandEnvironmentStringsA("%PATH%", NULL, 0);
8318     if (size == 0 && GetLastError() == ERROR_INVALID_PARAMETER)
8319     {
8320         /* Workaround for Win95 */
8321         CHAR tempbuf[1];
8322         size = ExpandEnvironmentStringsA("%PATH%", tempbuf, 0);
8323     }
8324     pathvar = HeapAlloc(GetProcessHeap(), 0, size);
8325     ExpandEnvironmentStringsA("%PATH%", pathvar, size);
8326
8327     size = 0;
8328     r = MsiGetPropertyA(hpkg, "SIGPROP4", NULL, &size);
8329     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8330
8331     pathdata = HeapAlloc(GetProcessHeap(), 0, ++size);
8332     r = MsiGetPropertyA(hpkg, "SIGPROP4", pathdata, &size);
8333     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8334     ok(!lstrcmpA(pathdata, pathvar),
8335        "Expected \"%s\", got \"%s\"\n", pathvar, pathdata);
8336
8337     HeapFree(GetProcessHeap(), 0, pathvar);
8338     HeapFree(GetProcessHeap(), 0, pathdata);
8339
8340     size = MAX_PATH;
8341     r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8342     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8343     ok(!lstrcmpA(prop,
8344        "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop);
8345
8346     size = MAX_PATH;
8347     r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8348     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8349     todo_wine
8350     {
8351         ok(!memcmp(prop, "\0one\0two\0\0", 10),
8352            "Expected \"\\0one\\0two\\0\\0\"\n");
8353     }
8354
8355     size = MAX_PATH;
8356     lstrcpyA(path, "#xCDAB3412EF907856");
8357     r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8358     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8359     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8360
8361     size = MAX_PATH;
8362     r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8363     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8364     ok(!lstrcmpA(prop, "##regszdata"),
8365        "Expected \"##regszdata\", got \"%s\"\n", prop);
8366
8367     size = MAX_PATH;
8368     sprintf(path, "%s\\FileName1", CURR_DIR);
8369     r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8370     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8371     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8372
8373     size = MAX_PATH;
8374     r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8375     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8376     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8377
8378     size = MAX_PATH;
8379     sprintf(path, "%s\\", CURR_DIR);
8380     r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8381     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8382     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8383
8384     size = MAX_PATH;
8385     r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8386     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8387     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8388
8389     size = MAX_PATH;
8390     sprintf(path, "%s\\", CURR_DIR);
8391     r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
8392     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8393     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8394
8395     size = MAX_PATH;
8396     r = MsiGetPropertyA(hpkg, "SIGPROP14", prop, &size);
8397     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8398     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8399
8400     size = MAX_PATH;
8401     r = MsiGetPropertyA(hpkg, "SIGPROP15", prop, &size);
8402     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8403     ok(!lstrcmpA(prop, "regszdata"),
8404        "Expected \"regszdata\", got \"%s\"\n", prop);
8405
8406     size = MAX_PATH;
8407     r = MsiGetPropertyA(hpkg, "SIGPROP16", prop, &size);
8408     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8409     ok(!lstrcmpA(prop, "regszdata"),
8410        "Expected \"regszdata\", got \"%s\"\n", prop);
8411
8412     if (users)
8413     {
8414         size = MAX_PATH;
8415         r = MsiGetPropertyA(hpkg, "SIGPROP17", prop, &size);
8416         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8417         ok(!lstrcmpA(prop, "regszdata"),
8418            "Expected \"regszdata\", got \"%s\"\n", prop);
8419     }
8420
8421     size = MAX_PATH;
8422     r = MsiGetPropertyA(hpkg, "SIGPROP18", prop, &size);
8423     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8424     ok(!lstrcmpA(prop, "defvalue"),
8425        "Expected \"defvalue\", got \"%s\"\n", prop);
8426
8427     size = MAX_PATH;
8428     r = MsiGetPropertyA(hpkg, "SIGPROP19", prop, &size);
8429     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8430     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8431
8432     size = MAX_PATH;
8433     r = MsiGetPropertyA(hpkg, "SIGPROP20", prop, &size);
8434     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8435     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8436
8437     if (version)
8438     {
8439         size = MAX_PATH;
8440         sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8441         r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size);
8442         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8443         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8444
8445         size = MAX_PATH;
8446         r = MsiGetPropertyA(hpkg, "SIGPROP22", prop, &size);
8447         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8448         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8449
8450         size = MAX_PATH;
8451         sprintf(path, "%s\\FileName5.dll", CURR_DIR);
8452         r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size);
8453         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8454         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8455     }
8456
8457     size = MAX_PATH;
8458     lstrcpyA(path, CURR_DIR);
8459     ptr = strrchr(path, '\\') + 1;
8460     *ptr = '\0';
8461     r = MsiGetPropertyA(hpkg, "SIGPROP24", prop, &size);
8462     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8463     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8464
8465     size = MAX_PATH;
8466     sprintf(path, "%s\\", CURR_DIR);
8467     r = MsiGetPropertyA(hpkg, "SIGPROP25", prop, &size);
8468     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8469     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8470
8471     size = MAX_PATH;
8472     r = MsiGetPropertyA(hpkg, "SIGPROP26", prop, &size);
8473     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8474     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8475
8476     size = MAX_PATH;
8477     r = MsiGetPropertyA(hpkg, "SIGPROP27", prop, &size);
8478     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8479     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8480
8481     size = MAX_PATH;
8482     r = MsiGetPropertyA(hpkg, "SIGPROP28", prop, &size);
8483     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8484     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8485
8486     size = MAX_PATH;
8487     sprintf(path, "%s\\FileName1", CURR_DIR);
8488     r = MsiGetPropertyA(hpkg, "SIGPROP29", prop, &size);
8489     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8490     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8491
8492     size = MAX_PATH;
8493     sprintf(path, "%s\\FileName1", CURR_DIR);
8494     r = MsiGetPropertyA(hpkg, "SIGPROP30", prop, &size);
8495     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8496     if (space)
8497         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8498     else
8499         todo_wine ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8500
8501     RegSetValueA(hklm, NULL, REG_SZ, "", 0);
8502     RegDeleteValueA(hklm, "Value1");
8503     RegDeleteValueA(hklm, "Value2");
8504     RegDeleteValueA(hklm, "Value3");
8505     RegDeleteValueA(hklm, "Value4");
8506     RegDeleteValueA(hklm, "Value5");
8507     RegDeleteValueA(hklm, "Value6");
8508     RegDeleteValueA(hklm, "Value7");
8509     RegDeleteValueA(hklm, "Value8");
8510     RegDeleteValueA(hklm, "Value9");
8511     RegDeleteValueA(hklm, "Value10");
8512     RegDeleteValueA(hklm, "Value11");
8513     RegDeleteValueA(hklm, "Value12");
8514     RegDeleteValueA(hklm, "Value13");
8515     RegDeleteValueA(hklm, "Value14");
8516     RegDeleteValueA(hklm, "Value15");
8517     RegDeleteValueA(hklm, "Value16");
8518     RegDeleteValueA(hklm, "Value17");
8519     delete_key(hklm, "", access);
8520     RegCloseKey(hklm);
8521
8522     RegDeleteValueA(classes, "Value1");
8523     RegDeleteKeyA(classes, "");
8524     RegCloseKey(classes);
8525
8526     RegDeleteValueA(hkcu, "Value1");
8527     RegDeleteKeyA(hkcu, "");
8528     RegCloseKey(hkcu);
8529
8530     RegDeleteValueA(users, "Value1");
8531     RegDeleteKeyA(users, "");
8532     RegCloseKey(users);
8533
8534     DeleteFileA("FileName1");
8535     DeleteFileA("FileName3.dll");
8536     DeleteFileA("FileName4.dll");
8537     DeleteFileA("FileName5.dll");
8538     MsiCloseHandle(hpkg);
8539     DeleteFileA(msifile);
8540 }
8541
8542 static void delete_win_ini(LPCSTR file)
8543 {
8544     CHAR path[MAX_PATH];
8545
8546     GetWindowsDirectoryA(path, MAX_PATH);
8547     lstrcatA(path, "\\");
8548     lstrcatA(path, file);
8549
8550     DeleteFileA(path);
8551 }
8552
8553 static void test_appsearch_inilocator(void)
8554 {
8555     MSIHANDLE hpkg, hdb;
8556     CHAR path[MAX_PATH];
8557     CHAR prop[MAX_PATH];
8558     BOOL version;
8559     LPCSTR str;
8560     LPSTR ptr;
8561     DWORD size;
8562     UINT r;
8563
8564     version = TRUE;
8565     if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
8566         version = FALSE;
8567
8568     DeleteFileA("test.dll");
8569
8570     WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
8571
8572     create_test_file("FileName1");
8573     sprintf(path, "%s\\FileName1", CURR_DIR);
8574     WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
8575
8576     WritePrivateProfileStringA("Section", "Key3", CURR_DIR, "IniFile.ini");
8577
8578     sprintf(path, "%s\\IDontExist", CURR_DIR);
8579     WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
8580
8581     create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8582     sprintf(path, "%s\\FileName2.dll", CURR_DIR);
8583     WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
8584
8585     create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8586     sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8587     WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
8588
8589     create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8590     sprintf(path, "%s\\FileName4.dll", CURR_DIR);
8591     WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
8592
8593     hdb = create_package_db();
8594     ok(hdb, "Expected a valid database handle\n");
8595
8596     r = create_appsearch_table(hdb);
8597     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8598
8599     r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8600     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8601
8602     r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8603     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8604
8605     r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8606     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8607
8608     r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8609     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8610
8611     r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8612     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8613
8614     r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8615     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8616
8617     r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8618     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8619
8620     r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8621     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8622
8623     r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8624     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8625
8626     r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8627     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8628
8629     r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8630     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8631
8632     r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
8633     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8634
8635     r = create_inilocator_table(hdb);
8636     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8637
8638     /* msidbLocatorTypeRawValue, field 1 */
8639     str = "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
8640     r = add_inilocator_entry(hdb, str);
8641     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8642
8643     /* msidbLocatorTypeRawValue, field 2 */
8644     str = "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
8645     r = add_inilocator_entry(hdb, str);
8646     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8647
8648     /* msidbLocatorTypeRawValue, entire field */
8649     str = "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
8650     r = add_inilocator_entry(hdb, str);
8651     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8652
8653     /* msidbLocatorTypeFile */
8654     str = "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
8655     r = add_inilocator_entry(hdb, str);
8656     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8657
8658     /* msidbLocatorTypeDirectory, file */
8659     str = "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
8660     r = add_inilocator_entry(hdb, str);
8661     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8662
8663     /* msidbLocatorTypeDirectory, directory */
8664     str = "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
8665     r = add_inilocator_entry(hdb, str);
8666     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8667
8668     /* msidbLocatorTypeFile, file, no signature */
8669     str = "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
8670     r = add_inilocator_entry(hdb, str);
8671     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8672
8673     /* msidbLocatorTypeFile, dir, no signature */
8674     str = "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
8675     r = add_inilocator_entry(hdb, str);
8676     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8677
8678     /* msidbLocatorTypeFile, file does not exist */
8679     str = "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
8680     r = add_inilocator_entry(hdb, str);
8681     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8682
8683     /* msidbLocatorTypeFile, signature with version */
8684     str = "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1";
8685     r = add_inilocator_entry(hdb, str);
8686     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8687
8688     /* msidbLocatorTypeFile, signature with version, ver > max */
8689     str = "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1";
8690     r = add_inilocator_entry(hdb, str);
8691     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8692
8693     /* msidbLocatorTypeFile, signature with version, sig->name ignored */
8694     str = "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1";
8695     r = add_inilocator_entry(hdb, str);
8696     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8697
8698     r = create_signature_table(hdb);
8699     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8700
8701     r = add_signature_entry(hdb, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
8702     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8703
8704     r = add_signature_entry(hdb, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
8705     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8706
8707     r = add_signature_entry(hdb, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8708     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8709
8710     r = add_signature_entry(hdb, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8711     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8712
8713     r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8714     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8715
8716     r = package_from_db(hdb, &hpkg);
8717     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
8718     {
8719         skip("Not enough rights to perform tests\n");
8720         goto error;
8721     }
8722     ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
8723
8724     r = MsiDoAction(hpkg, "AppSearch");
8725     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8726
8727     size = MAX_PATH;
8728     r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8729     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8730     ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop);
8731
8732     size = MAX_PATH;
8733     r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8734     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8735     ok(!lstrcmpA(prop, "field2"), "Expected \"field2\", got \"%s\"\n", prop);
8736
8737     size = MAX_PATH;
8738     r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8739     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8740     ok(!lstrcmpA(prop, "keydata,field2"),
8741        "Expected \"keydata,field2\", got \"%s\"\n", prop);
8742
8743     size = MAX_PATH;
8744     sprintf(path, "%s\\FileName1", CURR_DIR);
8745     r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
8746     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8747     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8748
8749     size = MAX_PATH;
8750     r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8751     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8752     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8753
8754     size = MAX_PATH;
8755     sprintf(path, "%s\\", CURR_DIR);
8756     r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8757     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8758     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8759
8760     size = MAX_PATH;
8761     sprintf(path, "%s\\", CURR_DIR);
8762     r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8763     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8764     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8765
8766     size = MAX_PATH;
8767     lstrcpyA(path, CURR_DIR);
8768     ptr = strrchr(path, '\\');
8769     *(ptr + 1) = '\0';
8770     r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8771     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8772     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8773
8774     size = MAX_PATH;
8775     r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8776     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8777     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8778
8779     if (version)
8780     {
8781         size = MAX_PATH;
8782         sprintf(path, "%s\\FileName2.dll", CURR_DIR);
8783         r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8784         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8785         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8786
8787         size = MAX_PATH;
8788         r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8789         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8790         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8791
8792         size = MAX_PATH;
8793         sprintf(path, "%s\\FileName4.dll", CURR_DIR);
8794         r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8795         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8796         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8797     }
8798
8799     MsiCloseHandle(hpkg);
8800
8801 error:
8802     delete_win_ini("IniFile.ini");
8803     DeleteFileA("FileName1");
8804     DeleteFileA("FileName2.dll");
8805     DeleteFileA("FileName3.dll");
8806     DeleteFileA("FileName4.dll");
8807     DeleteFileA(msifile);
8808 }
8809
8810 /*
8811  * MSI AppSearch action on DrLocator table always returns absolute paths.
8812  * If a relative path was set, it returns the first absolute path that
8813  * matches or an empty string if it didn't find anything.
8814  * This helper function replicates this behaviour.
8815  */
8816 static void search_absolute_directory(LPSTR absolute, LPCSTR relative)
8817 {
8818     int i, size;
8819     DWORD attr, drives;
8820
8821     size = lstrlenA(relative);
8822     drives = GetLogicalDrives();
8823     lstrcpyA(absolute, "A:\\");
8824     for (i = 0; i < 26; absolute[0] = '\0', i++)
8825     {
8826         if (!(drives & (1 << i)))
8827             continue;
8828
8829         absolute[0] = 'A' + i;
8830         if (GetDriveType(absolute) != DRIVE_FIXED)
8831             continue;
8832
8833         lstrcpynA(absolute + 3, relative, size + 1);
8834         attr = GetFileAttributesA(absolute);
8835         if (attr != INVALID_FILE_ATTRIBUTES &&
8836             (attr & FILE_ATTRIBUTE_DIRECTORY))
8837         {
8838             if (absolute[3 + size - 1] != '\\')
8839                 lstrcatA(absolute, "\\");
8840             break;
8841         }
8842         absolute[3] = '\0';
8843     }
8844 }
8845
8846 static void test_appsearch_drlocator(void)
8847 {
8848     MSIHANDLE hpkg, hdb;
8849     CHAR path[MAX_PATH];
8850     CHAR prop[MAX_PATH];
8851     BOOL version;
8852     LPCSTR str;
8853     DWORD size;
8854     UINT r;
8855
8856     version = TRUE;
8857     if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
8858         version = FALSE;
8859
8860     DeleteFileA("test.dll");
8861
8862     create_test_file("FileName1");
8863     CreateDirectoryA("one", NULL);
8864     CreateDirectoryA("one\\two", NULL);
8865     CreateDirectoryA("one\\two\\three", NULL);
8866     create_test_file("one\\two\\three\\FileName2");
8867     CreateDirectoryA("another", NULL);
8868     create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8869     create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8870     create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8871
8872     hdb = create_package_db();
8873     ok(hdb, "Expected a valid database handle\n");
8874
8875     r = create_appsearch_table(hdb);
8876     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8877
8878     r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8879     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8880
8881     r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8882     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8883
8884     r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8885     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8886
8887     r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8888     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8889
8890     r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8891     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8892
8893     r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8894     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8895
8896     r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8897     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8898
8899     r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8900     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8901
8902     r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8903     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8904
8905     r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8906     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8907
8908     r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8909     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8910
8911     r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
8912     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8913
8914     r = create_drlocator_table(hdb);
8915     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8916
8917     /* no parent, full path, depth 0, signature */
8918     sprintf(path, "'NewSignature1', '', '%s', 0", CURR_DIR);
8919     r = add_drlocator_entry(hdb, path);
8920     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8921
8922     /* no parent, full path, depth 0, no signature */
8923     sprintf(path, "'NewSignature2', '', '%s', 0", CURR_DIR);
8924     r = add_drlocator_entry(hdb, path);
8925     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8926
8927     /* no parent, relative path, depth 0, no signature */
8928     sprintf(path, "'NewSignature3', '', '%s', 0", CURR_DIR + 3);
8929     r = add_drlocator_entry(hdb, path);
8930     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8931
8932     /* no parent, full path, depth 2, signature */
8933     sprintf(path, "'NewSignature4', '', '%s', 2", CURR_DIR);
8934     r = add_drlocator_entry(hdb, path);
8935     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8936
8937     /* no parent, full path, depth 3, signature */
8938     sprintf(path, "'NewSignature5', '', '%s', 3", CURR_DIR);
8939     r = add_drlocator_entry(hdb, path);
8940     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8941
8942     /* no parent, full path, depth 1, signature is dir */
8943     sprintf(path, "'NewSignature6', '', '%s', 1", CURR_DIR);
8944     r = add_drlocator_entry(hdb, path);
8945     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8946
8947     /* parent is in DrLocator, relative path, depth 0, signature */
8948     sprintf(path, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
8949     r = add_drlocator_entry(hdb, path);
8950     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8951
8952     /* no parent, full path, depth 0, signature w/ version */
8953     sprintf(path, "'NewSignature8', '', '%s', 0", CURR_DIR);
8954     r = add_drlocator_entry(hdb, path);
8955     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8956
8957     /* no parent, full path, depth 0, signature w/ version, ver > max */
8958     sprintf(path, "'NewSignature9', '', '%s', 0", CURR_DIR);
8959     r = add_drlocator_entry(hdb, path);
8960     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8961
8962     /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
8963     sprintf(path, "'NewSignature10', '', '%s', 0", CURR_DIR);
8964     r = add_drlocator_entry(hdb, path);
8965     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8966
8967     /* no parent, relative empty path, depth 0, no signature */
8968     sprintf(path, "'NewSignature11', '', '', 0");
8969     r = add_drlocator_entry(hdb, path);
8970     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8971
8972     r = create_reglocator_table(hdb);
8973     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8974
8975     /* parent */
8976     r = add_reglocator_entry(hdb, "'NewSignature12', 2, 'htmlfile\\shell\\open\\nonexistent', '', 1");
8977     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8978
8979     /* parent is in RegLocator, no path, depth 0, no signature */
8980     sprintf(path, "'NewSignature13', 'NewSignature12', '', 0");
8981     r = add_drlocator_entry(hdb, path);
8982     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8983
8984     r = create_signature_table(hdb);
8985     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8986
8987     str = "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
8988     r = add_signature_entry(hdb, str);
8989     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8990
8991     str = "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
8992     r = add_signature_entry(hdb, str);
8993     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8994
8995     str = "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
8996     r = add_signature_entry(hdb, str);
8997     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8998
8999     str = "'NewSignature6', 'another', '', '', '', '', '', '', ''";
9000     r = add_signature_entry(hdb, str);
9001     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9002
9003     str = "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
9004     r = add_signature_entry(hdb, str);
9005     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9006
9007     str = "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
9008     r = add_signature_entry(hdb, str);
9009     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9010
9011     str = "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
9012     r = add_signature_entry(hdb, str);
9013     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9014
9015     str = "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
9016     r = add_signature_entry(hdb, str);
9017     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9018
9019     r = package_from_db(hdb, &hpkg);
9020     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9021     {
9022         skip("Not enough rights to perform tests\n");
9023         goto error;
9024     }
9025     ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
9026
9027     r = MsiDoAction(hpkg, "AppSearch");
9028     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9029
9030     size = MAX_PATH;
9031     sprintf(path, "%s\\FileName1", CURR_DIR);
9032     r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
9033     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9034     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9035
9036     size = MAX_PATH;
9037     sprintf(path, "%s\\", CURR_DIR);
9038     r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
9039     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9040     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9041
9042     size = MAX_PATH;
9043     search_absolute_directory(path, CURR_DIR + 3);
9044     r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
9045     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9046     ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9047
9048     size = MAX_PATH;
9049     r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
9050     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9051     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9052
9053     size = MAX_PATH;
9054     sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
9055     r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
9056     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9057     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9058
9059     size = MAX_PATH;
9060     r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
9061     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9062     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9063
9064     size = MAX_PATH;
9065     sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
9066     r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
9067     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9068     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9069
9070     if (version)
9071     {
9072         size = MAX_PATH;
9073         sprintf(path, "%s\\FileName3.dll", CURR_DIR);
9074         r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
9075         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9076         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9077
9078         size = MAX_PATH;
9079         r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
9080         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9081         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9082
9083         size = MAX_PATH;
9084         r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
9085         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9086         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9087     }
9088
9089     size = MAX_PATH;
9090     search_absolute_directory(path, "");
9091     r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
9092     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9093     ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9094
9095     size = MAX_PATH;
9096     strcpy(path, "c:\\");
9097     r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
9098     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9099     ok(!prop[0], "Expected \"\", got \"%s\"\n", prop);
9100
9101     MsiCloseHandle(hpkg);
9102
9103 error:
9104     DeleteFileA("FileName1");
9105     DeleteFileA("FileName3.dll");
9106     DeleteFileA("FileName4.dll");
9107     DeleteFileA("FileName5.dll");
9108     DeleteFileA("one\\two\\three\\FileName2");
9109     RemoveDirectoryA("one\\two\\three");
9110     RemoveDirectoryA("one\\two");
9111     RemoveDirectoryA("one");
9112     RemoveDirectoryA("another");
9113     DeleteFileA(msifile);
9114 }
9115
9116 static void test_featureparents(void)
9117 {
9118     MSIHANDLE hpkg;
9119     UINT r;
9120     MSIHANDLE hdb;
9121     INSTALLSTATE state, action;
9122
9123     hdb = create_package_db();
9124     ok ( hdb, "failed to create package database\n" );
9125
9126     r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
9127     ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
9128
9129     r = create_feature_table( hdb );
9130     ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
9131
9132     r = create_component_table( hdb );
9133     ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
9134
9135     r = create_feature_components_table( hdb );
9136     ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
9137
9138     r = create_file_table( hdb );
9139     ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
9140
9141     /* msidbFeatureAttributesFavorLocal */
9142     r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
9143     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9144
9145     /* msidbFeatureAttributesFavorSource */
9146     r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
9147     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9148
9149     /* msidbFeatureAttributesFavorLocal */
9150     r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
9151     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9152
9153     /* disabled because of install level */
9154     r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
9155     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9156
9157     /* child feature of disabled feature */
9158     r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
9159     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9160
9161     /* component of disabled feature (install level) */
9162     r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
9163     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9164
9165     /* component of disabled child feature (install level) */
9166     r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
9167     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9168
9169     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
9170     r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
9171     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9172
9173     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
9174     r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
9175     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9176
9177     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
9178     r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
9179     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9180
9181     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
9182     r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
9183     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9184
9185     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
9186     r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
9187     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9188
9189     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
9190     r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
9191     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9192
9193     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
9194     r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
9195     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9196
9197     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
9198     r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
9199     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9200
9201     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
9202     r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
9203
9204     r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
9205     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9206
9207     r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
9208     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9209
9210     r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
9211     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9212
9213     r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
9214     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9215
9216     r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
9217     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9218
9219     r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
9220     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9221
9222     r = add_feature_components_entry( hdb, "'orion', 'leo'" );
9223     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9224
9225     r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
9226     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9227
9228     r = add_feature_components_entry( hdb, "'orion', 'libra'" );
9229     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9230
9231     r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
9232     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9233
9234     r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
9235     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9236
9237     r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
9238     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9239
9240     r = add_feature_components_entry( hdb, "'orion', 'canis'" );
9241     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9242
9243     r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
9244     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9245
9246     r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
9247     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9248
9249     r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
9250     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9251
9252     r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
9253     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9254
9255     r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
9256     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9257
9258     r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
9259     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9260
9261     r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
9262     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9263
9264     r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
9265     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9266
9267     r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
9268     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9269
9270     r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
9271     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9272
9273     r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
9274     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9275
9276     r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
9277     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9278
9279     r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
9280     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9281
9282     r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
9283     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9284
9285     r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
9286     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9287
9288     r = package_from_db( hdb, &hpkg );
9289     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9290     {
9291         skip("Not enough rights to perform tests\n");
9292         DeleteFile(msifile);
9293         return;
9294     }
9295     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
9296
9297     MsiCloseHandle( hdb );
9298
9299     r = MsiDoAction( hpkg, "CostInitialize");
9300     ok( r == ERROR_SUCCESS, "cost init failed\n");
9301
9302     r = MsiDoAction( hpkg, "FileCost");
9303     ok( r == ERROR_SUCCESS, "file cost failed\n");
9304
9305     r = MsiDoAction( hpkg, "CostFinalize");
9306     ok( r == ERROR_SUCCESS, "cost finalize failed\n");
9307
9308     state = 0xdeadbee;
9309     action = 0xdeadbee;
9310     r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
9311     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9312     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9313     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9314
9315     state = 0xdeadbee;
9316     action = 0xdeadbee;
9317     r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
9318     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9319     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9320     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
9321
9322     state = 0xdeadbee;
9323     action = 0xdeadbee;
9324     r = MsiGetFeatureState(hpkg, "orion", &state, &action);
9325     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9326     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9327     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9328
9329     state = 0xdeadbee;
9330     action = 0xdeadbee;
9331     r = MsiGetFeatureState(hpkg, "waters", &state, &action);
9332     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9333     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9334     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
9335
9336     state = 0xdeadbee;
9337     action = 0xdeadbee;
9338     r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
9339     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9340     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9341     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
9342
9343     state = 0xdeadbee;
9344     action = 0xdeadbee;
9345     r = MsiGetComponentState(hpkg, "leo", &state, &action);
9346     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9347     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
9348     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9349
9350     state = 0xdeadbee;
9351     action = 0xdeadbee;
9352     r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9353     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9354     ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9355     ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9356
9357     state = 0xdeadbee;
9358     action = 0xdeadbee;
9359     r = MsiGetComponentState(hpkg, "libra", &state, &action);
9360     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9361     ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9362     ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9363
9364     state = 0xdeadbee;
9365     action = 0xdeadbee;
9366     r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9367     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9368     ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9369     ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9370
9371     state = 0xdeadbee;
9372     action = 0xdeadbee;
9373     r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9374     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9375     ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9376     ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9377
9378     state = 0xdeadbee;
9379     action = 0xdeadbee;
9380     r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9381     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9382     ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9383     ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
9384
9385     state = 0xdeadbee;
9386     action = 0xdeadbee;
9387     r = MsiGetComponentState(hpkg, "canis", &state, &action);
9388     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9389     ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9390     ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
9391
9392     state = 0xdeadbee;
9393     action = 0xdeadbee;
9394     r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9395     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9396     ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9397     ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
9398
9399     state = 0xdeadbee;
9400     action = 0xdeadbee;
9401     r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9402     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9403     ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9404     ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
9405
9406     state = 0xdeadbee;
9407     action = 0xdeadbee;
9408     r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9409     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9410     ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9411     ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9412
9413     state = 0xdeadbee;
9414     action = 0xdeadbee;
9415     r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9416     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9417     ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
9418     ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
9419
9420     r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
9421     ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
9422
9423     r = MsiSetFeatureState(hpkg, "nosuchfeature", INSTALLSTATE_ABSENT);
9424     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %u\n", r);
9425
9426     state = 0xdeadbee;
9427     action = 0xdeadbee;
9428     r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
9429     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9430     ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
9431     ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
9432
9433     state = 0xdeadbee;
9434     action = 0xdeadbee;
9435     r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
9436     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9437     ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
9438     ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
9439
9440     state = 0xdeadbee;
9441     action = 0xdeadbee;
9442     r = MsiGetFeatureState(hpkg, "orion", &state, &action);
9443     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9444     ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
9445     ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
9446
9447     state = 0xdeadbee;
9448     action = 0xdeadbee;
9449     r = MsiGetComponentState(hpkg, "leo", &state, &action);
9450     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9451     ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
9452     ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
9453
9454     state = 0xdeadbee;
9455     action = 0xdeadbee;
9456     r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9457     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9458     ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9459     ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9460
9461     state = 0xdeadbee;
9462     action = 0xdeadbee;
9463     r = MsiGetComponentState(hpkg, "libra", &state, &action);
9464     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9465     ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9466     ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9467
9468     state = 0xdeadbee;
9469     action = 0xdeadbee;
9470     r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9471     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9472     ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9473     ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9474
9475     state = 0xdeadbee;
9476     action = 0xdeadbee;
9477     r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9478     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9479     ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9480     ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9481
9482     state = 0xdeadbee;
9483     action = 0xdeadbee;
9484     r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9485     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9486     ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9487     ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
9488
9489     state = 0xdeadbee;
9490     action = 0xdeadbee;
9491     r = MsiGetComponentState(hpkg, "canis", &state, &action);
9492     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9493     ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9494     ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
9495
9496     state = 0xdeadbee;
9497     action = 0xdeadbee;
9498     r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9499     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9500     ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9501     ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
9502
9503     state = 0xdeadbee;
9504     action = 0xdeadbee;
9505     r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9506     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9507     ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9508     ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
9509
9510     state = 0xdeadbee;
9511     action = 0xdeadbee;
9512     r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9513     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9514     ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9515     ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9516
9517     state = 0xdeadbee;
9518     action = 0xdeadbee;
9519     r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9520     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9521     ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
9522     ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
9523     
9524     MsiCloseHandle(hpkg);
9525     DeleteFileA(msifile);
9526 }
9527
9528 static void test_installprops(void)
9529 {
9530     MSIHANDLE hpkg, hdb;
9531     CHAR path[MAX_PATH], buf[MAX_PATH];
9532     DWORD size, type;
9533     LANGID langid;
9534     HKEY hkey1, hkey2;
9535     int res;
9536     UINT r;
9537     REGSAM access = KEY_ALL_ACCESS;
9538     BOOL wow64;
9539
9540     if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
9541         access |= KEY_WOW64_64KEY;
9542
9543     GetCurrentDirectory(MAX_PATH, path);
9544     lstrcat(path, "\\");
9545     lstrcat(path, msifile);
9546
9547     hdb = create_package_db();
9548     ok( hdb, "failed to create database\n");
9549
9550     r = package_from_db(hdb, &hpkg);
9551     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9552     {
9553         skip("Not enough rights to perform tests\n");
9554         DeleteFile(msifile);
9555         return;
9556     }
9557     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
9558
9559     MsiCloseHandle(hdb);
9560
9561     size = MAX_PATH;
9562     r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
9563     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9564     ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9565
9566     RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
9567     RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey2);
9568
9569     size = MAX_PATH;
9570     type = REG_SZ;
9571     *path = '\0';
9572     if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
9573     {
9574         size = MAX_PATH;
9575         type = REG_SZ;
9576         RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
9577     }
9578
9579     /* win9x doesn't set this */
9580     if (*path)
9581     {
9582         size = MAX_PATH;
9583         r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
9584         ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9585         ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9586     }
9587
9588     size = MAX_PATH;
9589     type = REG_SZ;
9590     *path = '\0';
9591     if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
9592     {
9593         size = MAX_PATH;
9594         type = REG_SZ;
9595         RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
9596     }
9597
9598     if (*path)
9599     {
9600         size = MAX_PATH;
9601         r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
9602         ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9603         ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9604     }
9605
9606     size = MAX_PATH;
9607     r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
9608     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9609     trace("VersionDatabase = %s\n", buf);
9610
9611     size = MAX_PATH;
9612     r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
9613     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9614     trace("VersionMsi = %s\n", buf);
9615
9616     size = MAX_PATH;
9617     r = MsiGetProperty(hpkg, "Date", buf, &size);
9618     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9619     trace("Date = %s\n", buf);
9620
9621     size = MAX_PATH;
9622     r = MsiGetProperty(hpkg, "Time", buf, &size);
9623     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9624     trace("Time = %s\n", buf);
9625
9626     size = MAX_PATH;
9627     r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
9628     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9629     trace("PackageCode = %s\n", buf);
9630
9631     langid = GetUserDefaultLangID();
9632     sprintf(path, "%d", langid);
9633
9634     size = MAX_PATH;
9635     r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
9636     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
9637     ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
9638
9639     res = GetSystemMetrics(SM_CXSCREEN);
9640     size = MAX_PATH;
9641     r = MsiGetProperty(hpkg, "ScreenX", buf, &size);
9642     ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
9643
9644     res = GetSystemMetrics(SM_CYSCREEN);
9645     size = MAX_PATH;
9646     r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
9647     ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
9648
9649     CloseHandle(hkey1);
9650     CloseHandle(hkey2);
9651     MsiCloseHandle(hpkg);
9652     DeleteFile(msifile);
9653 }
9654
9655 static void test_launchconditions(void)
9656 {
9657     MSIHANDLE hpkg;
9658     MSIHANDLE hdb;
9659     UINT r;
9660
9661     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9662
9663     hdb = create_package_db();
9664     ok( hdb, "failed to create package database\n" );
9665
9666     r = create_launchcondition_table( hdb );
9667     ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
9668
9669     r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
9670     ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
9671
9672     /* invalid condition */
9673     r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
9674     ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
9675
9676     r = package_from_db( hdb, &hpkg );
9677     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9678     {
9679         skip("Not enough rights to perform tests\n");
9680         DeleteFile(msifile);
9681         return;
9682     }
9683     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
9684
9685     MsiCloseHandle( hdb );
9686
9687     r = MsiSetProperty( hpkg, "X", "1" );
9688     ok( r == ERROR_SUCCESS, "failed to set property\n" );
9689
9690     /* invalid conditions are ignored */
9691     r = MsiDoAction( hpkg, "LaunchConditions" );
9692     ok( r == ERROR_SUCCESS, "cost init failed\n" );
9693
9694     /* verify LaunchConditions still does some verification */
9695     r = MsiSetProperty( hpkg, "X", "2" );
9696     ok( r == ERROR_SUCCESS, "failed to set property\n" );
9697
9698     r = MsiDoAction( hpkg, "LaunchConditions" );
9699     ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
9700
9701     MsiCloseHandle( hpkg );
9702     DeleteFile( msifile );
9703 }
9704
9705 static void test_ccpsearch(void)
9706 {
9707     MSIHANDLE hdb, hpkg;
9708     CHAR prop[MAX_PATH];
9709     DWORD size = MAX_PATH;
9710     UINT r;
9711
9712     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9713
9714     hdb = create_package_db();
9715     ok(hdb, "failed to create package database\n");
9716
9717     r = create_ccpsearch_table(hdb);
9718     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9719
9720     r = add_ccpsearch_entry(hdb, "'CCP_random'");
9721     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9722
9723     r = add_ccpsearch_entry(hdb, "'RMCCP_random'");
9724     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9725
9726     r = create_reglocator_table(hdb);
9727     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9728
9729     r = add_reglocator_entry(hdb, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
9730     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9731
9732     r = create_drlocator_table(hdb);
9733     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9734
9735     r = add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
9736     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9737
9738     r = create_signature_table(hdb);
9739     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9740
9741     r = package_from_db(hdb, &hpkg);
9742     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9743     {
9744         skip("Not enough rights to perform tests\n");
9745         DeleteFile(msifile);
9746         return;
9747     }
9748     ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
9749
9750     MsiCloseHandle(hdb);
9751
9752     r = MsiDoAction(hpkg, "CCPSearch");
9753     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9754
9755     r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
9756     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9757     ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
9758
9759     MsiCloseHandle(hpkg);
9760     DeleteFileA(msifile);
9761 }
9762
9763 static void test_complocator(void)
9764 {
9765     MSIHANDLE hdb, hpkg;
9766     UINT r;
9767     CHAR prop[MAX_PATH];
9768     CHAR expected[MAX_PATH];
9769     DWORD size = MAX_PATH;
9770
9771     hdb = create_package_db();
9772     ok(hdb, "failed to create package database\n");
9773
9774     r = create_appsearch_table(hdb);
9775     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9776
9777     r = add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
9778     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9779
9780     r = add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
9781     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9782
9783     r = add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
9784     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9785
9786     r = add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
9787     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9788
9789     r = add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
9790     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9791
9792     r = add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
9793     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9794
9795     r = add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
9796     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9797
9798     r = add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
9799     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9800
9801     r = add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
9802     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9803
9804     r = add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
9805     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9806
9807     r = add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
9808     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9809
9810     r = add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
9811     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9812
9813     r = add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
9814     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9815
9816     r = add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
9817     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9818
9819     r = add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
9820     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9821
9822     r = add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
9823     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9824
9825     r = create_complocator_table(hdb);
9826     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9827
9828     r = add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
9829     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9830
9831     r = add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
9832     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9833
9834     r = add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
9835     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9836
9837     r = add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
9838     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9839
9840     r = add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
9841     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9842
9843     r = add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
9844     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9845
9846     r = add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
9847     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9848
9849     r = add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
9850     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9851
9852     r = add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
9853     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9854
9855     r = add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
9856     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9857
9858     r = add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
9859     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9860
9861     r = add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
9862     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9863
9864     r = add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
9865     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9866
9867     r = add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
9868     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9869
9870     r = add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
9871     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9872
9873     r = add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
9874     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9875
9876     r = create_signature_table(hdb);
9877     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9878
9879     r = add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
9880     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9881
9882     r = add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
9883     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9884
9885     r = add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
9886     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9887
9888     r = add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
9889     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9890
9891     r = add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
9892     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9893
9894     r = add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
9895     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9896
9897     r = add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
9898     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9899
9900     r = add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
9901     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9902
9903     r = package_from_db(hdb, &hpkg);
9904     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9905     {
9906         skip("Not enough rights to perform tests\n");
9907         DeleteFile(msifile);
9908         return;
9909     }
9910     ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
9911
9912     MsiCloseHandle(hdb);
9913
9914     create_test_file("abelisaurus");
9915     create_test_file("bactrosaurus");
9916     create_test_file("camelotia");
9917     create_test_file("diclonius");
9918     create_test_file("echinodon");
9919     create_test_file("falcarius");
9920     create_test_file("gallimimus");
9921     create_test_file("hagryphus");
9922     CreateDirectoryA("iguanodon", NULL);
9923     CreateDirectoryA("jobaria", NULL);
9924     CreateDirectoryA("kakuru", NULL);
9925     CreateDirectoryA("labocania", NULL);
9926     CreateDirectoryA("megaraptor", NULL);
9927     CreateDirectoryA("neosodon", NULL);
9928     CreateDirectoryA("olorotitan", NULL);
9929     CreateDirectoryA("pantydraco", NULL);
9930
9931     set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE,
9932                        "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL, FALSE);
9933     set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE,
9934                        "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL, FALSE);
9935     set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE,
9936                        "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL, FALSE);
9937     set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE,
9938                        "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL, FALSE);
9939     set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE,
9940                        "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL, FALSE);
9941     set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE,
9942                        "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL, FALSE);
9943     set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE,
9944                        "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL, FALSE);
9945     set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE,
9946                        "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL, FALSE);
9947
9948     r = MsiDoAction(hpkg, "AppSearch");
9949     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9950
9951     size = MAX_PATH;
9952     r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
9953     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9954
9955     lstrcpyA(expected, CURR_DIR);
9956     lstrcatA(expected, "\\abelisaurus");
9957     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9958        "Expected %s or empty string, got %s\n", expected, prop);
9959
9960     size = MAX_PATH;
9961     r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
9962     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9963     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9964
9965     size = MAX_PATH;
9966     r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
9967     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9968     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9969
9970     size = MAX_PATH;
9971     r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
9972     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9973     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9974
9975     size = MAX_PATH;
9976     r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
9977     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9978
9979     lstrcpyA(expected, CURR_DIR);
9980     lstrcatA(expected, "\\");
9981     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9982        "Expected %s or empty string, got %s\n", expected, prop);
9983
9984     size = MAX_PATH;
9985     r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
9986     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9987     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9988
9989     size = MAX_PATH;
9990     r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
9991     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9992     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9993
9994     size = MAX_PATH;
9995     r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
9996     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9997     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9998
9999     size = MAX_PATH;
10000     r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
10001     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10002     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10003
10004     size = MAX_PATH;
10005     r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
10006     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10007     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10008
10009     size = MAX_PATH;
10010     r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
10011     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10012     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10013
10014     size = MAX_PATH;
10015     r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
10016     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10017     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10018
10019     size = MAX_PATH;
10020     r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
10021     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10022
10023     lstrcpyA(expected, CURR_DIR);
10024     lstrcatA(expected, "\\");
10025     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10026        "Expected %s or empty string, got %s\n", expected, prop);
10027
10028     size = MAX_PATH;
10029     r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
10030     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10031
10032     lstrcpyA(expected, CURR_DIR);
10033     lstrcatA(expected, "\\neosodon\\");
10034     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10035        "Expected %s or empty string, got %s\n", expected, prop);
10036
10037     size = MAX_PATH;
10038     r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
10039     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10040     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10041
10042     size = MAX_PATH;
10043     r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
10044     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10045     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10046
10047     MsiCloseHandle(hpkg);
10048     DeleteFileA("abelisaurus");
10049     DeleteFileA("bactrosaurus");
10050     DeleteFileA("camelotia");
10051     DeleteFileA("diclonius");
10052     DeleteFileA("echinodon");
10053     DeleteFileA("falcarius");
10054     DeleteFileA("gallimimus");
10055     DeleteFileA("hagryphus");
10056     RemoveDirectoryA("iguanodon");
10057     RemoveDirectoryA("jobaria");
10058     RemoveDirectoryA("kakuru");
10059     RemoveDirectoryA("labocania");
10060     RemoveDirectoryA("megaraptor");
10061     RemoveDirectoryA("neosodon");
10062     RemoveDirectoryA("olorotitan");
10063     RemoveDirectoryA("pantydraco");
10064     delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
10065                           MSIINSTALLCONTEXT_MACHINE, NULL);
10066     delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
10067                           MSIINSTALLCONTEXT_MACHINE, NULL);
10068     delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
10069                           MSIINSTALLCONTEXT_MACHINE, NULL);
10070     delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
10071                           MSIINSTALLCONTEXT_MACHINE, NULL);
10072     delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
10073                           MSIINSTALLCONTEXT_MACHINE, NULL);
10074     delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
10075                           MSIINSTALLCONTEXT_MACHINE, NULL);
10076     delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
10077                           MSIINSTALLCONTEXT_MACHINE, NULL);
10078     delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
10079                           MSIINSTALLCONTEXT_MACHINE, NULL);
10080     DeleteFileA(msifile);
10081 }
10082
10083 static void set_suminfo_prop(MSIHANDLE db, DWORD prop, DWORD val)
10084 {
10085     MSIHANDLE summary;
10086     UINT r;
10087
10088     r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
10089     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10090
10091     r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
10092     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10093
10094     r = MsiSummaryInfoPersist(summary);
10095     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
10096
10097     MsiCloseHandle(summary);
10098 }
10099
10100 static void test_MsiGetSourcePath(void)
10101 {
10102     MSIHANDLE hdb, hpkg;
10103     CHAR path[MAX_PATH];
10104     CHAR cwd[MAX_PATH];
10105     CHAR subsrc[MAX_PATH];
10106     CHAR sub2[MAX_PATH];
10107     DWORD size;
10108     UINT r;
10109
10110     lstrcpyA(cwd, CURR_DIR);
10111     lstrcatA(cwd, "\\");
10112
10113     lstrcpyA(subsrc, cwd);
10114     lstrcatA(subsrc, "subsource");
10115     lstrcatA(subsrc, "\\");
10116
10117     lstrcpyA(sub2, subsrc);
10118     lstrcatA(sub2, "sub2");
10119     lstrcatA(sub2, "\\");
10120
10121     /* uncompressed source */
10122
10123     hdb = create_package_db();
10124     ok( hdb, "failed to create database\n");
10125
10126     set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
10127
10128     r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
10129     ok(r == S_OK, "failed\n");
10130
10131     r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
10132     ok(r == S_OK, "failed\n");
10133
10134     r = add_directory_entry(hdb, "'SubDir2', 'SubDir', 'sub2'");
10135     ok(r == S_OK, "failed\n");
10136
10137     r = MsiDatabaseCommit(hdb);
10138     ok(r == ERROR_SUCCESS , "Failed to commit database\n");
10139
10140     r = package_from_db(hdb, &hpkg);
10141     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
10142     {
10143         skip("Not enough rights to perform tests\n");
10144         DeleteFile(msifile);
10145         return;
10146     }
10147     ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
10148
10149     MsiCloseHandle(hdb);
10150
10151     /* invalid database handle */
10152     size = MAX_PATH;
10153     lstrcpyA(path, "kiwi");
10154     r = MsiGetSourcePath(-1, "TARGETDIR", path, &size);
10155     ok(r == ERROR_INVALID_HANDLE,
10156        "Expected ERROR_INVALID_HANDLE, got %d\n", r);
10157     ok(!lstrcmpA(path, "kiwi"),
10158        "Expected path to be unchanged, got \"%s\"\n", path);
10159     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10160
10161     /* NULL szFolder */
10162     size = MAX_PATH;
10163     lstrcpyA(path, "kiwi");
10164     r = MsiGetSourcePath(hpkg, NULL, path, &size);
10165     ok(r == ERROR_INVALID_PARAMETER,
10166        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
10167     ok(!lstrcmpA(path, "kiwi"),
10168        "Expected path to be unchanged, got \"%s\"\n", path);
10169     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10170
10171     /* empty szFolder */
10172     size = MAX_PATH;
10173     lstrcpyA(path, "kiwi");
10174     r = MsiGetSourcePath(hpkg, "", path, &size);
10175     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10176     ok(!lstrcmpA(path, "kiwi"),
10177        "Expected path to be unchanged, got \"%s\"\n", path);
10178     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10179
10180     /* try TARGETDIR */
10181     size = MAX_PATH;
10182     lstrcpyA(path, "kiwi");
10183     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10184     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10185     ok(!lstrcmpA(path, "kiwi"),
10186        "Expected path to be unchanged, got \"%s\"\n", path);
10187     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10188
10189     size = MAX_PATH;
10190     lstrcpyA(path, "kiwi");
10191     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10192     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10193     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10194     ok(size == 0, "Expected 0, got %d\n", size);
10195
10196     size = MAX_PATH;
10197     lstrcpyA(path, "kiwi");
10198     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10199     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10200     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10201     ok(size == 0, "Expected 0, got %d\n", size);
10202
10203     /* try SourceDir */
10204     size = MAX_PATH;
10205     lstrcpyA(path, "kiwi");
10206     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10207     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10208     ok(!lstrcmpA(path, "kiwi"),
10209        "Expected path to be unchanged, got \"%s\"\n", path);
10210     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10211
10212     /* try SOURCEDIR */
10213     size = MAX_PATH;
10214     lstrcpyA(path, "kiwi");
10215     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10216     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10217     ok(!lstrcmpA(path, "kiwi"),
10218        "Expected path to be unchanged, got \"%s\"\n", path);
10219     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10220
10221     /* source path does not exist, but the property exists */
10222     size = MAX_PATH;
10223     lstrcpyA(path, "kiwi");
10224     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10225     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10226     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10227     ok(size == 0, "Expected 0, got %d\n", size);
10228
10229     size = MAX_PATH;
10230     lstrcpyA(path, "kiwi");
10231     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10232     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10233     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10234     ok(size == 0, "Expected 0, got %d\n", size);
10235
10236     /* try SubDir */
10237     size = MAX_PATH;
10238     lstrcpyA(path, "kiwi");
10239     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10240     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10241     ok(!lstrcmpA(path, "kiwi"),
10242        "Expected path to be unchanged, got \"%s\"\n", path);
10243     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10244
10245     /* try SubDir2 */
10246     size = MAX_PATH;
10247     lstrcpyA(path, "kiwi");
10248     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10249     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10250     ok(!lstrcmpA(path, "kiwi"),
10251        "Expected path to be unchanged, got \"%s\"\n", path);
10252     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10253
10254     r = MsiDoAction(hpkg, "CostInitialize");
10255     ok(r == ERROR_SUCCESS, "cost init failed\n");
10256
10257     /* try TARGETDIR after CostInitialize */
10258     size = MAX_PATH;
10259     lstrcpyA(path, "kiwi");
10260     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10261     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10262     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10263     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10264
10265     /* try SourceDir after CostInitialize */
10266     size = MAX_PATH;
10267     lstrcpyA(path, "kiwi");
10268     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10269     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10270     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10271     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10272
10273     /* try SOURCEDIR after CostInitialize */
10274     size = MAX_PATH;
10275     lstrcpyA(path, "kiwi");
10276     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10277     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10278     ok(!lstrcmpA(path, "kiwi"),
10279        "Expected path to be unchanged, got \"%s\"\n", path);
10280     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10281
10282     /* source path does not exist, but the property exists */
10283     size = MAX_PATH;
10284     lstrcpyA(path, "kiwi");
10285     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10286     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10287     todo_wine
10288     {
10289         ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10290         ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10291     }
10292
10293     /* try SubDir after CostInitialize */
10294     size = MAX_PATH;
10295     lstrcpyA(path, "kiwi");
10296     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10297     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10298     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10299     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10300
10301     /* try SubDir2 after CostInitialize */
10302     size = MAX_PATH;
10303     lstrcpyA(path, "kiwi");
10304     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10305     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10306     ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10307     ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10308
10309     r = MsiDoAction(hpkg, "ResolveSource");
10310     ok(r == ERROR_SUCCESS, "file cost failed\n");
10311
10312     /* try TARGETDIR after ResolveSource */
10313     size = MAX_PATH;
10314     lstrcpyA(path, "kiwi");
10315     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10316     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10317     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10318     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10319
10320     /* try SourceDir after ResolveSource */
10321     size = MAX_PATH;
10322     lstrcpyA(path, "kiwi");
10323     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10324     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10325     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10326     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10327
10328     /* try SOURCEDIR after ResolveSource */
10329     size = MAX_PATH;
10330     lstrcpyA(path, "kiwi");
10331     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10332     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10333     ok(!lstrcmpA(path, "kiwi"),
10334        "Expected path to be unchanged, got \"%s\"\n", path);
10335     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10336
10337     /* source path does not exist, but the property exists */
10338     size = MAX_PATH;
10339     lstrcpyA(path, "kiwi");
10340     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10341     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10342     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10343     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10344
10345     /* try SubDir after ResolveSource */
10346     size = MAX_PATH;
10347     lstrcpyA(path, "kiwi");
10348     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10349     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10350     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10351     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10352
10353     /* try SubDir2 after ResolveSource */
10354     size = MAX_PATH;
10355     lstrcpyA(path, "kiwi");
10356     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10357     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10358     ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10359     ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10360
10361     r = MsiDoAction(hpkg, "FileCost");
10362     ok(r == ERROR_SUCCESS, "file cost failed\n");
10363
10364     /* try TARGETDIR after FileCost */
10365     size = MAX_PATH;
10366     lstrcpyA(path, "kiwi");
10367     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10368     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10369     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10370     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10371
10372     /* try SourceDir after FileCost */
10373     size = MAX_PATH;
10374     lstrcpyA(path, "kiwi");
10375     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10376     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10377     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10378     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10379
10380     /* try SOURCEDIR after FileCost */
10381     size = MAX_PATH;
10382     lstrcpyA(path, "kiwi");
10383     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10384     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10385     ok(!lstrcmpA(path, "kiwi"),
10386        "Expected path to be unchanged, got \"%s\"\n", path);
10387     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10388
10389     /* source path does not exist, but the property exists */
10390     size = MAX_PATH;
10391     lstrcpyA(path, "kiwi");
10392     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10393     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10394     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10395     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10396
10397     /* try SubDir after FileCost */
10398     size = MAX_PATH;
10399     lstrcpyA(path, "kiwi");
10400     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10401     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10402     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10403     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10404
10405     /* try SubDir2 after FileCost */
10406     size = MAX_PATH;
10407     lstrcpyA(path, "kiwi");
10408     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10409     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10410     ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10411     ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10412
10413     r = MsiDoAction(hpkg, "CostFinalize");
10414     ok(r == ERROR_SUCCESS, "file cost failed\n");
10415
10416     /* try TARGETDIR after CostFinalize */
10417     size = MAX_PATH;
10418     lstrcpyA(path, "kiwi");
10419     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10420     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10421     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10422     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10423
10424     /* try SourceDir after CostFinalize */
10425     size = MAX_PATH;
10426     lstrcpyA(path, "kiwi");
10427     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10428     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10429     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10430     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10431
10432     /* try SOURCEDIR after CostFinalize */
10433     size = MAX_PATH;
10434     lstrcpyA(path, "kiwi");
10435     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10436     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10437     ok(!lstrcmpA(path, "kiwi"),
10438        "Expected path to be unchanged, got \"%s\"\n", path);
10439     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10440
10441     /* source path does not exist, but the property exists */
10442     size = MAX_PATH;
10443     lstrcpyA(path, "kiwi");
10444     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10445     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10446     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10447     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10448
10449     /* try SubDir after CostFinalize */
10450     size = MAX_PATH;
10451     lstrcpyA(path, "kiwi");
10452     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10453     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10454     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10455     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10456
10457     /* try SubDir2 after CostFinalize */
10458     size = MAX_PATH;
10459     lstrcpyA(path, "kiwi");
10460     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10461     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10462     ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10463     ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10464
10465     /* nonexistent directory */
10466     size = MAX_PATH;
10467     lstrcpyA(path, "kiwi");
10468     r = MsiGetSourcePath(hpkg, "IDontExist", path, &size);
10469     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10470     ok(!lstrcmpA(path, "kiwi"),
10471        "Expected path to be unchanged, got \"%s\"\n", path);
10472     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10473
10474     /* NULL szPathBuf */
10475     size = MAX_PATH;
10476     r = MsiGetSourcePath(hpkg, "SourceDir", NULL, &size);
10477     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10478     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10479
10480     /* NULL pcchPathBuf */
10481     lstrcpyA(path, "kiwi");
10482     r = MsiGetSourcePath(hpkg, "SourceDir", path, NULL);
10483     ok(r == ERROR_INVALID_PARAMETER,
10484        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
10485     ok(!lstrcmpA(path, "kiwi"),
10486        "Expected path to be unchanged, got \"%s\"\n", path);
10487
10488     /* pcchPathBuf is 0 */
10489     size = 0;
10490     lstrcpyA(path, "kiwi");
10491     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10492     ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
10493     ok(!lstrcmpA(path, "kiwi"),
10494        "Expected path to be unchanged, got \"%s\"\n", path);
10495     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10496
10497     /* pcchPathBuf does not have room for NULL terminator */
10498     size = lstrlenA(cwd);
10499     lstrcpyA(path, "kiwi");
10500     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10501     ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
10502     ok(!strncmp(path, cwd, lstrlenA(cwd) - 1),
10503        "Expected path with no backslash, got \"%s\"\n", path);
10504     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10505
10506     /* pcchPathBuf has room for NULL terminator */
10507     size = lstrlenA(cwd) + 1;
10508     lstrcpyA(path, "kiwi");
10509     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10510     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10511     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10512     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10513
10514     /* remove property */
10515     r = MsiSetProperty(hpkg, "SourceDir", NULL);
10516     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10517
10518     /* try SourceDir again */
10519     size = MAX_PATH;
10520     lstrcpyA(path, "kiwi");
10521     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10522     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10523     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10524     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10525
10526     /* set property to a valid directory */
10527     r = MsiSetProperty(hpkg, "SOURCEDIR", cwd);
10528     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10529
10530     /* try SOURCEDIR again */
10531     size = MAX_PATH;
10532     lstrcpyA(path, "kiwi");
10533     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10534     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10535     ok(!lstrcmpA(path, "kiwi"),
10536        "Expected path to be unchanged, got \"%s\"\n", path);
10537     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10538
10539     MsiCloseHandle(hpkg);
10540
10541     /* compressed source */
10542
10543     r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
10544     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10545
10546     set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed);
10547
10548     r = package_from_db(hdb, &hpkg);
10549     ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
10550
10551     /* try TARGETDIR */
10552     size = MAX_PATH;
10553     lstrcpyA(path, "kiwi");
10554     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10555     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10556     ok(!lstrcmpA(path, "kiwi"),
10557        "Expected path to be unchanged, got \"%s\"\n", path);
10558     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10559
10560     /* try SourceDir */
10561     size = MAX_PATH;
10562     lstrcpyA(path, "kiwi");
10563     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10564     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10565     ok(!lstrcmpA(path, "kiwi"),
10566        "Expected path to be unchanged, got \"%s\"\n", path);
10567     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10568
10569     /* try SOURCEDIR */
10570     size = MAX_PATH;
10571     lstrcpyA(path, "kiwi");
10572     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10573     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10574     ok(!lstrcmpA(path, "kiwi"),
10575        "Expected path to be unchanged, got \"%s\"\n", path);
10576     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10577
10578     /* source path nor the property exist */
10579     size = MAX_PATH;
10580     lstrcpyA(path, "kiwi");
10581     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10582     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10583     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10584     ok(size == 0, "Expected 0, got %d\n", size);
10585
10586     /* try SubDir */
10587     size = MAX_PATH;
10588     lstrcpyA(path, "kiwi");
10589     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10590     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10591     ok(!lstrcmpA(path, "kiwi"),
10592        "Expected path to be unchanged, got \"%s\"\n", path);
10593     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10594
10595     /* try SubDir2 */
10596     size = MAX_PATH;
10597     lstrcpyA(path, "kiwi");
10598     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10599     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10600     ok(!lstrcmpA(path, "kiwi"),
10601        "Expected path to be unchanged, got \"%s\"\n", path);
10602     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10603
10604     r = MsiDoAction(hpkg, "CostInitialize");
10605     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10606
10607     /* try TARGETDIR after CostInitialize */
10608     size = MAX_PATH;
10609     lstrcpyA(path, "kiwi");
10610     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10611     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10612     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10613     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10614
10615     /* try SourceDir after CostInitialize */
10616     size = MAX_PATH;
10617     lstrcpyA(path, "kiwi");
10618     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10619     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10620     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10621     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10622
10623     /* try SOURCEDIR after CostInitialize */
10624     size = MAX_PATH;
10625     lstrcpyA(path, "kiwi");
10626     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10627     todo_wine
10628     {
10629         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10630         ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10631         ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10632     }
10633
10634     /* source path does not exist, but the property exists */
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, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10642         ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10643     }
10644
10645     /* try SubDir after CostInitialize */
10646     size = MAX_PATH;
10647     lstrcpyA(path, "kiwi");
10648     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10649     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10650     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10651     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10652
10653     /* try SubDir2 after CostInitialize */
10654     size = MAX_PATH;
10655     lstrcpyA(path, "kiwi");
10656     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10657     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10658     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10659     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10660
10661     r = MsiDoAction(hpkg, "ResolveSource");
10662     ok(r == ERROR_SUCCESS, "file cost failed\n");
10663
10664     /* try TARGETDIR after ResolveSource */
10665     size = MAX_PATH;
10666     lstrcpyA(path, "kiwi");
10667     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10668     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10669     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10670     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10671
10672     /* try SourceDir after ResolveSource */
10673     size = MAX_PATH;
10674     lstrcpyA(path, "kiwi");
10675     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10676     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10677     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10678     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10679
10680     /* try SOURCEDIR after ResolveSource */
10681     size = MAX_PATH;
10682     lstrcpyA(path, "kiwi");
10683     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10684     todo_wine
10685     {
10686         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10687         ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10688         ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10689     }
10690
10691     /* source path and the property exist */
10692     size = MAX_PATH;
10693     lstrcpyA(path, "kiwi");
10694     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10695     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10696     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10697     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10698
10699     /* try SubDir after ResolveSource */
10700     size = MAX_PATH;
10701     lstrcpyA(path, "kiwi");
10702     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10703     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10704     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10705     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10706
10707     /* try SubDir2 after ResolveSource */
10708     size = MAX_PATH;
10709     lstrcpyA(path, "kiwi");
10710     r = MsiGetSourcePath(hpkg, "SubDir2", 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     r = MsiDoAction(hpkg, "FileCost");
10716     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10717
10718     /* try TARGETDIR after CostFinalize */
10719     size = MAX_PATH;
10720     lstrcpyA(path, "kiwi");
10721     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10722     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10723     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10724     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10725
10726     /* try SourceDir after CostFinalize */
10727     size = MAX_PATH;
10728     lstrcpyA(path, "kiwi");
10729     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10730     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10731     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10732     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10733
10734     /* try SOURCEDIR after CostFinalize */
10735     size = MAX_PATH;
10736     lstrcpyA(path, "kiwi");
10737     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10738     todo_wine
10739     {
10740         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10741         ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10742         ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10743     }
10744
10745     /* source path and the property exist */
10746     size = MAX_PATH;
10747     lstrcpyA(path, "kiwi");
10748     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10749     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10750     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10751     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10752
10753     /* try SubDir after CostFinalize */
10754     size = MAX_PATH;
10755     lstrcpyA(path, "kiwi");
10756     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10757     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10758     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10759     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10760
10761     /* try SubDir2 after CostFinalize */
10762     size = MAX_PATH;
10763     lstrcpyA(path, "kiwi");
10764     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10765     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10766     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10767     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10768
10769     r = MsiDoAction(hpkg, "CostFinalize");
10770     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10771
10772     /* try TARGETDIR after CostFinalize */
10773     size = MAX_PATH;
10774     lstrcpyA(path, "kiwi");
10775     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10776     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10777     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10778     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10779
10780     /* try SourceDir after CostFinalize */
10781     size = MAX_PATH;
10782     lstrcpyA(path, "kiwi");
10783     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10784     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10785     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10786     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10787
10788     /* try SOURCEDIR after CostFinalize */
10789     size = MAX_PATH;
10790     lstrcpyA(path, "kiwi");
10791     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10792     todo_wine
10793     {
10794         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10795         ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10796         ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10797     }
10798
10799     /* source path and the property exist */
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     /* try SubDir after CostFinalize */
10808     size = MAX_PATH;
10809     lstrcpyA(path, "kiwi");
10810     r = MsiGetSourcePath(hpkg, "SubDir", 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     /* try SubDir2 after CostFinalize */
10816     size = MAX_PATH;
10817     lstrcpyA(path, "kiwi");
10818     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10819     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10820     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10821     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10822
10823     MsiCloseHandle(hpkg);
10824     DeleteFile(msifile);
10825 }
10826
10827 static void test_shortlongsource(void)
10828 {
10829     MSIHANDLE hdb, hpkg;
10830     CHAR path[MAX_PATH];
10831     CHAR cwd[MAX_PATH];
10832     CHAR subsrc[MAX_PATH];
10833     DWORD size;
10834     UINT r;
10835
10836     lstrcpyA(cwd, CURR_DIR);
10837     lstrcatA(cwd, "\\");
10838
10839     lstrcpyA(subsrc, cwd);
10840     lstrcatA(subsrc, "long");
10841     lstrcatA(subsrc, "\\");
10842
10843     /* long file names */
10844
10845     hdb = create_package_db();
10846     ok( hdb, "failed to create database\n");
10847
10848     set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
10849
10850     r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
10851     ok(r == S_OK, "failed\n");
10852
10853     r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'short|long'");
10854     ok(r == S_OK, "failed\n");
10855
10856     /* CostInitialize:short */
10857     r = add_directory_entry(hdb, "'SubDir2', 'TARGETDIR', 'one|two'");
10858     ok(r == S_OK, "failed\n");
10859
10860     /* CostInitialize:long */
10861     r = add_directory_entry(hdb, "'SubDir3', 'TARGETDIR', 'three|four'");
10862     ok(r == S_OK, "failed\n");
10863
10864     /* FileCost:short */
10865     r = add_directory_entry(hdb, "'SubDir4', 'TARGETDIR', 'five|six'");
10866     ok(r == S_OK, "failed\n");
10867
10868     /* FileCost:long */
10869     r = add_directory_entry(hdb, "'SubDir5', 'TARGETDIR', 'seven|eight'");
10870     ok(r == S_OK, "failed\n");
10871
10872     /* CostFinalize:short */
10873     r = add_directory_entry(hdb, "'SubDir6', 'TARGETDIR', 'nine|ten'");
10874     ok(r == S_OK, "failed\n");
10875
10876     /* CostFinalize:long */
10877     r = add_directory_entry(hdb, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
10878     ok(r == S_OK, "failed\n");
10879
10880     MsiDatabaseCommit(hdb);
10881
10882     r = package_from_db(hdb, &hpkg);
10883     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
10884     {
10885         skip("Not enough rights to perform tests\n");
10886         DeleteFile(msifile);
10887         return;
10888     }
10889     ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
10890
10891     MsiCloseHandle(hdb);
10892
10893     CreateDirectoryA("one", NULL);
10894     CreateDirectoryA("four", NULL);
10895
10896     r = MsiDoAction(hpkg, "CostInitialize");
10897     ok(r == ERROR_SUCCESS, "file cost failed\n");
10898
10899     CreateDirectory("five", NULL);
10900     CreateDirectory("eight", NULL);
10901
10902     r = MsiDoAction(hpkg, "FileCost");
10903     ok(r == ERROR_SUCCESS, "file cost failed\n");
10904
10905     CreateDirectory("nine", NULL);
10906     CreateDirectory("twelve", NULL);
10907
10908     r = MsiDoAction(hpkg, "CostFinalize");
10909     ok(r == ERROR_SUCCESS, "file cost failed\n");
10910
10911     /* neither short nor long source directories exist */
10912     size = MAX_PATH;
10913     lstrcpyA(path, "kiwi");
10914     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10915     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10916     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10917     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10918
10919     CreateDirectoryA("short", NULL);
10920
10921     /* short source directory exists */
10922     size = MAX_PATH;
10923     lstrcpyA(path, "kiwi");
10924     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10925     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10926     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10927     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10928
10929     CreateDirectoryA("long", NULL);
10930
10931     /* both short and long source directories exist */
10932     size = MAX_PATH;
10933     lstrcpyA(path, "kiwi");
10934     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10935     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10936     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10937     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10938
10939     lstrcpyA(subsrc, cwd);
10940     lstrcatA(subsrc, "two");
10941     lstrcatA(subsrc, "\\");
10942
10943     /* short dir exists before CostInitialize */
10944     size = MAX_PATH;
10945     lstrcpyA(path, "kiwi");
10946     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10947     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10948     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10949     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10950
10951     lstrcpyA(subsrc, cwd);
10952     lstrcatA(subsrc, "four");
10953     lstrcatA(subsrc, "\\");
10954
10955     /* long dir exists before CostInitialize */
10956     size = MAX_PATH;
10957     lstrcpyA(path, "kiwi");
10958     r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
10959     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10960     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10961     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10962
10963     lstrcpyA(subsrc, cwd);
10964     lstrcatA(subsrc, "six");
10965     lstrcatA(subsrc, "\\");
10966
10967     /* short dir exists before FileCost */
10968     size = MAX_PATH;
10969     lstrcpyA(path, "kiwi");
10970     r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
10971     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10972     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10973     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10974
10975     lstrcpyA(subsrc, cwd);
10976     lstrcatA(subsrc, "eight");
10977     lstrcatA(subsrc, "\\");
10978
10979     /* long dir exists before FileCost */
10980     size = MAX_PATH;
10981     lstrcpyA(path, "kiwi");
10982     r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
10983     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10984     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10985     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10986
10987     lstrcpyA(subsrc, cwd);
10988     lstrcatA(subsrc, "ten");
10989     lstrcatA(subsrc, "\\");
10990
10991     /* short dir exists before CostFinalize */
10992     size = MAX_PATH;
10993     lstrcpyA(path, "kiwi");
10994     r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
10995     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10996     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10997     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10998
10999     lstrcpyA(subsrc, cwd);
11000     lstrcatA(subsrc, "twelve");
11001     lstrcatA(subsrc, "\\");
11002
11003     /* long dir exists before CostFinalize */
11004     size = MAX_PATH;
11005     lstrcpyA(path, "kiwi");
11006     r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
11007     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11008     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11009     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11010
11011     MsiCloseHandle(hpkg);
11012     RemoveDirectoryA("short");
11013     RemoveDirectoryA("long");
11014     RemoveDirectoryA("one");
11015     RemoveDirectoryA("four");
11016     RemoveDirectoryA("five");
11017     RemoveDirectoryA("eight");
11018     RemoveDirectoryA("nine");
11019     RemoveDirectoryA("twelve");
11020
11021     /* short file names */
11022
11023     r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
11024     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11025
11026     set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
11027
11028     r = package_from_db(hdb, &hpkg);
11029     ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
11030
11031     MsiCloseHandle(hdb);
11032
11033     CreateDirectoryA("one", NULL);
11034     CreateDirectoryA("four", NULL);
11035
11036     r = MsiDoAction(hpkg, "CostInitialize");
11037     ok(r == ERROR_SUCCESS, "file cost failed\n");
11038
11039     CreateDirectory("five", NULL);
11040     CreateDirectory("eight", NULL);
11041
11042     r = MsiDoAction(hpkg, "FileCost");
11043     ok(r == ERROR_SUCCESS, "file cost failed\n");
11044
11045     CreateDirectory("nine", NULL);
11046     CreateDirectory("twelve", NULL);
11047
11048     r = MsiDoAction(hpkg, "CostFinalize");
11049     ok(r == ERROR_SUCCESS, "file cost failed\n");
11050
11051     lstrcpyA(subsrc, cwd);
11052     lstrcatA(subsrc, "short");
11053     lstrcatA(subsrc, "\\");
11054
11055     /* neither short nor long source directories exist */
11056     size = MAX_PATH;
11057     lstrcpyA(path, "kiwi");
11058     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11059     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11060     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11061     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11062
11063     CreateDirectoryA("short", NULL);
11064
11065     /* short source directory exists */
11066     size = MAX_PATH;
11067     lstrcpyA(path, "kiwi");
11068     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11069     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11070     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11071     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11072
11073     CreateDirectoryA("long", NULL);
11074
11075     /* both short and long source directories exist */
11076     size = MAX_PATH;
11077     lstrcpyA(path, "kiwi");
11078     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11079     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11080     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11081     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11082
11083     lstrcpyA(subsrc, cwd);
11084     lstrcatA(subsrc, "one");
11085     lstrcatA(subsrc, "\\");
11086
11087     /* short dir exists before CostInitialize */
11088     size = MAX_PATH;
11089     lstrcpyA(path, "kiwi");
11090     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11091     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11092     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11093     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11094
11095     lstrcpyA(subsrc, cwd);
11096     lstrcatA(subsrc, "three");
11097     lstrcatA(subsrc, "\\");
11098
11099     /* long dir exists before CostInitialize */
11100     size = MAX_PATH;
11101     lstrcpyA(path, "kiwi");
11102     r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
11103     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11104     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11105     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11106
11107     lstrcpyA(subsrc, cwd);
11108     lstrcatA(subsrc, "five");
11109     lstrcatA(subsrc, "\\");
11110
11111     /* short dir exists before FileCost */
11112     size = MAX_PATH;
11113     lstrcpyA(path, "kiwi");
11114     r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
11115     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11116     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11117     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11118
11119     lstrcpyA(subsrc, cwd);
11120     lstrcatA(subsrc, "seven");
11121     lstrcatA(subsrc, "\\");
11122
11123     /* long dir exists before FileCost */
11124     size = MAX_PATH;
11125     lstrcpyA(path, "kiwi");
11126     r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
11127     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11128     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11129     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11130
11131     lstrcpyA(subsrc, cwd);
11132     lstrcatA(subsrc, "nine");
11133     lstrcatA(subsrc, "\\");
11134
11135     /* short dir exists before CostFinalize */
11136     size = MAX_PATH;
11137     lstrcpyA(path, "kiwi");
11138     r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
11139     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11140     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11141     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11142
11143     lstrcpyA(subsrc, cwd);
11144     lstrcatA(subsrc, "eleven");
11145     lstrcatA(subsrc, "\\");
11146
11147     /* long dir exists before CostFinalize */
11148     size = MAX_PATH;
11149     lstrcpyA(path, "kiwi");
11150     r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
11151     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11152     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11153     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11154
11155     MsiCloseHandle(hpkg);
11156     RemoveDirectoryA("short");
11157     RemoveDirectoryA("long");
11158     RemoveDirectoryA("one");
11159     RemoveDirectoryA("four");
11160     RemoveDirectoryA("five");
11161     RemoveDirectoryA("eight");
11162     RemoveDirectoryA("nine");
11163     RemoveDirectoryA("twelve");
11164     DeleteFileA(msifile);
11165 }
11166
11167 static void test_sourcedir(void)
11168 {
11169     MSIHANDLE hdb, hpkg;
11170     CHAR package[12];
11171     CHAR path[MAX_PATH];
11172     CHAR cwd[MAX_PATH];
11173     CHAR subsrc[MAX_PATH];
11174     DWORD size;
11175     UINT r;
11176
11177     lstrcpyA(cwd, CURR_DIR);
11178     lstrcatA(cwd, "\\");
11179
11180     lstrcpyA(subsrc, cwd);
11181     lstrcatA(subsrc, "long");
11182     lstrcatA(subsrc, "\\");
11183
11184     hdb = create_package_db();
11185     ok( hdb, "failed to create database\n");
11186
11187     r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
11188     ok(r == S_OK, "failed\n");
11189
11190     sprintf(package, "#%u", hdb);
11191     r = MsiOpenPackage(package, &hpkg);
11192     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
11193     {
11194         skip("Not enough rights to perform tests\n");
11195         goto error;
11196     }
11197     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11198
11199     /* properties only */
11200
11201     /* SourceDir prop */
11202     size = MAX_PATH;
11203     lstrcpyA(path, "kiwi");
11204     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11205     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11206     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11207     ok(size == 0, "Expected 0, got %d\n", size);
11208
11209     /* SOURCEDIR prop */
11210     size = MAX_PATH;
11211     lstrcpyA(path, "kiwi");
11212     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11213     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11214     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11215     ok(size == 0, "Expected 0, got %d\n", size);
11216
11217     r = MsiDoAction(hpkg, "CostInitialize");
11218     ok(r == ERROR_SUCCESS, "file cost failed\n");
11219
11220     /* SourceDir after CostInitialize */
11221     size = MAX_PATH;
11222     lstrcpyA(path, "kiwi");
11223     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11224     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11225     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11226     ok(size == 0, "Expected 0, got %d\n", size);
11227
11228     /* SOURCEDIR after CostInitialize */
11229     size = MAX_PATH;
11230     lstrcpyA(path, "kiwi");
11231     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11232     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11233     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11234     ok(size == 0, "Expected 0, got %d\n", size);
11235
11236     r = MsiDoAction(hpkg, "FileCost");
11237     ok(r == ERROR_SUCCESS, "file cost failed\n");
11238
11239     /* SourceDir after FileCost */
11240     size = MAX_PATH;
11241     lstrcpyA(path, "kiwi");
11242     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11243     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11244     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11245     ok(size == 0, "Expected 0, got %d\n", size);
11246
11247     /* SOURCEDIR after FileCost */
11248     size = MAX_PATH;
11249     lstrcpyA(path, "kiwi");
11250     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11251     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11252     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11253     ok(size == 0, "Expected 0, got %d\n", size);
11254
11255     r = MsiDoAction(hpkg, "CostFinalize");
11256     ok(r == ERROR_SUCCESS, "file cost failed\n");
11257
11258     /* SourceDir after CostFinalize */
11259     size = MAX_PATH;
11260     lstrcpyA(path, "kiwi");
11261     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11262     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11263     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11264     ok(size == 0, "Expected 0, got %d\n", size);
11265
11266     /* SOURCEDIR after CostFinalize */
11267     size = MAX_PATH;
11268     lstrcpyA(path, "kiwi");
11269     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11270     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11271     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11272     ok(size == 0, "Expected 0, got %d\n", size);
11273
11274     r = MsiDoAction(hpkg, "ResolveSource");
11275     ok(r == ERROR_SUCCESS, "file cost failed\n");
11276
11277     /* SourceDir after ResolveSource */
11278     size = MAX_PATH;
11279     lstrcpyA(path, "kiwi");
11280     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11281     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11282     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11283     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11284
11285     /* SOURCEDIR after ResolveSource */
11286     size = MAX_PATH;
11287     lstrcpyA(path, "kiwi");
11288     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11289     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11290     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11291     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11292
11293     /* random casing */
11294     size = MAX_PATH;
11295     lstrcpyA(path, "kiwi");
11296     r = MsiGetProperty(hpkg, "SoUrCeDiR", path, &size);
11297     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11298     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11299     ok(size == 0, "Expected 0, got %d\n", size);
11300
11301     MsiCloseHandle(hpkg);
11302
11303     /* reset the package state */
11304     sprintf(package, "#%i", hdb);
11305     r = MsiOpenPackage(package, &hpkg);
11306     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11307
11308     /* test how MsiGetSourcePath affects the properties */
11309
11310     /* SourceDir prop */
11311     size = MAX_PATH;
11312     lstrcpyA(path, "kiwi");
11313     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11314     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11315     todo_wine
11316     {
11317         ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11318         ok(size == 0, "Expected 0, got %d\n", size);
11319     }
11320
11321     size = MAX_PATH;
11322     lstrcpyA(path, "kiwi");
11323     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11324     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11325     ok(!lstrcmpA(path, "kiwi"),
11326        "Expected path to be unchanged, got \"%s\"\n", path);
11327     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11328
11329     /* SourceDir after MsiGetSourcePath */
11330     size = MAX_PATH;
11331     lstrcpyA(path, "kiwi");
11332     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11333     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11334     todo_wine
11335     {
11336         ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11337         ok(size == 0, "Expected 0, got %d\n", size);
11338     }
11339
11340     /* SOURCEDIR prop */
11341     size = MAX_PATH;
11342     lstrcpyA(path, "kiwi");
11343     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11344     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11345     todo_wine
11346     {
11347         ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11348         ok(size == 0, "Expected 0, got %d\n", size);
11349     }
11350
11351     size = MAX_PATH;
11352     lstrcpyA(path, "kiwi");
11353     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11354     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11355     ok(!lstrcmpA(path, "kiwi"),
11356        "Expected path to be unchanged, got \"%s\"\n", path);
11357     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11358
11359     /* SOURCEDIR prop after MsiGetSourcePath */
11360     size = MAX_PATH;
11361     lstrcpyA(path, "kiwi");
11362     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11363     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11364     todo_wine
11365     {
11366         ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11367         ok(size == 0, "Expected 0, got %d\n", size);
11368     }
11369
11370     r = MsiDoAction(hpkg, "CostInitialize");
11371     ok(r == ERROR_SUCCESS, "file cost failed\n");
11372
11373     /* SourceDir after CostInitialize */
11374     size = MAX_PATH;
11375     lstrcpyA(path, "kiwi");
11376     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11377     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11378     todo_wine
11379     {
11380         ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11381         ok(size == 0, "Expected 0, got %d\n", size);
11382     }
11383
11384     size = MAX_PATH;
11385     lstrcpyA(path, "kiwi");
11386     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11387     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11388     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11389     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11390
11391     /* SourceDir after MsiGetSourcePath */
11392     size = MAX_PATH;
11393     lstrcpyA(path, "kiwi");
11394     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11395     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11396     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11397     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11398
11399     /* SOURCEDIR after CostInitialize */
11400     size = MAX_PATH;
11401     lstrcpyA(path, "kiwi");
11402     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11403     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11404     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11405     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11406
11407     /* SOURCEDIR source path still does not exist */
11408     size = MAX_PATH;
11409     lstrcpyA(path, "kiwi");
11410     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11411     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11412     ok(!lstrcmpA(path, "kiwi"),
11413        "Expected path to be unchanged, got \"%s\"\n", path);
11414     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11415
11416     r = MsiDoAction(hpkg, "FileCost");
11417     ok(r == ERROR_SUCCESS, "file cost failed\n");
11418
11419     /* SourceDir after FileCost */
11420     size = MAX_PATH;
11421     lstrcpyA(path, "kiwi");
11422     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11423     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11424     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11425     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11426
11427     /* SOURCEDIR after FileCost */
11428     size = MAX_PATH;
11429     lstrcpyA(path, "kiwi");
11430     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11431     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11432     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11433     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11434
11435     /* SOURCEDIR source path still does not exist */
11436     size = MAX_PATH;
11437     lstrcpyA(path, "kiwi");
11438     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11439     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11440     ok(!lstrcmpA(path, "kiwi"),
11441        "Expected path to be unchanged, got \"%s\"\n", path);
11442     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11443
11444     r = MsiDoAction(hpkg, "CostFinalize");
11445     ok(r == ERROR_SUCCESS, "file cost failed\n");
11446
11447     /* SourceDir after CostFinalize */
11448     size = MAX_PATH;
11449     lstrcpyA(path, "kiwi");
11450     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11451     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11452     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11453     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11454
11455     /* SOURCEDIR after CostFinalize */
11456     size = MAX_PATH;
11457     lstrcpyA(path, "kiwi");
11458     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11459     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11460     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11461     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11462
11463     /* SOURCEDIR source path still does not exist */
11464     size = MAX_PATH;
11465     lstrcpyA(path, "kiwi");
11466     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11467     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11468     ok(!lstrcmpA(path, "kiwi"),
11469        "Expected path to be unchanged, got \"%s\"\n", path);
11470     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11471
11472     r = MsiDoAction(hpkg, "ResolveSource");
11473     ok(r == ERROR_SUCCESS, "file cost failed\n");
11474
11475     /* SourceDir after ResolveSource */
11476     size = MAX_PATH;
11477     lstrcpyA(path, "kiwi");
11478     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11479     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11480     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11481     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11482
11483     /* SOURCEDIR after ResolveSource */
11484     size = MAX_PATH;
11485     lstrcpyA(path, "kiwi");
11486     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11487     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11488     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11489     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11490
11491     /* SOURCEDIR source path still does not exist */
11492     size = MAX_PATH;
11493     lstrcpyA(path, "kiwi");
11494     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11495     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11496     ok(!lstrcmpA(path, "kiwi"),
11497        "Expected path to be unchanged, got \"%s\"\n", path);
11498     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11499
11500     MsiCloseHandle(hpkg);
11501
11502 error:
11503     MsiCloseHandle(hdb);
11504     DeleteFileA(msifile);
11505 }
11506
11507 struct access_res
11508 {
11509     BOOL gothandle;
11510     DWORD lasterr;
11511     BOOL ignore;
11512 };
11513
11514 static const struct access_res create[16] =
11515 {
11516     { TRUE, ERROR_SUCCESS, TRUE },
11517     { TRUE, ERROR_SUCCESS, TRUE },
11518     { TRUE, ERROR_SUCCESS, FALSE },
11519     { TRUE, ERROR_SUCCESS, FALSE },
11520     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11521     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11522     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11523     { TRUE, ERROR_SUCCESS, FALSE },
11524     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11525     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11526     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11527     { TRUE, ERROR_SUCCESS, TRUE },
11528     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11529     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11530     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11531     { TRUE, ERROR_SUCCESS, TRUE }
11532 };
11533
11534 static const struct access_res create_commit[16] =
11535 {
11536     { TRUE, ERROR_SUCCESS, TRUE },
11537     { TRUE, ERROR_SUCCESS, TRUE },
11538     { TRUE, ERROR_SUCCESS, FALSE },
11539     { TRUE, ERROR_SUCCESS, FALSE },
11540     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11541     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11542     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11543     { TRUE, ERROR_SUCCESS, FALSE },
11544     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11545     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11546     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11547     { TRUE, ERROR_SUCCESS, TRUE },
11548     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11549     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11550     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11551     { TRUE, ERROR_SUCCESS, TRUE }
11552 };
11553
11554 static const struct access_res create_close[16] =
11555 {
11556     { TRUE, ERROR_SUCCESS, FALSE },
11557     { TRUE, ERROR_SUCCESS, FALSE },
11558     { TRUE, ERROR_SUCCESS, FALSE },
11559     { TRUE, ERROR_SUCCESS, FALSE },
11560     { TRUE, ERROR_SUCCESS, FALSE },
11561     { TRUE, ERROR_SUCCESS, FALSE },
11562     { TRUE, ERROR_SUCCESS, FALSE },
11563     { TRUE, ERROR_SUCCESS, FALSE },
11564     { TRUE, ERROR_SUCCESS, FALSE },
11565     { TRUE, ERROR_SUCCESS, FALSE },
11566     { TRUE, ERROR_SUCCESS, FALSE },
11567     { TRUE, ERROR_SUCCESS, FALSE },
11568     { TRUE, ERROR_SUCCESS, FALSE },
11569     { TRUE, ERROR_SUCCESS, FALSE },
11570     { TRUE, ERROR_SUCCESS, FALSE },
11571     { TRUE, ERROR_SUCCESS }
11572 };
11573
11574 static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line)
11575 {
11576     DWORD access = 0, share = 0;
11577     DWORD lasterr;
11578     HANDLE hfile;
11579     int i, j, idx = 0;
11580
11581     for (i = 0; i < 4; i++)
11582     {
11583         if (i == 0) access = 0;
11584         if (i == 1) access = GENERIC_READ;
11585         if (i == 2) access = GENERIC_WRITE;
11586         if (i == 3) access = GENERIC_READ | GENERIC_WRITE;
11587
11588         for (j = 0; j < 4; j++)
11589         {
11590             if (ares[idx].ignore)
11591                 continue;
11592
11593             if (j == 0) share = 0;
11594             if (j == 1) share = FILE_SHARE_READ;
11595             if (j == 2) share = FILE_SHARE_WRITE;
11596             if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE;
11597
11598             SetLastError(0xdeadbeef);
11599             hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
11600                                 FILE_ATTRIBUTE_NORMAL, 0);
11601             lasterr = GetLastError();
11602
11603             ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
11604                "(%d, handle, %d): Expected %d, got %d\n",
11605                line, idx, ares[idx].gothandle,
11606                (hfile != INVALID_HANDLE_VALUE));
11607
11608             ok(lasterr == ares[idx].lasterr ||
11609                lasterr == 0xdeadbeef, /* win9x */
11610                "(%d, lasterr, %d): Expected %d, got %d\n",
11611                line, idx, ares[idx].lasterr, lasterr);
11612
11613             CloseHandle(hfile);
11614             idx++;
11615         }
11616     }
11617 }
11618
11619 #define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
11620
11621 static void test_access(void)
11622 {
11623     MSIHANDLE hdb;
11624     UINT r;
11625
11626     r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
11627     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11628
11629     test_file_access(msifile, create);
11630
11631     r = MsiDatabaseCommit(hdb);
11632     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11633
11634     test_file_access(msifile, create_commit);
11635
11636     MsiCloseHandle(hdb);
11637
11638     test_file_access(msifile, create_close);
11639
11640     DeleteFileA(msifile);
11641
11642     r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATEDIRECT, &hdb);
11643     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11644
11645     test_file_access(msifile, create);
11646
11647     r = MsiDatabaseCommit(hdb);
11648     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11649
11650     test_file_access(msifile, create_commit);
11651
11652     MsiCloseHandle(hdb);
11653
11654     test_file_access(msifile, create_close);
11655
11656     DeleteFileA(msifile);
11657 }
11658
11659 static void test_emptypackage(void)
11660 {
11661     MSIHANDLE hpkg = 0, hdb = 0, hsuminfo = 0;
11662     MSIHANDLE hview = 0, hrec = 0;
11663     MSICONDITION condition;
11664     CHAR buffer[MAX_PATH];
11665     DWORD size;
11666     UINT r;
11667
11668     r = MsiOpenPackageA("", &hpkg);
11669     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
11670     {
11671         skip("Not enough rights to perform tests\n");
11672         return;
11673     }
11674     todo_wine
11675     {
11676         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11677     }
11678
11679     hdb = MsiGetActiveDatabase(hpkg);
11680     todo_wine
11681     {
11682         ok(hdb != 0, "Expected a valid database handle\n");
11683     }
11684
11685     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Tables`", &hview);
11686     todo_wine
11687     {
11688         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11689     }
11690     r = MsiViewExecute(hview, 0);
11691     todo_wine
11692     {
11693         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11694     }
11695
11696     r = MsiViewFetch(hview, &hrec);
11697     todo_wine
11698     {
11699         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11700     }
11701
11702     buffer[0] = 0;
11703     size = MAX_PATH;
11704     r = MsiRecordGetString(hrec, 1, buffer, &size);
11705     todo_wine
11706     {
11707         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11708         ok(!lstrcmpA(buffer, "_Property"),
11709            "Expected \"_Property\", got \"%s\"\n", buffer);
11710     }
11711
11712     MsiCloseHandle(hrec);
11713
11714     r = MsiViewFetch(hview, &hrec);
11715     todo_wine
11716     {
11717         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11718     }
11719
11720     size = MAX_PATH;
11721     r = MsiRecordGetString(hrec, 1, buffer, &size);
11722     todo_wine
11723     {
11724         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11725         ok(!lstrcmpA(buffer, "#_FolderCache"),
11726            "Expected \"_Property\", got \"%s\"\n", buffer);
11727     }
11728
11729     MsiCloseHandle(hrec);
11730     MsiViewClose(hview);
11731     MsiCloseHandle(hview);
11732
11733     condition = MsiDatabaseIsTablePersistentA(hdb, "_Property");
11734     todo_wine
11735     {
11736         ok(condition == MSICONDITION_FALSE,
11737            "Expected MSICONDITION_FALSE, got %d\n", condition);
11738     }
11739
11740     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
11741     todo_wine
11742     {
11743         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11744     }
11745     r = MsiViewExecute(hview, 0);
11746     todo_wine
11747     {
11748         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11749     }
11750
11751     /* _Property table is not empty */
11752     r = MsiViewFetch(hview, &hrec);
11753     todo_wine
11754     {
11755         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11756     }
11757
11758     MsiCloseHandle(hrec);
11759     MsiViewClose(hview);
11760     MsiCloseHandle(hview);
11761
11762     condition = MsiDatabaseIsTablePersistentA(hdb, "#_FolderCache");
11763     todo_wine
11764     {
11765         ok(condition == MSICONDITION_FALSE,
11766            "Expected MSICONDITION_FALSE, got %d\n", condition);
11767     }
11768
11769     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `#_FolderCache`", &hview);
11770     todo_wine
11771     {
11772         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11773     }
11774     r = MsiViewExecute(hview, 0);
11775     todo_wine
11776     {
11777         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11778     }
11779
11780     /* #_FolderCache is not empty */
11781     r = MsiViewFetch(hview, &hrec);
11782     todo_wine
11783     {
11784         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11785     }
11786
11787     MsiCloseHandle(hrec);
11788     MsiViewClose(hview);
11789     MsiCloseHandle(hview);
11790
11791     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Streams`", &hview);
11792     todo_wine
11793     {
11794         ok(r == ERROR_BAD_QUERY_SYNTAX,
11795            "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11796     }
11797
11798     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Storages`", &hview);
11799     todo_wine
11800     {
11801         ok(r == ERROR_BAD_QUERY_SYNTAX,
11802            "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11803     }
11804
11805     r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsuminfo);
11806     todo_wine
11807     {
11808         ok(r == ERROR_INSTALL_PACKAGE_INVALID,
11809            "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
11810     }
11811
11812     MsiCloseHandle(hsuminfo);
11813
11814     r = MsiDatabaseCommit(hdb);
11815     todo_wine
11816     {
11817         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11818     }
11819
11820     MsiCloseHandle(hdb);
11821     MsiCloseHandle(hpkg);
11822 }
11823
11824 static void test_MsiGetProductProperty(void)
11825 {
11826     MSIHANDLE hprod, hdb;
11827     CHAR val[MAX_PATH];
11828     CHAR path[MAX_PATH];
11829     CHAR query[MAX_PATH];
11830     CHAR keypath[MAX_PATH*2];
11831     CHAR prodcode[MAX_PATH];
11832     CHAR prod_squashed[MAX_PATH];
11833     HKEY prodkey, userkey, props;
11834     DWORD size;
11835     LONG res;
11836     UINT r;
11837     SC_HANDLE scm;
11838     REGSAM access = KEY_ALL_ACCESS;
11839     BOOL wow64;
11840
11841     scm = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
11842     if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
11843     {
11844         win_skip("Different registry keys on Win9x and WinMe\n");
11845         return;
11846     }
11847     CloseServiceHandle(scm);
11848
11849     GetCurrentDirectoryA(MAX_PATH, path);
11850     lstrcatA(path, "\\");
11851
11852     create_test_guid(prodcode, prod_squashed);
11853
11854     if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
11855         access |= KEY_WOW64_64KEY;
11856
11857     r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
11858     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11859
11860     r = MsiDatabaseCommit(hdb);
11861     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11862
11863     r = set_summary_info(hdb);
11864     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11865
11866     r = run_query(hdb,
11867             "CREATE TABLE `Directory` ( "
11868             "`Directory` CHAR(255) NOT NULL, "
11869             "`Directory_Parent` CHAR(255), "
11870             "`DefaultDir` CHAR(255) NOT NULL "
11871             "PRIMARY KEY `Directory`)");
11872     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11873
11874     r = run_query(hdb,
11875             "CREATE TABLE `Property` ( "
11876             "`Property` CHAR(72) NOT NULL, "
11877             "`Value` CHAR(255) "
11878             "PRIMARY KEY `Property`)");
11879     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11880
11881     sprintf(query, "INSERT INTO `Property` "
11882             "(`Property`, `Value`) "
11883             "VALUES( 'ProductCode', '%s' )", prodcode);
11884     r = run_query(hdb, query);
11885     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11886
11887     r = MsiDatabaseCommit(hdb);
11888     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11889
11890     MsiCloseHandle(hdb);
11891
11892     lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
11893     lstrcatA(keypath, prod_squashed);
11894
11895     res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
11896     if (res == ERROR_ACCESS_DENIED)
11897     {
11898         skip("Not enough rights to perform tests\n");
11899         DeleteFile(msifile);
11900         return;
11901     }
11902     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11903
11904     lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
11905     lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
11906     lstrcatA(keypath, prod_squashed);
11907
11908     res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
11909     if (res == ERROR_ACCESS_DENIED)
11910     {
11911         skip("Not enough rights to perform tests\n");
11912         RegDeleteKeyA(prodkey, "");
11913         RegCloseKey(prodkey);
11914         return;
11915     }
11916     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11917
11918     res = RegCreateKeyExA(userkey, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
11919     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11920
11921     lstrcpyA(val, path);
11922     lstrcatA(val, "\\");
11923     lstrcatA(val, msifile);
11924     res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
11925                          (const BYTE *)val, lstrlenA(val) + 1);
11926     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11927
11928     hprod = 0xdeadbeef;
11929     r = MsiOpenProductA(prodcode, &hprod);
11930     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11931     ok(hprod != 0 && hprod != 0xdeadbeef, "Expected a valid product handle\n");
11932
11933     /* hProduct is invalid */
11934     size = MAX_PATH;
11935     lstrcpyA(val, "apple");
11936     r = MsiGetProductPropertyA(0xdeadbeef, "ProductCode", val, &size);
11937     ok(r == ERROR_INVALID_HANDLE,
11938        "Expected ERROR_INVALID_HANDLE, got %d\n", r);
11939     ok(!lstrcmpA(val, "apple"),
11940        "Expected val to be unchanged, got \"%s\"\n", val);
11941     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11942
11943     /* szProperty is NULL */
11944     size = MAX_PATH;
11945     lstrcpyA(val, "apple");
11946     r = MsiGetProductPropertyA(hprod, NULL, val, &size);
11947     ok(r == ERROR_INVALID_PARAMETER,
11948        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11949     ok(!lstrcmpA(val, "apple"),
11950        "Expected val to be unchanged, got \"%s\"\n", val);
11951     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11952
11953     /* szProperty is empty */
11954     size = MAX_PATH;
11955     lstrcpyA(val, "apple");
11956     r = MsiGetProductPropertyA(hprod, "", val, &size);
11957     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11958     ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
11959     ok(size == 0, "Expected 0, got %d\n", size);
11960
11961     /* get the property */
11962     size = MAX_PATH;
11963     lstrcpyA(val, "apple");
11964     r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11965     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11966     ok(!lstrcmpA(val, prodcode),
11967        "Expected \"%s\", got \"%s\"\n", prodcode, val);
11968     ok(size == lstrlenA(prodcode),
11969        "Expected %d, got %d\n", lstrlenA(prodcode), size);
11970
11971     /* lpValueBuf is NULL */
11972     size = MAX_PATH;
11973     r = MsiGetProductPropertyA(hprod, "ProductCode", NULL, &size);
11974     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11975     ok(size == lstrlenA(prodcode),
11976        "Expected %d, got %d\n", lstrlenA(prodcode), size);
11977
11978     /* pcchValueBuf is NULL */
11979     lstrcpyA(val, "apple");
11980     r = MsiGetProductPropertyA(hprod, "ProductCode", val, NULL);
11981     ok(r == ERROR_INVALID_PARAMETER,
11982        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11983     ok(!lstrcmpA(val, "apple"),
11984        "Expected val to be unchanged, got \"%s\"\n", val);
11985     ok(size == lstrlenA(prodcode),
11986        "Expected %d, got %d\n", lstrlenA(prodcode), size);
11987
11988     /* pcchValueBuf is too small */
11989     size = 4;
11990     lstrcpyA(val, "apple");
11991     r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11992     ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
11993     ok(!strncmp(val, prodcode, 3),
11994        "Expected first 3 chars of \"%s\", got \"%s\"\n", prodcode, val);
11995     ok(size == lstrlenA(prodcode),
11996        "Expected %d, got %d\n", lstrlenA(prodcode), size);
11997
11998     /* pcchValueBuf does not leave room for NULL terminator */
11999     size = lstrlenA(prodcode);
12000     lstrcpyA(val, "apple");
12001     r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12002     ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
12003     ok(!strncmp(val, prodcode, lstrlenA(prodcode) - 1),
12004        "Expected first 37 chars of \"%s\", got \"%s\"\n", prodcode, val);
12005     ok(size == lstrlenA(prodcode),
12006        "Expected %d, got %d\n", lstrlenA(prodcode), size);
12007
12008     /* pcchValueBuf has enough room for NULL terminator */
12009     size = lstrlenA(prodcode) + 1;
12010     lstrcpyA(val, "apple");
12011     r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12012     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12013     ok(!lstrcmpA(val, prodcode),
12014        "Expected \"%s\", got \"%s\"\n", prodcode, val);
12015     ok(size == lstrlenA(prodcode),
12016        "Expected %d, got %d\n", lstrlenA(prodcode), size);
12017
12018     /* nonexistent property */
12019     size = MAX_PATH;
12020     lstrcpyA(val, "apple");
12021     r = MsiGetProductPropertyA(hprod, "IDontExist", val, &size);
12022     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12023     ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
12024     ok(size == 0, "Expected 0, got %d\n", size);
12025
12026     r = MsiSetPropertyA(hprod, "NewProperty", "value");
12027     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12028
12029     /* non-product property set */
12030     size = MAX_PATH;
12031     lstrcpyA(val, "apple");
12032     r = MsiGetProductPropertyA(hprod, "NewProperty", val, &size);
12033     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12034     ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
12035     ok(size == 0, "Expected 0, got %d\n", size);
12036
12037     r = MsiSetPropertyA(hprod, "ProductCode", "value");
12038     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12039
12040     /* non-product property that is also a product property set */
12041     size = MAX_PATH;
12042     lstrcpyA(val, "apple");
12043     r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12044     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12045     ok(!lstrcmpA(val, prodcode),
12046        "Expected \"%s\", got \"%s\"\n", prodcode, val);
12047     ok(size == lstrlenA(prodcode),
12048        "Expected %d, got %d\n", lstrlenA(prodcode), size);
12049
12050     MsiCloseHandle(hprod);
12051
12052     RegDeleteValueA(props, "LocalPackage");
12053     delete_key(props, "", access);
12054     RegCloseKey(props);
12055     delete_key(userkey, "", access);
12056     RegCloseKey(userkey);
12057     delete_key(prodkey, "", access);
12058     RegCloseKey(prodkey);
12059     DeleteFileA(msifile);
12060 }
12061
12062 static void test_MsiSetProperty(void)
12063 {
12064     MSIHANDLE hpkg, hdb, hrec;
12065     CHAR buf[MAX_PATH];
12066     LPCSTR query;
12067     DWORD size;
12068     UINT r;
12069
12070     r = package_from_db(create_package_db(), &hpkg);
12071     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
12072     {
12073         skip("Not enough rights to perform tests\n");
12074         DeleteFile(msifile);
12075         return;
12076     }
12077     ok(r == ERROR_SUCCESS, "Expected a valid package %u\n", r);
12078
12079     /* invalid hInstall */
12080     r = MsiSetPropertyA(0, "Prop", "Val");
12081     ok(r == ERROR_INVALID_HANDLE,
12082        "Expected ERROR_INVALID_HANDLE, got %d\n", r);
12083
12084     /* invalid hInstall */
12085     r = MsiSetPropertyA(0xdeadbeef, "Prop", "Val");
12086     ok(r == ERROR_INVALID_HANDLE,
12087        "Expected ERROR_INVALID_HANDLE, got %d\n", r);
12088
12089     /* szName is NULL */
12090     r = MsiSetPropertyA(hpkg, NULL, "Val");
12091     ok(r == ERROR_INVALID_PARAMETER,
12092        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
12093
12094     /* both szName and szValue are NULL */
12095     r = MsiSetPropertyA(hpkg, NULL, NULL);
12096     ok(r == ERROR_INVALID_PARAMETER,
12097        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
12098
12099     /* szName is empty */
12100     r = MsiSetPropertyA(hpkg, "", "Val");
12101     ok(r == ERROR_FUNCTION_FAILED,
12102        "Expected ERROR_FUNCTION_FAILED, got %d\n", r);
12103
12104     /* szName is empty and szValue is NULL */
12105     r = MsiSetPropertyA(hpkg, "", NULL);
12106     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12107
12108     /* set a property */
12109     r = MsiSetPropertyA(hpkg, "Prop", "Val");
12110     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12111
12112     /* get the property */
12113     size = MAX_PATH;
12114     r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12115     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12116     ok(!lstrcmpA(buf, "Val"), "Expected \"Val\", got \"%s\"\n", buf);
12117     ok(size == 3, "Expected 3, got %d\n", size);
12118
12119     /* update the property */
12120     r = MsiSetPropertyA(hpkg, "Prop", "Nuvo");
12121     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12122
12123     /* get the property */
12124     size = MAX_PATH;
12125     r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12126     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12127     ok(!lstrcmpA(buf, "Nuvo"), "Expected \"Nuvo\", got \"%s\"\n", buf);
12128     ok(size == 4, "Expected 4, got %d\n", size);
12129
12130     hdb = MsiGetActiveDatabase(hpkg);
12131     ok(hdb != 0, "Expected a valid database handle\n");
12132
12133     /* set prop is not in the _Property table */
12134     query = "SELECT * FROM `_Property` WHERE `Property` = 'Prop'";
12135     r = do_query(hdb, query, &hrec);
12136     ok(r == ERROR_BAD_QUERY_SYNTAX,
12137        "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
12138
12139     /* set prop is not in the Property table */
12140     query = "SELECT * FROM `Property` WHERE `Property` = 'Prop'";
12141     r = do_query(hdb, query, &hrec);
12142     ok(r == ERROR_BAD_QUERY_SYNTAX,
12143        "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
12144
12145     MsiCloseHandle(hdb);
12146
12147     /* szValue is an empty string */
12148     r = MsiSetPropertyA(hpkg, "Prop", "");
12149     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12150
12151     /* try to get the property */
12152     size = MAX_PATH;
12153     r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12154     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12155     ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
12156     ok(size == 0, "Expected 0, got %d\n", size);
12157
12158     /* reset the property */
12159     r = MsiSetPropertyA(hpkg, "Prop", "BlueTap");
12160     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12161
12162     /* delete the property */
12163     r = MsiSetPropertyA(hpkg, "Prop", NULL);
12164     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12165
12166     /* try to get the property */
12167     size = MAX_PATH;
12168     r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12169     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12170     ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
12171     ok(size == 0, "Expected 0, got %d\n", size);
12172
12173     MsiCloseHandle(hpkg);
12174     DeleteFileA(msifile);
12175 }
12176
12177 static void test_MsiApplyMultiplePatches(void)
12178 {
12179     UINT r, type = GetDriveType(NULL);
12180
12181     if (!pMsiApplyMultiplePatchesA) {
12182         win_skip("MsiApplyMultiplePatchesA not found\n");
12183         return;
12184     }
12185
12186     r = pMsiApplyMultiplePatchesA(NULL, NULL, NULL);
12187     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12188
12189     r = pMsiApplyMultiplePatchesA("", NULL, NULL);
12190     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12191
12192     r = pMsiApplyMultiplePatchesA(";", NULL, NULL);
12193     todo_wine
12194     {
12195         if (type == DRIVE_FIXED)
12196             ok(r == ERROR_PATH_NOT_FOUND,
12197                "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
12198         else
12199             ok(r == ERROR_INVALID_NAME,
12200                "Expected ERROR_INVALID_NAME, got %u\n", r);
12201     }
12202
12203     r = pMsiApplyMultiplePatchesA("  ;", NULL, NULL);
12204     todo_wine
12205     {
12206         if (type == DRIVE_FIXED)
12207             ok(r == ERROR_PATCH_PACKAGE_OPEN_FAILED,
12208                "Expected ERROR_PATCH_PACKAGE_OPEN_FAILED, got %u\n", r);
12209         else
12210             ok(r == ERROR_INVALID_NAME,
12211                "Expected ERROR_INVALID_NAME, got %u\n", r);
12212     }
12213
12214     r = pMsiApplyMultiplePatchesA(";;", NULL, NULL);
12215     todo_wine
12216     {
12217         if (type == DRIVE_FIXED)
12218             ok(r == ERROR_PATH_NOT_FOUND,
12219                "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
12220         else
12221             ok(r == ERROR_INVALID_NAME,
12222                "Expected ERROR_INVALID_NAME, got %u\n", r);
12223     }
12224
12225     r = pMsiApplyMultiplePatchesA("nosuchpatchpackage;", NULL, NULL);
12226     todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
12227
12228     r = pMsiApplyMultiplePatchesA(";nosuchpatchpackage", NULL, NULL);
12229     todo_wine
12230     {
12231         if (type == DRIVE_FIXED)
12232             ok(r == ERROR_PATH_NOT_FOUND,
12233                "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
12234         else
12235             ok(r == ERROR_INVALID_NAME,
12236                "Expected ERROR_INVALID_NAME, got %u\n", r);
12237     }
12238
12239     r = pMsiApplyMultiplePatchesA("nosuchpatchpackage;nosuchpatchpackage", NULL, NULL);
12240     todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
12241
12242     r = pMsiApplyMultiplePatchesA("  nosuchpatchpackage  ;  nosuchpatchpackage  ", NULL, NULL);
12243     todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
12244 }
12245
12246 static void test_MsiApplyPatch(void)
12247 {
12248     UINT r;
12249
12250     r = MsiApplyPatch(NULL, NULL, INSTALLTYPE_DEFAULT, NULL);
12251     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12252
12253     r = MsiApplyPatch("", NULL, INSTALLTYPE_DEFAULT, NULL);
12254     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12255 }
12256
12257 START_TEST(package)
12258 {
12259     STATEMGRSTATUS status;
12260     BOOL ret = FALSE;
12261
12262     init_functionpointers();
12263
12264     GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
12265
12266     /* Create a restore point ourselves so we circumvent the multitude of restore points
12267      * that would have been created by all the installation and removal tests.
12268      */
12269     if (pSRSetRestorePointA)
12270     {
12271         memset(&status, 0, sizeof(status));
12272         ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
12273     }
12274
12275     test_createpackage();
12276     test_doaction();
12277     test_gettargetpath_bad();
12278     test_settargetpath();
12279     test_props();
12280     test_property_table();
12281     test_condition();
12282     test_msipackage();
12283     test_formatrecord2();
12284     test_states();
12285     test_getproperty();
12286     test_removefiles();
12287     test_appsearch();
12288     test_appsearch_complocator();
12289     test_appsearch_reglocator();
12290     test_appsearch_inilocator();
12291     test_appsearch_drlocator();
12292     test_featureparents();
12293     test_installprops();
12294     test_launchconditions();
12295     test_ccpsearch();
12296     test_complocator();
12297     test_MsiGetSourcePath();
12298     test_shortlongsource();
12299     test_sourcedir();
12300     test_access();
12301     test_emptypackage();
12302     test_MsiGetProductProperty();
12303     test_MsiSetProperty();
12304     test_MsiApplyMultiplePatches();
12305     test_MsiApplyPatch();
12306
12307     if (pSRSetRestorePointA && ret)
12308     {
12309         ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
12310         if (ret)
12311             remove_restore_point(status.llSequenceNumber);
12312     }
12313 }