msi/tests: Move test coverage for standard actions to a separate module.
[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 #include <shlobj.h>
31
32 #include "wine/test.h"
33
34 static BOOL is_wow64;
35 static const char msifile[] = "winetest-package.msi";
36 static char CURR_DIR[MAX_PATH];
37
38 static UINT (WINAPI *pMsiApplyMultiplePatchesA)(LPCSTR, LPCSTR, LPCSTR);
39 static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
40 static HRESULT (WINAPI *pSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR);
41
42 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
43 static BOOL (WINAPI *pGetTokenInformation)( HANDLE, TOKEN_INFORMATION_CLASS, LPVOID, DWORD, PDWORD );
44 static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE );
45 static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
46 static LONG (WINAPI *pRegDeleteKeyExW)(HKEY, LPCWSTR, REGSAM, DWORD);
47 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
48 static void (WINAPI *pGetSystemInfo)(LPSYSTEM_INFO);
49 static UINT (WINAPI *pGetSystemWow64DirectoryA)(LPSTR, UINT);
50
51 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
52 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
53
54 static void init_functionpointers(void)
55 {
56     HMODULE hmsi = GetModuleHandleA("msi.dll");
57     HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
58     HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
59     HMODULE hshell32 = GetModuleHandleA("shell32.dll");
60     HMODULE hsrclient;
61
62 #define GET_PROC(mod, func) \
63     p ## func = (void*)GetProcAddress(mod, #func);
64
65     GET_PROC(hmsi, MsiApplyMultiplePatchesA);
66     GET_PROC(hmsi, MsiGetComponentPathExA);
67     GET_PROC(hshell32, SHGetFolderPathA);
68
69     GET_PROC(hadvapi32, ConvertSidToStringSidA);
70     GET_PROC(hadvapi32, GetTokenInformation);
71     GET_PROC(hadvapi32, OpenProcessToken);
72     GET_PROC(hadvapi32, RegDeleteKeyExA)
73     GET_PROC(hadvapi32, RegDeleteKeyExW)
74     GET_PROC(hkernel32, IsWow64Process)
75     GET_PROC(hkernel32, GetSystemInfo)
76     GET_PROC(hkernel32, GetSystemWow64DirectoryA)
77
78     hsrclient = LoadLibraryA("srclient.dll");
79     GET_PROC(hsrclient, SRRemoveRestorePoint);
80     GET_PROC(hsrclient, SRSetRestorePointA);
81 #undef GET_PROC
82 }
83
84 static BOOL is_process_limited(void)
85 {
86     HANDLE token;
87
88     if (!pOpenProcessToken || !pGetTokenInformation) return FALSE;
89
90     if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
91     {
92         BOOL ret;
93         TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
94         DWORD size;
95
96         ret = pGetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
97         CloseHandle(token);
98         return (ret && type == TokenElevationTypeLimited);
99     }
100     return FALSE;
101 }
102
103 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
104 {
105     if (pRegDeleteKeyExA)
106         return pRegDeleteKeyExA( key, subkey, access, 0 );
107     return RegDeleteKeyA( key, subkey );
108 }
109
110 static LPSTR get_user_sid(LPSTR *usersid)
111 {
112     HANDLE token;
113     BYTE buf[1024];
114     DWORD size;
115     PTOKEN_USER user;
116
117     if (!pConvertSidToStringSidA)
118     {
119         win_skip("ConvertSidToStringSidA is not available\n");
120         return NULL;
121     }
122
123     *usersid = NULL;
124     OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
125     size = sizeof(buf);
126     GetTokenInformation(token, TokenUser, buf, size, &size);
127     user = (PTOKEN_USER)buf;
128     pConvertSidToStringSidA(user->User.Sid, usersid);
129     ok(*usersid != NULL, "pConvertSidToStringSidA failed lre=%d\n", GetLastError());
130     CloseHandle(token);
131     return *usersid;
132 }
133
134 /* RegDeleteTreeW from dlls/advapi32/registry.c */
135 static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM access)
136 {
137     LONG ret;
138     DWORD dwMaxSubkeyLen, dwMaxValueLen;
139     DWORD dwMaxLen, dwSize;
140     WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
141     HKEY hSubKey = hKey;
142
143     if(lpszSubKey)
144     {
145         ret = RegOpenKeyExW(hKey, lpszSubKey, 0, access, &hSubKey);
146         if (ret) return ret;
147     }
148
149     ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
150             &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
151     if (ret) goto cleanup;
152
153     dwMaxSubkeyLen++;
154     dwMaxValueLen++;
155     dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
156     if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
157     {
158         /* Name too big: alloc a buffer for it */
159         if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
160         {
161             ret = ERROR_NOT_ENOUGH_MEMORY;
162             goto cleanup;
163         }
164     }
165
166     /* Recursively delete all the subkeys */
167     while (TRUE)
168     {
169         dwSize = dwMaxLen;
170         if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
171                           NULL, NULL, NULL)) break;
172
173         ret = package_RegDeleteTreeW(hSubKey, lpszName, access);
174         if (ret) goto cleanup;
175     }
176
177     if (lpszSubKey)
178     {
179         if (pRegDeleteKeyExW)
180             ret = pRegDeleteKeyExW(hKey, lpszSubKey, access, 0);
181         else
182             ret = RegDeleteKeyW(hKey, lpszSubKey);
183     }
184     else
185         while (TRUE)
186         {
187             dwSize = dwMaxLen;
188             if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
189                   NULL, NULL, NULL, NULL)) break;
190
191             ret = RegDeleteValueW(hKey, lpszName);
192             if (ret) goto cleanup;
193         }
194
195 cleanup:
196     if (lpszName != szNameBuf)
197         HeapFree(GetProcessHeap(), 0, lpszName);
198     if(lpszSubKey)
199         RegCloseKey(hSubKey);
200     return ret;
201 }
202
203 static BOOL squash_guid(LPCWSTR in, LPWSTR out)
204 {
205     DWORD i,n=1;
206     GUID guid;
207
208     if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid)))
209         return FALSE;
210
211     for(i=0; i<8; i++)
212         out[7-i] = in[n++];
213     n++;
214     for(i=0; i<4; i++)
215         out[11-i] = in[n++];
216     n++;
217     for(i=0; i<4; i++)
218         out[15-i] = in[n++];
219     n++;
220     for(i=0; i<2; i++)
221     {
222         out[17+i*2] = in[n++];
223         out[16+i*2] = in[n++];
224     }
225     n++;
226     for( ; i<8; i++)
227     {
228         out[17+i*2] = in[n++];
229         out[16+i*2] = in[n++];
230     }
231     out[32]=0;
232     return TRUE;
233 }
234
235 static void create_test_guid(LPSTR prodcode, LPSTR squashed)
236 {
237     WCHAR guidW[MAX_PATH];
238     WCHAR squashedW[MAX_PATH];
239     GUID guid;
240     HRESULT hr;
241     int size;
242
243     hr = CoCreateGuid(&guid);
244     ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
245
246     size = StringFromGUID2(&guid, guidW, MAX_PATH);
247     ok(size == 39, "Expected 39, got %d\n", hr);
248
249     WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL);
250     squash_guid(guidW, squashedW);
251     WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
252 }
253
254 static void set_component_path(LPCSTR filename, MSIINSTALLCONTEXT context,
255                                LPCSTR guid, LPSTR usersid, BOOL dir)
256 {
257     WCHAR guidW[MAX_PATH];
258     WCHAR squashedW[MAX_PATH];
259     CHAR squashed[MAX_PATH];
260     CHAR comppath[MAX_PATH];
261     CHAR prodpath[MAX_PATH];
262     CHAR path[MAX_PATH];
263     LPCSTR prod = NULL;
264     HKEY hkey;
265     REGSAM access = KEY_ALL_ACCESS;
266
267     if (is_wow64)
268         access |= KEY_WOW64_64KEY;
269
270     MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
271     squash_guid(guidW, squashedW);
272     WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
273
274     if (context == MSIINSTALLCONTEXT_MACHINE)
275     {
276         prod = "3D0DAE300FACA1300AD792060BCDAA92";
277         sprintf(comppath,
278                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
279                 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
280         lstrcpyA(prodpath,
281                  "SOFTWARE\\Classes\\Installer\\"
282                  "Products\\3D0DAE300FACA1300AD792060BCDAA92");
283     }
284     else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
285     {
286         prod = "7D2F387510109040002000060BECB6AB";
287         sprintf(comppath,
288                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
289                 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
290         sprintf(prodpath,
291                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
292                 "Installer\\%s\\Installer\\Products\\"
293                 "7D2F387510109040002000060BECB6AB", usersid);
294     }
295     else if (context == MSIINSTALLCONTEXT_USERMANAGED)
296     {
297         prod = "7D2F387510109040002000060BECB6AB";
298         sprintf(comppath,
299                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
300                 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
301         sprintf(prodpath,
302                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
303                 "Installer\\Managed\\%s\\Installer\\Products\\"
304                 "7D2F387510109040002000060BECB6AB", usersid);
305     }
306
307     RegCreateKeyExA(HKEY_LOCAL_MACHINE, comppath, 0, NULL, 0, access, NULL, &hkey, NULL);
308
309     lstrcpyA(path, CURR_DIR);
310     lstrcatA(path, "\\");
311     if (!dir) lstrcatA(path, filename);
312
313     RegSetValueExA(hkey, prod, 0, REG_SZ, (LPBYTE)path, lstrlenA(path));
314     RegCloseKey(hkey);
315
316     RegCreateKeyExA(HKEY_LOCAL_MACHINE, prodpath, 0, NULL, 0, access, NULL, &hkey, NULL);
317     RegCloseKey(hkey);
318 }
319
320 static void delete_component_path(LPCSTR guid, MSIINSTALLCONTEXT context, LPSTR usersid)
321 {
322     WCHAR guidW[MAX_PATH];
323     WCHAR squashedW[MAX_PATH];
324     WCHAR substrW[MAX_PATH];
325     CHAR squashed[MAX_PATH];
326     CHAR comppath[MAX_PATH];
327     CHAR prodpath[MAX_PATH];
328     REGSAM access = KEY_ALL_ACCESS;
329
330     if (is_wow64)
331         access |= KEY_WOW64_64KEY;
332
333     MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
334     squash_guid(guidW, squashedW);
335     WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
336
337     if (context == MSIINSTALLCONTEXT_MACHINE)
338     {
339         sprintf(comppath,
340                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
341                 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
342         lstrcpyA(prodpath,
343                  "SOFTWARE\\Classes\\Installer\\"
344                  "Products\\3D0DAE300FACA1300AD792060BCDAA92");
345     }
346     else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
347     {
348         sprintf(comppath,
349                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
350                 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
351         sprintf(prodpath,
352                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
353                 "Installer\\%s\\Installer\\Products\\"
354                 "7D2F387510109040002000060BECB6AB", usersid);
355     }
356     else if (context == MSIINSTALLCONTEXT_USERMANAGED)
357     {
358         sprintf(comppath,
359                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
360                 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
361         sprintf(prodpath,
362                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
363                 "Installer\\Managed\\%s\\Installer\\Products\\"
364                 "7D2F387510109040002000060BECB6AB", usersid);
365     }
366
367     MultiByteToWideChar(CP_ACP, 0, comppath, -1, substrW, MAX_PATH);
368     package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW, access);
369
370     MultiByteToWideChar(CP_ACP, 0, prodpath, -1, substrW, MAX_PATH);
371     package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW, access);
372 }
373
374 static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec)
375 {
376     MSIHANDLE hview = 0;
377     UINT r, ret;
378
379     /* open a select query */
380     r = MsiDatabaseOpenView(hdb, query, &hview);
381     if (r != ERROR_SUCCESS)
382         return r;
383     r = MsiViewExecute(hview, 0);
384     if (r != ERROR_SUCCESS)
385         return r;
386     ret = MsiViewFetch(hview, phrec);
387     r = MsiViewClose(hview);
388     if (r != ERROR_SUCCESS)
389         return r;
390     r = MsiCloseHandle(hview);
391     if (r != ERROR_SUCCESS)
392         return r;
393     return ret;
394 }
395
396 static UINT run_query( MSIHANDLE hdb, const char *query )
397 {
398     MSIHANDLE hview = 0;
399     UINT r;
400
401     r = MsiDatabaseOpenView(hdb, query, &hview);
402     if( r != ERROR_SUCCESS )
403         return r;
404
405     r = MsiViewExecute(hview, 0);
406     if( r == ERROR_SUCCESS )
407         r = MsiViewClose(hview);
408     MsiCloseHandle(hview);
409     return r;
410 }
411
412 static UINT create_component_table( MSIHANDLE hdb )
413 {
414     return run_query( hdb,
415             "CREATE TABLE `Component` ( "
416             "`Component` CHAR(72) NOT NULL, "
417             "`ComponentId` CHAR(38), "
418             "`Directory_` CHAR(72) NOT NULL, "
419             "`Attributes` SHORT NOT NULL, "
420             "`Condition` CHAR(255), "
421             "`KeyPath` CHAR(72) "
422             "PRIMARY KEY `Component`)" );
423 }
424
425 static UINT create_feature_table( MSIHANDLE hdb )
426 {
427     return run_query( hdb,
428             "CREATE TABLE `Feature` ( "
429             "`Feature` CHAR(38) NOT NULL, "
430             "`Feature_Parent` CHAR(38), "
431             "`Title` CHAR(64), "
432             "`Description` CHAR(255), "
433             "`Display` SHORT NOT NULL, "
434             "`Level` SHORT NOT NULL, "
435             "`Directory_` CHAR(72), "
436             "`Attributes` SHORT NOT NULL "
437             "PRIMARY KEY `Feature`)" );
438 }
439
440 static UINT create_feature_components_table( MSIHANDLE hdb )
441 {
442     return run_query( hdb,
443             "CREATE TABLE `FeatureComponents` ( "
444             "`Feature_` CHAR(38) NOT NULL, "
445             "`Component_` CHAR(72) NOT NULL "
446             "PRIMARY KEY `Feature_`, `Component_` )" );
447 }
448
449 static UINT create_file_table( MSIHANDLE hdb )
450 {
451     return run_query( hdb,
452             "CREATE TABLE `File` ("
453             "`File` CHAR(72) NOT NULL, "
454             "`Component_` CHAR(72) NOT NULL, "
455             "`FileName` CHAR(255) NOT NULL, "
456             "`FileSize` LONG NOT NULL, "
457             "`Version` CHAR(72), "
458             "`Language` CHAR(20), "
459             "`Attributes` SHORT, "
460             "`Sequence` SHORT NOT NULL "
461             "PRIMARY KEY `File`)" );
462 }
463
464 static UINT create_remove_file_table( MSIHANDLE hdb )
465 {
466     return run_query( hdb,
467             "CREATE TABLE `RemoveFile` ("
468             "`FileKey` CHAR(72) NOT NULL, "
469             "`Component_` CHAR(72) NOT NULL, "
470             "`FileName` CHAR(255) LOCALIZABLE, "
471             "`DirProperty` CHAR(72) NOT NULL, "
472             "`InstallMode` SHORT NOT NULL "
473             "PRIMARY KEY `FileKey`)" );
474 }
475
476 static UINT create_appsearch_table( MSIHANDLE hdb )
477 {
478     return run_query( hdb,
479             "CREATE TABLE `AppSearch` ("
480             "`Property` CHAR(72) NOT NULL, "
481             "`Signature_` CHAR(72) NOT NULL "
482             "PRIMARY KEY `Property`, `Signature_`)" );
483 }
484
485 static UINT create_reglocator_table( MSIHANDLE hdb )
486 {
487     return run_query( hdb,
488             "CREATE TABLE `RegLocator` ("
489             "`Signature_` CHAR(72) NOT NULL, "
490             "`Root` SHORT NOT NULL, "
491             "`Key` CHAR(255) NOT NULL, "
492             "`Name` CHAR(255), "
493             "`Type` SHORT "
494             "PRIMARY KEY `Signature_`)" );
495 }
496
497 static UINT create_signature_table( MSIHANDLE hdb )
498 {
499     return run_query( hdb,
500             "CREATE TABLE `Signature` ("
501             "`Signature` CHAR(72) NOT NULL, "
502             "`FileName` CHAR(255) NOT NULL, "
503             "`MinVersion` CHAR(20), "
504             "`MaxVersion` CHAR(20), "
505             "`MinSize` LONG, "
506             "`MaxSize` LONG, "
507             "`MinDate` LONG, "
508             "`MaxDate` LONG, "
509             "`Languages` CHAR(255) "
510             "PRIMARY KEY `Signature`)" );
511 }
512
513 static UINT create_launchcondition_table( MSIHANDLE hdb )
514 {
515     return run_query( hdb,
516             "CREATE TABLE `LaunchCondition` ("
517             "`Condition` CHAR(255) NOT NULL, "
518             "`Description` CHAR(255) NOT NULL "
519             "PRIMARY KEY `Condition`)" );
520 }
521
522 static UINT create_property_table( MSIHANDLE hdb )
523 {
524     return run_query( hdb,
525             "CREATE TABLE `Property` ("
526             "`Property` CHAR(72) NOT NULL, "
527             "`Value` CHAR(0) "
528             "PRIMARY KEY `Property`)" );
529 }
530
531 static UINT create_install_execute_sequence_table( MSIHANDLE hdb )
532 {
533     return run_query( hdb,
534             "CREATE TABLE `InstallExecuteSequence` ("
535             "`Action` CHAR(72) NOT NULL, "
536             "`Condition` CHAR(255), "
537             "`Sequence` SHORT "
538             "PRIMARY KEY `Action`)" );
539 }
540
541 static UINT create_media_table( MSIHANDLE hdb )
542 {
543     return run_query( hdb,
544             "CREATE TABLE `Media` ("
545             "`DiskId` SHORT NOT NULL, "
546             "`LastSequence` SHORT NOT NULL, "
547             "`DiskPrompt` CHAR(64), "
548             "`Cabinet` CHAR(255), "
549             "`VolumeLabel` CHAR(32), "
550             "`Source` CHAR(72) "
551             "PRIMARY KEY `DiskId`)" );
552 }
553
554 static UINT create_ccpsearch_table( MSIHANDLE hdb )
555 {
556     return run_query( hdb,
557             "CREATE TABLE `CCPSearch` ("
558             "`Signature_` CHAR(72) NOT NULL "
559             "PRIMARY KEY `Signature_`)" );
560 }
561
562 static UINT create_drlocator_table( MSIHANDLE hdb )
563 {
564     return run_query( hdb,
565             "CREATE TABLE `DrLocator` ("
566             "`Signature_` CHAR(72) NOT NULL, "
567             "`Parent` CHAR(72), "
568             "`Path` CHAR(255), "
569             "`Depth` SHORT "
570             "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
571 }
572
573 static UINT create_complocator_table( MSIHANDLE hdb )
574 {
575     return run_query( hdb,
576             "CREATE TABLE `CompLocator` ("
577             "`Signature_` CHAR(72) NOT NULL, "
578             "`ComponentId` CHAR(38) NOT NULL, "
579             "`Type` SHORT "
580             "PRIMARY KEY `Signature_`)" );
581 }
582
583 static UINT create_inilocator_table( MSIHANDLE hdb )
584 {
585     return run_query( hdb,
586             "CREATE TABLE `IniLocator` ("
587             "`Signature_` CHAR(72) NOT NULL, "
588             "`FileName` CHAR(255) NOT NULL, "
589             "`Section` CHAR(96)NOT NULL, "
590             "`Key` CHAR(128)NOT NULL, "
591             "`Field` SHORT, "
592             "`Type` SHORT "
593             "PRIMARY KEY `Signature_`)" );
594 }
595
596 #define make_add_entry(type, qtext) \
597     static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
598     { \
599         char insert[] = qtext; \
600         char *query; \
601         UINT sz, r; \
602         sz = strlen(values) + sizeof insert; \
603         query = HeapAlloc(GetProcessHeap(),0,sz); \
604         sprintf(query,insert,values); \
605         r = run_query( hdb, query ); \
606         HeapFree(GetProcessHeap(), 0, query); \
607         return r; \
608     }
609
610 make_add_entry(component,
611                "INSERT INTO `Component`  "
612                "(`Component`, `ComponentId`, `Directory_`, "
613                "`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
614
615 make_add_entry(directory,
616                "INSERT INTO `Directory` "
617                "(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
618
619 make_add_entry(feature,
620                "INSERT INTO `Feature` "
621                "(`Feature`, `Feature_Parent`, `Title`, `Description`, "
622                "`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
623
624 make_add_entry(feature_components,
625                "INSERT INTO `FeatureComponents` "
626                "(`Feature_`, `Component_`) VALUES( %s )")
627
628 make_add_entry(file,
629                "INSERT INTO `File` "
630                "(`File`, `Component_`, `FileName`, `FileSize`, "
631                "`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
632
633 make_add_entry(appsearch,
634                "INSERT INTO `AppSearch` "
635                "(`Property`, `Signature_`) VALUES( %s )")
636
637 make_add_entry(signature,
638                "INSERT INTO `Signature` "
639                "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
640                " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
641                "VALUES( %s )")
642
643 make_add_entry(launchcondition,
644                "INSERT INTO `LaunchCondition` "
645                "(`Condition`, `Description`) VALUES( %s )")
646
647 make_add_entry(property,
648                "INSERT INTO `Property` (`Property`, `Value`) VALUES( %s )")
649
650 make_add_entry(install_execute_sequence,
651                "INSERT INTO `InstallExecuteSequence` "
652                "(`Action`, `Condition`, `Sequence`) VALUES( %s )")
653
654 make_add_entry(media,
655                "INSERT INTO `Media` "
656                "(`DiskId`, `LastSequence`, `DiskPrompt`, "
657                "`Cabinet`, `VolumeLabel`, `Source`) VALUES( %s )")
658
659 make_add_entry(ccpsearch,
660                "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )")
661
662 make_add_entry(drlocator,
663                "INSERT INTO `DrLocator` "
664                "(`Signature_`, `Parent`, `Path`, `Depth`) VALUES( %s )")
665
666 make_add_entry(complocator,
667                "INSERT INTO `CompLocator` "
668                "(`Signature_`, `ComponentId`, `Type`) VALUES( %s )")
669
670 make_add_entry(inilocator,
671                "INSERT INTO `IniLocator` "
672                "(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) "
673                "VALUES( %s )")
674
675 static UINT add_reglocator_entry( MSIHANDLE hdb, const char *sig, UINT root, const char *path,
676                                   const char *name, UINT type )
677 {
678     const char insert[] =
679         "INSERT INTO `RegLocator` (`Signature_`, `Root`, `Key`, `Name`, `Type`) "
680         "VALUES( '%s', %u, '%s', '%s', %u )";
681     char *query;
682     UINT sz, r;
683
684     sz = strlen( sig ) + 10 + strlen( path ) + strlen( name ) + 10 + sizeof( insert );
685     query = HeapAlloc( GetProcessHeap(), 0, sz );
686     sprintf( query, insert, sig, root, path, name, type );
687     r = run_query( hdb, query );
688     HeapFree( GetProcessHeap(), 0, query );
689     return r;
690 }
691
692 static UINT set_summary_info(MSIHANDLE hdb)
693 {
694     UINT res;
695     MSIHANDLE suminfo;
696
697     /* build summary info */
698     res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
699     ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
700
701     res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
702                         "Installation Database");
703     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
704
705     res = MsiSummaryInfoSetProperty(suminfo,3, VT_LPSTR, 0,NULL,
706                         "Installation Database");
707     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
708
709     res = MsiSummaryInfoSetProperty(suminfo,4, VT_LPSTR, 0,NULL,
710                         "Wine Hackers");
711     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
712
713     res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
714                     ";1033");
715     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
716
717     res = MsiSummaryInfoSetProperty(suminfo,9, VT_LPSTR, 0,NULL,
718                     "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
719     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
720
721     res = MsiSummaryInfoSetProperty(suminfo, 14, VT_I4, 100, NULL, NULL);
722     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
723
724     res = MsiSummaryInfoSetProperty(suminfo, 15, VT_I4, 0, NULL, NULL);
725     ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
726
727     res = MsiSummaryInfoPersist(suminfo);
728     ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
729
730     res = MsiCloseHandle( suminfo);
731     ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
732
733     return res;
734 }
735
736
737 static MSIHANDLE create_package_db(void)
738 {
739     MSIHANDLE hdb = 0;
740     UINT res;
741
742     DeleteFile(msifile);
743
744     /* create an empty database */
745     res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb );
746     ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
747     if( res != ERROR_SUCCESS )
748         return hdb;
749
750     res = MsiDatabaseCommit( hdb );
751     ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
752
753     res = set_summary_info(hdb);
754
755     res = run_query( hdb,
756             "CREATE TABLE `Directory` ( "
757             "`Directory` CHAR(255) NOT NULL, "
758             "`Directory_Parent` CHAR(255), "
759             "`DefaultDir` CHAR(255) NOT NULL "
760             "PRIMARY KEY `Directory`)" );
761     ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
762
763     return hdb;
764 }
765
766 static UINT package_from_db(MSIHANDLE hdb, MSIHANDLE *handle)
767 {
768     UINT res;
769     CHAR szPackage[12];
770     MSIHANDLE hPackage;
771
772     sprintf(szPackage, "#%u", hdb);
773     res = MsiOpenPackage(szPackage, &hPackage);
774     if (res != ERROR_SUCCESS)
775     {
776         MsiCloseHandle(hdb);
777         return res;
778     }
779
780     res = MsiCloseHandle(hdb);
781     if (res != ERROR_SUCCESS)
782     {
783         MsiCloseHandle(hPackage);
784         return res;
785     }
786
787     *handle = hPackage;
788     return ERROR_SUCCESS;
789 }
790
791 static void create_test_file(const CHAR *name)
792 {
793     HANDLE file;
794     DWORD written;
795
796     file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
797     ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
798     WriteFile(file, name, strlen(name), &written, NULL);
799     WriteFile(file, "\n", strlen("\n"), &written, NULL);
800     CloseHandle(file);
801 }
802
803 typedef struct _tagVS_VERSIONINFO
804 {
805     WORD wLength;
806     WORD wValueLength;
807     WORD wType;
808     WCHAR szKey[1];
809     WORD wPadding1[1];
810     VS_FIXEDFILEINFO Value;
811     WORD wPadding2[1];
812     WORD wChildren[1];
813 } VS_VERSIONINFO;
814
815 #define roundoffs(a, b, r) (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))
816 #define roundpos(a, b, r) (((BYTE *)(a)) + roundoffs(a, b, r))
817
818 static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls)
819 {
820     VS_VERSIONINFO *pVerInfo;
821     VS_FIXEDFILEINFO *pFixedInfo;
822     LPBYTE buffer, ofs;
823     CHAR path[MAX_PATH];
824     DWORD handle, size;
825     HANDLE resource;
826     BOOL ret = FALSE;
827
828     GetSystemDirectory(path, MAX_PATH);
829     /* Some dlls can't be updated on Vista/W2K8 */
830     lstrcatA(path, "\\version.dll");
831
832     CopyFileA(path, name, FALSE);
833
834     size = GetFileVersionInfoSize(path, &handle);
835     buffer = HeapAlloc(GetProcessHeap(), 0, size);
836
837     GetFileVersionInfoA(path, 0, size, buffer);
838
839     pVerInfo = (VS_VERSIONINFO *)buffer;
840     ofs = (BYTE *)&pVerInfo->szKey[lstrlenW(pVerInfo->szKey) + 1];
841     pFixedInfo = (VS_FIXEDFILEINFO *)roundpos(pVerInfo, ofs, 4);
842
843     pFixedInfo->dwFileVersionMS = ms;
844     pFixedInfo->dwFileVersionLS = ls;
845     pFixedInfo->dwProductVersionMS = ms;
846     pFixedInfo->dwProductVersionLS = ls;
847
848     resource = BeginUpdateResource(name, FALSE);
849     if (!resource)
850         goto done;
851
852     if (!UpdateResource(resource, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO),
853                    MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), buffer, size))
854         goto done;
855
856     if (!EndUpdateResource(resource, FALSE))
857         goto done;
858
859     ret = TRUE;
860
861 done:
862     HeapFree(GetProcessHeap(), 0, buffer);
863     return ret;
864 }
865
866 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
867 {
868     RESTOREPOINTINFOA spec;
869
870     spec.dwEventType = event_type;
871     spec.dwRestorePtType = APPLICATION_INSTALL;
872     spec.llSequenceNumber = status->llSequenceNumber;
873     lstrcpyA(spec.szDescription, "msitest restore point");
874
875     return pSRSetRestorePointA(&spec, status);
876 }
877
878 static void remove_restore_point(DWORD seq_number)
879 {
880     DWORD res;
881
882     res = pSRRemoveRestorePoint(seq_number);
883     if (res != ERROR_SUCCESS)
884         trace("Failed to remove the restore point : %08x\n", res);
885 }
886
887 static void test_createpackage(void)
888 {
889     MSIHANDLE hPackage = 0;
890     UINT res;
891
892     res = package_from_db(create_package_db(), &hPackage);
893     if (res == ERROR_INSTALL_PACKAGE_REJECTED)
894     {
895         skip("Not enough rights to perform tests\n");
896         DeleteFile(msifile);
897         return;
898     }
899     ok( res == ERROR_SUCCESS, " Failed to create package %u\n", res );
900
901     res = MsiCloseHandle( hPackage);
902     ok( res == ERROR_SUCCESS , "Failed to close package\n" );
903     DeleteFile(msifile);
904 }
905
906 static void test_doaction( void )
907 {
908     MSIHANDLE hpkg;
909     UINT r;
910
911     r = MsiDoAction( -1, NULL );
912     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
913
914     r = package_from_db(create_package_db(), &hpkg);
915     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
916     {
917         skip("Not enough rights to perform tests\n");
918         DeleteFile(msifile);
919         return;
920     }
921     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
922
923     r = MsiDoAction(hpkg, NULL);
924     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
925
926     r = MsiDoAction(0, "boo");
927     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
928
929     r = MsiDoAction(hpkg, "boo");
930     ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
931
932     MsiCloseHandle( hpkg );
933     DeleteFile(msifile);
934 }
935
936 static void test_gettargetpath_bad(void)
937 {
938     static const WCHAR boo[] = {'b','o','o',0};
939     static const WCHAR empty[] = {0};
940     char buffer[0x80];
941     WCHAR bufferW[0x80];
942     MSIHANDLE hpkg;
943     DWORD sz;
944     UINT r;
945
946     r = package_from_db(create_package_db(), &hpkg);
947     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
948     {
949         skip("Not enough rights to perform tests\n");
950         DeleteFile(msifile);
951         return;
952     }
953     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
954
955     r = MsiGetTargetPath( 0, NULL, NULL, NULL );
956     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
957
958     r = MsiGetTargetPath( 0, NULL, NULL, &sz );
959     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
960
961     r = MsiGetTargetPath( 0, "boo", NULL, NULL );
962     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
963
964     r = MsiGetTargetPath( 0, "boo", NULL, NULL );
965     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
966
967     r = MsiGetTargetPath( hpkg, "boo", NULL, NULL );
968     ok( r == ERROR_DIRECTORY, "wrong return val\n");
969
970     r = MsiGetTargetPath( hpkg, "boo", buffer, NULL );
971     ok( r == ERROR_DIRECTORY, "wrong return val\n");
972
973     sz = 0;
974     r = MsiGetTargetPath( hpkg, "", buffer, &sz );
975     ok( r == ERROR_DIRECTORY, "wrong return val\n");
976
977     r = MsiGetTargetPathW( 0, NULL, NULL, NULL );
978     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
979
980     r = MsiGetTargetPathW( 0, NULL, NULL, &sz );
981     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
982
983     r = MsiGetTargetPathW( 0, boo, NULL, NULL );
984     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
985
986     r = MsiGetTargetPathW( 0, boo, NULL, NULL );
987     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
988
989     r = MsiGetTargetPathW( hpkg, boo, NULL, NULL );
990     ok( r == ERROR_DIRECTORY, "wrong return val\n");
991
992     r = MsiGetTargetPathW( hpkg, boo, bufferW, NULL );
993     ok( r == ERROR_DIRECTORY, "wrong return val\n");
994
995     sz = 0;
996     r = MsiGetTargetPathW( hpkg, empty, bufferW, &sz );
997     ok( r == ERROR_DIRECTORY, "wrong return val\n");
998
999     MsiCloseHandle( hpkg );
1000     DeleteFile(msifile);
1001 }
1002
1003 static void query_file_path(MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
1004 {
1005     UINT r;
1006     DWORD size;
1007     MSIHANDLE rec;
1008
1009     rec = MsiCreateRecord( 1 );
1010     ok(rec, "MsiCreate record failed\n");
1011
1012     r = MsiRecordSetString( rec, 0, file );
1013     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
1014
1015     size = MAX_PATH;
1016     r = MsiFormatRecord( hpkg, rec, buff, &size );
1017     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
1018
1019     MsiCloseHandle( rec );
1020 }
1021
1022 static void test_settargetpath(void)
1023 {
1024     char tempdir[MAX_PATH+8], buffer[MAX_PATH], file[MAX_PATH];
1025     DWORD sz;
1026     MSIHANDLE hpkg;
1027     UINT r;
1028     MSIHANDLE hdb;
1029
1030     hdb = create_package_db();
1031     ok ( hdb, "failed to create package database\n" );
1032
1033     r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
1034     ok( r == S_OK, "failed to add directory entry: %d\n" , r );
1035
1036     r = create_component_table( hdb );
1037     ok( r == S_OK, "cannot create Component table: %d\n", r );
1038
1039     r = add_component_entry( hdb, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
1040     ok( r == S_OK, "cannot add dummy component: %d\n", r );
1041
1042     r = add_component_entry( hdb, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
1043     ok( r == S_OK, "cannot add test component: %d\n", r );
1044
1045     r = create_feature_table( hdb );
1046     ok( r == S_OK, "cannot create Feature table: %d\n", r );
1047
1048     r = add_feature_entry( hdb, "'TestFeature', '', '', '', 0, 1, '', 0" );
1049     ok( r == ERROR_SUCCESS, "cannot add TestFeature to Feature table: %d\n", r );
1050
1051     r = create_feature_components_table( hdb );
1052     ok( r == S_OK, "cannot create FeatureComponents table: %d\n", r );
1053
1054     r = add_feature_components_entry( hdb, "'TestFeature', 'RootComp'" );
1055     ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
1056
1057     r = add_feature_components_entry( hdb, "'TestFeature', 'TestComp'" );
1058     ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
1059
1060     add_directory_entry( hdb, "'TestParent', 'TARGETDIR', 'TestParent'" );
1061     add_directory_entry( hdb, "'TestDir', 'TestParent', 'TestDir'" );
1062
1063     r = create_file_table( hdb );
1064     ok( r == S_OK, "cannot create File table: %d\n", r );
1065
1066     r = add_file_entry( hdb, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
1067     ok( r == S_OK, "cannot add file to the File table: %d\n", r );
1068
1069     r = add_file_entry( hdb, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
1070     ok( r == S_OK, "cannot add file to the File table: %d\n", r );
1071
1072     r = package_from_db( hdb, &hpkg );
1073     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
1074     {
1075         skip("Not enough rights to perform tests\n");
1076         DeleteFile(msifile);
1077         return;
1078     }
1079     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
1080
1081     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1082
1083     r = MsiDoAction( hpkg, "CostInitialize");
1084     ok( r == ERROR_SUCCESS, "cost init failed\n");
1085
1086     r = MsiDoAction( hpkg, "FileCost");
1087     ok( r == ERROR_SUCCESS, "file cost failed\n");
1088
1089     r = MsiDoAction( hpkg, "CostFinalize");
1090     ok( r == ERROR_SUCCESS, "cost finalize failed\n");
1091
1092     r = MsiSetTargetPath( 0, NULL, NULL );
1093     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1094
1095     r = MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
1096     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1097
1098     r = MsiSetTargetPath( hpkg, "boo", NULL );
1099     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1100
1101     r = MsiSetTargetPath( hpkg, "boo", "c:\\bogusx" );
1102     ok( r == ERROR_DIRECTORY, "wrong return val\n");
1103
1104     sz = sizeof tempdir - 1;
1105     r = MsiGetTargetPath( hpkg, "TARGETDIR", tempdir, &sz );
1106     sprintf( file, "%srootfile.txt", tempdir );
1107     buffer[0] = 0;
1108     query_file_path( hpkg, "[#RootFile]", buffer );
1109     ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1110     ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer );
1111
1112     GetTempFileName( tempdir, "_wt", 0, buffer );
1113     sprintf( tempdir, "%s\\subdir", buffer );
1114
1115     r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1116     ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1117         "MsiSetTargetPath on file returned %d\n", r );
1118
1119     r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1120     ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1121         "MsiSetTargetPath on 'subdir' of file returned %d\n", r );
1122
1123     DeleteFile( buffer );
1124
1125     r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1126     ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1127
1128     r = GetFileAttributes( buffer );
1129     ok ( r == INVALID_FILE_ATTRIBUTES, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r );
1130
1131     r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1132     ok( r == ERROR_SUCCESS, "MsiSetTargetPath on subsubdir returned %d\n", r );
1133
1134     sz = sizeof buffer - 1;
1135     lstrcat( tempdir, "\\" );
1136     r = MsiGetTargetPath( hpkg, "TARGETDIR", buffer, &sz );
1137     ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1138     ok( !lstrcmp(buffer, tempdir), "Expected %s, got %s\n", tempdir, buffer);
1139
1140     sprintf( file, "%srootfile.txt", tempdir );
1141     query_file_path( hpkg, "[#RootFile]", buffer );
1142     ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer);
1143
1144     r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two" );
1145     ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1146
1147     query_file_path( hpkg, "[#TestFile]", buffer );
1148     ok( !lstrcmpi(buffer, "C:\\one\\two\\TestDir\\testfile.txt"),
1149         "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer );
1150
1151     sz = sizeof buffer - 1;
1152     r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
1153     ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1154     ok( !lstrcmpi(buffer, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer);
1155
1156     r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two\\three" );
1157     ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1158
1159     sz = sizeof buffer - 1;
1160     r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
1161     ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1162     ok( !lstrcmpi(buffer, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", buffer);
1163
1164     MsiCloseHandle( hpkg );
1165 }
1166
1167 static void test_condition(void)
1168 {
1169     MSICONDITION r;
1170     MSIHANDLE hpkg;
1171
1172     r = package_from_db(create_package_db(), &hpkg);
1173     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
1174     {
1175         skip("Not enough rights to perform tests\n");
1176         DeleteFile(msifile);
1177         return;
1178     }
1179     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
1180
1181     r = MsiEvaluateCondition(0, NULL);
1182     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1183
1184     r = MsiEvaluateCondition(hpkg, NULL);
1185     ok( r == MSICONDITION_NONE, "wrong return val\n");
1186
1187     r = MsiEvaluateCondition(hpkg, "");
1188     ok( r == MSICONDITION_NONE, "wrong return val\n");
1189
1190     r = MsiEvaluateCondition(hpkg, "1");
1191     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1192
1193     r = MsiEvaluateCondition(hpkg, "0");
1194     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1195
1196     r = MsiEvaluateCondition(hpkg, "-1");
1197     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1198
1199     r = MsiEvaluateCondition(hpkg, "0 = 0");
1200     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1201
1202     r = MsiEvaluateCondition(hpkg, "0 <> 0");
1203     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1204
1205     r = MsiEvaluateCondition(hpkg, "0 = 1");
1206     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1207
1208     r = MsiEvaluateCondition(hpkg, "0 > 1");
1209     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1210
1211     r = MsiEvaluateCondition(hpkg, "0 ~> 1");
1212     ok( r == MSICONDITION_FALSE, "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_FALSE, "wrong return val\n");
1222
1223     r = MsiEvaluateCondition(hpkg, "0 ~>= 1");
1224     ok( r == MSICONDITION_FALSE, "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 < 1");
1233     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1234
1235     r = MsiEvaluateCondition(hpkg, "0 ~< 1");
1236     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1237
1238     r = MsiEvaluateCondition(hpkg, "1 < 1");
1239     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1240
1241     r = MsiEvaluateCondition(hpkg, "1 ~< 1");
1242     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1243
1244     r = MsiEvaluateCondition(hpkg, "0 <= 1");
1245     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1246
1247     r = MsiEvaluateCondition(hpkg, "0 ~<= 1");
1248     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1249
1250     r = MsiEvaluateCondition(hpkg, "1 <= 1");
1251     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1252
1253     r = MsiEvaluateCondition(hpkg, "1 ~<= 1");
1254     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1255
1256     r = MsiEvaluateCondition(hpkg, "0 >=");
1257     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1258
1259     r = MsiEvaluateCondition(hpkg, " ");
1260     ok( r == MSICONDITION_NONE, "wrong return val\n");
1261
1262     r = MsiEvaluateCondition(hpkg, "LicView <> \"1\"");
1263     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1264
1265     r = MsiEvaluateCondition(hpkg, "LicView <> \"0\"");
1266     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1267
1268     r = MsiEvaluateCondition(hpkg, "LicView <> LicView");
1269     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1270
1271     r = MsiEvaluateCondition(hpkg, "not 0");
1272     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1273
1274     r = MsiEvaluateCondition(hpkg, "not LicView");
1275     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1276
1277     r = MsiEvaluateCondition(hpkg, "\"Testing\" ~<< \"Testing\"");
1278     ok (r == MSICONDITION_TRUE, "wrong return val\n");
1279
1280     r = MsiEvaluateCondition(hpkg, "LicView ~<< \"Testing\"");
1281     ok (r == MSICONDITION_FALSE, "wrong return val\n");
1282
1283     r = MsiEvaluateCondition(hpkg, "Not LicView ~<< \"Testing\"");
1284     ok (r == MSICONDITION_TRUE, "wrong return val\n");
1285
1286     r = MsiEvaluateCondition(hpkg, "not \"A\"");
1287     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1288
1289     r = MsiEvaluateCondition(hpkg, "~not \"A\"");
1290     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1291
1292     r = MsiEvaluateCondition(hpkg, "\"0\"");
1293     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1294
1295     r = MsiEvaluateCondition(hpkg, "1 and 2");
1296     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1297
1298     r = MsiEvaluateCondition(hpkg, "not 0 and 3");
1299     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1300
1301     r = MsiEvaluateCondition(hpkg, "not 0 and 0");
1302     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1303
1304     r = MsiEvaluateCondition(hpkg, "not 0 or 1");
1305     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1306
1307     r = MsiEvaluateCondition(hpkg, "(0)");
1308     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1309
1310     r = MsiEvaluateCondition(hpkg, "(((((1))))))");
1311     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1312
1313     r = MsiEvaluateCondition(hpkg, "(((((1)))))");
1314     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1315
1316     r = MsiEvaluateCondition(hpkg, " \"A\" < \"B\" ");
1317     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1318
1319     r = MsiEvaluateCondition(hpkg, " \"A\" > \"B\" ");
1320     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1321
1322     r = MsiEvaluateCondition(hpkg, " \"1\" > \"12\" ");
1323     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1324
1325     r = MsiEvaluateCondition(hpkg, " \"100\" < \"21\" ");
1326     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1327
1328     r = MsiEvaluateCondition(hpkg, "0 < > 0");
1329     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1330
1331     r = MsiEvaluateCondition(hpkg, "(1<<1) == 2");
1332     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1333
1334     r = MsiEvaluateCondition(hpkg, " \"A\" = \"a\" ");
1335     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1336
1337     r = MsiEvaluateCondition(hpkg, " \"A\" ~ = \"a\" ");
1338     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1339
1340     r = MsiEvaluateCondition(hpkg, " \"A\" ~= \"a\" ");
1341     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1342
1343     r = MsiEvaluateCondition(hpkg, " \"A\" ~= 1 ");
1344     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1345
1346     r = MsiEvaluateCondition(hpkg, " \"A\" = 1 ");
1347     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1348
1349     r = MsiEvaluateCondition(hpkg, " 1 ~= 1 ");
1350     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1351
1352     r = MsiEvaluateCondition(hpkg, " 1 ~= \"1\" ");
1353     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1354
1355     r = MsiEvaluateCondition(hpkg, " 1 = \"1\" ");
1356     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1357
1358     r = MsiEvaluateCondition(hpkg, " 0 = \"1\" ");
1359     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1360
1361     r = MsiEvaluateCondition(hpkg, " 0 < \"100\" ");
1362     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1363
1364     r = MsiEvaluateCondition(hpkg, " 100 > \"0\" ");
1365     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1366
1367     r = MsiEvaluateCondition(hpkg, "1 XOR 1");
1368     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1369
1370     r = MsiEvaluateCondition(hpkg, "1 IMP 1");
1371     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1372
1373     r = MsiEvaluateCondition(hpkg, "1 IMP 0");
1374     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1375
1376     r = MsiEvaluateCondition(hpkg, "0 IMP 0");
1377     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1378
1379     r = MsiEvaluateCondition(hpkg, "0 EQV 0");
1380     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1381
1382     r = MsiEvaluateCondition(hpkg, "0 EQV 1");
1383     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1384
1385     r = MsiEvaluateCondition(hpkg, "1 IMP 1 OR 0");
1386     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1387
1388     r = MsiEvaluateCondition(hpkg, "1 IMPL 1");
1389     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1390
1391     r = MsiEvaluateCondition(hpkg, "\"ASFD\" >< \"S\" ");
1392     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1393
1394     r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"s\" ");
1395     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1396
1397     r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"\" ");
1398     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1399
1400     r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"sss\" ");
1401     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1402
1403     MsiSetProperty(hpkg, "mm", "5" );
1404
1405     r = MsiEvaluateCondition(hpkg, "mm = 5");
1406     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1407
1408     r = MsiEvaluateCondition(hpkg, "mm < 6");
1409     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1410
1411     r = MsiEvaluateCondition(hpkg, "mm <= 5");
1412     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1413
1414     r = MsiEvaluateCondition(hpkg, "mm > 4");
1415     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1416
1417     r = MsiEvaluateCondition(hpkg, "mm < 12");
1418     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1419
1420     r = MsiEvaluateCondition(hpkg, "mm = \"5\"");
1421     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1422
1423     r = MsiEvaluateCondition(hpkg, "0 = \"\"");
1424     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1425
1426     r = MsiEvaluateCondition(hpkg, "0 AND \"\"");
1427     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1428
1429     r = MsiEvaluateCondition(hpkg, "1 AND \"\"");
1430     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1431
1432     r = MsiEvaluateCondition(hpkg, "1 AND \"1\"");
1433     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1434
1435     r = MsiEvaluateCondition(hpkg, "3 >< 1");
1436     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1437
1438     r = MsiEvaluateCondition(hpkg, "3 >< 4");
1439     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1440
1441     r = MsiEvaluateCondition(hpkg, "NOT 0 AND 0");
1442     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1443
1444     r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1");
1445     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1446
1447     r = MsiEvaluateCondition(hpkg, "NOT 1 OR 0");
1448     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1449
1450     r = MsiEvaluateCondition(hpkg, "0 AND 1 OR 1");
1451     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1452
1453     r = MsiEvaluateCondition(hpkg, "0 AND 0 OR 1");
1454     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1455
1456     r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1 OR 0");
1457     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1458
1459     r = MsiEvaluateCondition(hpkg, "_1 = _1");
1460     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1461
1462     r = MsiEvaluateCondition(hpkg, "( 1 AND 1 ) = 2");
1463     ok( r == MSICONDITION_ERROR, "wrong return val\n");
1464
1465     r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
1466     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1467
1468     r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1469     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1470
1471     r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
1472     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1473
1474     r = MsiEvaluateCondition(hpkg, "NOT 1 AND 0");
1475     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1476
1477     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1478     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1479
1480     r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1481     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1482
1483     r = MsiEvaluateCondition(hpkg, "bandalmael<0");
1484     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1485
1486     r = MsiEvaluateCondition(hpkg, "bandalmael>0");
1487     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1488
1489     r = MsiEvaluateCondition(hpkg, "bandalmael>=0");
1490     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1491
1492     r = MsiEvaluateCondition(hpkg, "bandalmael<=0");
1493     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1494
1495     r = MsiEvaluateCondition(hpkg, "bandalmael~<>0");
1496     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1497
1498     MsiSetProperty(hpkg, "bandalmael", "0" );
1499     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1500     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1501
1502     MsiSetProperty(hpkg, "bandalmael", "" );
1503     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1504     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1505
1506     MsiSetProperty(hpkg, "bandalmael", "asdf" );
1507     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1508     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1509
1510     MsiSetProperty(hpkg, "bandalmael", "0asdf" );
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" );
1519     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1520     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1521
1522     MsiSetProperty(hpkg, "bandalmael", "0000000000000" );
1523     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1524     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1525
1526     MsiSetProperty(hpkg, "bandalmael", "--0" );
1527     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1528     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1529
1530     MsiSetProperty(hpkg, "bandalmael", "0x00" );
1531     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1532     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1533
1534     MsiSetProperty(hpkg, "bandalmael", "-" );
1535     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1536     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1537
1538     MsiSetProperty(hpkg, "bandalmael", "+0" );
1539     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1540     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1541
1542     MsiSetProperty(hpkg, "bandalmael", "0.0" );
1543     r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1544     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1545     r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1546     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1547
1548     MsiSetProperty(hpkg, "one", "hi");
1549     MsiSetProperty(hpkg, "two", "hithere");
1550     r = MsiEvaluateCondition(hpkg, "one >< two");
1551     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1552
1553     MsiSetProperty(hpkg, "one", "hithere");
1554     MsiSetProperty(hpkg, "two", "hi");
1555     r = MsiEvaluateCondition(hpkg, "one >< two");
1556     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1557
1558     MsiSetProperty(hpkg, "one", "hello");
1559     MsiSetProperty(hpkg, "two", "hi");
1560     r = MsiEvaluateCondition(hpkg, "one >< two");
1561     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1562
1563     MsiSetProperty(hpkg, "one", "hellohithere");
1564     MsiSetProperty(hpkg, "two", "hi");
1565     r = MsiEvaluateCondition(hpkg, "one >< two");
1566     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1567
1568     MsiSetProperty(hpkg, "one", "");
1569     MsiSetProperty(hpkg, "two", "hi");
1570     r = MsiEvaluateCondition(hpkg, "one >< two");
1571     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1572
1573     MsiSetProperty(hpkg, "one", "hi");
1574     MsiSetProperty(hpkg, "two", "");
1575     r = MsiEvaluateCondition(hpkg, "one >< two");
1576     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1577
1578     MsiSetProperty(hpkg, "one", "");
1579     MsiSetProperty(hpkg, "two", "");
1580     r = MsiEvaluateCondition(hpkg, "one >< two");
1581     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1582
1583     MsiSetProperty(hpkg, "one", "1234");
1584     MsiSetProperty(hpkg, "two", "1");
1585     r = MsiEvaluateCondition(hpkg, "one >< two");
1586     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1587
1588     MsiSetProperty(hpkg, "one", "one 1234");
1589     MsiSetProperty(hpkg, "two", "1");
1590     r = MsiEvaluateCondition(hpkg, "one >< two");
1591     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1592
1593     MsiSetProperty(hpkg, "one", "hithere");
1594     MsiSetProperty(hpkg, "two", "hi");
1595     r = MsiEvaluateCondition(hpkg, "one << two");
1596     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1597
1598     MsiSetProperty(hpkg, "one", "hi");
1599     MsiSetProperty(hpkg, "two", "hithere");
1600     r = MsiEvaluateCondition(hpkg, "one << two");
1601     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1602
1603     MsiSetProperty(hpkg, "one", "hi");
1604     MsiSetProperty(hpkg, "two", "hi");
1605     r = MsiEvaluateCondition(hpkg, "one << two");
1606     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1607
1608     MsiSetProperty(hpkg, "one", "abcdhithere");
1609     MsiSetProperty(hpkg, "two", "hi");
1610     r = MsiEvaluateCondition(hpkg, "one << two");
1611     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1612
1613     MsiSetProperty(hpkg, "one", "");
1614     MsiSetProperty(hpkg, "two", "hi");
1615     r = MsiEvaluateCondition(hpkg, "one << two");
1616     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1617
1618     MsiSetProperty(hpkg, "one", "hithere");
1619     MsiSetProperty(hpkg, "two", "");
1620     r = MsiEvaluateCondition(hpkg, "one << two");
1621     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1622
1623     MsiSetProperty(hpkg, "one", "");
1624     MsiSetProperty(hpkg, "two", "");
1625     r = MsiEvaluateCondition(hpkg, "one << two");
1626     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1627
1628     MsiSetProperty(hpkg, "one", "1234");
1629     MsiSetProperty(hpkg, "two", "1");
1630     r = MsiEvaluateCondition(hpkg, "one << two");
1631     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1632
1633     MsiSetProperty(hpkg, "one", "1234 one");
1634     MsiSetProperty(hpkg, "two", "1");
1635     r = MsiEvaluateCondition(hpkg, "one << two");
1636     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1637
1638     MsiSetProperty(hpkg, "one", "hithere");
1639     MsiSetProperty(hpkg, "two", "there");
1640     r = MsiEvaluateCondition(hpkg, "one >> two");
1641     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1642
1643     MsiSetProperty(hpkg, "one", "hithere");
1644     MsiSetProperty(hpkg, "two", "hi");
1645     r = MsiEvaluateCondition(hpkg, "one >> two");
1646     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1647
1648     MsiSetProperty(hpkg, "one", "there");
1649     MsiSetProperty(hpkg, "two", "hithere");
1650     r = MsiEvaluateCondition(hpkg, "one >> two");
1651     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1652
1653     MsiSetProperty(hpkg, "one", "there");
1654     MsiSetProperty(hpkg, "two", "there");
1655     r = MsiEvaluateCondition(hpkg, "one >> two");
1656     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1657
1658     MsiSetProperty(hpkg, "one", "abcdhithere");
1659     MsiSetProperty(hpkg, "two", "hi");
1660     r = MsiEvaluateCondition(hpkg, "one >> two");
1661     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1662
1663     MsiSetProperty(hpkg, "one", "");
1664     MsiSetProperty(hpkg, "two", "there");
1665     r = MsiEvaluateCondition(hpkg, "one >> two");
1666     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1667
1668     MsiSetProperty(hpkg, "one", "there");
1669     MsiSetProperty(hpkg, "two", "");
1670     r = MsiEvaluateCondition(hpkg, "one >> two");
1671     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1672
1673     MsiSetProperty(hpkg, "one", "");
1674     MsiSetProperty(hpkg, "two", "");
1675     r = MsiEvaluateCondition(hpkg, "one >> two");
1676     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1677
1678     MsiSetProperty(hpkg, "one", "1234");
1679     MsiSetProperty(hpkg, "two", "4");
1680     r = MsiEvaluateCondition(hpkg, "one >> two");
1681     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1682
1683     MsiSetProperty(hpkg, "one", "one 1234");
1684     MsiSetProperty(hpkg, "two", "4");
1685     r = MsiEvaluateCondition(hpkg, "one >> two");
1686     ok( r == MSICONDITION_TRUE, "wrong return val\n");
1687
1688     MsiSetProperty(hpkg, "MsiNetAssemblySupport", NULL);  /* make sure it's empty */
1689
1690     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1691     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1692
1693     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport > \"1.1.4322\"");
1694     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1695
1696     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport >= \"1.1.4322\"");
1697     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1698
1699     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <= \"1.1.4322\"");
1700     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1701
1702     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <> \"1.1.4322\"");
1703     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1704
1705     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1706     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1707
1708     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"abcd\"");
1709     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1710
1711     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a1.1.4322\"");
1712     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1713
1714     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322a\"");
1715     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1716
1717     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1718     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1719
1720     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1721     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1722
1723     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1724     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1725
1726     r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1");
1727     ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1728
1729     r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1\"");
1730     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1731
1732     r = MsiEvaluateCondition(hpkg, "\"2\" < \"12.1\"");
1733     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1734
1735     r = MsiEvaluateCondition(hpkg, "\"02.1\" < \"2.11\"");
1736     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1737
1738     r = MsiEvaluateCondition(hpkg, "\"02.1.1\" < \"2.1\"");
1739     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1740
1741     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1742     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1743
1744     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1745     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1746
1747     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0\"");
1748     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1749
1750     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"-1\"");
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 < \"!\"");
1757     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1758
1759     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1760     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1761
1762     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"/\"");
1763     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1764
1765     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \" \"");
1766     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1767
1768     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"azAZ_\"");
1769     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1770
1771     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]\"");
1772     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1773
1774     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]a\"");
1775     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1776
1777     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]\"");
1778     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1779
1780     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]a\"");
1781     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1782
1783     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a}\"");
1784     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1785
1786     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a\"");
1787     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1788
1789     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a\"");
1790     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1791
1792     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a{\"");
1793     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1794
1795     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a]\"");
1796     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1797
1798     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"A\"");
1799     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1800
1801     MsiSetProperty(hpkg, "MsiNetAssemblySupport", "1.1.4322");
1802     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1803     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1804
1805     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.14322\"");
1806     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1807
1808     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.5\"");
1809     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1810
1811     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1812     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1813
1814     r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1815     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1816
1817     MsiSetProperty(hpkg, "one", "1");
1818     r = MsiEvaluateCondition(hpkg, "one < \"1\"");
1819     ok( r == MSICONDITION_FALSE, "wrong return val\n");
1820
1821     MsiSetProperty(hpkg, "X", "5.0");
1822
1823     r = MsiEvaluateCondition(hpkg, "X != \"\"");
1824     ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1825
1826     r = MsiEvaluateCondition(hpkg, "X =\"5.0\"");
1827     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1828
1829     r = MsiEvaluateCondition(hpkg, "X =\"5.1\"");
1830     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1831
1832     r = MsiEvaluateCondition(hpkg, "X =\"6.0\"");
1833     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1834
1835     r = MsiEvaluateCondition(hpkg, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1836     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1837
1838     r = MsiEvaluateCondition(hpkg, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1839     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1840
1841     r = MsiEvaluateCondition(hpkg, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1842     ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1843
1844     /* feature doesn't exist */
1845     r = MsiEvaluateCondition(hpkg, "&nofeature");
1846     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1847
1848     MsiSetProperty(hpkg, "A", "2");
1849     MsiSetProperty(hpkg, "X", "50");
1850
1851     r = MsiEvaluateCondition(hpkg, "2 <= X");
1852     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1853
1854     r = MsiEvaluateCondition(hpkg, "A <= X");
1855     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1856
1857     r = MsiEvaluateCondition(hpkg, "A <= 50");
1858     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1859
1860     MsiSetProperty(hpkg, "X", "50val");
1861
1862     r = MsiEvaluateCondition(hpkg, "2 <= X");
1863     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1864
1865     r = MsiEvaluateCondition(hpkg, "A <= X");
1866     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1867
1868     MsiSetProperty(hpkg, "A", "7");
1869     MsiSetProperty(hpkg, "X", "50");
1870
1871     r = MsiEvaluateCondition(hpkg, "7 <= X");
1872     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1873
1874     r = MsiEvaluateCondition(hpkg, "A <= X");
1875     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1876
1877     r = MsiEvaluateCondition(hpkg, "A <= 50");
1878     ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1879
1880     MsiSetProperty(hpkg, "X", "50val");
1881
1882     r = MsiEvaluateCondition(hpkg, "2 <= X");
1883     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1884
1885     r = MsiEvaluateCondition(hpkg, "A <= X");
1886     ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1887
1888     MsiCloseHandle( hpkg );
1889     DeleteFile(msifile);
1890 }
1891
1892 static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop)
1893 {
1894     UINT r;
1895     DWORD sz;
1896     char buffer[2];
1897
1898     sz = sizeof buffer;
1899     strcpy(buffer,"x");
1900     r = MsiGetProperty( hpkg, prop, buffer, &sz );
1901     return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
1902 }
1903
1904 static void test_props(void)
1905 {
1906     MSIHANDLE hpkg, hdb;
1907     UINT r;
1908     DWORD sz;
1909     char buffer[0x100];
1910
1911     hdb = create_package_db();
1912     r = run_query( hdb,
1913             "CREATE TABLE `Property` ( "
1914             "`Property` CHAR(255) NOT NULL, "
1915             "`Value` CHAR(255) "
1916             "PRIMARY KEY `Property`)" );
1917     ok( r == ERROR_SUCCESS , "Failed\n" );
1918
1919     r = run_query(hdb,
1920             "INSERT INTO `Property` "
1921             "(`Property`, `Value`) "
1922             "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1923     ok( r == ERROR_SUCCESS , "Failed\n" );
1924
1925     r = package_from_db( hdb, &hpkg );
1926     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
1927     {
1928         skip("Not enough rights to perform tests\n");
1929         DeleteFile(msifile);
1930         return;
1931     }
1932     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
1933
1934     /* test invalid values */
1935     r = MsiGetProperty( 0, NULL, NULL, NULL );
1936     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1937
1938     r = MsiGetProperty( hpkg, NULL, NULL, NULL );
1939     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1940
1941     r = MsiGetProperty( hpkg, "boo", NULL, NULL );
1942     ok( r == ERROR_SUCCESS, "wrong return val\n");
1943
1944     r = MsiGetProperty( hpkg, "boo", buffer, NULL );
1945     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1946
1947     /* test retrieving an empty/nonexistent property */
1948     sz = sizeof buffer;
1949     r = MsiGetProperty( hpkg, "boo", NULL, &sz );
1950     ok( r == ERROR_SUCCESS, "wrong return val\n");
1951     ok( sz == 0, "wrong size returned\n");
1952
1953     check_prop_empty( hpkg, "boo");
1954     sz = 0;
1955     strcpy(buffer,"x");
1956     r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1957     ok( r == ERROR_MORE_DATA, "wrong return val\n");
1958     ok( !strcmp(buffer,"x"), "buffer was changed\n");
1959     ok( sz == 0, "wrong size returned\n");
1960
1961     sz = 1;
1962     strcpy(buffer,"x");
1963     r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1964     ok( r == ERROR_SUCCESS, "wrong return val\n");
1965     ok( buffer[0] == 0, "buffer was not changed\n");
1966     ok( sz == 0, "wrong size returned\n");
1967
1968     /* set the property to something */
1969     r = MsiSetProperty( 0, NULL, NULL );
1970     ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1971
1972     r = MsiSetProperty( hpkg, NULL, NULL );
1973     ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1974
1975     r = MsiSetProperty( hpkg, "", NULL );
1976     ok( r == ERROR_SUCCESS, "wrong return val\n");
1977
1978     /* try set and get some illegal property identifiers */
1979     r = MsiSetProperty( hpkg, "", "asdf" );
1980     ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n");
1981
1982     r = MsiSetProperty( hpkg, "=", "asdf" );
1983     ok( r == ERROR_SUCCESS, "wrong return val\n");
1984
1985     r = MsiSetProperty( hpkg, " ", "asdf" );
1986     ok( r == ERROR_SUCCESS, "wrong return val\n");
1987
1988     r = MsiSetProperty( hpkg, "'", "asdf" );
1989     ok( r == ERROR_SUCCESS, "wrong return val\n");
1990
1991     sz = sizeof buffer;
1992     buffer[0]=0;
1993     r = MsiGetProperty( hpkg, "'", buffer, &sz );
1994     ok( r == ERROR_SUCCESS, "wrong return val\n");
1995     ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
1996
1997     /* set empty values */
1998     r = MsiSetProperty( hpkg, "boo", NULL );
1999     ok( r == ERROR_SUCCESS, "wrong return val\n");
2000     ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
2001
2002     r = MsiSetProperty( hpkg, "boo", "" );
2003     ok( r == ERROR_SUCCESS, "wrong return val\n");
2004     ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
2005
2006     /* set a non-empty value */
2007     r = MsiSetProperty( hpkg, "boo", "xyz" );
2008     ok( r == ERROR_SUCCESS, "wrong return val\n");
2009
2010     sz = 1;
2011     strcpy(buffer,"x");
2012     r = MsiGetProperty( hpkg, "boo", buffer, &sz );
2013     ok( r == ERROR_MORE_DATA, "wrong return val\n");
2014     ok( buffer[0] == 0, "buffer was not changed\n");
2015     ok( sz == 3, "wrong size returned\n");
2016
2017     sz = 4;
2018     strcpy(buffer,"x");
2019     r = MsiGetProperty( hpkg, "boo", buffer, &sz );
2020     ok( r == ERROR_SUCCESS, "wrong return val\n");
2021     ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
2022     ok( sz == 3, "wrong size returned\n");
2023
2024     sz = 3;
2025     strcpy(buffer,"x");
2026     r = MsiGetProperty( hpkg, "boo", buffer, &sz );
2027     ok( r == ERROR_MORE_DATA, "wrong return val\n");
2028     ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
2029     ok( sz == 3, "wrong size returned\n");
2030
2031     r = MsiSetProperty(hpkg, "SourceDir", "foo");
2032     ok( r == ERROR_SUCCESS, "wrong return val\n");
2033
2034     sz = 4;
2035     r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
2036     ok( r == ERROR_SUCCESS, "wrong return val\n");
2037     ok( !strcmp(buffer,""), "buffer wrong\n");
2038     ok( sz == 0, "wrong size returned\n");
2039
2040     sz = 4;
2041     r = MsiGetProperty(hpkg, "SOMERANDOMNAME", buffer, &sz);
2042     ok( r == ERROR_SUCCESS, "wrong return val\n");
2043     ok( !strcmp(buffer,""), "buffer wrong\n");
2044     ok( sz == 0, "wrong size returned\n");
2045
2046     sz = 4;
2047     r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
2048     ok( r == ERROR_SUCCESS, "wrong return val\n");
2049     ok( !strcmp(buffer,"foo"), "buffer wrong\n");
2050     ok( sz == 3, "wrong size returned\n");
2051
2052     r = MsiSetProperty(hpkg, "MetadataCompName", "Photoshop.dll");
2053     ok( r == ERROR_SUCCESS, "wrong return val\n");
2054
2055     sz = 0;
2056     r = MsiGetProperty(hpkg, "MetadataCompName", NULL, &sz );
2057     ok( r == ERROR_SUCCESS, "return wrong\n");
2058     ok( sz == 13, "size wrong (%d)\n", sz);
2059
2060     sz = 13;
2061     r = MsiGetProperty(hpkg, "MetadataCompName", buffer, &sz );
2062     ok( r == ERROR_MORE_DATA, "return wrong\n");
2063     ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n");
2064
2065     r = MsiSetProperty(hpkg, "property", "value");
2066     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2067
2068     sz = 6;
2069     r = MsiGetProperty(hpkg, "property", buffer, &sz);
2070     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2071     ok( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer);
2072
2073     r = MsiSetProperty(hpkg, "property", NULL);
2074     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2075
2076     sz = 6;
2077     r = MsiGetProperty(hpkg, "property", buffer, &sz);
2078     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2079     ok( !strlen(buffer), "Expected empty string, got %s\n", buffer);
2080
2081     MsiCloseHandle( hpkg );
2082     DeleteFile(msifile);
2083 }
2084
2085 static BOOL find_prop_in_property(MSIHANDLE hdb, LPCSTR prop, LPCSTR val)
2086 {
2087     MSIHANDLE hview, hrec;
2088     BOOL found;
2089     CHAR buffer[MAX_PATH];
2090     DWORD sz;
2091     UINT r;
2092
2093     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
2094     ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2095     r = MsiViewExecute(hview, 0);
2096     ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
2097
2098     found = FALSE;
2099     while (r == ERROR_SUCCESS && !found)
2100     {
2101         r = MsiViewFetch(hview, &hrec);
2102         if (r != ERROR_SUCCESS) break;
2103
2104         sz = MAX_PATH;
2105         r = MsiRecordGetString(hrec, 1, buffer, &sz);
2106         if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
2107         {
2108             sz = MAX_PATH;
2109             r = MsiRecordGetString(hrec, 2, buffer, &sz);
2110             if (r == ERROR_SUCCESS && !lstrcmpA(buffer, val))
2111                 found = TRUE;
2112         }
2113
2114         MsiCloseHandle(hrec);
2115     }
2116
2117     MsiViewClose(hview);
2118     MsiCloseHandle(hview);
2119
2120     return found;
2121 }
2122
2123 static void test_property_table(void)
2124 {
2125     const char *query;
2126     UINT r;
2127     MSIHANDLE hpkg, hdb, hrec;
2128     char buffer[MAX_PATH], package[10];
2129     DWORD sz;
2130     BOOL found;
2131
2132     hdb = create_package_db();
2133     ok( hdb, "failed to create package\n");
2134
2135     r = package_from_db(hdb, &hpkg);
2136     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2137     {
2138         skip("Not enough rights to perform tests\n");
2139         DeleteFile(msifile);
2140         return;
2141     }
2142     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
2143
2144     MsiCloseHandle(hdb);
2145
2146     hdb = MsiGetActiveDatabase(hpkg);
2147
2148     query = "CREATE TABLE `_Property` ( "
2149         "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2150     r = run_query(hdb, query);
2151     ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2152
2153     MsiCloseHandle(hdb);
2154     MsiCloseHandle(hpkg);
2155     DeleteFile(msifile);
2156
2157     hdb = create_package_db();
2158     ok( hdb, "failed to create package\n");
2159
2160     query = "CREATE TABLE `_Property` ( "
2161         "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2162     r = run_query(hdb, query);
2163     ok(r == ERROR_SUCCESS, "failed to create table\n");
2164
2165     query = "ALTER `_Property` ADD `foo` INTEGER";
2166     r = run_query(hdb, query);
2167     ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2168
2169     query = "ALTER TABLE `_Property` ADD `foo` INTEGER";
2170     r = run_query(hdb, query);
2171     ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2172
2173     query = "ALTER TABLE `_Property` ADD `extra` INTEGER";
2174     r = run_query(hdb, query);
2175     ok(r == ERROR_SUCCESS, "failed to add column\n");
2176
2177     sprintf(package, "#%i", hdb);
2178     r = MsiOpenPackage(package, &hpkg);
2179     todo_wine ok(r != ERROR_SUCCESS, "MsiOpenPackage succeeded\n");
2180     if (r == ERROR_SUCCESS)
2181         MsiCloseHandle(hpkg);
2182
2183     r = MsiCloseHandle(hdb);
2184     ok(r == ERROR_SUCCESS, "MsiCloseHandle failed %u\n", r);
2185
2186     hdb = create_package_db();
2187     ok (hdb, "failed to create package database\n");
2188
2189     r = create_property_table(hdb);
2190     ok(r == ERROR_SUCCESS, "cannot create Property table: %d\n", r);
2191
2192     r = add_property_entry(hdb, "'prop', 'val'");
2193     ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2194
2195     r = package_from_db(hdb, &hpkg);
2196     ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
2197
2198     MsiCloseHandle(hdb);
2199
2200     sz = MAX_PATH;
2201     r = MsiGetProperty(hpkg, "prop", buffer, &sz);
2202     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2203     ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
2204
2205     hdb = MsiGetActiveDatabase(hpkg);
2206
2207     found = find_prop_in_property(hdb, "prop", "val");
2208     ok(found, "prop should be in the _Property table\n");
2209
2210     r = add_property_entry(hdb, "'dantes', 'mercedes'");
2211     ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2212
2213     query = "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
2214     r = do_query(hdb, query, &hrec);
2215     ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2216
2217     found = find_prop_in_property(hdb, "dantes", "mercedes");
2218     ok(found == FALSE, "dantes should not be in the _Property table\n");
2219
2220     sz = MAX_PATH;
2221     lstrcpy(buffer, "aaa");
2222     r = MsiGetProperty(hpkg, "dantes", buffer, &sz);
2223     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2224     ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer);
2225
2226     r = MsiSetProperty(hpkg, "dantes", "mercedes");
2227     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2228
2229     found = find_prop_in_property(hdb, "dantes", "mercedes");
2230     ok(found == TRUE, "dantes should be in the _Property table\n");
2231
2232     MsiCloseHandle(hdb);
2233     MsiCloseHandle(hpkg);
2234     DeleteFile(msifile);
2235 }
2236
2237 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
2238 {
2239     MSIHANDLE htab = 0;
2240     UINT res;
2241
2242     res = MsiDatabaseOpenView( hdb, szQuery, &htab );
2243     if( res == ERROR_SUCCESS )
2244     {
2245         UINT r;
2246
2247         r = MsiViewExecute( htab, hrec );
2248         if( r != ERROR_SUCCESS )
2249         {
2250             res = r;
2251             fprintf(stderr,"MsiViewExecute failed %08x\n", res);
2252         }
2253
2254         r = MsiViewClose( htab );
2255         if( r != ERROR_SUCCESS )
2256             res = r;
2257
2258         r = MsiCloseHandle( htab );
2259         if( r != ERROR_SUCCESS )
2260             res = r;
2261     }
2262     return res;
2263 }
2264
2265 static UINT try_query( MSIHANDLE hdb, LPCSTR szQuery )
2266 {
2267     return try_query_param( hdb, szQuery, 0 );
2268 }
2269
2270 static void set_summary_str(MSIHANDLE hdb, DWORD pid, LPCSTR value)
2271 {
2272     MSIHANDLE summary;
2273     UINT r;
2274
2275     r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2276     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2277
2278     r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
2279     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2280
2281     r = MsiSummaryInfoPersist(summary);
2282     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2283
2284     MsiCloseHandle(summary);
2285 }
2286
2287 static void set_summary_dword(MSIHANDLE hdb, DWORD pid, DWORD value)
2288 {
2289     MSIHANDLE summary;
2290     UINT r;
2291
2292     r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2293     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2294
2295     r = MsiSummaryInfoSetPropertyA(summary, pid, VT_I4, value, NULL, NULL);
2296     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2297
2298     r = MsiSummaryInfoPersist(summary);
2299     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2300
2301     MsiCloseHandle(summary);
2302 }
2303
2304 static void test_msipackage(void)
2305 {
2306     MSIHANDLE hdb = 0, hpack = 100;
2307     UINT r;
2308     const char *query;
2309     char name[10];
2310
2311     /* NULL szPackagePath */
2312     r = MsiOpenPackage(NULL, &hpack);
2313     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2314
2315     /* empty szPackagePath */
2316     r = MsiOpenPackage("", &hpack);
2317     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2318     {
2319         skip("Not enough rights to perform tests\n");
2320         return;
2321     }
2322     todo_wine
2323     {
2324         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2325     }
2326
2327     if (r == ERROR_SUCCESS)
2328         MsiCloseHandle(hpack);
2329
2330     /* nonexistent szPackagePath */
2331     r = MsiOpenPackage("nonexistent", &hpack);
2332     ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2333
2334     /* NULL hProduct */
2335     r = MsiOpenPackage(msifile, NULL);
2336     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2337
2338     name[0]='#';
2339     name[1]=0;
2340     r = MsiOpenPackage(name, &hpack);
2341     ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r);
2342
2343     r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2344     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2345
2346     /* database exists, but is emtpy */
2347     sprintf(name, "#%d", hdb);
2348     r = MsiOpenPackage(name, &hpack);
2349     ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2350        "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2351
2352     query = "CREATE TABLE `Property` ( "
2353             "`Property` CHAR(72), `Value` CHAR(0) "
2354             "PRIMARY KEY `Property`)";
2355     r = try_query(hdb, query);
2356     ok(r == ERROR_SUCCESS, "failed to create Properties table\n");
2357
2358     query = "CREATE TABLE `InstallExecuteSequence` ("
2359             "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2360             "PRIMARY KEY `Action`)";
2361     r = try_query(hdb, query);
2362     ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n");
2363
2364     /* a few key tables exist */
2365     sprintf(name, "#%d", hdb);
2366     r = MsiOpenPackage(name, &hpack);
2367     ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2368        "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2369
2370     MsiCloseHandle(hdb);
2371     DeleteFile(msifile);
2372
2373     /* start with a clean database to show what constitutes a valid package */
2374     r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2375     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2376
2377     sprintf(name, "#%d", hdb);
2378
2379     /* The following summary information props must exist:
2380      *  - PID_REVNUMBER
2381      *  - PID_PAGECOUNT
2382      */
2383
2384     set_summary_dword(hdb, PID_PAGECOUNT, 100);
2385     r = MsiOpenPackage(name, &hpack);
2386     ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2387        "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2388
2389     set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2390     r = MsiOpenPackage(name, &hpack);
2391     ok(r == ERROR_SUCCESS,
2392        "Expected ERROR_SUCCESS, got %d\n", r);
2393
2394     MsiCloseHandle(hpack);
2395     MsiCloseHandle(hdb);
2396     DeleteFile(msifile);
2397 }
2398
2399 static void test_formatrecord2(void)
2400 {
2401     MSIHANDLE hpkg, hrec ;
2402     char buffer[0x100];
2403     DWORD sz;
2404     UINT r;
2405
2406     r = package_from_db(create_package_db(), &hpkg);
2407     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2408     {
2409         skip("Not enough rights to perform tests\n");
2410         DeleteFile(msifile);
2411         return;
2412     }
2413     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
2414
2415     r = MsiSetProperty(hpkg, "Manufacturer", " " );
2416     ok( r == ERROR_SUCCESS, "set property failed\n");
2417
2418     hrec = MsiCreateRecord(2);
2419     ok(hrec, "create record failed\n");
2420
2421     r = MsiRecordSetString( hrec, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2422     ok( r == ERROR_SUCCESS, "format record failed\n");
2423
2424     buffer[0] = 0;
2425     sz = sizeof buffer;
2426     r = MsiFormatRecord( hpkg, hrec, buffer, &sz );
2427
2428     r = MsiRecordSetString(hrec, 0, "[foo][1]");
2429     r = MsiRecordSetString(hrec, 1, "hoo");
2430     sz = sizeof buffer;
2431     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2432     ok( sz == 3, "size wrong\n");
2433     ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2434     ok( r == ERROR_SUCCESS, "format failed\n");
2435
2436     r = MsiRecordSetString(hrec, 0, "x[~]x");
2437     sz = sizeof buffer;
2438     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2439     ok( sz == 3, "size wrong\n");
2440     ok( 0 == strcmp(buffer,"x"), "wrong output %s\n",buffer);
2441     ok( r == ERROR_SUCCESS, "format failed\n");
2442
2443     r = MsiRecordSetString(hrec, 0, "[foo.$%}][1]");
2444     r = MsiRecordSetString(hrec, 1, "hoo");
2445     sz = sizeof buffer;
2446     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2447     ok( sz == 3, "size wrong\n");
2448     ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2449     ok( r == ERROR_SUCCESS, "format failed\n");
2450
2451     r = MsiRecordSetString(hrec, 0, "[\\[]");
2452     sz = sizeof buffer;
2453     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2454     ok( sz == 1, "size wrong\n");
2455     ok( 0 == strcmp(buffer,"["), "wrong output %s\n",buffer);
2456     ok( r == ERROR_SUCCESS, "format failed\n");
2457
2458     SetEnvironmentVariable("FOO", "BAR");
2459     r = MsiRecordSetString(hrec, 0, "[%FOO]");
2460     sz = sizeof buffer;
2461     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2462     ok( sz == 3, "size wrong\n");
2463     ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2464     ok( r == ERROR_SUCCESS, "format failed\n");
2465
2466     r = MsiRecordSetString(hrec, 0, "[[1]]");
2467     r = MsiRecordSetString(hrec, 1, "%FOO");
2468     sz = sizeof buffer;
2469     r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2470     ok( sz == 3, "size wrong\n");
2471     ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2472     ok( r == ERROR_SUCCESS, "format failed\n");
2473
2474     MsiCloseHandle( hrec );
2475     MsiCloseHandle( hpkg );
2476     DeleteFile(msifile);
2477 }
2478
2479 static void test_states(void)
2480 {
2481     MSIHANDLE hpkg;
2482     UINT r;
2483     MSIHANDLE hdb;
2484     INSTALLSTATE state, action;
2485
2486     static const CHAR msifile2[] = "winetest2-package.msi";
2487     static const CHAR msifile3[] = "winetest3-package.msi";
2488     static const CHAR msifile4[] = "winetest4-package.msi";
2489
2490     if (is_process_limited())
2491     {
2492         skip("process is limited\n");
2493         return;
2494     }
2495
2496     hdb = create_package_db();
2497     ok ( hdb, "failed to create package database\n" );
2498
2499     r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
2500     ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
2501
2502     r = create_property_table( hdb );
2503     ok( r == ERROR_SUCCESS, "cannot create Property table: %d\n", r );
2504
2505     r = add_property_entry( hdb, "'ProductCode', '{7262AC98-EEBD-4364-8CE3-D654F6A425B9}'" );
2506     ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2507
2508     r = add_property_entry( hdb, "'ProductLanguage', '1033'" );
2509     ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2510
2511     r = add_property_entry( hdb, "'ProductName', 'MSITEST'" );
2512     ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2513
2514     r = add_property_entry( hdb, "'ProductVersion', '1.1.1'" );
2515     ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2516
2517     r = add_property_entry( hdb, "'MSIFASTINSTALL', '1'" );
2518     ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2519
2520     r = create_install_execute_sequence_table( hdb );
2521     ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table: %d\n", r );
2522
2523     r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
2524     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2525
2526     r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
2527     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2528
2529     r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
2530     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2531
2532     r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" );
2533     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2534
2535     r = add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" );
2536     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2537
2538     r = add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" );
2539     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2540
2541     r = add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" );
2542     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2543
2544     r = add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" );
2545     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2546
2547     r = add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" );
2548     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2549
2550     r = add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" );
2551     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2552
2553     r = add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" );
2554     ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2555
2556     r = create_media_table( hdb );
2557     ok( r == ERROR_SUCCESS, "cannot create media table: %d\n", r );
2558
2559     r = add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''");
2560     ok( r == ERROR_SUCCESS, "cannot add media entry: %d\n", r );
2561
2562     r = create_feature_table( hdb );
2563     ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
2564
2565     r = create_component_table( hdb );
2566     ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
2567
2568     /* msidbFeatureAttributesFavorLocal */
2569     r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
2570     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2571
2572     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2573     r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2574     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2575
2576     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2577     r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2578     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2579
2580     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2581     r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2582     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2583
2584     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2585     r = add_component_entry( hdb, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2586     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2587
2588     /* msidbFeatureAttributesFavorSource */
2589     r = add_feature_entry( hdb, "'two', '', '', '', 2, 1, '', 1" );
2590     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2591
2592     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2593     r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2594     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2595
2596     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2597     r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2598     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2599
2600     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2601     r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2602     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2603
2604     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2605     r = add_component_entry( hdb, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2606     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2607
2608     /* msidbFeatureAttributesFavorSource */
2609     r = add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" );
2610     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2611
2612     /* msidbFeatureAttributesFavorLocal */
2613     r = add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" );
2614     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2615
2616     /* disabled */
2617     r = add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" );
2618     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2619
2620     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2621     r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2622     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2623
2624     /* no feature parent:msidbComponentAttributesLocalOnly */
2625     r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2626     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2627
2628     /* msidbFeatureAttributesFavorLocal:removed */
2629     r = add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" );
2630     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2631
2632     /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2633     r = add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2634     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2635
2636     /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2637     r = add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2638     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2639
2640     /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2641     r = add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2642     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2643
2644     /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2645     r = add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2646     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2647
2648     /* msidbFeatureAttributesFavorSource:removed */
2649     r = add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" );
2650     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2651
2652     /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2653     r = add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2654     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2655
2656     /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2657     r = add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2658     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2659
2660     /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2661     r = add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2662     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2663
2664     /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2665     r = add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2666     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2667
2668     /* msidbFeatureAttributesFavorLocal */
2669     r = add_feature_entry( hdb, "'eight', '', '', '', 2, 1, '', 0" );
2670     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2671
2672     r = add_component_entry( hdb, "'tau', '{07DEB510-677C-4A6F-A0A6-7CD8EFEA77ED}', 'TARGETDIR', 1, '', 'tau_file'" );
2673     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2674
2675     /* msidbFeatureAttributesFavorSource */
2676     r = add_feature_entry( hdb, "'nine', '', '', '', 2, 1, '', 1" );
2677     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2678
2679     r = add_component_entry( hdb, "'phi', '{9F0594C5-35AD-43EA-94DD-8DF73FAA664D}', 'TARGETDIR', 1, '', 'phi_file'" );
2680     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2681
2682     /* msidbFeatureAttributesFavorAdvertise */
2683     r = add_feature_entry( hdb, "'ten', '', '', '', 2, 1, '', 4" );
2684     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2685
2686     r = add_component_entry( hdb, "'chi', '{E6B539AB-5DA9-4236-A2D2-E341A50B4C38}', 'TARGETDIR', 1, '', 'chi_file'" );
2687     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2688
2689     /* msidbFeatureAttributesUIDisallowAbsent */
2690     r = add_feature_entry( hdb, "'eleven', '', '', '', 2, 1, '', 16" );
2691     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2692
2693     r = add_component_entry( hdb, "'psi', '{A06B23B5-746B-427A-8A6E-FD6AC8F46A95}', 'TARGETDIR', 1, '', 'psi_file'" );
2694     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2695
2696     r = create_feature_components_table( hdb );
2697     ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
2698
2699     r = add_feature_components_entry( hdb, "'one', 'alpha'" );
2700     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2701
2702     r = add_feature_components_entry( hdb, "'one', 'beta'" );
2703     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2704
2705     r = add_feature_components_entry( hdb, "'one', 'gamma'" );
2706     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2707
2708     r = add_feature_components_entry( hdb, "'one', 'theta'" );
2709     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2710
2711     r = add_feature_components_entry( hdb, "'two', 'delta'" );
2712     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2713
2714     r = add_feature_components_entry( hdb, "'two', 'epsilon'" );
2715     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2716
2717     r = add_feature_components_entry( hdb, "'two', 'zeta'" );
2718     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2719
2720     r = add_feature_components_entry( hdb, "'two', 'iota'" );
2721     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2722
2723     r = add_feature_components_entry( hdb, "'three', 'eta'" );
2724     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2725
2726     r = add_feature_components_entry( hdb, "'four', 'eta'" );
2727     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2728
2729     r = add_feature_components_entry( hdb, "'five', 'eta'" );
2730     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2731
2732     r = add_feature_components_entry( hdb, "'six', 'lambda'" );
2733     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2734
2735     r = add_feature_components_entry( hdb, "'six', 'mu'" );
2736     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2737
2738     r = add_feature_components_entry( hdb, "'six', 'nu'" );
2739     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2740
2741     r = add_feature_components_entry( hdb, "'six', 'xi'" );
2742     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2743
2744     r = add_feature_components_entry( hdb, "'seven', 'omicron'" );
2745     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2746
2747     r = add_feature_components_entry( hdb, "'seven', 'pi'" );
2748     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2749
2750     r = add_feature_components_entry( hdb, "'seven', 'rho'" );
2751     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2752
2753     r = add_feature_components_entry( hdb, "'seven', 'sigma'" );
2754     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2755
2756     r = add_feature_components_entry( hdb, "'eight', 'tau'" );
2757     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2758
2759     r = add_feature_components_entry( hdb, "'nine', 'phi'" );
2760     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2761
2762     r = add_feature_components_entry( hdb, "'ten', 'chi'" );
2763     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2764
2765     r = add_feature_components_entry( hdb, "'eleven', 'psi'" );
2766     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2767
2768     r = create_file_table( hdb );
2769     ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
2770
2771     r = add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2772     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2773
2774     r = add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2775     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2776
2777     r = add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2778     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2779
2780     r = add_file_entry( hdb, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2781     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2782
2783     r = add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2784     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2785
2786     r = add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2787     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2788
2789     r = add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2790     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2791
2792     r = add_file_entry( hdb, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2793     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2794
2795     /* compressed file */
2796     r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2797     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2798
2799     r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2800     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2801
2802     r = add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2803     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2804
2805     r = add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2806     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2807
2808     r = add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2809     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2810
2811     r = add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2812     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2813
2814     r = add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2815     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2816
2817     r = add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2818     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2819
2820     r = add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2821     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2822
2823     r = add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2824     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2825
2826     r = add_file_entry( hdb, "'tau_file', 'tau', 'tau.txt', 100, '', '1033', 8192, 1" );
2827     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2828
2829     r = add_file_entry( hdb, "'phi_file', 'phi', 'phi.txt', 100, '', '1033', 8192, 1" );
2830     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2831
2832     r = add_file_entry( hdb, "'chi_file', 'chi', 'chi.txt', 100, '', '1033', 8192, 1" );
2833     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2834
2835     r = add_file_entry( hdb, "'psi_file', 'psi', 'psi.txt', 100, '', '1033', 8192, 1" );
2836     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2837
2838     MsiDatabaseCommit(hdb);
2839
2840     /* these properties must not be in the saved msi file */
2841     r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
2842     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2843
2844     r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
2845     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2846
2847     r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
2848     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2849
2850     r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
2851     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2852
2853     r = add_property_entry( hdb, "'REINSTALLMODE', 'omus'");
2854     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2855
2856     r = package_from_db( hdb, &hpkg );
2857     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2858     {
2859         skip("Not enough rights to perform tests\n");
2860         DeleteFile(msifile);
2861         return;
2862     }
2863     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
2864
2865     MsiCloseHandle(hdb);
2866
2867     CopyFileA(msifile, msifile2, FALSE);
2868     CopyFileA(msifile, msifile3, FALSE);
2869     CopyFileA(msifile, msifile4, FALSE);
2870
2871     state = 0xdeadbee;
2872     action = 0xdeadbee;
2873     r = MsiGetFeatureState(hpkg, "one", &state, &action);
2874     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2875     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2876     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2877
2878     state = 0xdeadbee;
2879     action = 0xdeadbee;
2880     r = MsiGetFeatureState(hpkg, "two", &state, &action);
2881     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2882     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2883     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2884
2885     state = 0xdeadbee;
2886     action = 0xdeadbee;
2887     r = MsiGetFeatureState(hpkg, "three", &state, &action);
2888     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2889     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2890     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2891
2892     state = 0xdeadbee;
2893     action = 0xdeadbee;
2894     r = MsiGetFeatureState(hpkg, "four", &state, &action);
2895     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2896     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2897     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2898
2899     state = 0xdeadbee;
2900     action = 0xdeadbee;
2901     r = MsiGetFeatureState(hpkg, "five", &state, &action);
2902     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2903     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2904     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2905
2906     state = 0xdeadbee;
2907     action = 0xdeadbee;
2908     r = MsiGetFeatureState(hpkg, "six", &state, &action);
2909     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2910     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2911     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2912
2913     state = 0xdeadbee;
2914     action = 0xdeadbee;
2915     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2916     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2917     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2918     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2919
2920     state = 0xdeadbee;
2921     action = 0xdeadbee;
2922     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
2923     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2924     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2925     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2926
2927     state = 0xdeadbee;
2928     action = 0xdeadbee;
2929     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
2930     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2931     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2932     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2933
2934     state = 0xdeadbee;
2935     action = 0xdeadbee;
2936     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
2937     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2938     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2939     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2940
2941     state = 0xdeadbee;
2942     action = 0xdeadbee;
2943     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
2944     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2945     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2946     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2947
2948     state = 0xdeadbee;
2949     action = 0xdeadbee;
2950     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2951     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2952     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2953     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2954
2955     state = 0xdeadbee;
2956     action = 0xdeadbee;
2957     r = MsiGetComponentState(hpkg, "beta", &state, &action);
2958     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2959     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2960     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2961
2962     state = 0xdeadbee;
2963     action = 0xdeadbee;
2964     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2965     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2966     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2967     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2968
2969     state = 0xdeadbee;
2970     action = 0xdeadbee;
2971     r = MsiGetComponentState(hpkg, "theta", &state, &action);
2972     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2973     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2974     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2975
2976     state = 0xdeadbee;
2977     action = 0xdeadbee;
2978     r = MsiGetComponentState(hpkg, "delta", &state, &action);
2979     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2980     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2981     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2982
2983     state = 0xdeadbee;
2984     action = 0xdeadbee;
2985     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2986     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2987     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2988     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2989
2990     state = 0xdeadbee;
2991     action = 0xdeadbee;
2992     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2993     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2994     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2995     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2996
2997     state = 0xdeadbee;
2998     action = 0xdeadbee;
2999     r = MsiGetComponentState(hpkg, "iota", &state, &action);
3000     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3001     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3002     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3003
3004     state = 0xdeadbee;
3005     action = 0xdeadbee;
3006     r = MsiGetComponentState(hpkg, "eta", &state, &action);
3007     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3008     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3009     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3010
3011     state = 0xdeadbee;
3012     action = 0xdeadbee;
3013     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3014     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3015     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3016     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3017
3018     state = 0xdeadbee;
3019     action = 0xdeadbee;
3020     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3021     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3022     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3023     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3024
3025     state = 0xdeadbee;
3026     action = 0xdeadbee;
3027     r = MsiGetComponentState(hpkg, "mu", &state, &action);
3028     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3029     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3030     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3031
3032     state = 0xdeadbee;
3033     action = 0xdeadbee;
3034     r = MsiGetComponentState(hpkg, "nu", &state, &action);
3035     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3036     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3037     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3038
3039     state = 0xdeadbee;
3040     action = 0xdeadbee;
3041     r = MsiGetComponentState(hpkg, "xi", &state, &action);
3042     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3043     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3044     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3045
3046     state = 0xdeadbee;
3047     action = 0xdeadbee;
3048     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3049     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3050     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3051     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3052
3053     state = 0xdeadbee;
3054     action = 0xdeadbee;
3055     r = MsiGetComponentState(hpkg, "pi", &state, &action);
3056     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3057     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3058     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3059
3060     state = 0xdeadbee;
3061     action = 0xdeadbee;
3062     r = MsiGetComponentState(hpkg, "rho", &state, &action);
3063     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3064     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3065     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3066
3067     state = 0xdeadbee;
3068     action = 0xdeadbee;
3069     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3070     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3071     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3072     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3073
3074     state = 0xdeadbee;
3075     action = 0xdeadbee;
3076     r = MsiGetComponentState(hpkg, "tau", &state, &action);
3077     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3078     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3079     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3080
3081     state = 0xdeadbee;
3082     action = 0xdeadbee;
3083     r = MsiGetComponentState(hpkg, "phi", &state, &action);
3084     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3085     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3086     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3087
3088     state = 0xdeadbee;
3089     action = 0xdeadbee;
3090     r = MsiGetComponentState(hpkg, "chi", &state, &action);
3091     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3092     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3093     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3094
3095     state = 0xdeadbee;
3096     action = 0xdeadbee;
3097     r = MsiGetComponentState(hpkg, "psi", &state, &action);
3098     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3099     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3100     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3101
3102     r = MsiDoAction( hpkg, "CostInitialize");
3103     ok( r == ERROR_SUCCESS, "cost init failed\n");
3104
3105     state = 0xdeadbee;
3106     action = 0xdeadbee;
3107     r = MsiGetFeatureState(hpkg, "one", &state, &action);
3108     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3109     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3110     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3111
3112     state = 0xdeadbee;
3113     action = 0xdeadbee;
3114     r = MsiGetFeatureState(hpkg, "two", &state, &action);
3115     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3116     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3117     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3118
3119     state = 0xdeadbee;
3120     action = 0xdeadbee;
3121     r = MsiGetFeatureState(hpkg, "three", &state, &action);
3122     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3123     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3124     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3125
3126     state = 0xdeadbee;
3127     action = 0xdeadbee;
3128     r = MsiGetFeatureState(hpkg, "four", &state, &action);
3129     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3130     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3131     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3132
3133     state = 0xdeadbee;
3134     action = 0xdeadbee;
3135     r = MsiGetFeatureState(hpkg, "five", &state, &action);
3136     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3137     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3138     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3139
3140     state = 0xdeadbee;
3141     action = 0xdeadbee;
3142     r = MsiGetFeatureState(hpkg, "six", &state, &action);
3143     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3144     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3145     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3146
3147     state = 0xdeadbee;
3148     action = 0xdeadbee;
3149     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3150     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3151     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3152     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3153
3154     state = 0xdeadbee;
3155     action = 0xdeadbee;
3156     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3157     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3158     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3159     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3160
3161     state = 0xdeadbee;
3162     action = 0xdeadbee;
3163     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3164     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3165     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3166     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3167
3168     state = 0xdeadbee;
3169     action = 0xdeadbee;
3170     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3171     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3172     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3173     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3174
3175     state = 0xdeadbee;
3176     action = 0xdeadbee;
3177     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
3178     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3179     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3180     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3181
3182     state = 0xdeadbee;
3183     action = 0xdeadbee;
3184     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3185     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3186     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3187     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3188
3189     state = 0xdeadbee;
3190     action = 0xdeadbee;
3191     r = MsiGetComponentState(hpkg, "beta", &state, &action);
3192     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3193     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3194     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3195
3196     state = 0xdeadbee;
3197     action = 0xdeadbee;
3198     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3199     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3200     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3201     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3202
3203     state = 0xdeadbee;
3204     action = 0xdeadbee;
3205     r = MsiGetComponentState(hpkg, "theta", &state, &action);
3206     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3207     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3208     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3209
3210     state = 0xdeadbee;
3211     action = 0xdeadbee;
3212     r = MsiGetComponentState(hpkg, "delta", &state, &action);
3213     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3214     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3215     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3216
3217     state = 0xdeadbee;
3218     action = 0xdeadbee;
3219     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3220     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3221     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3222     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3223
3224     state = 0xdeadbee;
3225     action = 0xdeadbee;
3226     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3227     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3228     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3229     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3230
3231     state = 0xdeadbee;
3232     action = 0xdeadbee;
3233     r = MsiGetComponentState(hpkg, "iota", &state, &action);
3234     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3235     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3236     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3237
3238     state = 0xdeadbee;
3239     action = 0xdeadbee;
3240     r = MsiGetComponentState(hpkg, "eta", &state, &action);
3241     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3242     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3243     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3244
3245     state = 0xdeadbee;
3246     action = 0xdeadbee;
3247     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3248     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3249     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3250     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3251
3252     state = 0xdeadbee;
3253     action = 0xdeadbee;
3254     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3255     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3256     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3257     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3258
3259     state = 0xdeadbee;
3260     action = 0xdeadbee;
3261     r = MsiGetComponentState(hpkg, "mu", &state, &action);
3262     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3263     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3264     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3265
3266     state = 0xdeadbee;
3267     action = 0xdeadbee;
3268     r = MsiGetComponentState(hpkg, "nu", &state, &action);
3269     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3270     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3271     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3272
3273     state = 0xdeadbee;
3274     action = 0xdeadbee;
3275     r = MsiGetComponentState(hpkg, "xi", &state, &action);
3276     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3277     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3278     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3279
3280     state = 0xdeadbee;
3281     action = 0xdeadbee;
3282     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3283     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3284     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3285     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3286
3287     state = 0xdeadbee;
3288     action = 0xdeadbee;
3289     r = MsiGetComponentState(hpkg, "pi", &state, &action);
3290     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3291     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3292     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3293
3294     state = 0xdeadbee;
3295     action = 0xdeadbee;
3296     r = MsiGetComponentState(hpkg, "rho", &state, &action);
3297     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3298     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3299     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3300
3301     state = 0xdeadbee;
3302     action = 0xdeadbee;
3303     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3304     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3305     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3306     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3307
3308     state = 0xdeadbee;
3309     action = 0xdeadbee;
3310     r = MsiGetComponentState(hpkg, "tau", &state, &action);
3311     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3312     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3313     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3314
3315     state = 0xdeadbee;
3316     action = 0xdeadbee;
3317     r = MsiGetComponentState(hpkg, "phi", &state, &action);
3318     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3319     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3320     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3321
3322     state = 0xdeadbee;
3323     action = 0xdeadbee;
3324     r = MsiGetComponentState(hpkg, "chi", &state, &action);
3325     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3326     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3327     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3328
3329     state = 0xdeadbee;
3330     action = 0xdeadbee;
3331     r = MsiGetComponentState(hpkg, "psi", &state, &action);
3332     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3333     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3334     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3335
3336     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3337
3338     r = MsiDoAction( hpkg, "FileCost");
3339     ok( r == ERROR_SUCCESS, "file cost failed\n");
3340
3341     r = MsiGetFeatureState(hpkg, "one", NULL, NULL);
3342     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3343
3344     action = 0xdeadbee;
3345     r = MsiGetFeatureState(hpkg, "one", NULL, &action);
3346     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3347     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3348
3349     state = 0xdeadbee;
3350     r = MsiGetFeatureState( hpkg, "one", &state, NULL);
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
3354     state = 0xdeadbee;
3355     action = 0xdeadbee;
3356     r = MsiGetFeatureState(hpkg, "one", &state, &action);
3357     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3358     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3359     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3360
3361     state = 0xdeadbee;
3362     action = 0xdeadbee;
3363     r = MsiGetFeatureState(hpkg, "two", &state, &action);
3364     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3365     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3366     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3367
3368     state = 0xdeadbee;
3369     action = 0xdeadbee;
3370     r = MsiGetFeatureState(hpkg, "three", &state, &action);
3371     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3372     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3373     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3374
3375     state = 0xdeadbee;
3376     action = 0xdeadbee;
3377     r = MsiGetFeatureState(hpkg, "four", &state, &action);
3378     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3379     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3380     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3381
3382     state = 0xdeadbee;
3383     action = 0xdeadbee;
3384     r = MsiGetFeatureState(hpkg, "five", &state, &action);
3385     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3386     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3387     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3388
3389     state = 0xdeadbee;
3390     action = 0xdeadbee;
3391     r = MsiGetFeatureState(hpkg, "six", &state, &action);
3392     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3393     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3394     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3395
3396     state = 0xdeadbee;
3397     action = 0xdeadbee;
3398     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3399     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3400     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3401     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3402
3403     state = 0xdeadbee;
3404     action = 0xdeadbee;
3405     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3406     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3407     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3408     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3409
3410     state = 0xdeadbee;
3411     action = 0xdeadbee;
3412     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3413     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3414     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3415     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3416
3417     state = 0xdeadbee;
3418     action = 0xdeadbee;
3419     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3420     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3421     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3422     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3423
3424     state = 0xdeadbee;
3425     action = 0xdeadbee;
3426     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
3427     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3428     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3429     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3430
3431     state = 0xdeadbee;
3432     action = 0xdeadbee;
3433     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3434     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3435     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3436     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3437
3438     state = 0xdeadbee;
3439     action = 0xdeadbee;
3440     r = MsiGetComponentState(hpkg, "beta", &state, &action);
3441     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3442     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3443     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3444
3445     state = 0xdeadbee;
3446     action = 0xdeadbee;
3447     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3448     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3449     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3450     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3451
3452     state = 0xdeadbee;
3453     action = 0xdeadbee;
3454     r = MsiGetComponentState(hpkg, "theta", &state, &action);
3455     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3456     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3457     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3458
3459     state = 0xdeadbee;
3460     action = 0xdeadbee;
3461     r = MsiGetComponentState(hpkg, "delta", &state, &action);
3462     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3463     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3464     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3465
3466     state = 0xdeadbee;
3467     action = 0xdeadbee;
3468     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3469     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3470     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3471     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3472
3473     state = 0xdeadbee;
3474     action = 0xdeadbee;
3475     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3476     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3477     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3478     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3479
3480     state = 0xdeadbee;
3481     action = 0xdeadbee;
3482     r = MsiGetComponentState(hpkg, "iota", &state, &action);
3483     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3484     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3485     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3486
3487     state = 0xdeadbee;
3488     action = 0xdeadbee;
3489     r = MsiGetComponentState(hpkg, "eta", &state, &action);
3490     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3491     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3492     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3493
3494     state = 0xdeadbee;
3495     action = 0xdeadbee;
3496     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3497     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3498     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3499     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3500
3501     state = 0xdeadbee;
3502     action = 0xdeadbee;
3503     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3504     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3505     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3506     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3507
3508     state = 0xdeadbee;
3509     action = 0xdeadbee;
3510     r = MsiGetComponentState(hpkg, "mu", &state, &action);
3511     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3512     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3513     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3514
3515     state = 0xdeadbee;
3516     action = 0xdeadbee;
3517     r = MsiGetComponentState(hpkg, "nu", &state, &action);
3518     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3519     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3520     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3521
3522     state = 0xdeadbee;
3523     action = 0xdeadbee;
3524     r = MsiGetComponentState(hpkg, "xi", &state, &action);
3525     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3526     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3527     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3528
3529     state = 0xdeadbee;
3530     action = 0xdeadbee;
3531     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3532     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3533     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3534     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3535
3536     state = 0xdeadbee;
3537     action = 0xdeadbee;
3538     r = MsiGetComponentState(hpkg, "pi", &state, &action);
3539     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3540     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3541     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3542
3543     state = 0xdeadbee;
3544     action = 0xdeadbee;
3545     r = MsiGetComponentState(hpkg, "rho", &state, &action);
3546     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3547     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3548     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3549
3550     state = 0xdeadbee;
3551     action = 0xdeadbee;
3552     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3553     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3554     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3555     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3556
3557     state = 0xdeadbee;
3558     action = 0xdeadbee;
3559     r = MsiGetComponentState(hpkg, "tau", &state, &action);
3560     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3561     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3562     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3563
3564     state = 0xdeadbee;
3565     action = 0xdeadbee;
3566     r = MsiGetComponentState(hpkg, "phi", &state, &action);
3567     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3568     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3569     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3570
3571     state = 0xdeadbee;
3572     action = 0xdeadbee;
3573     r = MsiGetComponentState(hpkg, "chi", &state, &action);
3574     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3575     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3576     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3577
3578     state = 0xdeadbee;
3579     action = 0xdeadbee;
3580     r = MsiGetComponentState(hpkg, "psi", &state, &action);
3581     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3582     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3583     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3584
3585     r = MsiDoAction( hpkg, "CostFinalize");
3586     ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3587
3588     state = 0xdeadbee;
3589     action = 0xdeadbee;
3590     r = MsiGetFeatureState(hpkg, "one", &state, &action);
3591     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3592     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3593     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3594
3595     state = 0xdeadbee;
3596     action = 0xdeadbee;
3597     r = MsiGetFeatureState(hpkg, "two", &state, &action);
3598     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3599     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3600     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3601
3602     state = 0xdeadbee;
3603     action = 0xdeadbee;
3604     r = MsiGetFeatureState(hpkg, "three", &state, &action);
3605     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3606     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3607     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3608
3609     state = 0xdeadbee;
3610     action = 0xdeadbee;
3611     r = MsiGetFeatureState(hpkg, "four", &state, &action);
3612     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3613     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3614     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3615
3616     state = 0xdeadbee;
3617     action = 0xdeadbee;
3618     r = MsiGetFeatureState(hpkg, "five", &state, &action);
3619     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3620     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3621     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3622
3623     state = 0xdeadbee;
3624     action = 0xdeadbee;
3625     r = MsiGetFeatureState(hpkg, "six", &state, &action);
3626     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3627     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3628     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3629
3630     state = 0xdeadbee;
3631     action = 0xdeadbee;
3632     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3633     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3634     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3635     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3636
3637     state = 0xdeadbee;
3638     action = 0xdeadbee;
3639     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3640     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3641     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3642     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3643
3644     state = 0xdeadbee;
3645     action = 0xdeadbee;
3646     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3647     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3648     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3649     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3650
3651     state = 0xdeadbee;
3652     action = 0xdeadbee;
3653     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3654     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3655     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3656     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3657
3658     state = 0xdeadbee;
3659     action = 0xdeadbee;
3660     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
3661     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3662     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3663     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3664
3665     state = 0xdeadbee;
3666     action = 0xdeadbee;
3667     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3668     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3669     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3670     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3671
3672     state = 0xdeadbee;
3673     action = 0xdeadbee;
3674     r = MsiGetComponentState(hpkg, "beta", &state, &action);
3675     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3676     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3677     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3678
3679     state = 0xdeadbee;
3680     action = 0xdeadbee;
3681     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3682     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3683     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3684     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3685
3686     state = 0xdeadbee;
3687     action = 0xdeadbee;
3688     r = MsiGetComponentState(hpkg, "theta", &state, &action);
3689     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3690     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3691     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3692
3693     state = 0xdeadbee;
3694     action = 0xdeadbee;
3695     r = MsiGetComponentState(hpkg, "delta", &state, &action);
3696     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3697     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3698     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3699
3700     state = 0xdeadbee;
3701     action = 0xdeadbee;
3702     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3703     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3704     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3705     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3706
3707     state = 0xdeadbee;
3708     action = 0xdeadbee;
3709     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3710     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3711     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3712     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3713
3714     state = 0xdeadbee;
3715     action = 0xdeadbee;
3716     r = MsiGetComponentState(hpkg, "iota", &state, &action);
3717     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3718     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3719     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3720
3721     state = 0xdeadbee;
3722     action = 0xdeadbee;
3723     r = MsiGetComponentState(hpkg, "eta", &state, &action);
3724     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3725     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3726     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3727
3728     state = 0xdeadbee;
3729     action = 0xdeadbee;
3730     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3731     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3732     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3733     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3734
3735     state = 0xdeadbee;
3736     action = 0xdeadbee;
3737     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3738     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3739     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3740     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3741
3742     state = 0xdeadbee;
3743     action = 0xdeadbee;
3744     r = MsiGetComponentState(hpkg, "mu", &state, &action);
3745     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3746     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3747     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3748
3749     state = 0xdeadbee;
3750     action = 0xdeadbee;
3751     r = MsiGetComponentState(hpkg, "nu", &state, &action);
3752     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3753     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3754     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3755
3756     state = 0xdeadbee;
3757     action = 0xdeadbee;
3758     r = MsiGetComponentState(hpkg, "xi", &state, &action);
3759     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3760     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3761     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3762
3763     state = 0xdeadbee;
3764     action = 0xdeadbee;
3765     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3766     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3767     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3768     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3769
3770     state = 0xdeadbee;
3771     action = 0xdeadbee;
3772     r = MsiGetComponentState(hpkg, "pi", &state, &action);
3773     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3774     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3775     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3776
3777     state = 0xdeadbee;
3778     action = 0xdeadbee;
3779     r = MsiGetComponentState(hpkg, "rho", &state, &action);
3780     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3781     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3782     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3783
3784     state = 0xdeadbee;
3785     action = 0xdeadbee;
3786     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3787     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3788     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3789     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3790
3791     state = 0xdeadbee;
3792     action = 0xdeadbee;
3793     r = MsiGetComponentState(hpkg, "tau", &state, &action);
3794     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3795     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3796     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3797
3798     state = 0xdeadbee;
3799     action = 0xdeadbee;
3800     r = MsiGetComponentState(hpkg, "phi", &state, &action);
3801     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3802     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3803     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3804
3805     state = 0xdeadbee;
3806     action = 0xdeadbee;
3807     r = MsiGetComponentState(hpkg, "chi", &state, &action);
3808     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3809     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3810     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3811
3812     state = 0xdeadbee;
3813     action = 0xdeadbee;
3814     r = MsiGetComponentState(hpkg, "psi", &state, &action);
3815     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3816     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3817     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3818
3819     MsiCloseHandle( hpkg );
3820
3821     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3822
3823     /* publish the features and components */
3824     r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven REINSTALL=eight,nine,ten");
3825     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3826
3827     r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
3828     ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
3829
3830     /* these properties must not be in the saved msi file */
3831     r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
3832     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3833
3834     r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
3835     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3836
3837     r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
3838     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3839
3840     r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
3841     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3842
3843     r = package_from_db( hdb, &hpkg );
3844     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
3845
3846     MsiCloseHandle(hdb);
3847
3848     state = 0xdeadbee;
3849     action = 0xdeadbee;
3850     r = MsiGetFeatureState(hpkg, "one", &state, &action);
3851     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3852     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3853     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3854
3855     state = 0xdeadbee;
3856     action = 0xdeadbee;
3857     r = MsiGetFeatureState(hpkg, "two", &state, &action);
3858     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3859     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3860     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3861
3862     state = 0xdeadbee;
3863     action = 0xdeadbee;
3864     r = MsiGetFeatureState(hpkg, "three", &state, &action);
3865     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3866     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3867     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3868
3869     state = 0xdeadbee;
3870     action = 0xdeadbee;
3871     r = MsiGetFeatureState(hpkg, "four", &state, &action);
3872     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3873     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3874     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3875
3876     state = 0xdeadbee;
3877     action = 0xdeadbee;
3878     r = MsiGetFeatureState(hpkg, "five", &state, &action);
3879     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3880     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3881     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3882
3883     state = 0xdeadbee;
3884     action = 0xdeadbee;
3885     r = MsiGetFeatureState(hpkg, "six", &state, &action);
3886     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3887     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3888     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3889
3890     state = 0xdeadbee;
3891     action = 0xdeadbee;
3892     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3893     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3894     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3895     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3896
3897     state = 0xdeadbee;
3898     action = 0xdeadbee;
3899     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3900     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3901     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3902     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3903
3904     state = 0xdeadbee;
3905     action = 0xdeadbee;
3906     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3907     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3908     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3909     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3910
3911     state = 0xdeadbee;
3912     action = 0xdeadbee;
3913     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3914     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3915     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3916     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3917
3918     state = 0xdeadbee;
3919     action = 0xdeadbee;
3920     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
3921     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3922     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3923     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3924
3925     state = 0xdeadbee;
3926     action = 0xdeadbee;
3927     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3928     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3929     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3930     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3931
3932     state = 0xdeadbee;
3933     action = 0xdeadbee;
3934     r = MsiGetComponentState(hpkg, "beta", &state, &action);
3935     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3936     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3937     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3938
3939     state = 0xdeadbee;
3940     action = 0xdeadbee;
3941     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3942     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3943     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3944     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3945
3946     state = 0xdeadbee;
3947     action = 0xdeadbee;
3948     r = MsiGetComponentState(hpkg, "theta", &state, &action);
3949     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3950     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3951     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3952
3953     state = 0xdeadbee;
3954     action = 0xdeadbee;
3955     r = MsiGetComponentState(hpkg, "delta", &state, &action);
3956     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3957     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3958     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3959
3960     state = 0xdeadbee;
3961     action = 0xdeadbee;
3962     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3963     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3964     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3965     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3966
3967     state = 0xdeadbee;
3968     action = 0xdeadbee;
3969     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3970     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3971     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3972     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3973
3974     state = 0xdeadbee;
3975     action = 0xdeadbee;
3976     r = MsiGetComponentState(hpkg, "iota", &state, &action);
3977     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3978     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3979     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3980
3981     state = 0xdeadbee;
3982     action = 0xdeadbee;
3983     r = MsiGetComponentState(hpkg, "eta", &state, &action);
3984     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3985     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3986     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3987
3988     state = 0xdeadbee;
3989     action = 0xdeadbee;
3990     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3991     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3992     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3993     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3994
3995     state = 0xdeadbee;
3996     action = 0xdeadbee;
3997     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3998     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3999     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4000     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4001
4002     state = 0xdeadbee;
4003     action = 0xdeadbee;
4004     r = MsiGetComponentState(hpkg, "mu", &state, &action);
4005     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4006     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4007     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4008
4009     state = 0xdeadbee;
4010     action = 0xdeadbee;
4011     r = MsiGetComponentState(hpkg, "nu", &state, &action);
4012     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4013     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4014     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4015
4016     state = 0xdeadbee;
4017     action = 0xdeadbee;
4018     r = MsiGetComponentState(hpkg, "xi", &state, &action);
4019     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4020     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4021     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4022
4023     state = 0xdeadbee;
4024     action = 0xdeadbee;
4025     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4026     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4027     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4028     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4029
4030     state = 0xdeadbee;
4031     action = 0xdeadbee;
4032     r = MsiGetComponentState(hpkg, "pi", &state, &action);
4033     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4034     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4035     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4036
4037     state = 0xdeadbee;
4038     action = 0xdeadbee;
4039     r = MsiGetComponentState(hpkg, "rho", &state, &action);
4040     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4041     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4042     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4043
4044     state = 0xdeadbee;
4045     action = 0xdeadbee;
4046     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4047     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4048     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4049     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4050
4051     state = 0xdeadbee;
4052     action = 0xdeadbee;
4053     r = MsiGetComponentState(hpkg, "tau", &state, &action);
4054     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4055     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4056     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4057
4058     state = 0xdeadbee;
4059     action = 0xdeadbee;
4060     r = MsiGetComponentState(hpkg, "phi", &state, &action);
4061     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4062     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4063     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4064
4065     state = 0xdeadbee;
4066     action = 0xdeadbee;
4067     r = MsiGetComponentState(hpkg, "chi", &state, &action);
4068     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4069     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4070     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4071
4072     state = 0xdeadbee;
4073     action = 0xdeadbee;
4074     r = MsiGetComponentState(hpkg, "psi", &state, &action);
4075     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4076     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4077     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4078
4079     r = MsiDoAction( hpkg, "CostInitialize");
4080     ok( r == ERROR_SUCCESS, "cost init failed\n");
4081
4082     state = 0xdeadbee;
4083     action = 0xdeadbee;
4084     r = MsiGetFeatureState(hpkg, "one", &state, &action);
4085     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4086     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4087     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4088
4089     state = 0xdeadbee;
4090     action = 0xdeadbee;
4091     r = MsiGetFeatureState(hpkg, "two", &state, &action);
4092     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4093     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4094     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4095
4096     state = 0xdeadbee;
4097     action = 0xdeadbee;
4098     r = MsiGetFeatureState(hpkg, "three", &state, &action);
4099     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4100     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4101     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4102
4103     state = 0xdeadbee;
4104     action = 0xdeadbee;
4105     r = MsiGetFeatureState(hpkg, "four", &state, &action);
4106     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4107     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4108     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4109
4110     state = 0xdeadbee;
4111     action = 0xdeadbee;
4112     r = MsiGetFeatureState(hpkg, "five", &state, &action);
4113     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4114     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4115     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4116
4117     state = 0xdeadbee;
4118     action = 0xdeadbee;
4119     r = MsiGetFeatureState(hpkg, "six", &state, &action);
4120     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4121     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4122     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4123
4124     state = 0xdeadbee;
4125     action = 0xdeadbee;
4126     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4127     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4128     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4129     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4130
4131     state = 0xdeadbee;
4132     action = 0xdeadbee;
4133     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4134     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4135     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4136     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4137
4138     state = 0xdeadbee;
4139     action = 0xdeadbee;
4140     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4141     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4142     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4143     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4144
4145     state = 0xdeadbee;
4146     action = 0xdeadbee;
4147     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4148     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4149     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4150     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4151
4152     state = 0xdeadbee;
4153     action = 0xdeadbee;
4154     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
4155     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4156     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4157     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4158
4159     state = 0xdeadbee;
4160     action = 0xdeadbee;
4161     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4162     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4163     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4164     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4165
4166     state = 0xdeadbee;
4167     action = 0xdeadbee;
4168     r = MsiGetComponentState(hpkg, "beta", &state, &action);
4169     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4170     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4171     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4172
4173     state = 0xdeadbee;
4174     action = 0xdeadbee;
4175     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4176     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4177     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4178     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4179
4180     state = 0xdeadbee;
4181     action = 0xdeadbee;
4182     r = MsiGetComponentState(hpkg, "theta", &state, &action);
4183     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4184     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4185     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4186
4187     state = 0xdeadbee;
4188     action = 0xdeadbee;
4189     r = MsiGetComponentState(hpkg, "delta", &state, &action);
4190     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4191     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4192     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4193
4194     state = 0xdeadbee;
4195     action = 0xdeadbee;
4196     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4197     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4198     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4199     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4200
4201     state = 0xdeadbee;
4202     action = 0xdeadbee;
4203     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4204     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4205     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4206     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4207
4208     state = 0xdeadbee;
4209     action = 0xdeadbee;
4210     r = MsiGetComponentState(hpkg, "iota", &state, &action);
4211     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4212     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4213     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4214
4215     state = 0xdeadbee;
4216     action = 0xdeadbee;
4217     r = MsiGetComponentState(hpkg, "eta", &state, &action);
4218     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4219     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4220     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4221
4222     state = 0xdeadbee;
4223     action = 0xdeadbee;
4224     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4225     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4226     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4227     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4228
4229     state = 0xdeadbee;
4230     action = 0xdeadbee;
4231     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4232     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4233     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4234     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4235
4236     state = 0xdeadbee;
4237     action = 0xdeadbee;
4238     r = MsiGetComponentState(hpkg, "mu", &state, &action);
4239     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4240     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4241     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4242
4243     state = 0xdeadbee;
4244     action = 0xdeadbee;
4245     r = MsiGetComponentState(hpkg, "nu", &state, &action);
4246     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4247     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4248     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4249
4250     state = 0xdeadbee;
4251     action = 0xdeadbee;
4252     r = MsiGetComponentState(hpkg, "xi", &state, &action);
4253     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4254     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4255     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4256
4257     state = 0xdeadbee;
4258     action = 0xdeadbee;
4259     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4260     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4261     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4262     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4263
4264     state = 0xdeadbee;
4265     action = 0xdeadbee;
4266     r = MsiGetComponentState(hpkg, "pi", &state, &action);
4267     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4268     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4269     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4270
4271     state = 0xdeadbee;
4272     action = 0xdeadbee;
4273     r = MsiGetComponentState(hpkg, "rho", &state, &action);
4274     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4275     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4276     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4277
4278     state = 0xdeadbee;
4279     action = 0xdeadbee;
4280     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4281     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4282     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4283     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4284
4285     state = 0xdeadbee;
4286     action = 0xdeadbee;
4287     r = MsiGetComponentState(hpkg, "tau", &state, &action);
4288     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4289     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4290     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4291
4292     state = 0xdeadbee;
4293     action = 0xdeadbee;
4294     r = MsiGetComponentState(hpkg, "phi", &state, &action);
4295     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4296     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4297     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4298
4299     state = 0xdeadbee;
4300     action = 0xdeadbee;
4301     r = MsiGetComponentState(hpkg, "chi", &state, &action);
4302     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4303     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4304     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4305
4306     state = 0xdeadbee;
4307     action = 0xdeadbee;
4308     r = MsiGetComponentState(hpkg, "psi", &state, &action);
4309     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4310     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4311     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4312
4313     r = MsiDoAction( hpkg, "FileCost");
4314     ok( r == ERROR_SUCCESS, "file cost failed\n");
4315
4316     state = 0xdeadbee;
4317     action = 0xdeadbee;
4318     r = MsiGetFeatureState(hpkg, "one", &state, &action);
4319     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4320     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4321     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4322
4323     state = 0xdeadbee;
4324     action = 0xdeadbee;
4325     r = MsiGetFeatureState(hpkg, "two", &state, &action);
4326     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4327     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4328     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4329
4330     state = 0xdeadbee;
4331     action = 0xdeadbee;
4332     r = MsiGetFeatureState(hpkg, "three", &state, &action);
4333     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4334     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4335     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4336
4337     state = 0xdeadbee;
4338     action = 0xdeadbee;
4339     r = MsiGetFeatureState(hpkg, "four", &state, &action);
4340     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4341     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4342     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4343
4344     state = 0xdeadbee;
4345     action = 0xdeadbee;
4346     r = MsiGetFeatureState(hpkg, "five", &state, &action);
4347     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4348     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4349     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4350
4351     state = 0xdeadbee;
4352     action = 0xdeadbee;
4353     r = MsiGetFeatureState(hpkg, "six", &state, &action);
4354     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4355     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4356     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4357
4358     state = 0xdeadbee;
4359     action = 0xdeadbee;
4360     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4361     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4362     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4363     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4364
4365     state = 0xdeadbee;
4366     action = 0xdeadbee;
4367     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4368     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4369     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4370     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4371
4372     state = 0xdeadbee;
4373     action = 0xdeadbee;
4374     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4375     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4376     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4377     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4378
4379     state = 0xdeadbee;
4380     action = 0xdeadbee;
4381     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4382     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4383     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4384     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4385
4386     state = 0xdeadbee;
4387     action = 0xdeadbee;
4388     r = MsiGetComponentState(hpkg, "beta", &state, &action);
4389     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4390     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4391     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4392
4393     state = 0xdeadbee;
4394     action = 0xdeadbee;
4395     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4396     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4397     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4398     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4399
4400     state = 0xdeadbee;
4401     action = 0xdeadbee;
4402     r = MsiGetComponentState(hpkg, "theta", &state, &action);
4403     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4404     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4405     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4406
4407     state = 0xdeadbee;
4408     action = 0xdeadbee;
4409     r = MsiGetComponentState(hpkg, "delta", &state, &action);
4410     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4411     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4412     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4413
4414     state = 0xdeadbee;
4415     action = 0xdeadbee;
4416     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4417     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4418     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4419     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4420
4421     state = 0xdeadbee;
4422     action = 0xdeadbee;
4423     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4424     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4425     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4426     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4427
4428     state = 0xdeadbee;
4429     action = 0xdeadbee;
4430     r = MsiGetComponentState(hpkg, "iota", &state, &action);
4431     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4432     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4433     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4434
4435     state = 0xdeadbee;
4436     action = 0xdeadbee;
4437     r = MsiGetComponentState(hpkg, "eta", &state, &action);
4438     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4439     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4440     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4441
4442     state = 0xdeadbee;
4443     action = 0xdeadbee;
4444     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4445     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4446     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4447     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4448
4449     state = 0xdeadbee;
4450     action = 0xdeadbee;
4451     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4452     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4453     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4454     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4455
4456     state = 0xdeadbee;
4457     action = 0xdeadbee;
4458     r = MsiGetComponentState(hpkg, "mu", &state, &action);
4459     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4460     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4461     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4462
4463     state = 0xdeadbee;
4464     action = 0xdeadbee;
4465     r = MsiGetComponentState(hpkg, "nu", &state, &action);
4466     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4467     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4468     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4469
4470     state = 0xdeadbee;
4471     action = 0xdeadbee;
4472     r = MsiGetComponentState(hpkg, "xi", &state, &action);
4473     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4474     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4475     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4476
4477     state = 0xdeadbee;
4478     action = 0xdeadbee;
4479     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4480     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4481     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4482     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4483
4484     state = 0xdeadbee;
4485     action = 0xdeadbee;
4486     r = MsiGetComponentState(hpkg, "pi", &state, &action);
4487     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4488     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4489     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4490
4491     state = 0xdeadbee;
4492     action = 0xdeadbee;
4493     r = MsiGetComponentState(hpkg, "rho", &state, &action);
4494     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4495     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4496     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4497
4498     state = 0xdeadbee;
4499     action = 0xdeadbee;
4500     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4501     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4502     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4503     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4504
4505     state = 0xdeadbee;
4506     action = 0xdeadbee;
4507     r = MsiGetComponentState(hpkg, "tau", &state, &action);
4508     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4509     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4510     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4511
4512     state = 0xdeadbee;
4513     action = 0xdeadbee;
4514     r = MsiGetComponentState(hpkg, "phi", &state, &action);
4515     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4516     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4517     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4518
4519     state = 0xdeadbee;
4520     action = 0xdeadbee;
4521     r = MsiGetComponentState(hpkg, "chi", &state, &action);
4522     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4523     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4524     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4525
4526     state = 0xdeadbee;
4527     action = 0xdeadbee;
4528     r = MsiGetComponentState(hpkg, "psi", &state, &action);
4529     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4530     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4531     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4532
4533     r = MsiDoAction( hpkg, "CostFinalize");
4534     ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
4535
4536     state = 0xdeadbee;
4537     action = 0xdeadbee;
4538     r = MsiGetFeatureState(hpkg, "one", &state, &action);
4539     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4540     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4541     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4542
4543     state = 0xdeadbee;
4544     action = 0xdeadbee;
4545     r = MsiGetFeatureState(hpkg, "two", &state, &action);
4546     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4547     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4548     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4549
4550     state = 0xdeadbee;
4551     action = 0xdeadbee;
4552     r = MsiGetFeatureState(hpkg, "three", &state, &action);
4553     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4554     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4555     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4556
4557     state = 0xdeadbee;
4558     action = 0xdeadbee;
4559     r = MsiGetFeatureState(hpkg, "four", &state, &action);
4560     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4561     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4562     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4563
4564     state = 0xdeadbee;
4565     action = 0xdeadbee;
4566     r = MsiGetFeatureState(hpkg, "five", &state, &action);
4567     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4568     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4569     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4570
4571     state = 0xdeadbee;
4572     action = 0xdeadbee;
4573     r = MsiGetFeatureState(hpkg, "six", &state, &action);
4574     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4575     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4576     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4577
4578     state = 0xdeadbee;
4579     action = 0xdeadbee;
4580     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4581     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4582     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4583     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4584
4585     state = 0xdeadbee;
4586     action = 0xdeadbee;
4587     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4588     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4589     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4590     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4591
4592     state = 0xdeadbee;
4593     action = 0xdeadbee;
4594     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4595     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4596     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4597     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4598
4599     state = 0xdeadbee;
4600     action = 0xdeadbee;
4601     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4602     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4603     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4604     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4605
4606     state = 0xdeadbee;
4607     action = 0xdeadbee;
4608     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
4609     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4610     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4611     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4612
4613     state = 0xdeadbee;
4614     action = 0xdeadbee;
4615     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4616     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4617     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4618     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4619
4620     state = 0xdeadbee;
4621     action = 0xdeadbee;
4622     r = MsiGetComponentState(hpkg, "beta", &state, &action);
4623     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4624     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4625     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4626
4627     state = 0xdeadbee;
4628     action = 0xdeadbee;
4629     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4630     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4631     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4632     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4633
4634     state = 0xdeadbee;
4635     action = 0xdeadbee;
4636     r = MsiGetComponentState(hpkg, "theta", &state, &action);
4637     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4638     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4639     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4640
4641     state = 0xdeadbee;
4642     action = 0xdeadbee;
4643     r = MsiGetComponentState(hpkg, "delta", &state, &action);
4644     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4645     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4646     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4647
4648     state = 0xdeadbee;
4649     action = 0xdeadbee;
4650     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4651     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4652     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4653     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4654
4655     state = 0xdeadbee;
4656     action = 0xdeadbee;
4657     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4658     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4659     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4660     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4661
4662     state = 0xdeadbee;
4663     action = 0xdeadbee;
4664     r = MsiGetComponentState(hpkg, "iota", &state, &action);
4665     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4666     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4667     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4668
4669     state = 0xdeadbee;
4670     action = 0xdeadbee;
4671     r = MsiGetComponentState(hpkg, "eta", &state, &action);
4672     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4673     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4674     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4675
4676     state = 0xdeadbee;
4677     action = 0xdeadbee;
4678     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4679     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4680     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4681     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4682
4683     state = 0xdeadbee;
4684     action = 0xdeadbee;
4685     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4686     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4687     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4688     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4689
4690     state = 0xdeadbee;
4691     action = 0xdeadbee;
4692     r = MsiGetComponentState(hpkg, "mu", &state, &action);
4693     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4694     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4695     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4696
4697     state = 0xdeadbee;
4698     action = 0xdeadbee;
4699     r = MsiGetComponentState(hpkg, "nu", &state, &action);
4700     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4701     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4702     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4703
4704     state = 0xdeadbee;
4705     action = 0xdeadbee;
4706     r = MsiGetComponentState(hpkg, "xi", &state, &action);
4707     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4708     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4709     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4710
4711     state = 0xdeadbee;
4712     action = 0xdeadbee;
4713     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4714     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4715     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4716     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4717
4718     state = 0xdeadbee;
4719     action = 0xdeadbee;
4720     r = MsiGetComponentState(hpkg, "pi", &state, &action);
4721     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4722     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4723     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4724
4725     state = 0xdeadbee;
4726     action = 0xdeadbee;
4727     r = MsiGetComponentState(hpkg, "rho", &state, &action);
4728     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4729     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4730     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4731
4732     state = 0xdeadbee;
4733     action = 0xdeadbee;
4734     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4735     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4736     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4737     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4738
4739     state = 0xdeadbee;
4740     action = 0xdeadbee;
4741     r = MsiGetComponentState(hpkg, "tau", &state, &action);
4742     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4743     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4744     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4745
4746     state = 0xdeadbee;
4747     action = 0xdeadbee;
4748     r = MsiGetComponentState(hpkg, "phi", &state, &action);
4749     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4750     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4751     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4752
4753     state = 0xdeadbee;
4754     action = 0xdeadbee;
4755     r = MsiGetComponentState(hpkg, "chi", &state, &action);
4756     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4757     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4758     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4759
4760     state = 0xdeadbee;
4761     action = 0xdeadbee;
4762     r = MsiGetComponentState(hpkg, "psi", &state, &action);
4763     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4764     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4765     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4766
4767     MsiCloseHandle(hpkg);
4768
4769     /* uninstall the product */
4770     r = MsiInstallProduct(msifile, "REMOVE=ALL");
4771     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4772
4773     /* all features installed locally */
4774     r = MsiInstallProduct(msifile2, "ADDLOCAL=ALL");
4775     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4776
4777     r = MsiOpenDatabase(msifile2, MSIDBOPEN_DIRECT, &hdb);
4778     ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
4779
4780     /* these properties must not be in the saved msi file */
4781     r = add_property_entry( hdb, "'ADDLOCAL', 'one,two,three,four,five,six,seven,eight,nine,ten'");
4782     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
4783
4784     r = package_from_db( hdb, &hpkg );
4785     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
4786
4787     state = 0xdeadbee;
4788     action = 0xdeadbee;
4789     r = MsiGetFeatureState(hpkg, "one", &state, &action);
4790     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4791     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4792     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4793
4794     state = 0xdeadbee;
4795     action = 0xdeadbee;
4796     r = MsiGetFeatureState(hpkg, "two", &state, &action);
4797     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4798     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4799     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4800
4801     state = 0xdeadbee;
4802     action = 0xdeadbee;
4803     r = MsiGetFeatureState(hpkg, "three", &state, &action);
4804     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4805     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4806     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4807
4808     state = 0xdeadbee;
4809     action = 0xdeadbee;
4810     r = MsiGetFeatureState(hpkg, "four", &state, &action);
4811     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4812     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4813     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4814
4815     state = 0xdeadbee;
4816     action = 0xdeadbee;
4817     r = MsiGetFeatureState(hpkg, "five", &state, &action);
4818     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4819     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4820     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4821
4822     state = 0xdeadbee;
4823     action = 0xdeadbee;
4824     r = MsiGetFeatureState(hpkg, "six", &state, &action);
4825     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4826     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4827     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4828
4829     state = 0xdeadbee;
4830     action = 0xdeadbee;
4831     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4832     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4833     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4834     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4835
4836     state = 0xdeadbee;
4837     action = 0xdeadbee;
4838     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4839     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4840     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4841     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4842
4843     state = 0xdeadbee;
4844     action = 0xdeadbee;
4845     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4846     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4847     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4848     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4849
4850     state = 0xdeadbee;
4851     action = 0xdeadbee;
4852     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4853     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4854     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4855     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4856
4857     state = 0xdeadbee;
4858     action = 0xdeadbee;
4859     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
4860     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4861     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4862     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4863
4864     state = 0xdeadbee;
4865     action = 0xdeadbee;
4866     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4867     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4868     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4869     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4870
4871     state = 0xdeadbee;
4872     action = 0xdeadbee;
4873     r = MsiGetComponentState(hpkg, "beta", &state, &action);
4874     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4875     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4876     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4877
4878     state = 0xdeadbee;
4879     action = 0xdeadbee;
4880     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4881     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4882     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4883     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4884
4885     state = 0xdeadbee;
4886     action = 0xdeadbee;
4887     r = MsiGetComponentState(hpkg, "theta", &state, &action);
4888     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4889     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4890     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4891
4892     state = 0xdeadbee;
4893     action = 0xdeadbee;
4894     r = MsiGetComponentState(hpkg, "delta", &state, &action);
4895     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4896     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4897     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4898
4899     state = 0xdeadbee;
4900     action = 0xdeadbee;
4901     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4902     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4903     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4904     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4905
4906     state = 0xdeadbee;
4907     action = 0xdeadbee;
4908     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4909     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4910     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4911     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4912
4913     state = 0xdeadbee;
4914     action = 0xdeadbee;
4915     r = MsiGetComponentState(hpkg, "iota", &state, &action);
4916     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4917     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4918     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4919
4920     state = 0xdeadbee;
4921     action = 0xdeadbee;
4922     r = MsiGetComponentState(hpkg, "eta", &state, &action);
4923     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4924     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4925     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4926
4927     state = 0xdeadbee;
4928     action = 0xdeadbee;
4929     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4930     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4931     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4932     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4933
4934     state = 0xdeadbee;
4935     action = 0xdeadbee;
4936     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4937     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4938     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4939     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4940
4941     state = 0xdeadbee;
4942     action = 0xdeadbee;
4943     r = MsiGetComponentState(hpkg, "mu", &state, &action);
4944     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4945     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4946     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4947
4948     state = 0xdeadbee;
4949     action = 0xdeadbee;
4950     r = MsiGetComponentState(hpkg, "nu", &state, &action);
4951     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4952     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4953     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4954
4955     state = 0xdeadbee;
4956     action = 0xdeadbee;
4957     r = MsiGetComponentState(hpkg, "xi", &state, &action);
4958     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4959     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4960     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4961
4962     state = 0xdeadbee;
4963     action = 0xdeadbee;
4964     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4965     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4966     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4967     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4968
4969     state = 0xdeadbee;
4970     action = 0xdeadbee;
4971     r = MsiGetComponentState(hpkg, "pi", &state, &action);
4972     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4973     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4974     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4975
4976     state = 0xdeadbee;
4977     action = 0xdeadbee;
4978     r = MsiGetComponentState(hpkg, "rho", &state, &action);
4979     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4980     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4981     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4982
4983     state = 0xdeadbee;
4984     action = 0xdeadbee;
4985     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4986     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4987     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4988     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4989
4990     state = 0xdeadbee;
4991     action = 0xdeadbee;
4992     r = MsiGetComponentState(hpkg, "tau", &state, &action);
4993     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4994     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4995     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4996
4997     state = 0xdeadbee;
4998     action = 0xdeadbee;
4999     r = MsiGetComponentState(hpkg, "phi", &state, &action);
5000     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5001     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5002     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5003
5004     state = 0xdeadbee;
5005     action = 0xdeadbee;
5006     r = MsiGetComponentState(hpkg, "chi", &state, &action);
5007     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5008     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5009     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5010
5011     state = 0xdeadbee;
5012     action = 0xdeadbee;
5013     r = MsiGetComponentState(hpkg, "psi", &state, &action);
5014     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5015     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5016     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5017
5018     r = MsiDoAction( hpkg, "CostInitialize");
5019     ok( r == ERROR_SUCCESS, "cost init failed\n");
5020
5021     state = 0xdeadbee;
5022     action = 0xdeadbee;
5023     r = MsiGetFeatureState(hpkg, "one", &state, &action);
5024     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5025     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5026     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5027
5028     state = 0xdeadbee;
5029     action = 0xdeadbee;
5030     r = MsiGetFeatureState(hpkg, "two", &state, &action);
5031     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5032     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5033     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5034
5035     state = 0xdeadbee;
5036     action = 0xdeadbee;
5037     r = MsiGetFeatureState(hpkg, "three", &state, &action);
5038     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5039     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5040     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5041
5042     state = 0xdeadbee;
5043     action = 0xdeadbee;
5044     r = MsiGetFeatureState(hpkg, "four", &state, &action);
5045     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5046     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5047     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5048
5049     state = 0xdeadbee;
5050     action = 0xdeadbee;
5051     r = MsiGetFeatureState(hpkg, "five", &state, &action);
5052     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5053     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5054     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5055
5056     state = 0xdeadbee;
5057     action = 0xdeadbee;
5058     r = MsiGetFeatureState(hpkg, "six", &state, &action);
5059     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5060     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5061     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5062
5063     state = 0xdeadbee;
5064     action = 0xdeadbee;
5065     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5066     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5067     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5068     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5069
5070     state = 0xdeadbee;
5071     action = 0xdeadbee;
5072     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5073     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5074     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5075     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5076
5077     state = 0xdeadbee;
5078     action = 0xdeadbee;
5079     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5080     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5081     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5082     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5083
5084     state = 0xdeadbee;
5085     action = 0xdeadbee;
5086     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5087     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5088     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5089     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5090
5091     state = 0xdeadbee;
5092     action = 0xdeadbee;
5093     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
5094     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5095     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5096     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5097
5098     state = 0xdeadbee;
5099     action = 0xdeadbee;
5100     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5101     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5102     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5103     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5104
5105     state = 0xdeadbee;
5106     action = 0xdeadbee;
5107     r = MsiGetComponentState(hpkg, "beta", &state, &action);
5108     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5109     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5110     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5111
5112     state = 0xdeadbee;
5113     action = 0xdeadbee;
5114     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5115     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5116     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5117     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5118
5119     state = 0xdeadbee;
5120     action = 0xdeadbee;
5121     r = MsiGetComponentState(hpkg, "theta", &state, &action);
5122     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5123     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5124     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5125
5126     state = 0xdeadbee;
5127     action = 0xdeadbee;
5128     r = MsiGetComponentState(hpkg, "delta", &state, &action);
5129     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5130     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5131     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5132
5133     state = 0xdeadbee;
5134     action = 0xdeadbee;
5135     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5136     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5137     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5138     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5139
5140     state = 0xdeadbee;
5141     action = 0xdeadbee;
5142     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5143     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5144     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5145     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5146
5147     state = 0xdeadbee;
5148     action = 0xdeadbee;
5149     r = MsiGetComponentState(hpkg, "iota", &state, &action);
5150     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5151     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5152     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5153
5154     state = 0xdeadbee;
5155     action = 0xdeadbee;
5156     r = MsiGetComponentState(hpkg, "eta", &state, &action);
5157     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5158     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5159     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5160
5161     state = 0xdeadbee;
5162     action = 0xdeadbee;
5163     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5164     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5165     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5166     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5167
5168     state = 0xdeadbee;
5169     action = 0xdeadbee;
5170     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5171     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5172     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5173     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5174
5175     state = 0xdeadbee;
5176     action = 0xdeadbee;
5177     r = MsiGetComponentState(hpkg, "mu", &state, &action);
5178     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5179     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5180     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5181
5182     state = 0xdeadbee;
5183     action = 0xdeadbee;
5184     r = MsiGetComponentState(hpkg, "nu", &state, &action);
5185     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5186     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5187     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5188
5189     state = 0xdeadbee;
5190     action = 0xdeadbee;
5191     r = MsiGetComponentState(hpkg, "xi", &state, &action);
5192     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5193     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5194     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5195
5196     state = 0xdeadbee;
5197     action = 0xdeadbee;
5198     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5199     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5200     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5201     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5202
5203     state = 0xdeadbee;
5204     action = 0xdeadbee;
5205     r = MsiGetComponentState(hpkg, "pi", &state, &action);
5206     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5207     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5208     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5209
5210     state = 0xdeadbee;
5211     action = 0xdeadbee;
5212     r = MsiGetComponentState(hpkg, "rho", &state, &action);
5213     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5214     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5215     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5216
5217     state = 0xdeadbee;
5218     action = 0xdeadbee;
5219     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5220     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5221     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5222     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5223
5224     state = 0xdeadbee;
5225     action = 0xdeadbee;
5226     r = MsiGetComponentState(hpkg, "tau", &state, &action);
5227     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5228     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5229     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5230
5231     state = 0xdeadbee;
5232     action = 0xdeadbee;
5233     r = MsiGetComponentState(hpkg, "phi", &state, &action);
5234     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5235     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5236     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5237
5238     state = 0xdeadbee;
5239     action = 0xdeadbee;
5240     r = MsiGetComponentState(hpkg, "chi", &state, &action);
5241     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5242     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5243     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5244
5245     state = 0xdeadbee;
5246     action = 0xdeadbee;
5247     r = MsiGetComponentState(hpkg, "psi", &state, &action);
5248     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5249     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5250     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5251
5252     r = MsiDoAction( hpkg, "FileCost");
5253     ok( r == ERROR_SUCCESS, "file cost failed\n");
5254
5255     state = 0xdeadbee;
5256     action = 0xdeadbee;
5257     r = MsiGetFeatureState(hpkg, "one", &state, &action);
5258     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5259     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5260     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5261
5262     state = 0xdeadbee;
5263     action = 0xdeadbee;
5264     r = MsiGetFeatureState(hpkg, "two", &state, &action);
5265     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5266     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5267     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5268
5269     state = 0xdeadbee;
5270     action = 0xdeadbee;
5271     r = MsiGetFeatureState(hpkg, "three", &state, &action);
5272     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5273     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5274     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5275
5276     state = 0xdeadbee;
5277     action = 0xdeadbee;
5278     r = MsiGetFeatureState(hpkg, "four", &state, &action);
5279     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5280     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5281     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5282
5283     state = 0xdeadbee;
5284     action = 0xdeadbee;
5285     r = MsiGetFeatureState(hpkg, "five", &state, &action);
5286     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5287     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5288     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5289
5290     state = 0xdeadbee;
5291     action = 0xdeadbee;
5292     r = MsiGetFeatureState(hpkg, "six", &state, &action);
5293     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5294     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5295     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5296
5297     state = 0xdeadbee;
5298     action = 0xdeadbee;
5299     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5300     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5301     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5302     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5303
5304     state = 0xdeadbee;
5305     action = 0xdeadbee;
5306     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5307     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5308     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5309     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5310
5311     state = 0xdeadbee;
5312     action = 0xdeadbee;
5313     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5314     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5315     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5316     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5317
5318     state = 0xdeadbee;
5319     action = 0xdeadbee;
5320     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5321     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5322     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5323     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5324
5325     state = 0xdeadbee;
5326     action = 0xdeadbee;
5327     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
5328     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5329     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5330     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5331
5332     state = 0xdeadbee;
5333     action = 0xdeadbee;
5334     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5335     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5336     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5337     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5338
5339     state = 0xdeadbee;
5340     action = 0xdeadbee;
5341     r = MsiGetComponentState(hpkg, "beta", &state, &action);
5342     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5343     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5344     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5345
5346     state = 0xdeadbee;
5347     action = 0xdeadbee;
5348     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5349     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5350     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5351     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5352
5353     state = 0xdeadbee;
5354     action = 0xdeadbee;
5355     r = MsiGetComponentState(hpkg, "theta", &state, &action);
5356     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5357     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5358     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5359
5360     state = 0xdeadbee;
5361     action = 0xdeadbee;
5362     r = MsiGetComponentState(hpkg, "delta", &state, &action);
5363     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5364     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5365     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5366
5367     state = 0xdeadbee;
5368     action = 0xdeadbee;
5369     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5370     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5371     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5372     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5373
5374     state = 0xdeadbee;
5375     action = 0xdeadbee;
5376     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5377     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5378     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5379     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5380
5381     state = 0xdeadbee;
5382     action = 0xdeadbee;
5383     r = MsiGetComponentState(hpkg, "iota", &state, &action);
5384     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5385     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5386     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5387
5388     state = 0xdeadbee;
5389     action = 0xdeadbee;
5390     r = MsiGetComponentState(hpkg, "eta", &state, &action);
5391     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5392     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5393     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5394
5395     state = 0xdeadbee;
5396     action = 0xdeadbee;
5397     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5398     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5399     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5400     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5401
5402     state = 0xdeadbee;
5403     action = 0xdeadbee;
5404     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5405     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5406     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5407     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5408
5409     state = 0xdeadbee;
5410     action = 0xdeadbee;
5411     r = MsiGetComponentState(hpkg, "mu", &state, &action);
5412     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5413     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5414     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5415
5416     state = 0xdeadbee;
5417     action = 0xdeadbee;
5418     r = MsiGetComponentState(hpkg, "nu", &state, &action);
5419     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5420     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5421     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5422
5423     state = 0xdeadbee;
5424     action = 0xdeadbee;
5425     r = MsiGetComponentState(hpkg, "xi", &state, &action);
5426     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5427     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5428     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5429
5430     state = 0xdeadbee;
5431     action = 0xdeadbee;
5432     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5433     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5434     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5435     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5436
5437     state = 0xdeadbee;
5438     action = 0xdeadbee;
5439     r = MsiGetComponentState(hpkg, "pi", &state, &action);
5440     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5441     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5442     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5443
5444     state = 0xdeadbee;
5445     action = 0xdeadbee;
5446     r = MsiGetComponentState(hpkg, "rho", &state, &action);
5447     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5448     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5449     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5450
5451     state = 0xdeadbee;
5452     action = 0xdeadbee;
5453     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5454     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5455     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5456     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5457
5458     state = 0xdeadbee;
5459     action = 0xdeadbee;
5460     r = MsiGetComponentState(hpkg, "tau", &state, &action);
5461     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5462     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5463     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5464
5465     state = 0xdeadbee;
5466     action = 0xdeadbee;
5467     r = MsiGetComponentState(hpkg, "phi", &state, &action);
5468     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5469     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5470     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5471
5472     state = 0xdeadbee;
5473     action = 0xdeadbee;
5474     r = MsiGetComponentState(hpkg, "chi", &state, &action);
5475     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5476     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5477     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5478
5479     state = 0xdeadbee;
5480     action = 0xdeadbee;
5481     r = MsiGetComponentState(hpkg, "psi", &state, &action);
5482     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5483     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5484     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5485
5486     r = MsiDoAction( hpkg, "CostFinalize");
5487     ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
5488
5489     state = 0xdeadbee;
5490     action = 0xdeadbee;
5491     r = MsiGetFeatureState(hpkg, "one", &state, &action);
5492     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5493     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5494     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5495
5496     state = 0xdeadbee;
5497     action = 0xdeadbee;
5498     r = MsiGetFeatureState(hpkg, "two", &state, &action);
5499     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5500     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5501     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5502
5503     state = 0xdeadbee;
5504     action = 0xdeadbee;
5505     r = MsiGetFeatureState(hpkg, "three", &state, &action);
5506     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5507     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5508     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5509
5510     state = 0xdeadbee;
5511     action = 0xdeadbee;
5512     r = MsiGetFeatureState(hpkg, "four", &state, &action);
5513     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5514     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5515     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5516
5517     state = 0xdeadbee;
5518     action = 0xdeadbee;
5519     r = MsiGetFeatureState(hpkg, "five", &state, &action);
5520     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5521     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5522     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5523
5524     state = 0xdeadbee;
5525     action = 0xdeadbee;
5526     r = MsiGetFeatureState(hpkg, "six", &state, &action);
5527     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5528     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5529     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5530
5531     state = 0xdeadbee;
5532     action = 0xdeadbee;
5533     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5534     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5535     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5536     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5537
5538     state = 0xdeadbee;
5539     action = 0xdeadbee;
5540     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5541     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5542     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5543     todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5544
5545     state = 0xdeadbee;
5546     action = 0xdeadbee;
5547     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5548     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5549     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5550     todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5551
5552     state = 0xdeadbee;
5553     action = 0xdeadbee;
5554     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5555     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5556     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5557     todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5558
5559     state = 0xdeadbee;
5560     action = 0xdeadbee;
5561     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
5562     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5563     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5564     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5565
5566     state = 0xdeadbee;
5567     action = 0xdeadbee;
5568     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5569     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5570     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5571     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5572
5573     state = 0xdeadbee;
5574     action = 0xdeadbee;
5575     r = MsiGetComponentState(hpkg, "beta", &state, &action);
5576     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5577     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5578     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5579
5580     state = 0xdeadbee;
5581     action = 0xdeadbee;
5582     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5583     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5584     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5585     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5586
5587     state = 0xdeadbee;
5588     action = 0xdeadbee;
5589     r = MsiGetComponentState(hpkg, "theta", &state, &action);
5590     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5591     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5592     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5593
5594     state = 0xdeadbee;
5595     action = 0xdeadbee;
5596     r = MsiGetComponentState(hpkg, "delta", &state, &action);
5597     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5598     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5599     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5600
5601     state = 0xdeadbee;
5602     action = 0xdeadbee;
5603     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5604     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5605     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5606     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5607
5608     state = 0xdeadbee;
5609     action = 0xdeadbee;
5610     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5611     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5612     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5613     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5614
5615     state = 0xdeadbee;
5616     action = 0xdeadbee;
5617     r = MsiGetComponentState(hpkg, "iota", &state, &action);
5618     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5619     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5620     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5621
5622     state = 0xdeadbee;
5623     action = 0xdeadbee;
5624     r = MsiGetComponentState(hpkg, "eta", &state, &action);
5625     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5626     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5627     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5628
5629     state = 0xdeadbee;
5630     action = 0xdeadbee;
5631     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5632     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5633     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5634     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5635
5636     state = 0xdeadbee;
5637     action = 0xdeadbee;
5638     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5639     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5640     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5641     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5642
5643     state = 0xdeadbee;
5644     action = 0xdeadbee;
5645     r = MsiGetComponentState(hpkg, "mu", &state, &action);
5646     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5647     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5648     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5649
5650     state = 0xdeadbee;
5651     action = 0xdeadbee;
5652     r = MsiGetComponentState(hpkg, "nu", &state, &action);
5653     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5654     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5655     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5656
5657     state = 0xdeadbee;
5658     action = 0xdeadbee;
5659     r = MsiGetComponentState(hpkg, "xi", &state, &action);
5660     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5661     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5662     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5663
5664     state = 0xdeadbee;
5665     action = 0xdeadbee;
5666     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5667     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5668     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5669     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5670
5671     state = 0xdeadbee;
5672     action = 0xdeadbee;
5673     r = MsiGetComponentState(hpkg, "pi", &state, &action);
5674     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5675     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5676     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5677
5678     state = 0xdeadbee;
5679     action = 0xdeadbee;
5680     r = MsiGetComponentState(hpkg, "rho", &state, &action);
5681     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5682     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5683     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5684
5685     state = 0xdeadbee;
5686     action = 0xdeadbee;
5687     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5688     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5689     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5690     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5691
5692     state = 0xdeadbee;
5693     action = 0xdeadbee;
5694     r = MsiGetComponentState(hpkg, "tau", &state, &action);
5695     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5696     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5697     todo_wine ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5698
5699     state = 0xdeadbee;
5700     action = 0xdeadbee;
5701     r = MsiGetComponentState(hpkg, "phi", &state, &action);
5702     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5703     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5704     todo_wine ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5705
5706     state = 0xdeadbee;
5707     action = 0xdeadbee;
5708     r = MsiGetComponentState(hpkg, "chi", &state, &action);
5709     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5710     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5711     todo_wine ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5712
5713     state = 0xdeadbee;
5714     action = 0xdeadbee;
5715     r = MsiGetComponentState(hpkg, "psi", &state, &action);
5716     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5717     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5718     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5719
5720     MsiCloseHandle(hpkg);
5721
5722     /* uninstall the product */
5723     r = MsiInstallProduct(msifile2, "REMOVE=ALL");
5724     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5725
5726     /* all features installed from source */
5727     r = MsiInstallProduct(msifile3, "ADDSOURCE=ALL");
5728     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5729
5730     r = MsiOpenDatabase(msifile3, MSIDBOPEN_DIRECT, &hdb);
5731     ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
5732
5733     /* this property must not be in the saved msi file */
5734     r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
5735     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
5736
5737     r = package_from_db( hdb, &hpkg );
5738     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
5739
5740     state = 0xdeadbee;
5741     action = 0xdeadbee;
5742     r = MsiGetFeatureState(hpkg, "one", &state, &action);
5743     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5744     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5745     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5746
5747     state = 0xdeadbee;
5748     action = 0xdeadbee;
5749     r = MsiGetFeatureState(hpkg, "two", &state, &action);
5750     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5751     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5752     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5753
5754     state = 0xdeadbee;
5755     action = 0xdeadbee;
5756     r = MsiGetFeatureState(hpkg, "three", &state, &action);
5757     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5758     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5759     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5760
5761     state = 0xdeadbee;
5762     action = 0xdeadbee;
5763     r = MsiGetFeatureState(hpkg, "four", &state, &action);
5764     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5765     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5766     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5767
5768     state = 0xdeadbee;
5769     action = 0xdeadbee;
5770     r = MsiGetFeatureState(hpkg, "five", &state, &action);
5771     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5772     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5773     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5774
5775     state = 0xdeadbee;
5776     action = 0xdeadbee;
5777     r = MsiGetFeatureState(hpkg, "six", &state, &action);
5778     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5779     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5780     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5781
5782     state = 0xdeadbee;
5783     action = 0xdeadbee;
5784     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5785     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5786     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5787     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5788
5789     state = 0xdeadbee;
5790     action = 0xdeadbee;
5791     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5792     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5793     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5794     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5795
5796     state = 0xdeadbee;
5797     action = 0xdeadbee;
5798     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5799     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5800     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5801     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5802
5803     state = 0xdeadbee;
5804     action = 0xdeadbee;
5805     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5806     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5807     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5808     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5809
5810     state = 0xdeadbee;
5811     action = 0xdeadbee;
5812     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
5813     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5814     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5815     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5816
5817     state = 0xdeadbee;
5818     action = 0xdeadbee;
5819     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5820     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5821     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5822     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5823
5824     state = 0xdeadbee;
5825     action = 0xdeadbee;
5826     r = MsiGetComponentState(hpkg, "beta", &state, &action);
5827     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5828     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5829     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5830
5831     state = 0xdeadbee;
5832     action = 0xdeadbee;
5833     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5834     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5835     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5836     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5837
5838     state = 0xdeadbee;
5839     action = 0xdeadbee;
5840     r = MsiGetComponentState(hpkg, "theta", &state, &action);
5841     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5842     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5843     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5844
5845     state = 0xdeadbee;
5846     action = 0xdeadbee;
5847     r = MsiGetComponentState(hpkg, "delta", &state, &action);
5848     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5849     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5850     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5851
5852     state = 0xdeadbee;
5853     action = 0xdeadbee;
5854     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5855     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5856     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5857     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5858
5859     state = 0xdeadbee;
5860     action = 0xdeadbee;
5861     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5862     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5863     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5864     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5865
5866     state = 0xdeadbee;
5867     action = 0xdeadbee;
5868     r = MsiGetComponentState(hpkg, "iota", &state, &action);
5869     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5870     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5871     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5872
5873     state = 0xdeadbee;
5874     action = 0xdeadbee;
5875     r = MsiGetComponentState(hpkg, "eta", &state, &action);
5876     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5877     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5878     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5879
5880     state = 0xdeadbee;
5881     action = 0xdeadbee;
5882     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5883     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5884     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5885     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5886
5887     state = 0xdeadbee;
5888     action = 0xdeadbee;
5889     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5890     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5891     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5892     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5893
5894     state = 0xdeadbee;
5895     action = 0xdeadbee;
5896     r = MsiGetComponentState(hpkg, "mu", &state, &action);
5897     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5898     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5899     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5900
5901     state = 0xdeadbee;
5902     action = 0xdeadbee;
5903     r = MsiGetComponentState(hpkg, "nu", &state, &action);
5904     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5905     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5906     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5907
5908     state = 0xdeadbee;
5909     action = 0xdeadbee;
5910     r = MsiGetComponentState(hpkg, "xi", &state, &action);
5911     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5912     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5913     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5914
5915     state = 0xdeadbee;
5916     action = 0xdeadbee;
5917     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5918     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5919     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5920     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5921
5922     state = 0xdeadbee;
5923     action = 0xdeadbee;
5924     r = MsiGetComponentState(hpkg, "pi", &state, &action);
5925     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5926     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5927     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5928
5929     state = 0xdeadbee;
5930     action = 0xdeadbee;
5931     r = MsiGetComponentState(hpkg, "rho", &state, &action);
5932     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5933     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5934     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5935
5936     state = 0xdeadbee;
5937     action = 0xdeadbee;
5938     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5939     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5940     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5941     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5942
5943     state = 0xdeadbee;
5944     action = 0xdeadbee;
5945     r = MsiGetComponentState(hpkg, "tau", &state, &action);
5946     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5947     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5948     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5949
5950     state = 0xdeadbee;
5951     action = 0xdeadbee;
5952     r = MsiGetComponentState(hpkg, "phi", &state, &action);
5953     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5954     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5955     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5956
5957     state = 0xdeadbee;
5958     action = 0xdeadbee;
5959     r = MsiGetComponentState(hpkg, "chi", &state, &action);
5960     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5961     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5962     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5963
5964     state = 0xdeadbee;
5965     action = 0xdeadbee;
5966     r = MsiGetComponentState(hpkg, "psi", &state, &action);
5967     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5968     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5969     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5970
5971     r = MsiDoAction( hpkg, "CostInitialize");
5972     ok( r == ERROR_SUCCESS, "cost init failed\n");
5973
5974     state = 0xdeadbee;
5975     action = 0xdeadbee;
5976     r = MsiGetFeatureState(hpkg, "one", &state, &action);
5977     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5978     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5979     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5980
5981     state = 0xdeadbee;
5982     action = 0xdeadbee;
5983     r = MsiGetFeatureState(hpkg, "two", &state, &action);
5984     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5985     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5986     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5987
5988     state = 0xdeadbee;
5989     action = 0xdeadbee;
5990     r = MsiGetFeatureState(hpkg, "three", &state, &action);
5991     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5992     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5993     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5994
5995     state = 0xdeadbee;
5996     action = 0xdeadbee;
5997     r = MsiGetFeatureState(hpkg, "four", &state, &action);
5998     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5999     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6000     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6001
6002     state = 0xdeadbee;
6003     action = 0xdeadbee;
6004     r = MsiGetFeatureState(hpkg, "five", &state, &action);
6005     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6006     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6007     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6008
6009     state = 0xdeadbee;
6010     action = 0xdeadbee;
6011     r = MsiGetFeatureState(hpkg, "six", &state, &action);
6012     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6013     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6014     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6015
6016     state = 0xdeadbee;
6017     action = 0xdeadbee;
6018     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6019     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6020     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6021     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6022
6023     state = 0xdeadbee;
6024     action = 0xdeadbee;
6025     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6026     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6027     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6028     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6029
6030     state = 0xdeadbee;
6031     action = 0xdeadbee;
6032     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6033     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6034     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6035     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6036
6037     state = 0xdeadbee;
6038     action = 0xdeadbee;
6039     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6040     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6041     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6042     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6043
6044     state = 0xdeadbee;
6045     action = 0xdeadbee;
6046     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
6047     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6048     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6049     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6050
6051     state = 0xdeadbee;
6052     action = 0xdeadbee;
6053     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6054     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6055     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6056     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6057
6058     state = 0xdeadbee;
6059     action = 0xdeadbee;
6060     r = MsiGetComponentState(hpkg, "beta", &state, &action);
6061     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6062     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6063     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6064
6065     state = 0xdeadbee;
6066     action = 0xdeadbee;
6067     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6068     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6069     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6070     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6071
6072     state = 0xdeadbee;
6073     action = 0xdeadbee;
6074     r = MsiGetComponentState(hpkg, "theta", &state, &action);
6075     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6076     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6077     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6078
6079     state = 0xdeadbee;
6080     action = 0xdeadbee;
6081     r = MsiGetComponentState(hpkg, "delta", &state, &action);
6082     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6083     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6084     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6085
6086     state = 0xdeadbee;
6087     action = 0xdeadbee;
6088     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6089     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6090     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6091     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6092
6093     state = 0xdeadbee;
6094     action = 0xdeadbee;
6095     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6096     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6097     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6098     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6099
6100     state = 0xdeadbee;
6101     action = 0xdeadbee;
6102     r = MsiGetComponentState(hpkg, "iota", &state, &action);
6103     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6104     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6105     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6106
6107     state = 0xdeadbee;
6108     action = 0xdeadbee;
6109     r = MsiGetComponentState(hpkg, "eta", &state, &action);
6110     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6111     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6112     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6113
6114     state = 0xdeadbee;
6115     action = 0xdeadbee;
6116     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6117     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6118     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6119     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6120
6121     state = 0xdeadbee;
6122     action = 0xdeadbee;
6123     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6124     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6125     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6126     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6127
6128     state = 0xdeadbee;
6129     action = 0xdeadbee;
6130     r = MsiGetComponentState(hpkg, "mu", &state, &action);
6131     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6132     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6133     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6134
6135     state = 0xdeadbee;
6136     action = 0xdeadbee;
6137     r = MsiGetComponentState(hpkg, "nu", &state, &action);
6138     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6139     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6140     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6141
6142     state = 0xdeadbee;
6143     action = 0xdeadbee;
6144     r = MsiGetComponentState(hpkg, "xi", &state, &action);
6145     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6146     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6147     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6148
6149     state = 0xdeadbee;
6150     action = 0xdeadbee;
6151     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6152     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6153     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6154     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6155
6156     state = 0xdeadbee;
6157     action = 0xdeadbee;
6158     r = MsiGetComponentState(hpkg, "pi", &state, &action);
6159     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6160     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6161     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6162
6163     state = 0xdeadbee;
6164     action = 0xdeadbee;
6165     r = MsiGetComponentState(hpkg, "rho", &state, &action);
6166     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6167     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6168     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6169
6170     state = 0xdeadbee;
6171     action = 0xdeadbee;
6172     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6173     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6174     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6175     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6176
6177     state = 0xdeadbee;
6178     action = 0xdeadbee;
6179     r = MsiGetComponentState(hpkg, "tau", &state, &action);
6180     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6181     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6182     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6183
6184     state = 0xdeadbee;
6185     action = 0xdeadbee;
6186     r = MsiGetComponentState(hpkg, "phi", &state, &action);
6187     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6188     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6189     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6190
6191     state = 0xdeadbee;
6192     action = 0xdeadbee;
6193     r = MsiGetComponentState(hpkg, "chi", &state, &action);
6194     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6195     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6196     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6197
6198     state = 0xdeadbee;
6199     action = 0xdeadbee;
6200     r = MsiGetComponentState(hpkg, "psi", &state, &action);
6201     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6202     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6203     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6204
6205     r = MsiDoAction( hpkg, "FileCost");
6206     ok( r == ERROR_SUCCESS, "file cost failed\n");
6207
6208     state = 0xdeadbee;
6209     action = 0xdeadbee;
6210     r = MsiGetFeatureState(hpkg, "one", &state, &action);
6211     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6212     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6213     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6214
6215     state = 0xdeadbee;
6216     action = 0xdeadbee;
6217     r = MsiGetFeatureState(hpkg, "two", &state, &action);
6218     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6219     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6220     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6221
6222     state = 0xdeadbee;
6223     action = 0xdeadbee;
6224     r = MsiGetFeatureState(hpkg, "three", &state, &action);
6225     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6226     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6227     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6228
6229     state = 0xdeadbee;
6230     action = 0xdeadbee;
6231     r = MsiGetFeatureState(hpkg, "four", &state, &action);
6232     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6233     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6234     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6235
6236     state = 0xdeadbee;
6237     action = 0xdeadbee;
6238     r = MsiGetFeatureState(hpkg, "five", &state, &action);
6239     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6240     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6241     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6242
6243     state = 0xdeadbee;
6244     action = 0xdeadbee;
6245     r = MsiGetFeatureState(hpkg, "six", &state, &action);
6246     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6247     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6248     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6249
6250     state = 0xdeadbee;
6251     action = 0xdeadbee;
6252     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6253     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6254     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6255     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6256
6257     state = 0xdeadbee;
6258     action = 0xdeadbee;
6259     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6260     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6261     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6262     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6263
6264     state = 0xdeadbee;
6265     action = 0xdeadbee;
6266     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6267     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6268     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6269     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6270
6271     state = 0xdeadbee;
6272     action = 0xdeadbee;
6273     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6274     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6275     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6276     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6277
6278     state = 0xdeadbee;
6279     action = 0xdeadbee;
6280     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
6281     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6282     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6283     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6284
6285     state = 0xdeadbee;
6286     action = 0xdeadbee;
6287     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6288     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6289     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6290     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6291
6292     state = 0xdeadbee;
6293     action = 0xdeadbee;
6294     r = MsiGetComponentState(hpkg, "beta", &state, &action);
6295     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6296     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6297     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6298
6299     state = 0xdeadbee;
6300     action = 0xdeadbee;
6301     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6302     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6303     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6304     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6305
6306     state = 0xdeadbee;
6307     action = 0xdeadbee;
6308     r = MsiGetComponentState(hpkg, "theta", &state, &action);
6309     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6310     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6311     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6312
6313     state = 0xdeadbee;
6314     action = 0xdeadbee;
6315     r = MsiGetComponentState(hpkg, "delta", &state, &action);
6316     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6317     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6318     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6319
6320     state = 0xdeadbee;
6321     action = 0xdeadbee;
6322     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6323     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6324     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6325     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6326
6327     state = 0xdeadbee;
6328     action = 0xdeadbee;
6329     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6330     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6331     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6332     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6333
6334     state = 0xdeadbee;
6335     action = 0xdeadbee;
6336     r = MsiGetComponentState(hpkg, "iota", &state, &action);
6337     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6338     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6339     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6340
6341     state = 0xdeadbee;
6342     action = 0xdeadbee;
6343     r = MsiGetComponentState(hpkg, "eta", &state, &action);
6344     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6345     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6346     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6347
6348     state = 0xdeadbee;
6349     action = 0xdeadbee;
6350     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6351     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6352     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6353     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6354
6355     state = 0xdeadbee;
6356     action = 0xdeadbee;
6357     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6358     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6359     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6360     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6361
6362     state = 0xdeadbee;
6363     action = 0xdeadbee;
6364     r = MsiGetComponentState(hpkg, "mu", &state, &action);
6365     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6366     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6367     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6368
6369     state = 0xdeadbee;
6370     action = 0xdeadbee;
6371     r = MsiGetComponentState(hpkg, "nu", &state, &action);
6372     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6373     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6374     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6375
6376     state = 0xdeadbee;
6377     action = 0xdeadbee;
6378     r = MsiGetComponentState(hpkg, "xi", &state, &action);
6379     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6380     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6381     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6382
6383     state = 0xdeadbee;
6384     action = 0xdeadbee;
6385     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6386     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6387     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6388     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6389
6390     state = 0xdeadbee;
6391     action = 0xdeadbee;
6392     r = MsiGetComponentState(hpkg, "pi", &state, &action);
6393     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6394     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6395     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6396
6397     state = 0xdeadbee;
6398     action = 0xdeadbee;
6399     r = MsiGetComponentState(hpkg, "rho", &state, &action);
6400     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6401     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6402     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6403
6404     state = 0xdeadbee;
6405     action = 0xdeadbee;
6406     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6407     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6408     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6409     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6410
6411     state = 0xdeadbee;
6412     action = 0xdeadbee;
6413     r = MsiGetComponentState(hpkg, "tau", &state, &action);
6414     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6415     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6416     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6417
6418     state = 0xdeadbee;
6419     action = 0xdeadbee;
6420     r = MsiGetComponentState(hpkg, "phi", &state, &action);
6421     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6422     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6423     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6424
6425     state = 0xdeadbee;
6426     action = 0xdeadbee;
6427     r = MsiGetComponentState(hpkg, "chi", &state, &action);
6428     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6429     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6430     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6431
6432     state = 0xdeadbee;
6433     action = 0xdeadbee;
6434     r = MsiGetComponentState(hpkg, "psi", &state, &action);
6435     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6436     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6437     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6438
6439     r = MsiDoAction( hpkg, "CostFinalize");
6440     ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
6441
6442     state = 0xdeadbee;
6443     action = 0xdeadbee;
6444     r = MsiGetFeatureState(hpkg, "one", &state, &action);
6445     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6446     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6447     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6448
6449     state = 0xdeadbee;
6450     action = 0xdeadbee;
6451     r = MsiGetFeatureState(hpkg, "two", &state, &action);
6452     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6453     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6454     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6455
6456     state = 0xdeadbee;
6457     action = 0xdeadbee;
6458     r = MsiGetFeatureState(hpkg, "three", &state, &action);
6459     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6460     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6461     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6462
6463     state = 0xdeadbee;
6464     action = 0xdeadbee;
6465     r = MsiGetFeatureState(hpkg, "four", &state, &action);
6466     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6467     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6468     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6469
6470     state = 0xdeadbee;
6471     action = 0xdeadbee;
6472     r = MsiGetFeatureState(hpkg, "five", &state, &action);
6473     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6474     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6475     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6476
6477     state = 0xdeadbee;
6478     action = 0xdeadbee;
6479     r = MsiGetFeatureState(hpkg, "six", &state, &action);
6480     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6481     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6482     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6483
6484     state = 0xdeadbee;
6485     action = 0xdeadbee;
6486     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6487     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6488     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6489     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6490
6491     state = 0xdeadbee;
6492     action = 0xdeadbee;
6493     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6494     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6495     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6496     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6497
6498     state = 0xdeadbee;
6499     action = 0xdeadbee;
6500     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6501     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6502     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6503     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6504
6505     state = 0xdeadbee;
6506     action = 0xdeadbee;
6507     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6508     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6509     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6510     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6511
6512     state = 0xdeadbee;
6513     action = 0xdeadbee;
6514     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
6515     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6516     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6517     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6518
6519     state = 0xdeadbee;
6520     action = 0xdeadbee;
6521     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6522     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6523     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6524     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6525
6526     state = 0xdeadbee;
6527     action = 0xdeadbee;
6528     r = MsiGetComponentState(hpkg, "beta", &state, &action);
6529     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6530     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6531     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6532
6533     state = 0xdeadbee;
6534     action = 0xdeadbee;
6535     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6536     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6537     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6538     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6539
6540     state = 0xdeadbee;
6541     action = 0xdeadbee;
6542     r = MsiGetComponentState(hpkg, "theta", &state, &action);
6543     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6544     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6545     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6546
6547     state = 0xdeadbee;
6548     action = 0xdeadbee;
6549     r = MsiGetComponentState(hpkg, "delta", &state, &action);
6550     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6551     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6552     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6553
6554     state = 0xdeadbee;
6555     action = 0xdeadbee;
6556     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6557     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6558     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6559     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6560
6561     state = 0xdeadbee;
6562     action = 0xdeadbee;
6563     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6564     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6565     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6566     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6567
6568     state = 0xdeadbee;
6569     action = 0xdeadbee;
6570     r = MsiGetComponentState(hpkg, "iota", &state, &action);
6571     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6572     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6573     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6574
6575     state = 0xdeadbee;
6576     action = 0xdeadbee;
6577     r = MsiGetComponentState(hpkg, "eta", &state, &action);
6578     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6579     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6580     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6581
6582     state = 0xdeadbee;
6583     action = 0xdeadbee;
6584     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6585     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6586     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6587     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6588
6589     state = 0xdeadbee;
6590     action = 0xdeadbee;
6591     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6592     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6593     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6594     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6595
6596     state = 0xdeadbee;
6597     action = 0xdeadbee;
6598     r = MsiGetComponentState(hpkg, "mu", &state, &action);
6599     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6600     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6601     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6602
6603     state = 0xdeadbee;
6604     action = 0xdeadbee;
6605     r = MsiGetComponentState(hpkg, "nu", &state, &action);
6606     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6607     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6608     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6609
6610     state = 0xdeadbee;
6611     action = 0xdeadbee;
6612     r = MsiGetComponentState(hpkg, "xi", &state, &action);
6613     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6614     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6615     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6616
6617     state = 0xdeadbee;
6618     action = 0xdeadbee;
6619     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6620     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6621     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6622     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6623
6624     state = 0xdeadbee;
6625     action = 0xdeadbee;
6626     r = MsiGetComponentState(hpkg, "pi", &state, &action);
6627     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6628     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6629     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6630
6631     state = 0xdeadbee;
6632     action = 0xdeadbee;
6633     r = MsiGetComponentState(hpkg, "rho", &state, &action);
6634     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6635     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6636     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6637
6638     state = 0xdeadbee;
6639     action = 0xdeadbee;
6640     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6641     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6642     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6643     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6644
6645     state = 0xdeadbee;
6646     action = 0xdeadbee;
6647     r = MsiGetComponentState(hpkg, "tau", &state, &action);
6648     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6649     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6650     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6651
6652     state = 0xdeadbee;
6653     action = 0xdeadbee;
6654     r = MsiGetComponentState(hpkg, "phi", &state, &action);
6655     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6656     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6657     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6658
6659     state = 0xdeadbee;
6660     action = 0xdeadbee;
6661     r = MsiGetComponentState(hpkg, "chi", &state, &action);
6662     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6663     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6664     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6665
6666     state = 0xdeadbee;
6667     action = 0xdeadbee;
6668     r = MsiGetComponentState(hpkg, "psi", &state, &action);
6669     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6670     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6671     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6672
6673     MsiCloseHandle(hpkg);
6674
6675     /* reinstall the product */
6676     r = MsiInstallProduct(msifile3, "REINSTALL=ALL");
6677     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6678
6679     r = MsiOpenDatabase(msifile4, MSIDBOPEN_DIRECT, &hdb);
6680     ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
6681
6682     /* this property must not be in the saved msi file */
6683     r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
6684     ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
6685
6686     r = package_from_db( hdb, &hpkg );
6687     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
6688
6689     state = 0xdeadbee;
6690     action = 0xdeadbee;
6691     r = MsiGetFeatureState(hpkg, "one", &state, &action);
6692     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6693     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6694     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6695
6696     state = 0xdeadbee;
6697     action = 0xdeadbee;
6698     r = MsiGetFeatureState(hpkg, "two", &state, &action);
6699     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6700     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6701     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6702
6703     state = 0xdeadbee;
6704     action = 0xdeadbee;
6705     r = MsiGetFeatureState(hpkg, "three", &state, &action);
6706     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6707     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6708     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6709
6710     state = 0xdeadbee;
6711     action = 0xdeadbee;
6712     r = MsiGetFeatureState(hpkg, "four", &state, &action);
6713     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6714     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6715     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6716
6717     state = 0xdeadbee;
6718     action = 0xdeadbee;
6719     r = MsiGetFeatureState(hpkg, "five", &state, &action);
6720     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6721     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6722     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6723
6724     state = 0xdeadbee;
6725     action = 0xdeadbee;
6726     r = MsiGetFeatureState(hpkg, "six", &state, &action);
6727     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6728     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6729     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6730
6731     state = 0xdeadbee;
6732     action = 0xdeadbee;
6733     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6734     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6735     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6736     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6737
6738     state = 0xdeadbee;
6739     action = 0xdeadbee;
6740     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6741     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6742     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6743     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6744
6745     state = 0xdeadbee;
6746     action = 0xdeadbee;
6747     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6748     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6749     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6750     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6751
6752     state = 0xdeadbee;
6753     action = 0xdeadbee;
6754     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6755     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6756     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6757     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6758
6759     state = 0xdeadbee;
6760     action = 0xdeadbee;
6761     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
6762     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6763     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6764     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6765
6766     state = 0xdeadbee;
6767     action = 0xdeadbee;
6768     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6769     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6770     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6771     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6772
6773     state = 0xdeadbee;
6774     action = 0xdeadbee;
6775     r = MsiGetComponentState(hpkg, "beta", &state, &action);
6776     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6777     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6778     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6779
6780     state = 0xdeadbee;
6781     action = 0xdeadbee;
6782     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6783     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6784     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6785     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6786
6787     state = 0xdeadbee;
6788     action = 0xdeadbee;
6789     r = MsiGetComponentState(hpkg, "theta", &state, &action);
6790     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6791     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6792     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6793
6794     state = 0xdeadbee;
6795     action = 0xdeadbee;
6796     r = MsiGetComponentState(hpkg, "delta", &state, &action);
6797     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6798     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6799     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6800
6801     state = 0xdeadbee;
6802     action = 0xdeadbee;
6803     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6804     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6805     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6806     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6807
6808     state = 0xdeadbee;
6809     action = 0xdeadbee;
6810     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6811     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6812     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6813     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6814
6815     state = 0xdeadbee;
6816     action = 0xdeadbee;
6817     r = MsiGetComponentState(hpkg, "iota", &state, &action);
6818     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6819     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6820     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6821
6822     state = 0xdeadbee;
6823     action = 0xdeadbee;
6824     r = MsiGetComponentState(hpkg, "eta", &state, &action);
6825     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6826     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6827     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6828
6829     state = 0xdeadbee;
6830     action = 0xdeadbee;
6831     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6832     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6833     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6834     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6835
6836     state = 0xdeadbee;
6837     action = 0xdeadbee;
6838     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6839     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6840     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6841     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6842
6843     state = 0xdeadbee;
6844     action = 0xdeadbee;
6845     r = MsiGetComponentState(hpkg, "mu", &state, &action);
6846     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6847     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6848     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6849
6850     state = 0xdeadbee;
6851     action = 0xdeadbee;
6852     r = MsiGetComponentState(hpkg, "nu", &state, &action);
6853     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6854     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6855     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6856
6857     state = 0xdeadbee;
6858     action = 0xdeadbee;
6859     r = MsiGetComponentState(hpkg, "xi", &state, &action);
6860     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6861     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6862     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6863
6864     state = 0xdeadbee;
6865     action = 0xdeadbee;
6866     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6867     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6868     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6869     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6870
6871     state = 0xdeadbee;
6872     action = 0xdeadbee;
6873     r = MsiGetComponentState(hpkg, "pi", &state, &action);
6874     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6875     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6876     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6877
6878     state = 0xdeadbee;
6879     action = 0xdeadbee;
6880     r = MsiGetComponentState(hpkg, "rho", &state, &action);
6881     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6882     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6883     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6884
6885     state = 0xdeadbee;
6886     action = 0xdeadbee;
6887     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6888     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6889     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6890     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6891
6892     state = 0xdeadbee;
6893     action = 0xdeadbee;
6894     r = MsiGetComponentState(hpkg, "tau", &state, &action);
6895     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6896     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6897     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6898
6899     state = 0xdeadbee;
6900     action = 0xdeadbee;
6901     r = MsiGetComponentState(hpkg, "phi", &state, &action);
6902     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6903     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6904     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6905
6906     state = 0xdeadbee;
6907     action = 0xdeadbee;
6908     r = MsiGetComponentState(hpkg, "chi", &state, &action);
6909     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6910     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6911     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6912
6913     state = 0xdeadbee;
6914     action = 0xdeadbee;
6915     r = MsiGetComponentState(hpkg, "psi", &state, &action);
6916     ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6917     ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6918     ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6919
6920     r = MsiDoAction( hpkg, "CostInitialize");
6921     ok( r == ERROR_SUCCESS, "cost init failed\n");
6922
6923     state = 0xdeadbee;
6924     action = 0xdeadbee;
6925     r = MsiGetFeatureState(hpkg, "one", &state, &action);
6926     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6927     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6928     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6929
6930     state = 0xdeadbee;
6931     action = 0xdeadbee;
6932     r = MsiGetFeatureState(hpkg, "two", &state, &action);
6933     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6934     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6935     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6936
6937     state = 0xdeadbee;
6938     action = 0xdeadbee;
6939     r = MsiGetFeatureState(hpkg, "three", &state, &action);
6940     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6941     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6942     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6943
6944     state = 0xdeadbee;
6945     action = 0xdeadbee;
6946     r = MsiGetFeatureState(hpkg, "four", &state, &action);
6947     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6948     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6949     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6950
6951     state = 0xdeadbee;
6952     action = 0xdeadbee;
6953     r = MsiGetFeatureState(hpkg, "five", &state, &action);
6954     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6955     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6956     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6957
6958     state = 0xdeadbee;
6959     action = 0xdeadbee;
6960     r = MsiGetFeatureState(hpkg, "six", &state, &action);
6961     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6962     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6963     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6964
6965     state = 0xdeadbee;
6966     action = 0xdeadbee;
6967     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6968     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6969     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6970     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6971
6972     state = 0xdeadbee;
6973     action = 0xdeadbee;
6974     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6975     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6976     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6977     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6978
6979     state = 0xdeadbee;
6980     action = 0xdeadbee;
6981     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6982     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6983     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6984     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6985
6986     state = 0xdeadbee;
6987     action = 0xdeadbee;
6988     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6989     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6990     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6991     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6992
6993     state = 0xdeadbee;
6994     action = 0xdeadbee;
6995     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
6996     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6997     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6998     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6999
7000     state = 0xdeadbee;
7001     action = 0xdeadbee;
7002     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
7003     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7004     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7005     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7006
7007     state = 0xdeadbee;
7008     action = 0xdeadbee;
7009     r = MsiGetComponentState(hpkg, "beta", &state, &action);
7010     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7011     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7012     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7013
7014     state = 0xdeadbee;
7015     action = 0xdeadbee;
7016     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
7017     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7018     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7019     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7020
7021     state = 0xdeadbee;
7022     action = 0xdeadbee;
7023     r = MsiGetComponentState(hpkg, "theta", &state, &action);
7024     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7025     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7026     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7027
7028     state = 0xdeadbee;
7029     action = 0xdeadbee;
7030     r = MsiGetComponentState(hpkg, "delta", &state, &action);
7031     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7032     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7033     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7034
7035     state = 0xdeadbee;
7036     action = 0xdeadbee;
7037     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
7038     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7039     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7040     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7041
7042     state = 0xdeadbee;
7043     action = 0xdeadbee;
7044     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
7045     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7046     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7047     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7048
7049     state = 0xdeadbee;
7050     action = 0xdeadbee;
7051     r = MsiGetComponentState(hpkg, "iota", &state, &action);
7052     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7053     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7054     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7055
7056     state = 0xdeadbee;
7057     action = 0xdeadbee;
7058     r = MsiGetComponentState(hpkg, "eta", &state, &action);
7059     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7060     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7061     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7062
7063     state = 0xdeadbee;
7064     action = 0xdeadbee;
7065     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
7066     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7067     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7068     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7069
7070     state = 0xdeadbee;
7071     action = 0xdeadbee;
7072     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
7073     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7074     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7075     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7076
7077     state = 0xdeadbee;
7078     action = 0xdeadbee;
7079     r = MsiGetComponentState(hpkg, "mu", &state, &action);
7080     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7081     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7082     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7083
7084     state = 0xdeadbee;
7085     action = 0xdeadbee;
7086     r = MsiGetComponentState(hpkg, "nu", &state, &action);
7087     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7088     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7089     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7090
7091     state = 0xdeadbee;
7092     action = 0xdeadbee;
7093     r = MsiGetComponentState(hpkg, "xi", &state, &action);
7094     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7095     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7096     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7097
7098     state = 0xdeadbee;
7099     action = 0xdeadbee;
7100     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
7101     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7102     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7103     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7104
7105     state = 0xdeadbee;
7106     action = 0xdeadbee;
7107     r = MsiGetComponentState(hpkg, "pi", &state, &action);
7108     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7109     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7110     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7111
7112     state = 0xdeadbee;
7113     action = 0xdeadbee;
7114     r = MsiGetComponentState(hpkg, "rho", &state, &action);
7115     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7116     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7117     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7118
7119     state = 0xdeadbee;
7120     action = 0xdeadbee;
7121     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
7122     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7123     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7124     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7125
7126     state = 0xdeadbee;
7127     action = 0xdeadbee;
7128     r = MsiGetComponentState(hpkg, "tau", &state, &action);
7129     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7130     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7131     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7132
7133     state = 0xdeadbee;
7134     action = 0xdeadbee;
7135     r = MsiGetComponentState(hpkg, "phi", &state, &action);
7136     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7137     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7138     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7139
7140     state = 0xdeadbee;
7141     action = 0xdeadbee;
7142     r = MsiGetComponentState(hpkg, "chi", &state, &action);
7143     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7144     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7145     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7146
7147     state = 0xdeadbee;
7148     action = 0xdeadbee;
7149     r = MsiGetComponentState(hpkg, "psi", &state, &action);
7150     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7151     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7152     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7153
7154     r = MsiDoAction( hpkg, "FileCost");
7155     ok( r == ERROR_SUCCESS, "file cost failed\n");
7156
7157     state = 0xdeadbee;
7158     action = 0xdeadbee;
7159     r = MsiGetFeatureState(hpkg, "one", &state, &action);
7160     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7161     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7162     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7163
7164     state = 0xdeadbee;
7165     action = 0xdeadbee;
7166     r = MsiGetFeatureState(hpkg, "two", &state, &action);
7167     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7168     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7169     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7170
7171     state = 0xdeadbee;
7172     action = 0xdeadbee;
7173     r = MsiGetFeatureState(hpkg, "three", &state, &action);
7174     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7175     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7176     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7177
7178     state = 0xdeadbee;
7179     action = 0xdeadbee;
7180     r = MsiGetFeatureState(hpkg, "four", &state, &action);
7181     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7182     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7183     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7184
7185     state = 0xdeadbee;
7186     action = 0xdeadbee;
7187     r = MsiGetFeatureState(hpkg, "five", &state, &action);
7188     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7189     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7190     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7191
7192     state = 0xdeadbee;
7193     action = 0xdeadbee;
7194     r = MsiGetFeatureState(hpkg, "six", &state, &action);
7195     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7196     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7197     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7198
7199     state = 0xdeadbee;
7200     action = 0xdeadbee;
7201     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
7202     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7203     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7204     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7205
7206     state = 0xdeadbee;
7207     action = 0xdeadbee;
7208     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
7209     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7210     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7211     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7212
7213     state = 0xdeadbee;
7214     action = 0xdeadbee;
7215     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
7216     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7217     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7218     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7219
7220     state = 0xdeadbee;
7221     action = 0xdeadbee;
7222     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
7223     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7224     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7225     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7226
7227     state = 0xdeadbee;
7228     action = 0xdeadbee;
7229     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
7230     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7231     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7232     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7233
7234     state = 0xdeadbee;
7235     action = 0xdeadbee;
7236     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
7237     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7238     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7239     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7240
7241     state = 0xdeadbee;
7242     action = 0xdeadbee;
7243     r = MsiGetComponentState(hpkg, "beta", &state, &action);
7244     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7245     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7246     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7247
7248     state = 0xdeadbee;
7249     action = 0xdeadbee;
7250     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
7251     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7252     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7253     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7254
7255     state = 0xdeadbee;
7256     action = 0xdeadbee;
7257     r = MsiGetComponentState(hpkg, "theta", &state, &action);
7258     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7259     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7260     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7261
7262     state = 0xdeadbee;
7263     action = 0xdeadbee;
7264     r = MsiGetComponentState(hpkg, "delta", &state, &action);
7265     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7266     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7267     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7268
7269     state = 0xdeadbee;
7270     action = 0xdeadbee;
7271     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
7272     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7273     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7274     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7275
7276     state = 0xdeadbee;
7277     action = 0xdeadbee;
7278     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
7279     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7280     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7281     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7282
7283     state = 0xdeadbee;
7284     action = 0xdeadbee;
7285     r = MsiGetComponentState(hpkg, "iota", &state, &action);
7286     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7287     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7288     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7289
7290     state = 0xdeadbee;
7291     action = 0xdeadbee;
7292     r = MsiGetComponentState(hpkg, "eta", &state, &action);
7293     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7294     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7295     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7296
7297     state = 0xdeadbee;
7298     action = 0xdeadbee;
7299     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
7300     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7301     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7302     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7303
7304     state = 0xdeadbee;
7305     action = 0xdeadbee;
7306     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
7307     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7308     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7309     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7310
7311     state = 0xdeadbee;
7312     action = 0xdeadbee;
7313     r = MsiGetComponentState(hpkg, "mu", &state, &action);
7314     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7315     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7316     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7317
7318     state = 0xdeadbee;
7319     action = 0xdeadbee;
7320     r = MsiGetComponentState(hpkg, "nu", &state, &action);
7321     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7322     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7323     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7324
7325     state = 0xdeadbee;
7326     action = 0xdeadbee;
7327     r = MsiGetComponentState(hpkg, "xi", &state, &action);
7328     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7329     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7330     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7331
7332     state = 0xdeadbee;
7333     action = 0xdeadbee;
7334     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
7335     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7336     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7337     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7338
7339     state = 0xdeadbee;
7340     action = 0xdeadbee;
7341     r = MsiGetComponentState(hpkg, "pi", &state, &action);
7342     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7343     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7344     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7345
7346     state = 0xdeadbee;
7347     action = 0xdeadbee;
7348     r = MsiGetComponentState(hpkg, "rho", &state, &action);
7349     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7350     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7351     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7352
7353     state = 0xdeadbee;
7354     action = 0xdeadbee;
7355     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
7356     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7357     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7358     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7359
7360     state = 0xdeadbee;
7361     action = 0xdeadbee;
7362     r = MsiGetComponentState(hpkg, "tau", &state, &action);
7363     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7364     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7365     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7366
7367     state = 0xdeadbee;
7368     action = 0xdeadbee;
7369     r = MsiGetComponentState(hpkg, "phi", &state, &action);
7370     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7371     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7372     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7373
7374     state = 0xdeadbee;
7375     action = 0xdeadbee;
7376     r = MsiGetComponentState(hpkg, "chi", &state, &action);
7377     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7378     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7379     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7380
7381     state = 0xdeadbee;
7382     action = 0xdeadbee;
7383     r = MsiGetComponentState(hpkg, "psi", &state, &action);
7384     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7385     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7386     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7387
7388     r = MsiDoAction( hpkg, "CostFinalize");
7389     ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
7390
7391     state = 0xdeadbee;
7392     action = 0xdeadbee;
7393     r = MsiGetFeatureState(hpkg, "one", &state, &action);
7394     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7395     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7396     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7397
7398     state = 0xdeadbee;
7399     action = 0xdeadbee;
7400     r = MsiGetFeatureState(hpkg, "two", &state, &action);
7401     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7402     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7403     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7404
7405     state = 0xdeadbee;
7406     action = 0xdeadbee;
7407     r = MsiGetFeatureState(hpkg, "three", &state, &action);
7408     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7409     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7410     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7411
7412     state = 0xdeadbee;
7413     action = 0xdeadbee;
7414     r = MsiGetFeatureState(hpkg, "four", &state, &action);
7415     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7416     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7417     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7418
7419     state = 0xdeadbee;
7420     action = 0xdeadbee;
7421     r = MsiGetFeatureState(hpkg, "five", &state, &action);
7422     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7423     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7424     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7425
7426     state = 0xdeadbee;
7427     action = 0xdeadbee;
7428     r = MsiGetFeatureState(hpkg, "six", &state, &action);
7429     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7430     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7431     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7432
7433     state = 0xdeadbee;
7434     action = 0xdeadbee;
7435     r = MsiGetFeatureState(hpkg, "seven", &state, &action);
7436     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7437     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7438     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7439
7440     state = 0xdeadbee;
7441     action = 0xdeadbee;
7442     r = MsiGetFeatureState(hpkg, "eight", &state, &action);
7443     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7444     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7445     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7446
7447     state = 0xdeadbee;
7448     action = 0xdeadbee;
7449     r = MsiGetFeatureState(hpkg, "nine", &state, &action);
7450     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7451     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7452     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7453
7454     state = 0xdeadbee;
7455     action = 0xdeadbee;
7456     r = MsiGetFeatureState(hpkg, "ten", &state, &action);
7457     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7458     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7459     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7460
7461     state = 0xdeadbee;
7462     action = 0xdeadbee;
7463     r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
7464     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7465     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7466     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7467
7468     state = 0xdeadbee;
7469     action = 0xdeadbee;
7470     r = MsiGetComponentState(hpkg, "alpha", &state, &action);
7471     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7472     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7473     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7474
7475     state = 0xdeadbee;
7476     action = 0xdeadbee;
7477     r = MsiGetComponentState(hpkg, "beta", &state, &action);
7478     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7479     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7480     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7481
7482     state = 0xdeadbee;
7483     action = 0xdeadbee;
7484     r = MsiGetComponentState(hpkg, "gamma", &state, &action);
7485     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7486     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7487     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7488
7489     state = 0xdeadbee;
7490     action = 0xdeadbee;
7491     r = MsiGetComponentState(hpkg, "theta", &state, &action);
7492     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7493     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7494     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7495
7496     state = 0xdeadbee;
7497     action = 0xdeadbee;
7498     r = MsiGetComponentState(hpkg, "delta", &state, &action);
7499     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7500     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7501     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7502
7503     state = 0xdeadbee;
7504     action = 0xdeadbee;
7505     r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
7506     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7507     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7508     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7509
7510     state = 0xdeadbee;
7511     action = 0xdeadbee;
7512     r = MsiGetComponentState(hpkg, "zeta", &state, &action);
7513     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7514     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7515     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7516
7517     state = 0xdeadbee;
7518     action = 0xdeadbee;
7519     r = MsiGetComponentState(hpkg, "iota", &state, &action);
7520     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7521     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7522     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7523
7524     state = 0xdeadbee;
7525     action = 0xdeadbee;
7526     r = MsiGetComponentState(hpkg, "eta", &state, &action);
7527     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7528     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7529     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7530
7531     state = 0xdeadbee;
7532     action = 0xdeadbee;
7533     r = MsiGetComponentState(hpkg, "kappa", &state, &action);
7534     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7535     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7536     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7537
7538     state = 0xdeadbee;
7539     action = 0xdeadbee;
7540     r = MsiGetComponentState(hpkg, "lambda", &state, &action);
7541     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7542     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7543     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7544
7545     state = 0xdeadbee;
7546     action = 0xdeadbee;
7547     r = MsiGetComponentState(hpkg, "mu", &state, &action);
7548     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7549     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7550     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7551
7552     state = 0xdeadbee;
7553     action = 0xdeadbee;
7554     r = MsiGetComponentState(hpkg, "nu", &state, &action);
7555     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7556     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7557     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7558
7559     state = 0xdeadbee;
7560     action = 0xdeadbee;
7561     r = MsiGetComponentState(hpkg, "xi", &state, &action);
7562     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7563     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7564     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7565
7566     state = 0xdeadbee;
7567     action = 0xdeadbee;
7568     r = MsiGetComponentState(hpkg, "omicron", &state, &action);
7569     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7570     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7571     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7572
7573     state = 0xdeadbee;
7574     action = 0xdeadbee;
7575     r = MsiGetComponentState(hpkg, "pi", &state, &action);
7576     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7577     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7578     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7579
7580     state = 0xdeadbee;
7581     action = 0xdeadbee;
7582     r = MsiGetComponentState(hpkg, "rho", &state, &action);
7583     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7584     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7585     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7586
7587     state = 0xdeadbee;
7588     action = 0xdeadbee;
7589     r = MsiGetComponentState(hpkg, "sigma", &state, &action);
7590     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7591     ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7592     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7593
7594     state = 0xdeadbee;
7595     action = 0xdeadbee;
7596     r = MsiGetComponentState(hpkg, "tau", &state, &action);
7597     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7598     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7599     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7600
7601     state = 0xdeadbee;
7602     action = 0xdeadbee;
7603     r = MsiGetComponentState(hpkg, "phi", &state, &action);
7604     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7605     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7606     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7607
7608     state = 0xdeadbee;
7609     action = 0xdeadbee;
7610     r = MsiGetComponentState(hpkg, "chi", &state, &action);
7611     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7612     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7613     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7614
7615     state = 0xdeadbee;
7616     action = 0xdeadbee;
7617     r = MsiGetComponentState(hpkg, "psi", &state, &action);
7618     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7619     ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7620     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7621
7622     MsiCloseHandle(hpkg);
7623
7624     /* uninstall the product */
7625     r = MsiInstallProduct(msifile4, "REMOVE=ALL");
7626     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7627
7628     DeleteFileA(msifile);
7629     DeleteFileA(msifile2);
7630     DeleteFileA(msifile3);
7631     DeleteFileA(msifile4);
7632 }
7633
7634 static void test_getproperty(void)
7635 {
7636     MSIHANDLE hPackage = 0;
7637     char prop[100];
7638     static CHAR empty[] = "";
7639     DWORD size;
7640     UINT r;
7641
7642     r = package_from_db(create_package_db(), &hPackage);
7643     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7644     {
7645         skip("Not enough rights to perform tests\n");
7646         DeleteFile(msifile);
7647         return;
7648     }
7649     ok( r == ERROR_SUCCESS, "Failed to create package %u\n", r );
7650
7651     /* set the property */
7652     r = MsiSetProperty(hPackage, "Name", "Value");
7653     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7654
7655     /* retrieve the size, NULL pointer */
7656     size = 0;
7657     r = MsiGetProperty(hPackage, "Name", NULL, &size);
7658     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7659     ok( size == 5, "Expected 5, got %d\n", size);
7660
7661     /* retrieve the size, empty string */
7662     size = 0;
7663     r = MsiGetProperty(hPackage, "Name", empty, &size);
7664     ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7665     ok( size == 5, "Expected 5, got %d\n", size);
7666
7667     /* don't change size */
7668     r = MsiGetProperty(hPackage, "Name", prop, &size);
7669     ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7670     ok( size == 5, "Expected 5, got %d\n", size);
7671     ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
7672
7673     /* increase the size by 1 */
7674     size++;
7675     r = MsiGetProperty(hPackage, "Name", prop, &size);
7676     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7677     ok( size == 5, "Expected 5, got %d\n", size);
7678     ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
7679
7680     r = MsiCloseHandle( hPackage);
7681     ok( r == ERROR_SUCCESS , "Failed to close package\n" );
7682     DeleteFile(msifile);
7683 }
7684
7685 static void test_removefiles(void)
7686 {
7687     MSIHANDLE hpkg;
7688     UINT r;
7689     MSIHANDLE hdb;
7690
7691     hdb = create_package_db();
7692     ok ( hdb, "failed to create package database\n" );
7693
7694     r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
7695     ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
7696
7697     r = create_feature_table( hdb );
7698     ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
7699
7700     r = create_component_table( hdb );
7701     ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
7702
7703     r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
7704     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7705
7706     r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
7707     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7708
7709     r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
7710     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7711
7712     r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
7713     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7714
7715     r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
7716     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7717
7718     r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
7719     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7720
7721     r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
7722     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7723
7724     r = create_feature_components_table( hdb );
7725     ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
7726
7727     r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
7728     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7729
7730     r = add_feature_components_entry( hdb, "'one', 'helium'" );
7731     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7732
7733     r = add_feature_components_entry( hdb, "'one', 'lithium'" );
7734     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7735
7736     r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
7737     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7738
7739     r = add_feature_components_entry( hdb, "'one', 'boron'" );
7740     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7741
7742     r = add_feature_components_entry( hdb, "'one', 'carbon'" );
7743     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7744
7745     r = create_file_table( hdb );
7746     ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
7747
7748     r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
7749     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7750
7751     r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
7752     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7753
7754     r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
7755     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7756
7757     r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
7758     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7759
7760     r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
7761     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7762
7763     r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
7764     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7765
7766     r = create_remove_file_table( hdb );
7767     ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
7768
7769     r = package_from_db( hdb, &hpkg );
7770     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7771     {
7772         skip("Not enough rights to perform tests\n");
7773         DeleteFile(msifile);
7774         return;
7775     }
7776     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
7777
7778     MsiCloseHandle( hdb );
7779
7780     create_test_file( "hydrogen.txt" );
7781     create_test_file( "helium.txt" );
7782     create_test_file( "lithium.txt" );
7783     create_test_file( "beryllium.txt" );
7784     create_test_file( "boron.txt" );
7785     create_test_file( "carbon.txt" );
7786
7787     r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
7788     ok( r == ERROR_SUCCESS, "set property failed\n");
7789
7790     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7791
7792     r = MsiDoAction( hpkg, "CostInitialize");
7793     ok( r == ERROR_SUCCESS, "cost init failed\n");
7794
7795     r = MsiDoAction( hpkg, "FileCost");
7796     ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7797
7798     r = MsiDoAction( hpkg, "CostFinalize");
7799     ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7800
7801     r = MsiDoAction( hpkg, "InstallValidate");
7802     ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7803
7804     r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
7805     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7806
7807     r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
7808     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7809
7810     r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
7811     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7812
7813     r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
7814     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7815
7816     r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
7817     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7818
7819     r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
7820     ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7821
7822     r = MsiDoAction( hpkg, "RemoveFiles");
7823     ok( r == ERROR_SUCCESS, "remove files failed\n");
7824
7825     ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
7826     ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");    
7827     ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
7828     ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
7829     ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
7830     ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
7831
7832     MsiCloseHandle( hpkg );
7833     DeleteFileA(msifile);
7834 }
7835
7836 static void test_appsearch(void)
7837 {
7838     MSIHANDLE hpkg;
7839     UINT r;
7840     MSIHANDLE hdb;
7841     CHAR prop[MAX_PATH];
7842     DWORD size;
7843
7844     hdb = create_package_db();
7845     ok ( hdb, "failed to create package database\n" );
7846
7847     r = create_appsearch_table( hdb );
7848     ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
7849
7850     r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
7851     ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
7852
7853     r = add_appsearch_entry( hdb, "'NOTEPAD', 'NewSignature2'" );
7854     ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
7855
7856     r = create_reglocator_table( hdb );
7857     ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7858
7859     r = add_reglocator_entry( hdb, "NewSignature1", 0, "htmlfile\\shell\\open\\command", "", 1 );
7860     ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7861
7862     r = create_drlocator_table( hdb );
7863     ok( r == ERROR_SUCCESS, "cannot create DrLocator table: %d\n", r );
7864
7865     r = add_drlocator_entry( hdb, "'NewSignature2', 0, 'c:\\windows\\system32', 0" );
7866     ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7867
7868     r = create_signature_table( hdb );
7869     ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
7870
7871     r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
7872     ok( r == ERROR_SUCCESS, "cannot add signature: %d\n", r );
7873
7874     r = add_signature_entry( hdb, "'NewSignature2', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
7875     ok( r == ERROR_SUCCESS, "cannot add signature: %d\n", r );
7876
7877     r = package_from_db( hdb, &hpkg );
7878     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7879     {
7880         skip("Not enough rights to perform tests\n");
7881         DeleteFile(msifile);
7882         return;
7883     }
7884     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
7885     MsiCloseHandle( hdb );
7886     if (r != ERROR_SUCCESS)
7887         goto done;
7888
7889     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7890
7891     r = MsiDoAction( hpkg, "AppSearch" );
7892     ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
7893
7894     size = sizeof(prop);
7895     r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
7896     ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
7897     todo_wine
7898     {
7899         ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
7900     }
7901
7902     size = sizeof(prop);
7903     r = MsiGetPropertyA( hpkg, "NOTEPAD", prop, &size );
7904     ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
7905
7906 done:
7907     MsiCloseHandle( hpkg );
7908     DeleteFileA(msifile);
7909 }
7910
7911 static void test_appsearch_complocator(void)
7912 {
7913     MSIHANDLE hpkg, hdb;
7914     CHAR path[MAX_PATH];
7915     CHAR prop[MAX_PATH];
7916     LPSTR usersid;
7917     DWORD size;
7918     UINT r;
7919
7920     if (!get_user_sid(&usersid))
7921         return;
7922
7923     if (is_process_limited())
7924     {
7925         skip("process is limited\n");
7926         return;
7927     }
7928
7929     create_test_file("FileName1");
7930     create_test_file("FileName4");
7931     set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE,
7932                        "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
7933
7934     create_test_file("FileName2");
7935     set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED,
7936                        "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
7937
7938     create_test_file("FileName3");
7939     set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED,
7940                        "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
7941
7942     create_test_file("FileName5");
7943     set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE,
7944                        "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
7945
7946     create_test_file("FileName6");
7947     set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE,
7948                        "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
7949
7950     create_test_file("FileName7");
7951     set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE,
7952                        "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
7953
7954     /* dir is FALSE, but we're pretending it's a directory */
7955     set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE,
7956                        "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
7957
7958     create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7959     set_component_path("FileName8.dll", MSIINSTALLCONTEXT_MACHINE,
7960                        "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
7961
7962     create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
7963     set_component_path("FileName9.dll", MSIINSTALLCONTEXT_MACHINE,
7964                        "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
7965
7966     create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7967     set_component_path("FileName10.dll", MSIINSTALLCONTEXT_MACHINE,
7968                        "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
7969
7970     hdb = create_package_db();
7971     ok(hdb, "Expected a valid database handle\n");
7972
7973     r = create_appsearch_table(hdb);
7974     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7975
7976     r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
7977     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7978
7979     r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
7980     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7981
7982     r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
7983     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7984
7985     r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
7986     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7987
7988     r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
7989     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7990
7991     r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
7992     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7993
7994     r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
7995     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7996
7997     r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
7998     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7999
8000     r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8001     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8002
8003     r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8004     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8005
8006     r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8007     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8008
8009     r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
8010     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8011
8012     r = create_complocator_table(hdb);
8013     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8014
8015     /* published component, machine, file, signature, misdbLocatorTypeFile */
8016     r = add_complocator_entry(hdb, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
8017     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8018
8019     /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
8020     r = add_complocator_entry(hdb, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
8021     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8022
8023     /* published component, user-managed, file, signature, misdbLocatorTypeFile */
8024     r = add_complocator_entry(hdb, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
8025     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8026
8027     /* published component, machine, file, signature, misdbLocatorTypeDirectory */
8028     r = add_complocator_entry(hdb, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
8029     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8030
8031     /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
8032     r = add_complocator_entry(hdb, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
8033     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8034
8035     /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
8036     r = add_complocator_entry(hdb, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
8037     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8038
8039     /* published component, machine, file, no signature, misdbLocatorTypeFile */
8040     r = add_complocator_entry(hdb, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
8041     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8042
8043     /* unpublished component, no signature, misdbLocatorTypeDir */
8044     r = add_complocator_entry(hdb, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
8045     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8046
8047     /* published component, no signature, dir does not exist misdbLocatorTypeDir */
8048     r = add_complocator_entry(hdb, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
8049     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8050
8051     /* published component, signature w/ ver, misdbLocatorTypeFile */
8052     r = add_complocator_entry(hdb, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
8053     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8054
8055     /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
8056     r = add_complocator_entry(hdb, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
8057     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8058
8059     /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
8060     r = add_complocator_entry(hdb, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
8061     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8062
8063     r = create_signature_table(hdb);
8064     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8065
8066     r = add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
8067     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8068
8069     r = add_signature_entry(hdb, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
8070     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8071
8072     r = add_signature_entry(hdb, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
8073     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8074
8075     r = add_signature_entry(hdb, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
8076     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8077
8078     r = add_signature_entry(hdb, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
8079     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8080
8081     r = add_signature_entry(hdb, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8082     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8083
8084     r = add_signature_entry(hdb, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8085     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8086
8087     r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8088     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8089
8090     r = package_from_db(hdb, &hpkg);
8091     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
8092     {
8093         skip("Not enough rights to perform tests\n");
8094         goto error;
8095     }
8096     ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
8097
8098     r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
8099     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8100
8101     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
8102
8103     r = MsiDoAction(hpkg, "AppSearch");
8104     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8105
8106     size = MAX_PATH;
8107     sprintf(path, "%s\\FileName1", CURR_DIR);
8108     r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8109     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8110     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8111
8112     size = MAX_PATH;
8113     sprintf(path, "%s\\FileName2", CURR_DIR);
8114     r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8115     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8116     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8117
8118     size = MAX_PATH;
8119     sprintf(path, "%s\\FileName3", CURR_DIR);
8120     r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8121     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8122     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8123
8124     size = MAX_PATH;
8125     sprintf(path, "%s\\FileName4", CURR_DIR);
8126     r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
8127     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8128     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8129
8130     size = MAX_PATH;
8131     sprintf(path, "%s\\FileName5", CURR_DIR);
8132     r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8133     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8134     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8135
8136     size = MAX_PATH;
8137     sprintf(path, "%s\\", CURR_DIR);
8138     r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8139     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8140     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8141
8142     size = MAX_PATH;
8143     sprintf(path, "%s\\", CURR_DIR);
8144     r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8145     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8146     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8147
8148     size = MAX_PATH;
8149     r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8150     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8151     ok(!lstrcmpA(prop, "october"), "Expected \"october\", got \"%s\"\n", prop);
8152
8153     size = MAX_PATH;
8154     r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8155     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8156     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8157
8158     size = MAX_PATH;
8159     sprintf(path, "%s\\FileName8.dll", CURR_DIR);
8160     r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8161     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8162     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8163
8164     size = MAX_PATH;
8165     r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8166     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8167     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8168
8169     size = MAX_PATH;
8170     sprintf(path, "%s\\FileName10.dll", CURR_DIR);
8171     r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8172     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8173     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8174
8175     delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
8176                           MSIINSTALLCONTEXT_MACHINE, NULL);
8177     delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
8178                           MSIINSTALLCONTEXT_USERUNMANAGED, usersid);
8179     delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
8180                           MSIINSTALLCONTEXT_USERMANAGED, usersid);
8181     delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
8182                           MSIINSTALLCONTEXT_MACHINE, NULL);
8183     delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
8184                           MSIINSTALLCONTEXT_MACHINE, NULL);
8185     delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
8186                           MSIINSTALLCONTEXT_MACHINE, NULL);
8187     delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
8188                           MSIINSTALLCONTEXT_MACHINE, NULL);
8189     delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
8190                           MSIINSTALLCONTEXT_MACHINE, NULL);
8191     delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
8192                           MSIINSTALLCONTEXT_MACHINE, NULL);
8193     delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
8194                           MSIINSTALLCONTEXT_MACHINE, NULL);
8195
8196     MsiCloseHandle(hpkg);
8197
8198 error:
8199     DeleteFileA("FileName1");
8200     DeleteFileA("FileName2");
8201     DeleteFileA("FileName3");
8202     DeleteFileA("FileName4");
8203     DeleteFileA("FileName5");
8204     DeleteFileA("FileName6");
8205     DeleteFileA("FileName7");
8206     DeleteFileA("FileName8.dll");
8207     DeleteFileA("FileName9.dll");
8208     DeleteFileA("FileName10.dll");
8209     DeleteFileA(msifile);
8210     LocalFree(usersid);
8211 }
8212
8213 static void test_appsearch_reglocator(void)
8214 {
8215     MSIHANDLE hpkg, hdb;
8216     CHAR path[MAX_PATH], prop[MAX_PATH];
8217     DWORD binary[2], size, val;
8218     BOOL space, version, is_64bit = sizeof(void *) > sizeof(int);
8219     HKEY hklm, classes, hkcu, users;
8220     LPSTR pathdata, pathvar, ptr;
8221     LPCSTR str;
8222     LONG res;
8223     UINT r, type = 0;
8224
8225     version = TRUE;
8226     if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
8227         version = FALSE;
8228
8229     DeleteFileA("test.dll");
8230
8231     res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
8232     if (res == ERROR_ACCESS_DENIED)
8233     {
8234         skip("Not enough rights to perform tests\n");
8235         return;
8236     }
8237     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8238
8239     res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
8240                          (const BYTE *)"regszdata", 10);
8241     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8242
8243     res = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine", &hkcu);
8244     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8245
8246     res = RegSetValueExA(hkcu, "Value1", 0, REG_SZ,
8247                          (const BYTE *)"regszdata", 10);
8248     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8249
8250     users = 0;
8251     res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
8252     ok(res == ERROR_SUCCESS ||
8253        broken(res == ERROR_INVALID_PARAMETER),
8254        "Expected ERROR_SUCCESS, got %d\n", res);
8255
8256     if (res == ERROR_SUCCESS)
8257     {
8258         res = RegSetValueExA(users, "Value1", 0, REG_SZ,
8259                              (const BYTE *)"regszdata", 10);
8260         ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8261     }
8262
8263     res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine", &hklm);
8264     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8265
8266     res = RegSetValueA(hklm, NULL, REG_SZ, "defvalue", 8);
8267     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8268
8269     res = RegSetValueExA(hklm, "Value1", 0, REG_SZ,
8270                          (const BYTE *)"regszdata", 10);
8271     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8272
8273     val = 42;
8274     res = RegSetValueExA(hklm, "Value2", 0, REG_DWORD,
8275                          (const BYTE *)&val, sizeof(DWORD));
8276     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8277
8278     val = -42;
8279     res = RegSetValueExA(hklm, "Value3", 0, REG_DWORD,
8280                          (const BYTE *)&val, sizeof(DWORD));
8281     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8282
8283     res = RegSetValueExA(hklm, "Value4", 0, REG_EXPAND_SZ,
8284                          (const BYTE *)"%PATH%", 7);
8285     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8286
8287     res = RegSetValueExA(hklm, "Value5", 0, REG_EXPAND_SZ,
8288                          (const BYTE *)"my%NOVAR%", 10);
8289     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8290
8291     res = RegSetValueExA(hklm, "Value6", 0, REG_MULTI_SZ,
8292                          (const BYTE *)"one\0two\0", 9);
8293     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8294
8295     binary[0] = 0x1234abcd;
8296     binary[1] = 0x567890ef;
8297     res = RegSetValueExA(hklm, "Value7", 0, REG_BINARY,
8298                          (const BYTE *)binary, sizeof(binary));
8299     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8300
8301     res = RegSetValueExA(hklm, "Value8", 0, REG_SZ,
8302                          (const BYTE *)"#regszdata", 11);
8303     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8304
8305     create_test_file("FileName1");
8306     sprintf(path, "%s\\FileName1", CURR_DIR);
8307     res = RegSetValueExA(hklm, "Value9", 0, REG_SZ,
8308                          (const BYTE *)path, lstrlenA(path) + 1);
8309     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8310
8311     sprintf(path, "%s\\FileName2", CURR_DIR);
8312     res = RegSetValueExA(hklm, "Value10", 0, REG_SZ,
8313                          (const BYTE *)path, lstrlenA(path) + 1);
8314     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8315
8316     lstrcpyA(path, CURR_DIR);
8317     res = RegSetValueExA(hklm, "Value11", 0, REG_SZ,
8318                          (const BYTE *)path, lstrlenA(path) + 1);
8319     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8320
8321     res = RegSetValueExA(hklm, "Value12", 0, REG_SZ,
8322                          (const BYTE *)"", 1);
8323     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8324
8325     create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8326     sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8327     res = RegSetValueExA(hklm, "Value13", 0, REG_SZ,
8328                          (const BYTE *)path, lstrlenA(path) + 1);
8329     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8330
8331     create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8332     sprintf(path, "%s\\FileName4.dll", CURR_DIR);
8333     res = RegSetValueExA(hklm, "Value14", 0, REG_SZ,
8334                          (const BYTE *)path, lstrlenA(path) + 1);
8335     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8336
8337     create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8338     sprintf(path, "%s\\FileName5.dll", CURR_DIR);
8339     res = RegSetValueExA(hklm, "Value15", 0, REG_SZ,
8340                          (const BYTE *)path, lstrlenA(path) + 1);
8341     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8342
8343     sprintf(path, "\"%s\\FileName1\" -option", CURR_DIR);
8344     res = RegSetValueExA(hklm, "value16", 0, REG_SZ,
8345                          (const BYTE *)path, lstrlenA(path) + 1);
8346
8347     space = (strchr(CURR_DIR, ' ')) ? TRUE : FALSE;
8348     sprintf(path, "%s\\FileName1 -option", CURR_DIR);
8349     res = RegSetValueExA(hklm, "value17", 0, REG_SZ,
8350                          (const BYTE *)path, lstrlenA(path) + 1);
8351
8352     hdb = create_package_db();
8353     ok(hdb, "Expected a valid database handle\n");
8354
8355     r = create_appsearch_table(hdb);
8356     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8357
8358     r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8359     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8360
8361     r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8362     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8363
8364     r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8365     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8366
8367     r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8368     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8369
8370     r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8371     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8372
8373     r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8374     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8375
8376     r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8377     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8378
8379     r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8380     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8381
8382     r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8383     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8384
8385     r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8386     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8387
8388     r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8389     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8390
8391     r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
8392     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8393
8394     r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
8395     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8396
8397     r = add_appsearch_entry(hdb, "'SIGPROP14', 'NewSignature14'");
8398     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8399
8400     r = add_appsearch_entry(hdb, "'SIGPROP15', 'NewSignature15'");
8401     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8402
8403     r = add_appsearch_entry(hdb, "'SIGPROP16', 'NewSignature16'");
8404     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8405
8406     r = add_appsearch_entry(hdb, "'SIGPROP17', 'NewSignature17'");
8407     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8408
8409     r = add_appsearch_entry(hdb, "'SIGPROP18', 'NewSignature18'");
8410     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8411
8412     r = add_appsearch_entry(hdb, "'SIGPROP19', 'NewSignature19'");
8413     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8414
8415     r = add_appsearch_entry(hdb, "'SIGPROP20', 'NewSignature20'");
8416     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8417
8418     r = add_appsearch_entry(hdb, "'SIGPROP21', 'NewSignature21'");
8419     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8420
8421     r = add_appsearch_entry(hdb, "'SIGPROP22', 'NewSignature22'");
8422     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8423
8424     r = add_appsearch_entry(hdb, "'SIGPROP23', 'NewSignature23'");
8425     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8426
8427     r = add_appsearch_entry(hdb, "'SIGPROP24', 'NewSignature24'");
8428     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8429
8430     r = add_appsearch_entry(hdb, "'SIGPROP25', 'NewSignature25'");
8431     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8432
8433     r = add_appsearch_entry(hdb, "'SIGPROP26', 'NewSignature26'");
8434     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8435
8436     r = add_appsearch_entry(hdb, "'SIGPROP27', 'NewSignature27'");
8437     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8438
8439     r = add_appsearch_entry(hdb, "'SIGPROP28', 'NewSignature28'");
8440     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8441
8442     r = add_appsearch_entry(hdb, "'SIGPROP29', 'NewSignature29'");
8443     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8444
8445     r = add_appsearch_entry(hdb, "'SIGPROP30', 'NewSignature30'");
8446     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8447
8448     r = create_reglocator_table(hdb);
8449     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8450
8451     type = msidbLocatorTypeRawValue;
8452     if (is_64bit)
8453         type |= msidbLocatorType64bit;
8454
8455     /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
8456     r = add_reglocator_entry(hdb, "NewSignature1", 2, "Software\\Wine", "Value1", type);
8457     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8458
8459     /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
8460     r = add_reglocator_entry(hdb, "NewSignature2", 2, "Software\\Wine", "Value2", type);
8461     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8462
8463     /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
8464     r = add_reglocator_entry(hdb, "NewSignature3", 2, "Software\\Wine", "Value3", type);
8465     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8466
8467     /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
8468     r = add_reglocator_entry(hdb, "NewSignature4", 2, "Software\\Wine", "Value4", type);
8469     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8470
8471     /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
8472     r = add_reglocator_entry(hdb, "NewSignature5", 2, "Software\\Wine", "Value5", type);
8473     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8474
8475     /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
8476     r = add_reglocator_entry(hdb, "NewSignature6", 2, "Software\\Wine", "Value6", type);
8477     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8478
8479     /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
8480     r = add_reglocator_entry(hdb, "NewSignature7", 2, "Software\\Wine", "Value7", type);
8481     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8482
8483     /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
8484     r = add_reglocator_entry(hdb, "NewSignature8", 2, "Software\\Wine", "Value8", type);
8485     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8486
8487     type = msidbLocatorTypeFileName;
8488     if (is_64bit)
8489         type |= msidbLocatorType64bit;
8490
8491     /* HKLM, msidbLocatorTypeFileName, signature, file exists */
8492     r = add_reglocator_entry(hdb, "NewSignature9", 2, "Software\\Wine", "Value9", type);
8493     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8494
8495     /* HKLM, msidbLocatorTypeFileName, signature, file does not exist */
8496     r = add_reglocator_entry(hdb, "NewSignature10", 2, "Software\\Wine", "Value10", type);
8497     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8498
8499     /* HKLM, msidbLocatorTypeFileName, no signature */
8500     r = add_reglocator_entry(hdb, "NewSignature11", 2, "Software\\Wine", "Value9", type);
8501     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8502
8503     type = msidbLocatorTypeDirectory;
8504     if (is_64bit)
8505         type |= msidbLocatorType64bit;
8506
8507     /* HKLM, msidbLocatorTypeDirectory, no signature, file exists */
8508     r = add_reglocator_entry(hdb, "NewSignature12", 2, "Software\\Wine", "Value9", type);
8509     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8510
8511     /* HKLM, msidbLocatorTypeDirectory, no signature, directory exists */
8512     r = add_reglocator_entry(hdb, "NewSignature13", 2, "Software\\Wine", "Value11", type);
8513     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8514
8515     /* HKLM, msidbLocatorTypeDirectory, signature, file exists */
8516     r = add_reglocator_entry(hdb, "NewSignature14", 2, "Software\\Wine", "Value9", type);
8517     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8518
8519     type = msidbLocatorTypeRawValue;
8520     if (is_64bit)
8521         type |= msidbLocatorType64bit;
8522
8523     /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
8524     r = add_reglocator_entry(hdb, "NewSignature15", 0, "Software\\Wine", "Value1", type);
8525     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8526
8527     /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
8528     r = add_reglocator_entry(hdb, "NewSignature16", 1, "Software\\Wine", "Value1", type);
8529     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8530
8531     /* HKU, msidbLocatorTypeRawValue, REG_SZ */
8532     r = add_reglocator_entry(hdb, "NewSignature17", 3, "S-1-5-18\\Software\\Wine", "Value1", type);
8533     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8534
8535     /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
8536     r = add_reglocator_entry(hdb, "NewSignature18", 2, "Software\\Wine", "", type);
8537     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8538
8539     /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
8540     r = add_reglocator_entry(hdb, "NewSignature19", 2, "Software\\IDontExist", "", type);
8541     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8542
8543     /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
8544     r = add_reglocator_entry(hdb, "NewSignature20", 2, "Software\\Wine", "Value12", type);
8545     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8546
8547     type = msidbLocatorTypeFileName;
8548     if (is_64bit)
8549         type |= msidbLocatorType64bit;
8550
8551     /* HKLM, msidbLocatorTypeFileName, signature, file exists w/ version */
8552     r = add_reglocator_entry(hdb, "NewSignature21", 2, "Software\\Wine", "Value13", type);
8553     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8554
8555     /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
8556     r = add_reglocator_entry(hdb, "NewSignature22", 2, "Software\\Wine", "Value14", type);
8557     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8558
8559     /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
8560     r = add_reglocator_entry(hdb, "NewSignature23", 2, "Software\\Wine", "Value15", type);
8561     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8562
8563     /* HKLM, msidbLocatorTypeFileName, no signature, directory exists */
8564     r = add_reglocator_entry(hdb, "NewSignature24", 2, "Software\\Wine", "Value11", type);
8565     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8566
8567     /* HKLM, msidbLocatorTypeFileName, no signature, file does not exist */
8568     r = add_reglocator_entry(hdb, "NewSignature25", 2, "Software\\Wine", "Value10", type);
8569     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8570
8571     type = msidbLocatorTypeDirectory;
8572     if (is_64bit)
8573         type |= msidbLocatorType64bit;
8574
8575     /* HKLM, msidbLocatorTypeDirectory, signature, directory exists */
8576     r = add_reglocator_entry(hdb, "NewSignature26", 2, "Software\\Wine", "Value11", type);
8577     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8578
8579     /* HKLM, msidbLocatorTypeDirectory, signature, file does not exist */
8580     r = add_reglocator_entry(hdb, "NewSignature27", 2, "Software\\Wine", "Value10", type);
8581     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8582
8583     /* HKLM, msidbLocatorTypeDirectory, no signature, file does not exist */
8584     r = add_reglocator_entry(hdb, "NewSignature28", 2, "Software\\Wine", "Value10", type);
8585     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8586
8587     type = msidbLocatorTypeFileName;
8588     if (is_64bit)
8589         type |= msidbLocatorType64bit;
8590
8591     /* HKLM, msidbLocatorTypeFile, file exists, in quotes */
8592     r = add_reglocator_entry(hdb, "NewSignature29", 2, "Software\\Wine", "Value16", type);
8593     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8594
8595     /* HKLM, msidbLocatorTypeFile, file exists, no quotes */
8596     r = add_reglocator_entry(hdb, "NewSignature30", 2, "Software\\Wine", "Value17", type);
8597     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8598
8599     r = create_signature_table(hdb);
8600     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8601
8602     str = "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
8603     r = add_signature_entry(hdb, str);
8604     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8605
8606     str = "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
8607     r = add_signature_entry(hdb, str);
8608     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8609
8610     str = "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
8611     r = add_signature_entry(hdb, str);
8612     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8613
8614     str = "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8615     r = add_signature_entry(hdb, str);
8616     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8617
8618     str = "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8619     r = add_signature_entry(hdb, str);
8620     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8621
8622     str = "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8623     r = add_signature_entry(hdb, str);
8624     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8625
8626     ptr = strrchr(CURR_DIR, '\\') + 1;
8627     sprintf(path, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr);
8628     r = add_signature_entry(hdb, path);
8629     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8630
8631     str = "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''";
8632     r = add_signature_entry(hdb, str);
8633     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8634
8635     str = "'NewSignature29', 'FileName1', '', '', '', '', '', '', ''";
8636     r = add_signature_entry(hdb, str);
8637     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8638
8639     str = "'NewSignature30', 'FileName1', '', '', '', '', '', '', ''";
8640     r = add_signature_entry(hdb, str);
8641     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8642
8643     r = package_from_db(hdb, &hpkg);
8644     ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
8645
8646     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
8647
8648     r = MsiDoAction(hpkg, "AppSearch");
8649     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8650
8651     size = MAX_PATH;
8652     r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8653     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8654     ok(!lstrcmpA(prop, "regszdata"),
8655        "Expected \"regszdata\", got \"%s\"\n", prop);
8656
8657     size = MAX_PATH;
8658     r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8659     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8660     ok(!lstrcmpA(prop, "#42"), "Expected \"#42\", got \"%s\"\n", prop);
8661
8662     size = MAX_PATH;
8663     r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8664     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8665     ok(!lstrcmpA(prop, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop);
8666
8667     size = ExpandEnvironmentStringsA("%PATH%", NULL, 0);
8668     if (size == 0 && GetLastError() == ERROR_INVALID_PARAMETER)
8669     {
8670         /* Workaround for Win95 */
8671         CHAR tempbuf[1];
8672         size = ExpandEnvironmentStringsA("%PATH%", tempbuf, 0);
8673     }
8674     pathvar = HeapAlloc(GetProcessHeap(), 0, size);
8675     ExpandEnvironmentStringsA("%PATH%", pathvar, size);
8676
8677     size = 0;
8678     r = MsiGetPropertyA(hpkg, "SIGPROP4", NULL, &size);
8679     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8680
8681     pathdata = HeapAlloc(GetProcessHeap(), 0, ++size);
8682     r = MsiGetPropertyA(hpkg, "SIGPROP4", pathdata, &size);
8683     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8684     ok(!lstrcmpA(pathdata, pathvar),
8685        "Expected \"%s\", got \"%s\"\n", pathvar, pathdata);
8686
8687     HeapFree(GetProcessHeap(), 0, pathvar);
8688     HeapFree(GetProcessHeap(), 0, pathdata);
8689
8690     size = MAX_PATH;
8691     r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8692     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8693     ok(!lstrcmpA(prop,
8694        "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop);
8695
8696     size = MAX_PATH;
8697     r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8698     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8699     todo_wine
8700     {
8701         ok(!memcmp(prop, "\0one\0two\0\0", 10),
8702            "Expected \"\\0one\\0two\\0\\0\"\n");
8703     }
8704
8705     size = MAX_PATH;
8706     lstrcpyA(path, "#xCDAB3412EF907856");
8707     r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8708     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8709     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8710
8711     size = MAX_PATH;
8712     r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8713     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8714     ok(!lstrcmpA(prop, "##regszdata"),
8715        "Expected \"##regszdata\", got \"%s\"\n", prop);
8716
8717     size = MAX_PATH;
8718     sprintf(path, "%s\\FileName1", CURR_DIR);
8719     r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8720     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8721     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8722
8723     size = MAX_PATH;
8724     r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8725     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8726     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8727
8728     size = MAX_PATH;
8729     sprintf(path, "%s\\", CURR_DIR);
8730     r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8731     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8732     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8733
8734     size = MAX_PATH;
8735     r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8736     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8737     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8738
8739     size = MAX_PATH;
8740     sprintf(path, "%s\\", CURR_DIR);
8741     r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
8742     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8743     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8744
8745     size = MAX_PATH;
8746     r = MsiGetPropertyA(hpkg, "SIGPROP14", prop, &size);
8747     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8748     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8749
8750     size = MAX_PATH;
8751     r = MsiGetPropertyA(hpkg, "SIGPROP15", prop, &size);
8752     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8753     ok(!lstrcmpA(prop, "regszdata"),
8754        "Expected \"regszdata\", got \"%s\"\n", prop);
8755
8756     size = MAX_PATH;
8757     r = MsiGetPropertyA(hpkg, "SIGPROP16", prop, &size);
8758     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8759     ok(!lstrcmpA(prop, "regszdata"),
8760        "Expected \"regszdata\", got \"%s\"\n", prop);
8761
8762     if (users)
8763     {
8764         size = MAX_PATH;
8765         r = MsiGetPropertyA(hpkg, "SIGPROP17", prop, &size);
8766         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8767         ok(!lstrcmpA(prop, "regszdata"),
8768            "Expected \"regszdata\", got \"%s\"\n", prop);
8769     }
8770
8771     size = MAX_PATH;
8772     r = MsiGetPropertyA(hpkg, "SIGPROP18", prop, &size);
8773     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8774     ok(!lstrcmpA(prop, "defvalue"),
8775        "Expected \"defvalue\", got \"%s\"\n", prop);
8776
8777     size = MAX_PATH;
8778     r = MsiGetPropertyA(hpkg, "SIGPROP19", prop, &size);
8779     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8780     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8781
8782     size = MAX_PATH;
8783     r = MsiGetPropertyA(hpkg, "SIGPROP20", prop, &size);
8784     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8785     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8786
8787     if (version)
8788     {
8789         size = MAX_PATH;
8790         sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8791         r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size);
8792         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8793         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8794
8795         size = MAX_PATH;
8796         r = MsiGetPropertyA(hpkg, "SIGPROP22", prop, &size);
8797         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8798         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8799
8800         size = MAX_PATH;
8801         sprintf(path, "%s\\FileName5.dll", CURR_DIR);
8802         r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size);
8803         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8804         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8805     }
8806
8807     size = MAX_PATH;
8808     lstrcpyA(path, CURR_DIR);
8809     ptr = strrchr(path, '\\') + 1;
8810     *ptr = '\0';
8811     r = MsiGetPropertyA(hpkg, "SIGPROP24", prop, &size);
8812     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8813     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8814
8815     size = MAX_PATH;
8816     sprintf(path, "%s\\", CURR_DIR);
8817     r = MsiGetPropertyA(hpkg, "SIGPROP25", prop, &size);
8818     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8819     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8820
8821     size = MAX_PATH;
8822     r = MsiGetPropertyA(hpkg, "SIGPROP26", prop, &size);
8823     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8824     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8825
8826     size = MAX_PATH;
8827     r = MsiGetPropertyA(hpkg, "SIGPROP27", prop, &size);
8828     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8829     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8830
8831     size = MAX_PATH;
8832     r = MsiGetPropertyA(hpkg, "SIGPROP28", prop, &size);
8833     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8834     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8835
8836     size = MAX_PATH;
8837     sprintf(path, "%s\\FileName1", CURR_DIR);
8838     r = MsiGetPropertyA(hpkg, "SIGPROP29", prop, &size);
8839     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8840     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8841
8842     size = MAX_PATH;
8843     sprintf(path, "%s\\FileName1", CURR_DIR);
8844     r = MsiGetPropertyA(hpkg, "SIGPROP30", prop, &size);
8845     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8846     if (space)
8847         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8848     else
8849         todo_wine ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8850
8851     RegSetValueA(hklm, NULL, REG_SZ, "", 0);
8852     RegDeleteValueA(hklm, "Value1");
8853     RegDeleteValueA(hklm, "Value2");
8854     RegDeleteValueA(hklm, "Value3");
8855     RegDeleteValueA(hklm, "Value4");
8856     RegDeleteValueA(hklm, "Value5");
8857     RegDeleteValueA(hklm, "Value6");
8858     RegDeleteValueA(hklm, "Value7");
8859     RegDeleteValueA(hklm, "Value8");
8860     RegDeleteValueA(hklm, "Value9");
8861     RegDeleteValueA(hklm, "Value10");
8862     RegDeleteValueA(hklm, "Value11");
8863     RegDeleteValueA(hklm, "Value12");
8864     RegDeleteValueA(hklm, "Value13");
8865     RegDeleteValueA(hklm, "Value14");
8866     RegDeleteValueA(hklm, "Value15");
8867     RegDeleteValueA(hklm, "Value16");
8868     RegDeleteValueA(hklm, "Value17");
8869     RegDeleteKey(hklm, "");
8870     RegCloseKey(hklm);
8871
8872     RegDeleteValueA(classes, "Value1");
8873     RegDeleteKeyA(classes, "");
8874     RegCloseKey(classes);
8875
8876     RegDeleteValueA(hkcu, "Value1");
8877     RegDeleteKeyA(hkcu, "");
8878     RegCloseKey(hkcu);
8879
8880     RegDeleteValueA(users, "Value1");
8881     RegDeleteKeyA(users, "");
8882     RegCloseKey(users);
8883
8884     DeleteFileA("FileName1");
8885     DeleteFileA("FileName3.dll");
8886     DeleteFileA("FileName4.dll");
8887     DeleteFileA("FileName5.dll");
8888     MsiCloseHandle(hpkg);
8889     DeleteFileA(msifile);
8890 }
8891
8892 static void delete_win_ini(LPCSTR file)
8893 {
8894     CHAR path[MAX_PATH];
8895
8896     GetWindowsDirectoryA(path, MAX_PATH);
8897     lstrcatA(path, "\\");
8898     lstrcatA(path, file);
8899
8900     DeleteFileA(path);
8901 }
8902
8903 static void test_appsearch_inilocator(void)
8904 {
8905     MSIHANDLE hpkg, hdb;
8906     CHAR path[MAX_PATH];
8907     CHAR prop[MAX_PATH];
8908     BOOL version;
8909     LPCSTR str;
8910     LPSTR ptr;
8911     DWORD size;
8912     UINT r;
8913
8914     version = TRUE;
8915     if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
8916         version = FALSE;
8917
8918     DeleteFileA("test.dll");
8919
8920     WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
8921
8922     create_test_file("FileName1");
8923     sprintf(path, "%s\\FileName1", CURR_DIR);
8924     WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
8925
8926     WritePrivateProfileStringA("Section", "Key3", CURR_DIR, "IniFile.ini");
8927
8928     sprintf(path, "%s\\IDontExist", CURR_DIR);
8929     WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
8930
8931     create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8932     sprintf(path, "%s\\FileName2.dll", CURR_DIR);
8933     WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
8934
8935     create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8936     sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8937     WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
8938
8939     create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8940     sprintf(path, "%s\\FileName4.dll", CURR_DIR);
8941     WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
8942
8943     hdb = create_package_db();
8944     ok(hdb, "Expected a valid database handle\n");
8945
8946     r = create_appsearch_table(hdb);
8947     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8948
8949     r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8950     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8951
8952     r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8953     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8954
8955     r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8956     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8957
8958     r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8959     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8960
8961     r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8962     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8963
8964     r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8965     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8966
8967     r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8968     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8969
8970     r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8971     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8972
8973     r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8974     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8975
8976     r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8977     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8978
8979     r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8980     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8981
8982     r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
8983     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8984
8985     r = create_inilocator_table(hdb);
8986     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8987
8988     /* msidbLocatorTypeRawValue, field 1 */
8989     str = "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
8990     r = add_inilocator_entry(hdb, str);
8991     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8992
8993     /* msidbLocatorTypeRawValue, field 2 */
8994     str = "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
8995     r = add_inilocator_entry(hdb, str);
8996     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8997
8998     /* msidbLocatorTypeRawValue, entire field */
8999     str = "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
9000     r = add_inilocator_entry(hdb, str);
9001     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9002
9003     /* msidbLocatorTypeFile */
9004     str = "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
9005     r = add_inilocator_entry(hdb, str);
9006     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9007
9008     /* msidbLocatorTypeDirectory, file */
9009     str = "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
9010     r = add_inilocator_entry(hdb, str);
9011     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9012
9013     /* msidbLocatorTypeDirectory, directory */
9014     str = "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
9015     r = add_inilocator_entry(hdb, str);
9016     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9017
9018     /* msidbLocatorTypeFile, file, no signature */
9019     str = "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
9020     r = add_inilocator_entry(hdb, str);
9021     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9022
9023     /* msidbLocatorTypeFile, dir, no signature */
9024     str = "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
9025     r = add_inilocator_entry(hdb, str);
9026     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9027
9028     /* msidbLocatorTypeFile, file does not exist */
9029     str = "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
9030     r = add_inilocator_entry(hdb, str);
9031     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9032
9033     /* msidbLocatorTypeFile, signature with version */
9034     str = "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1";
9035     r = add_inilocator_entry(hdb, str);
9036     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9037
9038     /* msidbLocatorTypeFile, signature with version, ver > max */
9039     str = "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1";
9040     r = add_inilocator_entry(hdb, str);
9041     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9042
9043     /* msidbLocatorTypeFile, signature with version, sig->name ignored */
9044     str = "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1";
9045     r = add_inilocator_entry(hdb, str);
9046     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9047
9048     r = create_signature_table(hdb);
9049     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9050
9051     r = add_signature_entry(hdb, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
9052     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9053
9054     r = add_signature_entry(hdb, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
9055     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9056
9057     r = add_signature_entry(hdb, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
9058     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9059
9060     r = add_signature_entry(hdb, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
9061     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9062
9063     r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
9064     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9065
9066     r = package_from_db(hdb, &hpkg);
9067     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9068     {
9069         skip("Not enough rights to perform tests\n");
9070         goto error;
9071     }
9072     ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
9073
9074     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9075
9076     r = MsiDoAction(hpkg, "AppSearch");
9077     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9078
9079     size = MAX_PATH;
9080     r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
9081     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9082     ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop);
9083
9084     size = MAX_PATH;
9085     r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
9086     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9087     ok(!lstrcmpA(prop, "field2"), "Expected \"field2\", got \"%s\"\n", prop);
9088
9089     size = MAX_PATH;
9090     r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
9091     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9092     ok(!lstrcmpA(prop, "keydata,field2"),
9093        "Expected \"keydata,field2\", got \"%s\"\n", prop);
9094
9095     size = MAX_PATH;
9096     sprintf(path, "%s\\FileName1", CURR_DIR);
9097     r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
9098     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9099     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9100
9101     size = MAX_PATH;
9102     r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
9103     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9104     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9105
9106     size = MAX_PATH;
9107     sprintf(path, "%s\\", CURR_DIR);
9108     r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
9109     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9110     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9111
9112     size = MAX_PATH;
9113     sprintf(path, "%s\\", CURR_DIR);
9114     r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
9115     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9116     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9117
9118     size = MAX_PATH;
9119     lstrcpyA(path, CURR_DIR);
9120     ptr = strrchr(path, '\\');
9121     *(ptr + 1) = '\0';
9122     r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
9123     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9124     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9125
9126     size = MAX_PATH;
9127     r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
9128     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9129     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9130
9131     if (version)
9132     {
9133         size = MAX_PATH;
9134         sprintf(path, "%s\\FileName2.dll", CURR_DIR);
9135         r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
9136         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9137         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9138
9139         size = MAX_PATH;
9140         r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
9141         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9142         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9143
9144         size = MAX_PATH;
9145         sprintf(path, "%s\\FileName4.dll", CURR_DIR);
9146         r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
9147         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9148         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9149     }
9150
9151     MsiCloseHandle(hpkg);
9152
9153 error:
9154     delete_win_ini("IniFile.ini");
9155     DeleteFileA("FileName1");
9156     DeleteFileA("FileName2.dll");
9157     DeleteFileA("FileName3.dll");
9158     DeleteFileA("FileName4.dll");
9159     DeleteFileA(msifile);
9160 }
9161
9162 /*
9163  * MSI AppSearch action on DrLocator table always returns absolute paths.
9164  * If a relative path was set, it returns the first absolute path that
9165  * matches or an empty string if it didn't find anything.
9166  * This helper function replicates this behaviour.
9167  */
9168 static void search_absolute_directory(LPSTR absolute, LPCSTR relative)
9169 {
9170     int i, size;
9171     DWORD attr, drives;
9172
9173     size = lstrlenA(relative);
9174     drives = GetLogicalDrives();
9175     lstrcpyA(absolute, "A:\\");
9176     for (i = 0; i < 26; absolute[0] = '\0', i++)
9177     {
9178         if (!(drives & (1 << i)))
9179             continue;
9180
9181         absolute[0] = 'A' + i;
9182         if (GetDriveType(absolute) != DRIVE_FIXED)
9183             continue;
9184
9185         lstrcpynA(absolute + 3, relative, size + 1);
9186         attr = GetFileAttributesA(absolute);
9187         if (attr != INVALID_FILE_ATTRIBUTES &&
9188             (attr & FILE_ATTRIBUTE_DIRECTORY))
9189         {
9190             if (absolute[3 + size - 1] != '\\')
9191                 lstrcatA(absolute, "\\");
9192             break;
9193         }
9194         absolute[3] = '\0';
9195     }
9196 }
9197
9198 static void test_appsearch_drlocator(void)
9199 {
9200     MSIHANDLE hpkg, hdb;
9201     CHAR path[MAX_PATH];
9202     CHAR prop[MAX_PATH];
9203     BOOL version;
9204     LPCSTR str;
9205     DWORD size;
9206     UINT r;
9207
9208     version = TRUE;
9209     if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
9210         version = FALSE;
9211
9212     DeleteFileA("test.dll");
9213
9214     create_test_file("FileName1");
9215     CreateDirectoryA("one", NULL);
9216     CreateDirectoryA("one\\two", NULL);
9217     CreateDirectoryA("one\\two\\three", NULL);
9218     create_test_file("one\\two\\three\\FileName2");
9219     CreateDirectoryA("another", NULL);
9220     create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
9221     create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
9222     create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
9223
9224     hdb = create_package_db();
9225     ok(hdb, "Expected a valid database handle\n");
9226
9227     r = create_appsearch_table(hdb);
9228     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9229
9230     r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
9231     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9232
9233     r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
9234     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9235
9236     r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
9237     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9238
9239     r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
9240     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9241
9242     r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
9243     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9244
9245     r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
9246     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9247
9248     r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
9249     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9250
9251     r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
9252     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9253
9254     r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
9255     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9256
9257     r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
9258     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9259
9260     r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
9261     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9262
9263     r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
9264     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9265
9266     r = create_drlocator_table(hdb);
9267     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9268
9269     /* no parent, full path, depth 0, signature */
9270     sprintf(path, "'NewSignature1', '', '%s', 0", CURR_DIR);
9271     r = add_drlocator_entry(hdb, path);
9272     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9273
9274     /* no parent, full path, depth 0, no signature */
9275     sprintf(path, "'NewSignature2', '', '%s', 0", CURR_DIR);
9276     r = add_drlocator_entry(hdb, path);
9277     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9278
9279     /* no parent, relative path, depth 0, no signature */
9280     sprintf(path, "'NewSignature3', '', '%s', 0", CURR_DIR + 3);
9281     r = add_drlocator_entry(hdb, path);
9282     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9283
9284     /* no parent, full path, depth 2, signature */
9285     sprintf(path, "'NewSignature4', '', '%s', 2", CURR_DIR);
9286     r = add_drlocator_entry(hdb, path);
9287     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9288
9289     /* no parent, full path, depth 3, signature */
9290     sprintf(path, "'NewSignature5', '', '%s', 3", CURR_DIR);
9291     r = add_drlocator_entry(hdb, path);
9292     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9293
9294     /* no parent, full path, depth 1, signature is dir */
9295     sprintf(path, "'NewSignature6', '', '%s', 1", CURR_DIR);
9296     r = add_drlocator_entry(hdb, path);
9297     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9298
9299     /* parent is in DrLocator, relative path, depth 0, signature */
9300     sprintf(path, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
9301     r = add_drlocator_entry(hdb, path);
9302     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9303
9304     /* no parent, full path, depth 0, signature w/ version */
9305     sprintf(path, "'NewSignature8', '', '%s', 0", CURR_DIR);
9306     r = add_drlocator_entry(hdb, path);
9307     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9308
9309     /* no parent, full path, depth 0, signature w/ version, ver > max */
9310     sprintf(path, "'NewSignature9', '', '%s', 0", CURR_DIR);
9311     r = add_drlocator_entry(hdb, path);
9312     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9313
9314     /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
9315     sprintf(path, "'NewSignature10', '', '%s', 0", CURR_DIR);
9316     r = add_drlocator_entry(hdb, path);
9317     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9318
9319     /* no parent, relative empty path, depth 0, no signature */
9320     sprintf(path, "'NewSignature11', '', '', 0");
9321     r = add_drlocator_entry(hdb, path);
9322     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9323
9324     r = create_reglocator_table(hdb);
9325     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9326
9327     /* parent */
9328     r = add_reglocator_entry(hdb, "NewSignature12", 2, "htmlfile\\shell\\open\\nonexistent", "", 1);
9329     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9330
9331     /* parent is in RegLocator, no path, depth 0, no signature */
9332     sprintf(path, "'NewSignature13', 'NewSignature12', '', 0");
9333     r = add_drlocator_entry(hdb, path);
9334     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9335
9336     r = create_signature_table(hdb);
9337     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9338
9339     str = "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
9340     r = add_signature_entry(hdb, str);
9341     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9342
9343     str = "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
9344     r = add_signature_entry(hdb, str);
9345     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9346
9347     str = "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
9348     r = add_signature_entry(hdb, str);
9349     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9350
9351     str = "'NewSignature6', 'another', '', '', '', '', '', '', ''";
9352     r = add_signature_entry(hdb, str);
9353     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9354
9355     str = "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
9356     r = add_signature_entry(hdb, str);
9357     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9358
9359     str = "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
9360     r = add_signature_entry(hdb, str);
9361     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9362
9363     str = "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
9364     r = add_signature_entry(hdb, str);
9365     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9366
9367     str = "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
9368     r = add_signature_entry(hdb, str);
9369     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9370
9371     r = package_from_db(hdb, &hpkg);
9372     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9373     {
9374         skip("Not enough rights to perform tests\n");
9375         goto error;
9376     }
9377     ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
9378
9379     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9380
9381     r = MsiDoAction(hpkg, "AppSearch");
9382     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9383
9384     size = MAX_PATH;
9385     sprintf(path, "%s\\FileName1", CURR_DIR);
9386     r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
9387     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9388     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9389
9390     size = MAX_PATH;
9391     sprintf(path, "%s\\", CURR_DIR);
9392     r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
9393     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9394     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9395
9396     size = MAX_PATH;
9397     search_absolute_directory(path, CURR_DIR + 3);
9398     r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
9399     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9400     ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9401
9402     size = MAX_PATH;
9403     r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
9404     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9405     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9406
9407     size = MAX_PATH;
9408     sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
9409     r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
9410     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9411     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9412
9413     size = MAX_PATH;
9414     r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
9415     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9416     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9417
9418     size = MAX_PATH;
9419     sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
9420     r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
9421     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9422     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9423
9424     if (version)
9425     {
9426         size = MAX_PATH;
9427         sprintf(path, "%s\\FileName3.dll", CURR_DIR);
9428         r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
9429         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9430         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9431
9432         size = MAX_PATH;
9433         r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
9434         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9435         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9436
9437         size = MAX_PATH;
9438         r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
9439         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9440         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9441     }
9442
9443     size = MAX_PATH;
9444     search_absolute_directory(path, "");
9445     r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
9446     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9447     ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9448
9449     size = MAX_PATH;
9450     strcpy(path, "c:\\");
9451     r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
9452     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9453     ok(!prop[0], "Expected \"\", got \"%s\"\n", prop);
9454
9455     MsiCloseHandle(hpkg);
9456
9457 error:
9458     DeleteFileA("FileName1");
9459     DeleteFileA("FileName3.dll");
9460     DeleteFileA("FileName4.dll");
9461     DeleteFileA("FileName5.dll");
9462     DeleteFileA("one\\two\\three\\FileName2");
9463     RemoveDirectoryA("one\\two\\three");
9464     RemoveDirectoryA("one\\two");
9465     RemoveDirectoryA("one");
9466     RemoveDirectoryA("another");
9467     DeleteFileA(msifile);
9468 }
9469
9470 static void test_featureparents(void)
9471 {
9472     MSIHANDLE hpkg;
9473     UINT r;
9474     MSIHANDLE hdb;
9475     INSTALLSTATE state, action;
9476
9477     hdb = create_package_db();
9478     ok ( hdb, "failed to create package database\n" );
9479
9480     r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
9481     ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
9482
9483     r = create_feature_table( hdb );
9484     ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
9485
9486     r = create_component_table( hdb );
9487     ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
9488
9489     r = create_feature_components_table( hdb );
9490     ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
9491
9492     r = create_file_table( hdb );
9493     ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
9494
9495     /* msidbFeatureAttributesFavorLocal */
9496     r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
9497     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9498
9499     /* msidbFeatureAttributesFavorSource */
9500     r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
9501     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9502
9503     /* msidbFeatureAttributesFavorLocal */
9504     r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
9505     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9506
9507     /* disabled because of install level */
9508     r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
9509     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9510
9511     /* child feature of disabled feature */
9512     r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
9513     ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9514
9515     /* component of disabled feature (install level) */
9516     r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
9517     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9518
9519     /* component of disabled child feature (install level) */
9520     r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
9521     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9522
9523     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
9524     r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
9525     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9526
9527     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
9528     r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
9529     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9530
9531     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
9532     r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
9533     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9534
9535     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
9536     r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
9537     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9538
9539     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
9540     r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
9541     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9542
9543     /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
9544     r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
9545     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9546
9547     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
9548     r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
9549     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9550
9551     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
9552     r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
9553     ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9554
9555     /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
9556     r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
9557
9558     r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
9559     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9560
9561     r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
9562     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9563
9564     r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
9565     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9566
9567     r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
9568     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9569
9570     r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
9571     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9572
9573     r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
9574     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9575
9576     r = add_feature_components_entry( hdb, "'orion', 'leo'" );
9577     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9578
9579     r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
9580     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9581
9582     r = add_feature_components_entry( hdb, "'orion', 'libra'" );
9583     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9584
9585     r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
9586     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9587
9588     r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
9589     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9590
9591     r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
9592     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9593
9594     r = add_feature_components_entry( hdb, "'orion', 'canis'" );
9595     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9596
9597     r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
9598     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9599
9600     r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
9601     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9602
9603     r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
9604     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9605
9606     r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
9607     ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9608
9609     r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
9610     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9611
9612     r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
9613     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9614
9615     r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
9616     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9617
9618     r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
9619     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9620
9621     r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
9622     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9623
9624     r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
9625     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9626
9627     r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
9628     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9629
9630     r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
9631     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9632
9633     r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
9634     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9635
9636     r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
9637     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9638
9639     r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
9640     ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9641
9642     r = package_from_db( hdb, &hpkg );
9643     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9644     {
9645         skip("Not enough rights to perform tests\n");
9646         DeleteFile(msifile);
9647         return;
9648     }
9649     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
9650
9651     MsiCloseHandle( hdb );
9652
9653     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9654
9655     r = MsiDoAction( hpkg, "CostInitialize");
9656     ok( r == ERROR_SUCCESS, "cost init failed\n");
9657
9658     r = MsiDoAction( hpkg, "FileCost");
9659     ok( r == ERROR_SUCCESS, "file cost failed\n");
9660
9661     r = MsiDoAction( hpkg, "CostFinalize");
9662     ok( r == ERROR_SUCCESS, "cost finalize failed\n");
9663
9664     state = 0xdeadbee;
9665     action = 0xdeadbee;
9666     r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
9667     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9668     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9669     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9670
9671     state = 0xdeadbee;
9672     action = 0xdeadbee;
9673     r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
9674     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9675     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9676     ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
9677
9678     state = 0xdeadbee;
9679     action = 0xdeadbee;
9680     r = MsiGetFeatureState(hpkg, "orion", &state, &action);
9681     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9682     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9683     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9684
9685     state = 0xdeadbee;
9686     action = 0xdeadbee;
9687     r = MsiGetFeatureState(hpkg, "waters", &state, &action);
9688     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9689     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9690     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
9691
9692     state = 0xdeadbee;
9693     action = 0xdeadbee;
9694     r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
9695     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9696     ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9697     ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
9698
9699     state = 0xdeadbee;
9700     action = 0xdeadbee;
9701     r = MsiGetComponentState(hpkg, "leo", &state, &action);
9702     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9703     ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
9704     ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9705
9706     state = 0xdeadbee;
9707     action = 0xdeadbee;
9708     r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9709     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9710     ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9711     ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9712
9713     state = 0xdeadbee;
9714     action = 0xdeadbee;
9715     r = MsiGetComponentState(hpkg, "libra", &state, &action);
9716     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9717     ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9718     ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9719
9720     state = 0xdeadbee;
9721     action = 0xdeadbee;
9722     r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9723     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9724     ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9725     ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9726
9727     state = 0xdeadbee;
9728     action = 0xdeadbee;
9729     r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9730     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9731     ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9732     ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9733
9734     state = 0xdeadbee;
9735     action = 0xdeadbee;
9736     r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9737     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9738     ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9739     ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
9740
9741     state = 0xdeadbee;
9742     action = 0xdeadbee;
9743     r = MsiGetComponentState(hpkg, "canis", &state, &action);
9744     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9745     ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9746     ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
9747
9748     state = 0xdeadbee;
9749     action = 0xdeadbee;
9750     r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9751     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9752     ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9753     ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
9754
9755     state = 0xdeadbee;
9756     action = 0xdeadbee;
9757     r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9758     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9759     ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9760     ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
9761
9762     state = 0xdeadbee;
9763     action = 0xdeadbee;
9764     r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9765     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9766     ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9767     ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9768
9769     state = 0xdeadbee;
9770     action = 0xdeadbee;
9771     r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9772     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9773     ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
9774     ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
9775
9776     r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
9777     ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
9778
9779     r = MsiSetFeatureState(hpkg, "nosuchfeature", INSTALLSTATE_ABSENT);
9780     ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %u\n", r);
9781
9782     state = 0xdeadbee;
9783     action = 0xdeadbee;
9784     r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
9785     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9786     ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
9787     ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
9788
9789     state = 0xdeadbee;
9790     action = 0xdeadbee;
9791     r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
9792     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9793     ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
9794     ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
9795
9796     state = 0xdeadbee;
9797     action = 0xdeadbee;
9798     r = MsiGetFeatureState(hpkg, "orion", &state, &action);
9799     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9800     ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
9801     ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
9802
9803     state = 0xdeadbee;
9804     action = 0xdeadbee;
9805     r = MsiGetComponentState(hpkg, "leo", &state, &action);
9806     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9807     ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
9808     ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
9809
9810     state = 0xdeadbee;
9811     action = 0xdeadbee;
9812     r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9813     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9814     ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9815     ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9816
9817     state = 0xdeadbee;
9818     action = 0xdeadbee;
9819     r = MsiGetComponentState(hpkg, "libra", &state, &action);
9820     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9821     ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9822     ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9823
9824     state = 0xdeadbee;
9825     action = 0xdeadbee;
9826     r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9827     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9828     ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9829     ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9830
9831     state = 0xdeadbee;
9832     action = 0xdeadbee;
9833     r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9834     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9835     ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9836     ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9837
9838     state = 0xdeadbee;
9839     action = 0xdeadbee;
9840     r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9841     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9842     ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9843     ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
9844
9845     state = 0xdeadbee;
9846     action = 0xdeadbee;
9847     r = MsiGetComponentState(hpkg, "canis", &state, &action);
9848     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9849     ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9850     ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
9851
9852     state = 0xdeadbee;
9853     action = 0xdeadbee;
9854     r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9855     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9856     ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9857     ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
9858
9859     state = 0xdeadbee;
9860     action = 0xdeadbee;
9861     r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9862     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9863     ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9864     ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
9865
9866     state = 0xdeadbee;
9867     action = 0xdeadbee;
9868     r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9869     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9870     ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9871     ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9872
9873     state = 0xdeadbee;
9874     action = 0xdeadbee;
9875     r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9876     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9877     ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
9878     ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
9879     
9880     MsiCloseHandle(hpkg);
9881     DeleteFileA(msifile);
9882 }
9883
9884 static void test_installprops(void)
9885 {
9886     MSIHANDLE hpkg, hdb;
9887     CHAR path[MAX_PATH], buf[MAX_PATH];
9888     DWORD size, type;
9889     LANGID langid;
9890     HKEY hkey1, hkey2;
9891     int res;
9892     UINT r;
9893     REGSAM access = KEY_ALL_ACCESS;
9894     SYSTEM_INFO si;
9895
9896     if (is_wow64)
9897         access |= KEY_WOW64_64KEY;
9898
9899     GetCurrentDirectory(MAX_PATH, path);
9900     lstrcat(path, "\\");
9901     lstrcat(path, msifile);
9902
9903     hdb = create_package_db();
9904     ok( hdb, "failed to create database\n");
9905
9906     r = package_from_db(hdb, &hpkg);
9907     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9908     {
9909         skip("Not enough rights to perform tests\n");
9910         DeleteFile(msifile);
9911         return;
9912     }
9913     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
9914
9915     MsiCloseHandle(hdb);
9916
9917     size = MAX_PATH;
9918     r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
9919     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9920     ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9921
9922     RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
9923     RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey2);
9924
9925     size = MAX_PATH;
9926     type = REG_SZ;
9927     *path = '\0';
9928     if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
9929     {
9930         size = MAX_PATH;
9931         type = REG_SZ;
9932         RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
9933     }
9934
9935     /* win9x doesn't set this */
9936     if (*path)
9937     {
9938         size = MAX_PATH;
9939         r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
9940         ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9941         ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9942     }
9943
9944     size = MAX_PATH;
9945     type = REG_SZ;
9946     *path = '\0';
9947     if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
9948     {
9949         size = MAX_PATH;
9950         type = REG_SZ;
9951         RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
9952     }
9953
9954     if (*path)
9955     {
9956         size = MAX_PATH;
9957         r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
9958         ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9959         ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9960     }
9961
9962     size = MAX_PATH;
9963     r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
9964     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9965     trace("VersionDatabase = %s\n", buf);
9966
9967     size = MAX_PATH;
9968     r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
9969     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9970     trace("VersionMsi = %s\n", buf);
9971
9972     size = MAX_PATH;
9973     r = MsiGetProperty(hpkg, "Date", buf, &size);
9974     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9975     trace("Date = %s\n", buf);
9976
9977     size = MAX_PATH;
9978     r = MsiGetProperty(hpkg, "Time", buf, &size);
9979     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9980     trace("Time = %s\n", buf);
9981
9982     size = MAX_PATH;
9983     r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
9984     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9985     trace("PackageCode = %s\n", buf);
9986
9987     langid = GetUserDefaultLangID();
9988     sprintf(path, "%d", langid);
9989
9990     size = MAX_PATH;
9991     r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
9992     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
9993     ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
9994
9995     res = GetSystemMetrics(SM_CXSCREEN);
9996     size = MAX_PATH;
9997     r = MsiGetProperty(hpkg, "ScreenX", buf, &size);
9998     ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
9999
10000     res = GetSystemMetrics(SM_CYSCREEN);
10001     size = MAX_PATH;
10002     r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
10003     ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
10004
10005     if (pGetSystemInfo && pSHGetFolderPathA)
10006     {
10007         pGetSystemInfo(&si);
10008         if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
10009         {
10010             buf[0] = 0;
10011             size = MAX_PATH;
10012             r = MsiGetProperty(hpkg, "MsiAMD64", buf, &size);
10013             ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10014             ok(buf[0], "property not set\n");
10015
10016             buf[0] = 0;
10017             size = MAX_PATH;
10018             r = MsiGetProperty(hpkg, "Msix64", buf, &size);
10019             ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10020             ok(buf[0], "property not set\n");
10021
10022             buf[0] = 0;
10023             size = MAX_PATH;
10024             r = MsiGetProperty(hpkg, "System64Folder", buf, &size);
10025             ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10026             GetSystemDirectoryA(path, MAX_PATH);
10027             if (size) buf[size - 1] = 0;
10028             ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10029
10030             buf[0] = 0;
10031             size = MAX_PATH;
10032             r = MsiGetProperty(hpkg, "SystemFolder", buf, &size);
10033             ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10034             pGetSystemWow64DirectoryA(path, MAX_PATH);
10035             if (size) buf[size - 1] = 0;
10036             ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10037
10038             buf[0] = 0;
10039             size = MAX_PATH;
10040             r = MsiGetProperty(hpkg, "ProgramFiles64Folder", buf, &size);
10041             ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10042             pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES, NULL, 0, path);
10043             if (size) buf[size - 1] = 0;
10044             ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10045
10046             buf[0] = 0;
10047             size = MAX_PATH;
10048             r = MsiGetProperty(hpkg, "ProgramFilesFolder", buf, &size);
10049             ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10050             pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILESX86, NULL, 0, path);
10051             if (size) buf[size - 1] = 0;
10052             ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10053
10054             buf[0] = 0;
10055             size = MAX_PATH;
10056             r = MsiGetProperty(hpkg, "CommonFiles64Folder", buf, &size);
10057             ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10058             pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMON, NULL, 0, path);
10059             if (size) buf[size - 1] = 0;
10060             ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10061
10062             buf[0] = 0;
10063             size = MAX_PATH;
10064             r = MsiGetProperty(hpkg, "CommonFilesFolder", buf, &size);
10065             ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10066             pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMONX86, NULL, 0, path);
10067             if (size) buf[size - 1] = 0;
10068             ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10069
10070             buf[0] = 0;
10071             size = MAX_PATH;
10072             r = MsiGetProperty(hpkg, "VersionNT64", buf, &size);
10073             ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10074             ok(buf[0], "property not set\n");
10075         }
10076         else if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
10077         {
10078             if (!is_wow64)
10079             {
10080                 buf[0] = 0;
10081                 size = MAX_PATH;
10082                 r = MsiGetProperty(hpkg, "MsiAMD64", buf, &size);
10083                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10084                 ok(!buf[0], "property set\n");
10085
10086                 buf[0] = 0;
10087                 size = MAX_PATH;
10088                 r = MsiGetProperty(hpkg, "Msix64", buf, &size);
10089                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10090                 ok(!buf[0], "property set\n");
10091
10092                 buf[0] = 0;
10093                 size = MAX_PATH;
10094                 r = MsiGetProperty(hpkg, "System64Folder", buf, &size);
10095                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10096                 ok(!buf[0], "property set\n");
10097
10098                 buf[0] = 0;
10099                 size = MAX_PATH;
10100                 r = MsiGetProperty(hpkg, "SystemFolder", buf, &size);
10101                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10102                 GetSystemDirectoryA(path, MAX_PATH);
10103                 if (size) buf[size - 1] = 0;
10104                 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10105
10106                 buf[0] = 0;
10107                 size = MAX_PATH;
10108                 r = MsiGetProperty(hpkg, "ProgramFiles64Folder", buf, &size);
10109                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10110                 ok(!buf[0], "property set\n");
10111
10112                 buf[0] = 0;
10113                 size = MAX_PATH;
10114                 r = MsiGetProperty(hpkg, "ProgramFilesFolder", buf, &size);
10115                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10116                 pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES, NULL, 0, path);
10117                 if (size) buf[size - 1] = 0;
10118                 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10119
10120                 buf[0] = 0;
10121                 size = MAX_PATH;
10122                 r = MsiGetProperty(hpkg, "CommonFiles64Folder", buf, &size);
10123                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10124                 ok(!buf[0], "property set\n");
10125
10126                 buf[0] = 0;
10127                 size = MAX_PATH;
10128                 r = MsiGetProperty(hpkg, "CommonFilesFolder", buf, &size);
10129                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10130                 pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMON, NULL, 0, path);
10131                 if (size) buf[size - 1] = 0;
10132                 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10133
10134                 buf[0] = 0;
10135                 size = MAX_PATH;
10136                 r = MsiGetProperty(hpkg, "VersionNT64", buf, &size);
10137                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10138                 ok(!buf[0], "property set\n");
10139             }
10140             else
10141             {
10142                 buf[0] = 0;
10143                 size = MAX_PATH;
10144                 r = MsiGetProperty(hpkg, "MsiAMD64", buf, &size);
10145                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10146                 ok(buf[0], "property not set\n");
10147
10148                 buf[0] = 0;
10149                 size = MAX_PATH;
10150                 r = MsiGetProperty(hpkg, "Msix64", buf, &size);
10151                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10152                 ok(buf[0], "property not set\n");
10153
10154                 buf[0] = 0;
10155                 size = MAX_PATH;
10156                 r = MsiGetProperty(hpkg, "System64Folder", buf, &size);
10157                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10158                 GetSystemDirectoryA(path, MAX_PATH);
10159                 if (size) buf[size - 1] = 0;
10160                 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10161
10162                 buf[0] = 0;
10163                 size = MAX_PATH;
10164                 r = MsiGetProperty(hpkg, "SystemFolder", buf, &size);
10165                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10166                 pGetSystemWow64DirectoryA(path, MAX_PATH);
10167                 if (size) buf[size - 1] = 0;
10168                 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10169
10170                 buf[0] = 0;
10171                 size = MAX_PATH;
10172                 r = MsiGetProperty(hpkg, "ProgramFilesFolder64", buf, &size);
10173                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10174                 ok(!buf[0], "property set\n");
10175
10176                 buf[0] = 0;
10177                 size = MAX_PATH;
10178                 r = MsiGetProperty(hpkg, "ProgramFilesFolder", buf, &size);
10179                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10180                 pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILESX86, NULL, 0, path);
10181                 if (size) buf[size - 1] = 0;
10182                 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10183
10184                 buf[0] = 0;
10185                 size = MAX_PATH;
10186                 r = MsiGetProperty(hpkg, "CommonFilesFolder64", buf, &size);
10187                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10188                 ok(!buf[0], "property set\n");
10189
10190                 buf[0] = 0;
10191                 size = MAX_PATH;
10192                 r = MsiGetProperty(hpkg, "CommonFilesFolder", buf, &size);
10193                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10194                 pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMONX86, NULL, 0, path);
10195                 if (size) buf[size - 1] = 0;
10196                 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10197
10198                 buf[0] = 0;
10199                 size = MAX_PATH;
10200                 r = MsiGetProperty(hpkg, "VersionNT64", buf, &size);
10201                 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10202                 ok(buf[0], "property not set\n");
10203             }
10204         }
10205     }
10206
10207     CloseHandle(hkey1);
10208     CloseHandle(hkey2);
10209     MsiCloseHandle(hpkg);
10210     DeleteFile(msifile);
10211 }
10212
10213 static void test_launchconditions(void)
10214 {
10215     MSIHANDLE hpkg;
10216     MSIHANDLE hdb;
10217     UINT r;
10218
10219     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
10220
10221     hdb = create_package_db();
10222     ok( hdb, "failed to create package database\n" );
10223
10224     r = create_launchcondition_table( hdb );
10225     ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
10226
10227     r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
10228     ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
10229
10230     /* invalid condition */
10231     r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
10232     ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
10233
10234     r = package_from_db( hdb, &hpkg );
10235     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
10236     {
10237         skip("Not enough rights to perform tests\n");
10238         DeleteFile(msifile);
10239         return;
10240     }
10241     ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
10242
10243     MsiCloseHandle( hdb );
10244
10245     r = MsiSetProperty( hpkg, "X", "1" );
10246     ok( r == ERROR_SUCCESS, "failed to set property\n" );
10247
10248     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
10249
10250     /* invalid conditions are ignored */
10251     r = MsiDoAction( hpkg, "LaunchConditions" );
10252     ok( r == ERROR_SUCCESS, "cost init failed\n" );
10253
10254     /* verify LaunchConditions still does some verification */
10255     r = MsiSetProperty( hpkg, "X", "2" );
10256     ok( r == ERROR_SUCCESS, "failed to set property\n" );
10257
10258     r = MsiDoAction( hpkg, "LaunchConditions" );
10259     ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
10260
10261     MsiCloseHandle( hpkg );
10262     DeleteFile( msifile );
10263 }
10264
10265 static void test_ccpsearch(void)
10266 {
10267     MSIHANDLE hdb, hpkg;
10268     CHAR prop[MAX_PATH];
10269     DWORD size = MAX_PATH;
10270     UINT r;
10271
10272     hdb = create_package_db();
10273     ok(hdb, "failed to create package database\n");
10274
10275     r = create_ccpsearch_table(hdb);
10276     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10277
10278     r = add_ccpsearch_entry(hdb, "'CCP_random'");
10279     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10280
10281     r = add_ccpsearch_entry(hdb, "'RMCCP_random'");
10282     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10283
10284     r = create_reglocator_table(hdb);
10285     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10286
10287     r = add_reglocator_entry(hdb, "CCP_random", 0, "htmlfile\\shell\\open\\nonexistent", "", 1);
10288     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10289
10290     r = create_drlocator_table(hdb);
10291     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10292
10293     r = add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
10294     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10295
10296     r = create_signature_table(hdb);
10297     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10298
10299     r = package_from_db(hdb, &hpkg);
10300     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
10301     {
10302         skip("Not enough rights to perform tests\n");
10303         DeleteFile(msifile);
10304         return;
10305     }
10306     ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
10307
10308     MsiCloseHandle(hdb);
10309
10310     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
10311
10312     r = MsiDoAction(hpkg, "CCPSearch");
10313     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10314
10315     r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
10316     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10317     ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
10318
10319     MsiCloseHandle(hpkg);
10320     DeleteFileA(msifile);
10321 }
10322
10323 static void test_complocator(void)
10324 {
10325     MSIHANDLE hdb, hpkg;
10326     UINT r;
10327     CHAR prop[MAX_PATH];
10328     CHAR expected[MAX_PATH];
10329     DWORD size = MAX_PATH;
10330
10331     hdb = create_package_db();
10332     ok(hdb, "failed to create package database\n");
10333
10334     r = create_appsearch_table(hdb);
10335     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10336
10337     r = add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
10338     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10339
10340     r = add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
10341     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10342
10343     r = add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
10344     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10345
10346     r = add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
10347     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10348
10349     r = add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
10350     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10351
10352     r = add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
10353     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10354
10355     r = add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
10356     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10357
10358     r = add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
10359     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10360
10361     r = add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
10362     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10363
10364     r = add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
10365     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10366
10367     r = add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
10368     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10369
10370     r = add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
10371     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10372
10373     r = add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
10374     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10375
10376     r = add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
10377     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10378
10379     r = add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
10380     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10381
10382     r = add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
10383     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10384
10385     r = create_complocator_table(hdb);
10386     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10387
10388     r = add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
10389     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10390
10391     r = add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
10392     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10393
10394     r = add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
10395     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10396
10397     r = add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
10398     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10399
10400     r = add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
10401     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10402
10403     r = add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
10404     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10405
10406     r = add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
10407     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10408
10409     r = add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
10410     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10411
10412     r = add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
10413     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10414
10415     r = add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
10416     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10417
10418     r = add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
10419     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10420
10421     r = add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
10422     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10423
10424     r = add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
10425     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10426
10427     r = add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
10428     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10429
10430     r = add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
10431     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10432
10433     r = add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
10434     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10435
10436     r = create_signature_table(hdb);
10437     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10438
10439     r = add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
10440     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10441
10442     r = add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
10443     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10444
10445     r = add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
10446     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10447
10448     r = add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
10449     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10450
10451     r = add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
10452     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10453
10454     r = add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
10455     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10456
10457     r = add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
10458     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10459
10460     r = add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
10461     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10462
10463     r = package_from_db(hdb, &hpkg);
10464     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
10465     {
10466         skip("Not enough rights to perform tests\n");
10467         DeleteFile(msifile);
10468         return;
10469     }
10470     ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
10471
10472     MsiCloseHandle(hdb);
10473
10474     create_test_file("abelisaurus");
10475     create_test_file("bactrosaurus");
10476     create_test_file("camelotia");
10477     create_test_file("diclonius");
10478     create_test_file("echinodon");
10479     create_test_file("falcarius");
10480     create_test_file("gallimimus");
10481     create_test_file("hagryphus");
10482     CreateDirectoryA("iguanodon", NULL);
10483     CreateDirectoryA("jobaria", NULL);
10484     CreateDirectoryA("kakuru", NULL);
10485     CreateDirectoryA("labocania", NULL);
10486     CreateDirectoryA("megaraptor", NULL);
10487     CreateDirectoryA("neosodon", NULL);
10488     CreateDirectoryA("olorotitan", NULL);
10489     CreateDirectoryA("pantydraco", NULL);
10490
10491     set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE,
10492                        "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL, FALSE);
10493     set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE,
10494                        "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL, FALSE);
10495     set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE,
10496                        "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL, FALSE);
10497     set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE,
10498                        "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL, FALSE);
10499     set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE,
10500                        "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL, FALSE);
10501     set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE,
10502                        "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL, FALSE);
10503     set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE,
10504                        "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL, FALSE);
10505     set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE,
10506                        "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL, FALSE);
10507
10508     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
10509
10510     r = MsiDoAction(hpkg, "AppSearch");
10511     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10512
10513     size = MAX_PATH;
10514     r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
10515     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10516
10517     lstrcpyA(expected, CURR_DIR);
10518     lstrcatA(expected, "\\abelisaurus");
10519     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10520        "Expected %s or empty string, got %s\n", expected, prop);
10521
10522     size = MAX_PATH;
10523     r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
10524     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10525     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10526
10527     size = MAX_PATH;
10528     r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
10529     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10530     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10531
10532     size = MAX_PATH;
10533     r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
10534     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10535     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10536
10537     size = MAX_PATH;
10538     r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
10539     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10540
10541     lstrcpyA(expected, CURR_DIR);
10542     lstrcatA(expected, "\\");
10543     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10544        "Expected %s or empty string, got %s\n", expected, prop);
10545
10546     size = MAX_PATH;
10547     r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
10548     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10549     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10550
10551     size = MAX_PATH;
10552     r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
10553     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10554     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10555
10556     size = MAX_PATH;
10557     r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
10558     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10559     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10560
10561     size = MAX_PATH;
10562     r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
10563     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10564     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10565
10566     size = MAX_PATH;
10567     r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
10568     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10569     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10570
10571     size = MAX_PATH;
10572     r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
10573     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10574     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10575
10576     size = MAX_PATH;
10577     r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
10578     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10579     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10580
10581     size = MAX_PATH;
10582     r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
10583     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10584
10585     lstrcpyA(expected, CURR_DIR);
10586     lstrcatA(expected, "\\");
10587     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10588        "Expected %s or empty string, got %s\n", expected, prop);
10589
10590     size = MAX_PATH;
10591     r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
10592     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10593
10594     lstrcpyA(expected, CURR_DIR);
10595     lstrcatA(expected, "\\neosodon\\");
10596     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10597        "Expected %s or empty string, got %s\n", expected, prop);
10598
10599     size = MAX_PATH;
10600     r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
10601     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10602     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10603
10604     size = MAX_PATH;
10605     r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
10606     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10607     ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10608
10609     MsiCloseHandle(hpkg);
10610     DeleteFileA("abelisaurus");
10611     DeleteFileA("bactrosaurus");
10612     DeleteFileA("camelotia");
10613     DeleteFileA("diclonius");
10614     DeleteFileA("echinodon");
10615     DeleteFileA("falcarius");
10616     DeleteFileA("gallimimus");
10617     DeleteFileA("hagryphus");
10618     RemoveDirectoryA("iguanodon");
10619     RemoveDirectoryA("jobaria");
10620     RemoveDirectoryA("kakuru");
10621     RemoveDirectoryA("labocania");
10622     RemoveDirectoryA("megaraptor");
10623     RemoveDirectoryA("neosodon");
10624     RemoveDirectoryA("olorotitan");
10625     RemoveDirectoryA("pantydraco");
10626     delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
10627                           MSIINSTALLCONTEXT_MACHINE, NULL);
10628     delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
10629                           MSIINSTALLCONTEXT_MACHINE, NULL);
10630     delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
10631                           MSIINSTALLCONTEXT_MACHINE, NULL);
10632     delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
10633                           MSIINSTALLCONTEXT_MACHINE, NULL);
10634     delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
10635                           MSIINSTALLCONTEXT_MACHINE, NULL);
10636     delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
10637                           MSIINSTALLCONTEXT_MACHINE, NULL);
10638     delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
10639                           MSIINSTALLCONTEXT_MACHINE, NULL);
10640     delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
10641                           MSIINSTALLCONTEXT_MACHINE, NULL);
10642     DeleteFileA(msifile);
10643 }
10644
10645 static void set_suminfo_prop(MSIHANDLE db, DWORD prop, DWORD val)
10646 {
10647     MSIHANDLE summary;
10648     UINT r;
10649
10650     r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
10651     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10652
10653     r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
10654     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10655
10656     r = MsiSummaryInfoPersist(summary);
10657     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
10658
10659     MsiCloseHandle(summary);
10660 }
10661
10662 static void test_MsiGetSourcePath(void)
10663 {
10664     MSIHANDLE hdb, hpkg;
10665     CHAR path[MAX_PATH];
10666     CHAR cwd[MAX_PATH];
10667     CHAR subsrc[MAX_PATH];
10668     CHAR sub2[MAX_PATH];
10669     DWORD size;
10670     UINT r;
10671
10672     lstrcpyA(cwd, CURR_DIR);
10673     lstrcatA(cwd, "\\");
10674
10675     lstrcpyA(subsrc, cwd);
10676     lstrcatA(subsrc, "subsource");
10677     lstrcatA(subsrc, "\\");
10678
10679     lstrcpyA(sub2, subsrc);
10680     lstrcatA(sub2, "sub2");
10681     lstrcatA(sub2, "\\");
10682
10683     /* uncompressed source */
10684
10685     hdb = create_package_db();
10686     ok( hdb, "failed to create database\n");
10687
10688     set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
10689
10690     r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
10691     ok(r == S_OK, "failed\n");
10692
10693     r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
10694     ok(r == S_OK, "failed\n");
10695
10696     r = add_directory_entry(hdb, "'SubDir2', 'SubDir', 'sub2'");
10697     ok(r == S_OK, "failed\n");
10698
10699     r = MsiDatabaseCommit(hdb);
10700     ok(r == ERROR_SUCCESS , "Failed to commit database\n");
10701
10702     r = package_from_db(hdb, &hpkg);
10703     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
10704     {
10705         skip("Not enough rights to perform tests\n");
10706         DeleteFile(msifile);
10707         return;
10708     }
10709     ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
10710
10711     MsiCloseHandle(hdb);
10712
10713     /* invalid database handle */
10714     size = MAX_PATH;
10715     lstrcpyA(path, "kiwi");
10716     r = MsiGetSourcePath(-1, "TARGETDIR", path, &size);
10717     ok(r == ERROR_INVALID_HANDLE,
10718        "Expected ERROR_INVALID_HANDLE, got %d\n", r);
10719     ok(!lstrcmpA(path, "kiwi"),
10720        "Expected path to be unchanged, got \"%s\"\n", path);
10721     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10722
10723     /* NULL szFolder */
10724     size = MAX_PATH;
10725     lstrcpyA(path, "kiwi");
10726     r = MsiGetSourcePath(hpkg, NULL, path, &size);
10727     ok(r == ERROR_INVALID_PARAMETER,
10728        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
10729     ok(!lstrcmpA(path, "kiwi"),
10730        "Expected path to be unchanged, got \"%s\"\n", path);
10731     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10732
10733     /* empty szFolder */
10734     size = MAX_PATH;
10735     lstrcpyA(path, "kiwi");
10736     r = MsiGetSourcePath(hpkg, "", path, &size);
10737     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10738     ok(!lstrcmpA(path, "kiwi"),
10739        "Expected path to be unchanged, got \"%s\"\n", path);
10740     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10741
10742     /* try TARGETDIR */
10743     size = MAX_PATH;
10744     lstrcpyA(path, "kiwi");
10745     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10746     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10747     ok(!lstrcmpA(path, "kiwi"),
10748        "Expected path to be unchanged, got \"%s\"\n", path);
10749     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10750
10751     size = MAX_PATH;
10752     lstrcpyA(path, "kiwi");
10753     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10754     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10755     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10756     ok(size == 0, "Expected 0, got %d\n", size);
10757
10758     size = MAX_PATH;
10759     lstrcpyA(path, "kiwi");
10760     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10761     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10762     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10763     ok(size == 0, "Expected 0, got %d\n", size);
10764
10765     /* try SourceDir */
10766     size = MAX_PATH;
10767     lstrcpyA(path, "kiwi");
10768     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10769     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10770     ok(!lstrcmpA(path, "kiwi"),
10771        "Expected path to be unchanged, got \"%s\"\n", path);
10772     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10773
10774     /* try SOURCEDIR */
10775     size = MAX_PATH;
10776     lstrcpyA(path, "kiwi");
10777     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10778     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10779     ok(!lstrcmpA(path, "kiwi"),
10780        "Expected path to be unchanged, got \"%s\"\n", path);
10781     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10782
10783     /* source path does not exist, but the property exists */
10784     size = MAX_PATH;
10785     lstrcpyA(path, "kiwi");
10786     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10787     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10788     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10789     ok(size == 0, "Expected 0, got %d\n", size);
10790
10791     size = MAX_PATH;
10792     lstrcpyA(path, "kiwi");
10793     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10794     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10795     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10796     ok(size == 0, "Expected 0, got %d\n", size);
10797
10798     /* try SubDir */
10799     size = MAX_PATH;
10800     lstrcpyA(path, "kiwi");
10801     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10802     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10803     ok(!lstrcmpA(path, "kiwi"),
10804        "Expected path to be unchanged, got \"%s\"\n", path);
10805     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10806
10807     /* try SubDir2 */
10808     size = MAX_PATH;
10809     lstrcpyA(path, "kiwi");
10810     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10811     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10812     ok(!lstrcmpA(path, "kiwi"),
10813        "Expected path to be unchanged, got \"%s\"\n", path);
10814     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10815
10816     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
10817
10818     r = MsiDoAction(hpkg, "CostInitialize");
10819     ok(r == ERROR_SUCCESS, "cost init failed\n");
10820
10821     /* try TARGETDIR after CostInitialize */
10822     size = MAX_PATH;
10823     lstrcpyA(path, "kiwi");
10824     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10825     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10826     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10827     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10828
10829     /* try SourceDir after CostInitialize */
10830     size = MAX_PATH;
10831     lstrcpyA(path, "kiwi");
10832     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10833     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10834     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10835     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10836
10837     /* try SOURCEDIR after CostInitialize */
10838     size = MAX_PATH;
10839     lstrcpyA(path, "kiwi");
10840     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10841     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10842     ok(!lstrcmpA(path, "kiwi"),
10843        "Expected path to be unchanged, got \"%s\"\n", path);
10844     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10845
10846     /* source path does not exist, but the property exists */
10847     size = MAX_PATH;
10848     lstrcpyA(path, "kiwi");
10849     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10850     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10851     todo_wine
10852     {
10853         ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10854         ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10855     }
10856
10857     /* try SubDir after CostInitialize */
10858     size = MAX_PATH;
10859     lstrcpyA(path, "kiwi");
10860     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10861     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10862     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10863     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10864
10865     /* try SubDir2 after CostInitialize */
10866     size = MAX_PATH;
10867     lstrcpyA(path, "kiwi");
10868     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10869     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10870     ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10871     ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10872
10873     r = MsiDoAction(hpkg, "ResolveSource");
10874     ok(r == ERROR_SUCCESS, "file cost failed\n");
10875
10876     /* try TARGETDIR after ResolveSource */
10877     size = MAX_PATH;
10878     lstrcpyA(path, "kiwi");
10879     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10880     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10881     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10882     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10883
10884     /* try SourceDir after ResolveSource */
10885     size = MAX_PATH;
10886     lstrcpyA(path, "kiwi");
10887     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10888     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10889     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10890     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10891
10892     /* try SOURCEDIR after ResolveSource */
10893     size = MAX_PATH;
10894     lstrcpyA(path, "kiwi");
10895     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10896     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10897     ok(!lstrcmpA(path, "kiwi"),
10898        "Expected path to be unchanged, got \"%s\"\n", path);
10899     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10900
10901     /* source path does not exist, but the property exists */
10902     size = MAX_PATH;
10903     lstrcpyA(path, "kiwi");
10904     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10905     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10906     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10907     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10908
10909     /* try SubDir after ResolveSource */
10910     size = MAX_PATH;
10911     lstrcpyA(path, "kiwi");
10912     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10913     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10914     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10915     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10916
10917     /* try SubDir2 after ResolveSource */
10918     size = MAX_PATH;
10919     lstrcpyA(path, "kiwi");
10920     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10921     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10922     ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10923     ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10924
10925     r = MsiDoAction(hpkg, "FileCost");
10926     ok(r == ERROR_SUCCESS, "file cost failed\n");
10927
10928     /* try TARGETDIR after FileCost */
10929     size = MAX_PATH;
10930     lstrcpyA(path, "kiwi");
10931     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10932     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10933     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10934     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10935
10936     /* try SourceDir after FileCost */
10937     size = MAX_PATH;
10938     lstrcpyA(path, "kiwi");
10939     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10940     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10941     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10942     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10943
10944     /* try SOURCEDIR after FileCost */
10945     size = MAX_PATH;
10946     lstrcpyA(path, "kiwi");
10947     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10948     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10949     ok(!lstrcmpA(path, "kiwi"),
10950        "Expected path to be unchanged, got \"%s\"\n", path);
10951     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10952
10953     /* source path does not exist, but the property exists */
10954     size = MAX_PATH;
10955     lstrcpyA(path, "kiwi");
10956     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10957     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10958     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10959     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10960
10961     /* try SubDir after FileCost */
10962     size = MAX_PATH;
10963     lstrcpyA(path, "kiwi");
10964     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10965     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10966     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10967     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10968
10969     /* try SubDir2 after FileCost */
10970     size = MAX_PATH;
10971     lstrcpyA(path, "kiwi");
10972     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10973     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10974     ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10975     ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10976
10977     r = MsiDoAction(hpkg, "CostFinalize");
10978     ok(r == ERROR_SUCCESS, "file cost failed\n");
10979
10980     /* try TARGETDIR after CostFinalize */
10981     size = MAX_PATH;
10982     lstrcpyA(path, "kiwi");
10983     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10984     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10985     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10986     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10987
10988     /* try SourceDir after CostFinalize */
10989     size = MAX_PATH;
10990     lstrcpyA(path, "kiwi");
10991     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10992     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10993     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10994     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10995
10996     /* try SOURCEDIR after CostFinalize */
10997     size = MAX_PATH;
10998     lstrcpyA(path, "kiwi");
10999     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11000     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11001     ok(!lstrcmpA(path, "kiwi"),
11002        "Expected path to be unchanged, got \"%s\"\n", path);
11003     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11004
11005     /* source path does not exist, but the property exists */
11006     size = MAX_PATH;
11007     lstrcpyA(path, "kiwi");
11008     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11009     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11010     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11011     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11012
11013     /* try SubDir after CostFinalize */
11014     size = MAX_PATH;
11015     lstrcpyA(path, "kiwi");
11016     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11017     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11018     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11019     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11020
11021     /* try SubDir2 after CostFinalize */
11022     size = MAX_PATH;
11023     lstrcpyA(path, "kiwi");
11024     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11025     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11026     ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
11027     ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
11028
11029     /* nonexistent directory */
11030     size = MAX_PATH;
11031     lstrcpyA(path, "kiwi");
11032     r = MsiGetSourcePath(hpkg, "IDontExist", path, &size);
11033     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11034     ok(!lstrcmpA(path, "kiwi"),
11035        "Expected path to be unchanged, got \"%s\"\n", path);
11036     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11037
11038     /* NULL szPathBuf */
11039     size = MAX_PATH;
11040     r = MsiGetSourcePath(hpkg, "SourceDir", NULL, &size);
11041     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11042     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11043
11044     /* NULL pcchPathBuf */
11045     lstrcpyA(path, "kiwi");
11046     r = MsiGetSourcePath(hpkg, "SourceDir", path, NULL);
11047     ok(r == ERROR_INVALID_PARAMETER,
11048        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11049     ok(!lstrcmpA(path, "kiwi"),
11050        "Expected path to be unchanged, got \"%s\"\n", path);
11051
11052     /* pcchPathBuf is 0 */
11053     size = 0;
11054     lstrcpyA(path, "kiwi");
11055     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11056     ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
11057     ok(!lstrcmpA(path, "kiwi"),
11058        "Expected path to be unchanged, got \"%s\"\n", path);
11059     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11060
11061     /* pcchPathBuf does not have room for NULL terminator */
11062     size = lstrlenA(cwd);
11063     lstrcpyA(path, "kiwi");
11064     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11065     ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
11066     ok(!strncmp(path, cwd, lstrlenA(cwd) - 1),
11067        "Expected path with no backslash, got \"%s\"\n", path);
11068     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11069
11070     /* pcchPathBuf has room for NULL terminator */
11071     size = lstrlenA(cwd) + 1;
11072     lstrcpyA(path, "kiwi");
11073     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11074     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11075     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11076     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11077
11078     /* remove property */
11079     r = MsiSetProperty(hpkg, "SourceDir", NULL);
11080     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11081
11082     /* try SourceDir again */
11083     size = MAX_PATH;
11084     lstrcpyA(path, "kiwi");
11085     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11086     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11087     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11088     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11089
11090     /* set property to a valid directory */
11091     r = MsiSetProperty(hpkg, "SOURCEDIR", cwd);
11092     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11093
11094     /* try SOURCEDIR again */
11095     size = MAX_PATH;
11096     lstrcpyA(path, "kiwi");
11097     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11098     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11099     ok(!lstrcmpA(path, "kiwi"),
11100        "Expected path to be unchanged, got \"%s\"\n", path);
11101     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11102
11103     MsiCloseHandle(hpkg);
11104
11105     /* compressed source */
11106
11107     r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
11108     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11109
11110     set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed);
11111
11112     r = package_from_db(hdb, &hpkg);
11113     ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
11114
11115     /* try TARGETDIR */
11116     size = MAX_PATH;
11117     lstrcpyA(path, "kiwi");
11118     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
11119     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11120     ok(!lstrcmpA(path, "kiwi"),
11121        "Expected path to be unchanged, got \"%s\"\n", path);
11122     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11123
11124     /* try SourceDir */
11125     size = MAX_PATH;
11126     lstrcpyA(path, "kiwi");
11127     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11128     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11129     ok(!lstrcmpA(path, "kiwi"),
11130        "Expected path to be unchanged, got \"%s\"\n", path);
11131     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11132
11133     /* try SOURCEDIR */
11134     size = MAX_PATH;
11135     lstrcpyA(path, "kiwi");
11136     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11137     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11138     ok(!lstrcmpA(path, "kiwi"),
11139        "Expected path to be unchanged, got \"%s\"\n", path);
11140     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11141
11142     /* source path nor the property exist */
11143     size = MAX_PATH;
11144     lstrcpyA(path, "kiwi");
11145     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11146     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11147     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11148     ok(size == 0, "Expected 0, got %d\n", size);
11149
11150     /* try SubDir */
11151     size = MAX_PATH;
11152     lstrcpyA(path, "kiwi");
11153     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11154     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11155     ok(!lstrcmpA(path, "kiwi"),
11156        "Expected path to be unchanged, got \"%s\"\n", path);
11157     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11158
11159     /* try SubDir2 */
11160     size = MAX_PATH;
11161     lstrcpyA(path, "kiwi");
11162     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11163     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11164     ok(!lstrcmpA(path, "kiwi"),
11165        "Expected path to be unchanged, got \"%s\"\n", path);
11166     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11167
11168     r = MsiDoAction(hpkg, "CostInitialize");
11169     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11170
11171     /* try TARGETDIR after CostInitialize */
11172     size = MAX_PATH;
11173     lstrcpyA(path, "kiwi");
11174     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
11175     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11176     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11177     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11178
11179     /* try SourceDir after CostInitialize */
11180     size = MAX_PATH;
11181     lstrcpyA(path, "kiwi");
11182     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11183     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11184     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11185     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11186
11187     /* try SOURCEDIR after CostInitialize */
11188     size = MAX_PATH;
11189     lstrcpyA(path, "kiwi");
11190     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11191     todo_wine
11192     {
11193         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11194         ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11195         ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11196     }
11197
11198     /* source path does not exist, but the property exists */
11199     size = MAX_PATH;
11200     lstrcpyA(path, "kiwi");
11201     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11202     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11203     todo_wine
11204     {
11205         ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11206         ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11207     }
11208
11209     /* try SubDir after CostInitialize */
11210     size = MAX_PATH;
11211     lstrcpyA(path, "kiwi");
11212     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11213     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11214     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11215     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11216
11217     /* try SubDir2 after CostInitialize */
11218     size = MAX_PATH;
11219     lstrcpyA(path, "kiwi");
11220     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11221     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11222     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11223     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11224
11225     r = MsiDoAction(hpkg, "ResolveSource");
11226     ok(r == ERROR_SUCCESS, "file cost failed\n");
11227
11228     /* try TARGETDIR after ResolveSource */
11229     size = MAX_PATH;
11230     lstrcpyA(path, "kiwi");
11231     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
11232     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11233     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11234     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11235
11236     /* try SourceDir after ResolveSource */
11237     size = MAX_PATH;
11238     lstrcpyA(path, "kiwi");
11239     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11240     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11241     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11242     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11243
11244     /* try SOURCEDIR after ResolveSource */
11245     size = MAX_PATH;
11246     lstrcpyA(path, "kiwi");
11247     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11248     todo_wine
11249     {
11250         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11251         ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11252         ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11253     }
11254
11255     /* source path and the property exist */
11256     size = MAX_PATH;
11257     lstrcpyA(path, "kiwi");
11258     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11259     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11260     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11261     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11262
11263     /* try SubDir after ResolveSource */
11264     size = MAX_PATH;
11265     lstrcpyA(path, "kiwi");
11266     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11267     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11268     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11269     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11270
11271     /* try SubDir2 after ResolveSource */
11272     size = MAX_PATH;
11273     lstrcpyA(path, "kiwi");
11274     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11275     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11276     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11277     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11278
11279     r = MsiDoAction(hpkg, "FileCost");
11280     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11281
11282     /* try TARGETDIR after CostFinalize */
11283     size = MAX_PATH;
11284     lstrcpyA(path, "kiwi");
11285     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
11286     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11287     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11288     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11289
11290     /* try SourceDir after CostFinalize */
11291     size = MAX_PATH;
11292     lstrcpyA(path, "kiwi");
11293     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11294     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11295     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11296     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11297
11298     /* try SOURCEDIR after CostFinalize */
11299     size = MAX_PATH;
11300     lstrcpyA(path, "kiwi");
11301     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11302     todo_wine
11303     {
11304         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11305         ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11306         ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11307     }
11308
11309     /* source path and the property exist */
11310     size = MAX_PATH;
11311     lstrcpyA(path, "kiwi");
11312     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11313     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11314     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11315     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11316
11317     /* try SubDir after CostFinalize */
11318     size = MAX_PATH;
11319     lstrcpyA(path, "kiwi");
11320     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11321     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11322     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11323     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11324
11325     /* try SubDir2 after CostFinalize */
11326     size = MAX_PATH;
11327     lstrcpyA(path, "kiwi");
11328     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11329     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11330     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11331     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11332
11333     r = MsiDoAction(hpkg, "CostFinalize");
11334     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11335
11336     /* try TARGETDIR after CostFinalize */
11337     size = MAX_PATH;
11338     lstrcpyA(path, "kiwi");
11339     r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
11340     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11341     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11342     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11343
11344     /* try SourceDir after CostFinalize */
11345     size = MAX_PATH;
11346     lstrcpyA(path, "kiwi");
11347     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11348     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11349     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11350     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11351
11352     /* try SOURCEDIR after CostFinalize */
11353     size = MAX_PATH;
11354     lstrcpyA(path, "kiwi");
11355     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11356     todo_wine
11357     {
11358         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11359         ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11360         ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11361     }
11362
11363     /* source path and the property exist */
11364     size = MAX_PATH;
11365     lstrcpyA(path, "kiwi");
11366     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11367     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11368     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11369     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11370
11371     /* try SubDir after CostFinalize */
11372     size = MAX_PATH;
11373     lstrcpyA(path, "kiwi");
11374     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11375     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11376     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11377     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11378
11379     /* try SubDir2 after CostFinalize */
11380     size = MAX_PATH;
11381     lstrcpyA(path, "kiwi");
11382     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11383     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11384     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11385     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11386
11387     MsiCloseHandle(hpkg);
11388     DeleteFile(msifile);
11389 }
11390
11391 static void test_shortlongsource(void)
11392 {
11393     MSIHANDLE hdb, hpkg;
11394     CHAR path[MAX_PATH];
11395     CHAR cwd[MAX_PATH];
11396     CHAR subsrc[MAX_PATH];
11397     DWORD size;
11398     UINT r;
11399
11400     lstrcpyA(cwd, CURR_DIR);
11401     lstrcatA(cwd, "\\");
11402
11403     lstrcpyA(subsrc, cwd);
11404     lstrcatA(subsrc, "long");
11405     lstrcatA(subsrc, "\\");
11406
11407     /* long file names */
11408
11409     hdb = create_package_db();
11410     ok( hdb, "failed to create database\n");
11411
11412     set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
11413
11414     r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
11415     ok(r == S_OK, "failed\n");
11416
11417     r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'short|long'");
11418     ok(r == S_OK, "failed\n");
11419
11420     /* CostInitialize:short */
11421     r = add_directory_entry(hdb, "'SubDir2', 'TARGETDIR', 'one|two'");
11422     ok(r == S_OK, "failed\n");
11423
11424     /* CostInitialize:long */
11425     r = add_directory_entry(hdb, "'SubDir3', 'TARGETDIR', 'three|four'");
11426     ok(r == S_OK, "failed\n");
11427
11428     /* FileCost:short */
11429     r = add_directory_entry(hdb, "'SubDir4', 'TARGETDIR', 'five|six'");
11430     ok(r == S_OK, "failed\n");
11431
11432     /* FileCost:long */
11433     r = add_directory_entry(hdb, "'SubDir5', 'TARGETDIR', 'seven|eight'");
11434     ok(r == S_OK, "failed\n");
11435
11436     /* CostFinalize:short */
11437     r = add_directory_entry(hdb, "'SubDir6', 'TARGETDIR', 'nine|ten'");
11438     ok(r == S_OK, "failed\n");
11439
11440     /* CostFinalize:long */
11441     r = add_directory_entry(hdb, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
11442     ok(r == S_OK, "failed\n");
11443
11444     MsiDatabaseCommit(hdb);
11445
11446     r = package_from_db(hdb, &hpkg);
11447     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
11448     {
11449         skip("Not enough rights to perform tests\n");
11450         DeleteFile(msifile);
11451         return;
11452     }
11453     ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
11454
11455     MsiCloseHandle(hdb);
11456
11457     CreateDirectoryA("one", NULL);
11458     CreateDirectoryA("four", NULL);
11459
11460     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
11461
11462     r = MsiDoAction(hpkg, "CostInitialize");
11463     ok(r == ERROR_SUCCESS, "file cost failed\n");
11464
11465     CreateDirectory("five", NULL);
11466     CreateDirectory("eight", NULL);
11467
11468     r = MsiDoAction(hpkg, "FileCost");
11469     ok(r == ERROR_SUCCESS, "file cost failed\n");
11470
11471     CreateDirectory("nine", NULL);
11472     CreateDirectory("twelve", NULL);
11473
11474     r = MsiDoAction(hpkg, "CostFinalize");
11475     ok(r == ERROR_SUCCESS, "file cost failed\n");
11476
11477     /* neither short nor long source directories exist */
11478     size = MAX_PATH;
11479     lstrcpyA(path, "kiwi");
11480     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11481     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11482     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11483     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11484
11485     CreateDirectoryA("short", NULL);
11486
11487     /* short source directory exists */
11488     size = MAX_PATH;
11489     lstrcpyA(path, "kiwi");
11490     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11491     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11492     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11493     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11494
11495     CreateDirectoryA("long", NULL);
11496
11497     /* both short and long source directories exist */
11498     size = MAX_PATH;
11499     lstrcpyA(path, "kiwi");
11500     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11501     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11502     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11503     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11504
11505     lstrcpyA(subsrc, cwd);
11506     lstrcatA(subsrc, "two");
11507     lstrcatA(subsrc, "\\");
11508
11509     /* short dir exists before CostInitialize */
11510     size = MAX_PATH;
11511     lstrcpyA(path, "kiwi");
11512     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11513     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11514     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11515     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11516
11517     lstrcpyA(subsrc, cwd);
11518     lstrcatA(subsrc, "four");
11519     lstrcatA(subsrc, "\\");
11520
11521     /* long dir exists before CostInitialize */
11522     size = MAX_PATH;
11523     lstrcpyA(path, "kiwi");
11524     r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
11525     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11526     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11527     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11528
11529     lstrcpyA(subsrc, cwd);
11530     lstrcatA(subsrc, "six");
11531     lstrcatA(subsrc, "\\");
11532
11533     /* short dir exists before FileCost */
11534     size = MAX_PATH;
11535     lstrcpyA(path, "kiwi");
11536     r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
11537     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11538     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11539     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11540
11541     lstrcpyA(subsrc, cwd);
11542     lstrcatA(subsrc, "eight");
11543     lstrcatA(subsrc, "\\");
11544
11545     /* long dir exists before FileCost */
11546     size = MAX_PATH;
11547     lstrcpyA(path, "kiwi");
11548     r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
11549     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11550     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11551     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11552
11553     lstrcpyA(subsrc, cwd);
11554     lstrcatA(subsrc, "ten");
11555     lstrcatA(subsrc, "\\");
11556
11557     /* short dir exists before CostFinalize */
11558     size = MAX_PATH;
11559     lstrcpyA(path, "kiwi");
11560     r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
11561     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11562     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11563     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11564
11565     lstrcpyA(subsrc, cwd);
11566     lstrcatA(subsrc, "twelve");
11567     lstrcatA(subsrc, "\\");
11568
11569     /* long dir exists before CostFinalize */
11570     size = MAX_PATH;
11571     lstrcpyA(path, "kiwi");
11572     r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
11573     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11574     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11575     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11576
11577     MsiCloseHandle(hpkg);
11578     RemoveDirectoryA("short");
11579     RemoveDirectoryA("long");
11580     RemoveDirectoryA("one");
11581     RemoveDirectoryA("four");
11582     RemoveDirectoryA("five");
11583     RemoveDirectoryA("eight");
11584     RemoveDirectoryA("nine");
11585     RemoveDirectoryA("twelve");
11586
11587     /* short file names */
11588
11589     r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
11590     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11591
11592     set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
11593
11594     r = package_from_db(hdb, &hpkg);
11595     ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
11596
11597     MsiCloseHandle(hdb);
11598
11599     CreateDirectoryA("one", NULL);
11600     CreateDirectoryA("four", NULL);
11601
11602     r = MsiDoAction(hpkg, "CostInitialize");
11603     ok(r == ERROR_SUCCESS, "file cost failed\n");
11604
11605     CreateDirectory("five", NULL);
11606     CreateDirectory("eight", NULL);
11607
11608     r = MsiDoAction(hpkg, "FileCost");
11609     ok(r == ERROR_SUCCESS, "file cost failed\n");
11610
11611     CreateDirectory("nine", NULL);
11612     CreateDirectory("twelve", NULL);
11613
11614     r = MsiDoAction(hpkg, "CostFinalize");
11615     ok(r == ERROR_SUCCESS, "file cost failed\n");
11616
11617     lstrcpyA(subsrc, cwd);
11618     lstrcatA(subsrc, "short");
11619     lstrcatA(subsrc, "\\");
11620
11621     /* neither short nor long source directories exist */
11622     size = MAX_PATH;
11623     lstrcpyA(path, "kiwi");
11624     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11625     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11626     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11627     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11628
11629     CreateDirectoryA("short", NULL);
11630
11631     /* short source directory exists */
11632     size = MAX_PATH;
11633     lstrcpyA(path, "kiwi");
11634     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11635     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11636     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11637     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11638
11639     CreateDirectoryA("long", NULL);
11640
11641     /* both short and long source directories exist */
11642     size = MAX_PATH;
11643     lstrcpyA(path, "kiwi");
11644     r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11645     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11646     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11647     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11648
11649     lstrcpyA(subsrc, cwd);
11650     lstrcatA(subsrc, "one");
11651     lstrcatA(subsrc, "\\");
11652
11653     /* short dir exists before CostInitialize */
11654     size = MAX_PATH;
11655     lstrcpyA(path, "kiwi");
11656     r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11657     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11658     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11659     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11660
11661     lstrcpyA(subsrc, cwd);
11662     lstrcatA(subsrc, "three");
11663     lstrcatA(subsrc, "\\");
11664
11665     /* long dir exists before CostInitialize */
11666     size = MAX_PATH;
11667     lstrcpyA(path, "kiwi");
11668     r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
11669     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11670     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11671     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11672
11673     lstrcpyA(subsrc, cwd);
11674     lstrcatA(subsrc, "five");
11675     lstrcatA(subsrc, "\\");
11676
11677     /* short dir exists before FileCost */
11678     size = MAX_PATH;
11679     lstrcpyA(path, "kiwi");
11680     r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
11681     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11682     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11683     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11684
11685     lstrcpyA(subsrc, cwd);
11686     lstrcatA(subsrc, "seven");
11687     lstrcatA(subsrc, "\\");
11688
11689     /* long dir exists before FileCost */
11690     size = MAX_PATH;
11691     lstrcpyA(path, "kiwi");
11692     r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
11693     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11694     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11695     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11696
11697     lstrcpyA(subsrc, cwd);
11698     lstrcatA(subsrc, "nine");
11699     lstrcatA(subsrc, "\\");
11700
11701     /* short dir exists before CostFinalize */
11702     size = MAX_PATH;
11703     lstrcpyA(path, "kiwi");
11704     r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
11705     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11706     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11707     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11708
11709     lstrcpyA(subsrc, cwd);
11710     lstrcatA(subsrc, "eleven");
11711     lstrcatA(subsrc, "\\");
11712
11713     /* long dir exists before CostFinalize */
11714     size = MAX_PATH;
11715     lstrcpyA(path, "kiwi");
11716     r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
11717     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11718     ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11719     ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11720
11721     MsiCloseHandle(hpkg);
11722     RemoveDirectoryA("short");
11723     RemoveDirectoryA("long");
11724     RemoveDirectoryA("one");
11725     RemoveDirectoryA("four");
11726     RemoveDirectoryA("five");
11727     RemoveDirectoryA("eight");
11728     RemoveDirectoryA("nine");
11729     RemoveDirectoryA("twelve");
11730     DeleteFileA(msifile);
11731 }
11732
11733 static void test_sourcedir(void)
11734 {
11735     MSIHANDLE hdb, hpkg;
11736     CHAR package[12];
11737     CHAR path[MAX_PATH];
11738     CHAR cwd[MAX_PATH];
11739     CHAR subsrc[MAX_PATH];
11740     DWORD size;
11741     UINT r;
11742
11743     lstrcpyA(cwd, CURR_DIR);
11744     lstrcatA(cwd, "\\");
11745
11746     lstrcpyA(subsrc, cwd);
11747     lstrcatA(subsrc, "long");
11748     lstrcatA(subsrc, "\\");
11749
11750     hdb = create_package_db();
11751     ok( hdb, "failed to create database\n");
11752
11753     r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
11754     ok(r == S_OK, "failed\n");
11755
11756     sprintf(package, "#%u", hdb);
11757     r = MsiOpenPackage(package, &hpkg);
11758     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
11759     {
11760         skip("Not enough rights to perform tests\n");
11761         goto error;
11762     }
11763     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11764
11765     /* properties only */
11766
11767     /* SourceDir prop */
11768     size = MAX_PATH;
11769     lstrcpyA(path, "kiwi");
11770     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11771     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11772     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11773     ok(size == 0, "Expected 0, got %d\n", size);
11774
11775     /* SOURCEDIR prop */
11776     size = MAX_PATH;
11777     lstrcpyA(path, "kiwi");
11778     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11779     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11780     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11781     ok(size == 0, "Expected 0, got %d\n", size);
11782
11783     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
11784
11785     r = MsiDoAction(hpkg, "CostInitialize");
11786     ok(r == ERROR_SUCCESS, "file cost failed\n");
11787
11788     /* SourceDir after CostInitialize */
11789     size = MAX_PATH;
11790     lstrcpyA(path, "kiwi");
11791     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11792     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11793     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11794     ok(size == 0, "Expected 0, got %d\n", size);
11795
11796     /* SOURCEDIR after CostInitialize */
11797     size = MAX_PATH;
11798     lstrcpyA(path, "kiwi");
11799     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11800     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11801     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11802     ok(size == 0, "Expected 0, got %d\n", size);
11803
11804     r = MsiDoAction(hpkg, "FileCost");
11805     ok(r == ERROR_SUCCESS, "file cost failed\n");
11806
11807     /* SourceDir after FileCost */
11808     size = MAX_PATH;
11809     lstrcpyA(path, "kiwi");
11810     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11811     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11812     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11813     ok(size == 0, "Expected 0, got %d\n", size);
11814
11815     /* SOURCEDIR after FileCost */
11816     size = MAX_PATH;
11817     lstrcpyA(path, "kiwi");
11818     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11819     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11820     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11821     ok(size == 0, "Expected 0, got %d\n", size);
11822
11823     r = MsiDoAction(hpkg, "CostFinalize");
11824     ok(r == ERROR_SUCCESS, "file cost failed\n");
11825
11826     /* SourceDir after CostFinalize */
11827     size = MAX_PATH;
11828     lstrcpyA(path, "kiwi");
11829     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11830     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11831     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11832     ok(size == 0, "Expected 0, got %d\n", size);
11833
11834     /* SOURCEDIR after CostFinalize */
11835     size = MAX_PATH;
11836     lstrcpyA(path, "kiwi");
11837     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11838     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11839     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11840     ok(size == 0, "Expected 0, got %d\n", size);
11841
11842     r = MsiDoAction(hpkg, "ResolveSource");
11843     ok(r == ERROR_SUCCESS, "file cost failed\n");
11844
11845     /* SourceDir after ResolveSource */
11846     size = MAX_PATH;
11847     lstrcpyA(path, "kiwi");
11848     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11849     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11850     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11851     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11852
11853     /* SOURCEDIR after ResolveSource */
11854     size = MAX_PATH;
11855     lstrcpyA(path, "kiwi");
11856     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11857     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11858     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11859     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11860
11861     /* random casing */
11862     size = MAX_PATH;
11863     lstrcpyA(path, "kiwi");
11864     r = MsiGetProperty(hpkg, "SoUrCeDiR", path, &size);
11865     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11866     ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11867     ok(size == 0, "Expected 0, got %d\n", size);
11868
11869     MsiCloseHandle(hpkg);
11870
11871     /* reset the package state */
11872     sprintf(package, "#%i", hdb);
11873     r = MsiOpenPackage(package, &hpkg);
11874     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11875
11876     /* test how MsiGetSourcePath affects the properties */
11877
11878     /* SourceDir prop */
11879     size = MAX_PATH;
11880     lstrcpyA(path, "kiwi");
11881     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11882     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11883     todo_wine
11884     {
11885         ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11886         ok(size == 0, "Expected 0, got %d\n", size);
11887     }
11888
11889     size = MAX_PATH;
11890     lstrcpyA(path, "kiwi");
11891     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11892     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11893     ok(!lstrcmpA(path, "kiwi"),
11894        "Expected path to be unchanged, got \"%s\"\n", path);
11895     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11896
11897     /* SourceDir after MsiGetSourcePath */
11898     size = MAX_PATH;
11899     lstrcpyA(path, "kiwi");
11900     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11901     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11902     todo_wine
11903     {
11904         ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11905         ok(size == 0, "Expected 0, got %d\n", size);
11906     }
11907
11908     /* SOURCEDIR prop */
11909     size = MAX_PATH;
11910     lstrcpyA(path, "kiwi");
11911     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11912     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11913     todo_wine
11914     {
11915         ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11916         ok(size == 0, "Expected 0, got %d\n", size);
11917     }
11918
11919     size = MAX_PATH;
11920     lstrcpyA(path, "kiwi");
11921     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11922     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11923     ok(!lstrcmpA(path, "kiwi"),
11924        "Expected path to be unchanged, got \"%s\"\n", path);
11925     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11926
11927     /* SOURCEDIR prop after MsiGetSourcePath */
11928     size = MAX_PATH;
11929     lstrcpyA(path, "kiwi");
11930     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11931     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11932     todo_wine
11933     {
11934         ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11935         ok(size == 0, "Expected 0, got %d\n", size);
11936     }
11937
11938     r = MsiDoAction(hpkg, "CostInitialize");
11939     ok(r == ERROR_SUCCESS, "file cost failed\n");
11940
11941     /* SourceDir after CostInitialize */
11942     size = MAX_PATH;
11943     lstrcpyA(path, "kiwi");
11944     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11945     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11946     todo_wine
11947     {
11948         ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11949         ok(size == 0, "Expected 0, got %d\n", size);
11950     }
11951
11952     size = MAX_PATH;
11953     lstrcpyA(path, "kiwi");
11954     r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11955     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11956     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11957     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11958
11959     /* SourceDir after MsiGetSourcePath */
11960     size = MAX_PATH;
11961     lstrcpyA(path, "kiwi");
11962     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11963     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11964     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11965     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11966
11967     /* SOURCEDIR after CostInitialize */
11968     size = MAX_PATH;
11969     lstrcpyA(path, "kiwi");
11970     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11971     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11972     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11973     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11974
11975     /* SOURCEDIR source path still does not exist */
11976     size = MAX_PATH;
11977     lstrcpyA(path, "kiwi");
11978     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11979     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11980     ok(!lstrcmpA(path, "kiwi"),
11981        "Expected path to be unchanged, got \"%s\"\n", path);
11982     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11983
11984     r = MsiDoAction(hpkg, "FileCost");
11985     ok(r == ERROR_SUCCESS, "file cost failed\n");
11986
11987     /* SourceDir after FileCost */
11988     size = MAX_PATH;
11989     lstrcpyA(path, "kiwi");
11990     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11991     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11992     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11993     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11994
11995     /* SOURCEDIR after FileCost */
11996     size = MAX_PATH;
11997     lstrcpyA(path, "kiwi");
11998     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11999     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12000     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
12001     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
12002
12003     /* SOURCEDIR source path still does not exist */
12004     size = MAX_PATH;
12005     lstrcpyA(path, "kiwi");
12006     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
12007     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
12008     ok(!lstrcmpA(path, "kiwi"),
12009        "Expected path to be unchanged, got \"%s\"\n", path);
12010     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
12011
12012     r = MsiDoAction(hpkg, "CostFinalize");
12013     ok(r == ERROR_SUCCESS, "file cost failed\n");
12014
12015     /* SourceDir after CostFinalize */
12016     size = MAX_PATH;
12017     lstrcpyA(path, "kiwi");
12018     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
12019     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12020     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
12021     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
12022
12023     /* SOURCEDIR after CostFinalize */
12024     size = MAX_PATH;
12025     lstrcpyA(path, "kiwi");
12026     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
12027     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12028     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
12029     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
12030
12031     /* SOURCEDIR source path still does not exist */
12032     size = MAX_PATH;
12033     lstrcpyA(path, "kiwi");
12034     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
12035     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
12036     ok(!lstrcmpA(path, "kiwi"),
12037        "Expected path to be unchanged, got \"%s\"\n", path);
12038     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
12039
12040     r = MsiDoAction(hpkg, "ResolveSource");
12041     ok(r == ERROR_SUCCESS, "file cost failed\n");
12042
12043     /* SourceDir after ResolveSource */
12044     size = MAX_PATH;
12045     lstrcpyA(path, "kiwi");
12046     r = MsiGetProperty(hpkg, "SourceDir", path, &size);
12047     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12048     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
12049     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
12050
12051     /* SOURCEDIR after ResolveSource */
12052     size = MAX_PATH;
12053     lstrcpyA(path, "kiwi");
12054     r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
12055     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12056     ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
12057     ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
12058
12059     /* SOURCEDIR source path still does not exist */
12060     size = MAX_PATH;
12061     lstrcpyA(path, "kiwi");
12062     r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
12063     ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
12064     ok(!lstrcmpA(path, "kiwi"),
12065        "Expected path to be unchanged, got \"%s\"\n", path);
12066     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
12067
12068     MsiCloseHandle(hpkg);
12069
12070 error:
12071     MsiCloseHandle(hdb);
12072     DeleteFileA(msifile);
12073 }
12074
12075 struct access_res
12076 {
12077     BOOL gothandle;
12078     DWORD lasterr;
12079     BOOL ignore;
12080 };
12081
12082 static const struct access_res create[16] =
12083 {
12084     { TRUE, ERROR_SUCCESS, TRUE },
12085     { TRUE, ERROR_SUCCESS, TRUE },
12086     { TRUE, ERROR_SUCCESS, FALSE },
12087     { TRUE, ERROR_SUCCESS, FALSE },
12088     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12089     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12090     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12091     { TRUE, ERROR_SUCCESS, FALSE },
12092     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12093     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12094     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12095     { TRUE, ERROR_SUCCESS, TRUE },
12096     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12097     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12098     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12099     { TRUE, ERROR_SUCCESS, TRUE }
12100 };
12101
12102 static const struct access_res create_commit[16] =
12103 {
12104     { TRUE, ERROR_SUCCESS, TRUE },
12105     { TRUE, ERROR_SUCCESS, TRUE },
12106     { TRUE, ERROR_SUCCESS, FALSE },
12107     { TRUE, ERROR_SUCCESS, FALSE },
12108     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12109     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12110     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12111     { TRUE, ERROR_SUCCESS, FALSE },
12112     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12113     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12114     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12115     { TRUE, ERROR_SUCCESS, TRUE },
12116     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12117     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12118     { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12119     { TRUE, ERROR_SUCCESS, TRUE }
12120 };
12121
12122 static const struct access_res create_close[16] =
12123 {
12124     { TRUE, ERROR_SUCCESS, FALSE },
12125     { TRUE, ERROR_SUCCESS, FALSE },
12126     { TRUE, ERROR_SUCCESS, FALSE },
12127     { TRUE, ERROR_SUCCESS, FALSE },
12128     { TRUE, ERROR_SUCCESS, FALSE },
12129     { TRUE, ERROR_SUCCESS, FALSE },
12130     { TRUE, ERROR_SUCCESS, FALSE },
12131     { TRUE, ERROR_SUCCESS, FALSE },
12132     { TRUE, ERROR_SUCCESS, FALSE },
12133     { TRUE, ERROR_SUCCESS, FALSE },
12134     { TRUE, ERROR_SUCCESS, FALSE },
12135     { TRUE, ERROR_SUCCESS, FALSE },
12136     { TRUE, ERROR_SUCCESS, FALSE },
12137     { TRUE, ERROR_SUCCESS, FALSE },
12138     { TRUE, ERROR_SUCCESS, FALSE },
12139     { TRUE, ERROR_SUCCESS }
12140 };
12141
12142 static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line)
12143 {
12144     DWORD access = 0, share = 0;
12145     DWORD lasterr;
12146     HANDLE hfile;
12147     int i, j, idx = 0;
12148
12149     for (i = 0; i < 4; i++)
12150     {
12151         if (i == 0) access = 0;
12152         if (i == 1) access = GENERIC_READ;
12153         if (i == 2) access = GENERIC_WRITE;
12154         if (i == 3) access = GENERIC_READ | GENERIC_WRITE;
12155
12156         for (j = 0; j < 4; j++)
12157         {
12158             if (ares[idx].ignore)
12159                 continue;
12160
12161             if (j == 0) share = 0;
12162             if (j == 1) share = FILE_SHARE_READ;
12163             if (j == 2) share = FILE_SHARE_WRITE;
12164             if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE;
12165
12166             SetLastError(0xdeadbeef);
12167             hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
12168                                 FILE_ATTRIBUTE_NORMAL, 0);
12169             lasterr = GetLastError();
12170
12171             ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
12172                "(%d, handle, %d): Expected %d, got %d\n",
12173                line, idx, ares[idx].gothandle,
12174                (hfile != INVALID_HANDLE_VALUE));
12175
12176             ok(lasterr == ares[idx].lasterr ||
12177                lasterr == 0xdeadbeef, /* win9x */
12178                "(%d, lasterr, %d): Expected %d, got %d\n",
12179                line, idx, ares[idx].lasterr, lasterr);
12180
12181             CloseHandle(hfile);
12182             idx++;
12183         }
12184     }
12185 }
12186
12187 #define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
12188
12189 static void test_access(void)
12190 {
12191     MSIHANDLE hdb;
12192     UINT r;
12193
12194     r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
12195     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12196
12197     test_file_access(msifile, create);
12198
12199     r = MsiDatabaseCommit(hdb);
12200     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12201
12202     test_file_access(msifile, create_commit);
12203     MsiCloseHandle(hdb);
12204
12205     test_file_access(msifile, create_close);
12206     DeleteFileA(msifile);
12207
12208     r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATEDIRECT, &hdb);
12209     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12210
12211     test_file_access(msifile, create);
12212
12213     r = MsiDatabaseCommit(hdb);
12214     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12215
12216     test_file_access(msifile, create_commit);
12217     MsiCloseHandle(hdb);
12218
12219     test_file_access(msifile, create_close);
12220     DeleteFileA(msifile);
12221 }
12222
12223 static void test_emptypackage(void)
12224 {
12225     MSIHANDLE hpkg = 0, hdb = 0, hsuminfo = 0;
12226     MSIHANDLE hview = 0, hrec = 0;
12227     MSICONDITION condition;
12228     CHAR buffer[MAX_PATH];
12229     DWORD size;
12230     UINT r;
12231
12232     r = MsiOpenPackageA("", &hpkg);
12233     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
12234     {
12235         skip("Not enough rights to perform tests\n");
12236         return;
12237     }
12238     todo_wine
12239     {
12240         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12241     }
12242
12243     hdb = MsiGetActiveDatabase(hpkg);
12244     todo_wine
12245     {
12246         ok(hdb != 0, "Expected a valid database handle\n");
12247     }
12248
12249     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Tables`", &hview);
12250     todo_wine
12251     {
12252         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12253     }
12254     r = MsiViewExecute(hview, 0);
12255     todo_wine
12256     {
12257         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12258     }
12259
12260     r = MsiViewFetch(hview, &hrec);
12261     todo_wine
12262     {
12263         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12264     }
12265
12266     buffer[0] = 0;
12267     size = MAX_PATH;
12268     r = MsiRecordGetString(hrec, 1, buffer, &size);
12269     todo_wine
12270     {
12271         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12272         ok(!lstrcmpA(buffer, "_Property"),
12273            "Expected \"_Property\", got \"%s\"\n", buffer);
12274     }
12275
12276     MsiCloseHandle(hrec);
12277
12278     r = MsiViewFetch(hview, &hrec);
12279     todo_wine
12280     {
12281         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12282     }
12283
12284     size = MAX_PATH;
12285     r = MsiRecordGetString(hrec, 1, buffer, &size);
12286     todo_wine
12287     {
12288         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12289         ok(!lstrcmpA(buffer, "#_FolderCache"),
12290            "Expected \"_Property\", got \"%s\"\n", buffer);
12291     }
12292
12293     MsiCloseHandle(hrec);
12294     MsiViewClose(hview);
12295     MsiCloseHandle(hview);
12296
12297     condition = MsiDatabaseIsTablePersistentA(hdb, "_Property");
12298     todo_wine
12299     {
12300         ok(condition == MSICONDITION_FALSE,
12301            "Expected MSICONDITION_FALSE, got %d\n", condition);
12302     }
12303
12304     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
12305     todo_wine
12306     {
12307         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12308     }
12309     r = MsiViewExecute(hview, 0);
12310     todo_wine
12311     {
12312         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12313     }
12314
12315     /* _Property table is not empty */
12316     r = MsiViewFetch(hview, &hrec);
12317     todo_wine
12318     {
12319         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12320     }
12321
12322     MsiCloseHandle(hrec);
12323     MsiViewClose(hview);
12324     MsiCloseHandle(hview);
12325
12326     condition = MsiDatabaseIsTablePersistentA(hdb, "#_FolderCache");
12327     todo_wine
12328     {
12329         ok(condition == MSICONDITION_FALSE,
12330            "Expected MSICONDITION_FALSE, got %d\n", condition);
12331     }
12332
12333     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `#_FolderCache`", &hview);
12334     todo_wine
12335     {
12336         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12337     }
12338     r = MsiViewExecute(hview, 0);
12339     todo_wine
12340     {
12341         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12342     }
12343
12344     /* #_FolderCache is not empty */
12345     r = MsiViewFetch(hview, &hrec);
12346     todo_wine
12347     {
12348         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12349     }
12350
12351     MsiCloseHandle(hrec);
12352     MsiViewClose(hview);
12353     MsiCloseHandle(hview);
12354
12355     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Streams`", &hview);
12356     todo_wine
12357     {
12358         ok(r == ERROR_BAD_QUERY_SYNTAX,
12359            "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
12360     }
12361
12362     r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Storages`", &hview);
12363     todo_wine
12364     {
12365         ok(r == ERROR_BAD_QUERY_SYNTAX,
12366            "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
12367     }
12368
12369     r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsuminfo);
12370     todo_wine
12371     {
12372         ok(r == ERROR_INSTALL_PACKAGE_INVALID,
12373            "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
12374     }
12375
12376     MsiCloseHandle(hsuminfo);
12377
12378     r = MsiDatabaseCommit(hdb);
12379     todo_wine
12380     {
12381         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12382     }
12383
12384     MsiCloseHandle(hdb);
12385     MsiCloseHandle(hpkg);
12386 }
12387
12388 static void test_MsiGetProductProperty(void)
12389 {
12390     MSIHANDLE hprod, hdb;
12391     CHAR val[MAX_PATH];
12392     CHAR path[MAX_PATH];
12393     CHAR query[MAX_PATH];
12394     CHAR keypath[MAX_PATH*2];
12395     CHAR prodcode[MAX_PATH];
12396     CHAR prod_squashed[MAX_PATH];
12397     HKEY prodkey, userkey, props;
12398     DWORD size;
12399     LONG res;
12400     UINT r;
12401     SC_HANDLE scm;
12402     REGSAM access = KEY_ALL_ACCESS;
12403
12404     scm = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
12405     if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
12406     {
12407         win_skip("Different registry keys on Win9x and WinMe\n");
12408         return;
12409     }
12410     CloseServiceHandle(scm);
12411
12412     GetCurrentDirectoryA(MAX_PATH, path);
12413     lstrcatA(path, "\\");
12414
12415     create_test_guid(prodcode, prod_squashed);
12416
12417     if (is_wow64)
12418         access |= KEY_WOW64_64KEY;
12419
12420     r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
12421     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12422
12423     r = MsiDatabaseCommit(hdb);
12424     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12425
12426     r = set_summary_info(hdb);
12427     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12428
12429     r = run_query(hdb,
12430             "CREATE TABLE `Directory` ( "
12431             "`Directory` CHAR(255) NOT NULL, "
12432             "`Directory_Parent` CHAR(255), "
12433             "`DefaultDir` CHAR(255) NOT NULL "
12434             "PRIMARY KEY `Directory`)");
12435     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12436
12437     r = run_query(hdb,
12438             "CREATE TABLE `Property` ( "
12439             "`Property` CHAR(72) NOT NULL, "
12440             "`Value` CHAR(255) "
12441             "PRIMARY KEY `Property`)");
12442     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12443
12444     sprintf(query, "INSERT INTO `Property` "
12445             "(`Property`, `Value`) "
12446             "VALUES( 'ProductCode', '%s' )", prodcode);
12447     r = run_query(hdb, query);
12448     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12449
12450     r = MsiDatabaseCommit(hdb);
12451     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12452
12453     MsiCloseHandle(hdb);
12454
12455     lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
12456     lstrcatA(keypath, prod_squashed);
12457
12458     res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
12459     if (res == ERROR_ACCESS_DENIED)
12460     {
12461         skip("Not enough rights to perform tests\n");
12462         DeleteFile(msifile);
12463         return;
12464     }
12465     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
12466
12467     lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
12468     lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
12469     lstrcatA(keypath, prod_squashed);
12470
12471     res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
12472     if (res == ERROR_ACCESS_DENIED)
12473     {
12474         skip("Not enough rights to perform tests\n");
12475         RegDeleteKeyA(prodkey, "");
12476         RegCloseKey(prodkey);
12477         return;
12478     }
12479     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
12480
12481     res = RegCreateKeyExA(userkey, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
12482     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
12483
12484     lstrcpyA(val, path);
12485     lstrcatA(val, "\\");
12486     lstrcatA(val, msifile);
12487     res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
12488                          (const BYTE *)val, lstrlenA(val) + 1);
12489     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
12490
12491     hprod = 0xdeadbeef;
12492     r = MsiOpenProductA(prodcode, &hprod);
12493     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12494     ok(hprod != 0 && hprod != 0xdeadbeef, "Expected a valid product handle\n");
12495
12496     /* hProduct is invalid */
12497     size = MAX_PATH;
12498     lstrcpyA(val, "apple");
12499     r = MsiGetProductPropertyA(0xdeadbeef, "ProductCode", val, &size);
12500     ok(r == ERROR_INVALID_HANDLE,
12501        "Expected ERROR_INVALID_HANDLE, got %d\n", r);
12502     ok(!lstrcmpA(val, "apple"),
12503        "Expected val to be unchanged, got \"%s\"\n", val);
12504     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
12505
12506     /* szProperty is NULL */
12507     size = MAX_PATH;
12508     lstrcpyA(val, "apple");
12509     r = MsiGetProductPropertyA(hprod, NULL, val, &size);
12510     ok(r == ERROR_INVALID_PARAMETER,
12511        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
12512     ok(!lstrcmpA(val, "apple"),
12513        "Expected val to be unchanged, got \"%s\"\n", val);
12514     ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
12515
12516     /* szProperty is empty */
12517     size = MAX_PATH;
12518     lstrcpyA(val, "apple");
12519     r = MsiGetProductPropertyA(hprod, "", val, &size);
12520     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12521     ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
12522     ok(size == 0, "Expected 0, got %d\n", size);
12523
12524     /* get the property */
12525     size = MAX_PATH;
12526     lstrcpyA(val, "apple");
12527     r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12528     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12529     ok(!lstrcmpA(val, prodcode),
12530        "Expected \"%s\", got \"%s\"\n", prodcode, val);
12531     ok(size == lstrlenA(prodcode),
12532        "Expected %d, got %d\n", lstrlenA(prodcode), size);
12533
12534     /* lpValueBuf is NULL */
12535     size = MAX_PATH;
12536     r = MsiGetProductPropertyA(hprod, "ProductCode", NULL, &size);
12537     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12538     ok(size == lstrlenA(prodcode),
12539        "Expected %d, got %d\n", lstrlenA(prodcode), size);
12540
12541     /* pcchValueBuf is NULL */
12542     lstrcpyA(val, "apple");
12543     r = MsiGetProductPropertyA(hprod, "ProductCode", val, NULL);
12544     ok(r == ERROR_INVALID_PARAMETER,
12545        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
12546     ok(!lstrcmpA(val, "apple"),
12547        "Expected val to be unchanged, got \"%s\"\n", val);
12548     ok(size == lstrlenA(prodcode),
12549        "Expected %d, got %d\n", lstrlenA(prodcode), size);
12550
12551     /* pcchValueBuf is too small */
12552     size = 4;
12553     lstrcpyA(val, "apple");
12554     r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12555     ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
12556     ok(!strncmp(val, prodcode, 3),
12557        "Expected first 3 chars of \"%s\", got \"%s\"\n", prodcode, val);
12558     ok(size == lstrlenA(prodcode),
12559        "Expected %d, got %d\n", lstrlenA(prodcode), size);
12560
12561     /* pcchValueBuf does not leave room for NULL terminator */
12562     size = lstrlenA(prodcode);
12563     lstrcpyA(val, "apple");
12564     r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12565     ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
12566     ok(!strncmp(val, prodcode, lstrlenA(prodcode) - 1),
12567        "Expected first 37 chars of \"%s\", got \"%s\"\n", prodcode, val);
12568     ok(size == lstrlenA(prodcode),
12569        "Expected %d, got %d\n", lstrlenA(prodcode), size);
12570
12571     /* pcchValueBuf has enough room for NULL terminator */
12572     size = lstrlenA(prodcode) + 1;
12573     lstrcpyA(val, "apple");
12574     r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12575     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12576     ok(!lstrcmpA(val, prodcode),
12577        "Expected \"%s\", got \"%s\"\n", prodcode, val);
12578     ok(size == lstrlenA(prodcode),
12579        "Expected %d, got %d\n", lstrlenA(prodcode), size);
12580
12581     /* nonexistent property */
12582     size = MAX_PATH;
12583     lstrcpyA(val, "apple");
12584     r = MsiGetProductPropertyA(hprod, "IDontExist", val, &size);
12585     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12586     ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
12587     ok(size == 0, "Expected 0, got %d\n", size);
12588
12589     r = MsiSetPropertyA(hprod, "NewProperty", "value");
12590     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12591
12592     /* non-product property set */
12593     size = MAX_PATH;
12594     lstrcpyA(val, "apple");
12595     r = MsiGetProductPropertyA(hprod, "NewProperty", val, &size);
12596     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12597     ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
12598     ok(size == 0, "Expected 0, got %d\n", size);
12599
12600     r = MsiSetPropertyA(hprod, "ProductCode", "value");
12601     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12602
12603     /* non-product property that is also a product property set */
12604     size = MAX_PATH;
12605     lstrcpyA(val, "apple");
12606     r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12607     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12608     ok(!lstrcmpA(val, prodcode),
12609        "Expected \"%s\", got \"%s\"\n", prodcode, val);
12610     ok(size == lstrlenA(prodcode),
12611        "Expected %d, got %d\n", lstrlenA(prodcode), size);
12612
12613     MsiCloseHandle(hprod);
12614
12615     RegDeleteValueA(props, "LocalPackage");
12616     delete_key(props, "", access);
12617     RegCloseKey(props);
12618     delete_key(userkey, "", access);
12619     RegCloseKey(userkey);
12620     delete_key(prodkey, "", access);
12621     RegCloseKey(prodkey);
12622     DeleteFileA(msifile);
12623 }
12624
12625 static void test_MsiSetProperty(void)
12626 {
12627     MSIHANDLE hpkg, hdb, hrec;
12628     CHAR buf[MAX_PATH];
12629     LPCSTR query;
12630     DWORD size;
12631     UINT r;
12632
12633     r = package_from_db(create_package_db(), &hpkg);
12634     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
12635     {
12636         skip("Not enough rights to perform tests\n");
12637         DeleteFile(msifile);
12638         return;
12639     }
12640     ok(r == ERROR_SUCCESS, "Expected a valid package %u\n", r);
12641
12642     /* invalid hInstall */
12643     r = MsiSetPropertyA(0, "Prop", "Val");
12644     ok(r == ERROR_INVALID_HANDLE,
12645        "Expected ERROR_INVALID_HANDLE, got %d\n", r);
12646
12647     /* invalid hInstall */
12648     r = MsiSetPropertyA(0xdeadbeef, "Prop", "Val");
12649     ok(r == ERROR_INVALID_HANDLE,
12650        "Expected ERROR_INVALID_HANDLE, got %d\n", r);
12651
12652     /* szName is NULL */
12653     r = MsiSetPropertyA(hpkg, NULL, "Val");
12654     ok(r == ERROR_INVALID_PARAMETER,
12655        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
12656
12657     /* both szName and szValue are NULL */
12658     r = MsiSetPropertyA(hpkg, NULL, NULL);
12659     ok(r == ERROR_INVALID_PARAMETER,
12660        "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
12661
12662     /* szName is empty */
12663     r = MsiSetPropertyA(hpkg, "", "Val");
12664     ok(r == ERROR_FUNCTION_FAILED,
12665        "Expected ERROR_FUNCTION_FAILED, got %d\n", r);
12666
12667     /* szName is empty and szValue is NULL */
12668     r = MsiSetPropertyA(hpkg, "", NULL);
12669     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12670
12671     /* set a property */
12672     r = MsiSetPropertyA(hpkg, "Prop", "Val");
12673     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12674
12675     /* get the property */
12676     size = MAX_PATH;
12677     r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12678     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12679     ok(!lstrcmpA(buf, "Val"), "Expected \"Val\", got \"%s\"\n", buf);
12680     ok(size == 3, "Expected 3, got %d\n", size);
12681
12682     /* update the property */
12683     r = MsiSetPropertyA(hpkg, "Prop", "Nuvo");
12684     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12685
12686     /* get the property */
12687     size = MAX_PATH;
12688     r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12689     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12690     ok(!lstrcmpA(buf, "Nuvo"), "Expected \"Nuvo\", got \"%s\"\n", buf);
12691     ok(size == 4, "Expected 4, got %d\n", size);
12692
12693     hdb = MsiGetActiveDatabase(hpkg);
12694     ok(hdb != 0, "Expected a valid database handle\n");
12695
12696     /* set prop is not in the _Property table */
12697     query = "SELECT * FROM `_Property` WHERE `Property` = 'Prop'";
12698     r = do_query(hdb, query, &hrec);
12699     ok(r == ERROR_BAD_QUERY_SYNTAX,
12700        "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
12701
12702     /* set prop is not in the Property table */
12703     query = "SELECT * FROM `Property` WHERE `Property` = 'Prop'";
12704     r = do_query(hdb, query, &hrec);
12705     ok(r == ERROR_BAD_QUERY_SYNTAX,
12706        "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
12707
12708     MsiCloseHandle(hdb);
12709
12710     /* szValue is an empty string */
12711     r = MsiSetPropertyA(hpkg, "Prop", "");
12712     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12713
12714     /* try to get the property */
12715     size = MAX_PATH;
12716     r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12717     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12718     ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
12719     ok(size == 0, "Expected 0, got %d\n", size);
12720
12721     /* reset the property */
12722     r = MsiSetPropertyA(hpkg, "Prop", "BlueTap");
12723     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12724
12725     /* delete the property */
12726     r = MsiSetPropertyA(hpkg, "Prop", NULL);
12727     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12728
12729     /* try to get the property */
12730     size = MAX_PATH;
12731     r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12732     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12733     ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
12734     ok(size == 0, "Expected 0, got %d\n", size);
12735
12736     MsiCloseHandle(hpkg);
12737     DeleteFileA(msifile);
12738 }
12739
12740 static void test_MsiApplyMultiplePatches(void)
12741 {
12742     UINT r, type = GetDriveType(NULL);
12743
12744     if (!pMsiApplyMultiplePatchesA) {
12745         win_skip("MsiApplyMultiplePatchesA not found\n");
12746         return;
12747     }
12748
12749     r = pMsiApplyMultiplePatchesA(NULL, NULL, NULL);
12750     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12751
12752     r = pMsiApplyMultiplePatchesA("", NULL, NULL);
12753     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12754
12755     r = pMsiApplyMultiplePatchesA(";", NULL, NULL);
12756     todo_wine
12757     {
12758         if (type == DRIVE_FIXED)
12759             ok(r == ERROR_PATH_NOT_FOUND,
12760                "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
12761         else
12762             ok(r == ERROR_INVALID_NAME,
12763                "Expected ERROR_INVALID_NAME, got %u\n", r);
12764     }
12765
12766     r = pMsiApplyMultiplePatchesA("  ;", NULL, NULL);
12767     todo_wine
12768     {
12769         if (type == DRIVE_FIXED)
12770             ok(r == ERROR_PATCH_PACKAGE_OPEN_FAILED,
12771                "Expected ERROR_PATCH_PACKAGE_OPEN_FAILED, got %u\n", r);
12772         else
12773             ok(r == ERROR_INVALID_NAME,
12774                "Expected ERROR_INVALID_NAME, got %u\n", r);
12775     }
12776
12777     r = pMsiApplyMultiplePatchesA(";;", NULL, NULL);
12778     todo_wine
12779     {
12780         if (type == DRIVE_FIXED)
12781             ok(r == ERROR_PATH_NOT_FOUND,
12782                "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
12783         else
12784             ok(r == ERROR_INVALID_NAME,
12785                "Expected ERROR_INVALID_NAME, got %u\n", r);
12786     }
12787
12788     r = pMsiApplyMultiplePatchesA("nosuchpatchpackage;", NULL, NULL);
12789     todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
12790
12791     r = pMsiApplyMultiplePatchesA(";nosuchpatchpackage", NULL, NULL);
12792     todo_wine
12793     {
12794         if (type == DRIVE_FIXED)
12795             ok(r == ERROR_PATH_NOT_FOUND,
12796                "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
12797         else
12798             ok(r == ERROR_INVALID_NAME,
12799                "Expected ERROR_INVALID_NAME, got %u\n", r);
12800     }
12801
12802     r = pMsiApplyMultiplePatchesA("nosuchpatchpackage;nosuchpatchpackage", NULL, NULL);
12803     todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
12804
12805     r = pMsiApplyMultiplePatchesA("  nosuchpatchpackage  ;  nosuchpatchpackage  ", NULL, NULL);
12806     todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
12807 }
12808
12809 static void test_MsiApplyPatch(void)
12810 {
12811     UINT r;
12812
12813     r = MsiApplyPatch(NULL, NULL, INSTALLTYPE_DEFAULT, NULL);
12814     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12815
12816     r = MsiApplyPatch("", NULL, INSTALLTYPE_DEFAULT, NULL);
12817     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12818 }
12819
12820 START_TEST(package)
12821 {
12822     STATEMGRSTATUS status;
12823     BOOL ret = FALSE;
12824
12825     init_functionpointers();
12826
12827     if (pIsWow64Process)
12828         pIsWow64Process(GetCurrentProcess(), &is_wow64);
12829
12830     GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
12831
12832     /* Create a restore point ourselves so we circumvent the multitude of restore points
12833      * that would have been created by all the installation and removal tests.
12834      *
12835      * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
12836      * creation of restore points.
12837      */
12838     if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
12839     {
12840         memset(&status, 0, sizeof(status));
12841         ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
12842     }
12843
12844     test_createpackage();
12845     test_doaction();
12846     test_gettargetpath_bad();
12847     test_settargetpath();
12848     test_props();
12849     test_property_table();
12850     test_condition();
12851     test_msipackage();
12852     test_formatrecord2();
12853     test_states();
12854     test_getproperty();
12855     test_removefiles();
12856     test_appsearch();
12857     test_appsearch_complocator();
12858     test_appsearch_reglocator();
12859     test_appsearch_inilocator();
12860     test_appsearch_drlocator();
12861     test_featureparents();
12862     test_installprops();
12863     test_launchconditions();
12864     test_ccpsearch();
12865     test_complocator();
12866     test_MsiGetSourcePath();
12867     test_shortlongsource();
12868     test_sourcedir();
12869     test_access();
12870     test_emptypackage();
12871     test_MsiGetProductProperty();
12872     test_MsiSetProperty();
12873     test_MsiApplyMultiplePatches();
12874     test_MsiApplyPatch();
12875
12876     if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
12877     {
12878         ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
12879         if (ret)
12880             remove_restore_point(status.llSequenceNumber);
12881     }
12882 }