[MSI_WINETEST]
[reactos.git] / rostests / winetests / msi / package.c
1 /*
2 * tests for Microsoft Installer functionality
3 *
4 * Copyright 2005 Mike McCormack for CodeWeavers
5 * Copyright 2005 Aric Stewart for CodeWeavers
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22 #define COBJMACROS
23
24 #include <stdio.h>
25 #include <windows.h>
26 #include <msidefs.h>
27 #include <msi.h>
28 #include <msiquery.h>
29 #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 void (WINAPI *pGetNativeSystemInfo)(LPSYSTEM_INFO);
50 static UINT (WINAPI *pGetSystemWow64DirectoryA)(LPSTR, UINT);
51
52 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
53 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
54
55 static void init_functionpointers(void)
56 {
57 HMODULE hmsi = GetModuleHandleA("msi.dll");
58 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
59 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
60 HMODULE hshell32 = GetModuleHandleA("shell32.dll");
61 HMODULE hsrclient;
62
63 #define GET_PROC(mod, func) \
64 p ## func = (void*)GetProcAddress(mod, #func);
65
66 GET_PROC(hmsi, MsiApplyMultiplePatchesA);
67 GET_PROC(hmsi, MsiGetComponentPathExA);
68 GET_PROC(hshell32, SHGetFolderPathA);
69
70 GET_PROC(hadvapi32, ConvertSidToStringSidA);
71 GET_PROC(hadvapi32, GetTokenInformation);
72 GET_PROC(hadvapi32, OpenProcessToken);
73 GET_PROC(hadvapi32, RegDeleteKeyExA)
74 GET_PROC(hadvapi32, RegDeleteKeyExW)
75 GET_PROC(hkernel32, IsWow64Process)
76 GET_PROC(hkernel32, GetNativeSystemInfo)
77 GET_PROC(hkernel32, GetSystemInfo)
78 GET_PROC(hkernel32, GetSystemWow64DirectoryA)
79
80 hsrclient = LoadLibraryA("srclient.dll");
81 GET_PROC(hsrclient, SRRemoveRestorePoint);
82 GET_PROC(hsrclient, SRSetRestorePointA);
83 #undef GET_PROC
84 }
85
86 static BOOL is_process_limited(void)
87 {
88 HANDLE token;
89
90 if (!pOpenProcessToken || !pGetTokenInformation) return FALSE;
91
92 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
93 {
94 BOOL ret;
95 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
96 DWORD size;
97
98 ret = pGetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
99 CloseHandle(token);
100 return (ret && type == TokenElevationTypeLimited);
101 }
102 return FALSE;
103 }
104
105 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
106 {
107 if (pRegDeleteKeyExA)
108 return pRegDeleteKeyExA( key, subkey, access, 0 );
109 return RegDeleteKeyA( key, subkey );
110 }
111
112 static char *get_user_sid(void)
113 {
114 HANDLE token;
115 DWORD size = 0;
116 TOKEN_USER *user;
117 char *usersid = NULL;
118
119 if (!pConvertSidToStringSidA)
120 {
121 win_skip("ConvertSidToStringSidA is not available\n");
122 return NULL;
123 }
124 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
125 GetTokenInformation(token, TokenUser, NULL, size, &size);
126
127 user = HeapAlloc(GetProcessHeap(), 0, size);
128 GetTokenInformation(token, TokenUser, user, size, &size);
129 pConvertSidToStringSidA(user->User.Sid, &usersid);
130 HeapFree(GetProcessHeap(), 0, user);
131
132 CloseHandle(token);
133 return usersid;
134 }
135
136 /* RegDeleteTreeW from dlls/advapi32/registry.c */
137 static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM access)
138 {
139 LONG ret;
140 DWORD dwMaxSubkeyLen, dwMaxValueLen;
141 DWORD dwMaxLen, dwSize;
142 WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
143 HKEY hSubKey = hKey;
144
145 if(lpszSubKey)
146 {
147 ret = RegOpenKeyExW(hKey, lpszSubKey, 0, access, &hSubKey);
148 if (ret) return ret;
149 }
150
151 ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
152 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
153 if (ret) goto cleanup;
154
155 dwMaxSubkeyLen++;
156 dwMaxValueLen++;
157 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
158 if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
159 {
160 /* Name too big: alloc a buffer for it */
161 if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
162 {
163 ret = ERROR_NOT_ENOUGH_MEMORY;
164 goto cleanup;
165 }
166 }
167
168 /* Recursively delete all the subkeys */
169 while (TRUE)
170 {
171 dwSize = dwMaxLen;
172 if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
173 NULL, NULL, NULL)) break;
174
175 ret = package_RegDeleteTreeW(hSubKey, lpszName, access);
176 if (ret) goto cleanup;
177 }
178
179 if (lpszSubKey)
180 {
181 if (pRegDeleteKeyExW)
182 ret = pRegDeleteKeyExW(hKey, lpszSubKey, access, 0);
183 else
184 ret = RegDeleteKeyW(hKey, lpszSubKey);
185 }
186 else
187 while (TRUE)
188 {
189 dwSize = dwMaxLen;
190 if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
191 NULL, NULL, NULL, NULL)) break;
192
193 ret = RegDeleteValueW(hKey, lpszName);
194 if (ret) goto cleanup;
195 }
196
197 cleanup:
198 if (lpszName != szNameBuf)
199 HeapFree(GetProcessHeap(), 0, lpszName);
200 if(lpszSubKey)
201 RegCloseKey(hSubKey);
202 return ret;
203 }
204
205 static BOOL squash_guid(LPCWSTR in, LPWSTR out)
206 {
207 DWORD i,n=1;
208 GUID guid;
209
210 if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid)))
211 return FALSE;
212
213 for(i=0; i<8; i++)
214 out[7-i] = in[n++];
215 n++;
216 for(i=0; i<4; i++)
217 out[11-i] = in[n++];
218 n++;
219 for(i=0; i<4; i++)
220 out[15-i] = in[n++];
221 n++;
222 for(i=0; i<2; i++)
223 {
224 out[17+i*2] = in[n++];
225 out[16+i*2] = in[n++];
226 }
227 n++;
228 for( ; i<8; i++)
229 {
230 out[17+i*2] = in[n++];
231 out[16+i*2] = in[n++];
232 }
233 out[32]=0;
234 return TRUE;
235 }
236
237 static void create_test_guid(LPSTR prodcode, LPSTR squashed)
238 {
239 WCHAR guidW[MAX_PATH];
240 WCHAR squashedW[MAX_PATH];
241 GUID guid;
242 HRESULT hr;
243 int size;
244
245 hr = CoCreateGuid(&guid);
246 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
247
248 size = StringFromGUID2(&guid, guidW, MAX_PATH);
249 ok(size == 39, "Expected 39, got %d\n", hr);
250
251 WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL);
252 squash_guid(guidW, squashedW);
253 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
254 }
255
256 static void set_component_path(LPCSTR filename, MSIINSTALLCONTEXT context,
257 LPCSTR guid, LPSTR usersid, BOOL dir)
258 {
259 WCHAR guidW[MAX_PATH];
260 WCHAR squashedW[MAX_PATH];
261 CHAR squashed[MAX_PATH];
262 CHAR comppath[MAX_PATH];
263 CHAR prodpath[MAX_PATH];
264 CHAR path[MAX_PATH];
265 LPCSTR prod = NULL;
266 HKEY hkey;
267 REGSAM access = KEY_ALL_ACCESS;
268
269 if (is_wow64)
270 access |= KEY_WOW64_64KEY;
271
272 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
273 squash_guid(guidW, squashedW);
274 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
275
276 if (context == MSIINSTALLCONTEXT_MACHINE)
277 {
278 prod = "3D0DAE300FACA1300AD792060BCDAA92";
279 sprintf(comppath,
280 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
281 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
282 lstrcpyA(prodpath,
283 "SOFTWARE\\Classes\\Installer\\"
284 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
285 }
286 else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
287 {
288 prod = "7D2F387510109040002000060BECB6AB";
289 sprintf(comppath,
290 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
291 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
292 sprintf(prodpath,
293 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
294 "Installer\\%s\\Installer\\Products\\"
295 "7D2F387510109040002000060BECB6AB", usersid);
296 }
297 else if (context == MSIINSTALLCONTEXT_USERMANAGED)
298 {
299 prod = "7D2F387510109040002000060BECB6AB";
300 sprintf(comppath,
301 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
302 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
303 sprintf(prodpath,
304 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
305 "Installer\\Managed\\%s\\Installer\\Products\\"
306 "7D2F387510109040002000060BECB6AB", usersid);
307 }
308
309 RegCreateKeyExA(HKEY_LOCAL_MACHINE, comppath, 0, NULL, 0, access, NULL, &hkey, NULL);
310
311 lstrcpyA(path, CURR_DIR);
312 lstrcatA(path, "\\");
313 if (!dir) lstrcatA(path, filename);
314
315 RegSetValueExA(hkey, prod, 0, REG_SZ, (LPBYTE)path, lstrlenA(path));
316 RegCloseKey(hkey);
317
318 RegCreateKeyExA(HKEY_LOCAL_MACHINE, prodpath, 0, NULL, 0, access, NULL, &hkey, NULL);
319 RegCloseKey(hkey);
320 }
321
322 static void delete_component_path(LPCSTR guid, MSIINSTALLCONTEXT context, LPSTR usersid)
323 {
324 WCHAR guidW[MAX_PATH];
325 WCHAR squashedW[MAX_PATH];
326 WCHAR substrW[MAX_PATH];
327 CHAR squashed[MAX_PATH];
328 CHAR comppath[MAX_PATH];
329 CHAR prodpath[MAX_PATH];
330 REGSAM access = KEY_ALL_ACCESS;
331
332 if (is_wow64)
333 access |= KEY_WOW64_64KEY;
334
335 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
336 squash_guid(guidW, squashedW);
337 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
338
339 if (context == MSIINSTALLCONTEXT_MACHINE)
340 {
341 sprintf(comppath,
342 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
343 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
344 lstrcpyA(prodpath,
345 "SOFTWARE\\Classes\\Installer\\"
346 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
347 }
348 else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
349 {
350 sprintf(comppath,
351 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
352 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
353 sprintf(prodpath,
354 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
355 "Installer\\%s\\Installer\\Products\\"
356 "7D2F387510109040002000060BECB6AB", usersid);
357 }
358 else if (context == MSIINSTALLCONTEXT_USERMANAGED)
359 {
360 sprintf(comppath,
361 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
362 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
363 sprintf(prodpath,
364 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
365 "Installer\\Managed\\%s\\Installer\\Products\\"
366 "7D2F387510109040002000060BECB6AB", usersid);
367 }
368
369 MultiByteToWideChar(CP_ACP, 0, comppath, -1, substrW, MAX_PATH);
370 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW, access);
371
372 MultiByteToWideChar(CP_ACP, 0, prodpath, -1, substrW, MAX_PATH);
373 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW, access);
374 }
375
376 static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec)
377 {
378 MSIHANDLE hview = 0;
379 UINT r, ret;
380
381 /* open a select query */
382 r = MsiDatabaseOpenView(hdb, query, &hview);
383 if (r != ERROR_SUCCESS)
384 return r;
385 r = MsiViewExecute(hview, 0);
386 if (r != ERROR_SUCCESS)
387 return r;
388 ret = MsiViewFetch(hview, phrec);
389 r = MsiViewClose(hview);
390 if (r != ERROR_SUCCESS)
391 return r;
392 r = MsiCloseHandle(hview);
393 if (r != ERROR_SUCCESS)
394 return r;
395 return ret;
396 }
397
398 static UINT run_query( MSIHANDLE hdb, const char *query )
399 {
400 MSIHANDLE hview = 0;
401 UINT r;
402
403 r = MsiDatabaseOpenView(hdb, query, &hview);
404 if( r != ERROR_SUCCESS )
405 return r;
406
407 r = MsiViewExecute(hview, 0);
408 if( r == ERROR_SUCCESS )
409 r = MsiViewClose(hview);
410 MsiCloseHandle(hview);
411 return r;
412 }
413
414 static UINT create_component_table( MSIHANDLE hdb )
415 {
416 return run_query( hdb,
417 "CREATE TABLE `Component` ( "
418 "`Component` CHAR(72) NOT NULL, "
419 "`ComponentId` CHAR(38), "
420 "`Directory_` CHAR(72) NOT NULL, "
421 "`Attributes` SHORT NOT NULL, "
422 "`Condition` CHAR(255), "
423 "`KeyPath` CHAR(72) "
424 "PRIMARY KEY `Component`)" );
425 }
426
427 static UINT create_feature_table( MSIHANDLE hdb )
428 {
429 return run_query( hdb,
430 "CREATE TABLE `Feature` ( "
431 "`Feature` CHAR(38) NOT NULL, "
432 "`Feature_Parent` CHAR(38), "
433 "`Title` CHAR(64), "
434 "`Description` CHAR(255), "
435 "`Display` SHORT NOT NULL, "
436 "`Level` SHORT NOT NULL, "
437 "`Directory_` CHAR(72), "
438 "`Attributes` SHORT NOT NULL "
439 "PRIMARY KEY `Feature`)" );
440 }
441
442 static UINT create_feature_components_table( MSIHANDLE hdb )
443 {
444 return run_query( hdb,
445 "CREATE TABLE `FeatureComponents` ( "
446 "`Feature_` CHAR(38) NOT NULL, "
447 "`Component_` CHAR(72) NOT NULL "
448 "PRIMARY KEY `Feature_`, `Component_` )" );
449 }
450
451 static UINT create_file_table( MSIHANDLE hdb )
452 {
453 return run_query( hdb,
454 "CREATE TABLE `File` ("
455 "`File` CHAR(72) NOT NULL, "
456 "`Component_` CHAR(72) NOT NULL, "
457 "`FileName` CHAR(255) NOT NULL, "
458 "`FileSize` LONG NOT NULL, "
459 "`Version` CHAR(72), "
460 "`Language` CHAR(20), "
461 "`Attributes` SHORT, "
462 "`Sequence` SHORT NOT NULL "
463 "PRIMARY KEY `File`)" );
464 }
465
466 static UINT create_remove_file_table( MSIHANDLE hdb )
467 {
468 return run_query( hdb,
469 "CREATE TABLE `RemoveFile` ("
470 "`FileKey` CHAR(72) NOT NULL, "
471 "`Component_` CHAR(72) NOT NULL, "
472 "`FileName` CHAR(255) LOCALIZABLE, "
473 "`DirProperty` CHAR(72) NOT NULL, "
474 "`InstallMode` SHORT NOT NULL "
475 "PRIMARY KEY `FileKey`)" );
476 }
477
478 static UINT create_appsearch_table( MSIHANDLE hdb )
479 {
480 return run_query( hdb,
481 "CREATE TABLE `AppSearch` ("
482 "`Property` CHAR(72) NOT NULL, "
483 "`Signature_` CHAR(72) NOT NULL "
484 "PRIMARY KEY `Property`, `Signature_`)" );
485 }
486
487 static UINT create_reglocator_table( MSIHANDLE hdb )
488 {
489 return run_query( hdb,
490 "CREATE TABLE `RegLocator` ("
491 "`Signature_` CHAR(72) NOT NULL, "
492 "`Root` SHORT NOT NULL, "
493 "`Key` CHAR(255) NOT NULL, "
494 "`Name` CHAR(255), "
495 "`Type` SHORT "
496 "PRIMARY KEY `Signature_`)" );
497 }
498
499 static UINT create_signature_table( MSIHANDLE hdb )
500 {
501 return run_query( hdb,
502 "CREATE TABLE `Signature` ("
503 "`Signature` CHAR(72) NOT NULL, "
504 "`FileName` CHAR(255) NOT NULL, "
505 "`MinVersion` CHAR(20), "
506 "`MaxVersion` CHAR(20), "
507 "`MinSize` LONG, "
508 "`MaxSize` LONG, "
509 "`MinDate` LONG, "
510 "`MaxDate` LONG, "
511 "`Languages` CHAR(255) "
512 "PRIMARY KEY `Signature`)" );
513 }
514
515 static UINT create_launchcondition_table( MSIHANDLE hdb )
516 {
517 return run_query( hdb,
518 "CREATE TABLE `LaunchCondition` ("
519 "`Condition` CHAR(255) NOT NULL, "
520 "`Description` CHAR(255) NOT NULL "
521 "PRIMARY KEY `Condition`)" );
522 }
523
524 static UINT create_property_table( MSIHANDLE hdb )
525 {
526 return run_query( hdb,
527 "CREATE TABLE `Property` ("
528 "`Property` CHAR(72) NOT NULL, "
529 "`Value` CHAR(0) "
530 "PRIMARY KEY `Property`)" );
531 }
532
533 static UINT create_install_execute_sequence_table( MSIHANDLE hdb )
534 {
535 return run_query( hdb,
536 "CREATE TABLE `InstallExecuteSequence` ("
537 "`Action` CHAR(72) NOT NULL, "
538 "`Condition` CHAR(255), "
539 "`Sequence` SHORT "
540 "PRIMARY KEY `Action`)" );
541 }
542
543 static UINT create_media_table( MSIHANDLE hdb )
544 {
545 return run_query( hdb,
546 "CREATE TABLE `Media` ("
547 "`DiskId` SHORT NOT NULL, "
548 "`LastSequence` SHORT NOT NULL, "
549 "`DiskPrompt` CHAR(64), "
550 "`Cabinet` CHAR(255), "
551 "`VolumeLabel` CHAR(32), "
552 "`Source` CHAR(72) "
553 "PRIMARY KEY `DiskId`)" );
554 }
555
556 static UINT create_ccpsearch_table( MSIHANDLE hdb )
557 {
558 return run_query( hdb,
559 "CREATE TABLE `CCPSearch` ("
560 "`Signature_` CHAR(72) NOT NULL "
561 "PRIMARY KEY `Signature_`)" );
562 }
563
564 static UINT create_drlocator_table( MSIHANDLE hdb )
565 {
566 return run_query( hdb,
567 "CREATE TABLE `DrLocator` ("
568 "`Signature_` CHAR(72) NOT NULL, "
569 "`Parent` CHAR(72), "
570 "`Path` CHAR(255), "
571 "`Depth` SHORT "
572 "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
573 }
574
575 static UINT create_complocator_table( MSIHANDLE hdb )
576 {
577 return run_query( hdb,
578 "CREATE TABLE `CompLocator` ("
579 "`Signature_` CHAR(72) NOT NULL, "
580 "`ComponentId` CHAR(38) NOT NULL, "
581 "`Type` SHORT "
582 "PRIMARY KEY `Signature_`)" );
583 }
584
585 static UINT create_inilocator_table( MSIHANDLE hdb )
586 {
587 return run_query( hdb,
588 "CREATE TABLE `IniLocator` ("
589 "`Signature_` CHAR(72) NOT NULL, "
590 "`FileName` CHAR(255) NOT NULL, "
591 "`Section` CHAR(96)NOT NULL, "
592 "`Key` CHAR(128)NOT NULL, "
593 "`Field` SHORT, "
594 "`Type` SHORT "
595 "PRIMARY KEY `Signature_`)" );
596 }
597
598 #define make_add_entry(type, qtext) \
599 static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
600 { \
601 char insert[] = qtext; \
602 char *query; \
603 UINT sz, r; \
604 sz = strlen(values) + sizeof insert; \
605 query = HeapAlloc(GetProcessHeap(),0,sz); \
606 sprintf(query,insert,values); \
607 r = run_query( hdb, query ); \
608 HeapFree(GetProcessHeap(), 0, query); \
609 return r; \
610 }
611
612 make_add_entry(component,
613 "INSERT INTO `Component` "
614 "(`Component`, `ComponentId`, `Directory_`, "
615 "`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
616
617 make_add_entry(directory,
618 "INSERT INTO `Directory` "
619 "(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
620
621 make_add_entry(feature,
622 "INSERT INTO `Feature` "
623 "(`Feature`, `Feature_Parent`, `Title`, `Description`, "
624 "`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
625
626 make_add_entry(feature_components,
627 "INSERT INTO `FeatureComponents` "
628 "(`Feature_`, `Component_`) VALUES( %s )")
629
630 make_add_entry(file,
631 "INSERT INTO `File` "
632 "(`File`, `Component_`, `FileName`, `FileSize`, "
633 "`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
634
635 make_add_entry(appsearch,
636 "INSERT INTO `AppSearch` "
637 "(`Property`, `Signature_`) VALUES( %s )")
638
639 make_add_entry(signature,
640 "INSERT INTO `Signature` "
641 "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
642 " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
643 "VALUES( %s )")
644
645 make_add_entry(launchcondition,
646 "INSERT INTO `LaunchCondition` "
647 "(`Condition`, `Description`) VALUES( %s )")
648
649 make_add_entry(property,
650 "INSERT INTO `Property` (`Property`, `Value`) VALUES( %s )")
651
652 make_add_entry(install_execute_sequence,
653 "INSERT INTO `InstallExecuteSequence` "
654 "(`Action`, `Condition`, `Sequence`) VALUES( %s )")
655
656 make_add_entry(media,
657 "INSERT INTO `Media` "
658 "(`DiskId`, `LastSequence`, `DiskPrompt`, "
659 "`Cabinet`, `VolumeLabel`, `Source`) VALUES( %s )")
660
661 make_add_entry(ccpsearch,
662 "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )")
663
664 make_add_entry(drlocator,
665 "INSERT INTO `DrLocator` "
666 "(`Signature_`, `Parent`, `Path`, `Depth`) VALUES( %s )")
667
668 make_add_entry(complocator,
669 "INSERT INTO `CompLocator` "
670 "(`Signature_`, `ComponentId`, `Type`) VALUES( %s )")
671
672 make_add_entry(inilocator,
673 "INSERT INTO `IniLocator` "
674 "(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) "
675 "VALUES( %s )")
676
677 static UINT add_reglocator_entry( MSIHANDLE hdb, const char *sig, UINT root, const char *path,
678 const char *name, UINT type )
679 {
680 const char insert[] =
681 "INSERT INTO `RegLocator` (`Signature_`, `Root`, `Key`, `Name`, `Type`) "
682 "VALUES( '%s', %u, '%s', '%s', %u )";
683 char *query;
684 UINT sz, r;
685
686 sz = strlen( sig ) + 10 + strlen( path ) + strlen( name ) + 10 + sizeof( insert );
687 query = HeapAlloc( GetProcessHeap(), 0, sz );
688 sprintf( query, insert, sig, root, path, name, type );
689 r = run_query( hdb, query );
690 HeapFree( GetProcessHeap(), 0, query );
691 return r;
692 }
693
694 static UINT set_summary_info(MSIHANDLE hdb)
695 {
696 UINT res;
697 MSIHANDLE suminfo;
698
699 /* build summary info */
700 res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
701 ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
702
703 res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
704 "Installation Database");
705 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
706
707 res = MsiSummaryInfoSetProperty(suminfo,3, VT_LPSTR, 0,NULL,
708 "Installation Database");
709 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
710
711 res = MsiSummaryInfoSetProperty(suminfo,4, VT_LPSTR, 0,NULL,
712 "Wine Hackers");
713 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
714
715 res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
716 ";1033");
717 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
718
719 res = MsiSummaryInfoSetProperty(suminfo,9, VT_LPSTR, 0,NULL,
720 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
721 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
722
723 res = MsiSummaryInfoSetProperty(suminfo, 14, VT_I4, 100, NULL, NULL);
724 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
725
726 res = MsiSummaryInfoSetProperty(suminfo, 15, VT_I4, 0, NULL, NULL);
727 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
728
729 res = MsiSummaryInfoPersist(suminfo);
730 ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
731
732 res = MsiCloseHandle( suminfo);
733 ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
734
735 return res;
736 }
737
738
739 static MSIHANDLE create_package_db(void)
740 {
741 MSIHANDLE hdb = 0;
742 UINT res;
743
744 DeleteFile(msifile);
745
746 /* create an empty database */
747 res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb );
748 ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
749 if( res != ERROR_SUCCESS )
750 return hdb;
751
752 res = MsiDatabaseCommit( hdb );
753 ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
754
755 res = set_summary_info(hdb);
756 ok( res == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", res);
757
758 res = run_query( hdb,
759 "CREATE TABLE `Directory` ( "
760 "`Directory` CHAR(255) NOT NULL, "
761 "`Directory_Parent` CHAR(255), "
762 "`DefaultDir` CHAR(255) NOT NULL "
763 "PRIMARY KEY `Directory`)" );
764 ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
765
766 return hdb;
767 }
768
769 static UINT package_from_db(MSIHANDLE hdb, MSIHANDLE *handle)
770 {
771 UINT res;
772 CHAR szPackage[12];
773 MSIHANDLE hPackage;
774
775 sprintf(szPackage, "#%u", hdb);
776 res = MsiOpenPackage(szPackage, &hPackage);
777 if (res != ERROR_SUCCESS)
778 {
779 MsiCloseHandle(hdb);
780 return res;
781 }
782
783 res = MsiCloseHandle(hdb);
784 if (res != ERROR_SUCCESS)
785 {
786 MsiCloseHandle(hPackage);
787 return res;
788 }
789
790 *handle = hPackage;
791 return ERROR_SUCCESS;
792 }
793
794 static void create_test_file(const CHAR *name)
795 {
796 HANDLE file;
797 DWORD written;
798
799 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
800 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
801 WriteFile(file, name, strlen(name), &written, NULL);
802 WriteFile(file, "\n", strlen("\n"), &written, NULL);
803 CloseHandle(file);
804 }
805
806 typedef struct _tagVS_VERSIONINFO
807 {
808 WORD wLength;
809 WORD wValueLength;
810 WORD wType;
811 WCHAR szKey[1];
812 WORD wPadding1[1];
813 VS_FIXEDFILEINFO Value;
814 WORD wPadding2[1];
815 WORD wChildren[1];
816 } VS_VERSIONINFO;
817
818 #define roundoffs(a, b, r) (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))
819 #define roundpos(a, b, r) (((BYTE *)(a)) + roundoffs(a, b, r))
820
821 static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls)
822 {
823 VS_VERSIONINFO *pVerInfo;
824 VS_FIXEDFILEINFO *pFixedInfo;
825 LPBYTE buffer, ofs;
826 CHAR path[MAX_PATH];
827 DWORD handle, size;
828 HANDLE resource;
829 BOOL ret = FALSE;
830
831 GetSystemDirectory(path, MAX_PATH);
832 /* Some dlls can't be updated on Vista/W2K8 */
833 lstrcatA(path, "\\version.dll");
834
835 CopyFileA(path, name, FALSE);
836
837 size = GetFileVersionInfoSize(path, &handle);
838 buffer = HeapAlloc(GetProcessHeap(), 0, size);
839
840 GetFileVersionInfoA(path, 0, size, buffer);
841
842 pVerInfo = (VS_VERSIONINFO *)buffer;
843 ofs = (BYTE *)&pVerInfo->szKey[lstrlenW(pVerInfo->szKey) + 1];
844 pFixedInfo = (VS_FIXEDFILEINFO *)roundpos(pVerInfo, ofs, 4);
845
846 pFixedInfo->dwFileVersionMS = ms;
847 pFixedInfo->dwFileVersionLS = ls;
848 pFixedInfo->dwProductVersionMS = ms;
849 pFixedInfo->dwProductVersionLS = ls;
850
851 resource = BeginUpdateResource(name, FALSE);
852 if (!resource)
853 goto done;
854
855 if (!UpdateResource(resource, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO),
856 MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), buffer, size))
857 goto done;
858
859 if (!EndUpdateResource(resource, FALSE))
860 goto done;
861
862 ret = TRUE;
863
864 done:
865 HeapFree(GetProcessHeap(), 0, buffer);
866 return ret;
867 }
868
869 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
870 {
871 RESTOREPOINTINFOA spec;
872
873 spec.dwEventType = event_type;
874 spec.dwRestorePtType = APPLICATION_INSTALL;
875 spec.llSequenceNumber = status->llSequenceNumber;
876 lstrcpyA(spec.szDescription, "msitest restore point");
877
878 return pSRSetRestorePointA(&spec, status);
879 }
880
881 static void remove_restore_point(DWORD seq_number)
882 {
883 DWORD res;
884
885 res = pSRRemoveRestorePoint(seq_number);
886 if (res != ERROR_SUCCESS)
887 trace("Failed to remove the restore point : %08x\n", res);
888 }
889
890 static void test_createpackage(void)
891 {
892 MSIHANDLE hPackage = 0;
893 UINT res;
894
895 res = package_from_db(create_package_db(), &hPackage);
896 if (res == ERROR_INSTALL_PACKAGE_REJECTED)
897 {
898 skip("Not enough rights to perform tests\n");
899 DeleteFile(msifile);
900 return;
901 }
902 ok( res == ERROR_SUCCESS, " Failed to create package %u\n", res );
903
904 res = MsiCloseHandle( hPackage);
905 ok( res == ERROR_SUCCESS , "Failed to close package\n" );
906 DeleteFile(msifile);
907 }
908
909 static void test_doaction( void )
910 {
911 MSIHANDLE hpkg;
912 UINT r;
913
914 r = MsiDoAction( -1, NULL );
915 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
916
917 r = package_from_db(create_package_db(), &hpkg);
918 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
919 {
920 skip("Not enough rights to perform tests\n");
921 DeleteFile(msifile);
922 return;
923 }
924 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
925
926 r = MsiDoAction(hpkg, NULL);
927 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
928
929 r = MsiDoAction(0, "boo");
930 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
931
932 r = MsiDoAction(hpkg, "boo");
933 ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
934
935 MsiCloseHandle( hpkg );
936 DeleteFile(msifile);
937 }
938
939 static void test_gettargetpath_bad(void)
940 {
941 static const WCHAR boo[] = {'b','o','o',0};
942 static const WCHAR empty[] = {0};
943 char buffer[0x80];
944 WCHAR bufferW[0x80];
945 MSIHANDLE hpkg;
946 DWORD sz;
947 UINT r;
948
949 r = package_from_db(create_package_db(), &hpkg);
950 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
951 {
952 skip("Not enough rights to perform tests\n");
953 DeleteFile(msifile);
954 return;
955 }
956 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
957
958 r = MsiGetTargetPath( 0, NULL, NULL, NULL );
959 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
960
961 r = MsiGetTargetPath( 0, NULL, NULL, &sz );
962 ok( r == ERROR_INVALID_PARAMETER, "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( 0, "boo", NULL, NULL );
968 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
969
970 r = MsiGetTargetPath( hpkg, "boo", NULL, NULL );
971 ok( r == ERROR_DIRECTORY, "wrong return val\n");
972
973 r = MsiGetTargetPath( hpkg, "boo", buffer, NULL );
974 ok( r == ERROR_DIRECTORY, "wrong return val\n");
975
976 sz = 0;
977 r = MsiGetTargetPath( hpkg, "", buffer, &sz );
978 ok( r == ERROR_DIRECTORY, "wrong return val\n");
979
980 r = MsiGetTargetPathW( 0, NULL, NULL, NULL );
981 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
982
983 r = MsiGetTargetPathW( 0, NULL, NULL, &sz );
984 ok( r == ERROR_INVALID_PARAMETER, "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( 0, boo, NULL, NULL );
990 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
991
992 r = MsiGetTargetPathW( hpkg, boo, NULL, NULL );
993 ok( r == ERROR_DIRECTORY, "wrong return val\n");
994
995 r = MsiGetTargetPathW( hpkg, boo, bufferW, NULL );
996 ok( r == ERROR_DIRECTORY, "wrong return val\n");
997
998 sz = 0;
999 r = MsiGetTargetPathW( hpkg, empty, bufferW, &sz );
1000 ok( r == ERROR_DIRECTORY, "wrong return val\n");
1001
1002 MsiCloseHandle( hpkg );
1003 DeleteFile(msifile);
1004 }
1005
1006 static void query_file_path(MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
1007 {
1008 UINT r;
1009 DWORD size;
1010 MSIHANDLE rec;
1011
1012 rec = MsiCreateRecord( 1 );
1013 ok(rec, "MsiCreate record failed\n");
1014
1015 r = MsiRecordSetString( rec, 0, file );
1016 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
1017
1018 size = MAX_PATH;
1019 r = MsiFormatRecord( hpkg, rec, buff, &size );
1020 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
1021
1022 MsiCloseHandle( rec );
1023 }
1024
1025 static void test_settargetpath(void)
1026 {
1027 char tempdir[MAX_PATH+8], buffer[MAX_PATH], file[MAX_PATH];
1028 DWORD sz;
1029 MSIHANDLE hpkg;
1030 UINT r;
1031 MSIHANDLE hdb;
1032
1033 hdb = create_package_db();
1034 ok ( hdb, "failed to create package database\n" );
1035
1036 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
1037 ok( r == S_OK, "failed to add directory entry: %d\n" , r );
1038
1039 r = create_component_table( hdb );
1040 ok( r == S_OK, "cannot create Component table: %d\n", r );
1041
1042 r = add_component_entry( hdb, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
1043 ok( r == S_OK, "cannot add dummy component: %d\n", r );
1044
1045 r = add_component_entry( hdb, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
1046 ok( r == S_OK, "cannot add test component: %d\n", r );
1047
1048 r = create_feature_table( hdb );
1049 ok( r == S_OK, "cannot create Feature table: %d\n", r );
1050
1051 r = add_feature_entry( hdb, "'TestFeature', '', '', '', 0, 1, '', 0" );
1052 ok( r == ERROR_SUCCESS, "cannot add TestFeature to Feature table: %d\n", r );
1053
1054 r = create_feature_components_table( hdb );
1055 ok( r == S_OK, "cannot create FeatureComponents table: %d\n", r );
1056
1057 r = add_feature_components_entry( hdb, "'TestFeature', 'RootComp'" );
1058 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
1059
1060 r = add_feature_components_entry( hdb, "'TestFeature', 'TestComp'" );
1061 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
1062
1063 add_directory_entry( hdb, "'TestParent', 'TARGETDIR', 'TestParent'" );
1064 add_directory_entry( hdb, "'TestDir', 'TestParent', 'TestDir'" );
1065
1066 r = create_file_table( hdb );
1067 ok( r == S_OK, "cannot create File table: %d\n", r );
1068
1069 r = add_file_entry( hdb, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
1070 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
1071
1072 r = add_file_entry( hdb, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
1073 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
1074
1075 r = package_from_db( hdb, &hpkg );
1076 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
1077 {
1078 skip("Not enough rights to perform tests\n");
1079 DeleteFile(msifile);
1080 return;
1081 }
1082 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
1083
1084 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1085
1086 r = MsiDoAction( hpkg, "CostInitialize");
1087 ok( r == ERROR_SUCCESS, "cost init failed\n");
1088
1089 r = MsiDoAction( hpkg, "FileCost");
1090 ok( r == ERROR_SUCCESS, "file cost failed\n");
1091
1092 r = MsiDoAction( hpkg, "CostFinalize");
1093 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
1094
1095 r = MsiSetTargetPath( 0, NULL, NULL );
1096 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1097
1098 r = MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
1099 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1100
1101 r = MsiSetTargetPath( hpkg, "boo", NULL );
1102 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1103
1104 r = MsiSetTargetPath( hpkg, "boo", "c:\\bogusx" );
1105 ok( r == ERROR_DIRECTORY, "wrong return val\n");
1106
1107 sz = sizeof tempdir - 1;
1108 r = MsiGetTargetPath( hpkg, "TARGETDIR", tempdir, &sz );
1109 sprintf( file, "%srootfile.txt", tempdir );
1110 buffer[0] = 0;
1111 query_file_path( hpkg, "[#RootFile]", buffer );
1112 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1113 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer );
1114
1115 GetTempFileName( tempdir, "_wt", 0, buffer );
1116 sprintf( tempdir, "%s\\subdir", buffer );
1117
1118 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1119 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1120 "MsiSetTargetPath on file returned %d\n", r );
1121
1122 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1123 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1124 "MsiSetTargetPath on 'subdir' of file returned %d\n", r );
1125
1126 DeleteFile( buffer );
1127
1128 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1129 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1130
1131 r = GetFileAttributes( buffer );
1132 ok ( r == INVALID_FILE_ATTRIBUTES, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r );
1133
1134 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1135 ok( r == ERROR_SUCCESS, "MsiSetTargetPath on subsubdir returned %d\n", r );
1136
1137 sz = sizeof buffer - 1;
1138 lstrcat( tempdir, "\\" );
1139 r = MsiGetTargetPath( hpkg, "TARGETDIR", buffer, &sz );
1140 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1141 ok( !lstrcmp(buffer, tempdir), "Expected %s, got %s\n", tempdir, buffer);
1142
1143 sprintf( file, "%srootfile.txt", tempdir );
1144 query_file_path( hpkg, "[#RootFile]", buffer );
1145 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer);
1146
1147 sz = sizeof(buffer);
1148 r = MsiGetPropertyA( hpkg, "TestParent", buffer, &sz );
1149 ok( r == ERROR_SUCCESS, "MsiGetProperty returned %u\n", r );
1150 lstrcatA( tempdir, "TestParent\\" );
1151 ok( !lstrcmpi(buffer, tempdir), "Expected \"%s\", got \"%s\"\n", tempdir, buffer );
1152
1153 r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two" );
1154 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1155
1156 sz = sizeof(buffer);
1157 r = MsiGetPropertyA( hpkg, "TestParent", buffer, &sz );
1158 ok( r == ERROR_SUCCESS, "MsiGetProperty returned %u\n", r );
1159 ok( lstrcmpi(buffer, "C:\\one\\two\\TestDir\\"),
1160 "Expected \"C:\\one\\two\\TestDir\\\", got \"%s\"\n", buffer );
1161
1162 query_file_path( hpkg, "[#TestFile]", buffer );
1163 ok( !lstrcmpi(buffer, "C:\\one\\two\\TestDir\\testfile.txt"),
1164 "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer );
1165
1166 sz = sizeof buffer - 1;
1167 r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
1168 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1169 ok( !lstrcmpi(buffer, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer);
1170
1171 r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two\\three" );
1172 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1173
1174 sz = sizeof buffer - 1;
1175 r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
1176 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1177 ok( !lstrcmpi(buffer, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", buffer);
1178
1179 r = MsiSetTargetPath( hpkg, "TestParent", "C:\\\\one\\\\two " );
1180 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1181
1182 sz = sizeof buffer - 1;
1183 r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
1184 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1185 ok( !lstrcmpi(buffer, "C:\\one\\two\\"), "Expected \"C:\\one\\two\\\", got %s\n", buffer);
1186
1187 MsiCloseHandle( hpkg );
1188 }
1189
1190 static void test_condition(void)
1191 {
1192 static const WCHAR cond1[] = {'\"','a',0x30a,'\"','<','\"',0xe5,'\"',0};
1193 static const WCHAR cond2[] = {'\"','a',0x30a,'\"','>','\"',0xe5,'\"',0};
1194 static const WCHAR cond3[] = {'\"','a',0x30a,'\"','<','>','\"',0xe5,'\"',0};
1195 static const WCHAR cond4[] = {'\"','a',0x30a,'\"','=','\"',0xe5,'\"',0};
1196 MSICONDITION r;
1197 MSIHANDLE hpkg;
1198
1199 r = package_from_db(create_package_db(), &hpkg);
1200 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
1201 {
1202 skip("Not enough rights to perform tests\n");
1203 DeleteFile(msifile);
1204 return;
1205 }
1206 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
1207
1208 r = MsiEvaluateCondition(0, NULL);
1209 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1210
1211 r = MsiEvaluateCondition(hpkg, NULL);
1212 ok( r == MSICONDITION_NONE, "wrong return val\n");
1213
1214 r = MsiEvaluateCondition(hpkg, "");
1215 ok( r == MSICONDITION_NONE, "wrong return val\n");
1216
1217 r = MsiEvaluateCondition(hpkg, "1");
1218 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1219
1220 r = MsiEvaluateCondition(hpkg, "0");
1221 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1222
1223 r = MsiEvaluateCondition(hpkg, "-1");
1224 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1225
1226 r = MsiEvaluateCondition(hpkg, "0 = 0");
1227 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1228
1229 r = MsiEvaluateCondition(hpkg, "0 <> 0");
1230 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1231
1232 r = MsiEvaluateCondition(hpkg, "0 = 1");
1233 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1234
1235 r = MsiEvaluateCondition(hpkg, "0 > 1");
1236 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1237
1238 r = MsiEvaluateCondition(hpkg, "0 ~> 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, "1 ~> 1");
1245 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1246
1247 r = MsiEvaluateCondition(hpkg, "0 >= 1");
1248 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1249
1250 r = MsiEvaluateCondition(hpkg, "0 ~>= 1");
1251 ok( r == MSICONDITION_FALSE, "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, "1 ~>= 1");
1257 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1258
1259 r = MsiEvaluateCondition(hpkg, "0 < 1");
1260 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1261
1262 r = MsiEvaluateCondition(hpkg, "0 ~< 1");
1263 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1264
1265 r = MsiEvaluateCondition(hpkg, "1 < 1");
1266 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1267
1268 r = MsiEvaluateCondition(hpkg, "1 ~< 1");
1269 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1270
1271 r = MsiEvaluateCondition(hpkg, "0 <= 1");
1272 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1273
1274 r = MsiEvaluateCondition(hpkg, "0 ~<= 1");
1275 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1276
1277 r = MsiEvaluateCondition(hpkg, "1 <= 1");
1278 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1279
1280 r = MsiEvaluateCondition(hpkg, "1 ~<= 1");
1281 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1282
1283 r = MsiEvaluateCondition(hpkg, "0 >=");
1284 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1285
1286 r = MsiEvaluateCondition(hpkg, " ");
1287 ok( r == MSICONDITION_NONE, "wrong return val\n");
1288
1289 r = MsiEvaluateCondition(hpkg, "LicView <> \"1\"");
1290 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1291
1292 r = MsiEvaluateCondition(hpkg, "LicView <> \"0\"");
1293 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1294
1295 r = MsiEvaluateCondition(hpkg, "LicView <> LicView");
1296 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1297
1298 r = MsiEvaluateCondition(hpkg, "not 0");
1299 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1300
1301 r = MsiEvaluateCondition(hpkg, "not LicView");
1302 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1303
1304 r = MsiEvaluateCondition(hpkg, "\"Testing\" ~<< \"Testing\"");
1305 ok (r == MSICONDITION_TRUE, "wrong return val\n");
1306
1307 r = MsiEvaluateCondition(hpkg, "LicView ~<< \"Testing\"");
1308 ok (r == MSICONDITION_FALSE, "wrong return val\n");
1309
1310 r = MsiEvaluateCondition(hpkg, "Not LicView ~<< \"Testing\"");
1311 ok (r == MSICONDITION_TRUE, "wrong return val\n");
1312
1313 r = MsiEvaluateCondition(hpkg, "not \"A\"");
1314 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1315
1316 r = MsiEvaluateCondition(hpkg, "~not \"A\"");
1317 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1318
1319 r = MsiEvaluateCondition(hpkg, "\"0\"");
1320 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1321
1322 r = MsiEvaluateCondition(hpkg, "1 and 2");
1323 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1324
1325 r = MsiEvaluateCondition(hpkg, "not 0 and 3");
1326 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1327
1328 r = MsiEvaluateCondition(hpkg, "not 0 and 0");
1329 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1330
1331 r = MsiEvaluateCondition(hpkg, "not 0 or 1");
1332 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1333
1334 r = MsiEvaluateCondition(hpkg, "(0)");
1335 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1336
1337 r = MsiEvaluateCondition(hpkg, "(((((1))))))");
1338 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1339
1340 r = MsiEvaluateCondition(hpkg, "(((((1)))))");
1341 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1342
1343 r = MsiEvaluateCondition(hpkg, " \"A\" < \"B\" ");
1344 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1345
1346 r = MsiEvaluateCondition(hpkg, " \"A\" > \"B\" ");
1347 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1348
1349 r = MsiEvaluateCondition(hpkg, " \"1\" > \"12\" ");
1350 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1351
1352 r = MsiEvaluateCondition(hpkg, " \"100\" < \"21\" ");
1353 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1354
1355 r = MsiEvaluateCondition(hpkg, "0 < > 0");
1356 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1357
1358 r = MsiEvaluateCondition(hpkg, "(1<<1) == 2");
1359 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1360
1361 r = MsiEvaluateCondition(hpkg, " \"A\" = \"a\" ");
1362 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1363
1364 r = MsiEvaluateCondition(hpkg, " \"A\" ~ = \"a\" ");
1365 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1366
1367 r = MsiEvaluateCondition(hpkg, " \"A\" ~= \"a\" ");
1368 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1369
1370 r = MsiEvaluateCondition(hpkg, " \"A\" ~= 1 ");
1371 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1372
1373 r = MsiEvaluateCondition(hpkg, " \"A\" = 1 ");
1374 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1375
1376 r = MsiEvaluateCondition(hpkg, " 1 ~= 1 ");
1377 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1378
1379 r = MsiEvaluateCondition(hpkg, " 1 ~= \"1\" ");
1380 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1381
1382 r = MsiEvaluateCondition(hpkg, " 1 = \"1\" ");
1383 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1384
1385 r = MsiEvaluateCondition(hpkg, " 0 = \"1\" ");
1386 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1387
1388 r = MsiEvaluateCondition(hpkg, " 0 < \"100\" ");
1389 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1390
1391 r = MsiEvaluateCondition(hpkg, " 100 > \"0\" ");
1392 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1393
1394 r = MsiEvaluateCondition(hpkg, "1 XOR 1");
1395 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1396
1397 r = MsiEvaluateCondition(hpkg, "1 IMP 1");
1398 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1399
1400 r = MsiEvaluateCondition(hpkg, "1 IMP 0");
1401 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1402
1403 r = MsiEvaluateCondition(hpkg, "0 IMP 0");
1404 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1405
1406 r = MsiEvaluateCondition(hpkg, "0 EQV 0");
1407 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1408
1409 r = MsiEvaluateCondition(hpkg, "0 EQV 1");
1410 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1411
1412 r = MsiEvaluateCondition(hpkg, "1 IMP 1 OR 0");
1413 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1414
1415 r = MsiEvaluateCondition(hpkg, "1 IMPL 1");
1416 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1417
1418 r = MsiEvaluateCondition(hpkg, "\"ASFD\" >< \"S\" ");
1419 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1420
1421 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"s\" ");
1422 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1423
1424 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"\" ");
1425 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1426
1427 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"sss\" ");
1428 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1429
1430 MsiSetProperty(hpkg, "mm", "5" );
1431
1432 r = MsiEvaluateCondition(hpkg, "mm = 5");
1433 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1434
1435 r = MsiEvaluateCondition(hpkg, "mm < 6");
1436 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1437
1438 r = MsiEvaluateCondition(hpkg, "mm <= 5");
1439 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1440
1441 r = MsiEvaluateCondition(hpkg, "mm > 4");
1442 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1443
1444 r = MsiEvaluateCondition(hpkg, "mm < 12");
1445 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1446
1447 r = MsiEvaluateCondition(hpkg, "mm = \"5\"");
1448 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1449
1450 r = MsiEvaluateCondition(hpkg, "0 = \"\"");
1451 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1452
1453 r = MsiEvaluateCondition(hpkg, "0 AND \"\"");
1454 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1455
1456 r = MsiEvaluateCondition(hpkg, "1 AND \"\"");
1457 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1458
1459 r = MsiEvaluateCondition(hpkg, "1 AND \"1\"");
1460 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1461
1462 r = MsiEvaluateCondition(hpkg, "3 >< 1");
1463 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1464
1465 r = MsiEvaluateCondition(hpkg, "3 >< 4");
1466 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1467
1468 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 0");
1469 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1470
1471 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1");
1472 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1473
1474 r = MsiEvaluateCondition(hpkg, "NOT 1 OR 0");
1475 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1476
1477 r = MsiEvaluateCondition(hpkg, "0 AND 1 OR 1");
1478 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1479
1480 r = MsiEvaluateCondition(hpkg, "0 AND 0 OR 1");
1481 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1482
1483 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1 OR 0");
1484 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1485
1486 r = MsiEvaluateCondition(hpkg, "_1 = _1");
1487 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1488
1489 r = MsiEvaluateCondition(hpkg, "( 1 AND 1 ) = 2");
1490 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1491
1492 r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
1493 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1494
1495 r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1496 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1497
1498 r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
1499 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1500
1501 r = MsiEvaluateCondition(hpkg, "NOT 1 AND 0");
1502 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1503
1504 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1505 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1506
1507 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1508 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1509
1510 r = MsiEvaluateCondition(hpkg, "bandalmael<0");
1511 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1512
1513 r = MsiEvaluateCondition(hpkg, "bandalmael>0");
1514 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1515
1516 r = MsiEvaluateCondition(hpkg, "bandalmael>=0");
1517 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1518
1519 r = MsiEvaluateCondition(hpkg, "bandalmael<=0");
1520 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1521
1522 r = MsiEvaluateCondition(hpkg, "bandalmael~<>0");
1523 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1524
1525 MsiSetProperty(hpkg, "bandalmael", "0" );
1526 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1527 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1528
1529 MsiSetProperty(hpkg, "bandalmael", "" );
1530 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1531 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1532
1533 MsiSetProperty(hpkg, "bandalmael", "asdf" );
1534 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1535 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1536
1537 MsiSetProperty(hpkg, "bandalmael", "0asdf" );
1538 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1539 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1540
1541 MsiSetProperty(hpkg, "bandalmael", "0 " );
1542 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1543 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1544
1545 MsiSetProperty(hpkg, "bandalmael", "-0" );
1546 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1547 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1548
1549 MsiSetProperty(hpkg, "bandalmael", "0000000000000" );
1550 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1551 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1552
1553 MsiSetProperty(hpkg, "bandalmael", "--0" );
1554 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1555 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1556
1557 MsiSetProperty(hpkg, "bandalmael", "0x00" );
1558 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1559 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1560
1561 MsiSetProperty(hpkg, "bandalmael", "-" );
1562 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1563 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1564
1565 MsiSetProperty(hpkg, "bandalmael", "+0" );
1566 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1567 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1568
1569 MsiSetProperty(hpkg, "bandalmael", "0.0" );
1570 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1571 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1572 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1573 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1574
1575 MsiSetProperty(hpkg, "one", "hi");
1576 MsiSetProperty(hpkg, "two", "hithere");
1577 r = MsiEvaluateCondition(hpkg, "one >< two");
1578 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1579
1580 MsiSetProperty(hpkg, "one", "hithere");
1581 MsiSetProperty(hpkg, "two", "hi");
1582 r = MsiEvaluateCondition(hpkg, "one >< two");
1583 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1584
1585 MsiSetProperty(hpkg, "one", "hello");
1586 MsiSetProperty(hpkg, "two", "hi");
1587 r = MsiEvaluateCondition(hpkg, "one >< two");
1588 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1589
1590 MsiSetProperty(hpkg, "one", "hellohithere");
1591 MsiSetProperty(hpkg, "two", "hi");
1592 r = MsiEvaluateCondition(hpkg, "one >< two");
1593 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1594
1595 MsiSetProperty(hpkg, "one", "");
1596 MsiSetProperty(hpkg, "two", "hi");
1597 r = MsiEvaluateCondition(hpkg, "one >< two");
1598 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1599
1600 MsiSetProperty(hpkg, "one", "hi");
1601 MsiSetProperty(hpkg, "two", "");
1602 r = MsiEvaluateCondition(hpkg, "one >< two");
1603 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1604
1605 MsiSetProperty(hpkg, "one", "");
1606 MsiSetProperty(hpkg, "two", "");
1607 r = MsiEvaluateCondition(hpkg, "one >< two");
1608 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1609
1610 MsiSetProperty(hpkg, "one", "1234");
1611 MsiSetProperty(hpkg, "two", "1");
1612 r = MsiEvaluateCondition(hpkg, "one >< two");
1613 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1614
1615 MsiSetProperty(hpkg, "one", "one 1234");
1616 MsiSetProperty(hpkg, "two", "1");
1617 r = MsiEvaluateCondition(hpkg, "one >< two");
1618 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1619
1620 MsiSetProperty(hpkg, "one", "hithere");
1621 MsiSetProperty(hpkg, "two", "hi");
1622 r = MsiEvaluateCondition(hpkg, "one << two");
1623 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1624
1625 MsiSetProperty(hpkg, "one", "hi");
1626 MsiSetProperty(hpkg, "two", "hithere");
1627 r = MsiEvaluateCondition(hpkg, "one << two");
1628 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1629
1630 MsiSetProperty(hpkg, "one", "hi");
1631 MsiSetProperty(hpkg, "two", "hi");
1632 r = MsiEvaluateCondition(hpkg, "one << two");
1633 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1634
1635 MsiSetProperty(hpkg, "one", "abcdhithere");
1636 MsiSetProperty(hpkg, "two", "hi");
1637 r = MsiEvaluateCondition(hpkg, "one << two");
1638 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1639
1640 MsiSetProperty(hpkg, "one", "");
1641 MsiSetProperty(hpkg, "two", "hi");
1642 r = MsiEvaluateCondition(hpkg, "one << two");
1643 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1644
1645 MsiSetProperty(hpkg, "one", "hithere");
1646 MsiSetProperty(hpkg, "two", "");
1647 r = MsiEvaluateCondition(hpkg, "one << two");
1648 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1649
1650 MsiSetProperty(hpkg, "one", "");
1651 MsiSetProperty(hpkg, "two", "");
1652 r = MsiEvaluateCondition(hpkg, "one << two");
1653 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1654
1655 MsiSetProperty(hpkg, "one", "1234");
1656 MsiSetProperty(hpkg, "two", "1");
1657 r = MsiEvaluateCondition(hpkg, "one << two");
1658 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1659
1660 MsiSetProperty(hpkg, "one", "1234 one");
1661 MsiSetProperty(hpkg, "two", "1");
1662 r = MsiEvaluateCondition(hpkg, "one << two");
1663 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1664
1665 MsiSetProperty(hpkg, "one", "hithere");
1666 MsiSetProperty(hpkg, "two", "there");
1667 r = MsiEvaluateCondition(hpkg, "one >> two");
1668 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1669
1670 MsiSetProperty(hpkg, "one", "hithere");
1671 MsiSetProperty(hpkg, "two", "hi");
1672 r = MsiEvaluateCondition(hpkg, "one >> two");
1673 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1674
1675 MsiSetProperty(hpkg, "one", "there");
1676 MsiSetProperty(hpkg, "two", "hithere");
1677 r = MsiEvaluateCondition(hpkg, "one >> two");
1678 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1679
1680 MsiSetProperty(hpkg, "one", "there");
1681 MsiSetProperty(hpkg, "two", "there");
1682 r = MsiEvaluateCondition(hpkg, "one >> two");
1683 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1684
1685 MsiSetProperty(hpkg, "one", "abcdhithere");
1686 MsiSetProperty(hpkg, "two", "hi");
1687 r = MsiEvaluateCondition(hpkg, "one >> two");
1688 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1689
1690 MsiSetProperty(hpkg, "one", "");
1691 MsiSetProperty(hpkg, "two", "there");
1692 r = MsiEvaluateCondition(hpkg, "one >> two");
1693 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1694
1695 MsiSetProperty(hpkg, "one", "there");
1696 MsiSetProperty(hpkg, "two", "");
1697 r = MsiEvaluateCondition(hpkg, "one >> two");
1698 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1699
1700 MsiSetProperty(hpkg, "one", "");
1701 MsiSetProperty(hpkg, "two", "");
1702 r = MsiEvaluateCondition(hpkg, "one >> two");
1703 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1704
1705 MsiSetProperty(hpkg, "one", "1234");
1706 MsiSetProperty(hpkg, "two", "4");
1707 r = MsiEvaluateCondition(hpkg, "one >> two");
1708 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1709
1710 MsiSetProperty(hpkg, "one", "one 1234");
1711 MsiSetProperty(hpkg, "two", "4");
1712 r = MsiEvaluateCondition(hpkg, "one >> two");
1713 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1714
1715 MsiSetProperty(hpkg, "MsiNetAssemblySupport", NULL); /* make sure it's empty */
1716
1717 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1718 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1719
1720 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport > \"1.1.4322\"");
1721 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1722
1723 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport >= \"1.1.4322\"");
1724 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1725
1726 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <= \"1.1.4322\"");
1727 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1728
1729 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <> \"1.1.4322\"");
1730 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1731
1732 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1733 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1734
1735 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"abcd\"");
1736 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1737
1738 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a1.1.4322\"");
1739 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1740
1741 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322a\"");
1742 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1743
1744 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1745 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1746
1747 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1748 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1749
1750 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1751 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1752
1753 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1");
1754 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1755
1756 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1\"");
1757 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1758
1759 r = MsiEvaluateCondition(hpkg, "\"2\" < \"12.1\"");
1760 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1761
1762 r = MsiEvaluateCondition(hpkg, "\"02.1\" < \"2.11\"");
1763 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1764
1765 r = MsiEvaluateCondition(hpkg, "\"02.1.1\" < \"2.1\"");
1766 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1767
1768 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1769 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1770
1771 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1772 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1773
1774 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0\"");
1775 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1776
1777 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"-1\"");
1778 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1779
1780 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a\"");
1781 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1782
1783 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1784 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1785
1786 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1787 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1788
1789 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"/\"");
1790 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1791
1792 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \" \"");
1793 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1794
1795 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"azAZ_\"");
1796 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1797
1798 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]\"");
1799 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1800
1801 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]a\"");
1802 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1803
1804 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]\"");
1805 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1806
1807 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]a\"");
1808 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1809
1810 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a}\"");
1811 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1812
1813 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a\"");
1814 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1815
1816 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a\"");
1817 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1818
1819 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a{\"");
1820 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1821
1822 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a]\"");
1823 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1824
1825 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"A\"");
1826 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1827
1828 MsiSetProperty(hpkg, "MsiNetAssemblySupport", "1.1.4322");
1829 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1830 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1831
1832 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.14322\"");
1833 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1834
1835 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.5\"");
1836 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1837
1838 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1839 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1840
1841 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1842 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1843
1844 MsiSetProperty(hpkg, "one", "1");
1845 r = MsiEvaluateCondition(hpkg, "one < \"1\"");
1846 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1847
1848 MsiSetProperty(hpkg, "X", "5.0");
1849
1850 r = MsiEvaluateCondition(hpkg, "X != \"\"");
1851 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1852
1853 r = MsiEvaluateCondition(hpkg, "X =\"5.0\"");
1854 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1855
1856 r = MsiEvaluateCondition(hpkg, "X =\"5.1\"");
1857 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1858
1859 r = MsiEvaluateCondition(hpkg, "X =\"6.0\"");
1860 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1861
1862 r = MsiEvaluateCondition(hpkg, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1863 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1864
1865 r = MsiEvaluateCondition(hpkg, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1866 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1867
1868 r = MsiEvaluateCondition(hpkg, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1869 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1870
1871 /* feature doesn't exist */
1872 r = MsiEvaluateCondition(hpkg, "&nofeature");
1873 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1874
1875 MsiSetProperty(hpkg, "A", "2");
1876 MsiSetProperty(hpkg, "X", "50");
1877
1878 r = MsiEvaluateCondition(hpkg, "2 <= X");
1879 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1880
1881 r = MsiEvaluateCondition(hpkg, "A <= X");
1882 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1883
1884 r = MsiEvaluateCondition(hpkg, "A <= 50");
1885 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1886
1887 MsiSetProperty(hpkg, "X", "50val");
1888
1889 r = MsiEvaluateCondition(hpkg, "2 <= X");
1890 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1891
1892 r = MsiEvaluateCondition(hpkg, "A <= X");
1893 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1894
1895 MsiSetProperty(hpkg, "A", "7");
1896 MsiSetProperty(hpkg, "X", "50");
1897
1898 r = MsiEvaluateCondition(hpkg, "7 <= X");
1899 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1900
1901 r = MsiEvaluateCondition(hpkg, "A <= X");
1902 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1903
1904 r = MsiEvaluateCondition(hpkg, "A <= 50");
1905 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1906
1907 MsiSetProperty(hpkg, "X", "50val");
1908
1909 r = MsiEvaluateCondition(hpkg, "2 <= X");
1910 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1911
1912 r = MsiEvaluateCondition(hpkg, "A <= X");
1913 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1914
1915 r = MsiEvaluateConditionW(hpkg, cond1);
1916 ok( r == MSICONDITION_TRUE || broken(r == MSICONDITION_FALSE),
1917 "wrong return val (%d)\n", r);
1918
1919 r = MsiEvaluateConditionW(hpkg, cond2);
1920 ok( r == MSICONDITION_FALSE || broken(r == MSICONDITION_TRUE),
1921 "wrong return val (%d)\n", r);
1922
1923 r = MsiEvaluateConditionW(hpkg, cond3);
1924 ok( r == MSICONDITION_TRUE || broken(r == MSICONDITION_FALSE),
1925 "wrong return val (%d)\n", r);
1926
1927 r = MsiEvaluateConditionW(hpkg, cond4);
1928 ok( r == MSICONDITION_FALSE || broken(r == MSICONDITION_TRUE),
1929 "wrong return val (%d)\n", r);
1930
1931 MsiCloseHandle( hpkg );
1932 DeleteFile(msifile);
1933 }
1934
1935 static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop)
1936 {
1937 UINT r;
1938 DWORD sz;
1939 char buffer[2];
1940
1941 sz = sizeof buffer;
1942 strcpy(buffer,"x");
1943 r = MsiGetProperty( hpkg, prop, buffer, &sz );
1944 return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
1945 }
1946
1947 static void test_props(void)
1948 {
1949 MSIHANDLE hpkg, hdb;
1950 UINT r;
1951 DWORD sz;
1952 char buffer[0x100];
1953
1954 hdb = create_package_db();
1955 r = run_query( hdb,
1956 "CREATE TABLE `Property` ( "
1957 "`Property` CHAR(255) NOT NULL, "
1958 "`Value` CHAR(255) "
1959 "PRIMARY KEY `Property`)" );
1960 ok( r == ERROR_SUCCESS , "Failed\n" );
1961
1962 r = run_query(hdb,
1963 "INSERT INTO `Property` "
1964 "(`Property`, `Value`) "
1965 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1966 ok( r == ERROR_SUCCESS , "Failed\n" );
1967
1968 r = package_from_db( hdb, &hpkg );
1969 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
1970 {
1971 skip("Not enough rights to perform tests\n");
1972 DeleteFile(msifile);
1973 return;
1974 }
1975 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
1976
1977 /* test invalid values */
1978 r = MsiGetProperty( 0, NULL, NULL, NULL );
1979 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1980
1981 r = MsiGetProperty( hpkg, NULL, NULL, NULL );
1982 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1983
1984 r = MsiGetProperty( hpkg, "boo", NULL, NULL );
1985 ok( r == ERROR_SUCCESS, "wrong return val\n");
1986
1987 r = MsiGetProperty( hpkg, "boo", buffer, NULL );
1988 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1989
1990 /* test retrieving an empty/nonexistent property */
1991 sz = sizeof buffer;
1992 r = MsiGetProperty( hpkg, "boo", NULL, &sz );
1993 ok( r == ERROR_SUCCESS, "wrong return val\n");
1994 ok( sz == 0, "wrong size returned\n");
1995
1996 check_prop_empty( hpkg, "boo");
1997 sz = 0;
1998 strcpy(buffer,"x");
1999 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
2000 ok( r == ERROR_MORE_DATA, "wrong return val\n");
2001 ok( !strcmp(buffer,"x"), "buffer was changed\n");
2002 ok( sz == 0, "wrong size returned\n");
2003
2004 sz = 1;
2005 strcpy(buffer,"x");
2006 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
2007 ok( r == ERROR_SUCCESS, "wrong return val\n");
2008 ok( buffer[0] == 0, "buffer was not changed\n");
2009 ok( sz == 0, "wrong size returned\n");
2010
2011 /* set the property to something */
2012 r = MsiSetProperty( 0, NULL, NULL );
2013 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
2014
2015 r = MsiSetProperty( hpkg, NULL, NULL );
2016 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
2017
2018 r = MsiSetProperty( hpkg, "", NULL );
2019 ok( r == ERROR_SUCCESS, "wrong return val\n");
2020
2021 /* try set and get some illegal property identifiers */
2022 r = MsiSetProperty( hpkg, "", "asdf" );
2023 ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n");
2024
2025 r = MsiSetProperty( hpkg, "=", "asdf" );
2026 ok( r == ERROR_SUCCESS, "wrong return val\n");
2027
2028 r = MsiSetProperty( hpkg, " ", "asdf" );
2029 ok( r == ERROR_SUCCESS, "wrong return val\n");
2030
2031 r = MsiSetProperty( hpkg, "'", "asdf" );
2032 ok( r == ERROR_SUCCESS, "wrong return val\n");
2033
2034 sz = sizeof buffer;
2035 buffer[0]=0;
2036 r = MsiGetProperty( hpkg, "'", buffer, &sz );
2037 ok( r == ERROR_SUCCESS, "wrong return val\n");
2038 ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
2039
2040 /* set empty values */
2041 r = MsiSetProperty( hpkg, "boo", NULL );
2042 ok( r == ERROR_SUCCESS, "wrong return val\n");
2043 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
2044
2045 r = MsiSetProperty( hpkg, "boo", "" );
2046 ok( r == ERROR_SUCCESS, "wrong return val\n");
2047 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
2048
2049 /* set a non-empty value */
2050 r = MsiSetProperty( hpkg, "boo", "xyz" );
2051 ok( r == ERROR_SUCCESS, "wrong return val\n");
2052
2053 sz = 1;
2054 strcpy(buffer,"x");
2055 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
2056 ok( r == ERROR_MORE_DATA, "wrong return val\n");
2057 ok( buffer[0] == 0, "buffer was not changed\n");
2058 ok( sz == 3, "wrong size returned\n");
2059
2060 sz = 4;
2061 strcpy(buffer,"x");
2062 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
2063 ok( r == ERROR_SUCCESS, "wrong return val\n");
2064 ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
2065 ok( sz == 3, "wrong size returned\n");
2066
2067 sz = 3;
2068 strcpy(buffer,"x");
2069 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
2070 ok( r == ERROR_MORE_DATA, "wrong return val\n");
2071 ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
2072 ok( sz == 3, "wrong size returned\n");
2073
2074 r = MsiSetProperty(hpkg, "SourceDir", "foo");
2075 ok( r == ERROR_SUCCESS, "wrong return val\n");
2076
2077 sz = 4;
2078 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
2079 ok( r == ERROR_SUCCESS, "wrong return val\n");
2080 ok( !strcmp(buffer,""), "buffer wrong\n");
2081 ok( sz == 0, "wrong size returned\n");
2082
2083 sz = 4;
2084 r = MsiGetProperty(hpkg, "SOMERANDOMNAME", buffer, &sz);
2085 ok( r == ERROR_SUCCESS, "wrong return val\n");
2086 ok( !strcmp(buffer,""), "buffer wrong\n");
2087 ok( sz == 0, "wrong size returned\n");
2088
2089 sz = 4;
2090 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
2091 ok( r == ERROR_SUCCESS, "wrong return val\n");
2092 ok( !strcmp(buffer,"foo"), "buffer wrong\n");
2093 ok( sz == 3, "wrong size returned\n");
2094
2095 r = MsiSetProperty(hpkg, "MetadataCompName", "Photoshop.dll");
2096 ok( r == ERROR_SUCCESS, "wrong return val\n");
2097
2098 sz = 0;
2099 r = MsiGetProperty(hpkg, "MetadataCompName", NULL, &sz );
2100 ok( r == ERROR_SUCCESS, "return wrong\n");
2101 ok( sz == 13, "size wrong (%d)\n", sz);
2102
2103 sz = 13;
2104 r = MsiGetProperty(hpkg, "MetadataCompName", buffer, &sz );
2105 ok( r == ERROR_MORE_DATA, "return wrong\n");
2106 ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n");
2107
2108 r = MsiSetProperty(hpkg, "property", "value");
2109 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2110
2111 sz = 6;
2112 r = MsiGetProperty(hpkg, "property", buffer, &sz);
2113 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2114 ok( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer);
2115
2116 r = MsiSetProperty(hpkg, "property", NULL);
2117 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2118
2119 sz = 6;
2120 r = MsiGetProperty(hpkg, "property", buffer, &sz);
2121 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2122 ok( !strlen(buffer), "Expected empty string, got %s\n", buffer);
2123
2124 MsiCloseHandle( hpkg );
2125 DeleteFile(msifile);
2126 }
2127
2128 static BOOL find_prop_in_property(MSIHANDLE hdb, LPCSTR prop, LPCSTR val)
2129 {
2130 MSIHANDLE hview, hrec;
2131 BOOL found;
2132 CHAR buffer[MAX_PATH];
2133 DWORD sz;
2134 UINT r;
2135
2136 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
2137 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2138 r = MsiViewExecute(hview, 0);
2139 ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
2140
2141 found = FALSE;
2142 while (r == ERROR_SUCCESS && !found)
2143 {
2144 r = MsiViewFetch(hview, &hrec);
2145 if (r != ERROR_SUCCESS) break;
2146
2147 sz = MAX_PATH;
2148 r = MsiRecordGetString(hrec, 1, buffer, &sz);
2149 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
2150 {
2151 sz = MAX_PATH;
2152 r = MsiRecordGetString(hrec, 2, buffer, &sz);
2153 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, val))
2154 found = TRUE;
2155 }
2156
2157 MsiCloseHandle(hrec);
2158 }
2159
2160 MsiViewClose(hview);
2161 MsiCloseHandle(hview);
2162
2163 return found;
2164 }
2165
2166 static void test_property_table(void)
2167 {
2168 const char *query;
2169 UINT r;
2170 MSIHANDLE hpkg, hdb, hrec;
2171 char buffer[MAX_PATH], package[10];
2172 DWORD sz;
2173 BOOL found;
2174
2175 hdb = create_package_db();
2176 ok( hdb, "failed to create package\n");
2177
2178 r = package_from_db(hdb, &hpkg);
2179 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2180 {
2181 skip("Not enough rights to perform tests\n");
2182 DeleteFile(msifile);
2183 return;
2184 }
2185 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
2186
2187 MsiCloseHandle(hdb);
2188
2189 hdb = MsiGetActiveDatabase(hpkg);
2190
2191 query = "CREATE TABLE `_Property` ( "
2192 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2193 r = run_query(hdb, query);
2194 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2195
2196 MsiCloseHandle(hdb);
2197 MsiCloseHandle(hpkg);
2198 DeleteFile(msifile);
2199
2200 hdb = create_package_db();
2201 ok( hdb, "failed to create package\n");
2202
2203 query = "CREATE TABLE `_Property` ( "
2204 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2205 r = run_query(hdb, query);
2206 ok(r == ERROR_SUCCESS, "failed to create table\n");
2207
2208 query = "ALTER `_Property` ADD `foo` INTEGER";
2209 r = run_query(hdb, query);
2210 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2211
2212 query = "ALTER TABLE `_Property` ADD `foo` INTEGER";
2213 r = run_query(hdb, query);
2214 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2215
2216 query = "ALTER TABLE `_Property` ADD `extra` INTEGER";
2217 r = run_query(hdb, query);
2218 ok(r == ERROR_SUCCESS, "failed to add column\n");
2219
2220 sprintf(package, "#%i", hdb);
2221 r = MsiOpenPackage(package, &hpkg);
2222 todo_wine ok(r != ERROR_SUCCESS, "MsiOpenPackage succeeded\n");
2223 if (r == ERROR_SUCCESS)
2224 MsiCloseHandle(hpkg);
2225
2226 r = MsiCloseHandle(hdb);
2227 ok(r == ERROR_SUCCESS, "MsiCloseHandle failed %u\n", r);
2228
2229 hdb = create_package_db();
2230 ok (hdb, "failed to create package database\n");
2231
2232 r = create_property_table(hdb);
2233 ok(r == ERROR_SUCCESS, "cannot create Property table: %d\n", r);
2234
2235 r = add_property_entry(hdb, "'prop', 'val'");
2236 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2237
2238 r = package_from_db(hdb, &hpkg);
2239 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
2240
2241 MsiCloseHandle(hdb);
2242
2243 sz = MAX_PATH;
2244 r = MsiGetProperty(hpkg, "prop", buffer, &sz);
2245 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2246 ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
2247
2248 hdb = MsiGetActiveDatabase(hpkg);
2249
2250 found = find_prop_in_property(hdb, "prop", "val");
2251 ok(found, "prop should be in the _Property table\n");
2252
2253 r = add_property_entry(hdb, "'dantes', 'mercedes'");
2254 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2255
2256 query = "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
2257 r = do_query(hdb, query, &hrec);
2258 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2259
2260 found = find_prop_in_property(hdb, "dantes", "mercedes");
2261 ok(found == FALSE, "dantes should not be in the _Property table\n");
2262
2263 sz = MAX_PATH;
2264 lstrcpy(buffer, "aaa");
2265 r = MsiGetProperty(hpkg, "dantes", buffer, &sz);
2266 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2267 ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer);
2268
2269 r = MsiSetProperty(hpkg, "dantes", "mercedes");
2270 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2271
2272 found = find_prop_in_property(hdb, "dantes", "mercedes");
2273 ok(found == TRUE, "dantes should be in the _Property table\n");
2274
2275 MsiCloseHandle(hdb);
2276 MsiCloseHandle(hpkg);
2277 DeleteFile(msifile);
2278 }
2279
2280 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
2281 {
2282 MSIHANDLE htab = 0;
2283 UINT res;
2284
2285 res = MsiDatabaseOpenView( hdb, szQuery, &htab );
2286 if( res == ERROR_SUCCESS )
2287 {
2288 UINT r;
2289
2290 r = MsiViewExecute( htab, hrec );
2291 if( r != ERROR_SUCCESS )
2292 {
2293 res = r;
2294 fprintf(stderr,"MsiViewExecute failed %08x\n", res);
2295 }
2296
2297 r = MsiViewClose( htab );
2298 if( r != ERROR_SUCCESS )
2299 res = r;
2300
2301 r = MsiCloseHandle( htab );
2302 if( r != ERROR_SUCCESS )
2303 res = r;
2304 }
2305 return res;
2306 }
2307
2308 static UINT try_query( MSIHANDLE hdb, LPCSTR szQuery )
2309 {
2310 return try_query_param( hdb, szQuery, 0 );
2311 }
2312
2313 static void set_summary_str(MSIHANDLE hdb, DWORD pid, LPCSTR value)
2314 {
2315 MSIHANDLE summary;
2316 UINT r;
2317
2318 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2319 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2320
2321 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
2322 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2323
2324 r = MsiSummaryInfoPersist(summary);
2325 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2326
2327 MsiCloseHandle(summary);
2328 }
2329
2330 static void set_summary_dword(MSIHANDLE hdb, DWORD pid, DWORD value)
2331 {
2332 MSIHANDLE summary;
2333 UINT r;
2334
2335 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2336 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2337
2338 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_I4, value, NULL, NULL);
2339 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2340
2341 r = MsiSummaryInfoPersist(summary);
2342 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2343
2344 MsiCloseHandle(summary);
2345 }
2346
2347 static void test_msipackage(void)
2348 {
2349 MSIHANDLE hdb = 0, hpack = 100;
2350 UINT r;
2351 const char *query;
2352 char name[10];
2353
2354 /* NULL szPackagePath */
2355 r = MsiOpenPackage(NULL, &hpack);
2356 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2357
2358 /* empty szPackagePath */
2359 r = MsiOpenPackage("", &hpack);
2360 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2361 {
2362 skip("Not enough rights to perform tests\n");
2363 return;
2364 }
2365 todo_wine
2366 {
2367 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2368 }
2369
2370 if (r == ERROR_SUCCESS)
2371 MsiCloseHandle(hpack);
2372
2373 /* nonexistent szPackagePath */
2374 r = MsiOpenPackage("nonexistent", &hpack);
2375 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2376
2377 /* NULL hProduct */
2378 r = MsiOpenPackage(msifile, NULL);
2379 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2380
2381 name[0]='#';
2382 name[1]=0;
2383 r = MsiOpenPackage(name, &hpack);
2384 ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r);
2385
2386 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2387 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2388
2389 /* database exists, but is emtpy */
2390 sprintf(name, "#%d", hdb);
2391 r = MsiOpenPackage(name, &hpack);
2392 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2393 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2394
2395 query = "CREATE TABLE `Property` ( "
2396 "`Property` CHAR(72), `Value` CHAR(0) "
2397 "PRIMARY KEY `Property`)";
2398 r = try_query(hdb, query);
2399 ok(r == ERROR_SUCCESS, "failed to create Properties table\n");
2400
2401 query = "CREATE TABLE `InstallExecuteSequence` ("
2402 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2403 "PRIMARY KEY `Action`)";
2404 r = try_query(hdb, query);
2405 ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n");
2406
2407 /* a few key tables exist */
2408 sprintf(name, "#%d", hdb);
2409 r = MsiOpenPackage(name, &hpack);
2410 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2411 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2412
2413 MsiCloseHandle(hdb);
2414 DeleteFile(msifile);
2415
2416 /* start with a clean database to show what constitutes a valid package */
2417 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2418 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2419
2420 sprintf(name, "#%d", hdb);
2421
2422 /* The following summary information props must exist:
2423 * - PID_REVNUMBER
2424 * - PID_PAGECOUNT
2425 */
2426
2427 set_summary_dword(hdb, PID_PAGECOUNT, 100);
2428 r = MsiOpenPackage(name, &hpack);
2429 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2430 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2431
2432 set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2433 r = MsiOpenPackage(name, &hpack);
2434 ok(r == ERROR_SUCCESS,
2435 "Expected ERROR_SUCCESS, got %d\n", r);
2436
2437 MsiCloseHandle(hpack);
2438 MsiCloseHandle(hdb);
2439 DeleteFile(msifile);
2440 }
2441
2442 static void test_formatrecord2(void)
2443 {
2444 MSIHANDLE hpkg, hrec ;
2445 char buffer[0x100];
2446 DWORD sz;
2447 UINT r;
2448
2449 r = package_from_db(create_package_db(), &hpkg);
2450 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2451 {
2452 skip("Not enough rights to perform tests\n");
2453 DeleteFile(msifile);
2454 return;
2455 }
2456 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
2457
2458 r = MsiSetProperty(hpkg, "Manufacturer", " " );
2459 ok( r == ERROR_SUCCESS, "set property failed\n");
2460
2461 hrec = MsiCreateRecord(2);
2462 ok(hrec, "create record failed\n");
2463
2464 r = MsiRecordSetString( hrec, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2465 ok( r == ERROR_SUCCESS, "format record failed\n");
2466
2467 buffer[0] = 0;
2468 sz = sizeof buffer;
2469 r = MsiFormatRecord( hpkg, hrec, buffer, &sz );
2470 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
2471
2472 r = MsiRecordSetString(hrec, 0, "[foo][1]");
2473 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
2474 r = MsiRecordSetString(hrec, 1, "hoo");
2475 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
2476 sz = sizeof buffer;
2477 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2478 ok( sz == 3, "size wrong\n");
2479 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2480 ok( r == ERROR_SUCCESS, "format failed\n");
2481
2482 r = MsiRecordSetString(hrec, 0, "x[~]x");
2483 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
2484 sz = sizeof buffer;
2485 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2486 ok( sz == 3, "size wrong\n");
2487 ok( 0 == strcmp(buffer,"x"), "wrong output %s\n",buffer);
2488 ok( r == ERROR_SUCCESS, "format failed\n");
2489
2490 r = MsiRecordSetString(hrec, 0, "[foo.$%}][1]");
2491 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
2492 r = MsiRecordSetString(hrec, 1, "hoo");
2493 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
2494 sz = sizeof buffer;
2495 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2496 ok( sz == 3, "size wrong\n");
2497 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2498 ok( r == ERROR_SUCCESS, "format failed\n");
2499
2500 r = MsiRecordSetString(hrec, 0, "[\\[]");
2501 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
2502 sz = sizeof buffer;
2503 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2504 ok( sz == 1, "size wrong\n");
2505 ok( 0 == strcmp(buffer,"["), "wrong output %s\n",buffer);
2506 ok( r == ERROR_SUCCESS, "format failed\n");
2507
2508 SetEnvironmentVariable("FOO", "BAR");
2509 r = MsiRecordSetString(hrec, 0, "[%FOO]");
2510 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
2511 sz = sizeof buffer;
2512 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2513 ok( sz == 3, "size wrong\n");
2514 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2515 ok( r == ERROR_SUCCESS, "format failed\n");
2516
2517 r = MsiRecordSetString(hrec, 0, "[[1]]");
2518 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
2519 r = MsiRecordSetString(hrec, 1, "%FOO");
2520 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
2521 sz = sizeof buffer;
2522 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2523 ok( sz == 3, "size wrong\n");
2524 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2525 ok( r == ERROR_SUCCESS, "format failed\n");
2526
2527 MsiCloseHandle( hrec );
2528 MsiCloseHandle( hpkg );
2529 DeleteFile(msifile);
2530 }
2531
2532 static void test_states(void)
2533 {
2534 MSIHANDLE hpkg;
2535 UINT r;
2536 MSIHANDLE hdb;
2537 INSTALLSTATE state, action;
2538
2539 static const CHAR msifile2[] = "winetest2-package.msi";
2540 static const CHAR msifile3[] = "winetest3-package.msi";
2541 static const CHAR msifile4[] = "winetest4-package.msi";
2542
2543 if (is_process_limited())
2544 {
2545 skip("process is limited\n");
2546 return;
2547 }
2548
2549 hdb = create_package_db();
2550 ok ( hdb, "failed to create package database\n" );
2551
2552 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
2553 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
2554
2555 r = create_property_table( hdb );
2556 ok( r == ERROR_SUCCESS, "cannot create Property table: %d\n", r );
2557
2558 r = add_property_entry( hdb, "'ProductCode', '{7262AC98-EEBD-4364-8CE3-D654F6A425B9}'" );
2559 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2560
2561 r = add_property_entry( hdb, "'ProductLanguage', '1033'" );
2562 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2563
2564 r = add_property_entry( hdb, "'ProductName', 'MSITEST'" );
2565 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2566
2567 r = add_property_entry( hdb, "'ProductVersion', '1.1.1'" );
2568 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2569
2570 r = add_property_entry( hdb, "'MSIFASTINSTALL', '1'" );
2571 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2572
2573 r = create_install_execute_sequence_table( hdb );
2574 ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table: %d\n", r );
2575
2576 r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
2577 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2578
2579 r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
2580 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2581
2582 r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
2583 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2584
2585 r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" );
2586 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2587
2588 r = add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" );
2589 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2590
2591 r = add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" );
2592 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2593
2594 r = add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" );
2595 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2596
2597 r = add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" );
2598 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2599
2600 r = add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" );
2601 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2602
2603 r = add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" );
2604 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2605
2606 r = add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" );
2607 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2608
2609 r = create_media_table( hdb );
2610 ok( r == ERROR_SUCCESS, "cannot create media table: %d\n", r );
2611
2612 r = add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''");
2613 ok( r == ERROR_SUCCESS, "cannot add media entry: %d\n", r );
2614
2615 r = create_feature_table( hdb );
2616 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
2617
2618 r = create_component_table( hdb );
2619 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
2620
2621 /* msidbFeatureAttributesFavorLocal */
2622 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
2623 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2624
2625 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2626 r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2627 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2628
2629 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2630 r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2631 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2632
2633 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2634 r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2635 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2636
2637 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2638 r = add_component_entry( hdb, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2639 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2640
2641 /* msidbFeatureAttributesFavorSource */
2642 r = add_feature_entry( hdb, "'two', '', '', '', 2, 1, '', 1" );
2643 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2644
2645 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2646 r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2647 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2648
2649 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2650 r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2651 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2652
2653 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2654 r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2655 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2656
2657 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2658 r = add_component_entry( hdb, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2659 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2660
2661 /* msidbFeatureAttributesFavorSource */
2662 r = add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" );
2663 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2664
2665 /* msidbFeatureAttributesFavorLocal */
2666 r = add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" );
2667 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2668
2669 /* disabled */
2670 r = add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" );
2671 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2672
2673 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2674 r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2675 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2676
2677 /* no feature parent:msidbComponentAttributesLocalOnly */
2678 r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2679 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2680
2681 /* msidbFeatureAttributesFavorLocal:removed */
2682 r = add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" );
2683 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2684
2685 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2686 r = add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2687 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2688
2689 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2690 r = add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2691 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2692
2693 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2694 r = add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2695 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2696
2697 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2698 r = add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2699 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2700
2701 /* msidbFeatureAttributesFavorSource:removed */
2702 r = add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" );
2703 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2704
2705 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2706 r = add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2707 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2708
2709 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2710 r = add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2711 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2712
2713 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2714 r = add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2715 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2716
2717 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2718 r = add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2719 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2720
2721 /* msidbFeatureAttributesFavorLocal */
2722 r = add_feature_entry( hdb, "'eight', '', '', '', 2, 1, '', 0" );
2723 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2724
2725 r = add_component_entry( hdb, "'tau', '{07DEB510-677C-4A6F-A0A6-7CD8EFEA77ED}', 'TARGETDIR', 1, '', 'tau_file'" );
2726 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2727
2728 /* msidbFeatureAttributesFavorSource */
2729 r = add_feature_entry( hdb, "'nine', '', '', '', 2, 1, '', 1" );
2730 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2731
2732 r = add_component_entry( hdb, "'phi', '{9F0594C5-35AD-43EA-94DD-8DF73FAA664D}', 'TARGETDIR', 1, '', 'phi_file'" );
2733 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2734
2735 /* msidbFeatureAttributesFavorAdvertise */
2736 r = add_feature_entry( hdb, "'ten', '', '', '', 2, 1, '', 4" );
2737 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2738
2739 r = add_component_entry( hdb, "'chi', '{E6B539AB-5DA9-4236-A2D2-E341A50B4C38}', 'TARGETDIR', 1, '', 'chi_file'" );
2740 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2741
2742 /* msidbFeatureAttributesUIDisallowAbsent */
2743 r = add_feature_entry( hdb, "'eleven', '', '', '', 2, 1, '', 16" );
2744 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2745
2746 r = add_component_entry( hdb, "'psi', '{A06B23B5-746B-427A-8A6E-FD6AC8F46A95}', 'TARGETDIR', 1, '', 'psi_file'" );
2747 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2748
2749 r = create_feature_components_table( hdb );
2750 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
2751
2752 r = add_feature_components_entry( hdb, "'one', 'alpha'" );
2753 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2754
2755 r = add_feature_components_entry( hdb, "'one', 'beta'" );
2756 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2757
2758 r = add_feature_components_entry( hdb, "'one', 'gamma'" );
2759 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2760
2761 r = add_feature_components_entry( hdb, "'one', 'theta'" );
2762 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2763
2764 r = add_feature_components_entry( hdb, "'two', 'delta'" );
2765 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2766
2767 r = add_feature_components_entry( hdb, "'two', 'epsilon'" );
2768 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2769
2770 r = add_feature_components_entry( hdb, "'two', 'zeta'" );
2771 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2772
2773 r = add_feature_components_entry( hdb, "'two', 'iota'" );
2774 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2775
2776 r = add_feature_components_entry( hdb, "'three', 'eta'" );
2777 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2778
2779 r = add_feature_components_entry( hdb, "'four', 'eta'" );
2780 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2781
2782 r = add_feature_components_entry( hdb, "'five', 'eta'" );
2783 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2784
2785 r = add_feature_components_entry( hdb, "'six', 'lambda'" );
2786 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2787
2788 r = add_feature_components_entry( hdb, "'six', 'mu'" );
2789 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2790
2791 r = add_feature_components_entry( hdb, "'six', 'nu'" );
2792 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2793
2794 r = add_feature_components_entry( hdb, "'six', 'xi'" );
2795 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2796
2797 r = add_feature_components_entry( hdb, "'seven', 'omicron'" );
2798 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2799
2800 r = add_feature_components_entry( hdb, "'seven', 'pi'" );
2801 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2802
2803 r = add_feature_components_entry( hdb, "'seven', 'rho'" );
2804 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2805
2806 r = add_feature_components_entry( hdb, "'seven', 'sigma'" );
2807 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2808
2809 r = add_feature_components_entry( hdb, "'eight', 'tau'" );
2810 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2811
2812 r = add_feature_components_entry( hdb, "'nine', 'phi'" );
2813 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2814
2815 r = add_feature_components_entry( hdb, "'ten', 'chi'" );
2816 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2817
2818 r = add_feature_components_entry( hdb, "'eleven', 'psi'" );
2819 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2820
2821 r = create_file_table( hdb );
2822 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
2823
2824 r = add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2825 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2826
2827 r = add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2828 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2829
2830 r = add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2831 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2832
2833 r = add_file_entry( hdb, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2834 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2835
2836 r = add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2837 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2838
2839 r = add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2840 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2841
2842 r = add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2843 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2844
2845 r = add_file_entry( hdb, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2846 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2847
2848 /* compressed file */
2849 r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2850 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2851
2852 r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2853 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2854
2855 r = add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2856 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2857
2858 r = add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2859 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2860
2861 r = add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2862 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2863
2864 r = add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2865 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2866
2867 r = add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2868 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2869
2870 r = add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2871 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2872
2873 r = add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2874 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2875
2876 r = add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2877 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2878
2879 r = add_file_entry( hdb, "'tau_file', 'tau', 'tau.txt', 100, '', '1033', 8192, 1" );
2880 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2881
2882 r = add_file_entry( hdb, "'phi_file', 'phi', 'phi.txt', 100, '', '1033', 8192, 1" );
2883 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2884
2885 r = add_file_entry( hdb, "'chi_file', 'chi', 'chi.txt', 100, '', '1033', 8192, 1" );
2886 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2887
2888 r = add_file_entry( hdb, "'psi_file', 'psi', 'psi.txt', 100, '', '1033', 8192, 1" );
2889 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2890
2891 MsiDatabaseCommit(hdb);
2892
2893 /* these properties must not be in the saved msi file */
2894 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
2895 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2896
2897 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
2898 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2899
2900 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
2901 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2902
2903 r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
2904 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2905
2906 r = add_property_entry( hdb, "'REINSTALLMODE', 'omus'");
2907 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2908
2909 r = package_from_db( hdb, &hpkg );
2910 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2911 {
2912 skip("Not enough rights to perform tests\n");
2913 DeleteFile(msifile);
2914 return;
2915 }
2916 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
2917
2918 MsiCloseHandle(hdb);
2919
2920 CopyFileA(msifile, msifile2, FALSE);
2921 CopyFileA(msifile, msifile3, FALSE);
2922 CopyFileA(msifile, msifile4, FALSE);
2923
2924 state = 0xdeadbee;
2925 action = 0xdeadbee;
2926 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2927 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2928 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2929 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2930
2931 state = 0xdeadbee;
2932 action = 0xdeadbee;
2933 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2934 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2935 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2936 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2937
2938 state = 0xdeadbee;
2939 action = 0xdeadbee;
2940 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2941 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2942 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2943 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2944
2945 state = 0xdeadbee;
2946 action = 0xdeadbee;
2947 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2948 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2949 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2950 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2951
2952 state = 0xdeadbee;
2953 action = 0xdeadbee;
2954 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2955 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2956 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2957 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2958
2959 state = 0xdeadbee;
2960 action = 0xdeadbee;
2961 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2962 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2963 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2964 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2965
2966 state = 0xdeadbee;
2967 action = 0xdeadbee;
2968 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2969 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2970 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2971 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2972
2973 state = 0xdeadbee;
2974 action = 0xdeadbee;
2975 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
2976 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2977 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2978 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2979
2980 state = 0xdeadbee;
2981 action = 0xdeadbee;
2982 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
2983 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2984 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2985 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2986
2987 state = 0xdeadbee;
2988 action = 0xdeadbee;
2989 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
2990 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2991 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2992 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2993
2994 state = 0xdeadbee;
2995 action = 0xdeadbee;
2996 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
2997 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2998 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2999 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3000
3001 state = 0xdeadbee;
3002 action = 0xdeadbee;
3003 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3004 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3005 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3006 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3007
3008 state = 0xdeadbee;
3009 action = 0xdeadbee;
3010 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3011 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3012 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3013 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3014
3015 state = 0xdeadbee;
3016 action = 0xdeadbee;
3017 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3018 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3019 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3020 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3021
3022 state = 0xdeadbee;
3023 action = 0xdeadbee;
3024 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3025 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3026 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3027 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3028
3029 state = 0xdeadbee;
3030 action = 0xdeadbee;
3031 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3032 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3033 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3034 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3035
3036 state = 0xdeadbee;
3037 action = 0xdeadbee;
3038 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3039 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3040 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3041 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3042
3043 state = 0xdeadbee;
3044 action = 0xdeadbee;
3045 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3046 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3047 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3048 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3049
3050 state = 0xdeadbee;
3051 action = 0xdeadbee;
3052 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3053 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3054 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3055 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3056
3057 state = 0xdeadbee;
3058 action = 0xdeadbee;
3059 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3060 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3061 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3062 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3063
3064 state = 0xdeadbee;
3065 action = 0xdeadbee;
3066 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3067 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3068 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3069 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3070
3071 state = 0xdeadbee;
3072 action = 0xdeadbee;
3073 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3074 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3075 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3076 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3077
3078 state = 0xdeadbee;
3079 action = 0xdeadbee;
3080 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3081 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3082 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3083 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3084
3085 state = 0xdeadbee;
3086 action = 0xdeadbee;
3087 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3088 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3089 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3090 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3091
3092 state = 0xdeadbee;
3093 action = 0xdeadbee;
3094 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3095 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3096 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3097 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3098
3099 state = 0xdeadbee;
3100 action = 0xdeadbee;
3101 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3102 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3103 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3104 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3105
3106 state = 0xdeadbee;
3107 action = 0xdeadbee;
3108 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3109 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3110 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3111 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3112
3113 state = 0xdeadbee;
3114 action = 0xdeadbee;
3115 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3116 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3117 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3118 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3119
3120 state = 0xdeadbee;
3121 action = 0xdeadbee;
3122 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3123 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3124 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3125 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3126
3127 state = 0xdeadbee;
3128 action = 0xdeadbee;
3129 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3130 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3131 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3132 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3133
3134 state = 0xdeadbee;
3135 action = 0xdeadbee;
3136 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3137 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3138 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3139 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3140
3141 state = 0xdeadbee;
3142 action = 0xdeadbee;
3143 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3144 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3145 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3146 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3147
3148 state = 0xdeadbee;
3149 action = 0xdeadbee;
3150 r = MsiGetComponentState(hpkg, "psi", &state, &action);
3151 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3152 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3153 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3154
3155 r = MsiDoAction( hpkg, "CostInitialize");
3156 ok( r == ERROR_SUCCESS, "cost init failed\n");
3157
3158 state = 0xdeadbee;
3159 action = 0xdeadbee;
3160 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3161 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3162 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3163 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3164
3165 state = 0xdeadbee;
3166 action = 0xdeadbee;
3167 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3168 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3169 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3170 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3171
3172 state = 0xdeadbee;
3173 action = 0xdeadbee;
3174 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3175 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3176 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3177 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3178
3179 state = 0xdeadbee;
3180 action = 0xdeadbee;
3181 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3182 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3183 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3184 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3185
3186 state = 0xdeadbee;
3187 action = 0xdeadbee;
3188 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3189 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3190 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3191 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3192
3193 state = 0xdeadbee;
3194 action = 0xdeadbee;
3195 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3196 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3197 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3198 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3199
3200 state = 0xdeadbee;
3201 action = 0xdeadbee;
3202 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3203 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3204 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3205 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3206
3207 state = 0xdeadbee;
3208 action = 0xdeadbee;
3209 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3210 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3211 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3212 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3213
3214 state = 0xdeadbee;
3215 action = 0xdeadbee;
3216 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3217 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3218 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3219 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3220
3221 state = 0xdeadbee;
3222 action = 0xdeadbee;
3223 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3224 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3225 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3226 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3227
3228 state = 0xdeadbee;
3229 action = 0xdeadbee;
3230 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
3231 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3232 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3233 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3234
3235 state = 0xdeadbee;
3236 action = 0xdeadbee;
3237 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3238 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3239 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3240 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3241
3242 state = 0xdeadbee;
3243 action = 0xdeadbee;
3244 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3245 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3246 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3247 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3248
3249 state = 0xdeadbee;
3250 action = 0xdeadbee;
3251 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3252 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3253 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3254 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3255
3256 state = 0xdeadbee;
3257 action = 0xdeadbee;
3258 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3259 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3260 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3261 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3262
3263 state = 0xdeadbee;
3264 action = 0xdeadbee;
3265 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3266 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3267 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3268 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3269
3270 state = 0xdeadbee;
3271 action = 0xdeadbee;
3272 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3273 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3274 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3275 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3276
3277 state = 0xdeadbee;
3278 action = 0xdeadbee;
3279 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3280 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3281 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3282 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3283
3284 state = 0xdeadbee;
3285 action = 0xdeadbee;
3286 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3287 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3288 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3289 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3290
3291 state = 0xdeadbee;
3292 action = 0xdeadbee;
3293 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3294 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3295 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3296 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3297
3298 state = 0xdeadbee;
3299 action = 0xdeadbee;
3300 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3301 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3302 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3303 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3304
3305 state = 0xdeadbee;
3306 action = 0xdeadbee;
3307 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3308 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3309 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3310 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3311
3312 state = 0xdeadbee;
3313 action = 0xdeadbee;
3314 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3315 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3316 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3317 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3318
3319 state = 0xdeadbee;
3320 action = 0xdeadbee;
3321 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3322 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3323 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3324 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3325
3326 state = 0xdeadbee;
3327 action = 0xdeadbee;
3328 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3329 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3330 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3331 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3332
3333 state = 0xdeadbee;
3334 action = 0xdeadbee;
3335 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3336 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3337 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3338 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3339
3340 state = 0xdeadbee;
3341 action = 0xdeadbee;
3342 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3343 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3344 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3345 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3346
3347 state = 0xdeadbee;
3348 action = 0xdeadbee;
3349 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3350 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3351 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3352 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3353
3354 state = 0xdeadbee;
3355 action = 0xdeadbee;
3356 r = MsiGetComponentState(hpkg, "sigma", &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 = MsiGetComponentState(hpkg, "tau", &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 = MsiGetComponentState(hpkg, "phi", &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 = MsiGetComponentState(hpkg, "chi", &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 = MsiGetComponentState(hpkg, "psi", &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 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3390
3391 r = MsiDoAction( hpkg, "FileCost");
3392 ok( r == ERROR_SUCCESS, "file cost failed\n");
3393
3394 r = MsiGetFeatureState(hpkg, "one", NULL, NULL);
3395 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3396
3397 action = 0xdeadbee;
3398 r = MsiGetFeatureState(hpkg, "one", NULL, &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
3402 state = 0xdeadbee;
3403 r = MsiGetFeatureState( hpkg, "one", &state, NULL);
3404 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3405 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3406
3407 state = 0xdeadbee;
3408 action = 0xdeadbee;
3409 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3410 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3411 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3412 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3413
3414 state = 0xdeadbee;
3415 action = 0xdeadbee;
3416 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3417 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3418 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3419 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3420
3421 state = 0xdeadbee;
3422 action = 0xdeadbee;
3423 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3424 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3425 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3426 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3427
3428 state = 0xdeadbee;
3429 action = 0xdeadbee;
3430 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3431 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3432 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3433 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3434
3435 state = 0xdeadbee;
3436 action = 0xdeadbee;
3437 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3438 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3439 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3440 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3441
3442 state = 0xdeadbee;
3443 action = 0xdeadbee;
3444 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3445 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3446 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3447 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3448
3449 state = 0xdeadbee;
3450 action = 0xdeadbee;
3451 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3452 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3453 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3454 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3455
3456 state = 0xdeadbee;
3457 action = 0xdeadbee;
3458 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3459 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3460 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3461 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3462
3463 state = 0xdeadbee;
3464 action = 0xdeadbee;
3465 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3466 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3467 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3468 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3469
3470 state = 0xdeadbee;
3471 action = 0xdeadbee;
3472 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3473 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3474 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3475 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3476
3477 state = 0xdeadbee;
3478 action = 0xdeadbee;
3479 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
3480 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3481 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3482 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3483
3484 state = 0xdeadbee;
3485 action = 0xdeadbee;
3486 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3487 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3488 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3489 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3490
3491 state = 0xdeadbee;
3492 action = 0xdeadbee;
3493 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3494 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3495 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3496 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3497
3498 state = 0xdeadbee;
3499 action = 0xdeadbee;
3500 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3501 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3502 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3503 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3504
3505 state = 0xdeadbee;
3506 action = 0xdeadbee;
3507 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3508 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3509 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3510 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3511
3512 state = 0xdeadbee;
3513 action = 0xdeadbee;
3514 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3515 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3516 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3517 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3518
3519 state = 0xdeadbee;
3520 action = 0xdeadbee;
3521 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3522 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3523 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3524 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3525
3526 state = 0xdeadbee;
3527 action = 0xdeadbee;
3528 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3529 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3530 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3531 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3532
3533 state = 0xdeadbee;
3534 action = 0xdeadbee;
3535 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3536 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3537 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3538 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3539
3540 state = 0xdeadbee;
3541 action = 0xdeadbee;
3542 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3543 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3544 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3545 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3546
3547 state = 0xdeadbee;
3548 action = 0xdeadbee;
3549 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3550 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3551 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3552 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3553
3554 state = 0xdeadbee;
3555 action = 0xdeadbee;
3556 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3557 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3558 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3559 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3560
3561 state = 0xdeadbee;
3562 action = 0xdeadbee;
3563 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3564 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3565 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3566 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3567
3568 state = 0xdeadbee;
3569 action = 0xdeadbee;
3570 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3571 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3572 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3573 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3574
3575 state = 0xdeadbee;
3576 action = 0xdeadbee;
3577 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3578 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3579 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3580 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3581
3582 state = 0xdeadbee;
3583 action = 0xdeadbee;
3584 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3585 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3586 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3587 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3588
3589 state = 0xdeadbee;
3590 action = 0xdeadbee;
3591 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3592 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3593 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3594 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3595
3596 state = 0xdeadbee;
3597 action = 0xdeadbee;
3598 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3599 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3600 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3601 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3602
3603 state = 0xdeadbee;
3604 action = 0xdeadbee;
3605 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3606 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3607 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3608 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3609
3610 state = 0xdeadbee;
3611 action = 0xdeadbee;
3612 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3613 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3614 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3615 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3616
3617 state = 0xdeadbee;
3618 action = 0xdeadbee;
3619 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3620 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3621 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3622 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3623
3624 state = 0xdeadbee;
3625 action = 0xdeadbee;
3626 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3627 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3628 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3629 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3630
3631 state = 0xdeadbee;
3632 action = 0xdeadbee;
3633 r = MsiGetComponentState(hpkg, "psi", &state, &action);
3634 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3635 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3636 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3637
3638 r = MsiDoAction( hpkg, "CostFinalize");
3639 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3640
3641 state = 0xdeadbee;
3642 action = 0xdeadbee;
3643 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3644 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3645 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3646 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3647
3648 state = 0xdeadbee;
3649 action = 0xdeadbee;
3650 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3651 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3652 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3653 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3654
3655 state = 0xdeadbee;
3656 action = 0xdeadbee;
3657 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3658 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3659 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3660 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3661
3662 state = 0xdeadbee;
3663 action = 0xdeadbee;
3664 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3665 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3666 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3667 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3668
3669 state = 0xdeadbee;
3670 action = 0xdeadbee;
3671 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3672 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3673 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3674 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3675
3676 state = 0xdeadbee;
3677 action = 0xdeadbee;
3678 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3679 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3680 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3681 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3682
3683 state = 0xdeadbee;
3684 action = 0xdeadbee;
3685 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3686 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3687 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3688 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3689
3690 state = 0xdeadbee;
3691 action = 0xdeadbee;
3692 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3693 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3694 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3695 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3696
3697 state = 0xdeadbee;
3698 action = 0xdeadbee;
3699 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3700 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3701 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3702 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3703
3704 state = 0xdeadbee;
3705 action = 0xdeadbee;
3706 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3707 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3708 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3709 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3710
3711 state = 0xdeadbee;
3712 action = 0xdeadbee;
3713 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
3714 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3715 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3716 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3717
3718 state = 0xdeadbee;
3719 action = 0xdeadbee;
3720 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3721 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3722 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3723 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3724
3725 state = 0xdeadbee;
3726 action = 0xdeadbee;
3727 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3728 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3729 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3730 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3731
3732 state = 0xdeadbee;
3733 action = 0xdeadbee;
3734 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3735 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3736 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3737 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3738
3739 state = 0xdeadbee;
3740 action = 0xdeadbee;
3741 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3742 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3743 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3744 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3745
3746 state = 0xdeadbee;
3747 action = 0xdeadbee;
3748 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3749 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3750 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3751 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3752
3753 state = 0xdeadbee;
3754 action = 0xdeadbee;
3755 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3756 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3757 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3758 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3759
3760 state = 0xdeadbee;
3761 action = 0xdeadbee;
3762 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3763 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3764 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3765 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3766
3767 state = 0xdeadbee;
3768 action = 0xdeadbee;
3769 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3770 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3771 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3772 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3773
3774 state = 0xdeadbee;
3775 action = 0xdeadbee;
3776 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3777 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3778 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3779 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3780
3781 state = 0xdeadbee;
3782 action = 0xdeadbee;
3783 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3784 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3785 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3786 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3787
3788 state = 0xdeadbee;
3789 action = 0xdeadbee;
3790 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3791 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3792 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3793 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3794
3795 state = 0xdeadbee;
3796 action = 0xdeadbee;
3797 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3798 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3799 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3800 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3801
3802 state = 0xdeadbee;
3803 action = 0xdeadbee;
3804 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3805 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3806 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3807 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3808
3809 state = 0xdeadbee;
3810 action = 0xdeadbee;
3811 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3812 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3813 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3814 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3815
3816 state = 0xdeadbee;
3817 action = 0xdeadbee;
3818 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3819 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3820 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3821 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3822
3823 state = 0xdeadbee;
3824 action = 0xdeadbee;
3825 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3826 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3827 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3828 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3829
3830 state = 0xdeadbee;
3831 action = 0xdeadbee;
3832 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3833 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3834 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3835 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3836
3837 state = 0xdeadbee;
3838 action = 0xdeadbee;
3839 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3840 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3841 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3842 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3843
3844 state = 0xdeadbee;
3845 action = 0xdeadbee;
3846 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3847 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3848 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3849 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3850
3851 state = 0xdeadbee;
3852 action = 0xdeadbee;
3853 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3854 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3855 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3856 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3857
3858 state = 0xdeadbee;
3859 action = 0xdeadbee;
3860 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3861 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3862 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3863 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3864
3865 state = 0xdeadbee;
3866 action = 0xdeadbee;
3867 r = MsiGetComponentState(hpkg, "psi", &state, &action);
3868 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3869 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3870 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3871
3872 MsiCloseHandle( hpkg );
3873
3874 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3875
3876 /* publish the features and components */
3877 r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven REINSTALL=eight,nine,ten");
3878 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3879
3880 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
3881 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
3882
3883 /* these properties must not be in the saved msi file */
3884 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
3885 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3886
3887 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
3888 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3889
3890 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
3891 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3892
3893 r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
3894 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3895
3896 r = package_from_db( hdb, &hpkg );
3897 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
3898
3899 MsiCloseHandle(hdb);
3900
3901 state = 0xdeadbee;
3902 action = 0xdeadbee;
3903 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3904 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3905 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3906 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3907
3908 state = 0xdeadbee;
3909 action = 0xdeadbee;
3910 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3911 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3912 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3913 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3914
3915 state = 0xdeadbee;
3916 action = 0xdeadbee;
3917 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3918 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3919 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3920 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3921
3922 state = 0xdeadbee;
3923 action = 0xdeadbee;
3924 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3925 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3926 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3927 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3928
3929 state = 0xdeadbee;
3930 action = 0xdeadbee;
3931 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3932 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3933 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3934 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3935
3936 state = 0xdeadbee;
3937 action = 0xdeadbee;
3938 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3939 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3940 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3941 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3942
3943 state = 0xdeadbee;
3944 action = 0xdeadbee;
3945 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3946 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3947 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3948 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3949
3950 state = 0xdeadbee;
3951 action = 0xdeadbee;
3952 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3953 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3954 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3955 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3956
3957 state = 0xdeadbee;
3958 action = 0xdeadbee;
3959 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3960 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3961 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3962 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3963
3964 state = 0xdeadbee;
3965 action = 0xdeadbee;
3966 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3967 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3968 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3969 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3970
3971 state = 0xdeadbee;
3972 action = 0xdeadbee;
3973 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
3974 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3975 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3976 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3977
3978 state = 0xdeadbee;
3979 action = 0xdeadbee;
3980 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3981 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3982 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3983 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3984
3985 state = 0xdeadbee;
3986 action = 0xdeadbee;
3987 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3988 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3989 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3990 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3991
3992 state = 0xdeadbee;
3993 action = 0xdeadbee;
3994 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3995 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3996 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3997 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3998
3999 state = 0xdeadbee;
4000 action = 0xdeadbee;
4001 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4002 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4003 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4004 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4005
4006 state = 0xdeadbee;
4007 action = 0xdeadbee;
4008 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4009 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4010 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4011 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4012
4013 state = 0xdeadbee;
4014 action = 0xdeadbee;
4015 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4016 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4017 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4018 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4019
4020 state = 0xdeadbee;
4021 action = 0xdeadbee;
4022 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4023 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4024 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4025 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4026
4027 state = 0xdeadbee;
4028 action = 0xdeadbee;
4029 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4030 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4031 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4032 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4033
4034 state = 0xdeadbee;
4035 action = 0xdeadbee;
4036 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4037 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4038 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4039 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4040
4041 state = 0xdeadbee;
4042 action = 0xdeadbee;
4043 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4044 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4045 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4046 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4047
4048 state = 0xdeadbee;
4049 action = 0xdeadbee;
4050 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4051 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4052 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4053 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4054
4055 state = 0xdeadbee;
4056 action = 0xdeadbee;
4057 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4058 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4059 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4060 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4061
4062 state = 0xdeadbee;
4063 action = 0xdeadbee;
4064 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4065 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4066 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4067 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4068
4069 state = 0xdeadbee;
4070 action = 0xdeadbee;
4071 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4072 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4073 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4074 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4075
4076 state = 0xdeadbee;
4077 action = 0xdeadbee;
4078 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4079 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4080 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4081 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4082
4083 state = 0xdeadbee;
4084 action = 0xdeadbee;
4085 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4086 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4087 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4088 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4089
4090 state = 0xdeadbee;
4091 action = 0xdeadbee;
4092 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4093 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4094 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4095 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4096
4097 state = 0xdeadbee;
4098 action = 0xdeadbee;
4099 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4100 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4101 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4102 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4103
4104 state = 0xdeadbee;
4105 action = 0xdeadbee;
4106 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4107 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4108 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4109 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4110
4111 state = 0xdeadbee;
4112 action = 0xdeadbee;
4113 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4114 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4115 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4116 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4117
4118 state = 0xdeadbee;
4119 action = 0xdeadbee;
4120 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4121 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4122 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4123 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4124
4125 state = 0xdeadbee;
4126 action = 0xdeadbee;
4127 r = MsiGetComponentState(hpkg, "psi", &state, &action);
4128 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4129 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4130 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4131
4132 r = MsiDoAction( hpkg, "CostInitialize");
4133 ok( r == ERROR_SUCCESS, "cost init failed\n");
4134
4135 state = 0xdeadbee;
4136 action = 0xdeadbee;
4137 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4138 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4139 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4140 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4141
4142 state = 0xdeadbee;
4143 action = 0xdeadbee;
4144 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4145 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4146 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4147 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4148
4149 state = 0xdeadbee;
4150 action = 0xdeadbee;
4151 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4152 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4153 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4154 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4155
4156 state = 0xdeadbee;
4157 action = 0xdeadbee;
4158 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4159 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4160 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4161 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4162
4163 state = 0xdeadbee;
4164 action = 0xdeadbee;
4165 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4166 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4167 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4168 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4169
4170 state = 0xdeadbee;
4171 action = 0xdeadbee;
4172 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4173 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4174 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4175 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4176
4177 state = 0xdeadbee;
4178 action = 0xdeadbee;
4179 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4180 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4181 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4182 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4183
4184 state = 0xdeadbee;
4185 action = 0xdeadbee;
4186 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4187 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4188 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4189 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4190
4191 state = 0xdeadbee;
4192 action = 0xdeadbee;
4193 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4194 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4195 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4196 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4197
4198 state = 0xdeadbee;
4199 action = 0xdeadbee;
4200 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4201 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4202 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4203 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4204
4205 state = 0xdeadbee;
4206 action = 0xdeadbee;
4207 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
4208 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4209 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4210 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4211
4212 state = 0xdeadbee;
4213 action = 0xdeadbee;
4214 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4215 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4216 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4217 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4218
4219 state = 0xdeadbee;
4220 action = 0xdeadbee;
4221 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4222 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4223 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4224 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4225
4226 state = 0xdeadbee;
4227 action = 0xdeadbee;
4228 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4229 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4230 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4231 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4232
4233 state = 0xdeadbee;
4234 action = 0xdeadbee;
4235 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4236 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4237 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4238 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4239
4240 state = 0xdeadbee;
4241 action = 0xdeadbee;
4242 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4243 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4244 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4245 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4246
4247 state = 0xdeadbee;
4248 action = 0xdeadbee;
4249 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4250 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4251 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4252 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4253
4254 state = 0xdeadbee;
4255 action = 0xdeadbee;
4256 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4257 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4258 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4259 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4260
4261 state = 0xdeadbee;
4262 action = 0xdeadbee;
4263 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4264 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4265 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4266 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4267
4268 state = 0xdeadbee;
4269 action = 0xdeadbee;
4270 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4271 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4272 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4273 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4274
4275 state = 0xdeadbee;
4276 action = 0xdeadbee;
4277 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4278 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4279 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4280 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4281
4282 state = 0xdeadbee;
4283 action = 0xdeadbee;
4284 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4285 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4286 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4287 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4288
4289 state = 0xdeadbee;
4290 action = 0xdeadbee;
4291 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4292 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4293 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4294 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4295
4296 state = 0xdeadbee;
4297 action = 0xdeadbee;
4298 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4299 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4300 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4301 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4302
4303 state = 0xdeadbee;
4304 action = 0xdeadbee;
4305 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4306 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4307 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4308 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4309
4310 state = 0xdeadbee;
4311 action = 0xdeadbee;
4312 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4313 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4314 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4315 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4316
4317 state = 0xdeadbee;
4318 action = 0xdeadbee;
4319 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4320 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4321 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4322 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4323
4324 state = 0xdeadbee;
4325 action = 0xdeadbee;
4326 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4327 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4328 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4329 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4330
4331 state = 0xdeadbee;
4332 action = 0xdeadbee;
4333 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4334 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4335 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4336 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4337
4338 state = 0xdeadbee;
4339 action = 0xdeadbee;
4340 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4341 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4342 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4343 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4344
4345 state = 0xdeadbee;
4346 action = 0xdeadbee;
4347 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4348 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4349 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4350 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4351
4352 state = 0xdeadbee;
4353 action = 0xdeadbee;
4354 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4355 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4356 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4357 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4358
4359 state = 0xdeadbee;
4360 action = 0xdeadbee;
4361 r = MsiGetComponentState(hpkg, "psi", &state, &action);
4362 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4363 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4364 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4365
4366 r = MsiDoAction( hpkg, "FileCost");
4367 ok( r == ERROR_SUCCESS, "file cost failed\n");
4368
4369 state = 0xdeadbee;
4370 action = 0xdeadbee;
4371 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4372 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4373 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4374 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4375
4376 state = 0xdeadbee;
4377 action = 0xdeadbee;
4378 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4379 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4380 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4381 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4382
4383 state = 0xdeadbee;
4384 action = 0xdeadbee;
4385 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4386 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4387 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4388 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4389
4390 state = 0xdeadbee;
4391 action = 0xdeadbee;
4392 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4393 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4394 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4395 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4396
4397 state = 0xdeadbee;
4398 action = 0xdeadbee;
4399 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4400 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4401 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4402 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4403
4404 state = 0xdeadbee;
4405 action = 0xdeadbee;
4406 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4407 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4408 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4409 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4410
4411 state = 0xdeadbee;
4412 action = 0xdeadbee;
4413 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4414 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4415 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4416 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4417
4418 state = 0xdeadbee;
4419 action = 0xdeadbee;
4420 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4421 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4422 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4423 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4424
4425 state = 0xdeadbee;
4426 action = 0xdeadbee;
4427 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4428 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4429 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4430 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4431
4432 state = 0xdeadbee;
4433 action = 0xdeadbee;
4434 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4435 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4436 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4437 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4438
4439 state = 0xdeadbee;
4440 action = 0xdeadbee;
4441 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4442 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4443 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4444 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4445
4446 state = 0xdeadbee;
4447 action = 0xdeadbee;
4448 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4449 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4450 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4451 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4452
4453 state = 0xdeadbee;
4454 action = 0xdeadbee;
4455 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4456 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4457 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4458 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4459
4460 state = 0xdeadbee;
4461 action = 0xdeadbee;
4462 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4463 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4464 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4465 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4466
4467 state = 0xdeadbee;
4468 action = 0xdeadbee;
4469 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4470 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4471 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4472 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4473
4474 state = 0xdeadbee;
4475 action = 0xdeadbee;
4476 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4477 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4478 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4479 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4480
4481 state = 0xdeadbee;
4482 action = 0xdeadbee;
4483 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4484 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4485 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4486 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4487
4488 state = 0xdeadbee;
4489 action = 0xdeadbee;
4490 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4491 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4492 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4493 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4494
4495 state = 0xdeadbee;
4496 action = 0xdeadbee;
4497 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4498 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4499 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4500 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4501
4502 state = 0xdeadbee;
4503 action = 0xdeadbee;
4504 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4505 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4506 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4507 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4508
4509 state = 0xdeadbee;
4510 action = 0xdeadbee;
4511 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4512 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4513 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4514 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4515
4516 state = 0xdeadbee;
4517 action = 0xdeadbee;
4518 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4519 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4520 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4521 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4522
4523 state = 0xdeadbee;
4524 action = 0xdeadbee;
4525 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4526 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4527 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4528 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4529
4530 state = 0xdeadbee;
4531 action = 0xdeadbee;
4532 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4533 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4534 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4535 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4536
4537 state = 0xdeadbee;
4538 action = 0xdeadbee;
4539 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4540 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4541 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4542 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4543
4544 state = 0xdeadbee;
4545 action = 0xdeadbee;
4546 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4547 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4548 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4549 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4550
4551 state = 0xdeadbee;
4552 action = 0xdeadbee;
4553 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4554 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4555 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4556 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4557
4558 state = 0xdeadbee;
4559 action = 0xdeadbee;
4560 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4561 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4562 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4563 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4564
4565 state = 0xdeadbee;
4566 action = 0xdeadbee;
4567 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4568 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4569 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4570 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4571
4572 state = 0xdeadbee;
4573 action = 0xdeadbee;
4574 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4575 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4576 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4577 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4578
4579 state = 0xdeadbee;
4580 action = 0xdeadbee;
4581 r = MsiGetComponentState(hpkg, "psi", &state, &action);
4582 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4583 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4584 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4585
4586 r = MsiDoAction( hpkg, "CostFinalize");
4587 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
4588
4589 state = 0xdeadbee;
4590 action = 0xdeadbee;
4591 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4592 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4593 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4594 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4595
4596 state = 0xdeadbee;
4597 action = 0xdeadbee;
4598 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4599 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4600 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4601 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4602
4603 state = 0xdeadbee;
4604 action = 0xdeadbee;
4605 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4606 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4607 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4608 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4609
4610 state = 0xdeadbee;
4611 action = 0xdeadbee;
4612 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4613 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4614 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4615 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4616
4617 state = 0xdeadbee;
4618 action = 0xdeadbee;
4619 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4620 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4621 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4622 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4623
4624 state = 0xdeadbee;
4625 action = 0xdeadbee;
4626 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4627 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4628 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4629 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4630
4631 state = 0xdeadbee;
4632 action = 0xdeadbee;
4633 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4634 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4635 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4636 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4637
4638 state = 0xdeadbee;
4639 action = 0xdeadbee;
4640 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4641 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4642 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4643 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4644
4645 state = 0xdeadbee;
4646 action = 0xdeadbee;
4647 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4648 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4649 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4650 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4651
4652 state = 0xdeadbee;
4653 action = 0xdeadbee;
4654 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4655 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4656 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4657 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4658
4659 state = 0xdeadbee;
4660 action = 0xdeadbee;
4661 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
4662 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4663 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4664 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4665
4666 state = 0xdeadbee;
4667 action = 0xdeadbee;
4668 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4669 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4670 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4671 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4672
4673 state = 0xdeadbee;
4674 action = 0xdeadbee;
4675 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4676 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4677 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4678 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4679
4680 state = 0xdeadbee;
4681 action = 0xdeadbee;
4682 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4683 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4684 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4685 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4686
4687 state = 0xdeadbee;
4688 action = 0xdeadbee;
4689 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4690 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4691 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4692 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4693
4694 state = 0xdeadbee;
4695 action = 0xdeadbee;
4696 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4697 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4698 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4699 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4700
4701 state = 0xdeadbee;
4702 action = 0xdeadbee;
4703 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4704 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4705 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4706 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4707
4708 state = 0xdeadbee;
4709 action = 0xdeadbee;
4710 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4711 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4712 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4713 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4714
4715 state = 0xdeadbee;
4716 action = 0xdeadbee;
4717 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4718 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4719 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4720 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4721
4722 state = 0xdeadbee;
4723 action = 0xdeadbee;
4724 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4725 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4726 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4727 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4728
4729 state = 0xdeadbee;
4730 action = 0xdeadbee;
4731 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4732 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4733 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4734 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4735
4736 state = 0xdeadbee;
4737 action = 0xdeadbee;
4738 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4739 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4740 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4741 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4742
4743 state = 0xdeadbee;
4744 action = 0xdeadbee;
4745 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4746 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4747 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4748 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4749
4750 state = 0xdeadbee;
4751 action = 0xdeadbee;
4752 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4753 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4754 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4755 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4756
4757 state = 0xdeadbee;
4758 action = 0xdeadbee;
4759 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4760 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4761 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4762 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4763
4764 state = 0xdeadbee;
4765 action = 0xdeadbee;
4766 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4767 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4768 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4769 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4770
4771 state = 0xdeadbee;
4772 action = 0xdeadbee;
4773 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4774 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4775 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4776 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4777
4778 state = 0xdeadbee;
4779 action = 0xdeadbee;
4780 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4781 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4782 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4783 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4784
4785 state = 0xdeadbee;
4786 action = 0xdeadbee;
4787 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4788 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4789 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4790 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4791
4792 state = 0xdeadbee;
4793 action = 0xdeadbee;
4794 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4795 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4796 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4797 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4798
4799 state = 0xdeadbee;
4800 action = 0xdeadbee;
4801 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4802 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4803 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4804 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4805
4806 state = 0xdeadbee;
4807 action = 0xdeadbee;
4808 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4809 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4810 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4811 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4812
4813 state = 0xdeadbee;
4814 action = 0xdeadbee;
4815 r = MsiGetComponentState(hpkg, "psi", &state, &action);
4816 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4817 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4818 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4819
4820 MsiCloseHandle(hpkg);
4821
4822 /* uninstall the product */
4823 r = MsiInstallProduct(msifile, "REMOVE=ALL");
4824 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4825
4826 /* all features installed locally */
4827 r = MsiInstallProduct(msifile2, "ADDLOCAL=ALL");
4828 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4829
4830 r = MsiOpenDatabase(msifile2, MSIDBOPEN_DIRECT, &hdb);
4831 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
4832
4833 /* these properties must not be in the saved msi file */
4834 r = add_property_entry( hdb, "'ADDLOCAL', 'one,two,three,four,five,six,seven,eight,nine,ten'");
4835 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
4836
4837 r = package_from_db( hdb, &hpkg );
4838 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
4839
4840 state = 0xdeadbee;
4841 action = 0xdeadbee;
4842 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4843 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4844 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4845 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4846
4847 state = 0xdeadbee;
4848 action = 0xdeadbee;
4849 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4850 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4851 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4852 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4853
4854 state = 0xdeadbee;
4855 action = 0xdeadbee;
4856 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4857 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4858 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4859 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4860
4861 state = 0xdeadbee;
4862 action = 0xdeadbee;
4863 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4864 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4865 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4866 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4867
4868 state = 0xdeadbee;
4869 action = 0xdeadbee;
4870 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4871 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4872 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4873 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4874
4875 state = 0xdeadbee;
4876 action = 0xdeadbee;
4877 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4878 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4879 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4880 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4881
4882 state = 0xdeadbee;
4883 action = 0xdeadbee;
4884 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4885 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4886 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4887 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4888
4889 state = 0xdeadbee;
4890 action = 0xdeadbee;
4891 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4892 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4893 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4894 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4895
4896 state = 0xdeadbee;
4897 action = 0xdeadbee;
4898 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4899 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4900 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4901 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4902
4903 state = 0xdeadbee;
4904 action = 0xdeadbee;
4905 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4906 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4907 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4908 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4909
4910 state = 0xdeadbee;
4911 action = 0xdeadbee;
4912 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
4913 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4914 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4915 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4916
4917 state = 0xdeadbee;
4918 action = 0xdeadbee;
4919 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4920 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4921 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4922 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4923
4924 state = 0xdeadbee;
4925 action = 0xdeadbee;
4926 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4927 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4928 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4929 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4930
4931 state = 0xdeadbee;
4932 action = 0xdeadbee;
4933 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4934 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4935 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4936 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4937
4938 state = 0xdeadbee;
4939 action = 0xdeadbee;
4940 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4941 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4942 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4943 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4944
4945 state = 0xdeadbee;
4946 action = 0xdeadbee;
4947 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4948 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4949 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4950 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4951
4952 state = 0xdeadbee;
4953 action = 0xdeadbee;
4954 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4955 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4956 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4957 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4958
4959 state = 0xdeadbee;
4960 action = 0xdeadbee;
4961 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4962 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4963 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4964 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4965
4966 state = 0xdeadbee;
4967 action = 0xdeadbee;
4968 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4969 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4970 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4971 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4972
4973 state = 0xdeadbee;
4974 action = 0xdeadbee;
4975 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4976 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4977 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4978 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4979
4980 state = 0xdeadbee;
4981 action = 0xdeadbee;
4982 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4983 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4984 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4985 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4986
4987 state = 0xdeadbee;
4988 action = 0xdeadbee;
4989 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4990 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4991 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4992 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4993
4994 state = 0xdeadbee;
4995 action = 0xdeadbee;
4996 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4997 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4998 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4999 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5000
5001 state = 0xdeadbee;
5002 action = 0xdeadbee;
5003 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5004 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5005 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5006 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5007
5008 state = 0xdeadbee;
5009 action = 0xdeadbee;
5010 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5011 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5012 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5013 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5014
5015 state = 0xdeadbee;
5016 action = 0xdeadbee;
5017 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5018 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5019 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5020 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5021
5022 state = 0xdeadbee;
5023 action = 0xdeadbee;
5024 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5025 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5026 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5027 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5028
5029 state = 0xdeadbee;
5030 action = 0xdeadbee;
5031 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5032 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5033 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5034 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5035
5036 state = 0xdeadbee;
5037 action = 0xdeadbee;
5038 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5039 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5040 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5041 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5042
5043 state = 0xdeadbee;
5044 action = 0xdeadbee;
5045 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5046 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5047 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5048 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5049
5050 state = 0xdeadbee;
5051 action = 0xdeadbee;
5052 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5053 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5054 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5055 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5056
5057 state = 0xdeadbee;
5058 action = 0xdeadbee;
5059 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5060 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5061 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5062 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5063
5064 state = 0xdeadbee;
5065 action = 0xdeadbee;
5066 r = MsiGetComponentState(hpkg, "psi", &state, &action);
5067 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5068 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5069 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5070
5071 r = MsiDoAction( hpkg, "CostInitialize");
5072 ok( r == ERROR_SUCCESS, "cost init failed\n");
5073
5074 state = 0xdeadbee;
5075 action = 0xdeadbee;
5076 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5077 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5078 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5079 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5080
5081 state = 0xdeadbee;
5082 action = 0xdeadbee;
5083 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5084 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5085 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5086 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5087
5088 state = 0xdeadbee;
5089 action = 0xdeadbee;
5090 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5091 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5092 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5093 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5094
5095 state = 0xdeadbee;
5096 action = 0xdeadbee;
5097 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5098 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5099 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5100 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5101
5102 state = 0xdeadbee;
5103 action = 0xdeadbee;
5104 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5105 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5106 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5107 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5108
5109 state = 0xdeadbee;
5110 action = 0xdeadbee;
5111 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5112 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5113 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5114 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5115
5116 state = 0xdeadbee;
5117 action = 0xdeadbee;
5118 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5119 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5120 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5121 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5122
5123 state = 0xdeadbee;
5124 action = 0xdeadbee;
5125 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5126 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5127 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5128 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5129
5130 state = 0xdeadbee;
5131 action = 0xdeadbee;
5132 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5133 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5134 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5135 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5136
5137 state = 0xdeadbee;
5138 action = 0xdeadbee;
5139 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5140 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5141 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5142 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5143
5144 state = 0xdeadbee;
5145 action = 0xdeadbee;
5146 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
5147 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5148 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5149 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5150
5151 state = 0xdeadbee;
5152 action = 0xdeadbee;
5153 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5154 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5155 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5156 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5157
5158 state = 0xdeadbee;
5159 action = 0xdeadbee;
5160 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5161 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5162 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5163 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5164
5165 state = 0xdeadbee;
5166 action = 0xdeadbee;
5167 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5168 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5169 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5170 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5171
5172 state = 0xdeadbee;
5173 action = 0xdeadbee;
5174 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5175 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5176 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5177 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5178
5179 state = 0xdeadbee;
5180 action = 0xdeadbee;
5181 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5182 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5183 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5184 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5185
5186 state = 0xdeadbee;
5187 action = 0xdeadbee;
5188 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5189 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5190 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5191 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5192
5193 state = 0xdeadbee;
5194 action = 0xdeadbee;
5195 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5196 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5197 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5198 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5199
5200 state = 0xdeadbee;
5201 action = 0xdeadbee;
5202 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5203 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5204 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5205 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5206
5207 state = 0xdeadbee;
5208 action = 0xdeadbee;
5209 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5210 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5211 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5212 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5213
5214 state = 0xdeadbee;
5215 action = 0xdeadbee;
5216 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5217 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5218 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5219 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5220
5221 state = 0xdeadbee;
5222 action = 0xdeadbee;
5223 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5224 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5225 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5226 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5227
5228 state = 0xdeadbee;
5229 action = 0xdeadbee;
5230 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5231 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5232 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5233 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5234
5235 state = 0xdeadbee;
5236 action = 0xdeadbee;
5237 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5238 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5239 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5240 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5241
5242 state = 0xdeadbee;
5243 action = 0xdeadbee;
5244 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5245 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5246 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5247 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5248
5249 state = 0xdeadbee;
5250 action = 0xdeadbee;
5251 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5252 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5253 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5254 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5255
5256 state = 0xdeadbee;
5257 action = 0xdeadbee;
5258 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5259 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5260 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5261 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5262
5263 state = 0xdeadbee;
5264 action = 0xdeadbee;
5265 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5266 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5267 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5268 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5269
5270 state = 0xdeadbee;
5271 action = 0xdeadbee;
5272 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5273 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5274 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5275 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5276
5277 state = 0xdeadbee;
5278 action = 0xdeadbee;
5279 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5280 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5281 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5282 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5283
5284 state = 0xdeadbee;
5285 action = 0xdeadbee;
5286 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5287 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5288 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5289 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5290
5291 state = 0xdeadbee;
5292 action = 0xdeadbee;
5293 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5294 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5295 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5296 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5297
5298 state = 0xdeadbee;
5299 action = 0xdeadbee;
5300 r = MsiGetComponentState(hpkg, "psi", &state, &action);
5301 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5302 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5303 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5304
5305 r = MsiDoAction( hpkg, "FileCost");
5306 ok( r == ERROR_SUCCESS, "file cost failed\n");
5307
5308 state = 0xdeadbee;
5309 action = 0xdeadbee;
5310 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5311 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5312 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5313 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5314
5315 state = 0xdeadbee;
5316 action = 0xdeadbee;
5317 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5318 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5319 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5320 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5321
5322 state = 0xdeadbee;
5323 action = 0xdeadbee;
5324 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5325 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5326 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5327 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5328
5329 state = 0xdeadbee;
5330 action = 0xdeadbee;
5331 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5332 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5333 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5334 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5335
5336 state = 0xdeadbee;
5337 action = 0xdeadbee;
5338 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5339 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5340 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5341 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5342
5343 state = 0xdeadbee;
5344 action = 0xdeadbee;
5345 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5346 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5347 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5348 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5349
5350 state = 0xdeadbee;
5351 action = 0xdeadbee;
5352 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5353 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5354 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5355 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5356
5357 state = 0xdeadbee;
5358 action = 0xdeadbee;
5359 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5360 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5361 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5362 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5363
5364 state = 0xdeadbee;
5365 action = 0xdeadbee;
5366 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5367 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5368 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5369 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5370
5371 state = 0xdeadbee;
5372 action = 0xdeadbee;
5373 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5374 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5375 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5376 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5377
5378 state = 0xdeadbee;
5379 action = 0xdeadbee;
5380 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
5381 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5382 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5383 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5384
5385 state = 0xdeadbee;
5386 action = 0xdeadbee;
5387 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5388 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5389 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5390 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5391
5392 state = 0xdeadbee;
5393 action = 0xdeadbee;
5394 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5395 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5396 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5397 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5398
5399 state = 0xdeadbee;
5400 action = 0xdeadbee;
5401 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5402 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5403 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5404 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5405
5406 state = 0xdeadbee;
5407 action = 0xdeadbee;
5408 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5409 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5410 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5411 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5412
5413 state = 0xdeadbee;
5414 action = 0xdeadbee;
5415 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5416 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5417 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5418 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5419
5420 state = 0xdeadbee;
5421 action = 0xdeadbee;
5422 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5423 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5424 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5425 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5426
5427 state = 0xdeadbee;
5428 action = 0xdeadbee;
5429 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5430 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5431 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5432 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5433
5434 state = 0xdeadbee;
5435 action = 0xdeadbee;
5436 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5437 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5438 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5439 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5440
5441 state = 0xdeadbee;
5442 action = 0xdeadbee;
5443 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5444 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5445 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5446 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5447
5448 state = 0xdeadbee;
5449 action = 0xdeadbee;
5450 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5451 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5452 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5453 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5454
5455 state = 0xdeadbee;
5456 action = 0xdeadbee;
5457 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5458 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5459 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5460 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5461
5462 state = 0xdeadbee;
5463 action = 0xdeadbee;
5464 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5465 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5466 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5467 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5468
5469 state = 0xdeadbee;
5470 action = 0xdeadbee;
5471 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5472 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5473 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5474 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5475
5476 state = 0xdeadbee;
5477 action = 0xdeadbee;
5478 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5479 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5480 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5481 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5482
5483 state = 0xdeadbee;
5484 action = 0xdeadbee;
5485 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5486 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5487 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5488 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5489
5490 state = 0xdeadbee;
5491 action = 0xdeadbee;
5492 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5493 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5494 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5495 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5496
5497 state = 0xdeadbee;
5498 action = 0xdeadbee;
5499 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5500 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5501 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5502 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5503
5504 state = 0xdeadbee;
5505 action = 0xdeadbee;
5506 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5507 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5508 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5509 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5510
5511 state = 0xdeadbee;
5512 action = 0xdeadbee;
5513 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5514 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5515 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5516 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5517
5518 state = 0xdeadbee;
5519 action = 0xdeadbee;
5520 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5521 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5522 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5523 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5524
5525 state = 0xdeadbee;
5526 action = 0xdeadbee;
5527 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5528 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5529 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5530 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5531
5532 state = 0xdeadbee;
5533 action = 0xdeadbee;
5534 r = MsiGetComponentState(hpkg, "psi", &state, &action);
5535 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5536 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5537 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5538
5539 r = MsiDoAction( hpkg, "CostFinalize");
5540 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
5541
5542 state = 0xdeadbee;
5543 action = 0xdeadbee;
5544 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5545 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5546 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5547 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5548
5549 state = 0xdeadbee;
5550 action = 0xdeadbee;
5551 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5552 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5553 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5554 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5555
5556 state = 0xdeadbee;
5557 action = 0xdeadbee;
5558 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5559 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5560 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5561 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5562
5563 state = 0xdeadbee;
5564 action = 0xdeadbee;
5565 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5566 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5567 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5568 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5569
5570 state = 0xdeadbee;
5571 action = 0xdeadbee;
5572 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5573 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5574 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5575 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5576
5577 state = 0xdeadbee;
5578 action = 0xdeadbee;
5579 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5580 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5581 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5582 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5583
5584 state = 0xdeadbee;
5585 action = 0xdeadbee;
5586 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5587 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5588 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5589 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5590
5591 state = 0xdeadbee;
5592 action = 0xdeadbee;
5593 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5594 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5595 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5596 todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5597
5598 state = 0xdeadbee;
5599 action = 0xdeadbee;
5600 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5601 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5602 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5603 todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5604
5605 state = 0xdeadbee;
5606 action = 0xdeadbee;
5607 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5608 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5609 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5610 todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5611
5612 state = 0xdeadbee;
5613 action = 0xdeadbee;
5614 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
5615 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5616 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5617 todo_wine ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5618
5619 state = 0xdeadbee;
5620 action = 0xdeadbee;
5621 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5622 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5623 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5624 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5625
5626 state = 0xdeadbee;
5627 action = 0xdeadbee;
5628 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5629 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5630 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5631 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5632
5633 state = 0xdeadbee;
5634 action = 0xdeadbee;
5635 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5636 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5637 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5638 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5639
5640 state = 0xdeadbee;
5641 action = 0xdeadbee;
5642 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5643 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5644 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5645 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5646
5647 state = 0xdeadbee;
5648 action = 0xdeadbee;
5649 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5650 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5651 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5652 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5653
5654 state = 0xdeadbee;
5655 action = 0xdeadbee;
5656 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5657 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5658 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5659 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5660
5661 state = 0xdeadbee;
5662 action = 0xdeadbee;
5663 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5664 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5665 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5666 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5667
5668 state = 0xdeadbee;
5669 action = 0xdeadbee;
5670 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5671 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5672 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5673 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5674
5675 state = 0xdeadbee;
5676 action = 0xdeadbee;
5677 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5678 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5679 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5680 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5681
5682 state = 0xdeadbee;
5683 action = 0xdeadbee;
5684 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5685 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5686 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5687 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5688
5689 state = 0xdeadbee;
5690 action = 0xdeadbee;
5691 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5692 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5693 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5694 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5695
5696 state = 0xdeadbee;
5697 action = 0xdeadbee;
5698 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5699 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5700 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5701 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5702
5703 state = 0xdeadbee;
5704 action = 0xdeadbee;
5705 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5706 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5707 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5708 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5709
5710 state = 0xdeadbee;
5711 action = 0xdeadbee;
5712 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5713 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5714 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5715 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5716
5717 state = 0xdeadbee;
5718 action = 0xdeadbee;
5719 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5720 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5721 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5722 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5723
5724 state = 0xdeadbee;
5725 action = 0xdeadbee;
5726 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5727 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5728 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5729 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5730
5731 state = 0xdeadbee;
5732 action = 0xdeadbee;
5733 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5734 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5735 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5736 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5737
5738 state = 0xdeadbee;
5739 action = 0xdeadbee;
5740 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5741 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5742 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5743 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5744
5745 state = 0xdeadbee;
5746 action = 0xdeadbee;
5747 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5748 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5749 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5750 todo_wine ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5751
5752 state = 0xdeadbee;
5753 action = 0xdeadbee;
5754 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5755 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5756 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5757 todo_wine ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5758
5759 state = 0xdeadbee;
5760 action = 0xdeadbee;
5761 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5762 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5763 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5764 todo_wine ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5765
5766 state = 0xdeadbee;
5767 action = 0xdeadbee;
5768 r = MsiGetComponentState(hpkg, "psi", &state, &action);
5769 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5770 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5771 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5772
5773 MsiCloseHandle(hpkg);
5774
5775 /* uninstall the product */
5776 r = MsiInstallProduct(msifile2, "REMOVE=ALL");
5777 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5778
5779 /* all features installed from source */
5780 r = MsiInstallProduct(msifile3, "ADDSOURCE=ALL");
5781 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5782
5783 r = MsiOpenDatabase(msifile3, MSIDBOPEN_DIRECT, &hdb);
5784 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
5785
5786 /* this property must not be in the saved msi file */
5787 r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
5788 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
5789
5790 r = package_from_db( hdb, &hpkg );
5791 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
5792
5793 state = 0xdeadbee;
5794 action = 0xdeadbee;
5795 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5796 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5797 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5798 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5799
5800 state = 0xdeadbee;
5801 action = 0xdeadbee;
5802 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5803 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5804 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5805 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5806
5807 state = 0xdeadbee;
5808 action = 0xdeadbee;
5809 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5810 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5811 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5812 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5813
5814 state = 0xdeadbee;
5815 action = 0xdeadbee;
5816 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5817 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5818 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5819 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5820
5821 state = 0xdeadbee;
5822 action = 0xdeadbee;
5823 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5824 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5825 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5826 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5827
5828 state = 0xdeadbee;
5829 action = 0xdeadbee;
5830 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5831 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5832 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5833 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5834
5835 state = 0xdeadbee;
5836 action = 0xdeadbee;
5837 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5838 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5839 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5840 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5841
5842 state = 0xdeadbee;
5843 action = 0xdeadbee;
5844 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5845 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5846 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5847 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5848
5849 state = 0xdeadbee;
5850 action = 0xdeadbee;
5851 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5852 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5853 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5854 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5855
5856 state = 0xdeadbee;
5857 action = 0xdeadbee;
5858 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5859 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5860 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5861 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5862
5863 state = 0xdeadbee;
5864 action = 0xdeadbee;
5865 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
5866 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5867 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5868 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5869
5870 state = 0xdeadbee;
5871 action = 0xdeadbee;
5872 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5873 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5874 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5875 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5876
5877 state = 0xdeadbee;
5878 action = 0xdeadbee;
5879 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5880 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5881 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5882 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5883
5884 state = 0xdeadbee;
5885 action = 0xdeadbee;
5886 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5887 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5888 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5889 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5890
5891 state = 0xdeadbee;
5892 action = 0xdeadbee;
5893 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5894 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5895 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5896 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5897
5898 state = 0xdeadbee;
5899 action = 0xdeadbee;
5900 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5901 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5902 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5903 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5904
5905 state = 0xdeadbee;
5906 action = 0xdeadbee;
5907 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5908 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5909 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5910 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5911
5912 state = 0xdeadbee;
5913 action = 0xdeadbee;
5914 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5915 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5916 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5917 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5918
5919 state = 0xdeadbee;
5920 action = 0xdeadbee;
5921 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5922 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5923 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5924 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5925
5926 state = 0xdeadbee;
5927 action = 0xdeadbee;
5928 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5929 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5930 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5931 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5932
5933 state = 0xdeadbee;
5934 action = 0xdeadbee;
5935 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5936 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5937 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5938 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5939
5940 state = 0xdeadbee;
5941 action = 0xdeadbee;
5942 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5943 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5944 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5945 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5946
5947 state = 0xdeadbee;
5948 action = 0xdeadbee;
5949 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5950 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5951 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5952 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5953
5954 state = 0xdeadbee;
5955 action = 0xdeadbee;
5956 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5957 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5958 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5959 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5960
5961 state = 0xdeadbee;
5962 action = 0xdeadbee;
5963 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5964 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5965 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5966 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5967
5968 state = 0xdeadbee;
5969 action = 0xdeadbee;
5970 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5971 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5972 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5973 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5974
5975 state = 0xdeadbee;
5976 action = 0xdeadbee;
5977 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5978 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5979 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5980 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5981
5982 state = 0xdeadbee;
5983 action = 0xdeadbee;
5984 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5985 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5986 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5987 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5988
5989 state = 0xdeadbee;
5990 action = 0xdeadbee;
5991 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5992 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5993 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5994 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5995
5996 state = 0xdeadbee;
5997 action = 0xdeadbee;
5998 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5999 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6000 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6001 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6002
6003 state = 0xdeadbee;
6004 action = 0xdeadbee;
6005 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6006 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6007 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6008 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6009
6010 state = 0xdeadbee;
6011 action = 0xdeadbee;
6012 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6013 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6014 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6015 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6016
6017 state = 0xdeadbee;
6018 action = 0xdeadbee;
6019 r = MsiGetComponentState(hpkg, "psi", &state, &action);
6020 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6021 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6022 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6023
6024 r = MsiDoAction( hpkg, "CostInitialize");
6025 ok( r == ERROR_SUCCESS, "cost init failed\n");
6026
6027 state = 0xdeadbee;
6028 action = 0xdeadbee;
6029 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6030 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6031 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6032 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6033
6034 state = 0xdeadbee;
6035 action = 0xdeadbee;
6036 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6037 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6038 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6039 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6040
6041 state = 0xdeadbee;
6042 action = 0xdeadbee;
6043 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6044 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6045 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6046 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6047
6048 state = 0xdeadbee;
6049 action = 0xdeadbee;
6050 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6051 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6052 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6053 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6054
6055 state = 0xdeadbee;
6056 action = 0xdeadbee;
6057 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6058 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6059 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6060 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6061
6062 state = 0xdeadbee;
6063 action = 0xdeadbee;
6064 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6065 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6066 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6067 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6068
6069 state = 0xdeadbee;
6070 action = 0xdeadbee;
6071 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6072 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6073 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6074 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6075
6076 state = 0xdeadbee;
6077 action = 0xdeadbee;
6078 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6079 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6080 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6081 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6082
6083 state = 0xdeadbee;
6084 action = 0xdeadbee;
6085 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6086 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6087 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6088 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6089
6090 state = 0xdeadbee;
6091 action = 0xdeadbee;
6092 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6093 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6094 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6095 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6096
6097 state = 0xdeadbee;
6098 action = 0xdeadbee;
6099 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
6100 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6101 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6102 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6103
6104 state = 0xdeadbee;
6105 action = 0xdeadbee;
6106 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6107 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6108 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6109 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6110
6111 state = 0xdeadbee;
6112 action = 0xdeadbee;
6113 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6114 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6115 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6116 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6117
6118 state = 0xdeadbee;
6119 action = 0xdeadbee;
6120 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6121 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6122 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6123 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6124
6125 state = 0xdeadbee;
6126 action = 0xdeadbee;
6127 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6128 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6129 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6130 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6131
6132 state = 0xdeadbee;
6133 action = 0xdeadbee;
6134 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6135 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6136 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6137 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6138
6139 state = 0xdeadbee;
6140 action = 0xdeadbee;
6141 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6142 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6143 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6144 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6145
6146 state = 0xdeadbee;
6147 action = 0xdeadbee;
6148 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6149 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6150 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6151 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6152
6153 state = 0xdeadbee;
6154 action = 0xdeadbee;
6155 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6156 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6157 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6158 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6159
6160 state = 0xdeadbee;
6161 action = 0xdeadbee;
6162 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6163 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6164 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6165 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6166
6167 state = 0xdeadbee;
6168 action = 0xdeadbee;
6169 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6170 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6171 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6172 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6173
6174 state = 0xdeadbee;
6175 action = 0xdeadbee;
6176 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6177 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6178 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6179 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6180
6181 state = 0xdeadbee;
6182 action = 0xdeadbee;
6183 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6184 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6185 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6186 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6187
6188 state = 0xdeadbee;
6189 action = 0xdeadbee;
6190 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6191 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6192 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6193 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6194
6195 state = 0xdeadbee;
6196 action = 0xdeadbee;
6197 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6198 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6199 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6200 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6201
6202 state = 0xdeadbee;
6203 action = 0xdeadbee;
6204 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6205 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6206 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6207 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6208
6209 state = 0xdeadbee;
6210 action = 0xdeadbee;
6211 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6212 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6213 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6214 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6215
6216 state = 0xdeadbee;
6217 action = 0xdeadbee;
6218 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6219 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6220 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6221 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6222
6223 state = 0xdeadbee;
6224 action = 0xdeadbee;
6225 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6226 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6227 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6228 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6229
6230 state = 0xdeadbee;
6231 action = 0xdeadbee;
6232 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6233 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6234 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6235 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6236
6237 state = 0xdeadbee;
6238 action = 0xdeadbee;
6239 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6240 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6241 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6242 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6243
6244 state = 0xdeadbee;
6245 action = 0xdeadbee;
6246 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6247 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6248 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6249 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6250
6251 state = 0xdeadbee;
6252 action = 0xdeadbee;
6253 r = MsiGetComponentState(hpkg, "psi", &state, &action);
6254 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6255 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6256 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6257
6258 r = MsiDoAction( hpkg, "FileCost");
6259 ok( r == ERROR_SUCCESS, "file cost failed\n");
6260
6261 state = 0xdeadbee;
6262 action = 0xdeadbee;
6263 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6264 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6265 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6266 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6267
6268 state = 0xdeadbee;
6269 action = 0xdeadbee;
6270 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6271 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6272 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6273 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6274
6275 state = 0xdeadbee;
6276 action = 0xdeadbee;
6277 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6278 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6279 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6280 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6281
6282 state = 0xdeadbee;
6283 action = 0xdeadbee;
6284 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6285 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6286 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6287 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6288
6289 state = 0xdeadbee;
6290 action = 0xdeadbee;
6291 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6292 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6293 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6294 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6295
6296 state = 0xdeadbee;
6297 action = 0xdeadbee;
6298 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6299 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6300 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6301 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6302
6303 state = 0xdeadbee;
6304 action = 0xdeadbee;
6305 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6306 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6307 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6308 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6309
6310 state = 0xdeadbee;
6311 action = 0xdeadbee;
6312 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6313 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6314 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6315 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6316
6317 state = 0xdeadbee;
6318 action = 0xdeadbee;
6319 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6320 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6321 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6322 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6323
6324 state = 0xdeadbee;
6325 action = 0xdeadbee;
6326 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6327 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6328 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6329 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6330
6331 state = 0xdeadbee;
6332 action = 0xdeadbee;
6333 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
6334 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6335 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6336 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6337
6338 state = 0xdeadbee;
6339 action = 0xdeadbee;
6340 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6341 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6342 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6343 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6344
6345 state = 0xdeadbee;
6346 action = 0xdeadbee;
6347 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6348 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6349 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6350 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6351
6352 state = 0xdeadbee;
6353 action = 0xdeadbee;
6354 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6355 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6356 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6357 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6358
6359 state = 0xdeadbee;
6360 action = 0xdeadbee;
6361 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6362 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6363 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6364 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6365
6366 state = 0xdeadbee;
6367 action = 0xdeadbee;
6368 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6369 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6370 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6371 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6372
6373 state = 0xdeadbee;
6374 action = 0xdeadbee;
6375 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6376 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6377 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6378 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6379
6380 state = 0xdeadbee;
6381 action = 0xdeadbee;
6382 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6383 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6384 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6385 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6386
6387 state = 0xdeadbee;
6388 action = 0xdeadbee;
6389 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6390 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6391 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6392 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6393
6394 state = 0xdeadbee;
6395 action = 0xdeadbee;
6396 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6397 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6398 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6399 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6400
6401 state = 0xdeadbee;
6402 action = 0xdeadbee;
6403 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6404 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6405 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6406 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6407
6408 state = 0xdeadbee;
6409 action = 0xdeadbee;
6410 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6411 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6412 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6413 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6414
6415 state = 0xdeadbee;
6416 action = 0xdeadbee;
6417 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6418 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6419 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6420 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6421
6422 state = 0xdeadbee;
6423 action = 0xdeadbee;
6424 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6425 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6426 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6427 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6428
6429 state = 0xdeadbee;
6430 action = 0xdeadbee;
6431 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6432 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6433 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6434 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6435
6436 state = 0xdeadbee;
6437 action = 0xdeadbee;
6438 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6439 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6440 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6441 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6442
6443 state = 0xdeadbee;
6444 action = 0xdeadbee;
6445 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6446 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6447 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6448 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6449
6450 state = 0xdeadbee;
6451 action = 0xdeadbee;
6452 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6453 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6454 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6455 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6456
6457 state = 0xdeadbee;
6458 action = 0xdeadbee;
6459 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6460 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6461 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6462 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6463
6464 state = 0xdeadbee;
6465 action = 0xdeadbee;
6466 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6467 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6468 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6469 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6470
6471 state = 0xdeadbee;
6472 action = 0xdeadbee;
6473 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6474 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6475 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6476 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6477
6478 state = 0xdeadbee;
6479 action = 0xdeadbee;
6480 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6481 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6482 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6483 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6484
6485 state = 0xdeadbee;
6486 action = 0xdeadbee;
6487 r = MsiGetComponentState(hpkg, "psi", &state, &action);
6488 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6489 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6490 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6491
6492 r = MsiDoAction( hpkg, "CostFinalize");
6493 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
6494
6495 state = 0xdeadbee;
6496 action = 0xdeadbee;
6497 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6498 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6499 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6500 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6501
6502 state = 0xdeadbee;
6503 action = 0xdeadbee;
6504 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6505 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6506 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6507 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6508
6509 state = 0xdeadbee;
6510 action = 0xdeadbee;
6511 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6512 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6513 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6514 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6515
6516 state = 0xdeadbee;
6517 action = 0xdeadbee;
6518 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6519 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6520 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6521 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6522
6523 state = 0xdeadbee;
6524 action = 0xdeadbee;
6525 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6526 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6527 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6528 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6529
6530 state = 0xdeadbee;
6531 action = 0xdeadbee;
6532 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6533 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6534 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6535 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6536
6537 state = 0xdeadbee;
6538 action = 0xdeadbee;
6539 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6540 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6541 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6542 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6543
6544 state = 0xdeadbee;
6545 action = 0xdeadbee;
6546 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6547 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6548 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6549 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6550
6551 state = 0xdeadbee;
6552 action = 0xdeadbee;
6553 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6554 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6555 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6556 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6557
6558 state = 0xdeadbee;
6559 action = 0xdeadbee;
6560 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6561 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6562 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6563 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6564
6565 state = 0xdeadbee;
6566 action = 0xdeadbee;
6567 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
6568 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6569 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6570 todo_wine ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6571
6572 state = 0xdeadbee;
6573 action = 0xdeadbee;
6574 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6575 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6576 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6577 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6578
6579 state = 0xdeadbee;
6580 action = 0xdeadbee;
6581 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6582 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6583 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6584 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6585
6586 state = 0xdeadbee;
6587 action = 0xdeadbee;
6588 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6589 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6590 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6591 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6592
6593 state = 0xdeadbee;
6594 action = 0xdeadbee;
6595 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6596 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6597 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6598 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6599
6600 state = 0xdeadbee;
6601 action = 0xdeadbee;
6602 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6603 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6604 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6605 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6606
6607 state = 0xdeadbee;
6608 action = 0xdeadbee;
6609 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6610 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6611 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6612 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6613
6614 state = 0xdeadbee;
6615 action = 0xdeadbee;
6616 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6617 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6618 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6619 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6620
6621 state = 0xdeadbee;
6622 action = 0xdeadbee;
6623 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6624 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6625 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6626 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6627
6628 state = 0xdeadbee;
6629 action = 0xdeadbee;
6630 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6631 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6632 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6633 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6634
6635 state = 0xdeadbee;
6636 action = 0xdeadbee;
6637 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6638 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6639 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6640 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6641
6642 state = 0xdeadbee;
6643 action = 0xdeadbee;
6644 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6645 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6646 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6647 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6648
6649 state = 0xdeadbee;
6650 action = 0xdeadbee;
6651 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6652 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6653 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6654 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6655
6656 state = 0xdeadbee;
6657 action = 0xdeadbee;
6658 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6659 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6660 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6661 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6662
6663 state = 0xdeadbee;
6664 action = 0xdeadbee;
6665 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6666 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6667 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6668 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6669
6670 state = 0xdeadbee;
6671 action = 0xdeadbee;
6672 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6673 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6674 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6675 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6676
6677 state = 0xdeadbee;
6678 action = 0xdeadbee;
6679 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6680 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6681 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6682 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6683
6684 state = 0xdeadbee;
6685 action = 0xdeadbee;
6686 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6687 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6688 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6689 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6690
6691 state = 0xdeadbee;
6692 action = 0xdeadbee;
6693 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6694 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6695 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6696 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6697
6698 state = 0xdeadbee;
6699 action = 0xdeadbee;
6700 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6701 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6702 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6703 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6704
6705 state = 0xdeadbee;
6706 action = 0xdeadbee;
6707 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6708 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6709 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6710 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6711
6712 state = 0xdeadbee;
6713 action = 0xdeadbee;
6714 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6715 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6716 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6717 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6718
6719 state = 0xdeadbee;
6720 action = 0xdeadbee;
6721 r = MsiGetComponentState(hpkg, "psi", &state, &action);
6722 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6723 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6724 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6725
6726 MsiCloseHandle(hpkg);
6727
6728 /* reinstall the product */
6729 r = MsiInstallProduct(msifile3, "REINSTALL=ALL");
6730 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6731
6732 r = MsiOpenDatabase(msifile4, MSIDBOPEN_DIRECT, &hdb);
6733 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
6734
6735 /* this property must not be in the saved msi file */
6736 r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
6737 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
6738
6739 r = package_from_db( hdb, &hpkg );
6740 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
6741
6742 state = 0xdeadbee;
6743 action = 0xdeadbee;
6744 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6745 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6746 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6747 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6748
6749 state = 0xdeadbee;
6750 action = 0xdeadbee;
6751 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6752 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6753 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6754 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6755
6756 state = 0xdeadbee;
6757 action = 0xdeadbee;
6758 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6759 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6760 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6761 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6762
6763 state = 0xdeadbee;
6764 action = 0xdeadbee;
6765 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6766 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6767 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6768 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6769
6770 state = 0xdeadbee;
6771 action = 0xdeadbee;
6772 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6773 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6774 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6775 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6776
6777 state = 0xdeadbee;
6778 action = 0xdeadbee;
6779 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6780 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6781 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6782 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6783
6784 state = 0xdeadbee;
6785 action = 0xdeadbee;
6786 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6787 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6788 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6789 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6790
6791 state = 0xdeadbee;
6792 action = 0xdeadbee;
6793 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6794 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6795 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6796 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6797
6798 state = 0xdeadbee;
6799 action = 0xdeadbee;
6800 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6801 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6802 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6803 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6804
6805 state = 0xdeadbee;
6806 action = 0xdeadbee;
6807 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6808 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6809 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6810 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6811
6812 state = 0xdeadbee;
6813 action = 0xdeadbee;
6814 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
6815 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6816 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6817 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6818
6819 state = 0xdeadbee;
6820 action = 0xdeadbee;
6821 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6822 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6823 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6824 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6825
6826 state = 0xdeadbee;
6827 action = 0xdeadbee;
6828 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6829 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6830 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6831 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6832
6833 state = 0xdeadbee;
6834 action = 0xdeadbee;
6835 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6836 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6837 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6838 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6839
6840 state = 0xdeadbee;
6841 action = 0xdeadbee;
6842 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6843 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6844 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6845 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6846
6847 state = 0xdeadbee;
6848 action = 0xdeadbee;
6849 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6850 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6851 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6852 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6853
6854 state = 0xdeadbee;
6855 action = 0xdeadbee;
6856 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6857 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6858 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6859 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6860
6861 state = 0xdeadbee;
6862 action = 0xdeadbee;
6863 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6864 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6865 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6866 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6867
6868 state = 0xdeadbee;
6869 action = 0xdeadbee;
6870 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6871 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6872 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6873 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6874
6875 state = 0xdeadbee;
6876 action = 0xdeadbee;
6877 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6878 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6879 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6880 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6881
6882 state = 0xdeadbee;
6883 action = 0xdeadbee;
6884 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6885 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6886 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6887 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6888
6889 state = 0xdeadbee;
6890 action = 0xdeadbee;
6891 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6892 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6893 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6894 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6895
6896 state = 0xdeadbee;
6897 action = 0xdeadbee;
6898 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6899 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6900 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6901 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6902
6903 state = 0xdeadbee;
6904 action = 0xdeadbee;
6905 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6906 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6907 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6908 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6909
6910 state = 0xdeadbee;
6911 action = 0xdeadbee;
6912 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6913 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6914 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6915 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6916
6917 state = 0xdeadbee;
6918 action = 0xdeadbee;
6919 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6920 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6921 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6922 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6923
6924 state = 0xdeadbee;
6925 action = 0xdeadbee;
6926 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6927 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6928 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6929 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6930
6931 state = 0xdeadbee;
6932 action = 0xdeadbee;
6933 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6934 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6935 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6936 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6937
6938 state = 0xdeadbee;
6939 action = 0xdeadbee;
6940 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6941 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6942 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6943 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6944
6945 state = 0xdeadbee;
6946 action = 0xdeadbee;
6947 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6948 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6949 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6950 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6951
6952 state = 0xdeadbee;
6953 action = 0xdeadbee;
6954 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6955 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6956 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6957 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6958
6959 state = 0xdeadbee;
6960 action = 0xdeadbee;
6961 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6962 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6963 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6964 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6965
6966 state = 0xdeadbee;
6967 action = 0xdeadbee;
6968 r = MsiGetComponentState(hpkg, "psi", &state, &action);
6969 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6970 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6971 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6972
6973 r = MsiDoAction( hpkg, "CostInitialize");
6974 ok( r == ERROR_SUCCESS, "cost init failed\n");
6975
6976 state = 0xdeadbee;
6977 action = 0xdeadbee;
6978 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6979 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6980 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6981 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6982
6983 state = 0xdeadbee;
6984 action = 0xdeadbee;
6985 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6986 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6987 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6988 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6989
6990 state = 0xdeadbee;
6991 action = 0xdeadbee;
6992 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6993 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6994 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6995 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6996
6997 state = 0xdeadbee;
6998 action = 0xdeadbee;
6999 r = MsiGetFeatureState(hpkg, "four", &state, &action);
7000 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7001 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7002 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7003
7004 state = 0xdeadbee;
7005 action = 0xdeadbee;
7006 r = MsiGetFeatureState(hpkg, "five", &state, &action);
7007 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7008 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7009 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7010
7011 state = 0xdeadbee;
7012 action = 0xdeadbee;
7013 r = MsiGetFeatureState(hpkg, "six", &state, &action);
7014 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7015 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7016 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7017
7018 state = 0xdeadbee;
7019 action = 0xdeadbee;
7020 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
7021 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7022 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7023 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7024
7025 state = 0xdeadbee;
7026 action = 0xdeadbee;
7027 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
7028 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7029 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7030 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7031
7032 state = 0xdeadbee;
7033 action = 0xdeadbee;
7034 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
7035 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7036 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7037 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7038
7039 state = 0xdeadbee;
7040 action = 0xdeadbee;
7041 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
7042 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7043 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7044 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7045
7046 state = 0xdeadbee;
7047 action = 0xdeadbee;
7048 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
7049 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7050 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7051 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7052
7053 state = 0xdeadbee;
7054 action = 0xdeadbee;
7055 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
7056 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7057 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7058 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7059
7060 state = 0xdeadbee;
7061 action = 0xdeadbee;
7062 r = MsiGetComponentState(hpkg, "beta", &state, &action);
7063 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7064 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7065 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7066
7067 state = 0xdeadbee;
7068 action = 0xdeadbee;
7069 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
7070 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7071 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7072 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7073
7074 state = 0xdeadbee;
7075 action = 0xdeadbee;
7076 r = MsiGetComponentState(hpkg, "theta", &state, &action);
7077 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7078 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7079 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7080
7081 state = 0xdeadbee;
7082 action = 0xdeadbee;
7083 r = MsiGetComponentState(hpkg, "delta", &state, &action);
7084 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7085 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7086 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7087
7088 state = 0xdeadbee;
7089 action = 0xdeadbee;
7090 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
7091 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7092 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7093 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7094
7095 state = 0xdeadbee;
7096 action = 0xdeadbee;
7097 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
7098 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7099 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7100 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7101
7102 state = 0xdeadbee;
7103 action = 0xdeadbee;
7104 r = MsiGetComponentState(hpkg, "iota", &state, &action);
7105 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7106 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7107 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7108
7109 state = 0xdeadbee;
7110 action = 0xdeadbee;
7111 r = MsiGetComponentState(hpkg, "eta", &state, &action);
7112 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7113 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7114 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7115
7116 state = 0xdeadbee;
7117 action = 0xdeadbee;
7118 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
7119 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7120 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7121 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7122
7123 state = 0xdeadbee;
7124 action = 0xdeadbee;
7125 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
7126 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7127 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7128 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7129
7130 state = 0xdeadbee;
7131 action = 0xdeadbee;
7132 r = MsiGetComponentState(hpkg, "mu", &state, &action);
7133 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7134 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7135 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7136
7137 state = 0xdeadbee;
7138 action = 0xdeadbee;
7139 r = MsiGetComponentState(hpkg, "nu", &state, &action);
7140 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7141 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7142 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7143
7144 state = 0xdeadbee;
7145 action = 0xdeadbee;
7146 r = MsiGetComponentState(hpkg, "xi", &state, &action);
7147 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7148 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7149 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7150
7151 state = 0xdeadbee;
7152 action = 0xdeadbee;
7153 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
7154 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7155 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7156 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7157
7158 state = 0xdeadbee;
7159 action = 0xdeadbee;
7160 r = MsiGetComponentState(hpkg, "pi", &state, &action);
7161 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7162 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7163 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7164
7165 state = 0xdeadbee;
7166 action = 0xdeadbee;
7167 r = MsiGetComponentState(hpkg, "rho", &state, &action);
7168 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7169 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7170 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7171
7172 state = 0xdeadbee;
7173 action = 0xdeadbee;
7174 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
7175 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7176 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7177 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7178
7179 state = 0xdeadbee;
7180 action = 0xdeadbee;
7181 r = MsiGetComponentState(hpkg, "tau", &state, &action);
7182 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7183 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7184 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7185
7186 state = 0xdeadbee;
7187 action = 0xdeadbee;
7188 r = MsiGetComponentState(hpkg, "phi", &state, &action);
7189 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7190 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7191 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7192
7193 state = 0xdeadbee;
7194 action = 0xdeadbee;
7195 r = MsiGetComponentState(hpkg, "chi", &state, &action);
7196 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7197 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7198 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7199
7200 state = 0xdeadbee;
7201 action = 0xdeadbee;
7202 r = MsiGetComponentState(hpkg, "psi", &state, &action);
7203 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7204 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7205 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7206
7207 r = MsiDoAction( hpkg, "FileCost");
7208 ok( r == ERROR_SUCCESS, "file cost failed\n");
7209
7210 state = 0xdeadbee;
7211 action = 0xdeadbee;
7212 r = MsiGetFeatureState(hpkg, "one", &state, &action);
7213 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7214 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7215 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7216
7217 state = 0xdeadbee;
7218 action = 0xdeadbee;
7219 r = MsiGetFeatureState(hpkg, "two", &state, &action);
7220 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7221 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7222 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7223
7224 state = 0xdeadbee;
7225 action = 0xdeadbee;
7226 r = MsiGetFeatureState(hpkg, "three", &state, &action);
7227 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7228 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7229 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7230
7231 state = 0xdeadbee;
7232 action = 0xdeadbee;
7233 r = MsiGetFeatureState(hpkg, "four", &state, &action);
7234 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7235 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7236 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7237
7238 state = 0xdeadbee;
7239 action = 0xdeadbee;
7240 r = MsiGetFeatureState(hpkg, "five", &state, &action);
7241 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7242 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7243 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7244
7245 state = 0xdeadbee;
7246 action = 0xdeadbee;
7247 r = MsiGetFeatureState(hpkg, "six", &state, &action);
7248 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7249 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7250 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7251
7252 state = 0xdeadbee;
7253 action = 0xdeadbee;
7254 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
7255 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7256 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7257 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7258
7259 state = 0xdeadbee;
7260 action = 0xdeadbee;
7261 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
7262 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7263 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7264 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7265
7266 state = 0xdeadbee;
7267 action = 0xdeadbee;
7268 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
7269 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7270 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7271 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7272
7273 state = 0xdeadbee;
7274 action = 0xdeadbee;
7275 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
7276 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7277 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7278 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7279
7280 state = 0xdeadbee;
7281 action = 0xdeadbee;
7282 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
7283 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7284 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7285 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7286
7287 state = 0xdeadbee;
7288 action = 0xdeadbee;
7289 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
7290 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7291 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7292 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7293
7294 state = 0xdeadbee;
7295 action = 0xdeadbee;
7296 r = MsiGetComponentState(hpkg, "beta", &state, &action);
7297 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7298 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7299 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7300
7301 state = 0xdeadbee;
7302 action = 0xdeadbee;
7303 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
7304 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7305 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7306 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7307
7308 state = 0xdeadbee;
7309 action = 0xdeadbee;
7310 r = MsiGetComponentState(hpkg, "theta", &state, &action);
7311 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7312 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7313 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7314
7315 state = 0xdeadbee;
7316 action = 0xdeadbee;
7317 r = MsiGetComponentState(hpkg, "delta", &state, &action);
7318 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7319 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7320 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7321
7322 state = 0xdeadbee;
7323 action = 0xdeadbee;
7324 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
7325 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7326 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7327 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7328
7329 state = 0xdeadbee;
7330 action = 0xdeadbee;
7331 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
7332 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7333 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7334 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7335
7336 state = 0xdeadbee;
7337 action = 0xdeadbee;
7338 r = MsiGetComponentState(hpkg, "iota", &state, &action);
7339 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7340 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7341 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7342
7343 state = 0xdeadbee;
7344 action = 0xdeadbee;
7345 r = MsiGetComponentState(hpkg, "eta", &state, &action);
7346 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7347 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7348 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7349
7350 state = 0xdeadbee;
7351 action = 0xdeadbee;
7352 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
7353 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7354 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7355 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7356
7357 state = 0xdeadbee;
7358 action = 0xdeadbee;
7359 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
7360 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7361 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7362 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7363
7364 state = 0xdeadbee;
7365 action = 0xdeadbee;
7366 r = MsiGetComponentState(hpkg, "mu", &state, &action);
7367 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7368 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7369 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7370
7371 state = 0xdeadbee;
7372 action = 0xdeadbee;
7373 r = MsiGetComponentState(hpkg, "nu", &state, &action);
7374 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7375 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7376 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7377
7378 state = 0xdeadbee;
7379 action = 0xdeadbee;
7380 r = MsiGetComponentState(hpkg, "xi", &state, &action);
7381 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7382 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7383 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7384
7385 state = 0xdeadbee;
7386 action = 0xdeadbee;
7387 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
7388 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7389 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7390 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7391
7392 state = 0xdeadbee;
7393 action = 0xdeadbee;
7394 r = MsiGetComponentState(hpkg, "pi", &state, &action);
7395 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7396 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7397 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7398
7399 state = 0xdeadbee;
7400 action = 0xdeadbee;
7401 r = MsiGetComponentState(hpkg, "rho", &state, &action);
7402 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7403 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7404 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7405
7406 state = 0xdeadbee;
7407 action = 0xdeadbee;
7408 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
7409 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7410 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7411 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7412
7413 state = 0xdeadbee;
7414 action = 0xdeadbee;
7415 r = MsiGetComponentState(hpkg, "tau", &state, &action);
7416 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7417 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7418 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7419
7420 state = 0xdeadbee;
7421 action = 0xdeadbee;
7422 r = MsiGetComponentState(hpkg, "phi", &state, &action);
7423 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7424 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7425 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7426
7427 state = 0xdeadbee;
7428 action = 0xdeadbee;
7429 r = MsiGetComponentState(hpkg, "chi", &state, &action);
7430 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7431 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7432 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7433
7434 state = 0xdeadbee;
7435 action = 0xdeadbee;
7436 r = MsiGetComponentState(hpkg, "psi", &state, &action);
7437 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7438 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7439 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7440
7441 r = MsiDoAction( hpkg, "CostFinalize");
7442 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
7443
7444 state = 0xdeadbee;
7445 action = 0xdeadbee;
7446 r = MsiGetFeatureState(hpkg, "one", &state, &action);
7447 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7448 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7449 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7450
7451 state = 0xdeadbee;
7452 action = 0xdeadbee;
7453 r = MsiGetFeatureState(hpkg, "two", &state, &action);
7454 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7455 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7456 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7457
7458 state = 0xdeadbee;
7459 action = 0xdeadbee;
7460 r = MsiGetFeatureState(hpkg, "three", &state, &action);
7461 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7462 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7463 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7464
7465 state = 0xdeadbee;
7466 action = 0xdeadbee;
7467 r = MsiGetFeatureState(hpkg, "four", &state, &action);
7468 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7469 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7470 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7471
7472 state = 0xdeadbee;
7473 action = 0xdeadbee;
7474 r = MsiGetFeatureState(hpkg, "five", &state, &action);
7475 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7476 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7477 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7478
7479 state = 0xdeadbee;
7480 action = 0xdeadbee;
7481 r = MsiGetFeatureState(hpkg, "six", &state, &action);
7482 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7483 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7484 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7485
7486 state = 0xdeadbee;
7487 action = 0xdeadbee;
7488 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
7489 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7490 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7491 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7492
7493 state = 0xdeadbee;
7494 action = 0xdeadbee;
7495 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
7496 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7497 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7498 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7499
7500 state = 0xdeadbee;
7501 action = 0xdeadbee;
7502 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
7503 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7504 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7505 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7506
7507 state = 0xdeadbee;
7508 action = 0xdeadbee;
7509 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
7510 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7511 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7512 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7513
7514 state = 0xdeadbee;
7515 action = 0xdeadbee;
7516 r = MsiGetFeatureState(hpkg, "eleven", &state, &action);
7517 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7518 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7519 todo_wine ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7520
7521 state = 0xdeadbee;
7522 action = 0xdeadbee;
7523 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
7524 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7525 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7526 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7527
7528 state = 0xdeadbee;
7529 action = 0xdeadbee;
7530 r = MsiGetComponentState(hpkg, "beta", &state, &action);
7531 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7532 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7533 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7534
7535 state = 0xdeadbee;
7536 action = 0xdeadbee;
7537 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
7538 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7539 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7540 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7541
7542 state = 0xdeadbee;
7543 action = 0xdeadbee;
7544 r = MsiGetComponentState(hpkg, "theta", &state, &action);
7545 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7546 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7547 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7548
7549 state = 0xdeadbee;
7550 action = 0xdeadbee;
7551 r = MsiGetComponentState(hpkg, "delta", &state, &action);
7552 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7553 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7554 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7555
7556 state = 0xdeadbee;
7557 action = 0xdeadbee;
7558 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
7559 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7560 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7561 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7562
7563 state = 0xdeadbee;
7564 action = 0xdeadbee;
7565 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
7566 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7567 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7568 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7569
7570 state = 0xdeadbee;
7571 action = 0xdeadbee;
7572 r = MsiGetComponentState(hpkg, "iota", &state, &action);
7573 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7574 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7575 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7576
7577 state = 0xdeadbee;
7578 action = 0xdeadbee;
7579 r = MsiGetComponentState(hpkg, "eta", &state, &action);
7580 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7581 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7582 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7583
7584 state = 0xdeadbee;
7585 action = 0xdeadbee;
7586 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
7587 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7588 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7589 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7590
7591 state = 0xdeadbee;
7592 action = 0xdeadbee;
7593 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
7594 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7595 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7596 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7597
7598 state = 0xdeadbee;
7599 action = 0xdeadbee;
7600 r = MsiGetComponentState(hpkg, "mu", &state, &action);
7601 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7602 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7603 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7604
7605 state = 0xdeadbee;
7606 action = 0xdeadbee;
7607 r = MsiGetComponentState(hpkg, "nu", &state, &action);
7608 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7609 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7610 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7611
7612 state = 0xdeadbee;
7613 action = 0xdeadbee;
7614 r = MsiGetComponentState(hpkg, "xi", &state, &action);
7615 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7616 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7617 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7618
7619 state = 0xdeadbee;
7620 action = 0xdeadbee;
7621 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
7622 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7623 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7624 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7625
7626 state = 0xdeadbee;
7627 action = 0xdeadbee;
7628 r = MsiGetComponentState(hpkg, "pi", &state, &action);
7629 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7630 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7631 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7632
7633 state = 0xdeadbee;
7634 action = 0xdeadbee;
7635 r = MsiGetComponentState(hpkg, "rho", &state, &action);
7636 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7637 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7638 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7639
7640 state = 0xdeadbee;
7641 action = 0xdeadbee;
7642 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
7643 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7644 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7645 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7646
7647 state = 0xdeadbee;
7648 action = 0xdeadbee;
7649 r = MsiGetComponentState(hpkg, "tau", &state, &action);
7650 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7651 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7652 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7653
7654 state = 0xdeadbee;
7655 action = 0xdeadbee;
7656 r = MsiGetComponentState(hpkg, "phi", &state, &action);
7657 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7658 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7659 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7660
7661 state = 0xdeadbee;
7662 action = 0xdeadbee;
7663 r = MsiGetComponentState(hpkg, "chi", &state, &action);
7664 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7665 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7666 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7667
7668 state = 0xdeadbee;
7669 action = 0xdeadbee;
7670 r = MsiGetComponentState(hpkg, "psi", &state, &action);
7671 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7672 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7673 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7674
7675 MsiCloseHandle(hpkg);
7676
7677 /* uninstall the product */
7678 r = MsiInstallProduct(msifile4, "REMOVE=ALL");
7679 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7680
7681 DeleteFileA(msifile);
7682 DeleteFileA(msifile2);
7683 DeleteFileA(msifile3);
7684 DeleteFileA(msifile4);
7685 }
7686
7687 static void test_getproperty(void)
7688 {
7689 MSIHANDLE hPackage = 0;
7690 char prop[100];
7691 static CHAR empty[] = "";
7692 DWORD size;
7693 UINT r;
7694
7695 r = package_from_db(create_package_db(), &hPackage);
7696 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7697 {
7698 skip("Not enough rights to perform tests\n");
7699 DeleteFile(msifile);
7700 return;
7701 }
7702 ok( r == ERROR_SUCCESS, "Failed to create package %u\n", r );
7703
7704 /* set the property */
7705 r = MsiSetProperty(hPackage, "Name", "Value");
7706 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7707
7708 /* retrieve the size, NULL pointer */
7709 size = 0;
7710 r = MsiGetProperty(hPackage, "Name", NULL, &size);
7711 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7712 ok( size == 5, "Expected 5, got %d\n", size);
7713
7714 /* retrieve the size, empty string */
7715 size = 0;
7716 r = MsiGetProperty(hPackage, "Name", empty, &size);
7717 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7718 ok( size == 5, "Expected 5, got %d\n", size);
7719
7720 /* don't change size */
7721 r = MsiGetProperty(hPackage, "Name", prop, &size);
7722 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7723 ok( size == 5, "Expected 5, got %d\n", size);
7724 ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
7725
7726 /* increase the size by 1 */
7727 size++;
7728 r = MsiGetProperty(hPackage, "Name", prop, &size);
7729 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7730 ok( size == 5, "Expected 5, got %d\n", size);
7731 ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
7732
7733 r = MsiCloseHandle( hPackage);
7734 ok( r == ERROR_SUCCESS , "Failed to close package\n" );
7735 DeleteFile(msifile);
7736 }
7737
7738 static void test_removefiles(void)
7739 {
7740 MSIHANDLE hpkg;
7741 UINT r;
7742 MSIHANDLE hdb;
7743 INSTALLSTATE installed, action;
7744
7745 hdb = create_package_db();
7746 ok ( hdb, "failed to create package database\n" );
7747
7748 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
7749 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
7750
7751 r = create_feature_table( hdb );
7752 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
7753
7754 r = create_component_table( hdb );
7755 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
7756
7757 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
7758 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7759
7760 r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
7761 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7762
7763 r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
7764 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7765
7766 r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
7767 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7768
7769 r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
7770 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7771
7772 r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
7773 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7774
7775 r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
7776 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7777
7778 r = add_component_entry( hdb, "'oxygen', '', 'TARGETDIR', 0, '0', 'oxygen_file'" );
7779 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7780
7781 r = create_feature_components_table( hdb );
7782 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
7783
7784 r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
7785 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7786
7787 r = add_feature_components_entry( hdb, "'one', 'helium'" );
7788 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7789
7790 r = add_feature_components_entry( hdb, "'one', 'lithium'" );
7791 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7792
7793 r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
7794 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7795
7796 r = add_feature_components_entry( hdb, "'one', 'boron'" );
7797 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7798
7799 r = add_feature_components_entry( hdb, "'one', 'carbon'" );
7800 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7801
7802 r = add_feature_components_entry( hdb, "'one', 'oxygen'" );
7803 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7804
7805 r = create_file_table( hdb );
7806 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
7807
7808 r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
7809 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7810
7811 r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
7812 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7813
7814 r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
7815 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7816
7817 r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
7818 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7819
7820 r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
7821 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7822
7823 r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
7824 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7825
7826 r = add_file_entry( hdb, "'oxygen_file', 'oxygen', 'oxygen.txt', 0, '', '1033', 16384, 1" );
7827 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7828
7829 r = create_remove_file_table( hdb );
7830 ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
7831
7832 r = package_from_db( hdb, &hpkg );
7833 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7834 {
7835 skip("Not enough rights to perform tests\n");
7836 DeleteFile(msifile);
7837 return;
7838 }
7839 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
7840
7841 MsiCloseHandle( hdb );
7842
7843 create_test_file( "hydrogen.txt" );
7844 create_test_file( "helium.txt" );
7845 create_test_file( "lithium.txt" );
7846 create_test_file( "beryllium.txt" );
7847 create_test_file( "boron.txt" );
7848 create_test_file( "carbon.txt" );
7849 create_test_file( "oxygen.txt" );
7850
7851 r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
7852 ok( r == ERROR_SUCCESS, "set property failed\n");
7853
7854 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7855
7856 r = MsiGetComponentState( hpkg, "oxygen", &installed, &action );
7857 ok( r == ERROR_UNKNOWN_COMPONENT, "expected ERROR_UNKNOWN_COMPONENT, got %u\n", r );
7858
7859 r = MsiDoAction( hpkg, "CostInitialize");
7860 ok( r == ERROR_SUCCESS, "cost init failed\n");
7861
7862 r = MsiDoAction( hpkg, "FileCost");
7863 ok( r == ERROR_SUCCESS, "file cost failed\n");
7864
7865 installed = action = 0xdeadbeef;
7866 r = MsiGetComponentState( hpkg, "oxygen", &installed, &action );
7867 ok( r == ERROR_SUCCESS, "failed to get component state %u\n", r );
7868 ok( installed == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", installed );
7869 ok( action == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", action );
7870
7871 r = MsiDoAction( hpkg, "CostFinalize");
7872 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7873
7874 r = MsiDoAction( hpkg, "InstallValidate");
7875 ok( r == ERROR_SUCCESS, "install validate failed\n");
7876
7877 r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
7878 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7879
7880 installed = action = 0xdeadbeef;
7881 r = MsiGetComponentState( hpkg, "hydrogen", &installed, &action );
7882 ok( r == ERROR_SUCCESS, "failed to get component state %u\n", r );
7883 ok( installed == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", installed );
7884 todo_wine ok( action == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", action );
7885
7886 r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
7887 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7888
7889 r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
7890 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7891
7892 r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
7893 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7894
7895 r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
7896 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7897
7898 r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
7899 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7900
7901 installed = action = 0xdeadbeef;
7902 r = MsiGetComponentState( hpkg, "oxygen", &installed, &action );
7903 ok( r == ERROR_SUCCESS, "failed to get component state %u\n", r );
7904 ok( installed == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", installed );
7905 ok( action == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", action );
7906
7907 r = MsiSetComponentState( hpkg, "oxygen", INSTALLSTATE_ABSENT );
7908 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7909
7910 installed = action = 0xdeadbeef;
7911 r = MsiGetComponentState( hpkg, "oxygen", &installed, &action );
7912 ok( r == ERROR_SUCCESS, "failed to get component state %u\n", r );
7913 ok( installed == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", installed );
7914 ok( action == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", action );
7915
7916 r = MsiDoAction( hpkg, "RemoveFiles");
7917 ok( r == ERROR_SUCCESS, "remove files failed\n");
7918
7919 installed = action = 0xdeadbeef;
7920 r = MsiGetComponentState( hpkg, "oxygen", &installed, &action );
7921 ok( r == ERROR_SUCCESS, "failed to get component state %u\n", r );
7922 ok( installed == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", installed );
7923 ok( action == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", action );
7924
7925 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
7926 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
7927 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
7928 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
7929 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
7930 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
7931 ok(DeleteFileA("oxygen.txt"), "Expected oxygen.txt to exist\n");
7932
7933 MsiCloseHandle( hpkg );
7934 DeleteFileA(msifile);
7935 }
7936
7937 static void test_appsearch(void)
7938 {
7939 MSIHANDLE hpkg;
7940 UINT r;
7941 MSIHANDLE hdb;
7942 CHAR prop[MAX_PATH];
7943 DWORD size;
7944
7945 hdb = create_package_db();
7946 ok ( hdb, "failed to create package database\n" );
7947
7948 r = create_appsearch_table( hdb );
7949 ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
7950
7951 r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
7952 ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
7953
7954 r = add_appsearch_entry( hdb, "'NOTEPAD', 'NewSignature2'" );
7955 ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
7956
7957 r = create_reglocator_table( hdb );
7958 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7959
7960 r = add_reglocator_entry( hdb, "NewSignature1", 0, "htmlfile\\shell\\open\\command", "", 1 );
7961 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7962
7963 r = create_drlocator_table( hdb );
7964 ok( r == ERROR_SUCCESS, "cannot create DrLocator table: %d\n", r );
7965
7966 r = add_drlocator_entry( hdb, "'NewSignature2', 0, 'c:\\windows\\system32', 0" );
7967 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7968
7969 r = create_signature_table( hdb );
7970 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
7971
7972 r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
7973 ok( r == ERROR_SUCCESS, "cannot add signature: %d\n", r );
7974
7975 r = add_signature_entry( hdb, "'NewSignature2', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
7976 ok( r == ERROR_SUCCESS, "cannot add signature: %d\n", r );
7977
7978 r = package_from_db( hdb, &hpkg );
7979 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7980 {
7981 skip("Not enough rights to perform tests\n");
7982 DeleteFile(msifile);
7983 return;
7984 }
7985 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
7986 MsiCloseHandle( hdb );
7987 if (r != ERROR_SUCCESS)
7988 goto done;
7989
7990 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7991
7992 r = MsiDoAction( hpkg, "AppSearch" );
7993 ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
7994
7995 size = sizeof(prop);
7996 r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
7997 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
7998 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
7999
8000 size = sizeof(prop);
8001 r = MsiGetPropertyA( hpkg, "NOTEPAD", prop, &size );
8002 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
8003
8004 done:
8005 MsiCloseHandle( hpkg );
8006 DeleteFileA(msifile);
8007 }
8008
8009 static void test_appsearch_complocator(void)
8010 {
8011 MSIHANDLE hpkg, hdb;
8012 CHAR path[MAX_PATH];
8013 CHAR prop[MAX_PATH];
8014 LPSTR usersid;
8015 DWORD size;
8016 UINT r;
8017
8018 if (!(usersid = get_user_sid()))
8019 return;
8020
8021 if (is_process_limited())
8022 {
8023 skip("process is limited\n");
8024 return;
8025 }
8026
8027 create_test_file("FileName1");
8028 create_test_file("FileName4");
8029 set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE,
8030 "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
8031
8032 create_test_file("FileName2");
8033 set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED,
8034 "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
8035
8036 create_test_file("FileName3");
8037 set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED,
8038 "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
8039
8040 create_test_file("FileName5");
8041 set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE,
8042 "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
8043
8044 create_test_file("FileName6");
8045 set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE,
8046 "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
8047
8048 create_test_file("FileName7");
8049 set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE,
8050 "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
8051
8052 /* dir is FALSE, but we're pretending it's a directory */
8053 set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE,
8054 "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
8055
8056 create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8057 set_component_path("FileName8.dll", MSIINSTALLCONTEXT_MACHINE,
8058 "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
8059
8060 create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8061 set_component_path("FileName9.dll", MSIINSTALLCONTEXT_MACHINE,
8062 "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
8063
8064 create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8065 set_component_path("FileName10.dll", MSIINSTALLCONTEXT_MACHINE,
8066 "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
8067
8068 hdb = create_package_db();
8069 ok(hdb, "Expected a valid database handle\n");
8070
8071 r = create_appsearch_table(hdb);
8072 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8073
8074 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8075 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8076
8077 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8078 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8079
8080 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8081 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8082
8083 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8084 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8085
8086 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8087 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8088
8089 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8090 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8091
8092 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8093 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8094
8095 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8096 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8097
8098 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8099 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8100
8101 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8102 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8103
8104 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8105 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8106
8107 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
8108 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8109
8110 r = create_complocator_table(hdb);
8111 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8112
8113 /* published component, machine, file, signature, misdbLocatorTypeFile */
8114 r = add_complocator_entry(hdb, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
8115 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8116
8117 /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
8118 r = add_complocator_entry(hdb, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
8119 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8120
8121 /* published component, user-managed, file, signature, misdbLocatorTypeFile */
8122 r = add_complocator_entry(hdb, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
8123 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8124
8125 /* published component, machine, file, signature, misdbLocatorTypeDirectory */
8126 r = add_complocator_entry(hdb, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
8127 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8128
8129 /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
8130 r = add_complocator_entry(hdb, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
8131 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8132
8133 /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
8134 r = add_complocator_entry(hdb, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
8135 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8136
8137 /* published component, machine, file, no signature, misdbLocatorTypeFile */
8138 r = add_complocator_entry(hdb, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
8139 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8140
8141 /* unpublished component, no signature, misdbLocatorTypeDir */
8142 r = add_complocator_entry(hdb, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
8143 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8144
8145 /* published component, no signature, dir does not exist misdbLocatorTypeDir */
8146 r = add_complocator_entry(hdb, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
8147 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8148
8149 /* published component, signature w/ ver, misdbLocatorTypeFile */
8150 r = add_complocator_entry(hdb, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
8151 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8152
8153 /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
8154 r = add_complocator_entry(hdb, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
8155 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8156
8157 /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
8158 r = add_complocator_entry(hdb, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
8159 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8160
8161 r = create_signature_table(hdb);
8162 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8163
8164 r = add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
8165 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8166
8167 r = add_signature_entry(hdb, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
8168 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8169
8170 r = add_signature_entry(hdb, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
8171 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8172
8173 r = add_signature_entry(hdb, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
8174 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8175
8176 r = add_signature_entry(hdb, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
8177 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8178
8179 r = add_signature_entry(hdb, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8180 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8181
8182 r = add_signature_entry(hdb, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8183 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8184
8185 r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8186 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8187
8188 r = package_from_db(hdb, &hpkg);
8189 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
8190 {
8191 skip("Not enough rights to perform tests\n");
8192 goto error;
8193 }
8194 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
8195
8196 r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
8197 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8198
8199 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
8200
8201 r = MsiDoAction(hpkg, "AppSearch");
8202 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8203
8204 size = MAX_PATH;
8205 sprintf(path, "%s\\FileName1", CURR_DIR);
8206 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8207 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8208 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8209
8210 size = MAX_PATH;
8211 sprintf(path, "%s\\FileName2", CURR_DIR);
8212 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8213 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8214 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8215
8216 size = MAX_PATH;
8217 sprintf(path, "%s\\FileName3", CURR_DIR);
8218 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8219 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8220 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8221
8222 size = MAX_PATH;
8223 sprintf(path, "%s\\FileName4", CURR_DIR);
8224 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
8225 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8226 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8227
8228 size = MAX_PATH;
8229 sprintf(path, "%s\\FileName5", CURR_DIR);
8230 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8231 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8232 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8233
8234 size = MAX_PATH;
8235 sprintf(path, "%s\\", CURR_DIR);
8236 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8237 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8238 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8239
8240 size = MAX_PATH;
8241 sprintf(path, "%s\\", CURR_DIR);
8242 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8243 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8244 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8245
8246 size = MAX_PATH;
8247 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8248 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8249 ok(!lstrcmpA(prop, "october"), "Expected \"october\", got \"%s\"\n", prop);
8250
8251 size = MAX_PATH;
8252 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8253 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8254 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8255
8256 size = MAX_PATH;
8257 sprintf(path, "%s\\FileName8.dll", CURR_DIR);
8258 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8259 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8260 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8261
8262 size = MAX_PATH;
8263 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8264 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8265 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8266
8267 size = MAX_PATH;
8268 sprintf(path, "%s\\FileName10.dll", CURR_DIR);
8269 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8270 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8271 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8272
8273 delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
8274 MSIINSTALLCONTEXT_MACHINE, NULL);
8275 delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
8276 MSIINSTALLCONTEXT_USERUNMANAGED, usersid);
8277 delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
8278 MSIINSTALLCONTEXT_USERMANAGED, usersid);
8279 delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
8280 MSIINSTALLCONTEXT_MACHINE, NULL);
8281 delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
8282 MSIINSTALLCONTEXT_MACHINE, NULL);
8283 delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
8284 MSIINSTALLCONTEXT_MACHINE, NULL);
8285 delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
8286 MSIINSTALLCONTEXT_MACHINE, NULL);
8287 delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
8288 MSIINSTALLCONTEXT_MACHINE, NULL);
8289 delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
8290 MSIINSTALLCONTEXT_MACHINE, NULL);
8291 delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
8292 MSIINSTALLCONTEXT_MACHINE, NULL);
8293
8294 MsiCloseHandle(hpkg);
8295
8296 error:
8297 DeleteFileA("FileName1");
8298 DeleteFileA("FileName2");
8299 DeleteFileA("FileName3");
8300 DeleteFileA("FileName4");
8301 DeleteFileA("FileName5");
8302 DeleteFileA("FileName6");
8303 DeleteFileA("FileName7");
8304 DeleteFileA("FileName8.dll");
8305 DeleteFileA("FileName9.dll");
8306 DeleteFileA("FileName10.dll");
8307 DeleteFileA(msifile);
8308 LocalFree(usersid);
8309 }
8310
8311 static void test_appsearch_reglocator(void)
8312 {
8313 MSIHANDLE hpkg, hdb;
8314 CHAR path[MAX_PATH], prop[MAX_PATH];
8315 DWORD binary[2], size, val;
8316 BOOL space, version, is_64bit = sizeof(void *) > sizeof(int);
8317 HKEY hklm, classes, hkcu, users;
8318 LPSTR pathdata, pathvar, ptr;
8319 LPCSTR str;
8320 LONG res;
8321 UINT r, type = 0;
8322 SYSTEM_INFO si;
8323
8324 version = TRUE;
8325 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
8326 version = FALSE;
8327
8328 DeleteFileA("test.dll");
8329
8330 res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
8331 if (res == ERROR_ACCESS_DENIED)
8332 {
8333 skip("Not enough rights to perform tests\n");
8334 return;
8335 }
8336 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8337
8338 res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
8339 (const BYTE *)"regszdata", 10);
8340 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8341
8342 res = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine", &hkcu);
8343 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8344
8345 res = RegSetValueExA(hkcu, "Value1", 0, REG_SZ,
8346 (const BYTE *)"regszdata", 10);
8347 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8348
8349 users = 0;
8350 res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
8351 ok(res == ERROR_SUCCESS ||
8352 broken(res == ERROR_INVALID_PARAMETER),
8353 "Expected ERROR_SUCCESS, got %d\n", res);
8354
8355 if (res == ERROR_SUCCESS)
8356 {
8357 res = RegSetValueExA(users, "Value1", 0, REG_SZ,
8358 (const BYTE *)"regszdata", 10);
8359 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8360 }
8361
8362 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine", &hklm);
8363 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8364
8365 res = RegSetValueA(hklm, NULL, REG_SZ, "defvalue", 8);
8366 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8367
8368 res = RegSetValueExA(hklm, "Value1", 0, REG_SZ,
8369 (const BYTE *)"regszdata", 10);
8370 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8371
8372 val = 42;
8373 res = RegSetValueExA(hklm, "Value2", 0, REG_DWORD,
8374 (const BYTE *)&val, sizeof(DWORD));
8375 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8376
8377 val = -42;
8378 res = RegSetValueExA(hklm, "Value3", 0, REG_DWORD,
8379 (const BYTE *)&val, sizeof(DWORD));
8380 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8381
8382 res = RegSetValueExA(hklm, "Value4", 0, REG_EXPAND_SZ,
8383 (const BYTE *)"%PATH%", 7);
8384 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8385
8386 res = RegSetValueExA(hklm, "Value5", 0, REG_EXPAND_SZ,
8387 (const BYTE *)"my%NOVAR%", 10);
8388 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8389
8390 res = RegSetValueExA(hklm, "Value6", 0, REG_MULTI_SZ,
8391 (const BYTE *)"one\0two\0", 9);
8392 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8393
8394 binary[0] = 0x1234abcd;
8395 binary[1] = 0x567890ef;
8396 res = RegSetValueExA(hklm, "Value7", 0, REG_BINARY,
8397 (const BYTE *)binary, sizeof(binary));
8398 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8399
8400 res = RegSetValueExA(hklm, "Value8", 0, REG_SZ,
8401 (const BYTE *)"#regszdata", 11);
8402 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8403
8404 create_test_file("FileName1");
8405 sprintf(path, "%s\\FileName1", CURR_DIR);
8406 res = RegSetValueExA(hklm, "Value9", 0, REG_SZ,
8407 (const BYTE *)path, lstrlenA(path) + 1);
8408 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8409
8410 sprintf(path, "%s\\FileName2", CURR_DIR);
8411 res = RegSetValueExA(hklm, "Value10", 0, REG_SZ,
8412 (const BYTE *)path, lstrlenA(path) + 1);
8413 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8414
8415 lstrcpyA(path, CURR_DIR);
8416 res = RegSetValueExA(hklm, "Value11", 0, REG_SZ,
8417 (const BYTE *)path, lstrlenA(path) + 1);
8418 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8419
8420 res = RegSetValueExA(hklm, "Value12", 0, REG_SZ,
8421 (const BYTE *)"", 1);
8422 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8423
8424 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8425 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8426 res = RegSetValueExA(hklm, "Value13", 0, REG_SZ,
8427 (const BYTE *)path, lstrlenA(path) + 1);
8428 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8429
8430 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8431 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
8432 res = RegSetValueExA(hklm, "Value14", 0, REG_SZ,
8433 (const BYTE *)path, lstrlenA(path) + 1);
8434 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8435
8436 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8437 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
8438 res = RegSetValueExA(hklm, "Value15", 0, REG_SZ,
8439 (const BYTE *)path, lstrlenA(path) + 1);
8440 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8441
8442 sprintf(path, "\"%s\\FileName1\" -option", CURR_DIR);
8443 res = RegSetValueExA(hklm, "value16", 0, REG_SZ,
8444 (const BYTE *)path, lstrlenA(path) + 1);
8445 ok( res == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", res);
8446
8447 space = (strchr(CURR_DIR, ' ')) ? TRUE : FALSE;
8448 sprintf(path, "%s\\FileName1 -option", CURR_DIR);
8449 res = RegSetValueExA(hklm, "value17", 0, REG_SZ,
8450 (const BYTE *)path, lstrlenA(path) + 1);
8451 ok( res == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", res);
8452
8453 hdb = create_package_db();
8454 ok(hdb, "Expected a valid database handle\n");
8455
8456 r = create_appsearch_table(hdb);
8457 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8458
8459 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8460 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8461
8462 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8463 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8464
8465 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8466 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8467
8468 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8469 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8470
8471 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8472 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8473
8474 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8475 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8476
8477 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8478 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8479
8480 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8481 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8482
8483 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8484 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8485
8486 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8487 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8488
8489 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8490 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8491
8492 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
8493 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8494
8495 r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
8496 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8497
8498 r = add_appsearch_entry(hdb, "'SIGPROP14', 'NewSignature14'");
8499 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8500
8501 r = add_appsearch_entry(hdb, "'SIGPROP15', 'NewSignature15'");
8502 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8503
8504 r = add_appsearch_entry(hdb, "'SIGPROP16', 'NewSignature16'");
8505 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8506
8507 r = add_appsearch_entry(hdb, "'SIGPROP17', 'NewSignature17'");
8508 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8509
8510 r = add_appsearch_entry(hdb, "'SIGPROP18', 'NewSignature18'");
8511 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8512
8513 r = add_appsearch_entry(hdb, "'SIGPROP19', 'NewSignature19'");
8514 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8515
8516 r = add_appsearch_entry(hdb, "'SIGPROP20', 'NewSignature20'");
8517 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8518
8519 r = add_appsearch_entry(hdb, "'SIGPROP21', 'NewSignature21'");
8520 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8521
8522 r = add_appsearch_entry(hdb, "'SIGPROP22', 'NewSignature22'");
8523 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8524
8525 r = add_appsearch_entry(hdb, "'SIGPROP23', 'NewSignature23'");
8526 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8527
8528 r = add_appsearch_entry(hdb, "'SIGPROP24', 'NewSignature24'");
8529 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8530
8531 r = add_appsearch_entry(hdb, "'SIGPROP25', 'NewSignature25'");
8532 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8533
8534 r = add_appsearch_entry(hdb, "'SIGPROP26', 'NewSignature26'");
8535 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8536
8537 r = add_appsearch_entry(hdb, "'SIGPROP27', 'NewSignature27'");
8538 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8539
8540 r = add_appsearch_entry(hdb, "'SIGPROP28', 'NewSignature28'");
8541 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8542
8543 r = add_appsearch_entry(hdb, "'SIGPROP29', 'NewSignature29'");
8544 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8545
8546 r = add_appsearch_entry(hdb, "'SIGPROP30', 'NewSignature30'");
8547 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8548
8549 r = create_reglocator_table(hdb);
8550 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8551
8552 type = msidbLocatorTypeRawValue;
8553 if (is_64bit)
8554 type |= msidbLocatorType64bit;
8555
8556 /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
8557 r = add_reglocator_entry(hdb, "NewSignature1", 2, "Software\\Wine", "Value1", type);
8558 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8559
8560 /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
8561 r = add_reglocator_entry(hdb, "NewSignature2", 2, "Software\\Wine", "Value2", type);
8562 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8563
8564 /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
8565 r = add_reglocator_entry(hdb, "NewSignature3", 2, "Software\\Wine", "Value3", type);
8566 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8567
8568 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
8569 r = add_reglocator_entry(hdb, "NewSignature4", 2, "Software\\Wine", "Value4", type);
8570 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8571
8572 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
8573 r = add_reglocator_entry(hdb, "NewSignature5", 2, "Software\\Wine", "Value5", type);
8574 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8575
8576 /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
8577 r = add_reglocator_entry(hdb, "NewSignature6", 2, "Software\\Wine", "Value6", type);
8578 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8579
8580 /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
8581 r = add_reglocator_entry(hdb, "NewSignature7", 2, "Software\\Wine", "Value7", type);
8582 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8583
8584 /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
8585 r = add_reglocator_entry(hdb, "NewSignature8", 2, "Software\\Wine", "Value8", type);
8586 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8587
8588 type = msidbLocatorTypeFileName;
8589 if (is_64bit)
8590 type |= msidbLocatorType64bit;
8591
8592 /* HKLM, msidbLocatorTypeFileName, signature, file exists */
8593 r = add_reglocator_entry(hdb, "NewSignature9", 2, "Software\\Wine", "Value9", type);
8594 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8595
8596 /* HKLM, msidbLocatorTypeFileName, signature, file does not exist */
8597 r = add_reglocator_entry(hdb, "NewSignature10", 2, "Software\\Wine", "Value10", type);
8598 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8599
8600 /* HKLM, msidbLocatorTypeFileName, no signature */
8601 r = add_reglocator_entry(hdb, "NewSignature11", 2, "Software\\Wine", "Value9", type);
8602 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8603
8604 type = msidbLocatorTypeDirectory;
8605 if (is_64bit)
8606 type |= msidbLocatorType64bit;
8607
8608 /* HKLM, msidbLocatorTypeDirectory, no signature, file exists */
8609 r = add_reglocator_entry(hdb, "NewSignature12", 2, "Software\\Wine", "Value9", type);
8610 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8611
8612 /* HKLM, msidbLocatorTypeDirectory, no signature, directory exists */
8613 r = add_reglocator_entry(hdb, "NewSignature13", 2, "Software\\Wine", "Value11", type);
8614 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8615
8616 /* HKLM, msidbLocatorTypeDirectory, signature, file exists */
8617 r = add_reglocator_entry(hdb, "NewSignature14", 2, "Software\\Wine", "Value9", type);
8618 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8619
8620 type = msidbLocatorTypeRawValue;
8621 if (is_64bit)
8622 type |= msidbLocatorType64bit;
8623
8624 /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
8625 r = add_reglocator_entry(hdb, "NewSignature15", 0, "Software\\Wine", "Value1", type);
8626 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8627
8628 /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
8629 r = add_reglocator_entry(hdb, "NewSignature16", 1, "Software\\Wine", "Value1", type);
8630 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8631
8632 /* HKU, msidbLocatorTypeRawValue, REG_SZ */
8633 r = add_reglocator_entry(hdb, "NewSignature17", 3, "S-1-5-18\\Software\\Wine", "Value1", type);
8634 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8635
8636 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
8637 r = add_reglocator_entry(hdb, "NewSignature18", 2, "Software\\Wine", "", type);
8638 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8639
8640 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
8641 r = add_reglocator_entry(hdb, "NewSignature19", 2, "Software\\IDontExist", "", type);
8642 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8643
8644 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
8645 r = add_reglocator_entry(hdb, "NewSignature20", 2, "Software\\Wine", "Value12", type);
8646 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8647
8648 type = msidbLocatorTypeFileName;
8649 if (is_64bit)
8650 type |= msidbLocatorType64bit;
8651
8652 /* HKLM, msidbLocatorTypeFileName, signature, file exists w/ version */
8653 r = add_reglocator_entry(hdb, "NewSignature21", 2, "Software\\Wine", "Value13", type);
8654 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8655
8656 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
8657 r = add_reglocator_entry(hdb, "NewSignature22", 2, "Software\\Wine", "Value14", type);
8658 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8659
8660 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
8661 r = add_reglocator_entry(hdb, "NewSignature23", 2, "Software\\Wine", "Value15", type);
8662 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8663
8664 /* HKLM, msidbLocatorTypeFileName, no signature, directory exists */
8665 r = add_reglocator_entry(hdb, "NewSignature24", 2, "Software\\Wine", "Value11", type);
8666 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8667
8668 /* HKLM, msidbLocatorTypeFileName, no signature, file does not exist */
8669 r = add_reglocator_entry(hdb, "NewSignature25", 2, "Software\\Wine", "Value10", type);
8670 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8671
8672 type = msidbLocatorTypeDirectory;
8673 if (is_64bit)
8674 type |= msidbLocatorType64bit;
8675
8676 /* HKLM, msidbLocatorTypeDirectory, signature, directory exists */
8677 r = add_reglocator_entry(hdb, "NewSignature26", 2, "Software\\Wine", "Value11", type);
8678 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8679
8680 /* HKLM, msidbLocatorTypeDirectory, signature, file does not exist */
8681 r = add_reglocator_entry(hdb, "NewSignature27", 2, "Software\\Wine", "Value10", type);
8682 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8683
8684 /* HKLM, msidbLocatorTypeDirectory, no signature, file does not exist */
8685 r = add_reglocator_entry(hdb, "NewSignature28", 2, "Software\\Wine", "Value10", type);
8686 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8687
8688 type = msidbLocatorTypeFileName;
8689 if (is_64bit)
8690 type |= msidbLocatorType64bit;
8691
8692 /* HKLM, msidbLocatorTypeFile, file exists, in quotes */
8693 r = add_reglocator_entry(hdb, "NewSignature29", 2, "Software\\Wine", "Value16", type);
8694 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8695
8696 /* HKLM, msidbLocatorTypeFile, file exists, no quotes */
8697 r = add_reglocator_entry(hdb, "NewSignature30", 2, "Software\\Wine", "Value17", type);
8698 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8699
8700 r = create_signature_table(hdb);
8701 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8702
8703 str = "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
8704 r = add_signature_entry(hdb, str);
8705 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8706
8707 str = "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
8708 r = add_signature_entry(hdb, str);
8709 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8710
8711 str = "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
8712 r = add_signature_entry(hdb, str);
8713 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8714
8715 str = "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8716 r = add_signature_entry(hdb, str);
8717 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8718
8719 str = "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8720 r = add_signature_entry(hdb, str);
8721 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8722
8723 str = "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8724 r = add_signature_entry(hdb, str);
8725 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8726
8727 ptr = strrchr(CURR_DIR, '\\') + 1;
8728 sprintf(path, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr);
8729 r = add_signature_entry(hdb, path);
8730 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8731
8732 str = "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''";
8733 r = add_signature_entry(hdb, str);
8734 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8735
8736 str = "'NewSignature29', 'FileName1', '', '', '', '', '', '', ''";
8737 r = add_signature_entry(hdb, str);
8738 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8739
8740 str = "'NewSignature30', 'FileName1', '', '', '', '', '', '', ''";
8741 r = add_signature_entry(hdb, str);
8742 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8743
8744 r = package_from_db(hdb, &hpkg);
8745 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
8746
8747 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
8748
8749 r = MsiDoAction(hpkg, "AppSearch");
8750 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8751
8752 size = MAX_PATH;
8753 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8754 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8755 ok(!lstrcmpA(prop, "regszdata"),
8756 "Expected \"regszdata\", got \"%s\"\n", prop);
8757
8758 size = MAX_PATH;
8759 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8760 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8761 ok(!lstrcmpA(prop, "#42"), "Expected \"#42\", got \"%s\"\n", prop);
8762
8763 size = MAX_PATH;
8764 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8765 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8766 ok(!lstrcmpA(prop, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop);
8767
8768 memset(&si, 0, sizeof(si));
8769 if (pGetNativeSystemInfo) pGetNativeSystemInfo(&si);
8770
8771 if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
8772 {
8773 size = ExpandEnvironmentStringsA("%PATH%", NULL, 0);
8774 pathvar = HeapAlloc(GetProcessHeap(), 0, size);
8775 ExpandEnvironmentStringsA("%PATH%", pathvar, size);
8776
8777 size = 0;
8778 r = MsiGetPropertyA(hpkg, "SIGPROP4", NULL, &size);
8779 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8780
8781 pathdata = HeapAlloc(GetProcessHeap(), 0, ++size);
8782 r = MsiGetPropertyA(hpkg, "SIGPROP4", pathdata, &size);
8783 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8784 ok(!lstrcmpA(pathdata, pathvar),
8785 "Expected \"%s\", got \"%s\"\n", pathvar, pathdata);
8786
8787 HeapFree(GetProcessHeap(), 0, pathvar);
8788 HeapFree(GetProcessHeap(), 0, pathdata);
8789 }
8790
8791 size = MAX_PATH;
8792 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8793 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8794 ok(!lstrcmpA(prop,
8795 "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop);
8796
8797 size = MAX_PATH;
8798 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8799 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8800 todo_wine
8801 {
8802 ok(!memcmp(prop, "\0one\0two\0\0", 10),
8803 "Expected \"\\0one\\0two\\0\\0\"\n");
8804 }
8805
8806 size = MAX_PATH;
8807 lstrcpyA(path, "#xCDAB3412EF907856");
8808 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8809 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8810 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8811
8812 size = MAX_PATH;
8813 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8814 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8815 ok(!lstrcmpA(prop, "##regszdata"),
8816 "Expected \"##regszdata\", got \"%s\"\n", prop);
8817
8818 size = MAX_PATH;
8819 sprintf(path, "%s\\FileName1", CURR_DIR);
8820 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8821 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8822 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8823
8824 size = MAX_PATH;
8825 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8826 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8827 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8828
8829 size = MAX_PATH;
8830 sprintf(path, "%s\\", CURR_DIR);
8831 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8832 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8833 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8834
8835 size = MAX_PATH;
8836 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8837 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8838 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8839
8840 size = MAX_PATH;
8841 sprintf(path, "%s\\", CURR_DIR);
8842 r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
8843 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8844 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8845
8846 size = MAX_PATH;
8847 r = MsiGetPropertyA(hpkg, "SIGPROP14", prop, &size);
8848 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8849 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8850
8851 size = MAX_PATH;
8852 r = MsiGetPropertyA(hpkg, "SIGPROP15", prop, &size);
8853 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8854 ok(!lstrcmpA(prop, "regszdata"),
8855 "Expected \"regszdata\", got \"%s\"\n", prop);
8856
8857 size = MAX_PATH;
8858 r = MsiGetPropertyA(hpkg, "SIGPROP16", prop, &size);
8859 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8860 ok(!lstrcmpA(prop, "regszdata"),
8861 "Expected \"regszdata\", got \"%s\"\n", prop);
8862
8863 if (users)
8864 {
8865 size = MAX_PATH;
8866 r = MsiGetPropertyA(hpkg, "SIGPROP17", prop, &size);
8867 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8868 ok(!lstrcmpA(prop, "regszdata"),
8869 "Expected \"regszdata\", got \"%s\"\n", prop);
8870 }
8871
8872 size = MAX_PATH;
8873 r = MsiGetPropertyA(hpkg, "SIGPROP18", prop, &size);
8874 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8875 ok(!lstrcmpA(prop, "defvalue"),
8876 "Expected \"defvalue\", got \"%s\"\n", prop);
8877
8878 size = MAX_PATH;
8879 r = MsiGetPropertyA(hpkg, "SIGPROP19", prop, &size);
8880 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8881 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8882
8883 size = MAX_PATH;
8884 r = MsiGetPropertyA(hpkg, "SIGPROP20", prop, &size);
8885 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8886 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8887
8888 if (version)
8889 {
8890 size = MAX_PATH;
8891 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8892 r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size);
8893 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8894 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8895
8896 size = MAX_PATH;
8897 r = MsiGetPropertyA(hpkg, "SIGPROP22", prop, &size);
8898 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8899 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8900
8901 size = MAX_PATH;
8902 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
8903 r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size);
8904 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8905 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8906 }
8907
8908 size = MAX_PATH;
8909 lstrcpyA(path, CURR_DIR);
8910 ptr = strrchr(path, '\\') + 1;
8911 *ptr = '\0';
8912 r = MsiGetPropertyA(hpkg, "SIGPROP24", prop, &size);
8913 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8914 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8915
8916 size = MAX_PATH;
8917 sprintf(path, "%s\\", CURR_DIR);
8918 r = MsiGetPropertyA(hpkg, "SIGPROP25", prop, &size);
8919 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8920 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8921
8922 size = MAX_PATH;
8923 r = MsiGetPropertyA(hpkg, "SIGPROP26", prop, &size);
8924 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8925 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8926
8927 size = MAX_PATH;
8928 r = MsiGetPropertyA(hpkg, "SIGPROP27", prop, &size);
8929 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8930 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8931
8932 size = MAX_PATH;
8933 r = MsiGetPropertyA(hpkg, "SIGPROP28", prop, &size);
8934 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8935 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8936
8937 size = MAX_PATH;
8938 sprintf(path, "%s\\FileName1", CURR_DIR);
8939 r = MsiGetPropertyA(hpkg, "SIGPROP29", prop, &size);
8940 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8941 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8942
8943 size = MAX_PATH;
8944 sprintf(path, "%s\\FileName1", CURR_DIR);
8945 r = MsiGetPropertyA(hpkg, "SIGPROP30", prop, &size);
8946 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8947 if (space)
8948 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8949 else
8950 todo_wine ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8951
8952 RegSetValueA(hklm, NULL, REG_SZ, "", 0);
8953 RegDeleteValueA(hklm, "Value1");
8954 RegDeleteValueA(hklm, "Value2");
8955 RegDeleteValueA(hklm, "Value3");
8956 RegDeleteValueA(hklm, "Value4");
8957 RegDeleteValueA(hklm, "Value5");
8958 RegDeleteValueA(hklm, "Value6");
8959 RegDeleteValueA(hklm, "Value7");
8960 RegDeleteValueA(hklm, "Value8");
8961 RegDeleteValueA(hklm, "Value9");
8962 RegDeleteValueA(hklm, "Value10");
8963 RegDeleteValueA(hklm, "Value11");
8964 RegDeleteValueA(hklm, "Value12");
8965 RegDeleteValueA(hklm, "Value13");
8966 RegDeleteValueA(hklm, "Value14");
8967 RegDeleteValueA(hklm, "Value15");
8968 RegDeleteValueA(hklm, "Value16");
8969 RegDeleteValueA(hklm, "Value17");
8970 RegDeleteKey(hklm, "");
8971 RegCloseKey(hklm);
8972
8973 RegDeleteValueA(classes, "Value1");
8974 RegDeleteKeyA(classes, "");
8975 RegCloseKey(classes);
8976
8977 RegDeleteValueA(hkcu, "Value1");
8978 RegDeleteKeyA(hkcu, "");
8979 RegCloseKey(hkcu);
8980
8981 RegDeleteValueA(users, "Value1");
8982 RegDeleteKeyA(users, "");
8983 RegCloseKey(users);
8984
8985 DeleteFileA("FileName1");
8986 DeleteFileA("FileName3.dll");
8987 DeleteFileA("FileName4.dll");
8988 DeleteFileA("FileName5.dll");
8989 MsiCloseHandle(hpkg);
8990 DeleteFileA(msifile);
8991 }
8992
8993 static void delete_win_ini(LPCSTR file)
8994 {
8995 CHAR path[MAX_PATH];
8996
8997 GetWindowsDirectoryA(path, MAX_PATH);
8998 lstrcatA(path, "\\");
8999 lstrcatA(path, file);
9000
9001 DeleteFileA(path);
9002 }
9003
9004 static void test_appsearch_inilocator(void)
9005 {
9006 MSIHANDLE hpkg, hdb;
9007 CHAR path[MAX_PATH];
9008 CHAR prop[MAX_PATH];
9009 BOOL version;
9010 LPCSTR str;
9011 LPSTR ptr;
9012 DWORD size;
9013 UINT r;
9014
9015 version = TRUE;
9016 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
9017 version = FALSE;
9018
9019 DeleteFileA("test.dll");
9020
9021 WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
9022
9023 create_test_file("FileName1");
9024 sprintf(path, "%s\\FileName1", CURR_DIR);
9025 WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
9026
9027 WritePrivateProfileStringA("Section", "Key3", CURR_DIR, "IniFile.ini");
9028
9029 sprintf(path, "%s\\IDontExist", CURR_DIR);
9030 WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
9031
9032 create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
9033 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
9034 WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
9035
9036 create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
9037 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
9038 WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
9039
9040 create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
9041 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
9042 WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
9043
9044 hdb = create_package_db();
9045 ok(hdb, "Expected a valid database handle\n");
9046
9047 r = create_appsearch_table(hdb);
9048 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9049
9050 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
9051 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9052
9053 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
9054 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9055
9056 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
9057 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9058
9059 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
9060 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9061
9062 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
9063 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9064
9065 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
9066 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9067
9068 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
9069 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9070
9071 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
9072 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9073
9074 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
9075 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9076
9077 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
9078 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9079
9080 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
9081 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9082
9083 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
9084 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9085
9086 r = create_inilocator_table(hdb);
9087 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9088
9089 /* msidbLocatorTypeRawValue, field 1 */
9090 str = "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
9091 r = add_inilocator_entry(hdb, str);
9092 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9093
9094 /* msidbLocatorTypeRawValue, field 2 */
9095 str = "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
9096 r = add_inilocator_entry(hdb, str);
9097 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9098
9099 /* msidbLocatorTypeRawValue, entire field */
9100 str = "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
9101 r = add_inilocator_entry(hdb, str);
9102 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9103
9104 /* msidbLocatorTypeFile */
9105 str = "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
9106 r = add_inilocator_entry(hdb, str);
9107 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9108
9109 /* msidbLocatorTypeDirectory, file */
9110 str = "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
9111 r = add_inilocator_entry(hdb, str);
9112 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9113
9114 /* msidbLocatorTypeDirectory, directory */
9115 str = "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
9116 r = add_inilocator_entry(hdb, str);
9117 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9118
9119 /* msidbLocatorTypeFile, file, no signature */
9120 str = "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
9121 r = add_inilocator_entry(hdb, str);
9122 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9123
9124 /* msidbLocatorTypeFile, dir, no signature */
9125 str = "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
9126 r = add_inilocator_entry(hdb, str);
9127 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9128
9129 /* msidbLocatorTypeFile, file does not exist */
9130 str = "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
9131 r = add_inilocator_entry(hdb, str);
9132 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9133
9134 /* msidbLocatorTypeFile, signature with version */
9135 str = "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1";
9136 r = add_inilocator_entry(hdb, str);
9137 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9138
9139 /* msidbLocatorTypeFile, signature with version, ver > max */
9140 str = "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1";
9141 r = add_inilocator_entry(hdb, str);
9142 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9143
9144 /* msidbLocatorTypeFile, signature with version, sig->name ignored */
9145 str = "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1";
9146 r = add_inilocator_entry(hdb, str);
9147 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9148
9149 r = create_signature_table(hdb);
9150 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9151
9152 r = add_signature_entry(hdb, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
9153 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9154
9155 r = add_signature_entry(hdb, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
9156 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9157
9158 r = add_signature_entry(hdb, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
9159 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9160
9161 r = add_signature_entry(hdb, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
9162 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9163
9164 r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
9165 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9166
9167 r = package_from_db(hdb, &hpkg);
9168 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9169 {
9170 skip("Not enough rights to perform tests\n");
9171 goto error;
9172 }
9173 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
9174
9175 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9176
9177 r = MsiDoAction(hpkg, "AppSearch");
9178 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9179
9180 size = MAX_PATH;
9181 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
9182 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9183 ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop);
9184
9185 size = MAX_PATH;
9186 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
9187 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9188 ok(!lstrcmpA(prop, "field2"), "Expected \"field2\", got \"%s\"\n", prop);
9189
9190 size = MAX_PATH;
9191 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
9192 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9193 ok(!lstrcmpA(prop, "keydata,field2"),
9194 "Expected \"keydata,field2\", got \"%s\"\n", prop);
9195
9196 size = MAX_PATH;
9197 sprintf(path, "%s\\FileName1", CURR_DIR);
9198 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
9199 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9200 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9201
9202 size = MAX_PATH;
9203 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
9204 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9205 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9206
9207 size = MAX_PATH;
9208 sprintf(path, "%s\\", CURR_DIR);
9209 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
9210 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9211 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9212
9213 size = MAX_PATH;
9214 sprintf(path, "%s\\", CURR_DIR);
9215 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
9216 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9217 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9218
9219 size = MAX_PATH;
9220 lstrcpyA(path, CURR_DIR);
9221 ptr = strrchr(path, '\\');
9222 *(ptr + 1) = '\0';
9223 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
9224 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9225 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9226
9227 size = MAX_PATH;
9228 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
9229 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9230 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9231
9232 if (version)
9233 {
9234 size = MAX_PATH;
9235 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
9236 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
9237 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9238 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9239
9240 size = MAX_PATH;
9241 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
9242 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9243 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9244
9245 size = MAX_PATH;
9246 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
9247 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
9248 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9249 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9250 }
9251
9252 MsiCloseHandle(hpkg);
9253
9254 error:
9255 delete_win_ini("IniFile.ini");
9256 DeleteFileA("FileName1");
9257 DeleteFileA("FileName2.dll");
9258 DeleteFileA("FileName3.dll");
9259 DeleteFileA("FileName4.dll");
9260 DeleteFileA(msifile);
9261 }
9262
9263 /*
9264 * MSI AppSearch action on DrLocator table always returns absolute paths.
9265 * If a relative path was set, it returns the first absolute path that
9266 * matches or an empty string if it didn't find anything.
9267 * This helper function replicates this behaviour.
9268 */
9269 static void search_absolute_directory(LPSTR absolute, LPCSTR relative)
9270 {
9271 int i, size;
9272 DWORD attr, drives;
9273
9274 size = lstrlenA(relative);
9275 drives = GetLogicalDrives();
9276 lstrcpyA(absolute, "A:\\");
9277 for (i = 0; i < 26; absolute[0] = '\0', i++)
9278 {
9279 if (!(drives & (1 << i)))
9280 continue;
9281
9282 absolute[0] = 'A' + i;
9283 if (GetDriveType(absolute) != DRIVE_FIXED)
9284 continue;
9285
9286 lstrcpynA(absolute + 3, relative, size + 1);
9287 attr = GetFileAttributesA(absolute);
9288 if (attr != INVALID_FILE_ATTRIBUTES &&
9289 (attr & FILE_ATTRIBUTE_DIRECTORY))
9290 {
9291 if (absolute[3 + size - 1] != '\\')
9292 lstrcatA(absolute, "\\");
9293 break;
9294 }
9295 absolute[3] = '\0';
9296 }
9297 }
9298
9299 static void test_appsearch_drlocator(void)
9300 {
9301 MSIHANDLE hpkg, hdb;
9302 CHAR path[MAX_PATH];
9303 CHAR prop[MAX_PATH];
9304 BOOL version;
9305 LPCSTR str;
9306 DWORD size;
9307 UINT r;
9308
9309 version = TRUE;
9310 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
9311 version = FALSE;
9312
9313 DeleteFileA("test.dll");
9314
9315 create_test_file("FileName1");
9316 CreateDirectoryA("one", NULL);
9317 CreateDirectoryA("one\\two", NULL);
9318 CreateDirectoryA("one\\two\\three", NULL);
9319 create_test_file("one\\two\\three\\FileName2");
9320 CreateDirectoryA("another", NULL);
9321 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
9322 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
9323 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
9324
9325 hdb = create_package_db();
9326 ok(hdb, "Expected a valid database handle\n");
9327
9328 r = create_appsearch_table(hdb);
9329 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9330
9331 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
9332 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9333
9334 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
9335 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9336
9337 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
9338 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9339
9340 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
9341 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9342
9343 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
9344 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9345
9346 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
9347 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9348
9349 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
9350 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9351
9352 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
9353 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9354
9355 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
9356 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9357
9358 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
9359 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9360
9361 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
9362 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9363
9364 r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
9365 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9366
9367 r = create_drlocator_table(hdb);
9368 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9369
9370 /* no parent, full path, depth 0, signature */
9371 sprintf(path, "'NewSignature1', '', '%s', 0", CURR_DIR);
9372 r = add_drlocator_entry(hdb, path);
9373 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9374
9375 /* no parent, full path, depth 0, no signature */
9376 sprintf(path, "'NewSignature2', '', '%s', 0", CURR_DIR);
9377 r = add_drlocator_entry(hdb, path);
9378 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9379
9380 /* no parent, relative path, depth 0, no signature */
9381 sprintf(path, "'NewSignature3', '', '%s', 0", CURR_DIR + 3);
9382 r = add_drlocator_entry(hdb, path);
9383 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9384
9385 /* no parent, full path, depth 2, signature */
9386 sprintf(path, "'NewSignature4', '', '%s', 2", CURR_DIR);
9387 r = add_drlocator_entry(hdb, path);
9388 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9389
9390 /* no parent, full path, depth 3, signature */
9391 sprintf(path, "'NewSignature5', '', '%s', 3", CURR_DIR);
9392 r = add_drlocator_entry(hdb, path);
9393 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9394
9395 /* no parent, full path, depth 1, signature is dir */
9396 sprintf(path, "'NewSignature6', '', '%s', 1", CURR_DIR);
9397 r = add_drlocator_entry(hdb, path);
9398 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9399
9400 /* parent is in DrLocator, relative path, depth 0, signature */
9401 sprintf(path, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
9402 r = add_drlocator_entry(hdb, path);
9403 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9404
9405 /* no parent, full path, depth 0, signature w/ version */
9406 sprintf(path, "'NewSignature8', '', '%s', 0", CURR_DIR);
9407 r = add_drlocator_entry(hdb, path);
9408 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9409
9410 /* no parent, full path, depth 0, signature w/ version, ver > max */
9411 sprintf(path, "'NewSignature9', '', '%s', 0", CURR_DIR);
9412 r = add_drlocator_entry(hdb, path);
9413 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9414
9415 /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
9416 sprintf(path, "'NewSignature10', '', '%s', 0", CURR_DIR);
9417 r = add_drlocator_entry(hdb, path);
9418 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9419
9420 /* no parent, relative empty path, depth 0, no signature */
9421 sprintf(path, "'NewSignature11', '', '', 0");
9422 r = add_drlocator_entry(hdb, path);
9423 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9424
9425 r = create_reglocator_table(hdb);
9426 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9427
9428 /* parent */
9429 r = add_reglocator_entry(hdb, "NewSignature12", 2, "htmlfile\\shell\\open\\nonexistent", "", 1);
9430 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9431
9432 /* parent is in RegLocator, no path, depth 0, no signature */
9433 sprintf(path, "'NewSignature13', 'NewSignature12', '', 0");
9434 r = add_drlocator_entry(hdb, path);
9435 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9436
9437 r = create_signature_table(hdb);
9438 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9439
9440 str = "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
9441 r = add_signature_entry(hdb, str);
9442 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9443
9444 str = "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
9445 r = add_signature_entry(hdb, str);
9446 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9447
9448 str = "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
9449 r = add_signature_entry(hdb, str);
9450 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9451
9452 str = "'NewSignature6', 'another', '', '', '', '', '', '', ''";
9453 r = add_signature_entry(hdb, str);
9454 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9455
9456 str = "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
9457 r = add_signature_entry(hdb, str);
9458 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9459
9460 str = "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
9461 r = add_signature_entry(hdb, str);
9462 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9463
9464 str = "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
9465 r = add_signature_entry(hdb, str);
9466 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9467
9468 str = "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
9469 r = add_signature_entry(hdb, str);
9470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9471
9472 r = package_from_db(hdb, &hpkg);
9473 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9474 {
9475 skip("Not enough rights to perform tests\n");
9476 goto error;
9477 }
9478 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
9479
9480 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9481
9482 r = MsiDoAction(hpkg, "AppSearch");
9483 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9484
9485 size = MAX_PATH;
9486 sprintf(path, "%s\\FileName1", CURR_DIR);
9487 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
9488 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9489 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9490
9491 size = MAX_PATH;
9492 sprintf(path, "%s\\", CURR_DIR);
9493 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
9494 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9495 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9496
9497 size = MAX_PATH;
9498 search_absolute_directory(path, CURR_DIR + 3);
9499 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
9500 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9501 ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9502
9503 size = MAX_PATH;
9504 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
9505 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9506 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9507
9508 size = MAX_PATH;
9509 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
9510 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
9511 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9512 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9513
9514 size = MAX_PATH;
9515 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
9516 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9517 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9518
9519 size = MAX_PATH;
9520 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
9521 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
9522 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9523 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9524
9525 if (version)
9526 {
9527 size = MAX_PATH;
9528 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
9529 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
9530 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9531 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9532
9533 size = MAX_PATH;
9534 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
9535 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9536 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9537
9538 size = MAX_PATH;
9539 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
9540 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9541 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9542 }
9543
9544 size = MAX_PATH;
9545 search_absolute_directory(path, "");
9546 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
9547 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9548 ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9549
9550 size = MAX_PATH;
9551 strcpy(path, "c:\\");
9552 r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
9553 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9554 ok(!prop[0], "Expected \"\", got \"%s\"\n", prop);
9555
9556 MsiCloseHandle(hpkg);
9557
9558 error:
9559 DeleteFileA("FileName1");
9560 DeleteFileA("FileName3.dll");
9561 DeleteFileA("FileName4.dll");
9562 DeleteFileA("FileName5.dll");
9563 DeleteFileA("one\\two\\three\\FileName2");
9564 RemoveDirectoryA("one\\two\\three");
9565 RemoveDirectoryA("one\\two");
9566 RemoveDirectoryA("one");
9567 RemoveDirectoryA("another");
9568 DeleteFileA(msifile);
9569 }
9570
9571 static void test_featureparents(void)
9572 {
9573 MSIHANDLE hpkg;
9574 UINT r;
9575 MSIHANDLE hdb;
9576 INSTALLSTATE state, action;
9577
9578 hdb = create_package_db();
9579 ok ( hdb, "failed to create package database\n" );
9580
9581 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
9582 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
9583
9584 r = create_feature_table( hdb );
9585 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
9586
9587 r = create_component_table( hdb );
9588 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
9589
9590 r = create_feature_components_table( hdb );
9591 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
9592
9593 r = create_file_table( hdb );
9594 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
9595
9596 /* msidbFeatureAttributesFavorLocal */
9597 r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
9598 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9599
9600 /* msidbFeatureAttributesFavorSource */
9601 r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
9602 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9603
9604 /* msidbFeatureAttributesFavorLocal */
9605 r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
9606 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9607
9608 /* msidbFeatureAttributesUIDisallowAbsent */
9609 r = add_feature_entry( hdb, "'lyra', '', '', '', 2, 1, '', 16" );
9610 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9611
9612 /* disabled because of install level */
9613 r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
9614 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9615
9616 /* child feature of disabled feature */
9617 r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
9618 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9619
9620 /* component of disabled feature (install level) */
9621 r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
9622 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9623
9624 /* component of disabled child feature (install level) */
9625 r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
9626 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9627
9628 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
9629 r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
9630 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9631
9632 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
9633 r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
9634 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9635
9636 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
9637 r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
9638 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9639
9640 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
9641 r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
9642 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9643
9644 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
9645 r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
9646 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9647
9648 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
9649 r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
9650 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9651
9652 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
9653 r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
9654 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9655
9656 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
9657 r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
9658 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9659
9660 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
9661 r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
9662 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
9663
9664 r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
9665 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9666
9667 r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
9668 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9669
9670 r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
9671 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9672
9673 r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
9674 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9675
9676 r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
9677 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9678
9679 r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
9680 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9681
9682 r = add_feature_components_entry( hdb, "'orion', 'leo'" );
9683 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9684
9685 r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
9686 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9687
9688 r = add_feature_components_entry( hdb, "'orion', 'libra'" );
9689 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9690
9691 r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
9692 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9693
9694 r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
9695 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9696
9697 r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
9698 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9699
9700 r = add_feature_components_entry( hdb, "'orion', 'canis'" );
9701 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9702
9703 r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
9704 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9705
9706 r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
9707 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9708
9709 r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
9710 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9711
9712 r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
9713 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9714
9715 r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
9716 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9717
9718 r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
9719 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9720
9721 r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
9722 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9723
9724 r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
9725 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9726
9727 r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
9728 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9729
9730 r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
9731 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9732
9733 r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
9734 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9735
9736 r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
9737 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9738
9739 r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
9740 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9741
9742 r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
9743 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9744
9745 r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
9746 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9747
9748 r = package_from_db( hdb, &hpkg );
9749 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9750 {
9751 skip("Not enough rights to perform tests\n");
9752 DeleteFile(msifile);
9753 return;
9754 }
9755 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
9756
9757 MsiCloseHandle( hdb );
9758
9759 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9760
9761 r = MsiDoAction( hpkg, "CostInitialize");
9762 ok( r == ERROR_SUCCESS, "cost init failed\n");
9763
9764 r = MsiDoAction( hpkg, "FileCost");
9765 ok( r == ERROR_SUCCESS, "file cost failed\n");
9766
9767 r = MsiDoAction( hpkg, "CostFinalize");
9768 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
9769
9770 state = 0xdeadbee;
9771 action = 0xdeadbee;
9772 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
9773 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9774 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9775 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9776
9777 state = 0xdeadbee;
9778 action = 0xdeadbee;
9779 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
9780 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9781 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9782 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
9783
9784 state = 0xdeadbee;
9785 action = 0xdeadbee;
9786 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
9787 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9788 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9789 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9790
9791 state = 0xdeadbee;
9792 action = 0xdeadbee;
9793 r = MsiGetFeatureState(hpkg, "lyra", &state, &action);
9794 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9795 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9796 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9797
9798 state = 0xdeadbee;
9799 action = 0xdeadbee;
9800 r = MsiGetFeatureState(hpkg, "waters", &state, &action);
9801 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9802 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9803 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
9804
9805 state = 0xdeadbee;
9806 action = 0xdeadbee;
9807 r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
9808 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9809 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9810 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
9811
9812 state = 0xdeadbee;
9813 action = 0xdeadbee;
9814 r = MsiGetComponentState(hpkg, "leo", &state, &action);
9815 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9816 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
9817 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9818
9819 state = 0xdeadbee;
9820 action = 0xdeadbee;
9821 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9822 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9823 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9824 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9825
9826 state = 0xdeadbee;
9827 action = 0xdeadbee;
9828 r = MsiGetComponentState(hpkg, "libra", &state, &action);
9829 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9830 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9831 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9832
9833 state = 0xdeadbee;
9834 action = 0xdeadbee;
9835 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9836 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9837 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9838 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9839
9840 state = 0xdeadbee;
9841 action = 0xdeadbee;
9842 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9843 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9844 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9845 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9846
9847 state = 0xdeadbee;
9848 action = 0xdeadbee;
9849 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9850 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9851 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9852 ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
9853
9854 state = 0xdeadbee;
9855 action = 0xdeadbee;
9856 r = MsiGetComponentState(hpkg, "canis", &state, &action);
9857 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9858 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9859 ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
9860
9861 state = 0xdeadbee;
9862 action = 0xdeadbee;
9863 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9864 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9865 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9866 ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
9867
9868 state = 0xdeadbee;
9869 action = 0xdeadbee;
9870 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9871 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9872 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9873 ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
9874
9875 state = 0xdeadbee;
9876 action = 0xdeadbee;
9877 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9878 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9879 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9880 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9881
9882 state = 0xdeadbee;
9883 action = 0xdeadbee;
9884 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9885 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9886 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
9887 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
9888
9889 r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
9890 ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
9891
9892 r = MsiSetFeatureState(hpkg, "lyra", INSTALLSTATE_ABSENT);
9893 ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
9894
9895 r = MsiSetFeatureState(hpkg, "nosuchfeature", INSTALLSTATE_ABSENT);
9896 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %u\n", r);
9897
9898 state = 0xdeadbee;
9899 action = 0xdeadbee;
9900 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
9901 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9902 ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
9903 ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
9904
9905 state = 0xdeadbee;
9906 action = 0xdeadbee;
9907 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
9908 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9909 ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
9910 ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
9911
9912 state = 0xdeadbee;
9913 action = 0xdeadbee;
9914 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
9915 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9916 ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
9917 ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
9918
9919 state = 0xdeadbee;
9920 action = 0xdeadbee;
9921 r = MsiGetFeatureState(hpkg, "lyra", &state, &action);
9922 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9923 ok( state == INSTALLSTATE_ABSENT, "Expected lyra INSTALLSTATE_ABSENT, got %d\n", state);
9924 ok( action == INSTALLSTATE_ABSENT, "Expected lyra INSTALLSTATE_ABSENT, got %d\n", action);
9925
9926 state = 0xdeadbee;
9927 action = 0xdeadbee;
9928 r = MsiGetComponentState(hpkg, "leo", &state, &action);
9929 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9930 ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
9931 ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
9932
9933 state = 0xdeadbee;
9934 action = 0xdeadbee;
9935 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9936 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9937 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9938 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9939
9940 state = 0xdeadbee;
9941 action = 0xdeadbee;
9942 r = MsiGetComponentState(hpkg, "libra", &state, &action);
9943 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9944 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9945 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9946
9947 state = 0xdeadbee;
9948 action = 0xdeadbee;
9949 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9950 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9951 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9952 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9953
9954 state = 0xdeadbee;
9955 action = 0xdeadbee;
9956 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9957 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9958 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9959 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9960
9961 state = 0xdeadbee;
9962 action = 0xdeadbee;
9963 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9964 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9965 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9966 ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
9967
9968 state = 0xdeadbee;
9969 action = 0xdeadbee;
9970 r = MsiGetComponentState(hpkg, "canis", &state, &action);
9971 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9972 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9973 ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
9974
9975 state = 0xdeadbee;
9976 action = 0xdeadbee;
9977 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9978 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9979 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9980 ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
9981
9982 state = 0xdeadbee;
9983 action = 0xdeadbee;
9984 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9985 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9986 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9987 ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
9988
9989 state = 0xdeadbee;
9990 action = 0xdeadbee;
9991 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9992 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9993 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9994 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9995
9996 state = 0xdeadbee;
9997 action = 0xdeadbee;
9998 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9999 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
10000 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
10001 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
10002
10003 MsiCloseHandle(hpkg);
10004 DeleteFileA(msifile);
10005 }
10006
10007 static void test_installprops(void)
10008 {
10009 MSIHANDLE hpkg, hdb;
10010 CHAR path[MAX_PATH], buf[MAX_PATH];
10011 DWORD size, type;
10012 LANGID langid;
10013 HKEY hkey1, hkey2;
10014 int res;
10015 UINT r;
10016 REGSAM access = KEY_ALL_ACCESS;
10017 SYSTEM_INFO si;
10018
10019 if (is_wow64)
10020 access |= KEY_WOW64_64KEY;
10021
10022 GetCurrentDirectory(MAX_PATH, path);
10023 lstrcat(path, "\\");
10024 lstrcat(path, msifile);
10025
10026 hdb = create_package_db();
10027 ok( hdb, "failed to create database\n");
10028
10029 r = package_from_db(hdb, &hpkg);
10030 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
10031 {
10032 skip("Not enough rights to perform tests\n");
10033 DeleteFile(msifile);
10034 return;
10035 }
10036 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
10037
10038 MsiCloseHandle(hdb);
10039
10040 size = MAX_PATH;
10041 r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
10042 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10043 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
10044
10045 RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
10046 RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey2);
10047
10048 size = MAX_PATH;
10049 type = REG_SZ;
10050 *path = '\0';
10051 if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
10052 {
10053 size = MAX_PATH;
10054 type = REG_SZ;
10055 RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
10056 }
10057
10058 size = MAX_PATH;
10059 r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
10060 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10061 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
10062
10063 size = MAX_PATH;
10064 type = REG_SZ;
10065 *path = '\0';
10066 if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
10067 {
10068 size = MAX_PATH;
10069 type = REG_SZ;
10070 RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
10071 }
10072
10073 if (*path)
10074 {
10075 size = MAX_PATH;
10076 r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
10077 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10078 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
10079 }
10080
10081 size = MAX_PATH;
10082 r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
10083 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10084 trace("VersionDatabase = %s\n", buf);
10085
10086 size = MAX_PATH;
10087 r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
10088 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10089 trace("VersionMsi = %s\n", buf);
10090
10091 size = MAX_PATH;
10092 r = MsiGetProperty(hpkg, "Date", buf, &size);
10093 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10094 trace("Date = %s\n", buf);
10095
10096 size = MAX_PATH;
10097 r = MsiGetProperty(hpkg, "Time", buf, &size);
10098 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10099 trace("Time = %s\n", buf);
10100
10101 size = MAX_PATH;
10102 r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
10103 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10104 trace("PackageCode = %s\n", buf);
10105
10106 size = MAX_PATH;
10107 r = MsiGetProperty(hpkg, "ComputerName", buf, &size);
10108 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
10109 trace("ComputerName = %s\n", buf);
10110
10111 langid = GetUserDefaultLangID();
10112 sprintf(path, "%d", langid);
10113
10114 size = MAX_PATH;
10115 r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
10116 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
10117 ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
10118
10119 res = GetSystemMetrics(SM_CXSCREEN);
10120 size = MAX_PATH;
10121 r = MsiGetProperty(hpkg, "ScreenX", buf, &size);
10122 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
10123 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
10124
10125 res = GetSystemMetrics(SM_CYSCREEN);
10126 size = MAX_PATH;
10127 r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
10128 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
10129 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
10130
10131 if (pGetSystemInfo && pSHGetFolderPathA)
10132 {
10133 pGetSystemInfo(&si);
10134 if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
10135 {
10136 buf[0] = 0;
10137 size = MAX_PATH;
10138 r = MsiGetProperty(hpkg, "MsiAMD64", buf, &size);
10139 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10140 ok(buf[0], "property not set\n");
10141
10142 buf[0] = 0;
10143 size = MAX_PATH;
10144 r = MsiGetProperty(hpkg, "Msix64", 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, "System64Folder", buf, &size);
10151 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10152 GetSystemDirectoryA(path, MAX_PATH);
10153 if (size) buf[size - 1] = 0;
10154 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10155
10156 buf[0] = 0;
10157 size = MAX_PATH;
10158 r = MsiGetProperty(hpkg, "SystemFolder", buf, &size);
10159 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10160 pGetSystemWow64DirectoryA(path, MAX_PATH);
10161 if (size) buf[size - 1] = 0;
10162 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10163
10164 buf[0] = 0;
10165 size = MAX_PATH;
10166 r = MsiGetProperty(hpkg, "ProgramFiles64Folder", buf, &size);
10167 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10168 pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES, NULL, 0, path);
10169 if (size) buf[size - 1] = 0;
10170 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10171
10172 buf[0] = 0;
10173 size = MAX_PATH;
10174 r = MsiGetProperty(hpkg, "ProgramFilesFolder", buf, &size);
10175 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10176 pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILESX86, NULL, 0, path);
10177 if (size) buf[size - 1] = 0;
10178 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10179
10180 buf[0] = 0;
10181 size = MAX_PATH;
10182 r = MsiGetProperty(hpkg, "CommonFiles64Folder", buf, &size);
10183 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10184 pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMON, NULL, 0, path);
10185 if (size) buf[size - 1] = 0;
10186 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10187
10188 buf[0] = 0;
10189 size = MAX_PATH;
10190 r = MsiGetProperty(hpkg, "CommonFilesFolder", buf, &size);
10191 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10192 pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMONX86, NULL, 0, path);
10193 if (size) buf[size - 1] = 0;
10194 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10195
10196 buf[0] = 0;
10197 size = MAX_PATH;
10198 r = MsiGetProperty(hpkg, "VersionNT64", buf, &size);
10199 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10200 ok(buf[0], "property not set\n");
10201 }
10202 else if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
10203 {
10204 if (!is_wow64)
10205 {
10206 buf[0] = 0;
10207 size = MAX_PATH;
10208 r = MsiGetProperty(hpkg, "MsiAMD64", buf, &size);
10209 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10210 ok(!buf[0], "property set\n");
10211
10212 buf[0] = 0;
10213 size = MAX_PATH;
10214 r = MsiGetProperty(hpkg, "Msix64", buf, &size);
10215 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10216 ok(!buf[0], "property set\n");
10217
10218 buf[0] = 0;
10219 size = MAX_PATH;
10220 r = MsiGetProperty(hpkg, "System64Folder", buf, &size);
10221 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10222 ok(!buf[0], "property set\n");
10223
10224 buf[0] = 0;
10225 size = MAX_PATH;
10226 r = MsiGetProperty(hpkg, "SystemFolder", buf, &size);
10227 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10228 GetSystemDirectoryA(path, MAX_PATH);
10229 if (size) buf[size - 1] = 0;
10230 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10231
10232 buf[0] = 0;
10233 size = MAX_PATH;
10234 r = MsiGetProperty(hpkg, "ProgramFiles64Folder", buf, &size);
10235 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10236 ok(!buf[0], "property set\n");
10237
10238 buf[0] = 0;
10239 size = MAX_PATH;
10240 r = MsiGetProperty(hpkg, "ProgramFilesFolder", buf, &size);
10241 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10242 pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES, NULL, 0, path);
10243 if (size) buf[size - 1] = 0;
10244 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10245
10246 buf[0] = 0;
10247 size = MAX_PATH;
10248 r = MsiGetProperty(hpkg, "CommonFiles64Folder", buf, &size);
10249 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10250 ok(!buf[0], "property set\n");
10251
10252 buf[0] = 0;
10253 size = MAX_PATH;
10254 r = MsiGetProperty(hpkg, "CommonFilesFolder", buf, &size);
10255 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10256 pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMON, NULL, 0, path);
10257 if (size) buf[size - 1] = 0;
10258 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10259
10260 buf[0] = 0;
10261 size = MAX_PATH;
10262 r = MsiGetProperty(hpkg, "VersionNT64", buf, &size);
10263 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10264 ok(!buf[0], "property set\n");
10265 }
10266 else
10267 {
10268 buf[0] = 0;
10269 size = MAX_PATH;
10270 r = MsiGetProperty(hpkg, "MsiAMD64", buf, &size);
10271 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10272 ok(buf[0], "property not set\n");
10273
10274 buf[0] = 0;
10275 size = MAX_PATH;
10276 r = MsiGetProperty(hpkg, "Msix64", buf, &size);
10277 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10278 ok(buf[0], "property not set\n");
10279
10280 buf[0] = 0;
10281 size = MAX_PATH;
10282 r = MsiGetProperty(hpkg, "System64Folder", buf, &size);
10283 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10284 GetSystemDirectoryA(path, MAX_PATH);
10285 if (size) buf[size - 1] = 0;
10286 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10287
10288 buf[0] = 0;
10289 size = MAX_PATH;
10290 r = MsiGetProperty(hpkg, "SystemFolder", buf, &size);
10291 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10292 pGetSystemWow64DirectoryA(path, MAX_PATH);
10293 if (size) buf[size - 1] = 0;
10294 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10295
10296 buf[0] = 0;
10297 size = MAX_PATH;
10298 r = MsiGetProperty(hpkg, "ProgramFilesFolder64", buf, &size);
10299 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10300 ok(!buf[0], "property set\n");
10301
10302 buf[0] = 0;
10303 size = MAX_PATH;
10304 r = MsiGetProperty(hpkg, "ProgramFilesFolder", buf, &size);
10305 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10306 pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILESX86, NULL, 0, path);
10307 if (size) buf[size - 1] = 0;
10308 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10309
10310 buf[0] = 0;
10311 size = MAX_PATH;
10312 r = MsiGetProperty(hpkg, "CommonFilesFolder64", buf, &size);
10313 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10314 ok(!buf[0], "property set\n");
10315
10316 buf[0] = 0;
10317 size = MAX_PATH;
10318 r = MsiGetProperty(hpkg, "CommonFilesFolder", buf, &size);
10319 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10320 pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMONX86, NULL, 0, path);
10321 if (size) buf[size - 1] = 0;
10322 ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
10323
10324 buf[0] = 0;
10325 size = MAX_PATH;
10326 r = MsiGetProperty(hpkg, "VersionNT64", buf, &size);
10327 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
10328 ok(buf[0], "property not set\n");
10329 }
10330 }
10331 }
10332
10333 CloseHandle(hkey1);
10334 CloseHandle(hkey2);
10335 MsiCloseHandle(hpkg);
10336 DeleteFile(msifile);
10337 }
10338
10339 static void test_launchconditions(void)
10340 {
10341 MSIHANDLE hpkg;
10342 MSIHANDLE hdb;
10343 UINT r;
10344
10345 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
10346
10347 hdb = create_package_db();
10348 ok( hdb, "failed to create package database\n" );
10349
10350 r = create_launchcondition_table( hdb );
10351 ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
10352
10353 r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
10354 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
10355
10356 /* invalid condition */
10357 r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
10358 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
10359
10360 r = package_from_db( hdb, &hpkg );
10361 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
10362 {
10363 skip("Not enough rights to perform tests\n");
10364 DeleteFile(msifile);
10365 return;
10366 }
10367 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
10368
10369 MsiCloseHandle( hdb );
10370
10371 r = MsiSetProperty( hpkg, "X", "1" );
10372 ok( r == ERROR_SUCCESS, "failed to set property\n" );
10373
10374 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
10375
10376 /* invalid conditions are ignored */
10377 r = MsiDoAction( hpkg, "LaunchConditions" );
10378 ok( r == ERROR_SUCCESS, "cost init failed\n" );
10379
10380 /* verify LaunchConditions still does some verification */
10381 r = MsiSetProperty( hpkg, "X", "2" );
10382 ok( r == ERROR_SUCCESS, "failed to set property\n" );
10383
10384 r = MsiDoAction( hpkg, "LaunchConditions" );
10385 ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
10386
10387 MsiCloseHandle( hpkg );
10388 DeleteFile( msifile );
10389 }
10390
10391 static void test_ccpsearch(void)
10392 {
10393 MSIHANDLE hdb, hpkg;
10394 CHAR prop[MAX_PATH];
10395 DWORD size = MAX_PATH;
10396 UINT r;
10397
10398 hdb = create_package_db();
10399 ok(hdb, "failed to create package database\n");
10400
10401 r = create_ccpsearch_table(hdb);
10402 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10403
10404 r = add_ccpsearch_entry(hdb, "'CCP_random'");
10405 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10406
10407 r = add_ccpsearch_entry(hdb, "'RMCCP_random'");
10408 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10409
10410 r = create_reglocator_table(hdb);
10411 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10412
10413 r = add_reglocator_entry(hdb, "CCP_random", 0, "htmlfile\\shell\\open\\nonexistent", "", 1);
10414 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10415
10416 r = create_drlocator_table(hdb);
10417 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10418
10419 r = add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
10420 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10421
10422 r = create_signature_table(hdb);
10423 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10424
10425 r = package_from_db(hdb, &hpkg);
10426 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
10427 {
10428 skip("Not enough rights to perform tests\n");
10429 DeleteFile(msifile);
10430 return;
10431 }
10432 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
10433
10434 MsiCloseHandle(hdb);
10435
10436 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
10437
10438 r = MsiDoAction(hpkg, "CCPSearch");
10439 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10440
10441 r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
10442 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10443 ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
10444
10445 MsiCloseHandle(hpkg);
10446 DeleteFileA(msifile);
10447 }
10448
10449 static void test_complocator(void)
10450 {
10451 MSIHANDLE hdb, hpkg;
10452 UINT r;
10453 CHAR prop[MAX_PATH];
10454 CHAR expected[MAX_PATH];
10455 DWORD size = MAX_PATH;
10456
10457 hdb = create_package_db();
10458 ok(hdb, "failed to create package database\n");
10459
10460 r = create_appsearch_table(hdb);
10461 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10462
10463 r = add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
10464 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10465
10466 r = add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
10467 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10468
10469 r = add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
10470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10471
10472 r = add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
10473 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10474
10475 r = add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
10476 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10477
10478 r = add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
10479 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10480
10481 r = add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
10482 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10483
10484 r = add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
10485 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10486
10487 r = add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
10488 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10489
10490 r = add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
10491 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10492
10493 r = add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
10494 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10495
10496 r = add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
10497 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10498
10499 r = add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
10500 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10501
10502 r = add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
10503 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10504
10505 r = add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
10506 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10507
10508 r = add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
10509 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10510
10511 r = create_complocator_table(hdb);
10512 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10513
10514 r = add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
10515 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10516
10517 r = add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
10518 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10519
10520 r = add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
10521 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10522
10523 r = add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
10524 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10525
10526 r = add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
10527 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10528
10529 r = add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
10530 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10531
10532 r = add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
10533 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10534
10535 r = add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
10536 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10537
10538 r = add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
10539 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10540
10541 r = add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
10542 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10543
10544 r = add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
10545 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10546
10547 r = add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
10548 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10549
10550 r = add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
10551 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10552
10553 r = add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
10554 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10555
10556 r = add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
10557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10558
10559 r = add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
10560 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10561
10562 r = create_signature_table(hdb);
10563 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10564
10565 r = add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
10566 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10567
10568 r = add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
10569 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10570
10571 r = add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
10572 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10573
10574 r = add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
10575 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10576
10577 r = add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
10578 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10579
10580 r = add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
10581 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10582
10583 r = add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
10584 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10585
10586 r = add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
10587 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10588
10589 r = package_from_db(hdb, &hpkg);
10590 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
10591 {
10592 skip("Not enough rights to perform tests\n");
10593 DeleteFile(msifile);
10594 return;
10595 }
10596 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
10597
10598 MsiCloseHandle(hdb);
10599
10600 create_test_file("abelisaurus");
10601 create_test_file("bactrosaurus");
10602 create_test_file("camelotia");
10603 create_test_file("diclonius");
10604 create_test_file("echinodon");
10605 create_test_file("falcarius");
10606 create_test_file("gallimimus");
10607 create_test_file("hagryphus");
10608 CreateDirectoryA("iguanodon", NULL);
10609 CreateDirectoryA("jobaria", NULL);
10610 CreateDirectoryA("kakuru", NULL);
10611 CreateDirectoryA("labocania", NULL);
10612 CreateDirectoryA("megaraptor", NULL);
10613 CreateDirectoryA("neosodon", NULL);
10614 CreateDirectoryA("olorotitan", NULL);
10615 CreateDirectoryA("pantydraco", NULL);
10616
10617 set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE,
10618 "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL, FALSE);
10619 set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE,
10620 "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL, FALSE);
10621 set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE,
10622 "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL, FALSE);
10623 set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE,
10624 "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL, FALSE);
10625 set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE,
10626 "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL, FALSE);
10627 set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE,
10628 "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL, FALSE);
10629 set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE,
10630 "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL, FALSE);
10631 set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE,
10632 "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL, FALSE);
10633
10634 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
10635
10636 r = MsiDoAction(hpkg, "AppSearch");
10637 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10638
10639 size = MAX_PATH;
10640 r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
10641 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10642
10643 lstrcpyA(expected, CURR_DIR);
10644 lstrcatA(expected, "\\abelisaurus");
10645 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10646 "Expected %s or empty string, got %s\n", expected, prop);
10647
10648 size = MAX_PATH;
10649 r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
10650 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10651 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10652
10653 size = MAX_PATH;
10654 r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
10655 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10656 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10657
10658 size = MAX_PATH;
10659 r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
10660 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10661 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10662
10663 size = MAX_PATH;
10664 r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
10665 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10666
10667 lstrcpyA(expected, CURR_DIR);
10668 lstrcatA(expected, "\\");
10669 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10670 "Expected %s or empty string, got %s\n", expected, prop);
10671
10672 size = MAX_PATH;
10673 r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
10674 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10675 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10676
10677 size = MAX_PATH;
10678 r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
10679 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10680 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10681
10682 size = MAX_PATH;
10683 r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
10684 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10685 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10686
10687 size = MAX_PATH;
10688 r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
10689 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10690 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10691
10692 size = MAX_PATH;
10693 r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
10694 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10695 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10696
10697 size = MAX_PATH;
10698 r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
10699 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10700 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10701
10702 size = MAX_PATH;
10703 r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
10704 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10705 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10706
10707 size = MAX_PATH;
10708 r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
10709 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10710
10711 lstrcpyA(expected, CURR_DIR);
10712 lstrcatA(expected, "\\");
10713 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10714 "Expected %s or empty string, got %s\n", expected, prop);
10715
10716 size = MAX_PATH;
10717 r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
10718 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10719
10720 lstrcpyA(expected, CURR_DIR);
10721 lstrcatA(expected, "\\neosodon\\");
10722 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10723 "Expected %s or empty string, got %s\n", expected, prop);
10724
10725 size = MAX_PATH;
10726 r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
10727 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10728 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10729
10730 size = MAX_PATH;
10731 r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
10732 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10733 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10734
10735 MsiCloseHandle(hpkg);
10736 DeleteFileA("abelisaurus");
10737 DeleteFileA("bactrosaurus");
10738 DeleteFileA("camelotia");
10739 DeleteFileA("diclonius");
10740 DeleteFileA("echinodon");
10741 DeleteFileA("falcarius");
10742 DeleteFileA("gallimimus");
10743 DeleteFileA("hagryphus");
10744 RemoveDirectoryA("iguanodon");
10745 RemoveDirectoryA("jobaria");
10746 RemoveDirectoryA("kakuru");
10747 RemoveDirectoryA("labocania");
10748 RemoveDirectoryA("megaraptor");
10749 RemoveDirectoryA("neosodon");
10750 RemoveDirectoryA("olorotitan");
10751 RemoveDirectoryA("pantydraco");
10752 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
10753 MSIINSTALLCONTEXT_MACHINE, NULL);
10754 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
10755 MSIINSTALLCONTEXT_MACHINE, NULL);
10756 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
10757 MSIINSTALLCONTEXT_MACHINE, NULL);
10758 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
10759 MSIINSTALLCONTEXT_MACHINE, NULL);
10760 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
10761 MSIINSTALLCONTEXT_MACHINE, NULL);
10762 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
10763 MSIINSTALLCONTEXT_MACHINE, NULL);
10764 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
10765 MSIINSTALLCONTEXT_MACHINE, NULL);
10766 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
10767 MSIINSTALLCONTEXT_MACHINE, NULL);
10768 DeleteFileA(msifile);
10769 }
10770
10771 static void set_suminfo_prop(MSIHANDLE db, DWORD prop, DWORD val)
10772 {
10773 MSIHANDLE summary;
10774 UINT r;
10775
10776 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
10777 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10778
10779 r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
10780 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10781
10782 r = MsiSummaryInfoPersist(summary);
10783 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
10784
10785 MsiCloseHandle(summary);
10786 }
10787
10788 static void test_MsiGetSourcePath(void)
10789 {
10790 MSIHANDLE hdb, hpkg;
10791 CHAR path[MAX_PATH];
10792 CHAR cwd[MAX_PATH];
10793 CHAR subsrc[MAX_PATH];
10794 CHAR sub2[MAX_PATH];
10795 DWORD size;
10796 UINT r;
10797
10798 lstrcpyA(cwd, CURR_DIR);
10799 lstrcatA(cwd, "\\");
10800
10801 lstrcpyA(subsrc, cwd);
10802 lstrcatA(subsrc, "subsource");
10803 lstrcatA(subsrc, "\\");
10804
10805 lstrcpyA(sub2, subsrc);
10806 lstrcatA(sub2, "sub2");
10807 lstrcatA(sub2, "\\");
10808
10809 /* uncompressed source */
10810
10811 hdb = create_package_db();
10812 ok( hdb, "failed to create database\n");
10813
10814 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
10815
10816 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
10817 ok(r == S_OK, "failed\n");
10818
10819 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
10820 ok(r == S_OK, "failed\n");
10821
10822 r = add_directory_entry(hdb, "'SubDir2', 'SubDir', 'sub2'");
10823 ok(r == S_OK, "failed\n");
10824
10825 r = MsiDatabaseCommit(hdb);
10826 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
10827
10828 r = package_from_db(hdb, &hpkg);
10829 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
10830 {
10831 skip("Not enough rights to perform tests\n");
10832 DeleteFile(msifile);
10833 return;
10834 }
10835 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
10836
10837 MsiCloseHandle(hdb);
10838
10839 /* invalid database handle */
10840 size = MAX_PATH;
10841 lstrcpyA(path, "kiwi");
10842 r = MsiGetSourcePath(-1, "TARGETDIR", path, &size);
10843 ok(r == ERROR_INVALID_HANDLE,
10844 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
10845 ok(!lstrcmpA(path, "kiwi"),
10846 "Expected path to be unchanged, got \"%s\"\n", path);
10847 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10848
10849 /* NULL szFolder */
10850 size = MAX_PATH;
10851 lstrcpyA(path, "kiwi");
10852 r = MsiGetSourcePath(hpkg, NULL, path, &size);
10853 ok(r == ERROR_INVALID_PARAMETER,
10854 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
10855 ok(!lstrcmpA(path, "kiwi"),
10856 "Expected path to be unchanged, got \"%s\"\n", path);
10857 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10858
10859 /* empty szFolder */
10860 size = MAX_PATH;
10861 lstrcpyA(path, "kiwi");
10862 r = MsiGetSourcePath(hpkg, "", path, &size);
10863 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10864 ok(!lstrcmpA(path, "kiwi"),
10865 "Expected path to be unchanged, got \"%s\"\n", path);
10866 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10867
10868 /* try TARGETDIR */
10869 size = MAX_PATH;
10870 lstrcpyA(path, "kiwi");
10871 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10872 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10873 ok(!lstrcmpA(path, "kiwi"),
10874 "Expected path to be unchanged, got \"%s\"\n", path);
10875 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10876
10877 size = MAX_PATH;
10878 lstrcpyA(path, "kiwi");
10879 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10880 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10881 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10882 ok(size == 0, "Expected 0, got %d\n", size);
10883
10884 size = MAX_PATH;
10885 lstrcpyA(path, "kiwi");
10886 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10887 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10888 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10889 ok(size == 0, "Expected 0, got %d\n", size);
10890
10891 /* try SourceDir */
10892 size = MAX_PATH;
10893 lstrcpyA(path, "kiwi");
10894 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10895 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10896 ok(!lstrcmpA(path, "kiwi"),
10897 "Expected path to be unchanged, got \"%s\"\n", path);
10898 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10899
10900 /* try SOURCEDIR */
10901 size = MAX_PATH;
10902 lstrcpyA(path, "kiwi");
10903 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10904 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10905 ok(!lstrcmpA(path, "kiwi"),
10906 "Expected path to be unchanged, got \"%s\"\n", path);
10907 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10908
10909 /* source path does not exist, but the property exists */
10910 size = MAX_PATH;
10911 lstrcpyA(path, "kiwi");
10912 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10913 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10914 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10915 ok(size == 0, "Expected 0, got %d\n", size);
10916
10917 size = MAX_PATH;
10918 lstrcpyA(path, "kiwi");
10919 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10920 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10921 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10922 ok(size == 0, "Expected 0, got %d\n", size);
10923
10924 /* try SubDir */
10925 size = MAX_PATH;
10926 lstrcpyA(path, "kiwi");
10927 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10928 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10929 ok(!lstrcmpA(path, "kiwi"),
10930 "Expected path to be unchanged, got \"%s\"\n", path);
10931 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10932
10933 /* try SubDir2 */
10934 size = MAX_PATH;
10935 lstrcpyA(path, "kiwi");
10936 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10937 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10938 ok(!lstrcmpA(path, "kiwi"),
10939 "Expected path to be unchanged, got \"%s\"\n", path);
10940 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10941
10942 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
10943
10944 r = MsiDoAction(hpkg, "CostInitialize");
10945 ok(r == ERROR_SUCCESS, "cost init failed\n");
10946
10947 /* try TARGETDIR after CostInitialize */
10948 size = MAX_PATH;
10949 lstrcpyA(path, "kiwi");
10950 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10951 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10952 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10953 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10954
10955 /* try SourceDir after CostInitialize */
10956 size = MAX_PATH;
10957 lstrcpyA(path, "kiwi");
10958 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10959 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10960 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10961 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10962
10963 /* try SOURCEDIR after CostInitialize */
10964 size = MAX_PATH;
10965 lstrcpyA(path, "kiwi");
10966 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10967 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10968 ok(!lstrcmpA(path, "kiwi"),
10969 "Expected path to be unchanged, got \"%s\"\n", path);
10970 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10971
10972 /* source path does not exist, but the property exists */
10973 size = MAX_PATH;
10974 lstrcpyA(path, "kiwi");
10975 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10976 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10977 todo_wine
10978 {
10979 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10980 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10981 }
10982
10983 /* try SubDir after CostInitialize */
10984 size = MAX_PATH;
10985 lstrcpyA(path, "kiwi");
10986 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10987 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10988 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10989 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10990
10991 /* try SubDir2 after CostInitialize */
10992 size = MAX_PATH;
10993 lstrcpyA(path, "kiwi");
10994 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10995 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10996 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10997 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10998
10999 r = MsiDoAction(hpkg, "ResolveSource");
11000 ok(r == ERROR_SUCCESS, "file cost failed\n");
11001
11002 /* try TARGETDIR after ResolveSource */
11003 size = MAX_PATH;
11004 lstrcpyA(path, "kiwi");
11005 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
11006 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11007 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11008 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11009
11010 /* try SourceDir after ResolveSource */
11011 size = MAX_PATH;
11012 lstrcpyA(path, "kiwi");
11013 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11014 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11015 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11016 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11017
11018 /* try SOURCEDIR after ResolveSource */
11019 size = MAX_PATH;
11020 lstrcpyA(path, "kiwi");
11021 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11022 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11023 ok(!lstrcmpA(path, "kiwi"),
11024 "Expected path to be unchanged, got \"%s\"\n", path);
11025 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11026
11027 /* source path does not exist, but the property exists */
11028 size = MAX_PATH;
11029 lstrcpyA(path, "kiwi");
11030 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11031 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11032 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11033 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11034
11035 /* try SubDir after ResolveSource */
11036 size = MAX_PATH;
11037 lstrcpyA(path, "kiwi");
11038 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11039 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11040 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11041 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11042
11043 /* try SubDir2 after ResolveSource */
11044 size = MAX_PATH;
11045 lstrcpyA(path, "kiwi");
11046 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11047 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11048 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
11049 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
11050
11051 r = MsiDoAction(hpkg, "FileCost");
11052 ok(r == ERROR_SUCCESS, "file cost failed\n");
11053
11054 /* try TARGETDIR after FileCost */
11055 size = MAX_PATH;
11056 lstrcpyA(path, "kiwi");
11057 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
11058 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11059 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11060 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11061
11062 /* try SourceDir after FileCost */
11063 size = MAX_PATH;
11064 lstrcpyA(path, "kiwi");
11065 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11066 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11067 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11068 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11069
11070 /* try SOURCEDIR after FileCost */
11071 size = MAX_PATH;
11072 lstrcpyA(path, "kiwi");
11073 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11074 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11075 ok(!lstrcmpA(path, "kiwi"),
11076 "Expected path to be unchanged, got \"%s\"\n", path);
11077 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11078
11079 /* source path does not exist, but the property exists */
11080 size = MAX_PATH;
11081 lstrcpyA(path, "kiwi");
11082 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11083 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11084 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11085 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11086
11087 /* try SubDir after FileCost */
11088 size = MAX_PATH;
11089 lstrcpyA(path, "kiwi");
11090 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11091 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11092 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11093 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11094
11095 /* try SubDir2 after FileCost */
11096 size = MAX_PATH;
11097 lstrcpyA(path, "kiwi");
11098 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11099 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11100 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
11101 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
11102
11103 r = MsiDoAction(hpkg, "CostFinalize");
11104 ok(r == ERROR_SUCCESS, "file cost failed\n");
11105
11106 /* try TARGETDIR after CostFinalize */
11107 size = MAX_PATH;
11108 lstrcpyA(path, "kiwi");
11109 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
11110 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11111 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11112 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11113
11114 /* try SourceDir after CostFinalize */
11115 size = MAX_PATH;
11116 lstrcpyA(path, "kiwi");
11117 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11118 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11119 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11120 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11121
11122 /* try SOURCEDIR after CostFinalize */
11123 size = MAX_PATH;
11124 lstrcpyA(path, "kiwi");
11125 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11126 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11127 ok(!lstrcmpA(path, "kiwi"),
11128 "Expected path to be unchanged, got \"%s\"\n", path);
11129 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11130
11131 /* source path does not exist, but the property exists */
11132 size = MAX_PATH;
11133 lstrcpyA(path, "kiwi");
11134 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11135 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11136 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11137 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11138
11139 /* try SubDir after CostFinalize */
11140 size = MAX_PATH;
11141 lstrcpyA(path, "kiwi");
11142 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11143 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11144 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11145 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11146
11147 /* try SubDir2 after CostFinalize */
11148 size = MAX_PATH;
11149 lstrcpyA(path, "kiwi");
11150 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11151 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11152 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
11153 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
11154
11155 /* nonexistent directory */
11156 size = MAX_PATH;
11157 lstrcpyA(path, "kiwi");
11158 r = MsiGetSourcePath(hpkg, "IDontExist", path, &size);
11159 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11160 ok(!lstrcmpA(path, "kiwi"),
11161 "Expected path to be unchanged, got \"%s\"\n", path);
11162 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11163
11164 /* NULL szPathBuf */
11165 size = MAX_PATH;
11166 r = MsiGetSourcePath(hpkg, "SourceDir", NULL, &size);
11167 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11168 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11169
11170 /* NULL pcchPathBuf */
11171 lstrcpyA(path, "kiwi");
11172 r = MsiGetSourcePath(hpkg, "SourceDir", path, NULL);
11173 ok(r == ERROR_INVALID_PARAMETER,
11174 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11175 ok(!lstrcmpA(path, "kiwi"),
11176 "Expected path to be unchanged, got \"%s\"\n", path);
11177
11178 /* pcchPathBuf is 0 */
11179 size = 0;
11180 lstrcpyA(path, "kiwi");
11181 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11182 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
11183 ok(!lstrcmpA(path, "kiwi"),
11184 "Expected path to be unchanged, got \"%s\"\n", path);
11185 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11186
11187 /* pcchPathBuf does not have room for NULL terminator */
11188 size = lstrlenA(cwd);
11189 lstrcpyA(path, "kiwi");
11190 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11191 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
11192 ok(!strncmp(path, cwd, lstrlenA(cwd) - 1),
11193 "Expected path with no backslash, got \"%s\"\n", path);
11194 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11195
11196 /* pcchPathBuf has room for NULL terminator */
11197 size = lstrlenA(cwd) + 1;
11198 lstrcpyA(path, "kiwi");
11199 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11200 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11201 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11202 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11203
11204 /* remove property */
11205 r = MsiSetProperty(hpkg, "SourceDir", NULL);
11206 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11207
11208 /* try SourceDir again */
11209 size = MAX_PATH;
11210 lstrcpyA(path, "kiwi");
11211 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11212 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11213 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11214 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11215
11216 /* set property to a valid directory */
11217 r = MsiSetProperty(hpkg, "SOURCEDIR", cwd);
11218 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11219
11220 /* try SOURCEDIR again */
11221 size = MAX_PATH;
11222 lstrcpyA(path, "kiwi");
11223 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11224 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11225 ok(!lstrcmpA(path, "kiwi"),
11226 "Expected path to be unchanged, got \"%s\"\n", path);
11227 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11228
11229 MsiCloseHandle(hpkg);
11230
11231 /* compressed source */
11232
11233 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
11234 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11235
11236 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed);
11237
11238 r = package_from_db(hdb, &hpkg);
11239 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
11240
11241 /* try TARGETDIR */
11242 size = MAX_PATH;
11243 lstrcpyA(path, "kiwi");
11244 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
11245 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11246 ok(!lstrcmpA(path, "kiwi"),
11247 "Expected path to be unchanged, got \"%s\"\n", path);
11248 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11249
11250 /* try SourceDir */
11251 size = MAX_PATH;
11252 lstrcpyA(path, "kiwi");
11253 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11254 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11255 ok(!lstrcmpA(path, "kiwi"),
11256 "Expected path to be unchanged, got \"%s\"\n", path);
11257 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11258
11259 /* try SOURCEDIR */
11260 size = MAX_PATH;
11261 lstrcpyA(path, "kiwi");
11262 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11263 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11264 ok(!lstrcmpA(path, "kiwi"),
11265 "Expected path to be unchanged, got \"%s\"\n", path);
11266 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11267
11268 /* source path nor the property exist */
11269 size = MAX_PATH;
11270 lstrcpyA(path, "kiwi");
11271 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11272 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11273 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11274 ok(size == 0, "Expected 0, got %d\n", size);
11275
11276 /* try SubDir */
11277 size = MAX_PATH;
11278 lstrcpyA(path, "kiwi");
11279 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11280 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11281 ok(!lstrcmpA(path, "kiwi"),
11282 "Expected path to be unchanged, got \"%s\"\n", path);
11283 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11284
11285 /* try SubDir2 */
11286 size = MAX_PATH;
11287 lstrcpyA(path, "kiwi");
11288 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11289 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11290 ok(!lstrcmpA(path, "kiwi"),
11291 "Expected path to be unchanged, got \"%s\"\n", path);
11292 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11293
11294 r = MsiDoAction(hpkg, "CostInitialize");
11295 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11296
11297 /* try TARGETDIR after CostInitialize */
11298 size = MAX_PATH;
11299 lstrcpyA(path, "kiwi");
11300 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
11301 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11302 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11303 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11304
11305 /* try SourceDir after CostInitialize */
11306 size = MAX_PATH;
11307 lstrcpyA(path, "kiwi");
11308 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11309 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11310 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11311 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11312
11313 /* try SOURCEDIR after CostInitialize */
11314 size = MAX_PATH;
11315 lstrcpyA(path, "kiwi");
11316 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11317 todo_wine
11318 {
11319 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11320 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11321 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11322 }
11323
11324 /* source path does not exist, but the property exists */
11325 size = MAX_PATH;
11326 lstrcpyA(path, "kiwi");
11327 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11328 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11329 todo_wine
11330 {
11331 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11332 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11333 }
11334
11335 /* try SubDir after CostInitialize */
11336 size = MAX_PATH;
11337 lstrcpyA(path, "kiwi");
11338 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11339 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11340 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11341 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11342
11343 /* try SubDir2 after CostInitialize */
11344 size = MAX_PATH;
11345 lstrcpyA(path, "kiwi");
11346 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11347 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11348 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11349 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11350
11351 r = MsiDoAction(hpkg, "ResolveSource");
11352 ok(r == ERROR_SUCCESS, "file cost failed\n");
11353
11354 /* try TARGETDIR after ResolveSource */
11355 size = MAX_PATH;
11356 lstrcpyA(path, "kiwi");
11357 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
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 /* try SourceDir after ResolveSource */
11363 size = MAX_PATH;
11364 lstrcpyA(path, "kiwi");
11365 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11366 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11367 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11368 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11369
11370 /* try SOURCEDIR after ResolveSource */
11371 size = MAX_PATH;
11372 lstrcpyA(path, "kiwi");
11373 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11374 todo_wine
11375 {
11376 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11377 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11378 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11379 }
11380
11381 /* source path and the property exist */
11382 size = MAX_PATH;
11383 lstrcpyA(path, "kiwi");
11384 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11385 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11386 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11387 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11388
11389 /* try SubDir after ResolveSource */
11390 size = MAX_PATH;
11391 lstrcpyA(path, "kiwi");
11392 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11393 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11394 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11395 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11396
11397 /* try SubDir2 after ResolveSource */
11398 size = MAX_PATH;
11399 lstrcpyA(path, "kiwi");
11400 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11401 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11402 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11403 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11404
11405 r = MsiDoAction(hpkg, "FileCost");
11406 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11407
11408 /* try TARGETDIR after CostFinalize */
11409 size = MAX_PATH;
11410 lstrcpyA(path, "kiwi");
11411 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
11412 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11413 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11414 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11415
11416 /* try SourceDir after CostFinalize */
11417 size = MAX_PATH;
11418 lstrcpyA(path, "kiwi");
11419 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11420 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11421 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11422 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11423
11424 /* try SOURCEDIR after CostFinalize */
11425 size = MAX_PATH;
11426 lstrcpyA(path, "kiwi");
11427 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11428 todo_wine
11429 {
11430 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11431 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11432 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11433 }
11434
11435 /* source path and the property exist */
11436 size = MAX_PATH;
11437 lstrcpyA(path, "kiwi");
11438 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11439 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11440 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11441 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11442
11443 /* try SubDir after CostFinalize */
11444 size = MAX_PATH;
11445 lstrcpyA(path, "kiwi");
11446 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11447 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11448 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11449 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11450
11451 /* try SubDir2 after CostFinalize */
11452 size = MAX_PATH;
11453 lstrcpyA(path, "kiwi");
11454 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11455 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11456 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11457 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11458
11459 r = MsiDoAction(hpkg, "CostFinalize");
11460 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11461
11462 /* try TARGETDIR after CostFinalize */
11463 size = MAX_PATH;
11464 lstrcpyA(path, "kiwi");
11465 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
11466 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11467 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11468 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11469
11470 /* try SourceDir after CostFinalize */
11471 size = MAX_PATH;
11472 lstrcpyA(path, "kiwi");
11473 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11474 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11475 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11476 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11477
11478 /* try SOURCEDIR after CostFinalize */
11479 size = MAX_PATH;
11480 lstrcpyA(path, "kiwi");
11481 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11482 todo_wine
11483 {
11484 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11485 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11486 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11487 }
11488
11489 /* source path and the property exist */
11490 size = MAX_PATH;
11491 lstrcpyA(path, "kiwi");
11492 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11493 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11494 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11495 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11496
11497 /* try SubDir after CostFinalize */
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, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11503 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11504
11505 /* try SubDir2 after CostFinalize */
11506 size = MAX_PATH;
11507 lstrcpyA(path, "kiwi");
11508 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11509 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11510 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11511 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11512
11513 MsiCloseHandle(hpkg);
11514 DeleteFile(msifile);
11515 }
11516
11517 static void test_shortlongsource(void)
11518 {
11519 MSIHANDLE hdb, hpkg;
11520 CHAR path[MAX_PATH];
11521 CHAR cwd[MAX_PATH];
11522 CHAR subsrc[MAX_PATH];
11523 DWORD size;
11524 UINT r;
11525
11526 lstrcpyA(cwd, CURR_DIR);
11527 lstrcatA(cwd, "\\");
11528
11529 lstrcpyA(subsrc, cwd);
11530 lstrcatA(subsrc, "long");
11531 lstrcatA(subsrc, "\\");
11532
11533 /* long file names */
11534
11535 hdb = create_package_db();
11536 ok( hdb, "failed to create database\n");
11537
11538 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
11539
11540 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
11541 ok(r == S_OK, "failed\n");
11542
11543 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'short|long'");
11544 ok(r == S_OK, "failed\n");
11545
11546 /* CostInitialize:short */
11547 r = add_directory_entry(hdb, "'SubDir2', 'TARGETDIR', 'one|two'");
11548 ok(r == S_OK, "failed\n");
11549
11550 /* CostInitialize:long */
11551 r = add_directory_entry(hdb, "'SubDir3', 'TARGETDIR', 'three|four'");
11552 ok(r == S_OK, "failed\n");
11553
11554 /* FileCost:short */
11555 r = add_directory_entry(hdb, "'SubDir4', 'TARGETDIR', 'five|six'");
11556 ok(r == S_OK, "failed\n");
11557
11558 /* FileCost:long */
11559 r = add_directory_entry(hdb, "'SubDir5', 'TARGETDIR', 'seven|eight'");
11560 ok(r == S_OK, "failed\n");
11561
11562 /* CostFinalize:short */
11563 r = add_directory_entry(hdb, "'SubDir6', 'TARGETDIR', 'nine|ten'");
11564 ok(r == S_OK, "failed\n");
11565
11566 /* CostFinalize:long */
11567 r = add_directory_entry(hdb, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
11568 ok(r == S_OK, "failed\n");
11569
11570 MsiDatabaseCommit(hdb);
11571
11572 r = package_from_db(hdb, &hpkg);
11573 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
11574 {
11575 skip("Not enough rights to perform tests\n");
11576 DeleteFile(msifile);
11577 return;
11578 }
11579 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
11580
11581 MsiCloseHandle(hdb);
11582
11583 CreateDirectoryA("one", NULL);
11584 CreateDirectoryA("four", NULL);
11585
11586 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
11587
11588 r = MsiDoAction(hpkg, "CostInitialize");
11589 ok(r == ERROR_SUCCESS, "file cost failed\n");
11590
11591 CreateDirectory("five", NULL);
11592 CreateDirectory("eight", NULL);
11593
11594 r = MsiDoAction(hpkg, "FileCost");
11595 ok(r == ERROR_SUCCESS, "file cost failed\n");
11596
11597 CreateDirectory("nine", NULL);
11598 CreateDirectory("twelve", NULL);
11599
11600 r = MsiDoAction(hpkg, "CostFinalize");
11601 ok(r == ERROR_SUCCESS, "file cost failed\n");
11602
11603 /* neither short nor long source directories exist */
11604 size = MAX_PATH;
11605 lstrcpyA(path, "kiwi");
11606 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11607 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11608 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11609 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11610
11611 CreateDirectoryA("short", NULL);
11612
11613 /* short source directory exists */
11614 size = MAX_PATH;
11615 lstrcpyA(path, "kiwi");
11616 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11617 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11618 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11619 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11620
11621 CreateDirectoryA("long", NULL);
11622
11623 /* both short and long source directories exist */
11624 size = MAX_PATH;
11625 lstrcpyA(path, "kiwi");
11626 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11627 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11628 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11629 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11630
11631 lstrcpyA(subsrc, cwd);
11632 lstrcatA(subsrc, "two");
11633 lstrcatA(subsrc, "\\");
11634
11635 /* short dir exists before CostInitialize */
11636 size = MAX_PATH;
11637 lstrcpyA(path, "kiwi");
11638 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11639 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11640 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11641 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11642
11643 lstrcpyA(subsrc, cwd);
11644 lstrcatA(subsrc, "four");
11645 lstrcatA(subsrc, "\\");
11646
11647 /* long dir exists before CostInitialize */
11648 size = MAX_PATH;
11649 lstrcpyA(path, "kiwi");
11650 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
11651 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11652 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11653 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11654
11655 lstrcpyA(subsrc, cwd);
11656 lstrcatA(subsrc, "six");
11657 lstrcatA(subsrc, "\\");
11658
11659 /* short dir exists before FileCost */
11660 size = MAX_PATH;
11661 lstrcpyA(path, "kiwi");
11662 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
11663 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11664 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11665 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11666
11667 lstrcpyA(subsrc, cwd);
11668 lstrcatA(subsrc, "eight");
11669 lstrcatA(subsrc, "\\");
11670
11671 /* long dir exists before FileCost */
11672 size = MAX_PATH;
11673 lstrcpyA(path, "kiwi");
11674 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
11675 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11676 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11677 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11678
11679 lstrcpyA(subsrc, cwd);
11680 lstrcatA(subsrc, "ten");
11681 lstrcatA(subsrc, "\\");
11682
11683 /* short dir exists before CostFinalize */
11684 size = MAX_PATH;
11685 lstrcpyA(path, "kiwi");
11686 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
11687 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11688 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11689 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11690
11691 lstrcpyA(subsrc, cwd);
11692 lstrcatA(subsrc, "twelve");
11693 lstrcatA(subsrc, "\\");
11694
11695 /* long dir exists before CostFinalize */
11696 size = MAX_PATH;
11697 lstrcpyA(path, "kiwi");
11698 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
11699 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11700 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11701 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11702
11703 MsiCloseHandle(hpkg);
11704 RemoveDirectoryA("short");
11705 RemoveDirectoryA("long");
11706 RemoveDirectoryA("one");
11707 RemoveDirectoryA("four");
11708 RemoveDirectoryA("five");
11709 RemoveDirectoryA("eight");
11710 RemoveDirectoryA("nine");
11711 RemoveDirectoryA("twelve");
11712
11713 /* short file names */
11714
11715 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
11716 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11717
11718 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
11719
11720 r = package_from_db(hdb, &hpkg);
11721 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
11722
11723 MsiCloseHandle(hdb);
11724
11725 CreateDirectoryA("one", NULL);
11726 CreateDirectoryA("four", NULL);
11727
11728 r = MsiDoAction(hpkg, "CostInitialize");
11729 ok(r == ERROR_SUCCESS, "file cost failed\n");
11730
11731 CreateDirectory("five", NULL);
11732 CreateDirectory("eight", NULL);
11733
11734 r = MsiDoAction(hpkg, "FileCost");
11735 ok(r == ERROR_SUCCESS, "file cost failed\n");
11736
11737 CreateDirectory("nine", NULL);
11738 CreateDirectory("twelve", NULL);
11739
11740 r = MsiDoAction(hpkg, "CostFinalize");
11741 ok(r == ERROR_SUCCESS, "file cost failed\n");
11742
11743 lstrcpyA(subsrc, cwd);
11744 lstrcatA(subsrc, "short");
11745 lstrcatA(subsrc, "\\");
11746
11747 /* neither short nor long source directories exist */
11748 size = MAX_PATH;
11749 lstrcpyA(path, "kiwi");
11750 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11751 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11752 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11753 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11754
11755 CreateDirectoryA("short", NULL);
11756
11757 /* short source directory exists */
11758 size = MAX_PATH;
11759 lstrcpyA(path, "kiwi");
11760 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11761 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11762 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11763 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11764
11765 CreateDirectoryA("long", NULL);
11766
11767 /* both short and long source directories exist */
11768 size = MAX_PATH;
11769 lstrcpyA(path, "kiwi");
11770 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11771 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11772 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11773 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11774
11775 lstrcpyA(subsrc, cwd);
11776 lstrcatA(subsrc, "one");
11777 lstrcatA(subsrc, "\\");
11778
11779 /* short dir exists before CostInitialize */
11780 size = MAX_PATH;
11781 lstrcpyA(path, "kiwi");
11782 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11783 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11784 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11785 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11786
11787 lstrcpyA(subsrc, cwd);
11788 lstrcatA(subsrc, "three");
11789 lstrcatA(subsrc, "\\");
11790
11791 /* long dir exists before CostInitialize */
11792 size = MAX_PATH;
11793 lstrcpyA(path, "kiwi");
11794 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
11795 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11796 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11797 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11798
11799 lstrcpyA(subsrc, cwd);
11800 lstrcatA(subsrc, "five");
11801 lstrcatA(subsrc, "\\");
11802
11803 /* short dir exists before FileCost */
11804 size = MAX_PATH;
11805 lstrcpyA(path, "kiwi");
11806 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
11807 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11808 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11809 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11810
11811 lstrcpyA(subsrc, cwd);
11812 lstrcatA(subsrc, "seven");
11813 lstrcatA(subsrc, "\\");
11814
11815 /* long dir exists before FileCost */
11816 size = MAX_PATH;
11817 lstrcpyA(path, "kiwi");
11818 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
11819 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11820 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11821 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11822
11823 lstrcpyA(subsrc, cwd);
11824 lstrcatA(subsrc, "nine");
11825 lstrcatA(subsrc, "\\");
11826
11827 /* short dir exists before CostFinalize */
11828 size = MAX_PATH;
11829 lstrcpyA(path, "kiwi");
11830 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
11831 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11832 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11833 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11834
11835 lstrcpyA(subsrc, cwd);
11836 lstrcatA(subsrc, "eleven");
11837 lstrcatA(subsrc, "\\");
11838
11839 /* long dir exists before CostFinalize */
11840 size = MAX_PATH;
11841 lstrcpyA(path, "kiwi");
11842 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
11843 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11844 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11845 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11846
11847 MsiCloseHandle(hpkg);
11848 RemoveDirectoryA("short");
11849 RemoveDirectoryA("long");
11850 RemoveDirectoryA("one");
11851 RemoveDirectoryA("four");
11852 RemoveDirectoryA("five");
11853 RemoveDirectoryA("eight");
11854 RemoveDirectoryA("nine");
11855 RemoveDirectoryA("twelve");
11856 DeleteFileA(msifile);
11857 }
11858
11859 static void test_sourcedir(void)
11860 {
11861 MSIHANDLE hdb, hpkg;
11862 CHAR package[12];
11863 CHAR path[MAX_PATH];
11864 CHAR cwd[MAX_PATH];
11865 CHAR subsrc[MAX_PATH];
11866 DWORD size;
11867 UINT r;
11868
11869 lstrcpyA(cwd, CURR_DIR);
11870 lstrcatA(cwd, "\\");
11871
11872 lstrcpyA(subsrc, cwd);
11873 lstrcatA(subsrc, "long");
11874 lstrcatA(subsrc, "\\");
11875
11876 hdb = create_package_db();
11877 ok( hdb, "failed to create database\n");
11878
11879 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
11880 ok(r == S_OK, "failed\n");
11881
11882 sprintf(package, "#%u", hdb);
11883 r = MsiOpenPackage(package, &hpkg);
11884 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
11885 {
11886 skip("Not enough rights to perform tests\n");
11887 goto error;
11888 }
11889 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11890
11891 /* properties only */
11892
11893 /* SourceDir prop */
11894 size = MAX_PATH;
11895 lstrcpyA(path, "kiwi");
11896 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11897 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11898 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11899 ok(size == 0, "Expected 0, got %d\n", size);
11900
11901 /* SOURCEDIR prop */
11902 size = MAX_PATH;
11903 lstrcpyA(path, "kiwi");
11904 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11905 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11906 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11907 ok(size == 0, "Expected 0, got %d\n", size);
11908
11909 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
11910
11911 r = MsiDoAction(hpkg, "CostInitialize");
11912 ok(r == ERROR_SUCCESS, "file cost failed\n");
11913
11914 /* SourceDir after CostInitialize */
11915 size = MAX_PATH;
11916 lstrcpyA(path, "kiwi");
11917 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11918 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11919 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11920 ok(size == 0, "Expected 0, got %d\n", size);
11921
11922 /* SOURCEDIR after CostInitialize */
11923 size = MAX_PATH;
11924 lstrcpyA(path, "kiwi");
11925 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11926 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11927 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11928 ok(size == 0, "Expected 0, got %d\n", size);
11929
11930 r = MsiDoAction(hpkg, "FileCost");
11931 ok(r == ERROR_SUCCESS, "file cost failed\n");
11932
11933 /* SourceDir after FileCost */
11934 size = MAX_PATH;
11935 lstrcpyA(path, "kiwi");
11936 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11937 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11938 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11939 ok(size == 0, "Expected 0, got %d\n", size);
11940
11941 /* SOURCEDIR after FileCost */
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 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11947 ok(size == 0, "Expected 0, got %d\n", size);
11948
11949 r = MsiDoAction(hpkg, "CostFinalize");
11950 ok(r == ERROR_SUCCESS, "file cost failed\n");
11951
11952 /* SourceDir after CostFinalize */
11953 size = MAX_PATH;
11954 lstrcpyA(path, "kiwi");
11955 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11956 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11957 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11958 ok(size == 0, "Expected 0, got %d\n", size);
11959
11960 /* SOURCEDIR after CostFinalize */
11961 size = MAX_PATH;
11962 lstrcpyA(path, "kiwi");
11963 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11964 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11965 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11966 ok(size == 0, "Expected 0, got %d\n", size);
11967
11968 size = MAX_PATH;
11969 lstrcpyA(path, "kiwi");
11970 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11971 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11972 ok(!lstrcmpA(path, "kiwi"), "Expected \"kiwi\", got \"%s\"\n", path);
11973 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
11974
11975 /* SOURCEDIR after calling MsiGetSourcePath */
11976 size = MAX_PATH;
11977 lstrcpyA(path, "kiwi");
11978 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11979 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11980 todo_wine {
11981 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11982 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11983 }
11984
11985 r = MsiDoAction(hpkg, "ResolveSource");
11986 ok(r == ERROR_SUCCESS, "file cost failed\n");
11987
11988 /* SourceDir after ResolveSource */
11989 size = MAX_PATH;
11990 lstrcpyA(path, "kiwi");
11991 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11992 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11993 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11994 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11995
11996 /* SOURCEDIR after ResolveSource */
11997 size = MAX_PATH;
11998 lstrcpyA(path, "kiwi");
11999 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
12000 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12001 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
12002 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
12003
12004 /* random casing */
12005 size = MAX_PATH;
12006 lstrcpyA(path, "kiwi");
12007 r = MsiGetProperty(hpkg, "SoUrCeDiR", path, &size);
12008 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12009 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
12010 ok(size == 0, "Expected 0, got %d\n", size);
12011
12012 MsiCloseHandle(hpkg);
12013
12014 /* reset the package state */
12015 sprintf(package, "#%i", hdb);
12016 r = MsiOpenPackage(package, &hpkg);
12017 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12018
12019 /* test how MsiGetSourcePath affects the properties */
12020
12021 /* SourceDir prop */
12022 size = MAX_PATH;
12023 lstrcpyA(path, "kiwi");
12024 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
12025 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12026 todo_wine
12027 {
12028 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
12029 ok(size == 0, "Expected 0, got %d\n", size);
12030 }
12031
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 /* SourceDir after MsiGetSourcePath */
12041 size = MAX_PATH;
12042 lstrcpyA(path, "kiwi");
12043 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
12044 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12045 todo_wine
12046 {
12047 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
12048 ok(size == 0, "Expected 0, got %d\n", size);
12049 }
12050
12051 /* SOURCEDIR prop */
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 todo_wine
12057 {
12058 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
12059 ok(size == 0, "Expected 0, got %d\n", size);
12060 }
12061
12062 size = MAX_PATH;
12063 lstrcpyA(path, "kiwi");
12064 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
12065 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
12066 ok(!lstrcmpA(path, "kiwi"),
12067 "Expected path to be unchanged, got \"%s\"\n", path);
12068 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
12069
12070 /* SOURCEDIR prop after MsiGetSourcePath */
12071 size = MAX_PATH;
12072 lstrcpyA(path, "kiwi");
12073 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
12074 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12075 todo_wine
12076 {
12077 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
12078 ok(size == 0, "Expected 0, got %d\n", size);
12079 }
12080
12081 r = MsiDoAction(hpkg, "CostInitialize");
12082 ok(r == ERROR_SUCCESS, "file cost failed\n");
12083
12084 /* SourceDir after CostInitialize */
12085 size = MAX_PATH;
12086 lstrcpyA(path, "kiwi");
12087 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
12088 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12089 todo_wine
12090 {
12091 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
12092 ok(size == 0, "Expected 0, got %d\n", size);
12093 }
12094
12095 size = MAX_PATH;
12096 lstrcpyA(path, "kiwi");
12097 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
12098 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12099 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
12100 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
12101
12102 /* SourceDir after MsiGetSourcePath */
12103 size = MAX_PATH;
12104 lstrcpyA(path, "kiwi");
12105 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
12106 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12107 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
12108 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
12109
12110 /* SOURCEDIR after CostInitialize */
12111 size = MAX_PATH;
12112 lstrcpyA(path, "kiwi");
12113 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
12114 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12115 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
12116 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
12117
12118 /* SOURCEDIR source path still does not exist */
12119 size = MAX_PATH;
12120 lstrcpyA(path, "kiwi");
12121 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
12122 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
12123 ok(!lstrcmpA(path, "kiwi"),
12124 "Expected path to be unchanged, got \"%s\"\n", path);
12125 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
12126
12127 r = MsiDoAction(hpkg, "FileCost");
12128 ok(r == ERROR_SUCCESS, "file cost failed\n");
12129
12130 /* SourceDir after FileCost */
12131 size = MAX_PATH;
12132 lstrcpyA(path, "kiwi");
12133 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
12134 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12135 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
12136 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
12137
12138 /* SOURCEDIR after FileCost */
12139 size = MAX_PATH;
12140 lstrcpyA(path, "kiwi");
12141 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
12142 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12143 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
12144 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
12145
12146 /* SOURCEDIR source path still does not exist */
12147 size = MAX_PATH;
12148 lstrcpyA(path, "kiwi");
12149 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
12150 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
12151 ok(!lstrcmpA(path, "kiwi"),
12152 "Expected path to be unchanged, got \"%s\"\n", path);
12153 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
12154
12155 r = MsiDoAction(hpkg, "CostFinalize");
12156 ok(r == ERROR_SUCCESS, "file cost failed\n");
12157
12158 /* SourceDir after CostFinalize */
12159 size = MAX_PATH;
12160 lstrcpyA(path, "kiwi");
12161 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
12162 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12163 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
12164 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
12165
12166 /* SOURCEDIR after CostFinalize */
12167 size = MAX_PATH;
12168 lstrcpyA(path, "kiwi");
12169 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
12170 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12171 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
12172 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
12173
12174 /* SOURCEDIR source path still does not exist */
12175 size = MAX_PATH;
12176 lstrcpyA(path, "kiwi");
12177 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
12178 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
12179 ok(!lstrcmpA(path, "kiwi"),
12180 "Expected path to be unchanged, got \"%s\"\n", path);
12181 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
12182
12183 r = MsiDoAction(hpkg, "ResolveSource");
12184 ok(r == ERROR_SUCCESS, "file cost failed\n");
12185
12186 /* SourceDir after ResolveSource */
12187 size = MAX_PATH;
12188 lstrcpyA(path, "kiwi");
12189 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
12190 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12191 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
12192 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
12193
12194 /* SOURCEDIR after ResolveSource */
12195 size = MAX_PATH;
12196 lstrcpyA(path, "kiwi");
12197 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
12198 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12199 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
12200 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
12201
12202 /* SOURCEDIR source path still does not exist */
12203 size = MAX_PATH;
12204 lstrcpyA(path, "kiwi");
12205 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
12206 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
12207 ok(!lstrcmpA(path, "kiwi"),
12208 "Expected path to be unchanged, got \"%s\"\n", path);
12209 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
12210
12211 MsiCloseHandle(hpkg);
12212
12213 error:
12214 MsiCloseHandle(hdb);
12215 DeleteFileA(msifile);
12216 }
12217
12218 struct access_res
12219 {
12220 BOOL gothandle;
12221 DWORD lasterr;
12222 BOOL ignore;
12223 };
12224
12225 static const struct access_res create[16] =
12226 {
12227 { TRUE, ERROR_SUCCESS, TRUE },
12228 { TRUE, ERROR_SUCCESS, TRUE },
12229 { TRUE, ERROR_SUCCESS, FALSE },
12230 { TRUE, ERROR_SUCCESS, FALSE },
12231 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12232 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12233 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12234 { TRUE, ERROR_SUCCESS, FALSE },
12235 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12236 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12237 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12238 { TRUE, ERROR_SUCCESS, TRUE },
12239 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12240 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12241 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12242 { TRUE, ERROR_SUCCESS, TRUE }
12243 };
12244
12245 static const struct access_res create_commit[16] =
12246 {
12247 { TRUE, ERROR_SUCCESS, TRUE },
12248 { TRUE, ERROR_SUCCESS, TRUE },
12249 { TRUE, ERROR_SUCCESS, FALSE },
12250 { TRUE, ERROR_SUCCESS, FALSE },
12251 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12252 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12253 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12254 { TRUE, ERROR_SUCCESS, FALSE },
12255 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12256 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12257 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12258 { TRUE, ERROR_SUCCESS, TRUE },
12259 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12260 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12261 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
12262 { TRUE, ERROR_SUCCESS, TRUE }
12263 };
12264
12265 static const struct access_res create_close[16] =
12266 {
12267 { TRUE, ERROR_SUCCESS, FALSE },
12268 { TRUE, ERROR_SUCCESS, FALSE },
12269 { TRUE, ERROR_SUCCESS, FALSE },
12270 { TRUE, ERROR_SUCCESS, FALSE },
12271 { TRUE, ERROR_SUCCESS, FALSE },
12272 { TRUE, ERROR_SUCCESS, FALSE },
12273 { TRUE, ERROR_SUCCESS, FALSE },
12274 { TRUE, ERROR_SUCCESS, FALSE },
12275 { TRUE, ERROR_SUCCESS, FALSE },
12276 { TRUE, ERROR_SUCCESS, FALSE },
12277 { TRUE, ERROR_SUCCESS, FALSE },
12278 { TRUE, ERROR_SUCCESS, FALSE },
12279 { TRUE, ERROR_SUCCESS, FALSE },
12280 { TRUE, ERROR_SUCCESS, FALSE },
12281 { TRUE, ERROR_SUCCESS, FALSE },
12282 { TRUE, ERROR_SUCCESS }
12283 };
12284
12285 static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line)
12286 {
12287 DWORD access = 0, share = 0;
12288 DWORD lasterr;
12289 HANDLE hfile;
12290 int i, j, idx = 0;
12291
12292 for (i = 0; i < 4; i++)
12293 {
12294 if (i == 0) access = 0;
12295 if (i == 1) access = GENERIC_READ;
12296 if (i == 2) access = GENERIC_WRITE;
12297 if (i == 3) access = GENERIC_READ | GENERIC_WRITE;
12298
12299 for (j = 0; j < 4; j++)
12300 {
12301 if (ares[idx].ignore)
12302 continue;
12303
12304 if (j == 0) share = 0;
12305 if (j == 1) share = FILE_SHARE_READ;
12306 if (j == 2) share = FILE_SHARE_WRITE;
12307 if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE;
12308
12309 SetLastError(0xdeadbeef);
12310 hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
12311 FILE_ATTRIBUTE_NORMAL, 0);
12312 lasterr = GetLastError();
12313
12314 ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
12315 "(%d, handle, %d): Expected %d, got %d\n",
12316 line, idx, ares[idx].gothandle,
12317 (hfile != INVALID_HANDLE_VALUE));
12318
12319 ok(lasterr == ares[idx].lasterr, "(%d, lasterr, %d): Expected %d, got %d\n",
12320 line, idx, ares[idx].lasterr, lasterr);
12321
12322 CloseHandle(hfile);
12323 idx++;
12324 }
12325 }
12326 }
12327
12328 #define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
12329
12330 static void test_access(void)
12331 {
12332 MSIHANDLE hdb;
12333 UINT r;
12334
12335 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
12336 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12337
12338 test_file_access(msifile, create);
12339
12340 r = MsiDatabaseCommit(hdb);
12341 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12342
12343 test_file_access(msifile, create_commit);
12344 MsiCloseHandle(hdb);
12345
12346 test_file_access(msifile, create_close);
12347 DeleteFileA(msifile);
12348
12349 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATEDIRECT, &hdb);
12350 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12351
12352 test_file_access(msifile, create);
12353
12354 r = MsiDatabaseCommit(hdb);
12355 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12356
12357 test_file_access(msifile, create_commit);
12358 MsiCloseHandle(hdb);
12359
12360 test_file_access(msifile, create_close);
12361 DeleteFileA(msifile);
12362 }
12363
12364 static void test_emptypackage(void)
12365 {
12366 MSIHANDLE hpkg = 0, hdb = 0, hsuminfo = 0;
12367 MSIHANDLE hview = 0, hrec = 0;
12368 MSICONDITION condition;
12369 CHAR buffer[MAX_PATH];
12370 DWORD size;
12371 UINT r;
12372
12373 r = MsiOpenPackageA("", &hpkg);
12374 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
12375 {
12376 skip("Not enough rights to perform tests\n");
12377 return;
12378 }
12379 todo_wine
12380 {
12381 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12382 }
12383
12384 hdb = MsiGetActiveDatabase(hpkg);
12385 todo_wine
12386 {
12387 ok(hdb != 0, "Expected a valid database handle\n");
12388 }
12389
12390 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Tables`", &hview);
12391 todo_wine
12392 {
12393 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12394 }
12395 r = MsiViewExecute(hview, 0);
12396 todo_wine
12397 {
12398 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12399 }
12400
12401 r = MsiViewFetch(hview, &hrec);
12402 todo_wine
12403 {
12404 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12405 }
12406
12407 buffer[0] = 0;
12408 size = MAX_PATH;
12409 r = MsiRecordGetString(hrec, 1, buffer, &size);
12410 todo_wine
12411 {
12412 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12413 ok(!lstrcmpA(buffer, "_Property"),
12414 "Expected \"_Property\", got \"%s\"\n", buffer);
12415 }
12416
12417 MsiCloseHandle(hrec);
12418
12419 r = MsiViewFetch(hview, &hrec);
12420 todo_wine
12421 {
12422 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12423 }
12424
12425 size = MAX_PATH;
12426 r = MsiRecordGetString(hrec, 1, buffer, &size);
12427 todo_wine
12428 {
12429 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12430 ok(!lstrcmpA(buffer, "#_FolderCache"),
12431 "Expected \"_Property\", got \"%s\"\n", buffer);
12432 }
12433
12434 MsiCloseHandle(hrec);
12435 MsiViewClose(hview);
12436 MsiCloseHandle(hview);
12437
12438 condition = MsiDatabaseIsTablePersistentA(hdb, "_Property");
12439 todo_wine
12440 {
12441 ok(condition == MSICONDITION_FALSE,
12442 "Expected MSICONDITION_FALSE, got %d\n", condition);
12443 }
12444
12445 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
12446 todo_wine
12447 {
12448 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12449 }
12450 r = MsiViewExecute(hview, 0);
12451 todo_wine
12452 {
12453 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12454 }
12455
12456 /* _Property table is not empty */
12457 r = MsiViewFetch(hview, &hrec);
12458 todo_wine
12459 {
12460 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12461 }
12462
12463 MsiCloseHandle(hrec);
12464 MsiViewClose(hview);
12465 MsiCloseHandle(hview);
12466
12467 condition = MsiDatabaseIsTablePersistentA(hdb, "#_FolderCache");
12468 todo_wine
12469 {
12470 ok(condition == MSICONDITION_FALSE,
12471 "Expected MSICONDITION_FALSE, got %d\n", condition);
12472 }
12473
12474 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `#_FolderCache`", &hview);
12475 todo_wine
12476 {
12477 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12478 }
12479 r = MsiViewExecute(hview, 0);
12480 todo_wine
12481 {
12482 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12483 }
12484
12485 /* #_FolderCache is not empty */
12486 r = MsiViewFetch(hview, &hrec);
12487 todo_wine
12488 {
12489 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12490 }
12491
12492 MsiCloseHandle(hrec);
12493 MsiViewClose(hview);
12494 MsiCloseHandle(hview);
12495
12496 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Streams`", &hview);
12497 todo_wine
12498 {
12499 ok(r == ERROR_BAD_QUERY_SYNTAX,
12500 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
12501 }
12502
12503 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Storages`", &hview);
12504 todo_wine
12505 {
12506 ok(r == ERROR_BAD_QUERY_SYNTAX,
12507 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
12508 }
12509
12510 r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsuminfo);
12511 todo_wine
12512 {
12513 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
12514 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
12515 }
12516
12517 MsiCloseHandle(hsuminfo);
12518
12519 r = MsiDatabaseCommit(hdb);
12520 todo_wine
12521 {
12522 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12523 }
12524
12525 MsiCloseHandle(hdb);
12526 MsiCloseHandle(hpkg);
12527 }
12528
12529 static void test_MsiGetProductProperty(void)
12530 {
12531 MSIHANDLE hprod, hdb;
12532 CHAR val[MAX_PATH];
12533 CHAR path[MAX_PATH];
12534 CHAR query[MAX_PATH];
12535 CHAR keypath[MAX_PATH*2];
12536 CHAR prodcode[MAX_PATH];
12537 CHAR prod_squashed[MAX_PATH];
12538 HKEY prodkey, userkey, props;
12539 DWORD size;
12540 LONG res;
12541 UINT r;
12542 REGSAM access = KEY_ALL_ACCESS;
12543
12544 GetCurrentDirectoryA(MAX_PATH, path);
12545 lstrcatA(path, "\\");
12546
12547 create_test_guid(prodcode, prod_squashed);
12548
12549 if (is_wow64)
12550 access |= KEY_WOW64_64KEY;
12551
12552 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
12553 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12554
12555 r = MsiDatabaseCommit(hdb);
12556 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12557
12558 r = set_summary_info(hdb);
12559 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12560
12561 r = run_query(hdb,
12562 "CREATE TABLE `Directory` ( "
12563 "`Directory` CHAR(255) NOT NULL, "
12564 "`Directory_Parent` CHAR(255), "
12565 "`DefaultDir` CHAR(255) NOT NULL "
12566 "PRIMARY KEY `Directory`)");
12567 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12568
12569 r = run_query(hdb,
12570 "CREATE TABLE `Property` ( "
12571 "`Property` CHAR(72) NOT NULL, "
12572 "`Value` CHAR(255) "
12573 "PRIMARY KEY `Property`)");
12574 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12575
12576 sprintf(query, "INSERT INTO `Property` "
12577 "(`Property`, `Value`) "
12578 "VALUES( 'ProductCode', '%s' )", prodcode);
12579 r = run_query(hdb, query);
12580 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12581
12582 r = MsiDatabaseCommit(hdb);
12583 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12584
12585 MsiCloseHandle(hdb);
12586
12587 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
12588 lstrcatA(keypath, prod_squashed);
12589
12590 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
12591 if (res == ERROR_ACCESS_DENIED)
12592 {
12593 skip("Not enough rights to perform tests\n");
12594 DeleteFile(msifile);
12595 return;
12596 }
12597 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
12598
12599 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
12600 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
12601 lstrcatA(keypath, prod_squashed);
12602
12603 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
12604 if (res == ERROR_ACCESS_DENIED)
12605 {
12606 skip("Not enough rights to perform tests\n");
12607 RegDeleteKeyA(prodkey, "");
12608 RegCloseKey(prodkey);
12609 return;
12610 }
12611 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
12612
12613 res = RegCreateKeyExA(userkey, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
12614 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
12615
12616 lstrcpyA(val, path);
12617 lstrcatA(val, "\\");
12618 lstrcatA(val, msifile);
12619 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
12620 (const BYTE *)val, lstrlenA(val) + 1);
12621 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
12622
12623 hprod = 0xdeadbeef;
12624 r = MsiOpenProductA(prodcode, &hprod);
12625 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12626 ok(hprod != 0 && hprod != 0xdeadbeef, "Expected a valid product handle\n");
12627
12628 /* hProduct is invalid */
12629 size = MAX_PATH;
12630 lstrcpyA(val, "apple");
12631 r = MsiGetProductPropertyA(0xdeadbeef, "ProductCode", val, &size);
12632 ok(r == ERROR_INVALID_HANDLE,
12633 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
12634 ok(!lstrcmpA(val, "apple"),
12635 "Expected val to be unchanged, got \"%s\"\n", val);
12636 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
12637
12638 /* szProperty is NULL */
12639 size = MAX_PATH;
12640 lstrcpyA(val, "apple");
12641 r = MsiGetProductPropertyA(hprod, NULL, val, &size);
12642 ok(r == ERROR_INVALID_PARAMETER,
12643 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
12644 ok(!lstrcmpA(val, "apple"),
12645 "Expected val to be unchanged, got \"%s\"\n", val);
12646 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
12647
12648 /* szProperty is empty */
12649 size = MAX_PATH;
12650 lstrcpyA(val, "apple");
12651 r = MsiGetProductPropertyA(hprod, "", val, &size);
12652 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12653 ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
12654 ok(size == 0, "Expected 0, got %d\n", size);
12655
12656 /* get the property */
12657 size = MAX_PATH;
12658 lstrcpyA(val, "apple");
12659 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12660 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12661 ok(!lstrcmpA(val, prodcode),
12662 "Expected \"%s\", got \"%s\"\n", prodcode, val);
12663 ok(size == lstrlenA(prodcode),
12664 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12665
12666 /* lpValueBuf is NULL */
12667 size = MAX_PATH;
12668 r = MsiGetProductPropertyA(hprod, "ProductCode", NULL, &size);
12669 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12670 ok(size == lstrlenA(prodcode),
12671 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12672
12673 /* pcchValueBuf is NULL */
12674 lstrcpyA(val, "apple");
12675 r = MsiGetProductPropertyA(hprod, "ProductCode", val, NULL);
12676 ok(r == ERROR_INVALID_PARAMETER,
12677 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
12678 ok(!lstrcmpA(val, "apple"),
12679 "Expected val to be unchanged, got \"%s\"\n", val);
12680 ok(size == lstrlenA(prodcode),
12681 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12682
12683 /* pcchValueBuf is too small */
12684 size = 4;
12685 lstrcpyA(val, "apple");
12686 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12687 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
12688 ok(!strncmp(val, prodcode, 3),
12689 "Expected first 3 chars of \"%s\", got \"%s\"\n", prodcode, val);
12690 ok(size == lstrlenA(prodcode),
12691 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12692
12693 /* pcchValueBuf does not leave room for NULL terminator */
12694 size = lstrlenA(prodcode);
12695 lstrcpyA(val, "apple");
12696 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12697 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
12698 ok(!strncmp(val, prodcode, lstrlenA(prodcode) - 1),
12699 "Expected first 37 chars of \"%s\", got \"%s\"\n", prodcode, val);
12700 ok(size == lstrlenA(prodcode),
12701 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12702
12703 /* pcchValueBuf has enough room for NULL terminator */
12704 size = lstrlenA(prodcode) + 1;
12705 lstrcpyA(val, "apple");
12706 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12707 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12708 ok(!lstrcmpA(val, prodcode),
12709 "Expected \"%s\", got \"%s\"\n", prodcode, val);
12710 ok(size == lstrlenA(prodcode),
12711 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12712
12713 /* nonexistent property */
12714 size = MAX_PATH;
12715 lstrcpyA(val, "apple");
12716 r = MsiGetProductPropertyA(hprod, "IDontExist", val, &size);
12717 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12718 ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
12719 ok(size == 0, "Expected 0, got %d\n", size);
12720
12721 r = MsiSetPropertyA(hprod, "NewProperty", "value");
12722 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12723
12724 /* non-product property set */
12725 size = MAX_PATH;
12726 lstrcpyA(val, "apple");
12727 r = MsiGetProductPropertyA(hprod, "NewProperty", val, &size);
12728 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12729 ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
12730 ok(size == 0, "Expected 0, got %d\n", size);
12731
12732 r = MsiSetPropertyA(hprod, "ProductCode", "value");
12733 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12734
12735 /* non-product property that is also a product property set */
12736 size = MAX_PATH;
12737 lstrcpyA(val, "apple");
12738 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12739 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12740 ok(!lstrcmpA(val, prodcode),
12741 "Expected \"%s\", got \"%s\"\n", prodcode, val);
12742 ok(size == lstrlenA(prodcode),
12743 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12744
12745 MsiCloseHandle(hprod);
12746
12747 RegDeleteValueA(props, "LocalPackage");
12748 delete_key(props, "", access);
12749 RegCloseKey(props);
12750 delete_key(userkey, "", access);
12751 RegCloseKey(userkey);
12752 delete_key(prodkey, "", access);
12753 RegCloseKey(prodkey);
12754 DeleteFileA(msifile);
12755 }
12756
12757 static void test_MsiSetProperty(void)
12758 {
12759 MSIHANDLE hpkg, hdb, hrec;
12760 CHAR buf[MAX_PATH];
12761 LPCSTR query;
12762 DWORD size;
12763 UINT r;
12764
12765 r = package_from_db(create_package_db(), &hpkg);
12766 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
12767 {
12768 skip("Not enough rights to perform tests\n");
12769 DeleteFile(msifile);
12770 return;
12771 }
12772 ok(r == ERROR_SUCCESS, "Expected a valid package %u\n", r);
12773
12774 /* invalid hInstall */
12775 r = MsiSetPropertyA(0, "Prop", "Val");
12776 ok(r == ERROR_INVALID_HANDLE,
12777 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
12778
12779 /* invalid hInstall */
12780 r = MsiSetPropertyA(0xdeadbeef, "Prop", "Val");
12781 ok(r == ERROR_INVALID_HANDLE,
12782 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
12783
12784 /* szName is NULL */
12785 r = MsiSetPropertyA(hpkg, NULL, "Val");
12786 ok(r == ERROR_INVALID_PARAMETER,
12787 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
12788
12789 /* both szName and szValue are NULL */
12790 r = MsiSetPropertyA(hpkg, NULL, NULL);
12791 ok(r == ERROR_INVALID_PARAMETER,
12792 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
12793
12794 /* szName is empty */
12795 r = MsiSetPropertyA(hpkg, "", "Val");
12796 ok(r == ERROR_FUNCTION_FAILED,
12797 "Expected ERROR_FUNCTION_FAILED, got %d\n", r);
12798
12799 /* szName is empty and szValue is NULL */
12800 r = MsiSetPropertyA(hpkg, "", NULL);
12801 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12802
12803 /* set a property */
12804 r = MsiSetPropertyA(hpkg, "Prop", "Val");
12805 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12806
12807 /* get the property */
12808 size = MAX_PATH;
12809 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12810 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12811 ok(!lstrcmpA(buf, "Val"), "Expected \"Val\", got \"%s\"\n", buf);
12812 ok(size == 3, "Expected 3, got %d\n", size);
12813
12814 /* update the property */
12815 r = MsiSetPropertyA(hpkg, "Prop", "Nuvo");
12816 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12817
12818 /* get the property */
12819 size = MAX_PATH;
12820 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12821 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12822 ok(!lstrcmpA(buf, "Nuvo"), "Expected \"Nuvo\", got \"%s\"\n", buf);
12823 ok(size == 4, "Expected 4, got %d\n", size);
12824
12825 hdb = MsiGetActiveDatabase(hpkg);
12826 ok(hdb != 0, "Expected a valid database handle\n");
12827
12828 /* set prop is not in the _Property table */
12829 query = "SELECT * FROM `_Property` WHERE `Property` = 'Prop'";
12830 r = do_query(hdb, query, &hrec);
12831 ok(r == ERROR_BAD_QUERY_SYNTAX,
12832 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
12833
12834 /* set prop is not in the Property table */
12835 query = "SELECT * FROM `Property` WHERE `Property` = 'Prop'";
12836 r = do_query(hdb, query, &hrec);
12837 ok(r == ERROR_BAD_QUERY_SYNTAX,
12838 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
12839
12840 MsiCloseHandle(hdb);
12841
12842 /* szValue is an empty string */
12843 r = MsiSetPropertyA(hpkg, "Prop", "");
12844 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12845
12846 /* try to get the property */
12847 size = MAX_PATH;
12848 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12849 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12850 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
12851 ok(size == 0, "Expected 0, got %d\n", size);
12852
12853 /* reset the property */
12854 r = MsiSetPropertyA(hpkg, "Prop", "BlueTap");
12855 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12856
12857 /* delete the property */
12858 r = MsiSetPropertyA(hpkg, "Prop", NULL);
12859 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12860
12861 /* try to get the property */
12862 size = MAX_PATH;
12863 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12864 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12865 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
12866 ok(size == 0, "Expected 0, got %d\n", size);
12867
12868 MsiCloseHandle(hpkg);
12869 DeleteFileA(msifile);
12870 }
12871
12872 static void test_MsiApplyMultiplePatches(void)
12873 {
12874 UINT r, type = GetDriveType(NULL);
12875
12876 if (!pMsiApplyMultiplePatchesA) {
12877 win_skip("MsiApplyMultiplePatchesA not found\n");
12878 return;
12879 }
12880
12881 r = pMsiApplyMultiplePatchesA(NULL, NULL, NULL);
12882 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12883
12884 r = pMsiApplyMultiplePatchesA("", NULL, NULL);
12885 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12886
12887 r = pMsiApplyMultiplePatchesA(";", NULL, NULL);
12888 if (type == DRIVE_FIXED)
12889 todo_wine ok(r == ERROR_PATH_NOT_FOUND, "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
12890 else
12891 ok(r == ERROR_INVALID_NAME, "Expected ERROR_INVALID_NAME, got %u\n", r);
12892
12893 r = pMsiApplyMultiplePatchesA(" ;", NULL, NULL);
12894 if (type == DRIVE_FIXED)
12895 todo_wine ok(r == ERROR_PATCH_PACKAGE_OPEN_FAILED, "Expected ERROR_PATCH_PACKAGE_OPEN_FAILED, got %u\n", r);
12896 else
12897 ok(r == ERROR_INVALID_NAME, "Expected ERROR_INVALID_NAME, got %u\n", r);
12898
12899 r = pMsiApplyMultiplePatchesA(";;", NULL, NULL);
12900 if (type == DRIVE_FIXED)
12901 todo_wine ok(r == ERROR_PATH_NOT_FOUND, "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
12902 else
12903 ok(r == ERROR_INVALID_NAME, "Expected ERROR_INVALID_NAME, got %u\n", r);
12904
12905 r = pMsiApplyMultiplePatchesA("nosuchpatchpackage;", NULL, NULL);
12906 todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
12907
12908 r = pMsiApplyMultiplePatchesA(";nosuchpatchpackage", NULL, NULL);
12909 if (type == DRIVE_FIXED)
12910 todo_wine ok(r == ERROR_PATH_NOT_FOUND, "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
12911 else
12912 ok(r == ERROR_INVALID_NAME, "Expected ERROR_INVALID_NAME, got %u\n", r);
12913
12914 r = pMsiApplyMultiplePatchesA("nosuchpatchpackage;nosuchpatchpackage", NULL, NULL);
12915 todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
12916
12917 r = pMsiApplyMultiplePatchesA(" nosuchpatchpackage ; nosuchpatchpackage ", NULL, NULL);
12918 todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
12919 }
12920
12921 static void test_MsiApplyPatch(void)
12922 {
12923 UINT r;
12924
12925 r = MsiApplyPatch(NULL, NULL, INSTALLTYPE_DEFAULT, NULL);
12926 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12927
12928 r = MsiApplyPatch("", NULL, INSTALLTYPE_DEFAULT, NULL);
12929 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12930 }
12931
12932 static void test_MsiEnumComponentCosts(void)
12933 {
12934 MSIHANDLE hdb, hpkg;
12935 char package[12], drive[3];
12936 DWORD len;
12937 UINT r;
12938 int cost, temp;
12939
12940 hdb = create_package_db();
12941 ok( hdb, "failed to create database\n" );
12942
12943 r = create_property_table( hdb );
12944 ok( r == ERROR_SUCCESS, "cannot create Property table %u\n", r );
12945
12946 r = add_property_entry( hdb, "'ProductCode', '{379B1C47-40C1-42FA-A9BB-BEBB6F1B0172}'" );
12947 ok( r == ERROR_SUCCESS, "cannot add property entry %u\n", r );
12948
12949 r = add_property_entry( hdb, "'MSIFASTINSTALL', '1'" );
12950 ok( r == ERROR_SUCCESS, "cannot add property entry %u\n", r );
12951
12952 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
12953 ok( r == ERROR_SUCCESS, "failed to add directory entry %u\n" , r );
12954
12955 r = create_media_table( hdb );
12956 ok( r == ERROR_SUCCESS, "cannot create Media table %u\n", r );
12957
12958 r = add_media_entry( hdb, "'1', '2', 'cabinet', '', '', ''");
12959 ok( r == ERROR_SUCCESS, "cannot add media entry %u\n", r );
12960
12961 r = create_file_table( hdb );
12962 ok( r == ERROR_SUCCESS, "cannot create File table %u\n", r );
12963
12964 r = add_file_entry( hdb, "'one.txt', 'one', 'one.txt', 4096, '', '', 8192, 1" );
12965 ok( r == ERROR_SUCCESS, "cannot add file %u\n", r );
12966
12967 r = create_component_table( hdb );
12968 ok( r == ERROR_SUCCESS, "cannot create Component table %u\n", r );
12969
12970 r = add_component_entry( hdb, "'one', '{B2F86B9D-8447-4BC5-8883-750C45AA31CA}', 'TARGETDIR', 0, '', 'one.txt'" );
12971 ok( r == ERROR_SUCCESS, "cannot add component %u\n", r );
12972
12973 r = add_component_entry( hdb, "'two', '{62A09F6E-0B74-4829-BDB7-CAB66F42CCE8}', 'TARGETDIR', 0, '', ''" );
12974 ok( r == ERROR_SUCCESS, "cannot add component %u\n", r );
12975
12976 r = create_feature_table( hdb );
12977 ok( r == ERROR_SUCCESS, "cannot create Feature table %u\n", r );
12978
12979 r = add_feature_entry( hdb, "'one', '', '', '', 0, 1, '', 0" );
12980 ok( r == ERROR_SUCCESS, "cannot add feature %u\n", r );
12981
12982 r = add_feature_entry( hdb, "'two', '', '', '', 0, 1, '', 0" );
12983 ok( r == ERROR_SUCCESS, "cannot add feature %u\n", r );
12984
12985 r = create_feature_components_table( hdb );
12986 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table %u\n", r );
12987
12988 r = add_feature_components_entry( hdb, "'one', 'one'" );
12989 ok( r == ERROR_SUCCESS, "cannot add feature/component pair %u\n", r );
12990
12991 r = add_feature_components_entry( hdb, "'two', 'two'" );
12992 ok( r == ERROR_SUCCESS, "cannot add feature/component pair %u\n", r );
12993
12994 r = create_install_execute_sequence_table( hdb );
12995 ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table %u\n", r );
12996
12997 r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
12998 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry %u\n", r );
12999
13000 r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
13001 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry %u\n", r );
13002
13003 r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
13004 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry %u\n", r );
13005
13006 r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1100'" );
13007 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry %u\n", r );
13008
13009 MsiDatabaseCommit( hdb );
13010
13011 sprintf( package, "#%u", hdb );
13012 r = MsiOpenPackageA( package, &hpkg );
13013 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
13014 {
13015 skip("Not enough rights to perform tests\n");
13016 goto error;
13017 }
13018 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
13019
13020 r = MsiEnumComponentCostsA( 0, NULL, 0, INSTALLSTATE_UNKNOWN, NULL, NULL, NULL, NULL );
13021 ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
13022
13023 r = MsiEnumComponentCostsA( hpkg, NULL, 0, INSTALLSTATE_UNKNOWN, NULL, NULL, NULL, NULL );
13024 ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
13025
13026 r = MsiEnumComponentCostsA( hpkg, NULL, 0, INSTALLSTATE_UNKNOWN, NULL, NULL, NULL, NULL );
13027 ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
13028
13029 r = MsiEnumComponentCostsA( hpkg, "", 0, INSTALLSTATE_UNKNOWN, NULL, NULL, NULL, NULL );
13030 ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
13031
13032 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_UNKNOWN, NULL, NULL, NULL, NULL );
13033 ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
13034
13035 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, NULL, NULL, NULL, NULL );
13036 ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
13037
13038 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, NULL, NULL, NULL );
13039 ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
13040
13041 len = sizeof(drive);
13042 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, NULL, NULL );
13043 ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
13044
13045 len = sizeof(drive);
13046 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, NULL );
13047 ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
13048
13049 len = sizeof(drive);
13050 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
13051 todo_wine ok( r == ERROR_INVALID_HANDLE_STATE, "Expected ERROR_INVALID_HANDLE_STATE, got %u\n", r );
13052
13053 len = sizeof(drive);
13054 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, NULL, &len, &cost, &temp );
13055 ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
13056
13057 MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
13058
13059 r = MsiDoAction( hpkg, "CostInitialize" );
13060 ok( r == ERROR_SUCCESS, "CostInitialize failed %u\n", r );
13061
13062 r = MsiDoAction( hpkg, "FileCost" );
13063 ok( r == ERROR_SUCCESS, "FileCost failed %u\n", r );
13064
13065 len = sizeof(drive);
13066 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
13067 ok( r == ERROR_FUNCTION_NOT_CALLED, "Expected ERROR_FUNCTION_NOT_CALLED, got %u\n", r );
13068
13069 r = MsiDoAction( hpkg, "CostFinalize" );
13070 ok( r == ERROR_SUCCESS, "CostFinalize failed %u\n", r );
13071
13072 /* contrary to what msdn says InstallValidate must be called too */
13073 len = sizeof(drive);
13074 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
13075 todo_wine ok( r == ERROR_FUNCTION_NOT_CALLED, "Expected ERROR_FUNCTION_NOT_CALLED, got %u\n", r );
13076
13077 r = MsiDoAction( hpkg, "InstallValidate" );
13078 ok( r == ERROR_SUCCESS, "InstallValidate failed %u\n", r );
13079
13080 len = 0;
13081 r = MsiEnumComponentCostsA( hpkg, "three", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
13082 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %u\n", r );
13083
13084 len = 0;
13085 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
13086 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %u\n", r );
13087 ok( len == 2, "expected len == 2, got %u\n", len );
13088
13089 len = 2;
13090 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
13091 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %u\n", r );
13092 ok( len == 2, "expected len == 2, got %u\n", len );
13093
13094 len = 2;
13095 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_UNKNOWN, drive, &len, &cost, &temp );
13096 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %u\n", r );
13097 ok( len == 2, "expected len == 2, got %u\n", len );
13098
13099 /* install state doesn't seem to matter */
13100 len = sizeof(drive);
13101 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_UNKNOWN, drive, &len, &cost, &temp );
13102 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
13103
13104 len = sizeof(drive);
13105 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_ABSENT, drive, &len, &cost, &temp );
13106 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
13107
13108 len = sizeof(drive);
13109 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_SOURCE, drive, &len, &cost, &temp );
13110 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
13111
13112 len = sizeof(drive);
13113 drive[0] = 0;
13114 cost = temp = 0xdead;
13115 r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
13116 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
13117 ok( len == 2, "expected len == 2, got %u\n", len );
13118 ok( drive[0], "expected a drive\n" );
13119 ok( cost && cost != 0xdead, "expected cost > 0, got %d\n", cost );
13120 ok( !temp, "expected temp == 0, got %d\n", temp );
13121
13122 len = sizeof(drive);
13123 drive[0] = 0;
13124 cost = temp = 0xdead;
13125 r = MsiEnumComponentCostsA( hpkg, "two", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
13126 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
13127 ok( len == 2, "expected len == 2, got %u\n", len );
13128 ok( drive[0], "expected a drive\n" );
13129 ok( !cost, "expected cost == 0, got %d\n", cost );
13130 ok( !temp, "expected temp == 0, got %d\n", temp );
13131
13132 len = sizeof(drive);
13133 drive[0] = 0;
13134 cost = temp = 0xdead;
13135 r = MsiEnumComponentCostsA( hpkg, "", 0, INSTALLSTATE_UNKNOWN, drive, &len, &cost, &temp );
13136 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
13137 ok( len == 2, "expected len == 2, got %u\n", len );
13138 ok( drive[0], "expected a drive\n" );
13139 ok( !cost, "expected cost == 0, got %d\n", cost );
13140 ok( temp && temp != 0xdead, "expected temp > 0, got %d\n", temp );
13141
13142 /* increased index */
13143 len = sizeof(drive);
13144 r = MsiEnumComponentCostsA( hpkg, "one", 1, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
13145 ok( r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %u\n", r );
13146
13147 len = sizeof(drive);
13148 r = MsiEnumComponentCostsA( hpkg, "", 1, INSTALLSTATE_UNKNOWN, drive, &len, &cost, &temp );
13149 ok( r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %u\n", r );
13150
13151 MsiCloseHandle( hpkg );
13152 error:
13153 MsiCloseHandle( hdb );
13154 DeleteFileA( msifile );
13155 }
13156
13157 START_TEST(package)
13158 {
13159 STATEMGRSTATUS status;
13160 BOOL ret = FALSE;
13161
13162 init_functionpointers();
13163
13164 if (pIsWow64Process)
13165 pIsWow64Process(GetCurrentProcess(), &is_wow64);
13166
13167 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
13168
13169 /* Create a restore point ourselves so we circumvent the multitude of restore points
13170 * that would have been created by all the installation and removal tests.
13171 *
13172 * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
13173 * creation of restore points.
13174 */
13175 if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
13176 {
13177 memset(&status, 0, sizeof(status));
13178 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
13179 }
13180
13181 test_createpackage();
13182 test_doaction();
13183 test_gettargetpath_bad();
13184 test_settargetpath();
13185 test_props();
13186 test_property_table();
13187 test_condition();
13188 test_msipackage();
13189 test_formatrecord2();
13190 test_states();
13191 test_getproperty();
13192 test_removefiles();
13193 test_appsearch();
13194 test_appsearch_complocator();
13195 test_appsearch_reglocator();
13196 test_appsearch_inilocator();
13197 test_appsearch_drlocator();
13198 test_featureparents();
13199 test_installprops();
13200 test_launchconditions();
13201 test_ccpsearch();
13202 test_complocator();
13203 test_MsiGetSourcePath();
13204 test_shortlongsource();
13205 test_sourcedir();
13206 test_access();
13207 test_emptypackage();
13208 test_MsiGetProductProperty();
13209 test_MsiSetProperty();
13210 test_MsiApplyMultiplePatches();
13211 test_MsiApplyPatch();
13212 test_MsiEnumComponentCosts();
13213
13214 if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
13215 {
13216 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
13217 if (ret)
13218 remove_restore_point(status.llSequenceNumber);
13219 }
13220 }