sync rostests to r44455
[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
31 #include "wine/test.h"
32
33 static const char msifile[] = "winetest.msi";
34 char CURR_DIR[MAX_PATH];
35
36 static UINT (WINAPI *pMsiApplyMultiplePatchesA)(LPCSTR, LPCSTR, LPCSTR);
37
38 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
39
40 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
41 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
42
43 static void init_functionpointers(void)
44 {
45 HMODULE hmsi = GetModuleHandleA("msi.dll");
46 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
47 HMODULE hsrclient;
48
49 #define GET_PROC(mod, func) \
50 p ## func = (void*)GetProcAddress(mod, #func);
51
52 GET_PROC(hmsi, MsiApplyMultiplePatchesA);
53
54 GET_PROC(hadvapi32, ConvertSidToStringSidA);
55
56 hsrclient = LoadLibraryA("srclient.dll");
57 GET_PROC(hsrclient, SRRemoveRestorePoint);
58 GET_PROC(hsrclient, SRSetRestorePointA);
59 #undef GET_PROC
60 }
61
62
63 static LPSTR get_user_sid(LPSTR *usersid)
64 {
65 HANDLE token;
66 BYTE buf[1024];
67 DWORD size;
68 PTOKEN_USER user;
69
70 if (!pConvertSidToStringSidA)
71 {
72 win_skip("ConvertSidToStringSidA is not available\n");
73 return NULL;
74 }
75
76 *usersid = NULL;
77 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
78 size = sizeof(buf);
79 GetTokenInformation(token, TokenUser, buf, size, &size);
80 user = (PTOKEN_USER)buf;
81 pConvertSidToStringSidA(user->User.Sid, usersid);
82 ok(*usersid != NULL, "pConvertSidToStringSidA failed lre=%d\n", GetLastError());
83 CloseHandle(token);
84 return *usersid;
85 }
86
87 /* RegDeleteTreeW from dlls/advapi32/registry.c */
88 static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
89 {
90 LONG ret;
91 DWORD dwMaxSubkeyLen, dwMaxValueLen;
92 DWORD dwMaxLen, dwSize;
93 WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
94 HKEY hSubKey = hKey;
95
96 if(lpszSubKey)
97 {
98 ret = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
99 if (ret) return ret;
100 }
101
102 ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
103 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
104 if (ret) goto cleanup;
105
106 dwMaxSubkeyLen++;
107 dwMaxValueLen++;
108 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
109 if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
110 {
111 /* Name too big: alloc a buffer for it */
112 if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
113 {
114 ret = ERROR_NOT_ENOUGH_MEMORY;
115 goto cleanup;
116 }
117 }
118
119 /* Recursively delete all the subkeys */
120 while (TRUE)
121 {
122 dwSize = dwMaxLen;
123 if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
124 NULL, NULL, NULL)) break;
125
126 ret = package_RegDeleteTreeW(hSubKey, lpszName);
127 if (ret) goto cleanup;
128 }
129
130 if (lpszSubKey)
131 ret = RegDeleteKeyW(hKey, lpszSubKey);
132 else
133 while (TRUE)
134 {
135 dwSize = dwMaxLen;
136 if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
137 NULL, NULL, NULL, NULL)) break;
138
139 ret = RegDeleteValueW(hKey, lpszName);
140 if (ret) goto cleanup;
141 }
142
143 cleanup:
144 if (lpszName != szNameBuf)
145 HeapFree(GetProcessHeap(), 0, lpszName);
146 if(lpszSubKey)
147 RegCloseKey(hSubKey);
148 return ret;
149 }
150
151 static BOOL squash_guid(LPCWSTR in, LPWSTR out)
152 {
153 DWORD i,n=1;
154 GUID guid;
155
156 if (FAILED(CLSIDFromString((LPOLESTR)in, &guid)))
157 return FALSE;
158
159 for(i=0; i<8; i++)
160 out[7-i] = in[n++];
161 n++;
162 for(i=0; i<4; i++)
163 out[11-i] = in[n++];
164 n++;
165 for(i=0; i<4; i++)
166 out[15-i] = in[n++];
167 n++;
168 for(i=0; i<2; i++)
169 {
170 out[17+i*2] = in[n++];
171 out[16+i*2] = in[n++];
172 }
173 n++;
174 for( ; i<8; i++)
175 {
176 out[17+i*2] = in[n++];
177 out[16+i*2] = in[n++];
178 }
179 out[32]=0;
180 return TRUE;
181 }
182
183 static void create_test_guid(LPSTR prodcode, LPSTR squashed)
184 {
185 WCHAR guidW[MAX_PATH];
186 WCHAR squashedW[MAX_PATH];
187 GUID guid;
188 HRESULT hr;
189 int size;
190
191 hr = CoCreateGuid(&guid);
192 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
193
194 size = StringFromGUID2(&guid, guidW, MAX_PATH);
195 ok(size == 39, "Expected 39, got %d\n", hr);
196
197 WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL);
198 squash_guid(guidW, squashedW);
199 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
200 }
201
202 static void set_component_path(LPCSTR filename, MSIINSTALLCONTEXT context,
203 LPCSTR guid, LPSTR usersid, BOOL dir)
204 {
205 WCHAR guidW[MAX_PATH];
206 WCHAR squashedW[MAX_PATH];
207 CHAR squashed[MAX_PATH];
208 CHAR comppath[MAX_PATH];
209 CHAR prodpath[MAX_PATH];
210 CHAR path[MAX_PATH];
211 LPCSTR prod = NULL;
212 HKEY hkey;
213
214 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
215 squash_guid(guidW, squashedW);
216 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
217
218 if (context == MSIINSTALLCONTEXT_MACHINE)
219 {
220 prod = "3D0DAE300FACA1300AD792060BCDAA92";
221 sprintf(comppath,
222 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
223 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
224 lstrcpyA(prodpath,
225 "SOFTWARE\\Classes\\Installer\\"
226 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
227 }
228 else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
229 {
230 prod = "7D2F387510109040002000060BECB6AB";
231 sprintf(comppath,
232 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
233 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
234 sprintf(prodpath,
235 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
236 "Installer\\%s\\Installer\\Products\\"
237 "7D2F387510109040002000060BECB6AB", usersid);
238 }
239 else if (context == MSIINSTALLCONTEXT_USERMANAGED)
240 {
241 prod = "7D2F387510109040002000060BECB6AB";
242 sprintf(comppath,
243 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
244 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
245 sprintf(prodpath,
246 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
247 "Installer\\Managed\\%s\\Installer\\Products\\"
248 "7D2F387510109040002000060BECB6AB", usersid);
249 }
250
251 RegCreateKeyA(HKEY_LOCAL_MACHINE, comppath, &hkey);
252
253 lstrcpyA(path, CURR_DIR);
254 lstrcatA(path, "\\");
255 if (!dir) lstrcatA(path, filename);
256
257 RegSetValueExA(hkey, prod, 0, REG_SZ, (LPBYTE)path, lstrlenA(path));
258 RegCloseKey(hkey);
259
260 RegCreateKeyA(HKEY_LOCAL_MACHINE, prodpath, &hkey);
261 RegCloseKey(hkey);
262 }
263
264 static void delete_component_path(LPCSTR guid, MSIINSTALLCONTEXT context, LPSTR usersid)
265 {
266 WCHAR guidW[MAX_PATH];
267 WCHAR squashedW[MAX_PATH];
268 WCHAR substrW[MAX_PATH];
269 CHAR squashed[MAX_PATH];
270 CHAR comppath[MAX_PATH];
271 CHAR prodpath[MAX_PATH];
272
273 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
274 squash_guid(guidW, squashedW);
275 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
276
277 if (context == MSIINSTALLCONTEXT_MACHINE)
278 {
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 sprintf(comppath,
289 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
290 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
291 sprintf(prodpath,
292 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
293 "Installer\\%s\\Installer\\Products\\"
294 "7D2F387510109040002000060BECB6AB", usersid);
295 }
296 else if (context == MSIINSTALLCONTEXT_USERMANAGED)
297 {
298 sprintf(comppath,
299 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
300 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
301 sprintf(prodpath,
302 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
303 "Installer\\Managed\\%s\\Installer\\Products\\"
304 "7D2F387510109040002000060BECB6AB", usersid);
305 }
306
307 MultiByteToWideChar(CP_ACP, 0, comppath, -1, substrW, MAX_PATH);
308 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW);
309
310 MultiByteToWideChar(CP_ACP, 0, prodpath, -1, substrW, MAX_PATH);
311 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW);
312 }
313
314 static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec)
315 {
316 MSIHANDLE hview = 0;
317 UINT r, ret;
318
319 /* open a select query */
320 r = MsiDatabaseOpenView(hdb, query, &hview);
321 if (r != ERROR_SUCCESS)
322 return r;
323 r = MsiViewExecute(hview, 0);
324 if (r != ERROR_SUCCESS)
325 return r;
326 ret = MsiViewFetch(hview, phrec);
327 r = MsiViewClose(hview);
328 if (r != ERROR_SUCCESS)
329 return r;
330 r = MsiCloseHandle(hview);
331 if (r != ERROR_SUCCESS)
332 return r;
333 return ret;
334 }
335
336 static UINT run_query( MSIHANDLE hdb, const char *query )
337 {
338 MSIHANDLE hview = 0;
339 UINT r;
340
341 r = MsiDatabaseOpenView(hdb, query, &hview);
342 if( r != ERROR_SUCCESS )
343 return r;
344
345 r = MsiViewExecute(hview, 0);
346 if( r == ERROR_SUCCESS )
347 r = MsiViewClose(hview);
348 MsiCloseHandle(hview);
349 return r;
350 }
351
352 static UINT create_component_table( MSIHANDLE hdb )
353 {
354 return run_query( hdb,
355 "CREATE TABLE `Component` ( "
356 "`Component` CHAR(72) NOT NULL, "
357 "`ComponentId` CHAR(38), "
358 "`Directory_` CHAR(72) NOT NULL, "
359 "`Attributes` SHORT NOT NULL, "
360 "`Condition` CHAR(255), "
361 "`KeyPath` CHAR(72) "
362 "PRIMARY KEY `Component`)" );
363 }
364
365 static UINT create_feature_table( MSIHANDLE hdb )
366 {
367 return run_query( hdb,
368 "CREATE TABLE `Feature` ( "
369 "`Feature` CHAR(38) NOT NULL, "
370 "`Feature_Parent` CHAR(38), "
371 "`Title` CHAR(64), "
372 "`Description` CHAR(255), "
373 "`Display` SHORT NOT NULL, "
374 "`Level` SHORT NOT NULL, "
375 "`Directory_` CHAR(72), "
376 "`Attributes` SHORT NOT NULL "
377 "PRIMARY KEY `Feature`)" );
378 }
379
380 static UINT create_feature_components_table( MSIHANDLE hdb )
381 {
382 return run_query( hdb,
383 "CREATE TABLE `FeatureComponents` ( "
384 "`Feature_` CHAR(38) NOT NULL, "
385 "`Component_` CHAR(72) NOT NULL "
386 "PRIMARY KEY `Feature_`, `Component_` )" );
387 }
388
389 static UINT create_file_table( MSIHANDLE hdb )
390 {
391 return run_query( hdb,
392 "CREATE TABLE `File` ("
393 "`File` CHAR(72) NOT NULL, "
394 "`Component_` CHAR(72) NOT NULL, "
395 "`FileName` CHAR(255) NOT NULL, "
396 "`FileSize` LONG NOT NULL, "
397 "`Version` CHAR(72), "
398 "`Language` CHAR(20), "
399 "`Attributes` SHORT, "
400 "`Sequence` SHORT NOT NULL "
401 "PRIMARY KEY `File`)" );
402 }
403
404 static UINT create_remove_file_table( MSIHANDLE hdb )
405 {
406 return run_query( hdb,
407 "CREATE TABLE `RemoveFile` ("
408 "`FileKey` CHAR(72) NOT NULL, "
409 "`Component_` CHAR(72) NOT NULL, "
410 "`FileName` CHAR(255) LOCALIZABLE, "
411 "`DirProperty` CHAR(72) NOT NULL, "
412 "`InstallMode` SHORT NOT NULL "
413 "PRIMARY KEY `FileKey`)" );
414 }
415
416 static UINT create_appsearch_table( MSIHANDLE hdb )
417 {
418 return run_query( hdb,
419 "CREATE TABLE `AppSearch` ("
420 "`Property` CHAR(72) NOT NULL, "
421 "`Signature_` CHAR(72) NOT NULL "
422 "PRIMARY KEY `Property`, `Signature_`)" );
423 }
424
425 static UINT create_reglocator_table( MSIHANDLE hdb )
426 {
427 return run_query( hdb,
428 "CREATE TABLE `RegLocator` ("
429 "`Signature_` CHAR(72) NOT NULL, "
430 "`Root` SHORT NOT NULL, "
431 "`Key` CHAR(255) NOT NULL, "
432 "`Name` CHAR(255), "
433 "`Type` SHORT "
434 "PRIMARY KEY `Signature_`)" );
435 }
436
437 static UINT create_signature_table( MSIHANDLE hdb )
438 {
439 return run_query( hdb,
440 "CREATE TABLE `Signature` ("
441 "`Signature` CHAR(72) NOT NULL, "
442 "`FileName` CHAR(255) NOT NULL, "
443 "`MinVersion` CHAR(20), "
444 "`MaxVersion` CHAR(20), "
445 "`MinSize` LONG, "
446 "`MaxSize` LONG, "
447 "`MinDate` LONG, "
448 "`MaxDate` LONG, "
449 "`Languages` CHAR(255) "
450 "PRIMARY KEY `Signature`)" );
451 }
452
453 static UINT create_launchcondition_table( MSIHANDLE hdb )
454 {
455 return run_query( hdb,
456 "CREATE TABLE `LaunchCondition` ("
457 "`Condition` CHAR(255) NOT NULL, "
458 "`Description` CHAR(255) NOT NULL "
459 "PRIMARY KEY `Condition`)" );
460 }
461
462 static UINT create_property_table( MSIHANDLE hdb )
463 {
464 return run_query( hdb,
465 "CREATE TABLE `Property` ("
466 "`Property` CHAR(72) NOT NULL, "
467 "`Value` CHAR(0) "
468 "PRIMARY KEY `Property`)" );
469 }
470
471 static UINT create_install_execute_sequence_table( MSIHANDLE hdb )
472 {
473 return run_query( hdb,
474 "CREATE TABLE `InstallExecuteSequence` ("
475 "`Action` CHAR(72) NOT NULL, "
476 "`Condition` CHAR(255), "
477 "`Sequence` SHORT "
478 "PRIMARY KEY `Action`)" );
479 }
480
481 static UINT create_media_table( MSIHANDLE hdb )
482 {
483 return run_query( hdb,
484 "CREATE TABLE `Media` ("
485 "`DiskId` SHORT NOT NULL, "
486 "`LastSequence` SHORT NOT NULL, "
487 "`DiskPrompt` CHAR(64), "
488 "`Cabinet` CHAR(255), "
489 "`VolumeLabel` CHAR(32), "
490 "`Source` CHAR(72) "
491 "PRIMARY KEY `DiskId`)" );
492 }
493
494 static UINT create_ccpsearch_table( MSIHANDLE hdb )
495 {
496 return run_query( hdb,
497 "CREATE TABLE `CCPSearch` ("
498 "`Signature_` CHAR(72) NOT NULL "
499 "PRIMARY KEY `Signature_`)" );
500 }
501
502 static UINT create_drlocator_table( MSIHANDLE hdb )
503 {
504 return run_query( hdb,
505 "CREATE TABLE `DrLocator` ("
506 "`Signature_` CHAR(72) NOT NULL, "
507 "`Parent` CHAR(72), "
508 "`Path` CHAR(255), "
509 "`Depth` SHORT "
510 "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
511 }
512
513 static UINT create_complocator_table( MSIHANDLE hdb )
514 {
515 return run_query( hdb,
516 "CREATE TABLE `CompLocator` ("
517 "`Signature_` CHAR(72) NOT NULL, "
518 "`ComponentId` CHAR(38) NOT NULL, "
519 "`Type` SHORT "
520 "PRIMARY KEY `Signature_`)" );
521 }
522
523 static UINT create_inilocator_table( MSIHANDLE hdb )
524 {
525 return run_query( hdb,
526 "CREATE TABLE `IniLocator` ("
527 "`Signature_` CHAR(72) NOT NULL, "
528 "`FileName` CHAR(255) NOT NULL, "
529 "`Section` CHAR(96)NOT NULL, "
530 "`Key` CHAR(128)NOT NULL, "
531 "`Field` SHORT, "
532 "`Type` SHORT "
533 "PRIMARY KEY `Signature_`)" );
534 }
535
536 #define make_add_entry(type, qtext) \
537 static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
538 { \
539 char insert[] = qtext; \
540 char *query; \
541 UINT sz, r; \
542 sz = strlen(values) + sizeof insert; \
543 query = HeapAlloc(GetProcessHeap(),0,sz); \
544 sprintf(query,insert,values); \
545 r = run_query( hdb, query ); \
546 HeapFree(GetProcessHeap(), 0, query); \
547 return r; \
548 }
549
550 make_add_entry(component,
551 "INSERT INTO `Component` "
552 "(`Component`, `ComponentId`, `Directory_`, "
553 "`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
554
555 make_add_entry(directory,
556 "INSERT INTO `Directory` "
557 "(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
558
559 make_add_entry(feature,
560 "INSERT INTO `Feature` "
561 "(`Feature`, `Feature_Parent`, `Title`, `Description`, "
562 "`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
563
564 make_add_entry(feature_components,
565 "INSERT INTO `FeatureComponents` "
566 "(`Feature_`, `Component_`) VALUES( %s )")
567
568 make_add_entry(file,
569 "INSERT INTO `File` "
570 "(`File`, `Component_`, `FileName`, `FileSize`, "
571 "`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
572
573 make_add_entry(appsearch,
574 "INSERT INTO `AppSearch` "
575 "(`Property`, `Signature_`) VALUES( %s )")
576
577 make_add_entry(reglocator,
578 "INSERT INTO `RegLocator` "
579 "(`Signature_`, `Root`, `Key`, `Name`, `Type`) VALUES( %s )")
580
581 make_add_entry(signature,
582 "INSERT INTO `Signature` "
583 "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
584 " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
585 "VALUES( %s )")
586
587 make_add_entry(launchcondition,
588 "INSERT INTO `LaunchCondition` "
589 "(`Condition`, `Description`) VALUES( %s )")
590
591 make_add_entry(property,
592 "INSERT INTO `Property` (`Property`, `Value`) VALUES( %s )")
593
594 make_add_entry(install_execute_sequence,
595 "INSERT INTO `InstallExecuteSequence` "
596 "(`Action`, `Condition`, `Sequence`) VALUES( %s )")
597
598 make_add_entry(media,
599 "INSERT INTO `Media` "
600 "(`DiskId`, `LastSequence`, `DiskPrompt`, "
601 "`Cabinet`, `VolumeLabel`, `Source`) VALUES( %s )")
602
603 make_add_entry(ccpsearch,
604 "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )")
605
606 make_add_entry(drlocator,
607 "INSERT INTO `DrLocator` "
608 "(`Signature_`, `Parent`, `Path`, `Depth`) VALUES( %s )")
609
610 make_add_entry(complocator,
611 "INSERT INTO `CompLocator` "
612 "(`Signature_`, `ComponentId`, `Type`) VALUES( %s )")
613
614 make_add_entry(inilocator,
615 "INSERT INTO `IniLocator` "
616 "(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) "
617 "VALUES( %s )")
618
619 static UINT set_summary_info(MSIHANDLE hdb)
620 {
621 UINT res;
622 MSIHANDLE suminfo;
623
624 /* build summary info */
625 res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
626 ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
627
628 res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
629 "Installation Database");
630 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
631
632 res = MsiSummaryInfoSetProperty(suminfo,3, VT_LPSTR, 0,NULL,
633 "Installation Database");
634 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
635
636 res = MsiSummaryInfoSetProperty(suminfo,4, VT_LPSTR, 0,NULL,
637 "Wine Hackers");
638 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
639
640 res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
641 ";1033");
642 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
643
644 res = MsiSummaryInfoSetProperty(suminfo,9, VT_LPSTR, 0,NULL,
645 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
646 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
647
648 res = MsiSummaryInfoSetProperty(suminfo, 14, VT_I4, 100, NULL, NULL);
649 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
650
651 res = MsiSummaryInfoSetProperty(suminfo, 15, VT_I4, 0, NULL, NULL);
652 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
653
654 res = MsiSummaryInfoPersist(suminfo);
655 ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
656
657 res = MsiCloseHandle( suminfo);
658 ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
659
660 return res;
661 }
662
663
664 static MSIHANDLE create_package_db(void)
665 {
666 MSIHANDLE hdb = 0;
667 UINT res;
668
669 DeleteFile(msifile);
670
671 /* create an empty database */
672 res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb );
673 ok( res == ERROR_SUCCESS , "Failed to create database\n" );
674 if( res != ERROR_SUCCESS )
675 return hdb;
676
677 res = MsiDatabaseCommit( hdb );
678 ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
679
680 res = set_summary_info(hdb);
681
682 res = run_query( hdb,
683 "CREATE TABLE `Directory` ( "
684 "`Directory` CHAR(255) NOT NULL, "
685 "`Directory_Parent` CHAR(255), "
686 "`DefaultDir` CHAR(255) NOT NULL "
687 "PRIMARY KEY `Directory`)" );
688 ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
689
690 return hdb;
691 }
692
693 static MSIHANDLE package_from_db(MSIHANDLE hdb)
694 {
695 UINT res;
696 CHAR szPackage[10];
697 MSIHANDLE hPackage;
698
699 sprintf(szPackage,"#%i",hdb);
700 res = MsiOpenPackage(szPackage,&hPackage);
701 if (res != ERROR_SUCCESS)
702 return 0;
703
704 res = MsiCloseHandle(hdb);
705 if (res != ERROR_SUCCESS)
706 return 0;
707
708 return hPackage;
709 }
710
711 static void create_test_file(const CHAR *name)
712 {
713 HANDLE file;
714 DWORD written;
715
716 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
717 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
718 WriteFile(file, name, strlen(name), &written, NULL);
719 WriteFile(file, "\n", strlen("\n"), &written, NULL);
720 CloseHandle(file);
721 }
722
723 typedef struct _tagVS_VERSIONINFO
724 {
725 WORD wLength;
726 WORD wValueLength;
727 WORD wType;
728 WCHAR szKey[1];
729 WORD wPadding1[1];
730 VS_FIXEDFILEINFO Value;
731 WORD wPadding2[1];
732 WORD wChildren[1];
733 } VS_VERSIONINFO;
734
735 #define roundoffs(a, b, r) (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))
736 #define roundpos(a, b, r) (((BYTE *)(a)) + roundoffs(a, b, r))
737
738 static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls)
739 {
740 VS_VERSIONINFO *pVerInfo;
741 VS_FIXEDFILEINFO *pFixedInfo;
742 LPBYTE buffer, ofs;
743 CHAR path[MAX_PATH];
744 DWORD handle, size;
745 HANDLE resource;
746 BOOL ret = FALSE;
747
748 GetSystemDirectory(path, MAX_PATH);
749 /* Some dlls can't be updated on Vista/W2K8 */
750 lstrcatA(path, "\\version.dll");
751
752 CopyFileA(path, name, FALSE);
753
754 size = GetFileVersionInfoSize(path, &handle);
755 buffer = HeapAlloc(GetProcessHeap(), 0, size);
756
757 GetFileVersionInfoA(path, 0, size, buffer);
758
759 pVerInfo = (VS_VERSIONINFO *)buffer;
760 ofs = (BYTE *)&pVerInfo->szKey[lstrlenW(pVerInfo->szKey) + 1];
761 pFixedInfo = (VS_FIXEDFILEINFO *)roundpos(pVerInfo, ofs, 4);
762
763 pFixedInfo->dwFileVersionMS = ms;
764 pFixedInfo->dwFileVersionLS = ls;
765 pFixedInfo->dwProductVersionMS = ms;
766 pFixedInfo->dwProductVersionLS = ls;
767
768 resource = BeginUpdateResource(name, FALSE);
769 if (!resource)
770 goto done;
771
772 if (!UpdateResource(resource, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO),
773 MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), buffer, size))
774 goto done;
775
776 if (!EndUpdateResource(resource, FALSE))
777 goto done;
778
779 ret = TRUE;
780
781 done:
782 HeapFree(GetProcessHeap(), 0, buffer);
783 return ret;
784 }
785
786 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
787 {
788 RESTOREPOINTINFOA spec;
789
790 spec.dwEventType = event_type;
791 spec.dwRestorePtType = APPLICATION_INSTALL;
792 spec.llSequenceNumber = status->llSequenceNumber;
793 lstrcpyA(spec.szDescription, "msitest restore point");
794
795 return pSRSetRestorePointA(&spec, status);
796 }
797
798 static void remove_restore_point(DWORD seq_number)
799 {
800 DWORD res;
801
802 res = pSRRemoveRestorePoint(seq_number);
803 if (res != ERROR_SUCCESS)
804 trace("Failed to remove the restore point : %08x\n", res);
805 }
806
807 static void test_createpackage(void)
808 {
809 MSIHANDLE hPackage = 0;
810 UINT res;
811
812 hPackage = package_from_db(create_package_db());
813 ok( hPackage != 0, " Failed to create package\n");
814
815 res = MsiCloseHandle( hPackage);
816 ok( res == ERROR_SUCCESS , "Failed to close package\n" );
817 DeleteFile(msifile);
818 }
819
820 static void test_doaction( void )
821 {
822 MSIHANDLE hpkg;
823 UINT r;
824
825 r = MsiDoAction( -1, NULL );
826 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
827
828 hpkg = package_from_db(create_package_db());
829 ok( hpkg, "failed to create package\n");
830
831 r = MsiDoAction(hpkg, NULL);
832 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
833
834 r = MsiDoAction(0, "boo");
835 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
836
837 r = MsiDoAction(hpkg, "boo");
838 ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
839
840 MsiCloseHandle( hpkg );
841 DeleteFile(msifile);
842 }
843
844 static void test_gettargetpath_bad(void)
845 {
846 static const WCHAR boo[] = {'b','o','o',0};
847 static const WCHAR empty[] = {0};
848 char buffer[0x80];
849 WCHAR bufferW[0x80];
850 MSIHANDLE hpkg;
851 DWORD sz;
852 UINT r;
853
854 hpkg = package_from_db(create_package_db());
855 ok( hpkg, "failed to create package\n");
856
857 r = MsiGetTargetPath( 0, NULL, NULL, NULL );
858 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
859
860 r = MsiGetTargetPath( 0, NULL, NULL, &sz );
861 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
862
863 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
864 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
865
866 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
867 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
868
869 r = MsiGetTargetPath( hpkg, "boo", NULL, NULL );
870 ok( r == ERROR_DIRECTORY, "wrong return val\n");
871
872 r = MsiGetTargetPath( hpkg, "boo", buffer, NULL );
873 ok( r == ERROR_DIRECTORY, "wrong return val\n");
874
875 sz = 0;
876 r = MsiGetTargetPath( hpkg, "", buffer, &sz );
877 ok( r == ERROR_DIRECTORY, "wrong return val\n");
878
879 r = MsiGetTargetPathW( 0, NULL, NULL, NULL );
880 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
881
882 r = MsiGetTargetPathW( 0, NULL, NULL, &sz );
883 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
884
885 r = MsiGetTargetPathW( 0, boo, NULL, NULL );
886 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
887
888 r = MsiGetTargetPathW( 0, boo, NULL, NULL );
889 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
890
891 r = MsiGetTargetPathW( hpkg, boo, NULL, NULL );
892 ok( r == ERROR_DIRECTORY, "wrong return val\n");
893
894 r = MsiGetTargetPathW( hpkg, boo, bufferW, NULL );
895 ok( r == ERROR_DIRECTORY, "wrong return val\n");
896
897 sz = 0;
898 r = MsiGetTargetPathW( hpkg, empty, bufferW, &sz );
899 ok( r == ERROR_DIRECTORY, "wrong return val\n");
900
901 MsiCloseHandle( hpkg );
902 DeleteFile(msifile);
903 }
904
905 static void query_file_path(MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
906 {
907 UINT r;
908 DWORD size;
909 MSIHANDLE rec;
910
911 rec = MsiCreateRecord( 1 );
912 ok(rec, "MsiCreate record failed\n");
913
914 r = MsiRecordSetString( rec, 0, file );
915 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
916
917 size = MAX_PATH;
918 r = MsiFormatRecord( hpkg, rec, buff, &size );
919 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
920
921 MsiCloseHandle( rec );
922 }
923
924 static void test_settargetpath(void)
925 {
926 char tempdir[MAX_PATH+8], buffer[MAX_PATH], file[MAX_PATH];
927 DWORD sz;
928 MSIHANDLE hpkg;
929 UINT r;
930 MSIHANDLE hdb;
931
932 hdb = create_package_db();
933 ok ( hdb, "failed to create package database\n" );
934
935 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
936 ok( r == S_OK, "failed to add directory entry: %d\n" , r );
937
938 r = create_component_table( hdb );
939 ok( r == S_OK, "cannot create Component table: %d\n", r );
940
941 r = add_component_entry( hdb, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
942 ok( r == S_OK, "cannot add dummy component: %d\n", r );
943
944 r = add_component_entry( hdb, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
945 ok( r == S_OK, "cannot add test component: %d\n", r );
946
947 r = create_feature_table( hdb );
948 ok( r == S_OK, "cannot create Feature table: %d\n", r );
949
950 r = add_feature_entry( hdb, "'TestFeature', '', '', '', 0, 1, '', 0" );
951 ok( r == ERROR_SUCCESS, "cannot add TestFeature to Feature table: %d\n", r );
952
953 r = create_feature_components_table( hdb );
954 ok( r == S_OK, "cannot create FeatureComponents table: %d\n", r );
955
956 r = add_feature_components_entry( hdb, "'TestFeature', 'RootComp'" );
957 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
958
959 r = add_feature_components_entry( hdb, "'TestFeature', 'TestComp'" );
960 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
961
962 add_directory_entry( hdb, "'TestParent', 'TARGETDIR', 'TestParent'" );
963 add_directory_entry( hdb, "'TestDir', 'TestParent', 'TestDir'" );
964
965 r = create_file_table( hdb );
966 ok( r == S_OK, "cannot create File table: %d\n", r );
967
968 r = add_file_entry( hdb, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
969 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
970
971 r = add_file_entry( hdb, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
972 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
973
974 hpkg = package_from_db( hdb );
975 ok( hpkg, "failed to create package\n");
976
977 r = MsiDoAction( hpkg, "CostInitialize");
978 ok( r == ERROR_SUCCESS, "cost init failed\n");
979
980 r = MsiDoAction( hpkg, "FileCost");
981 ok( r == ERROR_SUCCESS, "file cost failed\n");
982
983 r = MsiDoAction( hpkg, "CostFinalize");
984 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
985
986 r = MsiSetTargetPath( 0, NULL, NULL );
987 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
988
989 r = MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
990 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
991
992 r = MsiSetTargetPath( hpkg, "boo", NULL );
993 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
994
995 r = MsiSetTargetPath( hpkg, "boo", "c:\\bogusx" );
996 ok( r == ERROR_DIRECTORY, "wrong return val\n");
997
998 sz = sizeof tempdir - 1;
999 r = MsiGetTargetPath( hpkg, "TARGETDIR", tempdir, &sz );
1000 sprintf( file, "%srootfile.txt", tempdir );
1001 buffer[0] = 0;
1002 query_file_path( hpkg, "[#RootFile]", buffer );
1003 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1004 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer );
1005
1006 GetTempFileName( tempdir, "_wt", 0, buffer );
1007 sprintf( tempdir, "%s\\subdir", buffer );
1008
1009 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1010 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1011 "MsiSetTargetPath on file returned %d\n", r );
1012
1013 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1014 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1015 "MsiSetTargetPath on 'subdir' of file returned %d\n", r );
1016
1017 DeleteFile( buffer );
1018
1019 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1020 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1021
1022 r = GetFileAttributes( buffer );
1023 ok ( r == INVALID_FILE_ATTRIBUTES, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r );
1024
1025 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1026 ok( r == ERROR_SUCCESS, "MsiSetTargetPath on subsubdir returned %d\n", r );
1027
1028 sz = sizeof buffer - 1;
1029 lstrcat( tempdir, "\\" );
1030 r = MsiGetTargetPath( hpkg, "TARGETDIR", buffer, &sz );
1031 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1032 ok( !lstrcmp(buffer, tempdir), "Expected %s, got %s\n", tempdir, buffer);
1033
1034 sprintf( file, "%srootfile.txt", tempdir );
1035 query_file_path( hpkg, "[#RootFile]", buffer );
1036 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer);
1037
1038 r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two" );
1039 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1040
1041 query_file_path( hpkg, "[#TestFile]", buffer );
1042 ok( !lstrcmpi(buffer, "C:\\one\\two\\TestDir\\testfile.txt"),
1043 "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer );
1044
1045 sz = sizeof buffer - 1;
1046 r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
1047 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1048 ok( !lstrcmpi(buffer, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer);
1049
1050 MsiCloseHandle( hpkg );
1051 }
1052
1053 static void test_condition(void)
1054 {
1055 MSICONDITION r;
1056 MSIHANDLE hpkg;
1057
1058 hpkg = package_from_db(create_package_db());
1059 ok( hpkg, "failed to create package\n");
1060
1061 r = MsiEvaluateCondition(0, NULL);
1062 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1063
1064 r = MsiEvaluateCondition(hpkg, NULL);
1065 ok( r == MSICONDITION_NONE, "wrong return val\n");
1066
1067 r = MsiEvaluateCondition(hpkg, "");
1068 ok( r == MSICONDITION_NONE, "wrong return val\n");
1069
1070 r = MsiEvaluateCondition(hpkg, "1");
1071 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1072
1073 r = MsiEvaluateCondition(hpkg, "0");
1074 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1075
1076 r = MsiEvaluateCondition(hpkg, "-1");
1077 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1078
1079 r = MsiEvaluateCondition(hpkg, "0 = 0");
1080 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1081
1082 r = MsiEvaluateCondition(hpkg, "0 <> 0");
1083 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1084
1085 r = MsiEvaluateCondition(hpkg, "0 = 1");
1086 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1087
1088 r = MsiEvaluateCondition(hpkg, "0 > 1");
1089 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1090
1091 r = MsiEvaluateCondition(hpkg, "0 ~> 1");
1092 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1093
1094 r = MsiEvaluateCondition(hpkg, "1 > 1");
1095 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1096
1097 r = MsiEvaluateCondition(hpkg, "1 ~> 1");
1098 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1099
1100 r = MsiEvaluateCondition(hpkg, "0 >= 1");
1101 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1102
1103 r = MsiEvaluateCondition(hpkg, "0 ~>= 1");
1104 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1105
1106 r = MsiEvaluateCondition(hpkg, "1 >= 1");
1107 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1108
1109 r = MsiEvaluateCondition(hpkg, "1 ~>= 1");
1110 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1111
1112 r = MsiEvaluateCondition(hpkg, "0 < 1");
1113 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1114
1115 r = MsiEvaluateCondition(hpkg, "0 ~< 1");
1116 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1117
1118 r = MsiEvaluateCondition(hpkg, "1 < 1");
1119 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1120
1121 r = MsiEvaluateCondition(hpkg, "1 ~< 1");
1122 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1123
1124 r = MsiEvaluateCondition(hpkg, "0 <= 1");
1125 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1126
1127 r = MsiEvaluateCondition(hpkg, "0 ~<= 1");
1128 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1129
1130 r = MsiEvaluateCondition(hpkg, "1 <= 1");
1131 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1132
1133 r = MsiEvaluateCondition(hpkg, "1 ~<= 1");
1134 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1135
1136 r = MsiEvaluateCondition(hpkg, "0 >=");
1137 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1138
1139 r = MsiEvaluateCondition(hpkg, " ");
1140 ok( r == MSICONDITION_NONE, "wrong return val\n");
1141
1142 r = MsiEvaluateCondition(hpkg, "LicView <> \"1\"");
1143 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1144
1145 r = MsiEvaluateCondition(hpkg, "LicView <> \"0\"");
1146 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1147
1148 r = MsiEvaluateCondition(hpkg, "LicView <> LicView");
1149 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1150
1151 r = MsiEvaluateCondition(hpkg, "not 0");
1152 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1153
1154 r = MsiEvaluateCondition(hpkg, "not LicView");
1155 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1156
1157 r = MsiEvaluateCondition(hpkg, "\"Testing\" ~<< \"Testing\"");
1158 ok (r == MSICONDITION_TRUE, "wrong return val\n");
1159
1160 r = MsiEvaluateCondition(hpkg, "LicView ~<< \"Testing\"");
1161 ok (r == MSICONDITION_FALSE, "wrong return val\n");
1162
1163 r = MsiEvaluateCondition(hpkg, "Not LicView ~<< \"Testing\"");
1164 ok (r == MSICONDITION_TRUE, "wrong return val\n");
1165
1166 r = MsiEvaluateCondition(hpkg, "not \"A\"");
1167 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1168
1169 r = MsiEvaluateCondition(hpkg, "~not \"A\"");
1170 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1171
1172 r = MsiEvaluateCondition(hpkg, "\"0\"");
1173 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1174
1175 r = MsiEvaluateCondition(hpkg, "1 and 2");
1176 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1177
1178 r = MsiEvaluateCondition(hpkg, "not 0 and 3");
1179 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1180
1181 r = MsiEvaluateCondition(hpkg, "not 0 and 0");
1182 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1183
1184 r = MsiEvaluateCondition(hpkg, "not 0 or 1");
1185 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1186
1187 r = MsiEvaluateCondition(hpkg, "(0)");
1188 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1189
1190 r = MsiEvaluateCondition(hpkg, "(((((1))))))");
1191 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1192
1193 r = MsiEvaluateCondition(hpkg, "(((((1)))))");
1194 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1195
1196 r = MsiEvaluateCondition(hpkg, " \"A\" < \"B\" ");
1197 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1198
1199 r = MsiEvaluateCondition(hpkg, " \"A\" > \"B\" ");
1200 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1201
1202 r = MsiEvaluateCondition(hpkg, " \"1\" > \"12\" ");
1203 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1204
1205 r = MsiEvaluateCondition(hpkg, " \"100\" < \"21\" ");
1206 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1207
1208 r = MsiEvaluateCondition(hpkg, "0 < > 0");
1209 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1210
1211 r = MsiEvaluateCondition(hpkg, "(1<<1) == 2");
1212 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1213
1214 r = MsiEvaluateCondition(hpkg, " \"A\" = \"a\" ");
1215 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1216
1217 r = MsiEvaluateCondition(hpkg, " \"A\" ~ = \"a\" ");
1218 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1219
1220 r = MsiEvaluateCondition(hpkg, " \"A\" ~= \"a\" ");
1221 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1222
1223 r = MsiEvaluateCondition(hpkg, " \"A\" ~= 1 ");
1224 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1225
1226 r = MsiEvaluateCondition(hpkg, " \"A\" = 1 ");
1227 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1228
1229 r = MsiEvaluateCondition(hpkg, " 1 ~= 1 ");
1230 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1231
1232 r = MsiEvaluateCondition(hpkg, " 1 ~= \"1\" ");
1233 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1234
1235 r = MsiEvaluateCondition(hpkg, " 1 = \"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, " 0 < \"100\" ");
1242 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1243
1244 r = MsiEvaluateCondition(hpkg, " 100 > \"0\" ");
1245 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1246
1247 r = MsiEvaluateCondition(hpkg, "1 XOR 1");
1248 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1249
1250 r = MsiEvaluateCondition(hpkg, "1 IMP 1");
1251 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1252
1253 r = MsiEvaluateCondition(hpkg, "1 IMP 0");
1254 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1255
1256 r = MsiEvaluateCondition(hpkg, "0 IMP 0");
1257 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1258
1259 r = MsiEvaluateCondition(hpkg, "0 EQV 0");
1260 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1261
1262 r = MsiEvaluateCondition(hpkg, "0 EQV 1");
1263 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1264
1265 r = MsiEvaluateCondition(hpkg, "1 IMP 1 OR 0");
1266 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1267
1268 r = MsiEvaluateCondition(hpkg, "1 IMPL 1");
1269 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1270
1271 r = MsiEvaluateCondition(hpkg, "\"ASFD\" >< \"S\" ");
1272 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1273
1274 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"s\" ");
1275 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1276
1277 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"\" ");
1278 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1279
1280 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"sss\" ");
1281 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1282
1283 MsiSetProperty(hpkg, "mm", "5" );
1284
1285 r = MsiEvaluateCondition(hpkg, "mm = 5");
1286 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1287
1288 r = MsiEvaluateCondition(hpkg, "mm < 6");
1289 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1290
1291 r = MsiEvaluateCondition(hpkg, "mm <= 5");
1292 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1293
1294 r = MsiEvaluateCondition(hpkg, "mm > 4");
1295 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1296
1297 r = MsiEvaluateCondition(hpkg, "mm < 12");
1298 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1299
1300 r = MsiEvaluateCondition(hpkg, "mm = \"5\"");
1301 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1302
1303 r = MsiEvaluateCondition(hpkg, "0 = \"\"");
1304 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1305
1306 r = MsiEvaluateCondition(hpkg, "0 AND \"\"");
1307 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1308
1309 r = MsiEvaluateCondition(hpkg, "1 AND \"\"");
1310 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1311
1312 r = MsiEvaluateCondition(hpkg, "1 AND \"1\"");
1313 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1314
1315 r = MsiEvaluateCondition(hpkg, "3 >< 1");
1316 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1317
1318 r = MsiEvaluateCondition(hpkg, "3 >< 4");
1319 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1320
1321 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 0");
1322 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1323
1324 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1");
1325 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1326
1327 r = MsiEvaluateCondition(hpkg, "NOT 1 OR 0");
1328 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1329
1330 r = MsiEvaluateCondition(hpkg, "0 AND 1 OR 1");
1331 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1332
1333 r = MsiEvaluateCondition(hpkg, "0 AND 0 OR 1");
1334 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1335
1336 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1 OR 0");
1337 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1338
1339 r = MsiEvaluateCondition(hpkg, "_1 = _1");
1340 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1341
1342 r = MsiEvaluateCondition(hpkg, "( 1 AND 1 ) = 2");
1343 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1344
1345 r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
1346 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1347
1348 r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1349 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1350
1351 r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
1352 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1353
1354 r = MsiEvaluateCondition(hpkg, "NOT 1 AND 0");
1355 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1356
1357 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1358 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1359
1360 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1361 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1362
1363 r = MsiEvaluateCondition(hpkg, "bandalmael<0");
1364 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1365
1366 r = MsiEvaluateCondition(hpkg, "bandalmael>0");
1367 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1368
1369 r = MsiEvaluateCondition(hpkg, "bandalmael>=0");
1370 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1371
1372 r = MsiEvaluateCondition(hpkg, "bandalmael<=0");
1373 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1374
1375 r = MsiEvaluateCondition(hpkg, "bandalmael~<>0");
1376 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1377
1378 MsiSetProperty(hpkg, "bandalmael", "0" );
1379 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1380 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1381
1382 MsiSetProperty(hpkg, "bandalmael", "" );
1383 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1384 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1385
1386 MsiSetProperty(hpkg, "bandalmael", "asdf" );
1387 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1388 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1389
1390 MsiSetProperty(hpkg, "bandalmael", "0asdf" );
1391 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1392 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1393
1394 MsiSetProperty(hpkg, "bandalmael", "0 " );
1395 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1396 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1397
1398 MsiSetProperty(hpkg, "bandalmael", "-0" );
1399 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1400 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1401
1402 MsiSetProperty(hpkg, "bandalmael", "0000000000000" );
1403 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1404 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1405
1406 MsiSetProperty(hpkg, "bandalmael", "--0" );
1407 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1408 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1409
1410 MsiSetProperty(hpkg, "bandalmael", "0x00" );
1411 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1412 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1413
1414 MsiSetProperty(hpkg, "bandalmael", "-" );
1415 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1416 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1417
1418 MsiSetProperty(hpkg, "bandalmael", "+0" );
1419 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1420 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1421
1422 MsiSetProperty(hpkg, "bandalmael", "0.0" );
1423 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1424 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1425 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1426 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1427
1428 MsiSetProperty(hpkg, "one", "hi");
1429 MsiSetProperty(hpkg, "two", "hithere");
1430 r = MsiEvaluateCondition(hpkg, "one >< two");
1431 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1432
1433 MsiSetProperty(hpkg, "one", "hithere");
1434 MsiSetProperty(hpkg, "two", "hi");
1435 r = MsiEvaluateCondition(hpkg, "one >< two");
1436 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1437
1438 MsiSetProperty(hpkg, "one", "hello");
1439 MsiSetProperty(hpkg, "two", "hi");
1440 r = MsiEvaluateCondition(hpkg, "one >< two");
1441 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1442
1443 MsiSetProperty(hpkg, "one", "hellohithere");
1444 MsiSetProperty(hpkg, "two", "hi");
1445 r = MsiEvaluateCondition(hpkg, "one >< two");
1446 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1447
1448 MsiSetProperty(hpkg, "one", "");
1449 MsiSetProperty(hpkg, "two", "hi");
1450 r = MsiEvaluateCondition(hpkg, "one >< two");
1451 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1452
1453 MsiSetProperty(hpkg, "one", "hi");
1454 MsiSetProperty(hpkg, "two", "");
1455 r = MsiEvaluateCondition(hpkg, "one >< two");
1456 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1457
1458 MsiSetProperty(hpkg, "one", "");
1459 MsiSetProperty(hpkg, "two", "");
1460 r = MsiEvaluateCondition(hpkg, "one >< two");
1461 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1462
1463 MsiSetProperty(hpkg, "one", "1234");
1464 MsiSetProperty(hpkg, "two", "1");
1465 r = MsiEvaluateCondition(hpkg, "one >< two");
1466 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1467
1468 MsiSetProperty(hpkg, "one", "one 1234");
1469 MsiSetProperty(hpkg, "two", "1");
1470 r = MsiEvaluateCondition(hpkg, "one >< two");
1471 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1472
1473 MsiSetProperty(hpkg, "one", "hithere");
1474 MsiSetProperty(hpkg, "two", "hi");
1475 r = MsiEvaluateCondition(hpkg, "one << two");
1476 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1477
1478 MsiSetProperty(hpkg, "one", "hi");
1479 MsiSetProperty(hpkg, "two", "hithere");
1480 r = MsiEvaluateCondition(hpkg, "one << two");
1481 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1482
1483 MsiSetProperty(hpkg, "one", "hi");
1484 MsiSetProperty(hpkg, "two", "hi");
1485 r = MsiEvaluateCondition(hpkg, "one << two");
1486 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1487
1488 MsiSetProperty(hpkg, "one", "abcdhithere");
1489 MsiSetProperty(hpkg, "two", "hi");
1490 r = MsiEvaluateCondition(hpkg, "one << two");
1491 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1492
1493 MsiSetProperty(hpkg, "one", "");
1494 MsiSetProperty(hpkg, "two", "hi");
1495 r = MsiEvaluateCondition(hpkg, "one << two");
1496 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1497
1498 MsiSetProperty(hpkg, "one", "hithere");
1499 MsiSetProperty(hpkg, "two", "");
1500 r = MsiEvaluateCondition(hpkg, "one << two");
1501 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1502
1503 MsiSetProperty(hpkg, "one", "");
1504 MsiSetProperty(hpkg, "two", "");
1505 r = MsiEvaluateCondition(hpkg, "one << two");
1506 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1507
1508 MsiSetProperty(hpkg, "one", "1234");
1509 MsiSetProperty(hpkg, "two", "1");
1510 r = MsiEvaluateCondition(hpkg, "one << two");
1511 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1512
1513 MsiSetProperty(hpkg, "one", "1234 one");
1514 MsiSetProperty(hpkg, "two", "1");
1515 r = MsiEvaluateCondition(hpkg, "one << two");
1516 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1517
1518 MsiSetProperty(hpkg, "one", "hithere");
1519 MsiSetProperty(hpkg, "two", "there");
1520 r = MsiEvaluateCondition(hpkg, "one >> two");
1521 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1522
1523 MsiSetProperty(hpkg, "one", "hithere");
1524 MsiSetProperty(hpkg, "two", "hi");
1525 r = MsiEvaluateCondition(hpkg, "one >> two");
1526 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1527
1528 MsiSetProperty(hpkg, "one", "there");
1529 MsiSetProperty(hpkg, "two", "hithere");
1530 r = MsiEvaluateCondition(hpkg, "one >> two");
1531 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1532
1533 MsiSetProperty(hpkg, "one", "there");
1534 MsiSetProperty(hpkg, "two", "there");
1535 r = MsiEvaluateCondition(hpkg, "one >> two");
1536 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1537
1538 MsiSetProperty(hpkg, "one", "abcdhithere");
1539 MsiSetProperty(hpkg, "two", "hi");
1540 r = MsiEvaluateCondition(hpkg, "one >> two");
1541 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1542
1543 MsiSetProperty(hpkg, "one", "");
1544 MsiSetProperty(hpkg, "two", "there");
1545 r = MsiEvaluateCondition(hpkg, "one >> two");
1546 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1547
1548 MsiSetProperty(hpkg, "one", "there");
1549 MsiSetProperty(hpkg, "two", "");
1550 r = MsiEvaluateCondition(hpkg, "one >> two");
1551 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1552
1553 MsiSetProperty(hpkg, "one", "");
1554 MsiSetProperty(hpkg, "two", "");
1555 r = MsiEvaluateCondition(hpkg, "one >> two");
1556 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1557
1558 MsiSetProperty(hpkg, "one", "1234");
1559 MsiSetProperty(hpkg, "two", "4");
1560 r = MsiEvaluateCondition(hpkg, "one >> two");
1561 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1562
1563 MsiSetProperty(hpkg, "one", "one 1234");
1564 MsiSetProperty(hpkg, "two", "4");
1565 r = MsiEvaluateCondition(hpkg, "one >> two");
1566 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1567
1568 MsiSetProperty(hpkg, "MsiNetAssemblySupport", NULL); /* make sure it's empty */
1569
1570 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1571 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1572
1573 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport > \"1.1.4322\"");
1574 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1575
1576 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport >= \"1.1.4322\"");
1577 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1578
1579 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <= \"1.1.4322\"");
1580 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1581
1582 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <> \"1.1.4322\"");
1583 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1584
1585 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1586 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1587
1588 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"abcd\"");
1589 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1590
1591 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a1.1.4322\"");
1592 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1593
1594 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322a\"");
1595 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1596
1597 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1598 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1599
1600 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1601 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1602
1603 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1604 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1605
1606 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1");
1607 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1608
1609 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1\"");
1610 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1611
1612 r = MsiEvaluateCondition(hpkg, "\"2\" < \"12.1\"");
1613 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1614
1615 r = MsiEvaluateCondition(hpkg, "\"02.1\" < \"2.11\"");
1616 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1617
1618 r = MsiEvaluateCondition(hpkg, "\"02.1.1\" < \"2.1\"");
1619 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1620
1621 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1622 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1623
1624 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1625 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1626
1627 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0\"");
1628 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1629
1630 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"-1\"");
1631 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1632
1633 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a\"");
1634 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1635
1636 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1637 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1638
1639 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1640 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1641
1642 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"/\"");
1643 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1644
1645 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \" \"");
1646 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1647
1648 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"azAZ_\"");
1649 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1650
1651 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]\"");
1652 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1653
1654 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]a\"");
1655 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1656
1657 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]\"");
1658 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1659
1660 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]a\"");
1661 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1662
1663 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a}\"");
1664 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1665
1666 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a\"");
1667 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1668
1669 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a\"");
1670 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1671
1672 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a{\"");
1673 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1674
1675 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a]\"");
1676 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1677
1678 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"A\"");
1679 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1680
1681 MsiSetProperty(hpkg, "MsiNetAssemblySupport", "1.1.4322");
1682 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1683 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1684
1685 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.14322\"");
1686 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1687
1688 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.5\"");
1689 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1690
1691 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1692 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1693
1694 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1695 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1696
1697 MsiSetProperty(hpkg, "one", "1");
1698 r = MsiEvaluateCondition(hpkg, "one < \"1\"");
1699 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1700
1701 MsiSetProperty(hpkg, "X", "5.0");
1702
1703 r = MsiEvaluateCondition(hpkg, "X != \"\"");
1704 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1705
1706 r = MsiEvaluateCondition(hpkg, "X =\"5.0\"");
1707 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1708
1709 r = MsiEvaluateCondition(hpkg, "X =\"5.1\"");
1710 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1711
1712 r = MsiEvaluateCondition(hpkg, "X =\"6.0\"");
1713 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1714
1715 r = MsiEvaluateCondition(hpkg, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1716 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1717
1718 r = MsiEvaluateCondition(hpkg, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1719 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1720
1721 r = MsiEvaluateCondition(hpkg, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1722 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1723
1724 /* feature doesn't exist */
1725 r = MsiEvaluateCondition(hpkg, "&nofeature");
1726 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1727
1728 MsiSetProperty(hpkg, "A", "2");
1729 MsiSetProperty(hpkg, "X", "50");
1730
1731 r = MsiEvaluateCondition(hpkg, "2 <= X");
1732 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1733
1734 r = MsiEvaluateCondition(hpkg, "A <= X");
1735 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1736
1737 r = MsiEvaluateCondition(hpkg, "A <= 50");
1738 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1739
1740 MsiSetProperty(hpkg, "X", "50val");
1741
1742 r = MsiEvaluateCondition(hpkg, "2 <= X");
1743 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1744
1745 r = MsiEvaluateCondition(hpkg, "A <= X");
1746 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1747
1748 MsiSetProperty(hpkg, "A", "7");
1749 MsiSetProperty(hpkg, "X", "50");
1750
1751 r = MsiEvaluateCondition(hpkg, "7 <= X");
1752 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1753
1754 r = MsiEvaluateCondition(hpkg, "A <= X");
1755 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1756
1757 r = MsiEvaluateCondition(hpkg, "A <= 50");
1758 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1759
1760 MsiSetProperty(hpkg, "X", "50val");
1761
1762 r = MsiEvaluateCondition(hpkg, "2 <= X");
1763 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1764
1765 r = MsiEvaluateCondition(hpkg, "A <= X");
1766 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1767
1768 MsiCloseHandle( hpkg );
1769 DeleteFile(msifile);
1770 }
1771
1772 static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop)
1773 {
1774 UINT r;
1775 DWORD sz;
1776 char buffer[2];
1777
1778 sz = sizeof buffer;
1779 strcpy(buffer,"x");
1780 r = MsiGetProperty( hpkg, prop, buffer, &sz );
1781 return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
1782 }
1783
1784 static void test_props(void)
1785 {
1786 MSIHANDLE hpkg, hdb;
1787 UINT r;
1788 DWORD sz;
1789 char buffer[0x100];
1790
1791 hdb = create_package_db();
1792 r = run_query( hdb,
1793 "CREATE TABLE `Property` ( "
1794 "`Property` CHAR(255) NOT NULL, "
1795 "`Value` CHAR(255) "
1796 "PRIMARY KEY `Property`)" );
1797 ok( r == ERROR_SUCCESS , "Failed\n" );
1798
1799 r = run_query(hdb,
1800 "INSERT INTO `Property` "
1801 "(`Property`, `Value`) "
1802 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1803 ok( r == ERROR_SUCCESS , "Failed\n" );
1804
1805 hpkg = package_from_db( hdb );
1806 ok( hpkg, "failed to create package\n");
1807
1808 /* test invalid values */
1809 r = MsiGetProperty( 0, NULL, NULL, NULL );
1810 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1811
1812 r = MsiGetProperty( hpkg, NULL, NULL, NULL );
1813 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1814
1815 r = MsiGetProperty( hpkg, "boo", NULL, NULL );
1816 ok( r == ERROR_SUCCESS, "wrong return val\n");
1817
1818 r = MsiGetProperty( hpkg, "boo", buffer, NULL );
1819 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1820
1821 /* test retrieving an empty/nonexistent property */
1822 sz = sizeof buffer;
1823 r = MsiGetProperty( hpkg, "boo", NULL, &sz );
1824 ok( r == ERROR_SUCCESS, "wrong return val\n");
1825 ok( sz == 0, "wrong size returned\n");
1826
1827 check_prop_empty( hpkg, "boo");
1828 sz = 0;
1829 strcpy(buffer,"x");
1830 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1831 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1832 ok( !strcmp(buffer,"x"), "buffer was changed\n");
1833 ok( sz == 0, "wrong size returned\n");
1834
1835 sz = 1;
1836 strcpy(buffer,"x");
1837 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1838 ok( r == ERROR_SUCCESS, "wrong return val\n");
1839 ok( buffer[0] == 0, "buffer was not changed\n");
1840 ok( sz == 0, "wrong size returned\n");
1841
1842 /* set the property to something */
1843 r = MsiSetProperty( 0, NULL, NULL );
1844 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1845
1846 r = MsiSetProperty( hpkg, NULL, NULL );
1847 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1848
1849 r = MsiSetProperty( hpkg, "", NULL );
1850 ok( r == ERROR_SUCCESS, "wrong return val\n");
1851
1852 /* try set and get some illegal property identifiers */
1853 r = MsiSetProperty( hpkg, "", "asdf" );
1854 ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n");
1855
1856 r = MsiSetProperty( hpkg, "=", "asdf" );
1857 ok( r == ERROR_SUCCESS, "wrong return val\n");
1858
1859 r = MsiSetProperty( hpkg, " ", "asdf" );
1860 ok( r == ERROR_SUCCESS, "wrong return val\n");
1861
1862 r = MsiSetProperty( hpkg, "'", "asdf" );
1863 ok( r == ERROR_SUCCESS, "wrong return val\n");
1864
1865 sz = sizeof buffer;
1866 buffer[0]=0;
1867 r = MsiGetProperty( hpkg, "'", buffer, &sz );
1868 ok( r == ERROR_SUCCESS, "wrong return val\n");
1869 ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
1870
1871 /* set empty values */
1872 r = MsiSetProperty( hpkg, "boo", NULL );
1873 ok( r == ERROR_SUCCESS, "wrong return val\n");
1874 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1875
1876 r = MsiSetProperty( hpkg, "boo", "" );
1877 ok( r == ERROR_SUCCESS, "wrong return val\n");
1878 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1879
1880 /* set a non-empty value */
1881 r = MsiSetProperty( hpkg, "boo", "xyz" );
1882 ok( r == ERROR_SUCCESS, "wrong return val\n");
1883
1884 sz = 1;
1885 strcpy(buffer,"x");
1886 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1887 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1888 ok( buffer[0] == 0, "buffer was not changed\n");
1889 ok( sz == 3, "wrong size returned\n");
1890
1891 sz = 4;
1892 strcpy(buffer,"x");
1893 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1894 ok( r == ERROR_SUCCESS, "wrong return val\n");
1895 ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
1896 ok( sz == 3, "wrong size returned\n");
1897
1898 sz = 3;
1899 strcpy(buffer,"x");
1900 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1901 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1902 ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
1903 ok( sz == 3, "wrong size returned\n");
1904
1905 r = MsiSetProperty(hpkg, "SourceDir", "foo");
1906 ok( r == ERROR_SUCCESS, "wrong return val\n");
1907
1908 sz = 4;
1909 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
1910 ok( r == ERROR_SUCCESS, "wrong return val\n");
1911 ok( !strcmp(buffer,""), "buffer wrong\n");
1912 ok( sz == 0, "wrong size returned\n");
1913
1914 sz = 4;
1915 r = MsiGetProperty(hpkg, "SOMERANDOMNAME", buffer, &sz);
1916 ok( r == ERROR_SUCCESS, "wrong return val\n");
1917 ok( !strcmp(buffer,""), "buffer wrong\n");
1918 ok( sz == 0, "wrong size returned\n");
1919
1920 sz = 4;
1921 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
1922 ok( r == ERROR_SUCCESS, "wrong return val\n");
1923 ok( !strcmp(buffer,"foo"), "buffer wrong\n");
1924 ok( sz == 3, "wrong size returned\n");
1925
1926 r = MsiSetProperty(hpkg, "MetadataCompName", "Photoshop.dll");
1927 ok( r == ERROR_SUCCESS, "wrong return val\n");
1928
1929 sz = 0;
1930 r = MsiGetProperty(hpkg, "MetadataCompName", NULL, &sz );
1931 ok( r == ERROR_SUCCESS, "return wrong\n");
1932 ok( sz == 13, "size wrong (%d)\n", sz);
1933
1934 sz = 13;
1935 r = MsiGetProperty(hpkg, "MetadataCompName", buffer, &sz );
1936 ok( r == ERROR_MORE_DATA, "return wrong\n");
1937 ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n");
1938
1939 r = MsiSetProperty(hpkg, "property", "value");
1940 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1941
1942 sz = 6;
1943 r = MsiGetProperty(hpkg, "property", buffer, &sz);
1944 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1945 ok( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer);
1946
1947 r = MsiSetProperty(hpkg, "property", NULL);
1948 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1949
1950 sz = 6;
1951 r = MsiGetProperty(hpkg, "property", buffer, &sz);
1952 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1953 ok( !strlen(buffer), "Expected empty string, got %s\n", buffer);
1954
1955 MsiCloseHandle( hpkg );
1956 DeleteFile(msifile);
1957 }
1958
1959 static BOOL find_prop_in_property(MSIHANDLE hdb, LPCSTR prop, LPCSTR val)
1960 {
1961 MSIHANDLE hview, hrec;
1962 BOOL found;
1963 CHAR buffer[MAX_PATH];
1964 DWORD sz;
1965 UINT r;
1966
1967 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
1968 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
1969 r = MsiViewExecute(hview, 0);
1970 ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
1971
1972 found = FALSE;
1973 while (r == ERROR_SUCCESS && !found)
1974 {
1975 r = MsiViewFetch(hview, &hrec);
1976 if (r != ERROR_SUCCESS) break;
1977
1978 sz = MAX_PATH;
1979 r = MsiRecordGetString(hrec, 1, buffer, &sz);
1980 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
1981 {
1982 sz = MAX_PATH;
1983 r = MsiRecordGetString(hrec, 2, buffer, &sz);
1984 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, val))
1985 found = TRUE;
1986 }
1987
1988 MsiCloseHandle(hrec);
1989 }
1990
1991 MsiViewClose(hview);
1992 MsiCloseHandle(hview);
1993
1994 return found;
1995 }
1996
1997 static void test_property_table(void)
1998 {
1999 const char *query;
2000 UINT r;
2001 MSIHANDLE hpkg, hdb, hrec;
2002 char buffer[MAX_PATH];
2003 DWORD sz;
2004 BOOL found;
2005
2006 hdb = create_package_db();
2007 ok( hdb, "failed to create package\n");
2008
2009 hpkg = package_from_db(hdb);
2010 ok( hpkg, "failed to create package\n");
2011
2012 MsiCloseHandle(hdb);
2013
2014 hdb = MsiGetActiveDatabase(hpkg);
2015
2016 query = "CREATE TABLE `_Property` ( "
2017 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2018 r = run_query(hdb, query);
2019 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2020
2021 MsiCloseHandle(hdb);
2022 MsiCloseHandle(hpkg);
2023 DeleteFile(msifile);
2024
2025 hdb = create_package_db();
2026 ok( hdb, "failed to create package\n");
2027
2028 query = "CREATE TABLE `_Property` ( "
2029 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2030 r = run_query(hdb, query);
2031 ok(r == ERROR_SUCCESS, "failed to create table\n");
2032
2033 query = "ALTER `_Property` ADD `foo` INTEGER";
2034 r = run_query(hdb, query);
2035 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2036
2037 query = "ALTER TABLE `_Property` ADD `foo` INTEGER";
2038 r = run_query(hdb, query);
2039 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2040
2041 query = "ALTER TABLE `_Property` ADD `extra` INTEGER";
2042 r = run_query(hdb, query);
2043 ok(r == ERROR_SUCCESS, "failed to add column\n");
2044
2045 hpkg = package_from_db(hdb);
2046 todo_wine
2047 {
2048 ok(!hpkg, "package should not be created\n");
2049 }
2050
2051 MsiCloseHandle(hdb);
2052 MsiCloseHandle(hpkg);
2053 DeleteFile(msifile);
2054
2055 hdb = create_package_db();
2056 ok (hdb, "failed to create package database\n");
2057
2058 r = create_property_table(hdb);
2059 ok(r == ERROR_SUCCESS, "cannot create Property table: %d\n", r);
2060
2061 r = add_property_entry(hdb, "'prop', 'val'");
2062 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2063
2064 hpkg = package_from_db(hdb);
2065 ok(hpkg, "failed to create package\n");
2066
2067 MsiCloseHandle(hdb);
2068
2069 sz = MAX_PATH;
2070 r = MsiGetProperty(hpkg, "prop", buffer, &sz);
2071 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2072 ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
2073
2074 hdb = MsiGetActiveDatabase(hpkg);
2075
2076 found = find_prop_in_property(hdb, "prop", "val");
2077 ok(found, "prop should be in the _Property table\n");
2078
2079 r = add_property_entry(hdb, "'dantes', 'mercedes'");
2080 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2081
2082 query = "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
2083 r = do_query(hdb, query, &hrec);
2084 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2085
2086 found = find_prop_in_property(hdb, "dantes", "mercedes");
2087 ok(found == FALSE, "dantes should not be in the _Property table\n");
2088
2089 sz = MAX_PATH;
2090 lstrcpy(buffer, "aaa");
2091 r = MsiGetProperty(hpkg, "dantes", buffer, &sz);
2092 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2093 ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer);
2094
2095 r = MsiSetProperty(hpkg, "dantes", "mercedes");
2096 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2097
2098 found = find_prop_in_property(hdb, "dantes", "mercedes");
2099 ok(found == TRUE, "dantes should be in the _Property table\n");
2100
2101 MsiCloseHandle(hdb);
2102 MsiCloseHandle(hpkg);
2103 DeleteFile(msifile);
2104 }
2105
2106 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
2107 {
2108 MSIHANDLE htab = 0;
2109 UINT res;
2110
2111 res = MsiDatabaseOpenView( hdb, szQuery, &htab );
2112 if( res == ERROR_SUCCESS )
2113 {
2114 UINT r;
2115
2116 r = MsiViewExecute( htab, hrec );
2117 if( r != ERROR_SUCCESS )
2118 {
2119 res = r;
2120 fprintf(stderr,"MsiViewExecute failed %08x\n", res);
2121 }
2122
2123 r = MsiViewClose( htab );
2124 if( r != ERROR_SUCCESS )
2125 res = r;
2126
2127 r = MsiCloseHandle( htab );
2128 if( r != ERROR_SUCCESS )
2129 res = r;
2130 }
2131 return res;
2132 }
2133
2134 static UINT try_query( MSIHANDLE hdb, LPCSTR szQuery )
2135 {
2136 return try_query_param( hdb, szQuery, 0 );
2137 }
2138
2139 static void set_summary_str(MSIHANDLE hdb, DWORD pid, LPCSTR value)
2140 {
2141 MSIHANDLE summary;
2142 UINT r;
2143
2144 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2145 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2146
2147 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
2148 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2149
2150 r = MsiSummaryInfoPersist(summary);
2151 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2152
2153 MsiCloseHandle(summary);
2154 }
2155
2156 static void set_summary_dword(MSIHANDLE hdb, DWORD pid, DWORD value)
2157 {
2158 MSIHANDLE summary;
2159 UINT r;
2160
2161 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2162 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2163
2164 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_I4, value, NULL, NULL);
2165 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2166
2167 r = MsiSummaryInfoPersist(summary);
2168 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2169
2170 MsiCloseHandle(summary);
2171 }
2172
2173 static void test_msipackage(void)
2174 {
2175 MSIHANDLE hdb = 0, hpack = 100;
2176 UINT r;
2177 const char *query;
2178 char name[10];
2179
2180 /* NULL szPackagePath */
2181 r = MsiOpenPackage(NULL, &hpack);
2182 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2183
2184 /* empty szPackagePath */
2185 r = MsiOpenPackage("", &hpack);
2186 todo_wine
2187 {
2188 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2189 }
2190
2191 if (r == ERROR_SUCCESS)
2192 MsiCloseHandle(hpack);
2193
2194 /* nonexistent szPackagePath */
2195 r = MsiOpenPackage("nonexistent", &hpack);
2196 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2197
2198 /* NULL hProduct */
2199 r = MsiOpenPackage(msifile, NULL);
2200 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2201
2202 name[0]='#';
2203 name[1]=0;
2204 r = MsiOpenPackage(name, &hpack);
2205 ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r);
2206
2207 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2208 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2209
2210 /* database exists, but is emtpy */
2211 sprintf(name, "#%d", hdb);
2212 r = MsiOpenPackage(name, &hpack);
2213 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2214 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2215
2216 query = "CREATE TABLE `Property` ( "
2217 "`Property` CHAR(72), `Value` CHAR(0) "
2218 "PRIMARY KEY `Property`)";
2219 r = try_query(hdb, query);
2220 ok(r == ERROR_SUCCESS, "failed to create Properties table\n");
2221
2222 query = "CREATE TABLE `InstallExecuteSequence` ("
2223 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2224 "PRIMARY KEY `Action`)";
2225 r = try_query(hdb, query);
2226 ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n");
2227
2228 /* a few key tables exist */
2229 sprintf(name, "#%d", hdb);
2230 r = MsiOpenPackage(name, &hpack);
2231 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2232 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2233
2234 MsiCloseHandle(hdb);
2235 DeleteFile(msifile);
2236
2237 /* start with a clean database to show what constitutes a valid package */
2238 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2239 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2240
2241 sprintf(name, "#%d", hdb);
2242
2243 /* The following summary information props must exist:
2244 * - PID_REVNUMBER
2245 * - PID_PAGECOUNT
2246 */
2247
2248 set_summary_dword(hdb, PID_PAGECOUNT, 100);
2249 r = MsiOpenPackage(name, &hpack);
2250 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2251 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2252
2253 set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2254 r = MsiOpenPackage(name, &hpack);
2255 ok(r == ERROR_SUCCESS,
2256 "Expected ERROR_SUCCESS, got %d\n", r);
2257
2258 MsiCloseHandle(hpack);
2259 MsiCloseHandle(hdb);
2260 DeleteFile(msifile);
2261 }
2262
2263 static void test_formatrecord2(void)
2264 {
2265 MSIHANDLE hpkg, hrec ;
2266 char buffer[0x100];
2267 DWORD sz;
2268 UINT r;
2269
2270 hpkg = package_from_db(create_package_db());
2271 ok( hpkg, "failed to create package\n");
2272
2273 r = MsiSetProperty(hpkg, "Manufacturer", " " );
2274 ok( r == ERROR_SUCCESS, "set property failed\n");
2275
2276 hrec = MsiCreateRecord(2);
2277 ok(hrec, "create record failed\n");
2278
2279 r = MsiRecordSetString( hrec, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2280 ok( r == ERROR_SUCCESS, "format record failed\n");
2281
2282 buffer[0] = 0;
2283 sz = sizeof buffer;
2284 r = MsiFormatRecord( hpkg, hrec, buffer, &sz );
2285
2286 r = MsiRecordSetString(hrec, 0, "[foo][1]");
2287 r = MsiRecordSetString(hrec, 1, "hoo");
2288 sz = sizeof buffer;
2289 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2290 ok( sz == 3, "size wrong\n");
2291 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2292 ok( r == ERROR_SUCCESS, "format failed\n");
2293
2294 r = MsiRecordSetString(hrec, 0, "x[~]x");
2295 sz = sizeof buffer;
2296 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2297 ok( sz == 3, "size wrong\n");
2298 ok( 0 == strcmp(buffer,"x"), "wrong output %s\n",buffer);
2299 ok( r == ERROR_SUCCESS, "format failed\n");
2300
2301 r = MsiRecordSetString(hrec, 0, "[foo.$%}][1]");
2302 r = MsiRecordSetString(hrec, 1, "hoo");
2303 sz = sizeof buffer;
2304 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2305 ok( sz == 3, "size wrong\n");
2306 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2307 ok( r == ERROR_SUCCESS, "format failed\n");
2308
2309 r = MsiRecordSetString(hrec, 0, "[\\[]");
2310 sz = sizeof buffer;
2311 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2312 ok( sz == 1, "size wrong\n");
2313 ok( 0 == strcmp(buffer,"["), "wrong output %s\n",buffer);
2314 ok( r == ERROR_SUCCESS, "format failed\n");
2315
2316 SetEnvironmentVariable("FOO", "BAR");
2317 r = MsiRecordSetString(hrec, 0, "[%FOO]");
2318 sz = sizeof buffer;
2319 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2320 ok( sz == 3, "size wrong\n");
2321 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2322 ok( r == ERROR_SUCCESS, "format failed\n");
2323
2324 r = MsiRecordSetString(hrec, 0, "[[1]]");
2325 r = MsiRecordSetString(hrec, 1, "%FOO");
2326 sz = sizeof buffer;
2327 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2328 ok( sz == 3, "size wrong\n");
2329 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2330 ok( r == ERROR_SUCCESS, "format failed\n");
2331
2332 MsiCloseHandle( hrec );
2333 MsiCloseHandle( hpkg );
2334 DeleteFile(msifile);
2335 }
2336
2337 static void test_states(void)
2338 {
2339 MSIHANDLE hpkg;
2340 UINT r;
2341 MSIHANDLE hdb;
2342 INSTALLSTATE state, action;
2343
2344 static const CHAR msifile2[] = "winetest2.msi";
2345 static const CHAR msifile3[] = "winetest3.msi";
2346 static const CHAR msifile4[] = "winetest4.msi";
2347
2348 hdb = create_package_db();
2349 ok ( hdb, "failed to create package database\n" );
2350
2351 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
2352 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
2353
2354 r = create_property_table( hdb );
2355 ok( r == ERROR_SUCCESS, "cannot create Property table: %d\n", r );
2356
2357 r = add_property_entry( hdb, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2358 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2359
2360 r = add_property_entry( hdb, "'ProductLanguage', '1033'" );
2361 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2362
2363 r = add_property_entry( hdb, "'ProductName', 'MSITEST'" );
2364 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2365
2366 r = add_property_entry( hdb, "'ProductVersion', '1.1.1'" );
2367 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2368
2369 r = create_install_execute_sequence_table( hdb );
2370 ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table: %d\n", r );
2371
2372 r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
2373 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2374
2375 r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
2376 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2377
2378 r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
2379 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2380
2381 r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" );
2382 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2383
2384 r = add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" );
2385 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2386
2387 r = add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" );
2388 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2389
2390 r = add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" );
2391 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2392
2393 r = add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" );
2394 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2395
2396 r = add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" );
2397 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2398
2399 r = add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" );
2400 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2401
2402 r = add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" );
2403 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2404
2405 r = create_media_table( hdb );
2406 ok( r == ERROR_SUCCESS, "cannot create media table: %d\n", r );
2407
2408 r = add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''");
2409 ok( r == ERROR_SUCCESS, "cannot add media entry: %d\n", r );
2410
2411 r = create_feature_table( hdb );
2412 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
2413
2414 r = create_component_table( hdb );
2415 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
2416
2417 /* msidbFeatureAttributesFavorLocal */
2418 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
2419 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2420
2421 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2422 r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2423 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2424
2425 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2426 r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2427 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2428
2429 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2430 r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2431 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2432
2433 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2434 r = add_component_entry( hdb, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2435 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2436
2437 /* msidbFeatureAttributesFavorSource */
2438 r = add_feature_entry( hdb, "'two', '', '', '', 2, 1, '', 1" );
2439 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2440
2441 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2442 r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2443 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2444
2445 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2446 r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2447 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2448
2449 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2450 r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2451 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2452
2453 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2454 r = add_component_entry( hdb, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2455 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2456
2457 /* msidbFeatureAttributesFavorSource */
2458 r = add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" );
2459 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2460
2461 /* msidbFeatureAttributesFavorLocal */
2462 r = add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" );
2463 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2464
2465 /* disabled */
2466 r = add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" );
2467 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2468
2469 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2470 r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2471 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2472
2473 /* no feature parent:msidbComponentAttributesLocalOnly */
2474 r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2475 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2476
2477 /* msidbFeatureAttributesFavorLocal:removed */
2478 r = add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" );
2479 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2480
2481 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2482 r = add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2483 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2484
2485 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2486 r = add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2487 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2488
2489 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2490 r = add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2491 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2492
2493 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2494 r = add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2495 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2496
2497 /* msidbFeatureAttributesFavorSource:removed */
2498 r = add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" );
2499 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2500
2501 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2502 r = add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2503 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2504
2505 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2506 r = add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2507 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2508
2509 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2510 r = add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2511 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2512
2513 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2514 r = add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2515 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2516
2517 /* msidbFeatureAttributesFavorLocal */
2518 r = add_feature_entry( hdb, "'eight', '', '', '', 2, 1, '', 0" );
2519 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2520
2521 r = add_component_entry( hdb, "'tau', '{07DEB510-677C-4A6F-A0A6-7CD8EFEA77ED}', 'TARGETDIR', 1, '', 'tau_file'" );
2522 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2523
2524 /* msidbFeatureAttributesFavorSource */
2525 r = add_feature_entry( hdb, "'nine', '', '', '', 2, 1, '', 1" );
2526 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2527
2528 r = add_component_entry( hdb, "'phi', '{9F0594C5-35AD-43EA-94DD-8DF73FAA664D}', 'TARGETDIR', 1, '', 'phi_file'" );
2529 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2530
2531 /* msidbFeatureAttributesFavorAdvertise */
2532 r = add_feature_entry( hdb, "'ten', '', '', '', 2, 1, '', 4" );
2533 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2534
2535 r = add_component_entry( hdb, "'chi', '{E6B539AB-5DA9-4236-A2D2-E341A50B4C38}', 'TARGETDIR', 1, '', 'chi_file'" );
2536 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2537
2538 r = create_feature_components_table( hdb );
2539 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
2540
2541 r = add_feature_components_entry( hdb, "'one', 'alpha'" );
2542 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2543
2544 r = add_feature_components_entry( hdb, "'one', 'beta'" );
2545 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2546
2547 r = add_feature_components_entry( hdb, "'one', 'gamma'" );
2548 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2549
2550 r = add_feature_components_entry( hdb, "'one', 'theta'" );
2551 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2552
2553 r = add_feature_components_entry( hdb, "'two', 'delta'" );
2554 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2555
2556 r = add_feature_components_entry( hdb, "'two', 'epsilon'" );
2557 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2558
2559 r = add_feature_components_entry( hdb, "'two', 'zeta'" );
2560 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2561
2562 r = add_feature_components_entry( hdb, "'two', 'iota'" );
2563 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2564
2565 r = add_feature_components_entry( hdb, "'three', 'eta'" );
2566 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2567
2568 r = add_feature_components_entry( hdb, "'four', 'eta'" );
2569 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2570
2571 r = add_feature_components_entry( hdb, "'five', 'eta'" );
2572 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2573
2574 r = add_feature_components_entry( hdb, "'six', 'lambda'" );
2575 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2576
2577 r = add_feature_components_entry( hdb, "'six', 'mu'" );
2578 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2579
2580 r = add_feature_components_entry( hdb, "'six', 'nu'" );
2581 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2582
2583 r = add_feature_components_entry( hdb, "'six', 'xi'" );
2584 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2585
2586 r = add_feature_components_entry( hdb, "'seven', 'omicron'" );
2587 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2588
2589 r = add_feature_components_entry( hdb, "'seven', 'pi'" );
2590 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2591
2592 r = add_feature_components_entry( hdb, "'seven', 'rho'" );
2593 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2594
2595 r = add_feature_components_entry( hdb, "'seven', 'sigma'" );
2596 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2597
2598 r = add_feature_components_entry( hdb, "'eight', 'tau'" );
2599 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2600
2601 r = add_feature_components_entry( hdb, "'nine', 'phi'" );
2602 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2603
2604 r = add_feature_components_entry( hdb, "'ten', 'chi'" );
2605 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2606
2607 r = create_file_table( hdb );
2608 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
2609
2610 r = add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2611 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2612
2613 r = add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2614 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2615
2616 r = add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2617 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2618
2619 r = add_file_entry( hdb, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2620 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2621
2622 r = add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2623 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2624
2625 r = add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2626 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2627
2628 r = add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2629 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2630
2631 r = add_file_entry( hdb, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2632 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2633
2634 /* compressed file */
2635 r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2636 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2637
2638 r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2639 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2640
2641 r = add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2642 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2643
2644 r = add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2645 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2646
2647 r = add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2648 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2649
2650 r = add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2651 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2652
2653 r = add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2654 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2655
2656 r = add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2657 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2658
2659 r = add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2660 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2661
2662 r = add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2663 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2664
2665 r = add_file_entry( hdb, "'tau_file', 'tau', 'tau.txt', 100, '', '1033', 8192, 1" );
2666 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2667
2668 r = add_file_entry( hdb, "'phi_file', 'phi', 'phi.txt', 100, '', '1033', 8192, 1" );
2669 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2670
2671 r = add_file_entry( hdb, "'chi_file', 'chi', 'chi.txt', 100, '', '1033', 8192, 1" );
2672 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2673
2674 MsiDatabaseCommit(hdb);
2675
2676 /* these properties must not be in the saved msi file */
2677 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
2678 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2679
2680 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
2681 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2682
2683 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
2684 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2685
2686 r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
2687 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2688
2689 r = add_property_entry( hdb, "'REINSTALLMODE', 'omus'");
2690 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2691
2692 hpkg = package_from_db( hdb );
2693 ok( hpkg, "failed to create package\n");
2694
2695 MsiCloseHandle(hdb);
2696
2697 CopyFileA(msifile, msifile2, FALSE);
2698 CopyFileA(msifile, msifile3, FALSE);
2699 CopyFileA(msifile, msifile4, FALSE);
2700
2701 state = 0xdeadbee;
2702 action = 0xdeadbee;
2703 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2704 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2705 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2706 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2707
2708 state = 0xdeadbee;
2709 action = 0xdeadbee;
2710 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2711 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2712 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2713 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2714
2715 state = 0xdeadbee;
2716 action = 0xdeadbee;
2717 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2718 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2719 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2720 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2721
2722 state = 0xdeadbee;
2723 action = 0xdeadbee;
2724 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2725 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2726 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2727 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2728
2729 state = 0xdeadbee;
2730 action = 0xdeadbee;
2731 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2732 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2733 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2734 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2735
2736 state = 0xdeadbee;
2737 action = 0xdeadbee;
2738 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2739 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2740 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2741 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2742
2743 state = 0xdeadbee;
2744 action = 0xdeadbee;
2745 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2746 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2747 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2748 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2749
2750 state = 0xdeadbee;
2751 action = 0xdeadbee;
2752 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
2753 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2754 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2755 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2756
2757 state = 0xdeadbee;
2758 action = 0xdeadbee;
2759 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
2760 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2761 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2762 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2763
2764 state = 0xdeadbee;
2765 action = 0xdeadbee;
2766 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
2767 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2768 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2769 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2770
2771 state = 0xdeadbee;
2772 action = 0xdeadbee;
2773 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2774 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2775 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2776 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2777
2778 state = 0xdeadbee;
2779 action = 0xdeadbee;
2780 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2781 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2782 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2783 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2784
2785 state = 0xdeadbee;
2786 action = 0xdeadbee;
2787 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2788 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2789 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2790 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2791
2792 state = 0xdeadbee;
2793 action = 0xdeadbee;
2794 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2795 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2796 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2797 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2798
2799 state = 0xdeadbee;
2800 action = 0xdeadbee;
2801 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2802 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2803 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2804 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2805
2806 state = 0xdeadbee;
2807 action = 0xdeadbee;
2808 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2809 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2810 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2811 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2812
2813 state = 0xdeadbee;
2814 action = 0xdeadbee;
2815 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2816 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2817 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2818 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2819
2820 state = 0xdeadbee;
2821 action = 0xdeadbee;
2822 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2823 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2824 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2825 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2826
2827 state = 0xdeadbee;
2828 action = 0xdeadbee;
2829 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2830 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2831 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2832 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2833
2834 state = 0xdeadbee;
2835 action = 0xdeadbee;
2836 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2837 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2838 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2839 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2840
2841 state = 0xdeadbee;
2842 action = 0xdeadbee;
2843 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2844 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2845 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2846 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2847
2848 state = 0xdeadbee;
2849 action = 0xdeadbee;
2850 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2851 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2852 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2853 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2854
2855 state = 0xdeadbee;
2856 action = 0xdeadbee;
2857 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2858 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2859 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2860 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2861
2862 state = 0xdeadbee;
2863 action = 0xdeadbee;
2864 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2865 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2866 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2867 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2868
2869 state = 0xdeadbee;
2870 action = 0xdeadbee;
2871 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
2872 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2873 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2874 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2875
2876 state = 0xdeadbee;
2877 action = 0xdeadbee;
2878 r = MsiGetComponentState(hpkg, "pi", &state, &action);
2879 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2880 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2881 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2882
2883 state = 0xdeadbee;
2884 action = 0xdeadbee;
2885 r = MsiGetComponentState(hpkg, "rho", &state, &action);
2886 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2887 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2888 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2889
2890 state = 0xdeadbee;
2891 action = 0xdeadbee;
2892 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
2893 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2894 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2895 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2896
2897 state = 0xdeadbee;
2898 action = 0xdeadbee;
2899 r = MsiGetComponentState(hpkg, "tau", &state, &action);
2900 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2901 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2902 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2903
2904 state = 0xdeadbee;
2905 action = 0xdeadbee;
2906 r = MsiGetComponentState(hpkg, "phi", &state, &action);
2907 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2908 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2909 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2910
2911 state = 0xdeadbee;
2912 action = 0xdeadbee;
2913 r = MsiGetComponentState(hpkg, "chi", &state, &action);
2914 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2915 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2916 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2917
2918 r = MsiDoAction( hpkg, "CostInitialize");
2919 ok( r == ERROR_SUCCESS, "cost init failed\n");
2920
2921 state = 0xdeadbee;
2922 action = 0xdeadbee;
2923 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2924 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2925 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2926 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2927
2928 state = 0xdeadbee;
2929 action = 0xdeadbee;
2930 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2931 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2932 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2933 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2934
2935 state = 0xdeadbee;
2936 action = 0xdeadbee;
2937 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2938 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2939 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2940 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2941
2942 state = 0xdeadbee;
2943 action = 0xdeadbee;
2944 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2945 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2946 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2947 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2948
2949 state = 0xdeadbee;
2950 action = 0xdeadbee;
2951 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2952 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2953 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2954 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2955
2956 state = 0xdeadbee;
2957 action = 0xdeadbee;
2958 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2959 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2960 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2961 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2962
2963 state = 0xdeadbee;
2964 action = 0xdeadbee;
2965 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2966 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2967 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2968 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2969
2970 state = 0xdeadbee;
2971 action = 0xdeadbee;
2972 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
2973 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2974 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2975 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2976
2977 state = 0xdeadbee;
2978 action = 0xdeadbee;
2979 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
2980 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2981 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2982 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2983
2984 state = 0xdeadbee;
2985 action = 0xdeadbee;
2986 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
2987 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2988 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2989 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2990
2991 state = 0xdeadbee;
2992 action = 0xdeadbee;
2993 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2994 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2995 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2996 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2997
2998 state = 0xdeadbee;
2999 action = 0xdeadbee;
3000 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3001 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3002 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3003 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3004
3005 state = 0xdeadbee;
3006 action = 0xdeadbee;
3007 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3008 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3009 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3010 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3011
3012 state = 0xdeadbee;
3013 action = 0xdeadbee;
3014 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3015 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3016 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3017 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3018
3019 state = 0xdeadbee;
3020 action = 0xdeadbee;
3021 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3022 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3023 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3024 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3025
3026 state = 0xdeadbee;
3027 action = 0xdeadbee;
3028 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3029 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3030 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3031 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3032
3033 state = 0xdeadbee;
3034 action = 0xdeadbee;
3035 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3036 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3037 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3038 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3039
3040 state = 0xdeadbee;
3041 action = 0xdeadbee;
3042 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3043 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3044 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3045 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3046
3047 state = 0xdeadbee;
3048 action = 0xdeadbee;
3049 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3050 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3051 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3052 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3053
3054 state = 0xdeadbee;
3055 action = 0xdeadbee;
3056 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3057 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3058 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3059 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3060
3061 state = 0xdeadbee;
3062 action = 0xdeadbee;
3063 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3064 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3065 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3066 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3067
3068 state = 0xdeadbee;
3069 action = 0xdeadbee;
3070 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3071 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3072 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3073 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3074
3075 state = 0xdeadbee;
3076 action = 0xdeadbee;
3077 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3078 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3079 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3080 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3081
3082 state = 0xdeadbee;
3083 action = 0xdeadbee;
3084 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3085 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3086 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3087 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3088
3089 state = 0xdeadbee;
3090 action = 0xdeadbee;
3091 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3092 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3093 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3094 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3095
3096 state = 0xdeadbee;
3097 action = 0xdeadbee;
3098 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3099 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3100 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3101 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3102
3103 state = 0xdeadbee;
3104 action = 0xdeadbee;
3105 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3106 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3107 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3108 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3109
3110 state = 0xdeadbee;
3111 action = 0xdeadbee;
3112 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3113 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3114 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3115 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3116
3117 state = 0xdeadbee;
3118 action = 0xdeadbee;
3119 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3120 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3121 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3122 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3123
3124 state = 0xdeadbee;
3125 action = 0xdeadbee;
3126 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3127 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3128 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3129 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3130
3131 state = 0xdeadbee;
3132 action = 0xdeadbee;
3133 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3134 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3135 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3136 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3137
3138 r = MsiDoAction( hpkg, "FileCost");
3139 ok( r == ERROR_SUCCESS, "file cost failed\n");
3140
3141 state = 0xdeadbee;
3142 action = 0xdeadbee;
3143 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3144 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3145 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3146 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3147
3148 state = 0xdeadbee;
3149 action = 0xdeadbee;
3150 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3151 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3152 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3153 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3154
3155 state = 0xdeadbee;
3156 action = 0xdeadbee;
3157 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3158 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3159 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3160 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3161
3162 state = 0xdeadbee;
3163 action = 0xdeadbee;
3164 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3165 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3166 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3167 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3168
3169 state = 0xdeadbee;
3170 action = 0xdeadbee;
3171 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3172 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3173 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3174 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3175
3176 state = 0xdeadbee;
3177 action = 0xdeadbee;
3178 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3179 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3180 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3181 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3182
3183 state = 0xdeadbee;
3184 action = 0xdeadbee;
3185 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3186 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3187 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3188 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3189
3190 state = 0xdeadbee;
3191 action = 0xdeadbee;
3192 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3193 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3194 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3195 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3196
3197 state = 0xdeadbee;
3198 action = 0xdeadbee;
3199 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3200 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3201 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3202 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3203
3204 state = 0xdeadbee;
3205 action = 0xdeadbee;
3206 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3207 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3208 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3209 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3210
3211 state = 0xdeadbee;
3212 action = 0xdeadbee;
3213 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3214 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3215 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3216 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3217
3218 state = 0xdeadbee;
3219 action = 0xdeadbee;
3220 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3221 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3222 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3223 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3224
3225 state = 0xdeadbee;
3226 action = 0xdeadbee;
3227 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3228 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3229 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3230 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3231
3232 state = 0xdeadbee;
3233 action = 0xdeadbee;
3234 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3235 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3236 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3237 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3238
3239 state = 0xdeadbee;
3240 action = 0xdeadbee;
3241 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3242 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3243 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3244 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3245
3246 state = 0xdeadbee;
3247 action = 0xdeadbee;
3248 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3249 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3250 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3251 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3252
3253 state = 0xdeadbee;
3254 action = 0xdeadbee;
3255 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3256 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3257 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3258 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3259
3260 state = 0xdeadbee;
3261 action = 0xdeadbee;
3262 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3263 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3264 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3265 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3266
3267 state = 0xdeadbee;
3268 action = 0xdeadbee;
3269 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3270 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3271 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3272 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3273
3274 state = 0xdeadbee;
3275 action = 0xdeadbee;
3276 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3277 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3278 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3279 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3280
3281 state = 0xdeadbee;
3282 action = 0xdeadbee;
3283 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3284 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3285 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3286 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3287
3288 state = 0xdeadbee;
3289 action = 0xdeadbee;
3290 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3291 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3292 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3293 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3294
3295 state = 0xdeadbee;
3296 action = 0xdeadbee;
3297 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3298 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3299 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3300 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3301
3302 state = 0xdeadbee;
3303 action = 0xdeadbee;
3304 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3305 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3306 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3307 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3308
3309 state = 0xdeadbee;
3310 action = 0xdeadbee;
3311 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3312 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3313 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3314 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3315
3316 state = 0xdeadbee;
3317 action = 0xdeadbee;
3318 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3319 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3320 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3321 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3322
3323 state = 0xdeadbee;
3324 action = 0xdeadbee;
3325 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3326 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3327 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3328 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3329
3330 state = 0xdeadbee;
3331 action = 0xdeadbee;
3332 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3333 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3334 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3335 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3336
3337 state = 0xdeadbee;
3338 action = 0xdeadbee;
3339 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3340 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3341 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3342 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3343
3344 state = 0xdeadbee;
3345 action = 0xdeadbee;
3346 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3347 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3348 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3349 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3350
3351 state = 0xdeadbee;
3352 action = 0xdeadbee;
3353 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3354 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3355 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3356 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3357
3358 r = MsiDoAction( hpkg, "CostFinalize");
3359 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3360
3361 state = 0xdeadbee;
3362 action = 0xdeadbee;
3363 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3364 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3365 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3366 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3367
3368 state = 0xdeadbee;
3369 action = 0xdeadbee;
3370 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3371 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3372 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3373 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3374
3375 state = 0xdeadbee;
3376 action = 0xdeadbee;
3377 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3378 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3379 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3380 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3381
3382 state = 0xdeadbee;
3383 action = 0xdeadbee;
3384 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3385 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3386 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3387 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3388
3389 state = 0xdeadbee;
3390 action = 0xdeadbee;
3391 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3392 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3393 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3394 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3395
3396 state = 0xdeadbee;
3397 action = 0xdeadbee;
3398 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3399 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3400 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3401 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3402
3403 state = 0xdeadbee;
3404 action = 0xdeadbee;
3405 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3406 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3407 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3408 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3409
3410 state = 0xdeadbee;
3411 action = 0xdeadbee;
3412 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3413 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3414 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3415 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3416
3417 state = 0xdeadbee;
3418 action = 0xdeadbee;
3419 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3420 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3421 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3422 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3423
3424 state = 0xdeadbee;
3425 action = 0xdeadbee;
3426 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3427 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3428 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3429 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3430
3431 state = 0xdeadbee;
3432 action = 0xdeadbee;
3433 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3434 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3435 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3436 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3437
3438 state = 0xdeadbee;
3439 action = 0xdeadbee;
3440 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3441 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3442 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3443 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3444
3445 state = 0xdeadbee;
3446 action = 0xdeadbee;
3447 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3448 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3449 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3450 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3451
3452 state = 0xdeadbee;
3453 action = 0xdeadbee;
3454 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3455 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3456 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3457 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3458
3459 state = 0xdeadbee;
3460 action = 0xdeadbee;
3461 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3462 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3463 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3464 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3465
3466 state = 0xdeadbee;
3467 action = 0xdeadbee;
3468 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3469 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3470 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3471 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3472
3473 state = 0xdeadbee;
3474 action = 0xdeadbee;
3475 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3476 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3477 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3478 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3479
3480 state = 0xdeadbee;
3481 action = 0xdeadbee;
3482 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3483 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3484 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3485 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3486
3487 state = 0xdeadbee;
3488 action = 0xdeadbee;
3489 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3490 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3491 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3492 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3493
3494 state = 0xdeadbee;
3495 action = 0xdeadbee;
3496 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3497 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3498 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3499 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3500
3501 state = 0xdeadbee;
3502 action = 0xdeadbee;
3503 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3504 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3505 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3506 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3507
3508 state = 0xdeadbee;
3509 action = 0xdeadbee;
3510 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3511 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3512 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3513 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3514
3515 state = 0xdeadbee;
3516 action = 0xdeadbee;
3517 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3518 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3519 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3520 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3521
3522 state = 0xdeadbee;
3523 action = 0xdeadbee;
3524 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3525 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3526 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3527 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3528
3529 state = 0xdeadbee;
3530 action = 0xdeadbee;
3531 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3532 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3533 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3534 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3535
3536 state = 0xdeadbee;
3537 action = 0xdeadbee;
3538 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3539 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3540 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3541 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3542
3543 state = 0xdeadbee;
3544 action = 0xdeadbee;
3545 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3546 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3547 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3548 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3549
3550 state = 0xdeadbee;
3551 action = 0xdeadbee;
3552 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3553 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3554 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3555 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3556
3557 state = 0xdeadbee;
3558 action = 0xdeadbee;
3559 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3560 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3561 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3562 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3563
3564 state = 0xdeadbee;
3565 action = 0xdeadbee;
3566 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3567 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3568 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3569 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3570
3571 state = 0xdeadbee;
3572 action = 0xdeadbee;
3573 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3574 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3575 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3576 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3577
3578 MsiCloseHandle( hpkg );
3579
3580 /* publish the features and components */
3581 r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven REINSTALL=eight,nine,ten");
3582 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3583
3584 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
3585 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
3586
3587 /* these properties must not be in the saved msi file */
3588 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
3589 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3590
3591 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
3592 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3593
3594 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
3595 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3596
3597 r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
3598 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3599
3600 hpkg = package_from_db( hdb );
3601 ok( hpkg, "failed to create package\n");
3602
3603 MsiCloseHandle(hdb);
3604
3605 state = 0xdeadbee;
3606 action = 0xdeadbee;
3607 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3608 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3609 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3610 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3611
3612 state = 0xdeadbee;
3613 action = 0xdeadbee;
3614 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3615 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3616 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3617 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3618
3619 state = 0xdeadbee;
3620 action = 0xdeadbee;
3621 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3622 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3623 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3624 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3625
3626 state = 0xdeadbee;
3627 action = 0xdeadbee;
3628 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3629 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3630 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3631 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3632
3633 state = 0xdeadbee;
3634 action = 0xdeadbee;
3635 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3636 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3637 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3638 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3639
3640 state = 0xdeadbee;
3641 action = 0xdeadbee;
3642 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3643 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3644 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3645 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3646
3647 state = 0xdeadbee;
3648 action = 0xdeadbee;
3649 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3650 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3651 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3652 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3653
3654 state = 0xdeadbee;
3655 action = 0xdeadbee;
3656 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3657 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3658 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3659 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3660
3661 state = 0xdeadbee;
3662 action = 0xdeadbee;
3663 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3664 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3665 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3666 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3667
3668 state = 0xdeadbee;
3669 action = 0xdeadbee;
3670 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3671 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3672 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3673 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3674
3675 state = 0xdeadbee;
3676 action = 0xdeadbee;
3677 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3678 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3679 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3680 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3681
3682 state = 0xdeadbee;
3683 action = 0xdeadbee;
3684 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3685 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3686 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3687 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3688
3689 state = 0xdeadbee;
3690 action = 0xdeadbee;
3691 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3692 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3693 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3694 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3695
3696 state = 0xdeadbee;
3697 action = 0xdeadbee;
3698 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3699 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3700 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3701 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3702
3703 state = 0xdeadbee;
3704 action = 0xdeadbee;
3705 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3706 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3707 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3708 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3709
3710 state = 0xdeadbee;
3711 action = 0xdeadbee;
3712 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3713 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3714 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3715 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3716
3717 state = 0xdeadbee;
3718 action = 0xdeadbee;
3719 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3720 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3721 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3722 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3723
3724 state = 0xdeadbee;
3725 action = 0xdeadbee;
3726 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3727 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3728 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3729 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3730
3731 state = 0xdeadbee;
3732 action = 0xdeadbee;
3733 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3734 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3735 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3736 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3737
3738 state = 0xdeadbee;
3739 action = 0xdeadbee;
3740 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3741 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3742 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3743 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3744
3745 state = 0xdeadbee;
3746 action = 0xdeadbee;
3747 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3748 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3749 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3750 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3751
3752 state = 0xdeadbee;
3753 action = 0xdeadbee;
3754 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3755 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3756 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3757 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3758
3759 state = 0xdeadbee;
3760 action = 0xdeadbee;
3761 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3762 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3763 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3764 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3765
3766 state = 0xdeadbee;
3767 action = 0xdeadbee;
3768 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3769 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3770 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3771 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3772
3773 state = 0xdeadbee;
3774 action = 0xdeadbee;
3775 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3776 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3777 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3778 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3779
3780 state = 0xdeadbee;
3781 action = 0xdeadbee;
3782 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3783 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3784 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3785 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3786
3787 state = 0xdeadbee;
3788 action = 0xdeadbee;
3789 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3790 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3791 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3792 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3793
3794 state = 0xdeadbee;
3795 action = 0xdeadbee;
3796 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3797 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3798 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3799 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3800
3801 state = 0xdeadbee;
3802 action = 0xdeadbee;
3803 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3804 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3805 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3806 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3807
3808 state = 0xdeadbee;
3809 action = 0xdeadbee;
3810 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3811 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3812 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3813 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3814
3815 state = 0xdeadbee;
3816 action = 0xdeadbee;
3817 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3818 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3819 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3820 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3821
3822 r = MsiDoAction( hpkg, "CostInitialize");
3823 ok( r == ERROR_SUCCESS, "cost init failed\n");
3824
3825 state = 0xdeadbee;
3826 action = 0xdeadbee;
3827 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3828 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3829 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3830 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3831
3832 state = 0xdeadbee;
3833 action = 0xdeadbee;
3834 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3835 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3836 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3837 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3838
3839 state = 0xdeadbee;
3840 action = 0xdeadbee;
3841 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3842 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3843 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3844 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3845
3846 state = 0xdeadbee;
3847 action = 0xdeadbee;
3848 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3849 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3850 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3851 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3852
3853 state = 0xdeadbee;
3854 action = 0xdeadbee;
3855 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3856 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3857 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3858 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3859
3860 state = 0xdeadbee;
3861 action = 0xdeadbee;
3862 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3863 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3864 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3865 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3866
3867 state = 0xdeadbee;
3868 action = 0xdeadbee;
3869 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3870 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3871 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3872 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3873
3874 state = 0xdeadbee;
3875 action = 0xdeadbee;
3876 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3877 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3878 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3879 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3880
3881 state = 0xdeadbee;
3882 action = 0xdeadbee;
3883 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3884 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3885 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3886 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3887
3888 state = 0xdeadbee;
3889 action = 0xdeadbee;
3890 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3891 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3892 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3893 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3894
3895 state = 0xdeadbee;
3896 action = 0xdeadbee;
3897 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3898 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3899 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3900 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3901
3902 state = 0xdeadbee;
3903 action = 0xdeadbee;
3904 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3905 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3906 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3907 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3908
3909 state = 0xdeadbee;
3910 action = 0xdeadbee;
3911 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3912 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3913 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3914 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3915
3916 state = 0xdeadbee;
3917 action = 0xdeadbee;
3918 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3919 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3920 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3921 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3922
3923 state = 0xdeadbee;
3924 action = 0xdeadbee;
3925 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3926 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3927 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3928 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3929
3930 state = 0xdeadbee;
3931 action = 0xdeadbee;
3932 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3933 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3934 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3935 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3936
3937 state = 0xdeadbee;
3938 action = 0xdeadbee;
3939 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3940 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3941 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3942 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3943
3944 state = 0xdeadbee;
3945 action = 0xdeadbee;
3946 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3947 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3948 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3949 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3950
3951 state = 0xdeadbee;
3952 action = 0xdeadbee;
3953 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3954 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3955 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3956 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3957
3958 state = 0xdeadbee;
3959 action = 0xdeadbee;
3960 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3961 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3962 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3963 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3964
3965 state = 0xdeadbee;
3966 action = 0xdeadbee;
3967 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3968 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3969 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3970 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3971
3972 state = 0xdeadbee;
3973 action = 0xdeadbee;
3974 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3975 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3976 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3977 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3978
3979 state = 0xdeadbee;
3980 action = 0xdeadbee;
3981 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3982 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3983 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3984 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3985
3986 state = 0xdeadbee;
3987 action = 0xdeadbee;
3988 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3989 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3990 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3991 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3992
3993 state = 0xdeadbee;
3994 action = 0xdeadbee;
3995 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3996 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3997 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3998 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3999
4000 state = 0xdeadbee;
4001 action = 0xdeadbee;
4002 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4003 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4004 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4005 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4006
4007 state = 0xdeadbee;
4008 action = 0xdeadbee;
4009 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4010 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4011 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4012 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4013
4014 state = 0xdeadbee;
4015 action = 0xdeadbee;
4016 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4017 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4018 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4019 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4020
4021 state = 0xdeadbee;
4022 action = 0xdeadbee;
4023 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4024 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4025 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4026 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4027
4028 state = 0xdeadbee;
4029 action = 0xdeadbee;
4030 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4031 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4032 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4033 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4034
4035 state = 0xdeadbee;
4036 action = 0xdeadbee;
4037 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4038 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4039 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4040 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4041
4042 r = MsiDoAction( hpkg, "FileCost");
4043 ok( r == ERROR_SUCCESS, "file cost failed\n");
4044
4045 state = 0xdeadbee;
4046 action = 0xdeadbee;
4047 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4048 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4049 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4050 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4051
4052 state = 0xdeadbee;
4053 action = 0xdeadbee;
4054 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4055 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4056 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4057 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4058
4059 state = 0xdeadbee;
4060 action = 0xdeadbee;
4061 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4062 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4063 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4064 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4065
4066 state = 0xdeadbee;
4067 action = 0xdeadbee;
4068 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4069 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4070 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4071 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4072
4073 state = 0xdeadbee;
4074 action = 0xdeadbee;
4075 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4076 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4077 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4078 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4079
4080 state = 0xdeadbee;
4081 action = 0xdeadbee;
4082 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4083 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4084 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4085 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4086
4087 state = 0xdeadbee;
4088 action = 0xdeadbee;
4089 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4090 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4091 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4092 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4093
4094 state = 0xdeadbee;
4095 action = 0xdeadbee;
4096 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4097 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4098 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4099 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4100
4101 state = 0xdeadbee;
4102 action = 0xdeadbee;
4103 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4104 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4105 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4106 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4107
4108 state = 0xdeadbee;
4109 action = 0xdeadbee;
4110 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4111 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4112 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4113 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4114
4115 state = 0xdeadbee;
4116 action = 0xdeadbee;
4117 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4118 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4119 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4120 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4121
4122 state = 0xdeadbee;
4123 action = 0xdeadbee;
4124 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4125 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4126 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4127 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4128
4129 state = 0xdeadbee;
4130 action = 0xdeadbee;
4131 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4132 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4133 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4134 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4135
4136 state = 0xdeadbee;
4137 action = 0xdeadbee;
4138 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4139 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4140 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4141 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4142
4143 state = 0xdeadbee;
4144 action = 0xdeadbee;
4145 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4146 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4147 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4148 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4149
4150 state = 0xdeadbee;
4151 action = 0xdeadbee;
4152 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4153 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4154 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4155 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4156
4157 state = 0xdeadbee;
4158 action = 0xdeadbee;
4159 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4160 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4161 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4162 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4163
4164 state = 0xdeadbee;
4165 action = 0xdeadbee;
4166 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4167 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4168 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4169 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4170
4171 state = 0xdeadbee;
4172 action = 0xdeadbee;
4173 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4174 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4175 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4176 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4177
4178 state = 0xdeadbee;
4179 action = 0xdeadbee;
4180 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4181 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4182 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4183 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4184
4185 state = 0xdeadbee;
4186 action = 0xdeadbee;
4187 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4188 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4189 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4190 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4191
4192 state = 0xdeadbee;
4193 action = 0xdeadbee;
4194 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4195 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4196 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4197 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4198
4199 state = 0xdeadbee;
4200 action = 0xdeadbee;
4201 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4202 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4203 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4204 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4205
4206 state = 0xdeadbee;
4207 action = 0xdeadbee;
4208 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4209 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4210 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4211 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4212
4213 state = 0xdeadbee;
4214 action = 0xdeadbee;
4215 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4216 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4217 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4218 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4219
4220 state = 0xdeadbee;
4221 action = 0xdeadbee;
4222 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4223 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4224 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4225 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4226
4227 state = 0xdeadbee;
4228 action = 0xdeadbee;
4229 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4230 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4231 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4232 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4233
4234 state = 0xdeadbee;
4235 action = 0xdeadbee;
4236 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4237 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4238 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4239 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4240
4241 state = 0xdeadbee;
4242 action = 0xdeadbee;
4243 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4244 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4245 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4246 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4247
4248 state = 0xdeadbee;
4249 action = 0xdeadbee;
4250 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4251 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4252 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4253 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4254
4255 r = MsiDoAction( hpkg, "CostFinalize");
4256 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
4257
4258 state = 0xdeadbee;
4259 action = 0xdeadbee;
4260 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4261 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4262 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4263 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4264
4265 state = 0xdeadbee;
4266 action = 0xdeadbee;
4267 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4268 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4269 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4270 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4271
4272 state = 0xdeadbee;
4273 action = 0xdeadbee;
4274 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4275 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4276 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4277 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4278
4279 state = 0xdeadbee;
4280 action = 0xdeadbee;
4281 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4282 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4283 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4284 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4285
4286 state = 0xdeadbee;
4287 action = 0xdeadbee;
4288 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4289 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4290 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4291 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4292
4293 state = 0xdeadbee;
4294 action = 0xdeadbee;
4295 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4296 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4297 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4298 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4299
4300 state = 0xdeadbee;
4301 action = 0xdeadbee;
4302 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4303 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4304 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4305 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4306
4307 state = 0xdeadbee;
4308 action = 0xdeadbee;
4309 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4310 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4311 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4312 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4313
4314 state = 0xdeadbee;
4315 action = 0xdeadbee;
4316 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4317 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4318 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4319 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4320
4321 state = 0xdeadbee;
4322 action = 0xdeadbee;
4323 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4324 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4325 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4326 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4327
4328 state = 0xdeadbee;
4329 action = 0xdeadbee;
4330 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4331 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4332 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4333 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4334
4335 state = 0xdeadbee;
4336 action = 0xdeadbee;
4337 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4338 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4339 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4340 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4341
4342 state = 0xdeadbee;
4343 action = 0xdeadbee;
4344 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4345 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4346 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4347 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4348
4349 state = 0xdeadbee;
4350 action = 0xdeadbee;
4351 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4352 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4353 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4354 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4355
4356 state = 0xdeadbee;
4357 action = 0xdeadbee;
4358 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4359 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4360 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4361 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4362
4363 state = 0xdeadbee;
4364 action = 0xdeadbee;
4365 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4366 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4367 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4368 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4369
4370 state = 0xdeadbee;
4371 action = 0xdeadbee;
4372 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4373 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4374 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4375 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4376
4377 state = 0xdeadbee;
4378 action = 0xdeadbee;
4379 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4380 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4381 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4382 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4383
4384 state = 0xdeadbee;
4385 action = 0xdeadbee;
4386 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4387 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4388 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4389 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4390
4391 state = 0xdeadbee;
4392 action = 0xdeadbee;
4393 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4394 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4395 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4396 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4397
4398 state = 0xdeadbee;
4399 action = 0xdeadbee;
4400 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4401 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4402 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4403 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4404
4405 state = 0xdeadbee;
4406 action = 0xdeadbee;
4407 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4408 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4409 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4410 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4411
4412 state = 0xdeadbee;
4413 action = 0xdeadbee;
4414 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4415 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4416 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4417 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4418
4419 state = 0xdeadbee;
4420 action = 0xdeadbee;
4421 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4422 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4423 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4424 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4425
4426 state = 0xdeadbee;
4427 action = 0xdeadbee;
4428 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4429 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4430 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4431 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4432
4433 state = 0xdeadbee;
4434 action = 0xdeadbee;
4435 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4436 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4437 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4438 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4439
4440 state = 0xdeadbee;
4441 action = 0xdeadbee;
4442 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4443 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4444 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4445 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4446
4447 state = 0xdeadbee;
4448 action = 0xdeadbee;
4449 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4450 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4451 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4452 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4453
4454 state = 0xdeadbee;
4455 action = 0xdeadbee;
4456 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4457 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4458 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4459 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4460
4461 state = 0xdeadbee;
4462 action = 0xdeadbee;
4463 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4464 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4465 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4466 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4467
4468 state = 0xdeadbee;
4469 action = 0xdeadbee;
4470 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4471 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4472 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4473 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4474
4475 MsiCloseHandle(hpkg);
4476
4477 /* uninstall the product */
4478 r = MsiInstallProduct(msifile, "REMOVE=ALL");
4479 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4480
4481 /* all features installed locally */
4482 r = MsiInstallProduct(msifile2, "ADDLOCAL=ALL");
4483 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4484
4485 r = MsiOpenDatabase(msifile2, MSIDBOPEN_DIRECT, &hdb);
4486 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
4487
4488 /* these properties must not be in the saved msi file */
4489 r = add_property_entry( hdb, "'ADDLOCAL', 'one,two,three,four,five,six,seven,eight,nine,ten'");
4490 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
4491
4492 hpkg = package_from_db( hdb );
4493 ok( hpkg, "failed to create package\n");
4494
4495 state = 0xdeadbee;
4496 action = 0xdeadbee;
4497 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4498 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4499 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4500 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4501
4502 state = 0xdeadbee;
4503 action = 0xdeadbee;
4504 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4505 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4506 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4507 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4508
4509 state = 0xdeadbee;
4510 action = 0xdeadbee;
4511 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4512 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4513 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4514 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4515
4516 state = 0xdeadbee;
4517 action = 0xdeadbee;
4518 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4519 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4520 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4521 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4522
4523 state = 0xdeadbee;
4524 action = 0xdeadbee;
4525 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4526 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4527 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4528 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4529
4530 state = 0xdeadbee;
4531 action = 0xdeadbee;
4532 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4533 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4534 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4535 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4536
4537 state = 0xdeadbee;
4538 action = 0xdeadbee;
4539 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4540 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4541 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4542 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4543
4544 state = 0xdeadbee;
4545 action = 0xdeadbee;
4546 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4547 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4548 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4549 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4550
4551 state = 0xdeadbee;
4552 action = 0xdeadbee;
4553 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4554 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4555 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4556 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4557
4558 state = 0xdeadbee;
4559 action = 0xdeadbee;
4560 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4561 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4562 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4563 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4564
4565 state = 0xdeadbee;
4566 action = 0xdeadbee;
4567 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4568 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4569 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4570 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4571
4572 state = 0xdeadbee;
4573 action = 0xdeadbee;
4574 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4575 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4576 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4577 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4578
4579 state = 0xdeadbee;
4580 action = 0xdeadbee;
4581 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4582 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4583 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4584 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4585
4586 state = 0xdeadbee;
4587 action = 0xdeadbee;
4588 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4589 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4590 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4591 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4592
4593 state = 0xdeadbee;
4594 action = 0xdeadbee;
4595 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4596 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4597 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4598 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4599
4600 state = 0xdeadbee;
4601 action = 0xdeadbee;
4602 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4603 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4604 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4605 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4606
4607 state = 0xdeadbee;
4608 action = 0xdeadbee;
4609 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4610 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4611 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4612 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4613
4614 state = 0xdeadbee;
4615 action = 0xdeadbee;
4616 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4617 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4618 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4619 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4620
4621 state = 0xdeadbee;
4622 action = 0xdeadbee;
4623 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4624 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4625 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4626 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4627
4628 state = 0xdeadbee;
4629 action = 0xdeadbee;
4630 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4631 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4632 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4633 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4634
4635 state = 0xdeadbee;
4636 action = 0xdeadbee;
4637 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4638 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4639 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4640 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4641
4642 state = 0xdeadbee;
4643 action = 0xdeadbee;
4644 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4645 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4646 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4647 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4648
4649 state = 0xdeadbee;
4650 action = 0xdeadbee;
4651 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4652 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4653 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4654 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4655
4656 state = 0xdeadbee;
4657 action = 0xdeadbee;
4658 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4659 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4660 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4661 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4662
4663 state = 0xdeadbee;
4664 action = 0xdeadbee;
4665 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4666 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4667 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4668 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4669
4670 state = 0xdeadbee;
4671 action = 0xdeadbee;
4672 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4673 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4674 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4675 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4676
4677 state = 0xdeadbee;
4678 action = 0xdeadbee;
4679 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4680 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4681 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4682 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4683
4684 state = 0xdeadbee;
4685 action = 0xdeadbee;
4686 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4687 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4688 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4689 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4690
4691 state = 0xdeadbee;
4692 action = 0xdeadbee;
4693 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4694 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4695 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4696 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4697
4698 state = 0xdeadbee;
4699 action = 0xdeadbee;
4700 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4701 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4702 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4703 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4704
4705 state = 0xdeadbee;
4706 action = 0xdeadbee;
4707 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4708 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4709 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4710 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4711
4712 r = MsiDoAction( hpkg, "CostInitialize");
4713 ok( r == ERROR_SUCCESS, "cost init failed\n");
4714
4715 state = 0xdeadbee;
4716 action = 0xdeadbee;
4717 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4718 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4719 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4720 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4721
4722 state = 0xdeadbee;
4723 action = 0xdeadbee;
4724 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4725 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4726 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4727 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4728
4729 state = 0xdeadbee;
4730 action = 0xdeadbee;
4731 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4732 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4733 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4734 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4735
4736 state = 0xdeadbee;
4737 action = 0xdeadbee;
4738 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4739 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4740 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4741 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4742
4743 state = 0xdeadbee;
4744 action = 0xdeadbee;
4745 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4746 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4747 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4748 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4749
4750 state = 0xdeadbee;
4751 action = 0xdeadbee;
4752 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4753 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4754 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4755 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4756
4757 state = 0xdeadbee;
4758 action = 0xdeadbee;
4759 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4760 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4761 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4762 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4763
4764 state = 0xdeadbee;
4765 action = 0xdeadbee;
4766 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4767 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4768 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4769 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4770
4771 state = 0xdeadbee;
4772 action = 0xdeadbee;
4773 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4774 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4775 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4776 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4777
4778 state = 0xdeadbee;
4779 action = 0xdeadbee;
4780 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4781 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4782 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4783 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4784
4785 state = 0xdeadbee;
4786 action = 0xdeadbee;
4787 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4788 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4789 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4790 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4791
4792 state = 0xdeadbee;
4793 action = 0xdeadbee;
4794 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4795 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4796 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4797 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4798
4799 state = 0xdeadbee;
4800 action = 0xdeadbee;
4801 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4802 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4803 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4804 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4805
4806 state = 0xdeadbee;
4807 action = 0xdeadbee;
4808 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4809 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4810 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4811 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4812
4813 state = 0xdeadbee;
4814 action = 0xdeadbee;
4815 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4816 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4817 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4818 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4819
4820 state = 0xdeadbee;
4821 action = 0xdeadbee;
4822 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4823 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4824 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4825 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4826
4827 state = 0xdeadbee;
4828 action = 0xdeadbee;
4829 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4830 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4831 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4832 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4833
4834 state = 0xdeadbee;
4835 action = 0xdeadbee;
4836 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4837 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4838 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4839 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4840
4841 state = 0xdeadbee;
4842 action = 0xdeadbee;
4843 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4844 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4845 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4846 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4847
4848 state = 0xdeadbee;
4849 action = 0xdeadbee;
4850 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4851 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4852 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4853 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4854
4855 state = 0xdeadbee;
4856 action = 0xdeadbee;
4857 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4858 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4859 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4860 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4861
4862 state = 0xdeadbee;
4863 action = 0xdeadbee;
4864 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4865 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4866 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4867 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4868
4869 state = 0xdeadbee;
4870 action = 0xdeadbee;
4871 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4872 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4873 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4874 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4875
4876 state = 0xdeadbee;
4877 action = 0xdeadbee;
4878 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4879 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4880 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4881 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4882
4883 state = 0xdeadbee;
4884 action = 0xdeadbee;
4885 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4886 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4887 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4888 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4889
4890 state = 0xdeadbee;
4891 action = 0xdeadbee;
4892 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4893 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4894 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4895 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4896
4897 state = 0xdeadbee;
4898 action = 0xdeadbee;
4899 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4900 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4901 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4902 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4903
4904 state = 0xdeadbee;
4905 action = 0xdeadbee;
4906 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4907 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4908 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4909 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4910
4911 state = 0xdeadbee;
4912 action = 0xdeadbee;
4913 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4914 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4915 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4916 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4917
4918 state = 0xdeadbee;
4919 action = 0xdeadbee;
4920 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4921 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4922 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4923 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4924
4925 state = 0xdeadbee;
4926 action = 0xdeadbee;
4927 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4928 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4929 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4930 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4931
4932 r = MsiDoAction( hpkg, "FileCost");
4933 ok( r == ERROR_SUCCESS, "file cost failed\n");
4934
4935 state = 0xdeadbee;
4936 action = 0xdeadbee;
4937 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4938 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4939 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4940 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4941
4942 state = 0xdeadbee;
4943 action = 0xdeadbee;
4944 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4945 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4946 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4947 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4948
4949 state = 0xdeadbee;
4950 action = 0xdeadbee;
4951 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4952 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4953 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4954 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4955
4956 state = 0xdeadbee;
4957 action = 0xdeadbee;
4958 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4959 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4960 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4961 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4962
4963 state = 0xdeadbee;
4964 action = 0xdeadbee;
4965 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4966 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4967 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4968 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4969
4970 state = 0xdeadbee;
4971 action = 0xdeadbee;
4972 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4973 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4974 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4975 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4976
4977 state = 0xdeadbee;
4978 action = 0xdeadbee;
4979 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4980 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4981 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4982 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4983
4984 state = 0xdeadbee;
4985 action = 0xdeadbee;
4986 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4987 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4988 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4989 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4990
4991 state = 0xdeadbee;
4992 action = 0xdeadbee;
4993 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4994 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4995 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4996 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4997
4998 state = 0xdeadbee;
4999 action = 0xdeadbee;
5000 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5001 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5002 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5003 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5004
5005 state = 0xdeadbee;
5006 action = 0xdeadbee;
5007 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5008 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5009 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5010 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5011
5012 state = 0xdeadbee;
5013 action = 0xdeadbee;
5014 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5015 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5016 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5017 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5018
5019 state = 0xdeadbee;
5020 action = 0xdeadbee;
5021 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5022 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5023 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5024 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5025
5026 state = 0xdeadbee;
5027 action = 0xdeadbee;
5028 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5029 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5030 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5031 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5032
5033 state = 0xdeadbee;
5034 action = 0xdeadbee;
5035 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5036 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5037 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5038 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5039
5040 state = 0xdeadbee;
5041 action = 0xdeadbee;
5042 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5043 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5044 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5045 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5046
5047 state = 0xdeadbee;
5048 action = 0xdeadbee;
5049 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5050 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5051 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5052 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5053
5054 state = 0xdeadbee;
5055 action = 0xdeadbee;
5056 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5057 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5058 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5059 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5060
5061 state = 0xdeadbee;
5062 action = 0xdeadbee;
5063 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5064 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5065 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5066 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5067
5068 state = 0xdeadbee;
5069 action = 0xdeadbee;
5070 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5071 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5072 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5073 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5074
5075 state = 0xdeadbee;
5076 action = 0xdeadbee;
5077 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5078 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5079 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5080 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5081
5082 state = 0xdeadbee;
5083 action = 0xdeadbee;
5084 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5085 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5086 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5087 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5088
5089 state = 0xdeadbee;
5090 action = 0xdeadbee;
5091 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5092 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5093 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5094 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5095
5096 state = 0xdeadbee;
5097 action = 0xdeadbee;
5098 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5099 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5100 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5101 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5102
5103 state = 0xdeadbee;
5104 action = 0xdeadbee;
5105 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5106 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5107 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5108 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5109
5110 state = 0xdeadbee;
5111 action = 0xdeadbee;
5112 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5113 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5114 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5115 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5116
5117 state = 0xdeadbee;
5118 action = 0xdeadbee;
5119 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5120 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5121 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5122 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5123
5124 state = 0xdeadbee;
5125 action = 0xdeadbee;
5126 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5127 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5128 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5129 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5130
5131 state = 0xdeadbee;
5132 action = 0xdeadbee;
5133 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5134 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5135 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5136 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5137
5138 state = 0xdeadbee;
5139 action = 0xdeadbee;
5140 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5141 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5142 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5143 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5144
5145 state = 0xdeadbee;
5146 action = 0xdeadbee;
5147 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5148 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5149 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5150 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5151
5152 r = MsiDoAction( hpkg, "CostFinalize");
5153 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
5154
5155 state = 0xdeadbee;
5156 action = 0xdeadbee;
5157 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5158 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5159 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5160 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5161
5162 state = 0xdeadbee;
5163 action = 0xdeadbee;
5164 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5165 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5166 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5167 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5168
5169 state = 0xdeadbee;
5170 action = 0xdeadbee;
5171 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5172 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5173 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5174 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5175
5176 state = 0xdeadbee;
5177 action = 0xdeadbee;
5178 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5179 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5180 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5181 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5182
5183 state = 0xdeadbee;
5184 action = 0xdeadbee;
5185 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5186 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5187 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5188 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5189
5190 state = 0xdeadbee;
5191 action = 0xdeadbee;
5192 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5193 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5194 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5195 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5196
5197 state = 0xdeadbee;
5198 action = 0xdeadbee;
5199 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5200 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5201 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5202 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5203
5204 state = 0xdeadbee;
5205 action = 0xdeadbee;
5206 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5207 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5208 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5209 todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5210
5211 state = 0xdeadbee;
5212 action = 0xdeadbee;
5213 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5214 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5215 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5216 todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5217
5218 state = 0xdeadbee;
5219 action = 0xdeadbee;
5220 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5221 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5222 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5223 todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5224
5225 state = 0xdeadbee;
5226 action = 0xdeadbee;
5227 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5228 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5229 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5230 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5231
5232 state = 0xdeadbee;
5233 action = 0xdeadbee;
5234 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5235 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5236 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5237 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5238
5239 state = 0xdeadbee;
5240 action = 0xdeadbee;
5241 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5242 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5243 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5244 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5245
5246 state = 0xdeadbee;
5247 action = 0xdeadbee;
5248 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5249 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5250 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5251 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5252
5253 state = 0xdeadbee;
5254 action = 0xdeadbee;
5255 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5256 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5257 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5258 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5259
5260 state = 0xdeadbee;
5261 action = 0xdeadbee;
5262 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5263 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5264 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5265 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5266
5267 state = 0xdeadbee;
5268 action = 0xdeadbee;
5269 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5270 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5271 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5272 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5273
5274 state = 0xdeadbee;
5275 action = 0xdeadbee;
5276 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5277 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5278 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5279 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5280
5281 state = 0xdeadbee;
5282 action = 0xdeadbee;
5283 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5284 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5285 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5286 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5287
5288 state = 0xdeadbee;
5289 action = 0xdeadbee;
5290 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5291 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5292 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5293 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5294
5295 state = 0xdeadbee;
5296 action = 0xdeadbee;
5297 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5298 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5299 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5300 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5301
5302 state = 0xdeadbee;
5303 action = 0xdeadbee;
5304 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5305 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5306 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5307 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5308
5309 state = 0xdeadbee;
5310 action = 0xdeadbee;
5311 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5312 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5313 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5314 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5315
5316 state = 0xdeadbee;
5317 action = 0xdeadbee;
5318 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5319 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5320 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5321 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5322
5323 state = 0xdeadbee;
5324 action = 0xdeadbee;
5325 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5326 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5327 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5328 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5329
5330 state = 0xdeadbee;
5331 action = 0xdeadbee;
5332 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5333 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5334 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5335 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5336
5337 state = 0xdeadbee;
5338 action = 0xdeadbee;
5339 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5340 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5341 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5342 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5343
5344 state = 0xdeadbee;
5345 action = 0xdeadbee;
5346 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5347 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5348 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5349 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5350
5351 state = 0xdeadbee;
5352 action = 0xdeadbee;
5353 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5354 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5355 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5356 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5357
5358 state = 0xdeadbee;
5359 action = 0xdeadbee;
5360 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5361 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5362 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5363 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5364
5365 state = 0xdeadbee;
5366 action = 0xdeadbee;
5367 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5368 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5369 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5370 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5371
5372 MsiCloseHandle(hpkg);
5373
5374 /* uninstall the product */
5375 r = MsiInstallProduct(msifile2, "REMOVE=ALL");
5376 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5377
5378 /* all features installed from source */
5379 r = MsiInstallProduct(msifile3, "ADDSOURCE=ALL");
5380 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5381
5382 r = MsiOpenDatabase(msifile3, MSIDBOPEN_DIRECT, &hdb);
5383 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
5384
5385 /* this property must not be in the saved msi file */
5386 r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
5387 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
5388
5389 hpkg = package_from_db( hdb );
5390 ok( hpkg, "failed to create package\n");
5391
5392 state = 0xdeadbee;
5393 action = 0xdeadbee;
5394 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5395 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5396 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5397 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5398
5399 state = 0xdeadbee;
5400 action = 0xdeadbee;
5401 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5402 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5403 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5404 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5405
5406 state = 0xdeadbee;
5407 action = 0xdeadbee;
5408 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5409 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5410 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5411 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5412
5413 state = 0xdeadbee;
5414 action = 0xdeadbee;
5415 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5416 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5417 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5418 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5419
5420 state = 0xdeadbee;
5421 action = 0xdeadbee;
5422 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5423 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5424 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5425 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5426
5427 state = 0xdeadbee;
5428 action = 0xdeadbee;
5429 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5430 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5431 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5432 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5433
5434 state = 0xdeadbee;
5435 action = 0xdeadbee;
5436 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5437 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5438 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5439 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5440
5441 state = 0xdeadbee;
5442 action = 0xdeadbee;
5443 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5444 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5445 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5446 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5447
5448 state = 0xdeadbee;
5449 action = 0xdeadbee;
5450 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5451 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5452 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5453 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5454
5455 state = 0xdeadbee;
5456 action = 0xdeadbee;
5457 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5458 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5459 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5460 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5461
5462 state = 0xdeadbee;
5463 action = 0xdeadbee;
5464 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5465 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5466 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5467 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5468
5469 state = 0xdeadbee;
5470 action = 0xdeadbee;
5471 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5472 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5473 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5474 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5475
5476 state = 0xdeadbee;
5477 action = 0xdeadbee;
5478 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5479 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5480 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5481 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5482
5483 state = 0xdeadbee;
5484 action = 0xdeadbee;
5485 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5486 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5487 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5488 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5489
5490 state = 0xdeadbee;
5491 action = 0xdeadbee;
5492 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5493 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5494 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5495 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5496
5497 state = 0xdeadbee;
5498 action = 0xdeadbee;
5499 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5500 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5501 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5502 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5503
5504 state = 0xdeadbee;
5505 action = 0xdeadbee;
5506 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5507 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5508 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5509 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5510
5511 state = 0xdeadbee;
5512 action = 0xdeadbee;
5513 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5514 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5515 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5516 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5517
5518 state = 0xdeadbee;
5519 action = 0xdeadbee;
5520 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5521 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5522 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5523 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5524
5525 state = 0xdeadbee;
5526 action = 0xdeadbee;
5527 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5528 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5529 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5530 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5531
5532 state = 0xdeadbee;
5533 action = 0xdeadbee;
5534 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5535 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5536 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5537 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5538
5539 state = 0xdeadbee;
5540 action = 0xdeadbee;
5541 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5542 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5543 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5544 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5545
5546 state = 0xdeadbee;
5547 action = 0xdeadbee;
5548 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5549 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5550 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5551 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5552
5553 state = 0xdeadbee;
5554 action = 0xdeadbee;
5555 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5556 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5557 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5558 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5559
5560 state = 0xdeadbee;
5561 action = 0xdeadbee;
5562 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5563 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5564 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5565 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5566
5567 state = 0xdeadbee;
5568 action = 0xdeadbee;
5569 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5570 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5571 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5572 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5573
5574 state = 0xdeadbee;
5575 action = 0xdeadbee;
5576 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5577 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5578 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5579 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5580
5581 state = 0xdeadbee;
5582 action = 0xdeadbee;
5583 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5584 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5585 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5586 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5587
5588 state = 0xdeadbee;
5589 action = 0xdeadbee;
5590 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5591 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5592 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5593 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5594
5595 state = 0xdeadbee;
5596 action = 0xdeadbee;
5597 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5598 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5599 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5600 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5601
5602 state = 0xdeadbee;
5603 action = 0xdeadbee;
5604 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5605 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5606 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5607 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5608
5609 r = MsiDoAction( hpkg, "CostInitialize");
5610 ok( r == ERROR_SUCCESS, "cost init failed\n");
5611
5612 state = 0xdeadbee;
5613 action = 0xdeadbee;
5614 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5615 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5616 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5617 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5618
5619 state = 0xdeadbee;
5620 action = 0xdeadbee;
5621 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5622 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5623 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5624 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5625
5626 state = 0xdeadbee;
5627 action = 0xdeadbee;
5628 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5629 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5630 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5631 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5632
5633 state = 0xdeadbee;
5634 action = 0xdeadbee;
5635 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5636 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5637 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5638 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5639
5640 state = 0xdeadbee;
5641 action = 0xdeadbee;
5642 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5643 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5644 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5645 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5646
5647 state = 0xdeadbee;
5648 action = 0xdeadbee;
5649 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5650 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5651 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5652 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5653
5654 state = 0xdeadbee;
5655 action = 0xdeadbee;
5656 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5657 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5658 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5659 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5660
5661 state = 0xdeadbee;
5662 action = 0xdeadbee;
5663 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5664 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5665 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5666 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5667
5668 state = 0xdeadbee;
5669 action = 0xdeadbee;
5670 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5671 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5672 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5673 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5674
5675 state = 0xdeadbee;
5676 action = 0xdeadbee;
5677 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5678 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5679 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5680 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5681
5682 state = 0xdeadbee;
5683 action = 0xdeadbee;
5684 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5685 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5686 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5687 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5688
5689 state = 0xdeadbee;
5690 action = 0xdeadbee;
5691 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5692 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5693 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5694 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5695
5696 state = 0xdeadbee;
5697 action = 0xdeadbee;
5698 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5699 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5700 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5701 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5702
5703 state = 0xdeadbee;
5704 action = 0xdeadbee;
5705 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5706 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5707 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5708 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5709
5710 state = 0xdeadbee;
5711 action = 0xdeadbee;
5712 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5713 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5714 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5715 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5716
5717 state = 0xdeadbee;
5718 action = 0xdeadbee;
5719 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5720 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5721 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5722 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5723
5724 state = 0xdeadbee;
5725 action = 0xdeadbee;
5726 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5727 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5728 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5729 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5730
5731 state = 0xdeadbee;
5732 action = 0xdeadbee;
5733 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5734 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5735 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5736 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5737
5738 state = 0xdeadbee;
5739 action = 0xdeadbee;
5740 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5741 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5742 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5743 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5744
5745 state = 0xdeadbee;
5746 action = 0xdeadbee;
5747 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5748 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5749 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5750 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5751
5752 state = 0xdeadbee;
5753 action = 0xdeadbee;
5754 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5755 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5756 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5757 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5758
5759 state = 0xdeadbee;
5760 action = 0xdeadbee;
5761 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5762 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5763 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5764 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5765
5766 state = 0xdeadbee;
5767 action = 0xdeadbee;
5768 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5769 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5770 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5771 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5772
5773 state = 0xdeadbee;
5774 action = 0xdeadbee;
5775 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5776 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5777 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5778 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5779
5780 state = 0xdeadbee;
5781 action = 0xdeadbee;
5782 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5783 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5784 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5785 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5786
5787 state = 0xdeadbee;
5788 action = 0xdeadbee;
5789 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5790 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5791 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5792 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5793
5794 state = 0xdeadbee;
5795 action = 0xdeadbee;
5796 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5797 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5798 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5799 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5800
5801 state = 0xdeadbee;
5802 action = 0xdeadbee;
5803 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5804 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5805 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5806 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5807
5808 state = 0xdeadbee;
5809 action = 0xdeadbee;
5810 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5811 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5812 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5813 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5814
5815 state = 0xdeadbee;
5816 action = 0xdeadbee;
5817 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5818 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5819 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5820 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5821
5822 state = 0xdeadbee;
5823 action = 0xdeadbee;
5824 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5825 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5826 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5827 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5828
5829 r = MsiDoAction( hpkg, "FileCost");
5830 ok( r == ERROR_SUCCESS, "file cost failed\n");
5831
5832 state = 0xdeadbee;
5833 action = 0xdeadbee;
5834 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5835 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5836 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5837 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5838
5839 state = 0xdeadbee;
5840 action = 0xdeadbee;
5841 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5842 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5843 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5844 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5845
5846 state = 0xdeadbee;
5847 action = 0xdeadbee;
5848 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5849 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5850 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5851 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5852
5853 state = 0xdeadbee;
5854 action = 0xdeadbee;
5855 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5856 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5857 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5858 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5859
5860 state = 0xdeadbee;
5861 action = 0xdeadbee;
5862 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5863 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5864 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5865 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5866
5867 state = 0xdeadbee;
5868 action = 0xdeadbee;
5869 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5870 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5871 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5872 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5873
5874 state = 0xdeadbee;
5875 action = 0xdeadbee;
5876 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5877 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5878 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5879 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5880
5881 state = 0xdeadbee;
5882 action = 0xdeadbee;
5883 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5884 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5885 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5886 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5887
5888 state = 0xdeadbee;
5889 action = 0xdeadbee;
5890 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5891 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5892 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5893 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5894
5895 state = 0xdeadbee;
5896 action = 0xdeadbee;
5897 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5898 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5899 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5900 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5901
5902 state = 0xdeadbee;
5903 action = 0xdeadbee;
5904 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5905 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5906 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5907 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5908
5909 state = 0xdeadbee;
5910 action = 0xdeadbee;
5911 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5912 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5913 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5914 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5915
5916 state = 0xdeadbee;
5917 action = 0xdeadbee;
5918 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5919 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5920 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5921 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5922
5923 state = 0xdeadbee;
5924 action = 0xdeadbee;
5925 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5926 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5927 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5928 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5929
5930 state = 0xdeadbee;
5931 action = 0xdeadbee;
5932 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5933 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5934 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5935 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5936
5937 state = 0xdeadbee;
5938 action = 0xdeadbee;
5939 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5940 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5941 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5942 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5943
5944 state = 0xdeadbee;
5945 action = 0xdeadbee;
5946 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5947 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5948 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5949 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5950
5951 state = 0xdeadbee;
5952 action = 0xdeadbee;
5953 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5954 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5955 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5956 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5957
5958 state = 0xdeadbee;
5959 action = 0xdeadbee;
5960 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5961 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5962 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5963 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5964
5965 state = 0xdeadbee;
5966 action = 0xdeadbee;
5967 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5968 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5969 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5970 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5971
5972 state = 0xdeadbee;
5973 action = 0xdeadbee;
5974 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5975 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5976 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5977 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5978
5979 state = 0xdeadbee;
5980 action = 0xdeadbee;
5981 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5982 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5983 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5984 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5985
5986 state = 0xdeadbee;
5987 action = 0xdeadbee;
5988 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5989 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5990 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5991 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5992
5993 state = 0xdeadbee;
5994 action = 0xdeadbee;
5995 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5996 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5997 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5998 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5999
6000 state = 0xdeadbee;
6001 action = 0xdeadbee;
6002 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6003 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6004 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6005 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6006
6007 state = 0xdeadbee;
6008 action = 0xdeadbee;
6009 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6010 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6011 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6012 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6013
6014 state = 0xdeadbee;
6015 action = 0xdeadbee;
6016 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6017 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6018 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6019 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6020
6021 state = 0xdeadbee;
6022 action = 0xdeadbee;
6023 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6024 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6025 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6026 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6027
6028 state = 0xdeadbee;
6029 action = 0xdeadbee;
6030 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6031 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6032 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6033 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6034
6035 state = 0xdeadbee;
6036 action = 0xdeadbee;
6037 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6038 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6039 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6040 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6041
6042 state = 0xdeadbee;
6043 action = 0xdeadbee;
6044 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6045 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6046 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6047 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6048
6049 r = MsiDoAction( hpkg, "CostFinalize");
6050 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
6051
6052 state = 0xdeadbee;
6053 action = 0xdeadbee;
6054 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6055 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6056 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6057 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6058
6059 state = 0xdeadbee;
6060 action = 0xdeadbee;
6061 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6062 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6063 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6064 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6065
6066 state = 0xdeadbee;
6067 action = 0xdeadbee;
6068 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6069 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6070 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6071 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6072
6073 state = 0xdeadbee;
6074 action = 0xdeadbee;
6075 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6076 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6077 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6078 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6079
6080 state = 0xdeadbee;
6081 action = 0xdeadbee;
6082 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6083 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6084 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6085 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6086
6087 state = 0xdeadbee;
6088 action = 0xdeadbee;
6089 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6090 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6091 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6092 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6093
6094 state = 0xdeadbee;
6095 action = 0xdeadbee;
6096 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6097 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6098 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6099 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6100
6101 state = 0xdeadbee;
6102 action = 0xdeadbee;
6103 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6104 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6105 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6106 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6107
6108 state = 0xdeadbee;
6109 action = 0xdeadbee;
6110 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6111 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6112 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6113 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6114
6115 state = 0xdeadbee;
6116 action = 0xdeadbee;
6117 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6118 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6119 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6120 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6121
6122 state = 0xdeadbee;
6123 action = 0xdeadbee;
6124 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6125 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6126 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6127 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6128
6129 state = 0xdeadbee;
6130 action = 0xdeadbee;
6131 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6132 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6133 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6134 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6135
6136 state = 0xdeadbee;
6137 action = 0xdeadbee;
6138 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6139 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6140 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6141 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6142
6143 state = 0xdeadbee;
6144 action = 0xdeadbee;
6145 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6146 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6147 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6148 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6149
6150 state = 0xdeadbee;
6151 action = 0xdeadbee;
6152 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6153 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6154 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6155 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6156
6157 state = 0xdeadbee;
6158 action = 0xdeadbee;
6159 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6160 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6161 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6162 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6163
6164 state = 0xdeadbee;
6165 action = 0xdeadbee;
6166 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6167 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6168 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6169 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6170
6171 state = 0xdeadbee;
6172 action = 0xdeadbee;
6173 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6174 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6175 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6176 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6177
6178 state = 0xdeadbee;
6179 action = 0xdeadbee;
6180 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6181 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6182 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6183 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6184
6185 state = 0xdeadbee;
6186 action = 0xdeadbee;
6187 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6188 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6189 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6190 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6191
6192 state = 0xdeadbee;
6193 action = 0xdeadbee;
6194 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6195 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6196 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6197 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6198
6199 state = 0xdeadbee;
6200 action = 0xdeadbee;
6201 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6202 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6203 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6204 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6205
6206 state = 0xdeadbee;
6207 action = 0xdeadbee;
6208 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6209 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6210 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6211 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6212
6213 state = 0xdeadbee;
6214 action = 0xdeadbee;
6215 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6216 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6217 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6218 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6219
6220 state = 0xdeadbee;
6221 action = 0xdeadbee;
6222 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6223 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6224 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6225 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6226
6227 state = 0xdeadbee;
6228 action = 0xdeadbee;
6229 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6230 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6231 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6232 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6233
6234 state = 0xdeadbee;
6235 action = 0xdeadbee;
6236 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6237 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6238 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6239 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6240
6241 state = 0xdeadbee;
6242 action = 0xdeadbee;
6243 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6244 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6245 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6246 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6247
6248 state = 0xdeadbee;
6249 action = 0xdeadbee;
6250 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6251 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6252 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6253 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6254
6255 state = 0xdeadbee;
6256 action = 0xdeadbee;
6257 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6258 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6259 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6260 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6261
6262 state = 0xdeadbee;
6263 action = 0xdeadbee;
6264 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6265 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6266 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6267 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6268
6269 MsiCloseHandle(hpkg);
6270
6271 /* reinstall the product */
6272 r = MsiInstallProduct(msifile3, "REINSTALL=ALL");
6273 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6274
6275 r = MsiOpenDatabase(msifile4, MSIDBOPEN_DIRECT, &hdb);
6276 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
6277
6278 /* this property must not be in the saved msi file */
6279 r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
6280 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
6281
6282 hpkg = package_from_db( hdb );
6283 ok( hpkg, "failed to create package\n");
6284
6285 state = 0xdeadbee;
6286 action = 0xdeadbee;
6287 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6288 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6289 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6290 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6291
6292 state = 0xdeadbee;
6293 action = 0xdeadbee;
6294 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6295 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6296 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6297 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6298
6299 state = 0xdeadbee;
6300 action = 0xdeadbee;
6301 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6302 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6303 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6304 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6305
6306 state = 0xdeadbee;
6307 action = 0xdeadbee;
6308 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6309 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6310 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6311 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6312
6313 state = 0xdeadbee;
6314 action = 0xdeadbee;
6315 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6316 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6317 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6318 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6319
6320 state = 0xdeadbee;
6321 action = 0xdeadbee;
6322 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6323 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6324 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6325 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6326
6327 state = 0xdeadbee;
6328 action = 0xdeadbee;
6329 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6330 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6331 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6332 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6333
6334 state = 0xdeadbee;
6335 action = 0xdeadbee;
6336 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6337 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6338 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6339 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6340
6341 state = 0xdeadbee;
6342 action = 0xdeadbee;
6343 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6344 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6345 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6346 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6347
6348 state = 0xdeadbee;
6349 action = 0xdeadbee;
6350 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6351 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6352 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6353 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6354
6355 state = 0xdeadbee;
6356 action = 0xdeadbee;
6357 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6358 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6359 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6360 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6361
6362 state = 0xdeadbee;
6363 action = 0xdeadbee;
6364 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6365 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6366 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6367 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6368
6369 state = 0xdeadbee;
6370 action = 0xdeadbee;
6371 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6372 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6373 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6374 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6375
6376 state = 0xdeadbee;
6377 action = 0xdeadbee;
6378 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6379 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6380 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6381 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6382
6383 state = 0xdeadbee;
6384 action = 0xdeadbee;
6385 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6386 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6387 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6388 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6389
6390 state = 0xdeadbee;
6391 action = 0xdeadbee;
6392 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6393 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6394 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6395 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6396
6397 state = 0xdeadbee;
6398 action = 0xdeadbee;
6399 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6400 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6401 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6402 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6403
6404 state = 0xdeadbee;
6405 action = 0xdeadbee;
6406 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6407 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6408 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6409 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6410
6411 state = 0xdeadbee;
6412 action = 0xdeadbee;
6413 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6414 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6415 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6416 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6417
6418 state = 0xdeadbee;
6419 action = 0xdeadbee;
6420 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6421 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6422 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6423 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6424
6425 state = 0xdeadbee;
6426 action = 0xdeadbee;
6427 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6428 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6429 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6430 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6431
6432 state = 0xdeadbee;
6433 action = 0xdeadbee;
6434 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6435 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6436 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6437 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6438
6439 state = 0xdeadbee;
6440 action = 0xdeadbee;
6441 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6442 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6443 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6444 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6445
6446 state = 0xdeadbee;
6447 action = 0xdeadbee;
6448 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6449 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6450 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6451 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6452
6453 state = 0xdeadbee;
6454 action = 0xdeadbee;
6455 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6456 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6457 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6458 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6459
6460 state = 0xdeadbee;
6461 action = 0xdeadbee;
6462 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6463 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6464 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6465 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6466
6467 state = 0xdeadbee;
6468 action = 0xdeadbee;
6469 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6470 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6471 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6472 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6473
6474 state = 0xdeadbee;
6475 action = 0xdeadbee;
6476 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6477 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6478 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6479 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6480
6481 state = 0xdeadbee;
6482 action = 0xdeadbee;
6483 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6484 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6485 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6486 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6487
6488 state = 0xdeadbee;
6489 action = 0xdeadbee;
6490 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6491 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6492 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6493 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6494
6495 state = 0xdeadbee;
6496 action = 0xdeadbee;
6497 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6498 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6499 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6500 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6501
6502 r = MsiDoAction( hpkg, "CostInitialize");
6503 ok( r == ERROR_SUCCESS, "cost init failed\n");
6504
6505 state = 0xdeadbee;
6506 action = 0xdeadbee;
6507 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6508 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6509 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6510 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6511
6512 state = 0xdeadbee;
6513 action = 0xdeadbee;
6514 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6515 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6516 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6517 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6518
6519 state = 0xdeadbee;
6520 action = 0xdeadbee;
6521 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6522 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6523 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6524 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6525
6526 state = 0xdeadbee;
6527 action = 0xdeadbee;
6528 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6529 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6530 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6531 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6532
6533 state = 0xdeadbee;
6534 action = 0xdeadbee;
6535 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6536 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6537 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6538 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6539
6540 state = 0xdeadbee;
6541 action = 0xdeadbee;
6542 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6543 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6544 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6545 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6546
6547 state = 0xdeadbee;
6548 action = 0xdeadbee;
6549 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6550 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6551 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6552 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6553
6554 state = 0xdeadbee;
6555 action = 0xdeadbee;
6556 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6557 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6558 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6559 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6560
6561 state = 0xdeadbee;
6562 action = 0xdeadbee;
6563 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6564 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6565 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6566 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6567
6568 state = 0xdeadbee;
6569 action = 0xdeadbee;
6570 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6571 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6572 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6573 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6574
6575 state = 0xdeadbee;
6576 action = 0xdeadbee;
6577 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6578 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6579 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6580 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6581
6582 state = 0xdeadbee;
6583 action = 0xdeadbee;
6584 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6585 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6586 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6587 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6588
6589 state = 0xdeadbee;
6590 action = 0xdeadbee;
6591 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6592 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6593 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6594 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6595
6596 state = 0xdeadbee;
6597 action = 0xdeadbee;
6598 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6599 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6600 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6601 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6602
6603 state = 0xdeadbee;
6604 action = 0xdeadbee;
6605 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6606 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6607 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6608 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6609
6610 state = 0xdeadbee;
6611 action = 0xdeadbee;
6612 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6613 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6614 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6615 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6616
6617 state = 0xdeadbee;
6618 action = 0xdeadbee;
6619 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6620 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6621 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6622 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6623
6624 state = 0xdeadbee;
6625 action = 0xdeadbee;
6626 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6627 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6628 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6629 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6630
6631 state = 0xdeadbee;
6632 action = 0xdeadbee;
6633 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6634 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6635 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6636 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6637
6638 state = 0xdeadbee;
6639 action = 0xdeadbee;
6640 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6641 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6642 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6643 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6644
6645 state = 0xdeadbee;
6646 action = 0xdeadbee;
6647 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6648 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6649 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6650 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6651
6652 state = 0xdeadbee;
6653 action = 0xdeadbee;
6654 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6655 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6656 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6657 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6658
6659 state = 0xdeadbee;
6660 action = 0xdeadbee;
6661 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6662 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6663 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6664 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6665
6666 state = 0xdeadbee;
6667 action = 0xdeadbee;
6668 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6669 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6670 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6671 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6672
6673 state = 0xdeadbee;
6674 action = 0xdeadbee;
6675 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6676 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6677 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6678 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6679
6680 state = 0xdeadbee;
6681 action = 0xdeadbee;
6682 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6683 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6684 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6685 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6686
6687 state = 0xdeadbee;
6688 action = 0xdeadbee;
6689 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6690 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6691 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6692 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6693
6694 state = 0xdeadbee;
6695 action = 0xdeadbee;
6696 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6697 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6698 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6699 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6700
6701 state = 0xdeadbee;
6702 action = 0xdeadbee;
6703 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6704 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6705 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6706 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6707
6708 state = 0xdeadbee;
6709 action = 0xdeadbee;
6710 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6711 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6712 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6713 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6714
6715 state = 0xdeadbee;
6716 action = 0xdeadbee;
6717 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6718 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6719 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6720 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6721
6722 r = MsiDoAction( hpkg, "FileCost");
6723 ok( r == ERROR_SUCCESS, "file cost failed\n");
6724
6725 state = 0xdeadbee;
6726 action = 0xdeadbee;
6727 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6728 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6729 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6730 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6731
6732 state = 0xdeadbee;
6733 action = 0xdeadbee;
6734 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6735 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6736 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6737 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6738
6739 state = 0xdeadbee;
6740 action = 0xdeadbee;
6741 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6742 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6743 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6744 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6745
6746 state = 0xdeadbee;
6747 action = 0xdeadbee;
6748 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6749 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6750 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6751 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6752
6753 state = 0xdeadbee;
6754 action = 0xdeadbee;
6755 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6756 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6757 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6758 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6759
6760 state = 0xdeadbee;
6761 action = 0xdeadbee;
6762 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6763 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6764 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6765 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6766
6767 state = 0xdeadbee;
6768 action = 0xdeadbee;
6769 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6770 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6771 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6772 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6773
6774 state = 0xdeadbee;
6775 action = 0xdeadbee;
6776 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6777 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6778 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6779 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6780
6781 state = 0xdeadbee;
6782 action = 0xdeadbee;
6783 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6784 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6785 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6786 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6787
6788 state = 0xdeadbee;
6789 action = 0xdeadbee;
6790 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6791 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6792 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6793 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6794
6795 state = 0xdeadbee;
6796 action = 0xdeadbee;
6797 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6798 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6799 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6800 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6801
6802 state = 0xdeadbee;
6803 action = 0xdeadbee;
6804 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6805 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6806 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6807 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6808
6809 state = 0xdeadbee;
6810 action = 0xdeadbee;
6811 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6812 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6813 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6814 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6815
6816 state = 0xdeadbee;
6817 action = 0xdeadbee;
6818 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6819 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6820 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6821 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6822
6823 state = 0xdeadbee;
6824 action = 0xdeadbee;
6825 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6826 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6827 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6828 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6829
6830 state = 0xdeadbee;
6831 action = 0xdeadbee;
6832 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6833 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6834 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6835 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6836
6837 state = 0xdeadbee;
6838 action = 0xdeadbee;
6839 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6840 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6841 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6842 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6843
6844 state = 0xdeadbee;
6845 action = 0xdeadbee;
6846 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6847 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6848 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6849 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6850
6851 state = 0xdeadbee;
6852 action = 0xdeadbee;
6853 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6854 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6855 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6856 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6857
6858 state = 0xdeadbee;
6859 action = 0xdeadbee;
6860 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6861 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6862 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6863 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6864
6865 state = 0xdeadbee;
6866 action = 0xdeadbee;
6867 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6868 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6869 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6870 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6871
6872 state = 0xdeadbee;
6873 action = 0xdeadbee;
6874 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6875 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6876 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6877 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6878
6879 state = 0xdeadbee;
6880 action = 0xdeadbee;
6881 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6882 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6883 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6884 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6885
6886 state = 0xdeadbee;
6887 action = 0xdeadbee;
6888 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6889 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6890 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6891 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6892
6893 state = 0xdeadbee;
6894 action = 0xdeadbee;
6895 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6896 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6897 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6898 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6899
6900 state = 0xdeadbee;
6901 action = 0xdeadbee;
6902 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6903 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6904 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6905 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6906
6907 state = 0xdeadbee;
6908 action = 0xdeadbee;
6909 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6910 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6911 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6912 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6913
6914 state = 0xdeadbee;
6915 action = 0xdeadbee;
6916 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6917 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6918 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6919 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6920
6921 state = 0xdeadbee;
6922 action = 0xdeadbee;
6923 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6924 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6925 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6926 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6927
6928 state = 0xdeadbee;
6929 action = 0xdeadbee;
6930 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6931 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6932 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6933 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6934
6935 state = 0xdeadbee;
6936 action = 0xdeadbee;
6937 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6938 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6939 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6940 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6941
6942 r = MsiDoAction( hpkg, "CostFinalize");
6943 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
6944
6945 state = 0xdeadbee;
6946 action = 0xdeadbee;
6947 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6948 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6949 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6950 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6951
6952 state = 0xdeadbee;
6953 action = 0xdeadbee;
6954 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6955 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6956 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6957 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6958
6959 state = 0xdeadbee;
6960 action = 0xdeadbee;
6961 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6962 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6963 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6964 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6965
6966 state = 0xdeadbee;
6967 action = 0xdeadbee;
6968 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6969 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6970 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6971 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6972
6973 state = 0xdeadbee;
6974 action = 0xdeadbee;
6975 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6976 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6977 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6978 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6979
6980 state = 0xdeadbee;
6981 action = 0xdeadbee;
6982 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6983 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6984 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6985 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6986
6987 state = 0xdeadbee;
6988 action = 0xdeadbee;
6989 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6990 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6991 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6992 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6993
6994 state = 0xdeadbee;
6995 action = 0xdeadbee;
6996 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6997 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6998 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6999 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7000
7001 state = 0xdeadbee;
7002 action = 0xdeadbee;
7003 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
7004 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7005 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7006 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7007
7008 state = 0xdeadbee;
7009 action = 0xdeadbee;
7010 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
7011 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7012 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7013 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7014
7015 state = 0xdeadbee;
7016 action = 0xdeadbee;
7017 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
7018 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7019 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7020 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7021
7022 state = 0xdeadbee;
7023 action = 0xdeadbee;
7024 r = MsiGetComponentState(hpkg, "beta", &state, &action);
7025 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7026 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7027 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7028
7029 state = 0xdeadbee;
7030 action = 0xdeadbee;
7031 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
7032 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7033 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7034 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7035
7036 state = 0xdeadbee;
7037 action = 0xdeadbee;
7038 r = MsiGetComponentState(hpkg, "theta", &state, &action);
7039 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7040 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7041 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7042
7043 state = 0xdeadbee;
7044 action = 0xdeadbee;
7045 r = MsiGetComponentState(hpkg, "delta", &state, &action);
7046 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7047 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7048 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7049
7050 state = 0xdeadbee;
7051 action = 0xdeadbee;
7052 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
7053 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7054 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7055 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7056
7057 state = 0xdeadbee;
7058 action = 0xdeadbee;
7059 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
7060 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7061 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7062 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7063
7064 state = 0xdeadbee;
7065 action = 0xdeadbee;
7066 r = MsiGetComponentState(hpkg, "iota", &state, &action);
7067 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7068 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7069 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7070
7071 state = 0xdeadbee;
7072 action = 0xdeadbee;
7073 r = MsiGetComponentState(hpkg, "eta", &state, &action);
7074 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7075 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7076 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7077
7078 state = 0xdeadbee;
7079 action = 0xdeadbee;
7080 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
7081 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7082 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7083 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7084
7085 state = 0xdeadbee;
7086 action = 0xdeadbee;
7087 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
7088 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7089 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7090 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7091
7092 state = 0xdeadbee;
7093 action = 0xdeadbee;
7094 r = MsiGetComponentState(hpkg, "mu", &state, &action);
7095 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7096 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7097 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7098
7099 state = 0xdeadbee;
7100 action = 0xdeadbee;
7101 r = MsiGetComponentState(hpkg, "nu", &state, &action);
7102 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7103 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7104 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7105
7106 state = 0xdeadbee;
7107 action = 0xdeadbee;
7108 r = MsiGetComponentState(hpkg, "xi", &state, &action);
7109 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7110 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7111 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7112
7113 state = 0xdeadbee;
7114 action = 0xdeadbee;
7115 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
7116 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7117 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7118 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7119
7120 state = 0xdeadbee;
7121 action = 0xdeadbee;
7122 r = MsiGetComponentState(hpkg, "pi", &state, &action);
7123 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7124 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7125 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7126
7127 state = 0xdeadbee;
7128 action = 0xdeadbee;
7129 r = MsiGetComponentState(hpkg, "rho", &state, &action);
7130 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7131 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7132 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7133
7134 state = 0xdeadbee;
7135 action = 0xdeadbee;
7136 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
7137 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7138 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7139 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7140
7141 state = 0xdeadbee;
7142 action = 0xdeadbee;
7143 r = MsiGetComponentState(hpkg, "tau", &state, &action);
7144 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7145 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7146 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7147
7148 state = 0xdeadbee;
7149 action = 0xdeadbee;
7150 r = MsiGetComponentState(hpkg, "phi", &state, &action);
7151 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7152 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7153 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7154
7155 state = 0xdeadbee;
7156 action = 0xdeadbee;
7157 r = MsiGetComponentState(hpkg, "chi", &state, &action);
7158 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7159 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7160 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7161
7162 MsiCloseHandle(hpkg);
7163
7164 /* uninstall the product */
7165 r = MsiInstallProduct(msifile4, "REMOVE=ALL");
7166 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7167
7168 DeleteFileA(msifile);
7169 DeleteFileA(msifile2);
7170 DeleteFileA(msifile3);
7171 DeleteFileA(msifile4);
7172 }
7173
7174 static void test_getproperty(void)
7175 {
7176 MSIHANDLE hPackage = 0;
7177 char prop[100];
7178 static CHAR empty[] = "";
7179 DWORD size;
7180 UINT r;
7181
7182 hPackage = package_from_db(create_package_db());
7183 ok( hPackage != 0, " Failed to create package\n");
7184
7185 /* set the property */
7186 r = MsiSetProperty(hPackage, "Name", "Value");
7187 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7188
7189 /* retrieve the size, NULL pointer */
7190 size = 0;
7191 r = MsiGetProperty(hPackage, "Name", NULL, &size);
7192 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7193 ok( size == 5, "Expected 5, got %d\n", size);
7194
7195 /* retrieve the size, empty string */
7196 size = 0;
7197 r = MsiGetProperty(hPackage, "Name", empty, &size);
7198 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7199 ok( size == 5, "Expected 5, got %d\n", size);
7200
7201 /* don't change size */
7202 r = MsiGetProperty(hPackage, "Name", prop, &size);
7203 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7204 ok( size == 5, "Expected 5, got %d\n", size);
7205 ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
7206
7207 /* increase the size by 1 */
7208 size++;
7209 r = MsiGetProperty(hPackage, "Name", prop, &size);
7210 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7211 ok( size == 5, "Expected 5, got %d\n", size);
7212 ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
7213
7214 r = MsiCloseHandle( hPackage);
7215 ok( r == ERROR_SUCCESS , "Failed to close package\n" );
7216 DeleteFile(msifile);
7217 }
7218
7219 static void test_removefiles(void)
7220 {
7221 MSIHANDLE hpkg;
7222 UINT r;
7223 MSIHANDLE hdb;
7224
7225 hdb = create_package_db();
7226 ok ( hdb, "failed to create package database\n" );
7227
7228 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
7229 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
7230
7231 r = create_feature_table( hdb );
7232 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
7233
7234 r = create_component_table( hdb );
7235 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
7236
7237 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
7238 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7239
7240 r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
7241 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7242
7243 r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
7244 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7245
7246 r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
7247 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7248
7249 r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
7250 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7251
7252 r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
7253 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7254
7255 r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
7256 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7257
7258 r = create_feature_components_table( hdb );
7259 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
7260
7261 r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
7262 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7263
7264 r = add_feature_components_entry( hdb, "'one', 'helium'" );
7265 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7266
7267 r = add_feature_components_entry( hdb, "'one', 'lithium'" );
7268 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7269
7270 r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
7271 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7272
7273 r = add_feature_components_entry( hdb, "'one', 'boron'" );
7274 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7275
7276 r = add_feature_components_entry( hdb, "'one', 'carbon'" );
7277 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7278
7279 r = create_file_table( hdb );
7280 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
7281
7282 r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
7283 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7284
7285 r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
7286 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7287
7288 r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
7289 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7290
7291 r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
7292 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7293
7294 r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
7295 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7296
7297 r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
7298 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7299
7300 r = create_remove_file_table( hdb );
7301 ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
7302
7303 hpkg = package_from_db( hdb );
7304 ok( hpkg, "failed to create package\n");
7305
7306 MsiCloseHandle( hdb );
7307
7308 create_test_file( "hydrogen.txt" );
7309 create_test_file( "helium.txt" );
7310 create_test_file( "lithium.txt" );
7311 create_test_file( "beryllium.txt" );
7312 create_test_file( "boron.txt" );
7313 create_test_file( "carbon.txt" );
7314
7315 r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
7316 ok( r == ERROR_SUCCESS, "set property failed\n");
7317
7318 r = MsiDoAction( hpkg, "CostInitialize");
7319 ok( r == ERROR_SUCCESS, "cost init failed\n");
7320
7321 r = MsiDoAction( hpkg, "FileCost");
7322 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7323
7324 r = MsiDoAction( hpkg, "CostFinalize");
7325 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7326
7327 r = MsiDoAction( hpkg, "InstallValidate");
7328 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7329
7330 r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
7331 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7332
7333 r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
7334 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7335
7336 r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
7337 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7338
7339 r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
7340 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7341
7342 r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
7343 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7344
7345 r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
7346 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7347
7348 r = MsiDoAction( hpkg, "RemoveFiles");
7349 ok( r == ERROR_SUCCESS, "remove files failed\n");
7350
7351 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
7352 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
7353 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
7354 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
7355 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
7356 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
7357
7358 MsiCloseHandle( hpkg );
7359 DeleteFileA(msifile);
7360 }
7361
7362 static void test_appsearch(void)
7363 {
7364 MSIHANDLE hpkg;
7365 UINT r;
7366 MSIHANDLE hdb;
7367 CHAR prop[MAX_PATH];
7368 DWORD size = MAX_PATH;
7369
7370 hdb = create_package_db();
7371 ok ( hdb, "failed to create package database\n" );
7372
7373 r = create_appsearch_table( hdb );
7374 ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
7375
7376 r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
7377 ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
7378
7379 r = create_reglocator_table( hdb );
7380 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7381
7382 r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
7383 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7384
7385 r = create_signature_table( hdb );
7386 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
7387
7388 r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
7389 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
7390
7391 hpkg = package_from_db( hdb );
7392 ok( hpkg, "failed to create package\n");
7393
7394 MsiCloseHandle( hdb );
7395
7396 r = MsiDoAction( hpkg, "AppSearch" );
7397 ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
7398
7399 r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
7400 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
7401 todo_wine
7402 {
7403 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
7404 }
7405
7406 MsiCloseHandle( hpkg );
7407 DeleteFileA(msifile);
7408 }
7409
7410 static void test_appsearch_complocator(void)
7411 {
7412 MSIHANDLE hpkg, hdb;
7413 CHAR path[MAX_PATH];
7414 CHAR prop[MAX_PATH];
7415 LPSTR usersid;
7416 DWORD size;
7417 UINT r;
7418
7419 if (!get_user_sid(&usersid))
7420 return;
7421
7422 create_test_file("FileName1");
7423 create_test_file("FileName4");
7424 set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE,
7425 "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
7426
7427 create_test_file("FileName2");
7428 set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED,
7429 "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
7430
7431 create_test_file("FileName3");
7432 set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED,
7433 "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
7434
7435 create_test_file("FileName5");
7436 set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE,
7437 "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
7438
7439 create_test_file("FileName6");
7440 set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE,
7441 "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
7442
7443 create_test_file("FileName7");
7444 set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE,
7445 "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
7446
7447 /* dir is FALSE, but we're pretending it's a directory */
7448 set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE,
7449 "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
7450
7451 create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7452 set_component_path("FileName8.dll", MSIINSTALLCONTEXT_MACHINE,
7453 "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
7454
7455 create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
7456 set_component_path("FileName9.dll", MSIINSTALLCONTEXT_MACHINE,
7457 "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
7458
7459 create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7460 set_component_path("FileName10.dll", MSIINSTALLCONTEXT_MACHINE,
7461 "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
7462
7463 hdb = create_package_db();
7464 ok(hdb, "Expected a valid database handle\n");
7465
7466 r = create_appsearch_table(hdb);
7467 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7468
7469 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
7470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7471
7472 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
7473 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7474
7475 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
7476 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7477
7478 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
7479 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7480
7481 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
7482 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7483
7484 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
7485 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7486
7487 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
7488 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7489
7490 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
7491 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7492
7493 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
7494 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7495
7496 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
7497 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7498
7499 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
7500 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7501
7502 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
7503 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7504
7505 r = create_complocator_table(hdb);
7506 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7507
7508 /* published component, machine, file, signature, misdbLocatorTypeFile */
7509 r = add_complocator_entry(hdb, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
7510 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7511
7512 /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
7513 r = add_complocator_entry(hdb, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
7514 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7515
7516 /* published component, user-managed, file, signature, misdbLocatorTypeFile */
7517 r = add_complocator_entry(hdb, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
7518 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7519
7520 /* published component, machine, file, signature, misdbLocatorTypeDirectory */
7521 r = add_complocator_entry(hdb, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
7522 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7523
7524 /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
7525 r = add_complocator_entry(hdb, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
7526 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7527
7528 /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
7529 r = add_complocator_entry(hdb, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
7530 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7531
7532 /* published component, machine, file, no signature, misdbLocatorTypeFile */
7533 r = add_complocator_entry(hdb, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
7534 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7535
7536 /* unpublished component, no signature, misdbLocatorTypeDir */
7537 r = add_complocator_entry(hdb, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
7538 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7539
7540 /* published component, no signature, dir does not exist misdbLocatorTypeDir */
7541 r = add_complocator_entry(hdb, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
7542 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7543
7544 /* published component, signature w/ ver, misdbLocatorTypeFile */
7545 r = add_complocator_entry(hdb, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
7546 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7547
7548 /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
7549 r = add_complocator_entry(hdb, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
7550 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7551
7552 /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
7553 r = add_complocator_entry(hdb, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
7554 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7555
7556 r = create_signature_table(hdb);
7557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7558
7559 r = add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
7560 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7561
7562 r = add_signature_entry(hdb, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
7563 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7564
7565 r = add_signature_entry(hdb, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
7566 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7567
7568 r = add_signature_entry(hdb, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
7569 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7570
7571 r = add_signature_entry(hdb, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
7572 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7573
7574 r = add_signature_entry(hdb, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7575 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7576
7577 r = add_signature_entry(hdb, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7578 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7579
7580 r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7581 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7582
7583 hpkg = package_from_db(hdb);
7584 ok(hpkg, "Expected a valid package handle\n");
7585
7586 r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
7587 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7588
7589 r = MsiDoAction(hpkg, "AppSearch");
7590 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7591
7592 size = MAX_PATH;
7593 sprintf(path, "%s\\FileName1", CURR_DIR);
7594 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
7595 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7596 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7597
7598 size = MAX_PATH;
7599 sprintf(path, "%s\\FileName2", CURR_DIR);
7600 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
7601 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7602 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7603
7604 size = MAX_PATH;
7605 sprintf(path, "%s\\FileName3", CURR_DIR);
7606 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
7607 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7608 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7609
7610 size = MAX_PATH;
7611 sprintf(path, "%s\\FileName4", CURR_DIR);
7612 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
7613 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7614 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7615
7616 size = MAX_PATH;
7617 sprintf(path, "%s\\FileName5", CURR_DIR);
7618 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
7619 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7620 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7621
7622 size = MAX_PATH;
7623 sprintf(path, "%s\\", CURR_DIR);
7624 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
7625 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7626 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7627
7628 size = MAX_PATH;
7629 sprintf(path, "%s\\", CURR_DIR);
7630 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
7631 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7632 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7633
7634 size = MAX_PATH;
7635 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
7636 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7637 ok(!lstrcmpA(prop, "october"), "Expected \"october\", got \"%s\"\n", prop);
7638
7639 size = MAX_PATH;
7640 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
7641 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7642 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7643
7644 size = MAX_PATH;
7645 sprintf(path, "%s\\FileName8.dll", CURR_DIR);
7646 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
7647 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7648 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7649
7650 size = MAX_PATH;
7651 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
7652 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7653 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7654
7655 size = MAX_PATH;
7656 sprintf(path, "%s\\FileName10.dll", CURR_DIR);
7657 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
7658 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7659 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7660
7661 delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
7662 MSIINSTALLCONTEXT_MACHINE, NULL);
7663 delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
7664 MSIINSTALLCONTEXT_USERUNMANAGED, usersid);
7665 delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
7666 MSIINSTALLCONTEXT_USERMANAGED, usersid);
7667 delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
7668 MSIINSTALLCONTEXT_MACHINE, NULL);
7669 delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
7670 MSIINSTALLCONTEXT_MACHINE, NULL);
7671 delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
7672 MSIINSTALLCONTEXT_MACHINE, NULL);
7673 delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
7674 MSIINSTALLCONTEXT_MACHINE, NULL);
7675 delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
7676 MSIINSTALLCONTEXT_MACHINE, NULL);
7677 delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
7678 MSIINSTALLCONTEXT_MACHINE, NULL);
7679 delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
7680 MSIINSTALLCONTEXT_MACHINE, NULL);
7681
7682 DeleteFileA("FileName1");
7683 DeleteFileA("FileName2");
7684 DeleteFileA("FileName3");
7685 DeleteFileA("FileName4");
7686 DeleteFileA("FileName5");
7687 DeleteFileA("FileName6");
7688 DeleteFileA("FileName7");
7689 DeleteFileA("FileName8.dll");
7690 DeleteFileA("FileName9.dll");
7691 DeleteFileA("FileName10.dll");
7692 MsiCloseHandle(hpkg);
7693 DeleteFileA(msifile);
7694 LocalFree(usersid);
7695 }
7696
7697 static void test_appsearch_reglocator(void)
7698 {
7699 MSIHANDLE hpkg, hdb;
7700 CHAR path[MAX_PATH];
7701 CHAR prop[MAX_PATH];
7702 DWORD binary[2];
7703 DWORD size, val;
7704 BOOL space, version;
7705 HKEY hklm, classes;
7706 HKEY hkcu, users;
7707 LPSTR pathdata;
7708 LPSTR pathvar;
7709 LPCSTR str;
7710 LPSTR ptr;
7711 LONG res;
7712 UINT r;
7713
7714 version = TRUE;
7715 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
7716 version = FALSE;
7717
7718 DeleteFileA("test.dll");
7719
7720 res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
7721 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7722
7723 res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
7724 (const BYTE *)"regszdata", 10);
7725 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7726
7727 res = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine", &hkcu);
7728 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7729
7730 res = RegSetValueExA(hkcu, "Value1", 0, REG_SZ,
7731 (const BYTE *)"regszdata", 10);
7732 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7733
7734 users = 0;
7735 res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
7736 ok(res == ERROR_SUCCESS ||
7737 broken(res == ERROR_INVALID_PARAMETER),
7738 "Expected ERROR_SUCCESS, got %d\n", res);
7739
7740 if (res == ERROR_SUCCESS)
7741 {
7742 res = RegSetValueExA(users, "Value1", 0, REG_SZ,
7743 (const BYTE *)"regszdata", 10);
7744 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7745 }
7746
7747 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine", &hklm);
7748 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7749
7750 res = RegSetValueA(hklm, NULL, REG_SZ, "defvalue", 8);
7751 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7752
7753 res = RegSetValueExA(hklm, "Value1", 0, REG_SZ,
7754 (const BYTE *)"regszdata", 10);
7755 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7756
7757 val = 42;
7758 res = RegSetValueExA(hklm, "Value2", 0, REG_DWORD,
7759 (const BYTE *)&val, sizeof(DWORD));
7760 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7761
7762 val = -42;
7763 res = RegSetValueExA(hklm, "Value3", 0, REG_DWORD,
7764 (const BYTE *)&val, sizeof(DWORD));
7765 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7766
7767 res = RegSetValueExA(hklm, "Value4", 0, REG_EXPAND_SZ,
7768 (const BYTE *)"%PATH%", 7);
7769 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7770
7771 res = RegSetValueExA(hklm, "Value5", 0, REG_EXPAND_SZ,
7772 (const BYTE *)"my%NOVAR%", 10);
7773 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7774
7775 res = RegSetValueExA(hklm, "Value6", 0, REG_MULTI_SZ,
7776 (const BYTE *)"one\0two\0", 9);
7777 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7778
7779 binary[0] = 0x1234abcd;
7780 binary[1] = 0x567890ef;
7781 res = RegSetValueExA(hklm, "Value7", 0, REG_BINARY,
7782 (const BYTE *)binary, sizeof(binary));
7783 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7784
7785 res = RegSetValueExA(hklm, "Value8", 0, REG_SZ,
7786 (const BYTE *)"#regszdata", 11);
7787 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7788
7789 create_test_file("FileName1");
7790 sprintf(path, "%s\\FileName1", CURR_DIR);
7791 res = RegSetValueExA(hklm, "Value9", 0, REG_SZ,
7792 (const BYTE *)path, lstrlenA(path) + 1);
7793 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7794
7795 sprintf(path, "%s\\FileName2", CURR_DIR);
7796 res = RegSetValueExA(hklm, "Value10", 0, REG_SZ,
7797 (const BYTE *)path, lstrlenA(path) + 1);
7798 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7799
7800 lstrcpyA(path, CURR_DIR);
7801 res = RegSetValueExA(hklm, "Value11", 0, REG_SZ,
7802 (const BYTE *)path, lstrlenA(path) + 1);
7803 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7804
7805 res = RegSetValueExA(hklm, "Value12", 0, REG_SZ,
7806 (const BYTE *)"", 1);
7807 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7808
7809 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7810 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
7811 res = RegSetValueExA(hklm, "Value13", 0, REG_SZ,
7812 (const BYTE *)path, lstrlenA(path) + 1);
7813 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7814
7815 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
7816 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
7817 res = RegSetValueExA(hklm, "Value14", 0, REG_SZ,
7818 (const BYTE *)path, lstrlenA(path) + 1);
7819 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7820
7821 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7822 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
7823 res = RegSetValueExA(hklm, "Value15", 0, REG_SZ,
7824 (const BYTE *)path, lstrlenA(path) + 1);
7825 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7826
7827 sprintf(path, "\"%s\\FileName1\" -option", CURR_DIR);
7828 res = RegSetValueExA(hklm, "value16", 0, REG_SZ,
7829 (const BYTE *)path, lstrlenA(path) + 1);
7830
7831 space = (strchr(CURR_DIR, ' ')) ? TRUE : FALSE;
7832 sprintf(path, "%s\\FileName1 -option", CURR_DIR);
7833 res = RegSetValueExA(hklm, "value17", 0, REG_SZ,
7834 (const BYTE *)path, lstrlenA(path) + 1);
7835
7836 hdb = create_package_db();
7837 ok(hdb, "Expected a valid database handle\n");
7838
7839 r = create_appsearch_table(hdb);
7840 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7841
7842 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
7843 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7844
7845 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
7846 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7847
7848 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
7849 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7850
7851 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
7852 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7853
7854 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
7855 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7856
7857 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
7858 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7859
7860 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
7861 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7862
7863 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
7864 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7865
7866 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
7867 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7868
7869 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
7870 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7871
7872 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
7873 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7874
7875 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
7876 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7877
7878 r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
7879 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7880
7881 r = add_appsearch_entry(hdb, "'SIGPROP14', 'NewSignature14'");
7882 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7883
7884 r = add_appsearch_entry(hdb, "'SIGPROP15', 'NewSignature15'");
7885 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7886
7887 r = add_appsearch_entry(hdb, "'SIGPROP16', 'NewSignature16'");
7888 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7889
7890 r = add_appsearch_entry(hdb, "'SIGPROP17', 'NewSignature17'");
7891 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7892
7893 r = add_appsearch_entry(hdb, "'SIGPROP18', 'NewSignature18'");
7894 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7895
7896 r = add_appsearch_entry(hdb, "'SIGPROP19', 'NewSignature19'");
7897 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7898
7899 r = add_appsearch_entry(hdb, "'SIGPROP20', 'NewSignature20'");
7900 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7901
7902 r = add_appsearch_entry(hdb, "'SIGPROP21', 'NewSignature21'");
7903 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7904
7905 r = add_appsearch_entry(hdb, "'SIGPROP22', 'NewSignature22'");
7906 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7907
7908 r = add_appsearch_entry(hdb, "'SIGPROP23', 'NewSignature23'");
7909 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7910
7911 r = add_appsearch_entry(hdb, "'SIGPROP24', 'NewSignature24'");
7912 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7913
7914 r = add_appsearch_entry(hdb, "'SIGPROP25', 'NewSignature25'");
7915 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7916
7917 r = add_appsearch_entry(hdb, "'SIGPROP26', 'NewSignature26'");
7918 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7919
7920 r = add_appsearch_entry(hdb, "'SIGPROP27', 'NewSignature27'");
7921 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7922
7923 r = add_appsearch_entry(hdb, "'SIGPROP28', 'NewSignature28'");
7924 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7925
7926 r = add_appsearch_entry(hdb, "'SIGPROP29', 'NewSignature29'");
7927 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7928
7929 r = add_appsearch_entry(hdb, "'SIGPROP30', 'NewSignature30'");
7930 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7931
7932 r = create_reglocator_table(hdb);
7933 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7934
7935 /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
7936 str = "'NewSignature1', 2, 'Software\\Wine', 'Value1', 2";
7937 r = add_reglocator_entry(hdb, str);
7938 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7939
7940 /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
7941 str = "'NewSignature2', 2, 'Software\\Wine', 'Value2', 2";
7942 r = add_reglocator_entry(hdb, str);
7943 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7944
7945 /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
7946 str = "'NewSignature3', 2, 'Software\\Wine', 'Value3', 2";
7947 r = add_reglocator_entry(hdb, str);
7948 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7949
7950 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
7951 str = "'NewSignature4', 2, 'Software\\Wine', 'Value4', 2";
7952 r = add_reglocator_entry(hdb, str);
7953 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7954
7955 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
7956 str = "'NewSignature5', 2, 'Software\\Wine', 'Value5', 2";
7957 r = add_reglocator_entry(hdb, str);
7958 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7959
7960 /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
7961 str = "'NewSignature6', 2, 'Software\\Wine', 'Value6', 2";
7962 r = add_reglocator_entry(hdb, str);
7963 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7964
7965 /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
7966 str = "'NewSignature7', 2, 'Software\\Wine', 'Value7', 2";
7967 r = add_reglocator_entry(hdb, str);
7968 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7969
7970 /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
7971 str = "'NewSignature8', 2, 'Software\\Wine', 'Value8', 2";
7972 r = add_reglocator_entry(hdb, str);
7973 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7974
7975 /* HKLM, msidbLocatorTypeFileName, signature, file exists */
7976 str = "'NewSignature9', 2, 'Software\\Wine', 'Value9', 1";
7977 r = add_reglocator_entry(hdb, str);
7978 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7979
7980 /* HKLM, msidbLocatorTypeFileName, signature, file does not exist */
7981 str = "'NewSignature10', 2, 'Software\\Wine', 'Value10', 1";
7982 r = add_reglocator_entry(hdb, str);
7983 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7984
7985 /* HKLM, msidbLocatorTypeFileName, no signature */
7986 str = "'NewSignature11', 2, 'Software\\Wine', 'Value9', 1";
7987 r = add_reglocator_entry(hdb, str);
7988 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7989
7990 /* HKLM, msidbLocatorTypeDirectory, no signature, file exists */
7991 str = "'NewSignature12', 2, 'Software\\Wine', 'Value9', 0";
7992 r = add_reglocator_entry(hdb, str);
7993 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7994
7995 /* HKLM, msidbLocatorTypeDirectory, no signature, directory exists */
7996 str = "'NewSignature13', 2, 'Software\\Wine', 'Value11', 0";
7997 r = add_reglocator_entry(hdb, str);
7998 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7999
8000 /* HKLM, msidbLocatorTypeDirectory, signature, file exists */
8001 str = "'NewSignature14', 2, 'Software\\Wine', 'Value9', 0";
8002 r = add_reglocator_entry(hdb, str);
8003 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8004
8005 /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
8006 str = "'NewSignature15', 0, 'Software\\Wine', 'Value1', 2";
8007 r = add_reglocator_entry(hdb, str);
8008 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8009
8010 /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
8011 str = "'NewSignature16', 1, 'Software\\Wine', 'Value1', 2";
8012 r = add_reglocator_entry(hdb, str);
8013 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8014
8015 /* HKU, msidbLocatorTypeRawValue, REG_SZ */
8016 str = "'NewSignature17', 3, 'S-1-5-18\\Software\\Wine', 'Value1', 2";
8017 r = add_reglocator_entry(hdb, str);
8018 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8019
8020 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
8021 str = "'NewSignature18', 2, 'Software\\Wine', '', 2";
8022 r = add_reglocator_entry(hdb, str);
8023 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8024
8025 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
8026 str = "'NewSignature19', 2, 'Software\\IDontExist', '', 2";
8027 r = add_reglocator_entry(hdb, str);
8028 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8029
8030 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
8031 str = "'NewSignature20', 2, 'Software\\Wine', 'Value12', 2";
8032 r = add_reglocator_entry(hdb, str);
8033 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8034
8035 /* HKLM, msidbLocatorTypeFileName, signature, file exists w/ version */
8036 str = "'NewSignature21', 2, 'Software\\Wine', 'Value13', 1";
8037 r = add_reglocator_entry(hdb, str);
8038 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8039
8040 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
8041 str = "'NewSignature22', 2, 'Software\\Wine', 'Value14', 1";
8042 r = add_reglocator_entry(hdb, str);
8043 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8044
8045 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
8046 str = "'NewSignature23', 2, 'Software\\Wine', 'Value15', 1";
8047 r = add_reglocator_entry(hdb, str);
8048 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8049
8050 /* HKLM, msidbLocatorTypeFileName, no signature, directory exists */
8051 str = "'NewSignature24', 2, 'Software\\Wine', 'Value11', 1";
8052 r = add_reglocator_entry(hdb, str);
8053 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8054
8055 /* HKLM, msidbLocatorTypeFileName, no signature, file does not exist */
8056 str = "'NewSignature25', 2, 'Software\\Wine', 'Value10', 1";
8057 r = add_reglocator_entry(hdb, str);
8058 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8059
8060 /* HKLM, msidbLocatorTypeDirectory, signature, directory exists */
8061 str = "'NewSignature26', 2, 'Software\\Wine', 'Value11', 0";
8062 r = add_reglocator_entry(hdb, str);
8063 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8064
8065 /* HKLM, msidbLocatorTypeDirectory, signature, file does not exist */
8066 str = "'NewSignature27', 2, 'Software\\Wine', 'Value10', 0";
8067 r = add_reglocator_entry(hdb, str);
8068 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8069
8070 /* HKLM, msidbLocatorTypeDirectory, no signature, file does not exist */
8071 str = "'NewSignature28', 2, 'Software\\Wine', 'Value10', 0";
8072 r = add_reglocator_entry(hdb, str);
8073 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8074
8075 /* HKLM, msidbLocatorTypeFile, file exists, in quotes */
8076 str = "'NewSignature29', 2, 'Software\\Wine', 'Value16', 1";
8077 r = add_reglocator_entry(hdb, str);
8078 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8079
8080 /* HKLM, msidbLocatorTypeFile, file exists, no quotes */
8081 str = "'NewSignature30', 2, 'Software\\Wine', 'Value17', 1";
8082 r = add_reglocator_entry(hdb, str);
8083 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8084
8085 r = create_signature_table(hdb);
8086 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8087
8088 str = "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
8089 r = add_signature_entry(hdb, str);
8090 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8091
8092 str = "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
8093 r = add_signature_entry(hdb, str);
8094 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8095
8096 str = "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
8097 r = add_signature_entry(hdb, str);
8098 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8099
8100 str = "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8101 r = add_signature_entry(hdb, str);
8102 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8103
8104 str = "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8105 r = add_signature_entry(hdb, str);
8106 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8107
8108 str = "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8109 r = add_signature_entry(hdb, str);
8110 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8111
8112 ptr = strrchr(CURR_DIR, '\\') + 1;
8113 sprintf(path, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr);
8114 r = add_signature_entry(hdb, path);
8115 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8116
8117 str = "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''";
8118 r = add_signature_entry(hdb, str);
8119 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8120
8121 str = "'NewSignature29', 'FileName1', '', '', '', '', '', '', ''";
8122 r = add_signature_entry(hdb, str);
8123 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8124
8125 str = "'NewSignature30', 'FileName1', '', '', '', '', '', '', ''";
8126 r = add_signature_entry(hdb, str);
8127 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8128
8129 hpkg = package_from_db(hdb);
8130 ok(hpkg, "Expected a valid package handle\n");
8131
8132 r = MsiDoAction(hpkg, "AppSearch");
8133 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8134
8135 size = MAX_PATH;
8136 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8137 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8138 ok(!lstrcmpA(prop, "regszdata"),
8139 "Expected \"regszdata\", got \"%s\"\n", prop);
8140
8141 size = MAX_PATH;
8142 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8143 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8144 ok(!lstrcmpA(prop, "#42"), "Expected \"#42\", got \"%s\"\n", prop);
8145
8146 size = MAX_PATH;
8147 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8148 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8149 ok(!lstrcmpA(prop, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop);
8150
8151 size = ExpandEnvironmentStringsA("%PATH%", NULL, 0);
8152 if (size == 0 && GetLastError() == ERROR_INVALID_PARAMETER)
8153 {
8154 /* Workaround for Win95 */
8155 CHAR tempbuf[1];
8156 size = ExpandEnvironmentStringsA("%PATH%", tempbuf, 0);
8157 }
8158 pathvar = HeapAlloc(GetProcessHeap(), 0, size);
8159 ExpandEnvironmentStringsA("%PATH%", pathvar, size);
8160
8161 size = 0;
8162 r = MsiGetPropertyA(hpkg, "SIGPROP4", NULL, &size);
8163 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8164
8165 pathdata = HeapAlloc(GetProcessHeap(), 0, ++size);
8166 r = MsiGetPropertyA(hpkg, "SIGPROP4", pathdata, &size);
8167 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8168 ok(!lstrcmpA(pathdata, pathvar),
8169 "Expected \"%s\", got \"%s\"\n", pathvar, pathdata);
8170
8171 HeapFree(GetProcessHeap(), 0, pathvar);
8172 HeapFree(GetProcessHeap(), 0, pathdata);
8173
8174 size = MAX_PATH;
8175 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8176 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8177 ok(!lstrcmpA(prop,
8178 "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop);
8179
8180 size = MAX_PATH;
8181 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8182 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8183 todo_wine
8184 {
8185 ok(!memcmp(prop, "\0one\0two\0\0", 10),
8186 "Expected \"\\0one\\0two\\0\\0\"\n");
8187 }
8188
8189 size = MAX_PATH;
8190 lstrcpyA(path, "#xCDAB3412EF907856");
8191 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8192 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8193 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8194
8195 size = MAX_PATH;
8196 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8197 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8198 ok(!lstrcmpA(prop, "##regszdata"),
8199 "Expected \"##regszdata\", got \"%s\"\n", prop);
8200
8201 size = MAX_PATH;
8202 sprintf(path, "%s\\FileName1", CURR_DIR);
8203 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8204 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8205 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8206
8207 size = MAX_PATH;
8208 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8209 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8210 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8211
8212 size = MAX_PATH;
8213 sprintf(path, "%s\\", CURR_DIR);
8214 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8215 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8216 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8217
8218 size = MAX_PATH;
8219 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8220 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8221 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8222
8223 size = MAX_PATH;
8224 sprintf(path, "%s\\", CURR_DIR);
8225 r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
8226 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8227 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8228
8229 size = MAX_PATH;
8230 r = MsiGetPropertyA(hpkg, "SIGPROP14", prop, &size);
8231 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8232 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8233
8234 size = MAX_PATH;
8235 r = MsiGetPropertyA(hpkg, "SIGPROP15", prop, &size);
8236 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8237 ok(!lstrcmpA(prop, "regszdata"),
8238 "Expected \"regszdata\", got \"%s\"\n", prop);
8239
8240 size = MAX_PATH;
8241 r = MsiGetPropertyA(hpkg, "SIGPROP16", prop, &size);
8242 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8243 ok(!lstrcmpA(prop, "regszdata"),
8244 "Expected \"regszdata\", got \"%s\"\n", prop);
8245
8246 if (users)
8247 {
8248 size = MAX_PATH;
8249 r = MsiGetPropertyA(hpkg, "SIGPROP17", prop, &size);
8250 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8251 ok(!lstrcmpA(prop, "regszdata"),
8252 "Expected \"regszdata\", got \"%s\"\n", prop);
8253 }
8254
8255 size = MAX_PATH;
8256 r = MsiGetPropertyA(hpkg, "SIGPROP18", prop, &size);
8257 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8258 ok(!lstrcmpA(prop, "defvalue"),
8259 "Expected \"defvalue\", got \"%s\"\n", prop);
8260
8261 size = MAX_PATH;
8262 r = MsiGetPropertyA(hpkg, "SIGPROP19", prop, &size);
8263 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8264 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8265
8266 size = MAX_PATH;
8267 r = MsiGetPropertyA(hpkg, "SIGPROP20", prop, &size);
8268 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8269 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8270
8271 if (version)
8272 {
8273 size = MAX_PATH;
8274 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8275 r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size);
8276 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8277 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8278
8279 size = MAX_PATH;
8280 r = MsiGetPropertyA(hpkg, "SIGPROP22", prop, &size);
8281 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8282 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8283
8284 size = MAX_PATH;
8285 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
8286 r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size);
8287 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8288 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8289 }
8290
8291 size = MAX_PATH;
8292 lstrcpyA(path, CURR_DIR);
8293 ptr = strrchr(path, '\\') + 1;
8294 *ptr = '\0';
8295 r = MsiGetPropertyA(hpkg, "SIGPROP24", prop, &size);
8296 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8297 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8298
8299 size = MAX_PATH;
8300 sprintf(path, "%s\\", CURR_DIR);
8301 r = MsiGetPropertyA(hpkg, "SIGPROP25", prop, &size);
8302 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8303 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8304
8305 size = MAX_PATH;
8306 r = MsiGetPropertyA(hpkg, "SIGPROP26", prop, &size);
8307 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8308 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8309
8310 size = MAX_PATH;
8311 r = MsiGetPropertyA(hpkg, "SIGPROP27", prop, &size);
8312 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8313 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8314
8315 size = MAX_PATH;
8316 r = MsiGetPropertyA(hpkg, "SIGPROP28", prop, &size);
8317 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8318 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8319
8320 size = MAX_PATH;
8321 sprintf(path, "%s\\FileName1", CURR_DIR);
8322 r = MsiGetPropertyA(hpkg, "SIGPROP29", prop, &size);
8323 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8324 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8325
8326 size = MAX_PATH;
8327 sprintf(path, "%s\\FileName1", CURR_DIR);
8328 r = MsiGetPropertyA(hpkg, "SIGPROP30", prop, &size);
8329 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8330 if (space)
8331 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8332 else
8333 todo_wine ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8334
8335 RegSetValueA(hklm, NULL, REG_SZ, "", 0);
8336 RegDeleteValueA(hklm, "Value1");
8337 RegDeleteValueA(hklm, "Value2");
8338 RegDeleteValueA(hklm, "Value3");
8339 RegDeleteValueA(hklm, "Value4");
8340 RegDeleteValueA(hklm, "Value5");
8341 RegDeleteValueA(hklm, "Value6");
8342 RegDeleteValueA(hklm, "Value7");
8343 RegDeleteValueA(hklm, "Value8");
8344 RegDeleteValueA(hklm, "Value9");
8345 RegDeleteValueA(hklm, "Value10");
8346 RegDeleteValueA(hklm, "Value11");
8347 RegDeleteValueA(hklm, "Value12");
8348 RegDeleteValueA(hklm, "Value13");
8349 RegDeleteValueA(hklm, "Value14");
8350 RegDeleteValueA(hklm, "Value15");
8351 RegDeleteValueA(hklm, "Value16");
8352 RegDeleteValueA(hklm, "Value17");
8353 RegDeleteKeyA(hklm, "");
8354 RegCloseKey(hklm);
8355
8356 RegDeleteValueA(classes, "Value1");
8357 RegDeleteKeyA(classes, "");
8358 RegCloseKey(classes);
8359
8360 RegDeleteValueA(hkcu, "Value1");
8361 RegDeleteKeyA(hkcu, "");
8362 RegCloseKey(hkcu);
8363
8364 RegDeleteValueA(users, "Value1");
8365 RegDeleteKeyA(users, "");
8366 RegCloseKey(users);
8367
8368 DeleteFileA("FileName1");
8369 DeleteFileA("FileName3.dll");
8370 DeleteFileA("FileName4.dll");
8371 DeleteFileA("FileName5.dll");
8372 MsiCloseHandle(hpkg);
8373 DeleteFileA(msifile);
8374 }
8375
8376 static void delete_win_ini(LPCSTR file)
8377 {
8378 CHAR path[MAX_PATH];
8379
8380 GetWindowsDirectoryA(path, MAX_PATH);
8381 lstrcatA(path, "\\");
8382 lstrcatA(path, file);
8383
8384 DeleteFileA(path);
8385 }
8386
8387 static void test_appsearch_inilocator(void)
8388 {
8389 MSIHANDLE hpkg, hdb;
8390 CHAR path[MAX_PATH];
8391 CHAR prop[MAX_PATH];
8392 BOOL version;
8393 LPCSTR str;
8394 LPSTR ptr;
8395 DWORD size;
8396 UINT r;
8397
8398 version = TRUE;
8399 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
8400 version = FALSE;
8401
8402 DeleteFileA("test.dll");
8403
8404 WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
8405
8406 create_test_file("FileName1");
8407 sprintf(path, "%s\\FileName1", CURR_DIR);
8408 WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
8409
8410 WritePrivateProfileStringA("Section", "Key3", CURR_DIR, "IniFile.ini");
8411
8412 sprintf(path, "%s\\IDontExist", CURR_DIR);
8413 WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
8414
8415 create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8416 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
8417 WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
8418
8419 create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8420 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8421 WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
8422
8423 create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8424 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
8425 WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
8426
8427 hdb = create_package_db();
8428 ok(hdb, "Expected a valid database handle\n");
8429
8430 r = create_appsearch_table(hdb);
8431 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8432
8433 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8434 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8435
8436 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8437 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8438
8439 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8440 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8441
8442 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8443 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8444
8445 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8446 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8447
8448 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8449 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8450
8451 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8452 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8453
8454 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8455 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8456
8457 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8458 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8459
8460 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8461 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8462
8463 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8464 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8465
8466 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
8467 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8468
8469 r = create_inilocator_table(hdb);
8470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8471
8472 /* msidbLocatorTypeRawValue, field 1 */
8473 str = "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
8474 r = add_inilocator_entry(hdb, str);
8475 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8476
8477 /* msidbLocatorTypeRawValue, field 2 */
8478 str = "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
8479 r = add_inilocator_entry(hdb, str);
8480 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8481
8482 /* msidbLocatorTypeRawValue, entire field */
8483 str = "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
8484 r = add_inilocator_entry(hdb, str);
8485 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8486
8487 /* msidbLocatorTypeFile */
8488 str = "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
8489 r = add_inilocator_entry(hdb, str);
8490 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8491
8492 /* msidbLocatorTypeDirectory, file */
8493 str = "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
8494 r = add_inilocator_entry(hdb, str);
8495 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8496
8497 /* msidbLocatorTypeDirectory, directory */
8498 str = "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
8499 r = add_inilocator_entry(hdb, str);
8500 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8501
8502 /* msidbLocatorTypeFile, file, no signature */
8503 str = "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
8504 r = add_inilocator_entry(hdb, str);
8505 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8506
8507 /* msidbLocatorTypeFile, dir, no signature */
8508 str = "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
8509 r = add_inilocator_entry(hdb, str);
8510 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8511
8512 /* msidbLocatorTypeFile, file does not exist */
8513 str = "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
8514 r = add_inilocator_entry(hdb, str);
8515 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8516
8517 /* msidbLocatorTypeFile, signature with version */
8518 str = "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1";
8519 r = add_inilocator_entry(hdb, str);
8520 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8521
8522 /* msidbLocatorTypeFile, signature with version, ver > max */
8523 str = "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1";
8524 r = add_inilocator_entry(hdb, str);
8525 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8526
8527 /* msidbLocatorTypeFile, signature with version, sig->name ignored */
8528 str = "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1";
8529 r = add_inilocator_entry(hdb, str);
8530 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8531
8532 r = create_signature_table(hdb);
8533 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8534
8535 r = add_signature_entry(hdb, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
8536 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8537
8538 r = add_signature_entry(hdb, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
8539 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8540
8541 r = add_signature_entry(hdb, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8542 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8543
8544 r = add_signature_entry(hdb, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8545 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8546
8547 r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8548 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8549
8550 hpkg = package_from_db(hdb);
8551 ok(hpkg, "Expected a valid package handle\n");
8552
8553 r = MsiDoAction(hpkg, "AppSearch");
8554 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8555
8556 size = MAX_PATH;
8557 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8558 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8559 ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop);
8560
8561 size = MAX_PATH;
8562 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8563 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8564 ok(!lstrcmpA(prop, "field2"), "Expected \"field2\", got \"%s\"\n", prop);
8565
8566 size = MAX_PATH;
8567 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8568 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8569 ok(!lstrcmpA(prop, "keydata,field2"),
8570 "Expected \"keydata,field2\", got \"%s\"\n", prop);
8571
8572 size = MAX_PATH;
8573 sprintf(path, "%s\\FileName1", CURR_DIR);
8574 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
8575 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8576 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8577
8578 size = MAX_PATH;
8579 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8580 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8581 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8582
8583 size = MAX_PATH;
8584 sprintf(path, "%s\\", CURR_DIR);
8585 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8586 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8587 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8588
8589 size = MAX_PATH;
8590 sprintf(path, "%s\\", CURR_DIR);
8591 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8592 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8593 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8594
8595 size = MAX_PATH;
8596 lstrcpyA(path, CURR_DIR);
8597 ptr = strrchr(path, '\\');
8598 *(ptr + 1) = '\0';
8599 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8600 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8601 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8602
8603 size = MAX_PATH;
8604 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8605 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8606 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8607
8608 if (version)
8609 {
8610 size = MAX_PATH;
8611 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
8612 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8613 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8614 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8615
8616 size = MAX_PATH;
8617 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8618 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8619 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8620
8621 size = MAX_PATH;
8622 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
8623 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8624 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8625 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8626 }
8627
8628 delete_win_ini("IniFile.ini");
8629 DeleteFileA("FileName1");
8630 DeleteFileA("FileName2.dll");
8631 DeleteFileA("FileName3.dll");
8632 DeleteFileA("FileName4.dll");
8633 MsiCloseHandle(hpkg);
8634 DeleteFileA(msifile);
8635 }
8636
8637 /*
8638 * MSI AppSearch action on DrLocator table always returns absolute paths.
8639 * If a relative path was set, it returns the first absolute path that
8640 * matches or an empty string if it didn't find anything.
8641 * This helper function replicates this behaviour.
8642 */
8643 static void search_absolute_directory(LPSTR absolute, LPCSTR relative)
8644 {
8645 int i, size;
8646 DWORD attr, drives;
8647
8648 size = lstrlenA(relative);
8649 drives = GetLogicalDrives();
8650 lstrcpyA(absolute, "A:\\");
8651 for (i = 0; i < 26; absolute[0] = '\0', i++)
8652 {
8653 if (!(drives & (1 << i)))
8654 continue;
8655
8656 absolute[0] = 'A' + i;
8657 if (GetDriveType(absolute) != DRIVE_FIXED)
8658 continue;
8659
8660 lstrcpynA(absolute + 3, relative, size + 1);
8661 attr = GetFileAttributesA(absolute);
8662 if (attr != INVALID_FILE_ATTRIBUTES &&
8663 (attr & FILE_ATTRIBUTE_DIRECTORY))
8664 {
8665 if (absolute[3 + size - 1] != '\\')
8666 lstrcatA(absolute, "\\");
8667 break;
8668 }
8669 absolute[3] = '\0';
8670 }
8671 }
8672
8673 static void test_appsearch_drlocator(void)
8674 {
8675 MSIHANDLE hpkg, hdb;
8676 CHAR path[MAX_PATH];
8677 CHAR prop[MAX_PATH];
8678 BOOL version;
8679 LPCSTR str;
8680 DWORD size;
8681 UINT r;
8682
8683 version = TRUE;
8684 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
8685 version = FALSE;
8686
8687 DeleteFileA("test.dll");
8688
8689 create_test_file("FileName1");
8690 CreateDirectoryA("one", NULL);
8691 CreateDirectoryA("one\\two", NULL);
8692 CreateDirectoryA("one\\two\\three", NULL);
8693 create_test_file("one\\two\\three\\FileName2");
8694 CreateDirectoryA("another", NULL);
8695 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8696 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8697 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8698
8699 hdb = create_package_db();
8700 ok(hdb, "Expected a valid database handle\n");
8701
8702 r = create_appsearch_table(hdb);
8703 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8704
8705 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8706 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8707
8708 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8709 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8710
8711 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8712 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8713
8714 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8715 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8716
8717 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8718 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8719
8720 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8721 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8722
8723 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8724 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8725
8726 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8727 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8728
8729 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8730 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8731
8732 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8733 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8734
8735 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8736 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8737
8738 r = create_drlocator_table(hdb);
8739 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8740
8741 /* no parent, full path, depth 0, signature */
8742 sprintf(path, "'NewSignature1', '', '%s', 0", CURR_DIR);
8743 r = add_drlocator_entry(hdb, path);
8744 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8745
8746 /* no parent, full path, depth 0, no signature */
8747 sprintf(path, "'NewSignature2', '', '%s', 0", CURR_DIR);
8748 r = add_drlocator_entry(hdb, path);
8749 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8750
8751 /* no parent, relative path, depth 0, no signature */
8752 sprintf(path, "'NewSignature3', '', '%s', 0", CURR_DIR + 3);
8753 r = add_drlocator_entry(hdb, path);
8754 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8755
8756 /* no parent, full path, depth 2, signature */
8757 sprintf(path, "'NewSignature4', '', '%s', 2", CURR_DIR);
8758 r = add_drlocator_entry(hdb, path);
8759 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8760
8761 /* no parent, full path, depth 3, signature */
8762 sprintf(path, "'NewSignature5', '', '%s', 3", CURR_DIR);
8763 r = add_drlocator_entry(hdb, path);
8764 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8765
8766 /* no parent, full path, depth 1, signature is dir */
8767 sprintf(path, "'NewSignature6', '', '%s', 1", CURR_DIR);
8768 r = add_drlocator_entry(hdb, path);
8769 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8770
8771 /* parent is in DrLocator, relative path, depth 0, signature */
8772 sprintf(path, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
8773 r = add_drlocator_entry(hdb, path);
8774 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8775
8776 /* no parent, full path, depth 0, signature w/ version */
8777 sprintf(path, "'NewSignature8', '', '%s', 0", CURR_DIR);
8778 r = add_drlocator_entry(hdb, path);
8779 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8780
8781 /* no parent, full path, depth 0, signature w/ version, ver > max */
8782 sprintf(path, "'NewSignature9', '', '%s', 0", CURR_DIR);
8783 r = add_drlocator_entry(hdb, path);
8784 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8785
8786 /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
8787 sprintf(path, "'NewSignature10', '', '%s', 0", CURR_DIR);
8788 r = add_drlocator_entry(hdb, path);
8789 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8790
8791 /* no parent, relative empty path, depth 0, no signature */
8792 sprintf(path, "'NewSignature11', '', '', 0");
8793 r = add_drlocator_entry(hdb, path);
8794 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8795
8796 r = create_signature_table(hdb);
8797 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8798
8799 str = "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
8800 r = add_signature_entry(hdb, str);
8801 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8802
8803 str = "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
8804 r = add_signature_entry(hdb, str);
8805 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8806
8807 str = "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
8808 r = add_signature_entry(hdb, str);
8809 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8810
8811 str = "'NewSignature6', 'another', '', '', '', '', '', '', ''";
8812 r = add_signature_entry(hdb, str);
8813 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8814
8815 str = "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
8816 r = add_signature_entry(hdb, str);
8817 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8818
8819 str = "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8820 r = add_signature_entry(hdb, str);
8821 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8822
8823 str = "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8824 r = add_signature_entry(hdb, str);
8825 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8826
8827 str = "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8828 r = add_signature_entry(hdb, str);
8829 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8830
8831 hpkg = package_from_db(hdb);
8832 ok(hpkg, "Expected a valid package handle\n");
8833
8834 r = MsiDoAction(hpkg, "AppSearch");
8835 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8836
8837 size = MAX_PATH;
8838 sprintf(path, "%s\\FileName1", CURR_DIR);
8839 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8840 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8841 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8842
8843 size = MAX_PATH;
8844 sprintf(path, "%s\\", CURR_DIR);
8845 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8846 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8847 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8848
8849 size = MAX_PATH;
8850 search_absolute_directory(path, CURR_DIR + 3);
8851 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8852 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8853 ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8854
8855 size = MAX_PATH;
8856 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
8857 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8858 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8859
8860 size = MAX_PATH;
8861 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
8862 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8863 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8864 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8865
8866 size = MAX_PATH;
8867 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8868 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8869 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8870
8871 size = MAX_PATH;
8872 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
8873 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8874 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8875 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8876
8877 if (version)
8878 {
8879 size = MAX_PATH;
8880 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8881 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8882 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8883 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8884
8885 size = MAX_PATH;
8886 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8887 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8888 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8889
8890 size = MAX_PATH;
8891 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8892 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8893 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8894 }
8895
8896 size = MAX_PATH;
8897 search_absolute_directory(path, "");
8898 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8899 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8900 ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8901
8902 DeleteFileA("FileName1");
8903 DeleteFileA("FileName3.dll");
8904 DeleteFileA("FileName4.dll");
8905 DeleteFileA("FileName5.dll");
8906 DeleteFileA("one\\two\\three\\FileName2");
8907 RemoveDirectoryA("one\\two\\three");
8908 RemoveDirectoryA("one\\two");
8909 RemoveDirectoryA("one");
8910 RemoveDirectoryA("another");
8911 MsiCloseHandle(hpkg);
8912 DeleteFileA(msifile);
8913 }
8914
8915 static void test_featureparents(void)
8916 {
8917 MSIHANDLE hpkg;
8918 UINT r;
8919 MSIHANDLE hdb;
8920 INSTALLSTATE state, action;
8921
8922 hdb = create_package_db();
8923 ok ( hdb, "failed to create package database\n" );
8924
8925 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
8926 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
8927
8928 r = create_feature_table( hdb );
8929 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
8930
8931 r = create_component_table( hdb );
8932 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
8933
8934 r = create_feature_components_table( hdb );
8935 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
8936
8937 r = create_file_table( hdb );
8938 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
8939
8940 /* msidbFeatureAttributesFavorLocal */
8941 r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
8942 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
8943
8944 /* msidbFeatureAttributesFavorSource */
8945 r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
8946 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
8947
8948 /* msidbFeatureAttributesFavorLocal */
8949 r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
8950 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
8951
8952 /* disabled because of install level */
8953 r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
8954 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
8955
8956 /* child feature of disabled feature */
8957 r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
8958 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
8959
8960 /* component of disabled feature (install level) */
8961 r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
8962 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8963
8964 /* component of disabled child feature (install level) */
8965 r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
8966 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8967
8968 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
8969 r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
8970 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8971
8972 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
8973 r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
8974 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8975
8976 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
8977 r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
8978 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8979
8980 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
8981 r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
8982 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8983
8984 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
8985 r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
8986 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8987
8988 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
8989 r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
8990 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8991
8992 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
8993 r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
8994 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8995
8996 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
8997 r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
8998 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8999
9000 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
9001 r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
9002
9003 r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
9004 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9005
9006 r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
9007 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9008
9009 r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
9010 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9011
9012 r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
9013 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9014
9015 r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
9016 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9017
9018 r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
9019 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9020
9021 r = add_feature_components_entry( hdb, "'orion', 'leo'" );
9022 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9023
9024 r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
9025 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9026
9027 r = add_feature_components_entry( hdb, "'orion', 'libra'" );
9028 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9029
9030 r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
9031 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9032
9033 r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
9034 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9035
9036 r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
9037 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9038
9039 r = add_feature_components_entry( hdb, "'orion', 'canis'" );
9040 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9041
9042 r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
9043 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9044
9045 r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
9046 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9047
9048 r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
9049 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9050
9051 r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
9052 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9053
9054 r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
9055 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9056
9057 r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
9058 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9059
9060 r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
9061 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9062
9063 r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
9064 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9065
9066 r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
9067 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9068
9069 r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
9070 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9071
9072 r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
9073 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9074
9075 r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
9076 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9077
9078 r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
9079 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9080
9081 r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
9082 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9083
9084 r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
9085 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9086
9087 hpkg = package_from_db( hdb );
9088 ok( hpkg, "failed to create package\n");
9089
9090 MsiCloseHandle( hdb );
9091
9092 r = MsiDoAction( hpkg, "CostInitialize");
9093 ok( r == ERROR_SUCCESS, "cost init failed\n");
9094
9095 r = MsiDoAction( hpkg, "FileCost");
9096 ok( r == ERROR_SUCCESS, "file cost failed\n");
9097
9098 r = MsiDoAction( hpkg, "CostFinalize");
9099 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
9100
9101 state = 0xdeadbee;
9102 action = 0xdeadbee;
9103 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
9104 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9105 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9106 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9107
9108 state = 0xdeadbee;
9109 action = 0xdeadbee;
9110 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
9111 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9112 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9113 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
9114
9115 state = 0xdeadbee;
9116 action = 0xdeadbee;
9117 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
9118 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9119 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9120 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9121
9122 state = 0xdeadbee;
9123 action = 0xdeadbee;
9124 r = MsiGetFeatureState(hpkg, "waters", &state, &action);
9125 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9126 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9127 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
9128
9129 state = 0xdeadbee;
9130 action = 0xdeadbee;
9131 r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
9132 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9133 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9134 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
9135
9136 state = 0xdeadbee;
9137 action = 0xdeadbee;
9138 r = MsiGetComponentState(hpkg, "leo", &state, &action);
9139 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9140 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
9141 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9142
9143 state = 0xdeadbee;
9144 action = 0xdeadbee;
9145 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9146 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9147 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9148 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9149
9150 state = 0xdeadbee;
9151 action = 0xdeadbee;
9152 r = MsiGetComponentState(hpkg, "libra", &state, &action);
9153 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9154 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9155 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9156
9157 state = 0xdeadbee;
9158 action = 0xdeadbee;
9159 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9160 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9161 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9162 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9163
9164 state = 0xdeadbee;
9165 action = 0xdeadbee;
9166 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9167 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9168 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9169 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9170
9171 state = 0xdeadbee;
9172 action = 0xdeadbee;
9173 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9174 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9175 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9176 ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
9177
9178 state = 0xdeadbee;
9179 action = 0xdeadbee;
9180 r = MsiGetComponentState(hpkg, "canis", &state, &action);
9181 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9182 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9183 ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
9184
9185 state = 0xdeadbee;
9186 action = 0xdeadbee;
9187 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9188 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9189 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9190 ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
9191
9192 state = 0xdeadbee;
9193 action = 0xdeadbee;
9194 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9195 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9196 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9197 ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
9198
9199 state = 0xdeadbee;
9200 action = 0xdeadbee;
9201 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9202 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9203 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9204 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9205
9206 state = 0xdeadbee;
9207 action = 0xdeadbee;
9208 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9209 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9210 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
9211 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
9212
9213 r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
9214 ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
9215
9216 state = 0xdeadbee;
9217 action = 0xdeadbee;
9218 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
9219 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9220 ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
9221 ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
9222
9223 state = 0xdeadbee;
9224 action = 0xdeadbee;
9225 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
9226 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9227 ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
9228 ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
9229
9230 state = 0xdeadbee;
9231 action = 0xdeadbee;
9232 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
9233 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9234 ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
9235 ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
9236
9237 state = 0xdeadbee;
9238 action = 0xdeadbee;
9239 r = MsiGetComponentState(hpkg, "leo", &state, &action);
9240 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9241 ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
9242 ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
9243
9244 state = 0xdeadbee;
9245 action = 0xdeadbee;
9246 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9247 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9248 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9249 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9250
9251 state = 0xdeadbee;
9252 action = 0xdeadbee;
9253 r = MsiGetComponentState(hpkg, "libra", &state, &action);
9254 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9255 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9256 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9257
9258 state = 0xdeadbee;
9259 action = 0xdeadbee;
9260 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9261 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9262 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9263 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9264
9265 state = 0xdeadbee;
9266 action = 0xdeadbee;
9267 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9268 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9269 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9270 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9271
9272 state = 0xdeadbee;
9273 action = 0xdeadbee;
9274 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9275 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9276 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9277 ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
9278
9279 state = 0xdeadbee;
9280 action = 0xdeadbee;
9281 r = MsiGetComponentState(hpkg, "canis", &state, &action);
9282 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9283 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9284 ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
9285
9286 state = 0xdeadbee;
9287 action = 0xdeadbee;
9288 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9289 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9290 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9291 ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
9292
9293 state = 0xdeadbee;
9294 action = 0xdeadbee;
9295 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9296 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9297 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9298 ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
9299
9300 state = 0xdeadbee;
9301 action = 0xdeadbee;
9302 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9303 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9304 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9305 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9306
9307 state = 0xdeadbee;
9308 action = 0xdeadbee;
9309 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9310 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9311 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
9312 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
9313
9314 MsiCloseHandle(hpkg);
9315 DeleteFileA(msifile);
9316 }
9317
9318 static void test_installprops(void)
9319 {
9320 MSIHANDLE hpkg, hdb;
9321 CHAR path[MAX_PATH];
9322 CHAR buf[MAX_PATH];
9323 DWORD size, type;
9324 LANGID langid;
9325 HKEY hkey1, hkey2;
9326 int res;
9327 UINT r;
9328
9329 GetCurrentDirectory(MAX_PATH, path);
9330 lstrcat(path, "\\");
9331 lstrcat(path, msifile);
9332
9333 hdb = create_package_db();
9334 ok( hdb, "failed to create database\n");
9335
9336 hpkg = package_from_db(hdb);
9337 ok( hpkg, "failed to create package\n");
9338
9339 MsiCloseHandle(hdb);
9340
9341 size = MAX_PATH;
9342 r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
9343 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9344 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9345
9346 RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
9347
9348 RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2);
9349
9350 size = MAX_PATH;
9351 type = REG_SZ;
9352 *path = '\0';
9353 if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
9354 {
9355 size = MAX_PATH;
9356 type = REG_SZ;
9357 RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
9358 }
9359
9360 /* win9x doesn't set this */
9361 if (*path)
9362 {
9363 size = MAX_PATH;
9364 r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
9365 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9366 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9367 }
9368
9369 size = MAX_PATH;
9370 type = REG_SZ;
9371 *path = '\0';
9372 if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
9373 {
9374 size = MAX_PATH;
9375 type = REG_SZ;
9376 RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
9377 }
9378
9379 if (*path)
9380 {
9381 size = MAX_PATH;
9382 r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
9383 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9384 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9385 }
9386
9387 size = MAX_PATH;
9388 r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
9389 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9390 trace("VersionDatabase = %s\n", buf);
9391
9392 size = MAX_PATH;
9393 r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
9394 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9395 trace("VersionMsi = %s\n", buf);
9396
9397 size = MAX_PATH;
9398 r = MsiGetProperty(hpkg, "Date", buf, &size);
9399 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9400 trace("Date = %s\n", buf);
9401
9402 size = MAX_PATH;
9403 r = MsiGetProperty(hpkg, "Time", buf, &size);
9404 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9405 trace("Time = %s\n", buf);
9406
9407 size = MAX_PATH;
9408 r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
9409 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9410 trace("PackageCode = %s\n", buf);
9411
9412 langid = GetUserDefaultLangID();
9413 sprintf(path, "%d", langid);
9414
9415 size = MAX_PATH;
9416 r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
9417 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
9418 ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
9419
9420 res = GetSystemMetrics(SM_CXSCREEN);
9421 size = MAX_PATH;
9422 r = MsiGetProperty(hpkg, "ScreenX", buf, &size);
9423 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
9424
9425 res = GetSystemMetrics(SM_CYSCREEN);
9426 size = MAX_PATH;
9427 r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
9428 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
9429
9430 CloseHandle(hkey1);
9431 CloseHandle(hkey2);
9432 MsiCloseHandle(hpkg);
9433 DeleteFile(msifile);
9434 }
9435
9436 static void test_launchconditions(void)
9437 {
9438 MSIHANDLE hpkg;
9439 MSIHANDLE hdb;
9440 UINT r;
9441
9442 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9443
9444 hdb = create_package_db();
9445 ok( hdb, "failed to create package database\n" );
9446
9447 r = create_launchcondition_table( hdb );
9448 ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
9449
9450 r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
9451 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
9452
9453 /* invalid condition */
9454 r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
9455 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
9456
9457 hpkg = package_from_db( hdb );
9458 ok( hpkg, "failed to create package\n");
9459
9460 MsiCloseHandle( hdb );
9461
9462 r = MsiSetProperty( hpkg, "X", "1" );
9463 ok( r == ERROR_SUCCESS, "failed to set property\n" );
9464
9465 /* invalid conditions are ignored */
9466 r = MsiDoAction( hpkg, "LaunchConditions" );
9467 ok( r == ERROR_SUCCESS, "cost init failed\n" );
9468
9469 /* verify LaunchConditions still does some verification */
9470 r = MsiSetProperty( hpkg, "X", "2" );
9471 ok( r == ERROR_SUCCESS, "failed to set property\n" );
9472
9473 r = MsiDoAction( hpkg, "LaunchConditions" );
9474 ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
9475
9476 MsiCloseHandle( hpkg );
9477 DeleteFile( msifile );
9478 }
9479
9480 static void test_ccpsearch(void)
9481 {
9482 MSIHANDLE hdb, hpkg;
9483 CHAR prop[MAX_PATH];
9484 DWORD size = MAX_PATH;
9485 UINT r;
9486
9487 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9488
9489 hdb = create_package_db();
9490 ok(hdb, "failed to create package database\n");
9491
9492 r = create_ccpsearch_table(hdb);
9493 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9494
9495 r = add_ccpsearch_entry(hdb, "'CCP_random'");
9496 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9497
9498 r = add_ccpsearch_entry(hdb, "'RMCCP_random'");
9499 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9500
9501 r = create_reglocator_table(hdb);
9502 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9503
9504 r = add_reglocator_entry(hdb, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
9505 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9506
9507 r = create_drlocator_table(hdb);
9508 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9509
9510 r = add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
9511 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9512
9513 r = create_signature_table(hdb);
9514 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9515
9516 hpkg = package_from_db(hdb);
9517 ok(hpkg, "failed to create package\n");
9518
9519 MsiCloseHandle(hdb);
9520
9521 r = MsiDoAction(hpkg, "CCPSearch");
9522 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9523
9524 r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
9525 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9526 ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
9527
9528 MsiCloseHandle(hpkg);
9529 DeleteFileA(msifile);
9530 }
9531
9532 static void test_complocator(void)
9533 {
9534 MSIHANDLE hdb, hpkg;
9535 UINT r;
9536 CHAR prop[MAX_PATH];
9537 CHAR expected[MAX_PATH];
9538 DWORD size = MAX_PATH;
9539
9540 hdb = create_package_db();
9541 ok(hdb, "failed to create package database\n");
9542
9543 r = create_appsearch_table(hdb);
9544 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9545
9546 r = add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
9547 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9548
9549 r = add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
9550 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9551
9552 r = add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
9553 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9554
9555 r = add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
9556 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9557
9558 r = add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
9559 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9560
9561 r = add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
9562 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9563
9564 r = add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
9565 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9566
9567 r = add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
9568 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9569
9570 r = add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
9571 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9572
9573 r = add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
9574 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9575
9576 r = add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
9577 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9578
9579 r = add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
9580 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9581
9582 r = add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
9583 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9584
9585 r = add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
9586 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9587
9588 r = add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
9589 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9590
9591 r = add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
9592 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9593
9594 r = create_complocator_table(hdb);
9595 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9596
9597 r = add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
9598 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9599
9600 r = add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
9601 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9602
9603 r = add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
9604 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9605
9606 r = add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
9607 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9608
9609 r = add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
9610 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9611
9612 r = add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
9613 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9614
9615 r = add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
9616 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9617
9618 r = add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
9619 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9620
9621 r = add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
9622 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9623
9624 r = add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
9625 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9626
9627 r = add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
9628 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9629
9630 r = add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
9631 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9632
9633 r = add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
9634 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9635
9636 r = add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
9637 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9638
9639 r = add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
9640 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9641
9642 r = add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
9643 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9644
9645 r = create_signature_table(hdb);
9646 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9647
9648 r = add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
9649 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9650
9651 r = add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
9652 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9653
9654 r = add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
9655 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9656
9657 r = add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
9658 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9659
9660 r = add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
9661 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9662
9663 r = add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
9664 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9665
9666 r = add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
9667 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9668
9669 r = add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
9670 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9671
9672 hpkg = package_from_db(hdb);
9673 ok(hpkg, "failed to create package\n");
9674
9675 MsiCloseHandle(hdb);
9676
9677 create_test_file("abelisaurus");
9678 create_test_file("bactrosaurus");
9679 create_test_file("camelotia");
9680 create_test_file("diclonius");
9681 create_test_file("echinodon");
9682 create_test_file("falcarius");
9683 create_test_file("gallimimus");
9684 create_test_file("hagryphus");
9685 CreateDirectoryA("iguanodon", NULL);
9686 CreateDirectoryA("jobaria", NULL);
9687 CreateDirectoryA("kakuru", NULL);
9688 CreateDirectoryA("labocania", NULL);
9689 CreateDirectoryA("megaraptor", NULL);
9690 CreateDirectoryA("neosodon", NULL);
9691 CreateDirectoryA("olorotitan", NULL);
9692 CreateDirectoryA("pantydraco", NULL);
9693
9694 set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE,
9695 "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL, FALSE);
9696 set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE,
9697 "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL, FALSE);
9698 set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE,
9699 "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL, FALSE);
9700 set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE,
9701 "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL, FALSE);
9702 set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE,
9703 "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL, FALSE);
9704 set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE,
9705 "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL, FALSE);
9706 set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE,
9707 "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL, FALSE);
9708 set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE,
9709 "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL, FALSE);
9710
9711 r = MsiDoAction(hpkg, "AppSearch");
9712 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9713
9714 size = MAX_PATH;
9715 r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
9716 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9717
9718 lstrcpyA(expected, CURR_DIR);
9719 lstrcatA(expected, "\\abelisaurus");
9720 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9721 "Expected %s or empty string, got %s\n", expected, prop);
9722
9723 size = MAX_PATH;
9724 r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
9725 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9726 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9727
9728 size = MAX_PATH;
9729 r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
9730 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9731 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9732
9733 size = MAX_PATH;
9734 r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
9735 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9736 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9737
9738 size = MAX_PATH;
9739 r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
9740 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9741
9742 lstrcpyA(expected, CURR_DIR);
9743 lstrcatA(expected, "\\");
9744 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9745 "Expected %s or empty string, got %s\n", expected, prop);
9746
9747 size = MAX_PATH;
9748 r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
9749 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9750 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9751
9752 size = MAX_PATH;
9753 r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
9754 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9755 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9756
9757 size = MAX_PATH;
9758 r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
9759 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9760 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9761
9762 size = MAX_PATH;
9763 r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
9764 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9765 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9766
9767 size = MAX_PATH;
9768 r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
9769 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9770 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9771
9772 size = MAX_PATH;
9773 r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
9774 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9775 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9776
9777 size = MAX_PATH;
9778 r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
9779 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9780 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9781
9782 size = MAX_PATH;
9783 r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
9784 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9785
9786 lstrcpyA(expected, CURR_DIR);
9787 lstrcatA(expected, "\\");
9788 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9789 "Expected %s or empty string, got %s\n", expected, prop);
9790
9791 size = MAX_PATH;
9792 r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
9793 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9794
9795 lstrcpyA(expected, CURR_DIR);
9796 lstrcatA(expected, "\\neosodon\\");
9797 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9798 "Expected %s or empty string, got %s\n", expected, prop);
9799
9800 size = MAX_PATH;
9801 r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
9802 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9803 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9804
9805 size = MAX_PATH;
9806 r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
9807 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9808 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9809
9810 MsiCloseHandle(hpkg);
9811 DeleteFileA("abelisaurus");
9812 DeleteFileA("bactrosaurus");
9813 DeleteFileA("camelotia");
9814 DeleteFileA("diclonius");
9815 DeleteFileA("echinodon");
9816 DeleteFileA("falcarius");
9817 DeleteFileA("gallimimus");
9818 DeleteFileA("hagryphus");
9819 RemoveDirectoryA("iguanodon");
9820 RemoveDirectoryA("jobaria");
9821 RemoveDirectoryA("kakuru");
9822 RemoveDirectoryA("labocania");
9823 RemoveDirectoryA("megaraptor");
9824 RemoveDirectoryA("neosodon");
9825 RemoveDirectoryA("olorotitan");
9826 RemoveDirectoryA("pantydraco");
9827 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
9828 MSIINSTALLCONTEXT_MACHINE, NULL);
9829 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
9830 MSIINSTALLCONTEXT_MACHINE, NULL);
9831 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
9832 MSIINSTALLCONTEXT_MACHINE, NULL);
9833 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
9834 MSIINSTALLCONTEXT_MACHINE, NULL);
9835 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
9836 MSIINSTALLCONTEXT_MACHINE, NULL);
9837 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
9838 MSIINSTALLCONTEXT_MACHINE, NULL);
9839 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
9840 MSIINSTALLCONTEXT_MACHINE, NULL);
9841 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
9842 MSIINSTALLCONTEXT_MACHINE, NULL);
9843 DeleteFileA(msifile);
9844 }
9845
9846 static void set_suminfo_prop(MSIHANDLE db, DWORD prop, DWORD val)
9847 {
9848 MSIHANDLE summary;
9849 UINT r;
9850
9851 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
9852 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9853
9854 r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
9855 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9856
9857 r = MsiSummaryInfoPersist(summary);
9858 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
9859
9860 MsiCloseHandle(summary);
9861 }
9862
9863 static void test_MsiGetSourcePath(void)
9864 {
9865 MSIHANDLE hdb, hpkg;
9866 CHAR path[MAX_PATH];
9867 CHAR cwd[MAX_PATH];
9868 CHAR subsrc[MAX_PATH];
9869 CHAR sub2[MAX_PATH];
9870 DWORD size;
9871 UINT r;
9872
9873 lstrcpyA(cwd, CURR_DIR);
9874 lstrcatA(cwd, "\\");
9875
9876 lstrcpyA(subsrc, cwd);
9877 lstrcatA(subsrc, "subsource");
9878 lstrcatA(subsrc, "\\");
9879
9880 lstrcpyA(sub2, subsrc);
9881 lstrcatA(sub2, "sub2");
9882 lstrcatA(sub2, "\\");
9883
9884 /* uncompressed source */
9885
9886 hdb = create_package_db();
9887 ok( hdb, "failed to create database\n");
9888
9889 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
9890
9891 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
9892 ok(r == S_OK, "failed\n");
9893
9894 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
9895 ok(r == S_OK, "failed\n");
9896
9897 r = add_directory_entry(hdb, "'SubDir2', 'SubDir', 'sub2'");
9898 ok(r == S_OK, "failed\n");
9899
9900 r = MsiDatabaseCommit(hdb);
9901 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
9902
9903 hpkg = package_from_db(hdb);
9904 ok(hpkg, "failed to create package\n");
9905
9906 MsiCloseHandle(hdb);
9907
9908 /* invalid database handle */
9909 size = MAX_PATH;
9910 lstrcpyA(path, "kiwi");
9911 r = MsiGetSourcePath(-1, "TARGETDIR", path, &size);
9912 ok(r == ERROR_INVALID_HANDLE,
9913 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
9914 ok(!lstrcmpA(path, "kiwi"),
9915 "Expected path to be unchanged, got \"%s\"\n", path);
9916 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9917
9918 /* NULL szFolder */
9919 size = MAX_PATH;
9920 lstrcpyA(path, "kiwi");
9921 r = MsiGetSourcePath(hpkg, NULL, path, &size);
9922 ok(r == ERROR_INVALID_PARAMETER,
9923 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
9924 ok(!lstrcmpA(path, "kiwi"),
9925 "Expected path to be unchanged, got \"%s\"\n", path);
9926 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9927
9928 /* empty szFolder */
9929 size = MAX_PATH;
9930 lstrcpyA(path, "kiwi");
9931 r = MsiGetSourcePath(hpkg, "", path, &size);
9932 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9933 ok(!lstrcmpA(path, "kiwi"),
9934 "Expected path to be unchanged, got \"%s\"\n", path);
9935 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9936
9937 /* try TARGETDIR */
9938 size = MAX_PATH;
9939 lstrcpyA(path, "kiwi");
9940 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
9941 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9942 ok(!lstrcmpA(path, "kiwi"),
9943 "Expected path to be unchanged, got \"%s\"\n", path);
9944 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9945
9946 /* try SourceDir */
9947 size = MAX_PATH;
9948 lstrcpyA(path, "kiwi");
9949 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
9950 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9951 ok(!lstrcmpA(path, "kiwi"),
9952 "Expected path to be unchanged, got \"%s\"\n", path);
9953 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9954
9955 /* try SOURCEDIR */
9956 size = MAX_PATH;
9957 lstrcpyA(path, "kiwi");
9958 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9959 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9960 ok(!lstrcmpA(path, "kiwi"),
9961 "Expected path to be unchanged, got \"%s\"\n", path);
9962 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9963
9964 /* source path does not exist, but the property exists */
9965 size = MAX_PATH;
9966 lstrcpyA(path, "kiwi");
9967 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9968 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9969 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9970 ok(size == 0, "Expected 0, got %d\n", size);
9971
9972 /* try SubDir */
9973 size = MAX_PATH;
9974 lstrcpyA(path, "kiwi");
9975 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
9976 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9977 ok(!lstrcmpA(path, "kiwi"),
9978 "Expected path to be unchanged, got \"%s\"\n", path);
9979 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9980
9981 /* try SubDir2 */
9982 size = MAX_PATH;
9983 lstrcpyA(path, "kiwi");
9984 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
9985 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9986 ok(!lstrcmpA(path, "kiwi"),
9987 "Expected path to be unchanged, got \"%s\"\n", path);
9988 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9989
9990 r = MsiDoAction(hpkg, "CostInitialize");
9991 ok(r == ERROR_SUCCESS, "cost init failed\n");
9992
9993 /* try TARGETDIR after CostInitialize */
9994 size = MAX_PATH;
9995 lstrcpyA(path, "kiwi");
9996 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
9997 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9998 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9999 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10000
10001 /* try SourceDir after CostInitialize */
10002 size = MAX_PATH;
10003 lstrcpyA(path, "kiwi");
10004 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10005 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10006 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10007 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10008
10009 /* try SOURCEDIR after CostInitialize */
10010 size = MAX_PATH;
10011 lstrcpyA(path, "kiwi");
10012 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10013 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10014 ok(!lstrcmpA(path, "kiwi"),
10015 "Expected path to be unchanged, got \"%s\"\n", path);
10016 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10017
10018 /* source path does not exist, but the property exists */
10019 size = MAX_PATH;
10020 lstrcpyA(path, "kiwi");
10021 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10022 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10023 todo_wine
10024 {
10025 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10026 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10027 }
10028
10029 /* try SubDir after CostInitialize */
10030 size = MAX_PATH;
10031 lstrcpyA(path, "kiwi");
10032 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10033 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10034 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10035 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10036
10037 /* try SubDir2 after CostInitialize */
10038 size = MAX_PATH;
10039 lstrcpyA(path, "kiwi");
10040 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10041 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10042 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10043 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10044
10045 r = MsiDoAction(hpkg, "ResolveSource");
10046 ok(r == ERROR_SUCCESS, "file cost failed\n");
10047
10048 /* try TARGETDIR after ResolveSource */
10049 size = MAX_PATH;
10050 lstrcpyA(path, "kiwi");
10051 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10052 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10053 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10054 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10055
10056 /* try SourceDir after ResolveSource */
10057 size = MAX_PATH;
10058 lstrcpyA(path, "kiwi");
10059 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10060 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10061 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10062 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10063
10064 /* try SOURCEDIR after ResolveSource */
10065 size = MAX_PATH;
10066 lstrcpyA(path, "kiwi");
10067 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10068 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10069 ok(!lstrcmpA(path, "kiwi"),
10070 "Expected path to be unchanged, got \"%s\"\n", path);
10071 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10072
10073 /* source path does not exist, but the property exists */
10074 size = MAX_PATH;
10075 lstrcpyA(path, "kiwi");
10076 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10077 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10078 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10079 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10080
10081 /* try SubDir after ResolveSource */
10082 size = MAX_PATH;
10083 lstrcpyA(path, "kiwi");
10084 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10085 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10086 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10087 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10088
10089 /* try SubDir2 after ResolveSource */
10090 size = MAX_PATH;
10091 lstrcpyA(path, "kiwi");
10092 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10093 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10094 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10095 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10096
10097 r = MsiDoAction(hpkg, "FileCost");
10098 ok(r == ERROR_SUCCESS, "file cost failed\n");
10099
10100 /* try TARGETDIR after FileCost */
10101 size = MAX_PATH;
10102 lstrcpyA(path, "kiwi");
10103 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10104 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10105 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10106 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10107
10108 /* try SourceDir after FileCost */
10109 size = MAX_PATH;
10110 lstrcpyA(path, "kiwi");
10111 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10112 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10113 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10114 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10115
10116 /* try SOURCEDIR after FileCost */
10117 size = MAX_PATH;
10118 lstrcpyA(path, "kiwi");
10119 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10120 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10121 ok(!lstrcmpA(path, "kiwi"),
10122 "Expected path to be unchanged, got \"%s\"\n", path);
10123 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10124
10125 /* source path does not exist, but the property exists */
10126 size = MAX_PATH;
10127 lstrcpyA(path, "kiwi");
10128 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10129 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10130 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10131 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10132
10133 /* try SubDir after FileCost */
10134 size = MAX_PATH;
10135 lstrcpyA(path, "kiwi");
10136 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10137 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10138 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10139 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10140
10141 /* try SubDir2 after FileCost */
10142 size = MAX_PATH;
10143 lstrcpyA(path, "kiwi");
10144 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10145 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10146 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10147 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10148
10149 r = MsiDoAction(hpkg, "CostFinalize");
10150 ok(r == ERROR_SUCCESS, "file cost failed\n");
10151
10152 /* try TARGETDIR after CostFinalize */
10153 size = MAX_PATH;
10154 lstrcpyA(path, "kiwi");
10155 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10156 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10157 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10158 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10159
10160 /* try SourceDir after CostFinalize */
10161 size = MAX_PATH;
10162 lstrcpyA(path, "kiwi");
10163 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10164 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10165 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10166 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10167
10168 /* try SOURCEDIR after CostFinalize */
10169 size = MAX_PATH;
10170 lstrcpyA(path, "kiwi");
10171 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10172 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10173 ok(!lstrcmpA(path, "kiwi"),
10174 "Expected path to be unchanged, got \"%s\"\n", path);
10175 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10176
10177 /* source path does not exist, but the property exists */
10178 size = MAX_PATH;
10179 lstrcpyA(path, "kiwi");
10180 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10181 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10182 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10183 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10184
10185 /* try SubDir after CostFinalize */
10186 size = MAX_PATH;
10187 lstrcpyA(path, "kiwi");
10188 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10189 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10190 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10191 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10192
10193 /* try SubDir2 after CostFinalize */
10194 size = MAX_PATH;
10195 lstrcpyA(path, "kiwi");
10196 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10197 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10198 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10199 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10200
10201 /* nonexistent directory */
10202 size = MAX_PATH;
10203 lstrcpyA(path, "kiwi");
10204 r = MsiGetSourcePath(hpkg, "IDontExist", path, &size);
10205 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10206 ok(!lstrcmpA(path, "kiwi"),
10207 "Expected path to be unchanged, got \"%s\"\n", path);
10208 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10209
10210 /* NULL szPathBuf */
10211 size = MAX_PATH;
10212 r = MsiGetSourcePath(hpkg, "SourceDir", NULL, &size);
10213 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10214 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10215
10216 /* NULL pcchPathBuf */
10217 lstrcpyA(path, "kiwi");
10218 r = MsiGetSourcePath(hpkg, "SourceDir", path, NULL);
10219 ok(r == ERROR_INVALID_PARAMETER,
10220 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
10221 ok(!lstrcmpA(path, "kiwi"),
10222 "Expected path to be unchanged, got \"%s\"\n", path);
10223
10224 /* pcchPathBuf is 0 */
10225 size = 0;
10226 lstrcpyA(path, "kiwi");
10227 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10228 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
10229 ok(!lstrcmpA(path, "kiwi"),
10230 "Expected path to be unchanged, got \"%s\"\n", path);
10231 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10232
10233 /* pcchPathBuf does not have room for NULL terminator */
10234 size = lstrlenA(cwd);
10235 lstrcpyA(path, "kiwi");
10236 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10237 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
10238 ok(!strncmp(path, cwd, lstrlenA(cwd) - 1),
10239 "Expected path with no backslash, got \"%s\"\n", path);
10240 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10241
10242 /* pcchPathBuf has room for NULL terminator */
10243 size = lstrlenA(cwd) + 1;
10244 lstrcpyA(path, "kiwi");
10245 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10246 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10247 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10248 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10249
10250 MsiCloseHandle(hpkg);
10251
10252 /* compressed source */
10253
10254 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
10255 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10256
10257 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed);
10258
10259 hpkg = package_from_db(hdb);
10260 ok(hpkg, "failed to create package\n");
10261
10262 /* try TARGETDIR */
10263 size = MAX_PATH;
10264 lstrcpyA(path, "kiwi");
10265 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10266 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10267 ok(!lstrcmpA(path, "kiwi"),
10268 "Expected path to be unchanged, got \"%s\"\n", path);
10269 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10270
10271 /* try SourceDir */
10272 size = MAX_PATH;
10273 lstrcpyA(path, "kiwi");
10274 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10275 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10276 ok(!lstrcmpA(path, "kiwi"),
10277 "Expected path to be unchanged, got \"%s\"\n", path);
10278 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10279
10280 /* try SOURCEDIR */
10281 size = MAX_PATH;
10282 lstrcpyA(path, "kiwi");
10283 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10284 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10285 ok(!lstrcmpA(path, "kiwi"),
10286 "Expected path to be unchanged, got \"%s\"\n", path);
10287 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10288
10289 /* source path nor the property exist */
10290 size = MAX_PATH;
10291 lstrcpyA(path, "kiwi");
10292 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10293 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10294 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10295 ok(size == 0, "Expected 0, got %d\n", size);
10296
10297 /* try SubDir */
10298 size = MAX_PATH;
10299 lstrcpyA(path, "kiwi");
10300 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10301 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10302 ok(!lstrcmpA(path, "kiwi"),
10303 "Expected path to be unchanged, got \"%s\"\n", path);
10304 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10305
10306 /* try SubDir2 */
10307 size = MAX_PATH;
10308 lstrcpyA(path, "kiwi");
10309 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10310 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10311 ok(!lstrcmpA(path, "kiwi"),
10312 "Expected path to be unchanged, got \"%s\"\n", path);
10313 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10314
10315 r = MsiDoAction(hpkg, "CostInitialize");
10316 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10317
10318 /* try TARGETDIR after CostInitialize */
10319 size = MAX_PATH;
10320 lstrcpyA(path, "kiwi");
10321 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10322 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10323 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10324 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10325
10326 /* try SourceDir after CostInitialize */
10327 size = MAX_PATH;
10328 lstrcpyA(path, "kiwi");
10329 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10330 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10331 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10332 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10333
10334 /* try SOURCEDIR after CostInitialize */
10335 size = MAX_PATH;
10336 lstrcpyA(path, "kiwi");
10337 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10338 todo_wine
10339 {
10340 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10341 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10342 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10343 }
10344
10345 /* source path does not exist, but the property exists */
10346 size = MAX_PATH;
10347 lstrcpyA(path, "kiwi");
10348 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10349 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10350 todo_wine
10351 {
10352 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10353 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10354 }
10355
10356 /* try SubDir after CostInitialize */
10357 size = MAX_PATH;
10358 lstrcpyA(path, "kiwi");
10359 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10360 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10361 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10362 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10363
10364 /* try SubDir2 after CostInitialize */
10365 size = MAX_PATH;
10366 lstrcpyA(path, "kiwi");
10367 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10368 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10369 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10370 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10371
10372 r = MsiDoAction(hpkg, "ResolveSource");
10373 ok(r == ERROR_SUCCESS, "file cost failed\n");
10374
10375 /* try TARGETDIR after ResolveSource */
10376 size = MAX_PATH;
10377 lstrcpyA(path, "kiwi");
10378 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10379 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10380 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10381 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10382
10383 /* try SourceDir after ResolveSource */
10384 size = MAX_PATH;
10385 lstrcpyA(path, "kiwi");
10386 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10387 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10388 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10389 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10390
10391 /* try SOURCEDIR after ResolveSource */
10392 size = MAX_PATH;
10393 lstrcpyA(path, "kiwi");
10394 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10395 todo_wine
10396 {
10397 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10398 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10399 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10400 }
10401
10402 /* source path and the property exist */
10403 size = MAX_PATH;
10404 lstrcpyA(path, "kiwi");
10405 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10406 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10407 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10408 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10409
10410 /* try SubDir after ResolveSource */
10411 size = MAX_PATH;
10412 lstrcpyA(path, "kiwi");
10413 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10414 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10415 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10416 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10417
10418 /* try SubDir2 after ResolveSource */
10419 size = MAX_PATH;
10420 lstrcpyA(path, "kiwi");
10421 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10422 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10423 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10424 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10425
10426 r = MsiDoAction(hpkg, "FileCost");
10427 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10428
10429 /* try TARGETDIR after CostFinalize */
10430 size = MAX_PATH;
10431 lstrcpyA(path, "kiwi");
10432 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10433 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10434 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10435 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10436
10437 /* try SourceDir after CostFinalize */
10438 size = MAX_PATH;
10439 lstrcpyA(path, "kiwi");
10440 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10441 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10442 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10443 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10444
10445 /* try SOURCEDIR after CostFinalize */
10446 size = MAX_PATH;
10447 lstrcpyA(path, "kiwi");
10448 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10449 todo_wine
10450 {
10451 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10452 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10453 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10454 }
10455
10456 /* source path and the property exist */
10457 size = MAX_PATH;
10458 lstrcpyA(path, "kiwi");
10459 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10460 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10461 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10462 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10463
10464 /* try SubDir after CostFinalize */
10465 size = MAX_PATH;
10466 lstrcpyA(path, "kiwi");
10467 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10468 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10469 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10470 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10471
10472 /* try SubDir2 after CostFinalize */
10473 size = MAX_PATH;
10474 lstrcpyA(path, "kiwi");
10475 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10476 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10477 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10478 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10479
10480 r = MsiDoAction(hpkg, "CostFinalize");
10481 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10482
10483 /* try TARGETDIR after CostFinalize */
10484 size = MAX_PATH;
10485 lstrcpyA(path, "kiwi");
10486 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10487 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10488 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10489 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10490
10491 /* try SourceDir after CostFinalize */
10492 size = MAX_PATH;
10493 lstrcpyA(path, "kiwi");
10494 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10495 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10496 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10497 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10498
10499 /* try SOURCEDIR after CostFinalize */
10500 size = MAX_PATH;
10501 lstrcpyA(path, "kiwi");
10502 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10503 todo_wine
10504 {
10505 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10506 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10507 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10508 }
10509
10510 /* source path and the property exist */
10511 size = MAX_PATH;
10512 lstrcpyA(path, "kiwi");
10513 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10514 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10515 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10516 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10517
10518 /* try SubDir after CostFinalize */
10519 size = MAX_PATH;
10520 lstrcpyA(path, "kiwi");
10521 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10522 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10523 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10524 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10525
10526 /* try SubDir2 after CostFinalize */
10527 size = MAX_PATH;
10528 lstrcpyA(path, "kiwi");
10529 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10530 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10531 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10532 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10533
10534 MsiCloseHandle(hpkg);
10535 DeleteFile(msifile);
10536 }
10537
10538 static void test_shortlongsource(void)
10539 {
10540 MSIHANDLE hdb, hpkg;
10541 CHAR path[MAX_PATH];
10542 CHAR cwd[MAX_PATH];
10543 CHAR subsrc[MAX_PATH];
10544 DWORD size;
10545 UINT r;
10546
10547 lstrcpyA(cwd, CURR_DIR);
10548 lstrcatA(cwd, "\\");
10549
10550 lstrcpyA(subsrc, cwd);
10551 lstrcatA(subsrc, "long");
10552 lstrcatA(subsrc, "\\");
10553
10554 /* long file names */
10555
10556 hdb = create_package_db();
10557 ok( hdb, "failed to create database\n");
10558
10559 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
10560
10561 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
10562 ok(r == S_OK, "failed\n");
10563
10564 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'short|long'");
10565 ok(r == S_OK, "failed\n");
10566
10567 /* CostInitialize:short */
10568 r = add_directory_entry(hdb, "'SubDir2', 'TARGETDIR', 'one|two'");
10569 ok(r == S_OK, "failed\n");
10570
10571 /* CostInitialize:long */
10572 r = add_directory_entry(hdb, "'SubDir3', 'TARGETDIR', 'three|four'");
10573 ok(r == S_OK, "failed\n");
10574
10575 /* FileCost:short */
10576 r = add_directory_entry(hdb, "'SubDir4', 'TARGETDIR', 'five|six'");
10577 ok(r == S_OK, "failed\n");
10578
10579 /* FileCost:long */
10580 r = add_directory_entry(hdb, "'SubDir5', 'TARGETDIR', 'seven|eight'");
10581 ok(r == S_OK, "failed\n");
10582
10583 /* CostFinalize:short */
10584 r = add_directory_entry(hdb, "'SubDir6', 'TARGETDIR', 'nine|ten'");
10585 ok(r == S_OK, "failed\n");
10586
10587 /* CostFinalize:long */
10588 r = add_directory_entry(hdb, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
10589 ok(r == S_OK, "failed\n");
10590
10591 MsiDatabaseCommit(hdb);
10592
10593 hpkg = package_from_db(hdb);
10594 ok(hpkg, "failed to create package\n");
10595
10596 MsiCloseHandle(hdb);
10597
10598 CreateDirectoryA("one", NULL);
10599 CreateDirectoryA("four", NULL);
10600
10601 r = MsiDoAction(hpkg, "CostInitialize");
10602 ok(r == ERROR_SUCCESS, "file cost failed\n");
10603
10604 CreateDirectory("five", NULL);
10605 CreateDirectory("eight", NULL);
10606
10607 r = MsiDoAction(hpkg, "FileCost");
10608 ok(r == ERROR_SUCCESS, "file cost failed\n");
10609
10610 CreateDirectory("nine", NULL);
10611 CreateDirectory("twelve", NULL);
10612
10613 r = MsiDoAction(hpkg, "CostFinalize");
10614 ok(r == ERROR_SUCCESS, "file cost failed\n");
10615
10616 /* neither short nor long source directories exist */
10617 size = MAX_PATH;
10618 lstrcpyA(path, "kiwi");
10619 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10620 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10621 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10622 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10623
10624 CreateDirectoryA("short", NULL);
10625
10626 /* short source directory exists */
10627 size = MAX_PATH;
10628 lstrcpyA(path, "kiwi");
10629 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10630 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10631 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10632 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10633
10634 CreateDirectoryA("long", NULL);
10635
10636 /* both short and long source directories exist */
10637 size = MAX_PATH;
10638 lstrcpyA(path, "kiwi");
10639 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10640 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10641 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10642 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10643
10644 lstrcpyA(subsrc, cwd);
10645 lstrcatA(subsrc, "two");
10646 lstrcatA(subsrc, "\\");
10647
10648 /* short dir exists before CostInitialize */
10649 size = MAX_PATH;
10650 lstrcpyA(path, "kiwi");
10651 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10652 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10653 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10654 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10655
10656 lstrcpyA(subsrc, cwd);
10657 lstrcatA(subsrc, "four");
10658 lstrcatA(subsrc, "\\");
10659
10660 /* long dir exists before CostInitialize */
10661 size = MAX_PATH;
10662 lstrcpyA(path, "kiwi");
10663 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
10664 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10665 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10666 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10667
10668 lstrcpyA(subsrc, cwd);
10669 lstrcatA(subsrc, "six");
10670 lstrcatA(subsrc, "\\");
10671
10672 /* short dir exists before FileCost */
10673 size = MAX_PATH;
10674 lstrcpyA(path, "kiwi");
10675 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
10676 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10677 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10678 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10679
10680 lstrcpyA(subsrc, cwd);
10681 lstrcatA(subsrc, "eight");
10682 lstrcatA(subsrc, "\\");
10683
10684 /* long dir exists before FileCost */
10685 size = MAX_PATH;
10686 lstrcpyA(path, "kiwi");
10687 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
10688 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10689 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10690 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10691
10692 lstrcpyA(subsrc, cwd);
10693 lstrcatA(subsrc, "ten");
10694 lstrcatA(subsrc, "\\");
10695
10696 /* short dir exists before CostFinalize */
10697 size = MAX_PATH;
10698 lstrcpyA(path, "kiwi");
10699 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
10700 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10701 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10702 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10703
10704 lstrcpyA(subsrc, cwd);
10705 lstrcatA(subsrc, "twelve");
10706 lstrcatA(subsrc, "\\");
10707
10708 /* long dir exists before CostFinalize */
10709 size = MAX_PATH;
10710 lstrcpyA(path, "kiwi");
10711 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
10712 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10713 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10714 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10715
10716 MsiCloseHandle(hpkg);
10717 RemoveDirectoryA("short");
10718 RemoveDirectoryA("long");
10719 RemoveDirectoryA("one");
10720 RemoveDirectoryA("four");
10721 RemoveDirectoryA("five");
10722 RemoveDirectoryA("eight");
10723 RemoveDirectoryA("nine");
10724 RemoveDirectoryA("twelve");
10725
10726 /* short file names */
10727
10728 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
10729 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10730
10731 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
10732
10733 hpkg = package_from_db(hdb);
10734 ok(hpkg, "failed to create package\n");
10735
10736 MsiCloseHandle(hdb);
10737
10738 CreateDirectoryA("one", NULL);
10739 CreateDirectoryA("four", NULL);
10740
10741 r = MsiDoAction(hpkg, "CostInitialize");
10742 ok(r == ERROR_SUCCESS, "file cost failed\n");
10743
10744 CreateDirectory("five", NULL);
10745 CreateDirectory("eight", NULL);
10746
10747 r = MsiDoAction(hpkg, "FileCost");
10748 ok(r == ERROR_SUCCESS, "file cost failed\n");
10749
10750 CreateDirectory("nine", NULL);
10751 CreateDirectory("twelve", NULL);
10752
10753 r = MsiDoAction(hpkg, "CostFinalize");
10754 ok(r == ERROR_SUCCESS, "file cost failed\n");
10755
10756 lstrcpyA(subsrc, cwd);
10757 lstrcatA(subsrc, "short");
10758 lstrcatA(subsrc, "\\");
10759
10760 /* neither short nor long source directories exist */
10761 size = MAX_PATH;
10762 lstrcpyA(path, "kiwi");
10763 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10764 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10765 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10766 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10767
10768 CreateDirectoryA("short", NULL);
10769
10770 /* short source directory exists */
10771 size = MAX_PATH;
10772 lstrcpyA(path, "kiwi");
10773 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10774 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10775 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10776 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10777
10778 CreateDirectoryA("long", NULL);
10779
10780 /* both short and long source directories exist */
10781 size = MAX_PATH;
10782 lstrcpyA(path, "kiwi");
10783 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10784 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10785 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10786 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10787
10788 lstrcpyA(subsrc, cwd);
10789 lstrcatA(subsrc, "one");
10790 lstrcatA(subsrc, "\\");
10791
10792 /* short dir exists before CostInitialize */
10793 size = MAX_PATH;
10794 lstrcpyA(path, "kiwi");
10795 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10796 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10797 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10798 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10799
10800 lstrcpyA(subsrc, cwd);
10801 lstrcatA(subsrc, "three");
10802 lstrcatA(subsrc, "\\");
10803
10804 /* long dir exists before CostInitialize */
10805 size = MAX_PATH;
10806 lstrcpyA(path, "kiwi");
10807 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
10808 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10809 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10810 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10811
10812 lstrcpyA(subsrc, cwd);
10813 lstrcatA(subsrc, "five");
10814 lstrcatA(subsrc, "\\");
10815
10816 /* short dir exists before FileCost */
10817 size = MAX_PATH;
10818 lstrcpyA(path, "kiwi");
10819 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
10820 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10821 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10822 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10823
10824 lstrcpyA(subsrc, cwd);
10825 lstrcatA(subsrc, "seven");
10826 lstrcatA(subsrc, "\\");
10827
10828 /* long dir exists before FileCost */
10829 size = MAX_PATH;
10830 lstrcpyA(path, "kiwi");
10831 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
10832 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10833 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10834 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10835
10836 lstrcpyA(subsrc, cwd);
10837 lstrcatA(subsrc, "nine");
10838 lstrcatA(subsrc, "\\");
10839
10840 /* short dir exists before CostFinalize */
10841 size = MAX_PATH;
10842 lstrcpyA(path, "kiwi");
10843 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
10844 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10845 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10846 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10847
10848 lstrcpyA(subsrc, cwd);
10849 lstrcatA(subsrc, "eleven");
10850 lstrcatA(subsrc, "\\");
10851
10852 /* long dir exists before CostFinalize */
10853 size = MAX_PATH;
10854 lstrcpyA(path, "kiwi");
10855 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
10856 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10857 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10858 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10859
10860 MsiCloseHandle(hpkg);
10861 RemoveDirectoryA("short");
10862 RemoveDirectoryA("long");
10863 RemoveDirectoryA("one");
10864 RemoveDirectoryA("four");
10865 RemoveDirectoryA("five");
10866 RemoveDirectoryA("eight");
10867 RemoveDirectoryA("nine");
10868 RemoveDirectoryA("twelve");
10869 DeleteFileA(msifile);
10870 }
10871
10872 static void test_sourcedir(void)
10873 {
10874 MSIHANDLE hdb, hpkg;
10875 CHAR package[10];
10876 CHAR path[MAX_PATH];
10877 CHAR cwd[MAX_PATH];
10878 CHAR subsrc[MAX_PATH];
10879 DWORD size;
10880 UINT r;
10881
10882 lstrcpyA(cwd, CURR_DIR);
10883 lstrcatA(cwd, "\\");
10884
10885 lstrcpyA(subsrc, cwd);
10886 lstrcatA(subsrc, "long");
10887 lstrcatA(subsrc, "\\");
10888
10889 hdb = create_package_db();
10890 ok( hdb, "failed to create database\n");
10891
10892 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
10893 ok(r == S_OK, "failed\n");
10894
10895 sprintf(package, "#%i", hdb);
10896 r = MsiOpenPackage(package, &hpkg);
10897 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10898
10899 /* properties only */
10900
10901 /* SourceDir prop */
10902 size = MAX_PATH;
10903 lstrcpyA(path, "kiwi");
10904 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10905 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10906 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10907 ok(size == 0, "Expected 0, got %d\n", size);
10908
10909 /* SOURCEDIR prop */
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 r = MsiDoAction(hpkg, "CostInitialize");
10918 ok(r == ERROR_SUCCESS, "file cost failed\n");
10919
10920 /* SourceDir after CostInitialize */
10921 size = MAX_PATH;
10922 lstrcpyA(path, "kiwi");
10923 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10924 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10925 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10926 ok(size == 0, "Expected 0, got %d\n", size);
10927
10928 /* SOURCEDIR after CostInitialize */
10929 size = MAX_PATH;
10930 lstrcpyA(path, "kiwi");
10931 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10932 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10933 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10934 ok(size == 0, "Expected 0, got %d\n", size);
10935
10936 r = MsiDoAction(hpkg, "FileCost");
10937 ok(r == ERROR_SUCCESS, "file cost failed\n");
10938
10939 /* SourceDir after FileCost */
10940 size = MAX_PATH;
10941 lstrcpyA(path, "kiwi");
10942 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10943 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10944 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10945 ok(size == 0, "Expected 0, got %d\n", size);
10946
10947 /* SOURCEDIR after FileCost */
10948 size = MAX_PATH;
10949 lstrcpyA(path, "kiwi");
10950 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10951 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10952 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10953 ok(size == 0, "Expected 0, got %d\n", size);
10954
10955 r = MsiDoAction(hpkg, "CostFinalize");
10956 ok(r == ERROR_SUCCESS, "file cost failed\n");
10957
10958 /* SourceDir after CostFinalize */
10959 size = MAX_PATH;
10960 lstrcpyA(path, "kiwi");
10961 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10962 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10963 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10964 ok(size == 0, "Expected 0, got %d\n", size);
10965
10966 /* SOURCEDIR after CostFinalize */
10967 size = MAX_PATH;
10968 lstrcpyA(path, "kiwi");
10969 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10970 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10971 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10972 ok(size == 0, "Expected 0, got %d\n", size);
10973
10974 r = MsiDoAction(hpkg, "ResolveSource");
10975 ok(r == ERROR_SUCCESS, "file cost failed\n");
10976
10977 /* SourceDir after ResolveSource */
10978 size = MAX_PATH;
10979 lstrcpyA(path, "kiwi");
10980 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10981 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10982 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10983 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10984
10985 /* SOURCEDIR after ResolveSource */
10986 size = MAX_PATH;
10987 lstrcpyA(path, "kiwi");
10988 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10989 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10990 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10991 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10992
10993 /* random casing */
10994 size = MAX_PATH;
10995 lstrcpyA(path, "kiwi");
10996 r = MsiGetProperty(hpkg, "SoUrCeDiR", path, &size);
10997 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10998 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10999 ok(size == 0, "Expected 0, got %d\n", size);
11000
11001 MsiCloseHandle(hpkg);
11002
11003 /* reset the package state */
11004 sprintf(package, "#%i", hdb);
11005 r = MsiOpenPackage(package, &hpkg);
11006 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11007
11008 /* test how MsiGetSourcePath affects the properties */
11009
11010 /* SourceDir prop */
11011 size = MAX_PATH;
11012 lstrcpyA(path, "kiwi");
11013 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11014 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11015 todo_wine
11016 {
11017 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11018 ok(size == 0, "Expected 0, got %d\n", size);
11019 }
11020
11021 size = MAX_PATH;
11022 lstrcpyA(path, "kiwi");
11023 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11024 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11025 ok(!lstrcmpA(path, "kiwi"),
11026 "Expected path to be unchanged, got \"%s\"\n", path);
11027 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11028
11029 /* SourceDir after MsiGetSourcePath */
11030 size = MAX_PATH;
11031 lstrcpyA(path, "kiwi");
11032 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11033 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11034 todo_wine
11035 {
11036 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11037 ok(size == 0, "Expected 0, got %d\n", size);
11038 }
11039
11040 /* SOURCEDIR prop */
11041 size = MAX_PATH;
11042 lstrcpyA(path, "kiwi");
11043 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11044 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11045 todo_wine
11046 {
11047 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11048 ok(size == 0, "Expected 0, got %d\n", size);
11049 }
11050
11051 size = MAX_PATH;
11052 lstrcpyA(path, "kiwi");
11053 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11054 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11055 ok(!lstrcmpA(path, "kiwi"),
11056 "Expected path to be unchanged, got \"%s\"\n", path);
11057 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11058
11059 /* SOURCEDIR prop after MsiGetSourcePath */
11060 size = MAX_PATH;
11061 lstrcpyA(path, "kiwi");
11062 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11063 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11064 todo_wine
11065 {
11066 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11067 ok(size == 0, "Expected 0, got %d\n", size);
11068 }
11069
11070 r = MsiDoAction(hpkg, "CostInitialize");
11071 ok(r == ERROR_SUCCESS, "file cost failed\n");
11072
11073 /* SourceDir after CostInitialize */
11074 size = MAX_PATH;
11075 lstrcpyA(path, "kiwi");
11076 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11077 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11078 todo_wine
11079 {
11080 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11081 ok(size == 0, "Expected 0, got %d\n", size);
11082 }
11083
11084 size = MAX_PATH;
11085 lstrcpyA(path, "kiwi");
11086 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11087 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11088 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11089 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11090
11091 /* SourceDir after MsiGetSourcePath */
11092 size = MAX_PATH;
11093 lstrcpyA(path, "kiwi");
11094 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11095 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11096 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11097 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11098
11099 /* SOURCEDIR after CostInitialize */
11100 size = MAX_PATH;
11101 lstrcpyA(path, "kiwi");
11102 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11103 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11104 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11105 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11106
11107 /* SOURCEDIR source path still does not exist */
11108 size = MAX_PATH;
11109 lstrcpyA(path, "kiwi");
11110 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11111 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11112 ok(!lstrcmpA(path, "kiwi"),
11113 "Expected path to be unchanged, got \"%s\"\n", path);
11114 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11115
11116 r = MsiDoAction(hpkg, "FileCost");
11117 ok(r == ERROR_SUCCESS, "file cost failed\n");
11118
11119 /* SourceDir after FileCost */
11120 size = MAX_PATH;
11121 lstrcpyA(path, "kiwi");
11122 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11123 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11124 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11125 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11126
11127 /* SOURCEDIR after FileCost */
11128 size = MAX_PATH;
11129 lstrcpyA(path, "kiwi");
11130 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11131 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11132 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11133 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11134
11135 /* SOURCEDIR source path still does not exist */
11136 size = MAX_PATH;
11137 lstrcpyA(path, "kiwi");
11138 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11139 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11140 ok(!lstrcmpA(path, "kiwi"),
11141 "Expected path to be unchanged, got \"%s\"\n", path);
11142 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11143
11144 r = MsiDoAction(hpkg, "CostFinalize");
11145 ok(r == ERROR_SUCCESS, "file cost failed\n");
11146
11147 /* SourceDir after CostFinalize */
11148 size = MAX_PATH;
11149 lstrcpyA(path, "kiwi");
11150 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11151 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11152 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11153 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11154
11155 /* SOURCEDIR after CostFinalize */
11156 size = MAX_PATH;
11157 lstrcpyA(path, "kiwi");
11158 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11159 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11160 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11161 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11162
11163 /* SOURCEDIR source path still does not exist */
11164 size = MAX_PATH;
11165 lstrcpyA(path, "kiwi");
11166 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11167 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11168 ok(!lstrcmpA(path, "kiwi"),
11169 "Expected path to be unchanged, got \"%s\"\n", path);
11170 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11171
11172 r = MsiDoAction(hpkg, "ResolveSource");
11173 ok(r == ERROR_SUCCESS, "file cost failed\n");
11174
11175 /* SourceDir after ResolveSource */
11176 size = MAX_PATH;
11177 lstrcpyA(path, "kiwi");
11178 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11179 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11180 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11181 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11182
11183 /* SOURCEDIR after ResolveSource */
11184 size = MAX_PATH;
11185 lstrcpyA(path, "kiwi");
11186 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11187 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11188 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11189 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11190
11191 /* SOURCEDIR source path still does not exist */
11192 size = MAX_PATH;
11193 lstrcpyA(path, "kiwi");
11194 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11195 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11196 ok(!lstrcmpA(path, "kiwi"),
11197 "Expected path to be unchanged, got \"%s\"\n", path);
11198 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11199
11200 MsiCloseHandle(hdb);
11201 MsiCloseHandle(hpkg);
11202 DeleteFileA(msifile);
11203 }
11204
11205 struct access_res
11206 {
11207 BOOL gothandle;
11208 DWORD lasterr;
11209 BOOL ignore;
11210 };
11211
11212 static const struct access_res create[16] =
11213 {
11214 { TRUE, ERROR_SUCCESS, TRUE },
11215 { TRUE, ERROR_SUCCESS, TRUE },
11216 { TRUE, ERROR_SUCCESS, FALSE },
11217 { TRUE, ERROR_SUCCESS, FALSE },
11218 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11219 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11220 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11221 { TRUE, ERROR_SUCCESS, FALSE },
11222 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11223 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11224 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11225 { TRUE, ERROR_SUCCESS, TRUE },
11226 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11227 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11228 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11229 { TRUE, ERROR_SUCCESS, TRUE }
11230 };
11231
11232 static const struct access_res create_commit[16] =
11233 {
11234 { TRUE, ERROR_SUCCESS, TRUE },
11235 { TRUE, ERROR_SUCCESS, TRUE },
11236 { TRUE, ERROR_SUCCESS, FALSE },
11237 { TRUE, ERROR_SUCCESS, FALSE },
11238 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11239 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11240 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11241 { TRUE, ERROR_SUCCESS, FALSE },
11242 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11243 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11244 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11245 { TRUE, ERROR_SUCCESS, TRUE },
11246 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11247 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11248 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11249 { TRUE, ERROR_SUCCESS, TRUE }
11250 };
11251
11252 static const struct access_res create_close[16] =
11253 {
11254 { TRUE, ERROR_SUCCESS, FALSE },
11255 { TRUE, ERROR_SUCCESS, FALSE },
11256 { TRUE, ERROR_SUCCESS, FALSE },
11257 { TRUE, ERROR_SUCCESS, FALSE },
11258 { TRUE, ERROR_SUCCESS, FALSE },
11259 { TRUE, ERROR_SUCCESS, FALSE },
11260 { TRUE, ERROR_SUCCESS, FALSE },
11261 { TRUE, ERROR_SUCCESS, FALSE },
11262 { TRUE, ERROR_SUCCESS, FALSE },
11263 { TRUE, ERROR_SUCCESS, FALSE },
11264 { TRUE, ERROR_SUCCESS, FALSE },
11265 { TRUE, ERROR_SUCCESS, FALSE },
11266 { TRUE, ERROR_SUCCESS, FALSE },
11267 { TRUE, ERROR_SUCCESS, FALSE },
11268 { TRUE, ERROR_SUCCESS, FALSE },
11269 { TRUE, ERROR_SUCCESS }
11270 };
11271
11272 static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line)
11273 {
11274 DWORD access = 0, share = 0;
11275 DWORD lasterr;
11276 HANDLE hfile;
11277 int i, j, idx = 0;
11278
11279 for (i = 0; i < 4; i++)
11280 {
11281 if (i == 0) access = 0;
11282 if (i == 1) access = GENERIC_READ;
11283 if (i == 2) access = GENERIC_WRITE;
11284 if (i == 3) access = GENERIC_READ | GENERIC_WRITE;
11285
11286 for (j = 0; j < 4; j++)
11287 {
11288 if (ares[idx].ignore)
11289 continue;
11290
11291 if (j == 0) share = 0;
11292 if (j == 1) share = FILE_SHARE_READ;
11293 if (j == 2) share = FILE_SHARE_WRITE;
11294 if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE;
11295
11296 SetLastError(0xdeadbeef);
11297 hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
11298 FILE_ATTRIBUTE_NORMAL, 0);
11299 lasterr = GetLastError();
11300
11301 ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
11302 "(%d, handle, %d): Expected %d, got %d\n",
11303 line, idx, ares[idx].gothandle,
11304 (hfile != INVALID_HANDLE_VALUE));
11305
11306 ok(lasterr == ares[idx].lasterr ||
11307 lasterr == 0xdeadbeef, /* win9x */
11308 "(%d, lasterr, %d): Expected %d, got %d\n",
11309 line, idx, ares[idx].lasterr, lasterr);
11310
11311 CloseHandle(hfile);
11312 idx++;
11313 }
11314 }
11315 }
11316
11317 #define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
11318
11319 static void test_access(void)
11320 {
11321 MSIHANDLE hdb;
11322 UINT r;
11323
11324 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
11325 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11326
11327 test_file_access(msifile, create);
11328
11329 r = MsiDatabaseCommit(hdb);
11330 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11331
11332 test_file_access(msifile, create_commit);
11333
11334 MsiCloseHandle(hdb);
11335
11336 test_file_access(msifile, create_close);
11337
11338 DeleteFileA(msifile);
11339
11340 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATEDIRECT, &hdb);
11341 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11342
11343 test_file_access(msifile, create);
11344
11345 r = MsiDatabaseCommit(hdb);
11346 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11347
11348 test_file_access(msifile, create_commit);
11349
11350 MsiCloseHandle(hdb);
11351
11352 test_file_access(msifile, create_close);
11353
11354 DeleteFileA(msifile);
11355 }
11356
11357 static void test_emptypackage(void)
11358 {
11359 MSIHANDLE hpkg = 0, hdb = 0, hsuminfo = 0;
11360 MSIHANDLE hview = 0, hrec = 0;
11361 MSICONDITION condition;
11362 CHAR buffer[MAX_PATH];
11363 DWORD size;
11364 UINT r;
11365
11366 r = MsiOpenPackageA("", &hpkg);
11367 todo_wine
11368 {
11369 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11370 }
11371
11372 hdb = MsiGetActiveDatabase(hpkg);
11373 todo_wine
11374 {
11375 ok(hdb != 0, "Expected a valid database handle\n");
11376 }
11377
11378 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Tables`", &hview);
11379 todo_wine
11380 {
11381 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11382 }
11383 r = MsiViewExecute(hview, 0);
11384 todo_wine
11385 {
11386 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11387 }
11388
11389 r = MsiViewFetch(hview, &hrec);
11390 todo_wine
11391 {
11392 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11393 }
11394
11395 buffer[0] = 0;
11396 size = MAX_PATH;
11397 r = MsiRecordGetString(hrec, 1, buffer, &size);
11398 todo_wine
11399 {
11400 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11401 ok(!lstrcmpA(buffer, "_Property"),
11402 "Expected \"_Property\", got \"%s\"\n", buffer);
11403 }
11404
11405 MsiCloseHandle(hrec);
11406
11407 r = MsiViewFetch(hview, &hrec);
11408 todo_wine
11409 {
11410 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11411 }
11412
11413 size = MAX_PATH;
11414 r = MsiRecordGetString(hrec, 1, buffer, &size);
11415 todo_wine
11416 {
11417 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11418 ok(!lstrcmpA(buffer, "#_FolderCache"),
11419 "Expected \"_Property\", got \"%s\"\n", buffer);
11420 }
11421
11422 MsiCloseHandle(hrec);
11423 MsiViewClose(hview);
11424 MsiCloseHandle(hview);
11425
11426 condition = MsiDatabaseIsTablePersistentA(hdb, "_Property");
11427 todo_wine
11428 {
11429 ok(condition == MSICONDITION_FALSE,
11430 "Expected MSICONDITION_FALSE, got %d\n", condition);
11431 }
11432
11433 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
11434 todo_wine
11435 {
11436 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11437 }
11438 r = MsiViewExecute(hview, 0);
11439 todo_wine
11440 {
11441 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11442 }
11443
11444 /* _Property table is not empty */
11445 r = MsiViewFetch(hview, &hrec);
11446 todo_wine
11447 {
11448 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11449 }
11450
11451 MsiCloseHandle(hrec);
11452 MsiViewClose(hview);
11453 MsiCloseHandle(hview);
11454
11455 condition = MsiDatabaseIsTablePersistentA(hdb, "#_FolderCache");
11456 todo_wine
11457 {
11458 ok(condition == MSICONDITION_FALSE,
11459 "Expected MSICONDITION_FALSE, got %d\n", condition);
11460 }
11461
11462 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `#_FolderCache`", &hview);
11463 todo_wine
11464 {
11465 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11466 }
11467 r = MsiViewExecute(hview, 0);
11468 todo_wine
11469 {
11470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11471 }
11472
11473 /* #_FolderCache is not empty */
11474 r = MsiViewFetch(hview, &hrec);
11475 todo_wine
11476 {
11477 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11478 }
11479
11480 MsiCloseHandle(hrec);
11481 MsiViewClose(hview);
11482 MsiCloseHandle(hview);
11483
11484 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Streams`", &hview);
11485 todo_wine
11486 {
11487 ok(r == ERROR_BAD_QUERY_SYNTAX,
11488 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11489 }
11490
11491 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Storages`", &hview);
11492 todo_wine
11493 {
11494 ok(r == ERROR_BAD_QUERY_SYNTAX,
11495 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11496 }
11497
11498 r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsuminfo);
11499 todo_wine
11500 {
11501 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
11502 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
11503 }
11504
11505 MsiCloseHandle(hsuminfo);
11506
11507 r = MsiDatabaseCommit(hdb);
11508 todo_wine
11509 {
11510 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11511 }
11512
11513 MsiCloseHandle(hdb);
11514 MsiCloseHandle(hpkg);
11515 }
11516
11517 static void test_MsiGetProductProperty(void)
11518 {
11519 MSIHANDLE hprod, hdb;
11520 CHAR val[MAX_PATH];
11521 CHAR path[MAX_PATH];
11522 CHAR query[MAX_PATH];
11523 CHAR keypath[MAX_PATH*2];
11524 CHAR prodcode[MAX_PATH];
11525 CHAR prod_squashed[MAX_PATH];
11526 HKEY prodkey, userkey, props;
11527 DWORD size;
11528 LONG res;
11529 UINT r;
11530 SC_HANDLE scm;
11531
11532 scm = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
11533 if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
11534 {
11535 win_skip("Different registry keys on Win9x and WinMe\n");
11536 return;
11537 }
11538 CloseServiceHandle(scm);
11539
11540 GetCurrentDirectoryA(MAX_PATH, path);
11541 lstrcatA(path, "\\");
11542
11543 create_test_guid(prodcode, prod_squashed);
11544
11545 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
11546 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11547
11548 r = MsiDatabaseCommit(hdb);
11549 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11550
11551 r = set_summary_info(hdb);
11552 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11553
11554 r = run_query(hdb,
11555 "CREATE TABLE `Directory` ( "
11556 "`Directory` CHAR(255) NOT NULL, "
11557 "`Directory_Parent` CHAR(255), "
11558 "`DefaultDir` CHAR(255) NOT NULL "
11559 "PRIMARY KEY `Directory`)");
11560 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11561
11562 r = run_query(hdb,
11563 "CREATE TABLE `Property` ( "
11564 "`Property` CHAR(72) NOT NULL, "
11565 "`Value` CHAR(255) "
11566 "PRIMARY KEY `Property`)");
11567 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11568
11569 sprintf(query, "INSERT INTO `Property` "
11570 "(`Property`, `Value`) "
11571 "VALUES( 'ProductCode', '%s' )", prodcode);
11572 r = run_query(hdb, query);
11573 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11574
11575 r = MsiDatabaseCommit(hdb);
11576 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11577
11578 MsiCloseHandle(hdb);
11579
11580 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
11581 lstrcatA(keypath, prod_squashed);
11582
11583 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
11584 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11585
11586 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
11587 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
11588 lstrcatA(keypath, prod_squashed);
11589
11590 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
11591 if (res == ERROR_ACCESS_DENIED)
11592 {
11593 skip("Not enough rights to perform tests\n");
11594 RegDeleteKeyA(prodkey, "");
11595 RegCloseKey(prodkey);
11596 return;
11597 }
11598 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11599
11600 res = RegCreateKeyA(userkey, "InstallProperties", &props);
11601 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11602
11603 lstrcpyA(val, path);
11604 lstrcatA(val, "\\winetest.msi");
11605 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
11606 (const BYTE *)val, lstrlenA(val) + 1);
11607 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11608
11609 hprod = 0xdeadbeef;
11610 r = MsiOpenProductA(prodcode, &hprod);
11611 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11612 ok(hprod != 0 && hprod != 0xdeadbeef, "Expected a valid product handle\n");
11613
11614 /* hProduct is invalid */
11615 size = MAX_PATH;
11616 lstrcpyA(val, "apple");
11617 r = MsiGetProductPropertyA(0xdeadbeef, "ProductCode", val, &size);
11618 ok(r == ERROR_INVALID_HANDLE,
11619 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
11620 ok(!lstrcmpA(val, "apple"),
11621 "Expected val to be unchanged, got \"%s\"\n", val);
11622 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11623
11624 /* szProperty is NULL */
11625 size = MAX_PATH;
11626 lstrcpyA(val, "apple");
11627 r = MsiGetProductPropertyA(hprod, NULL, val, &size);
11628 ok(r == ERROR_INVALID_PARAMETER,
11629 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11630 ok(!lstrcmpA(val, "apple"),
11631 "Expected val to be unchanged, got \"%s\"\n", val);
11632 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11633
11634 /* szProperty is empty */
11635 size = MAX_PATH;
11636 lstrcpyA(val, "apple");
11637 r = MsiGetProductPropertyA(hprod, "", val, &size);
11638 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11639 ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
11640 ok(size == 0, "Expected 0, got %d\n", size);
11641
11642 /* get the property */
11643 size = MAX_PATH;
11644 lstrcpyA(val, "apple");
11645 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11646 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11647 ok(!lstrcmpA(val, prodcode),
11648 "Expected \"%s\", got \"%s\"\n", prodcode, val);
11649 ok(size == lstrlenA(prodcode),
11650 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11651
11652 /* lpValueBuf is NULL */
11653 size = MAX_PATH;
11654 r = MsiGetProductPropertyA(hprod, "ProductCode", NULL, &size);
11655 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11656 ok(size == lstrlenA(prodcode),
11657 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11658
11659 /* pcchValueBuf is NULL */
11660 lstrcpyA(val, "apple");
11661 r = MsiGetProductPropertyA(hprod, "ProductCode", val, NULL);
11662 ok(r == ERROR_INVALID_PARAMETER,
11663 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11664 ok(!lstrcmpA(val, "apple"),
11665 "Expected val to be unchanged, got \"%s\"\n", val);
11666 ok(size == lstrlenA(prodcode),
11667 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11668
11669 /* pcchValueBuf is too small */
11670 size = 4;
11671 lstrcpyA(val, "apple");
11672 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11673 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
11674 ok(!strncmp(val, prodcode, 3),
11675 "Expected first 3 chars of \"%s\", got \"%s\"\n", prodcode, val);
11676 ok(size == lstrlenA(prodcode),
11677 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11678
11679 /* pcchValueBuf does not leave room for NULL terminator */
11680 size = lstrlenA(prodcode);
11681 lstrcpyA(val, "apple");
11682 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11683 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
11684 ok(!strncmp(val, prodcode, lstrlenA(prodcode) - 1),
11685 "Expected first 37 chars of \"%s\", got \"%s\"\n", prodcode, val);
11686 ok(size == lstrlenA(prodcode),
11687 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11688
11689 /* pcchValueBuf has enough room for NULL terminator */
11690 size = lstrlenA(prodcode) + 1;
11691 lstrcpyA(val, "apple");
11692 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11693 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11694 ok(!lstrcmpA(val, prodcode),
11695 "Expected \"%s\", got \"%s\"\n", prodcode, val);
11696 ok(size == lstrlenA(prodcode),
11697 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11698
11699 /* nonexistent property */
11700 size = MAX_PATH;
11701 lstrcpyA(val, "apple");
11702 r = MsiGetProductPropertyA(hprod, "IDontExist", val, &size);
11703 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11704 ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
11705 ok(size == 0, "Expected 0, got %d\n", size);
11706
11707 r = MsiSetPropertyA(hprod, "NewProperty", "value");
11708 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11709
11710 /* non-product property set */
11711 size = MAX_PATH;
11712 lstrcpyA(val, "apple");
11713 r = MsiGetProductPropertyA(hprod, "NewProperty", val, &size);
11714 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11715 ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
11716 ok(size == 0, "Expected 0, got %d\n", size);
11717
11718 r = MsiSetPropertyA(hprod, "ProductCode", "value");
11719 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11720
11721 /* non-product property that is also a product property set */
11722 size = MAX_PATH;
11723 lstrcpyA(val, "apple");
11724 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11725 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11726 ok(!lstrcmpA(val, prodcode),
11727 "Expected \"%s\", got \"%s\"\n", prodcode, val);
11728 ok(size == lstrlenA(prodcode),
11729 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11730
11731 MsiCloseHandle(hprod);
11732
11733 RegDeleteValueA(props, "LocalPackage");
11734 RegDeleteKeyA(props, "");
11735 RegCloseKey(props);
11736 RegDeleteKeyA(userkey, "");
11737 RegCloseKey(userkey);
11738 RegDeleteKeyA(prodkey, "");
11739 RegCloseKey(prodkey);
11740 DeleteFileA(msifile);
11741 }
11742
11743 static void test_MsiSetProperty(void)
11744 {
11745 MSIHANDLE hpkg, hdb, hrec;
11746 CHAR buf[MAX_PATH];
11747 LPCSTR query;
11748 DWORD size;
11749 UINT r;
11750
11751 hpkg = package_from_db(create_package_db());
11752 ok(hpkg != 0, "Expected a valid package\n");
11753
11754 /* invalid hInstall */
11755 r = MsiSetPropertyA(0, "Prop", "Val");
11756 ok(r == ERROR_INVALID_HANDLE,
11757 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
11758
11759 /* invalid hInstall */
11760 r = MsiSetPropertyA(0xdeadbeef, "Prop", "Val");
11761 ok(r == ERROR_INVALID_HANDLE,
11762 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
11763
11764 /* szName is NULL */
11765 r = MsiSetPropertyA(hpkg, NULL, "Val");
11766 ok(r == ERROR_INVALID_PARAMETER,
11767 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11768
11769 /* both szName and szValue are NULL */
11770 r = MsiSetPropertyA(hpkg, NULL, NULL);
11771 ok(r == ERROR_INVALID_PARAMETER,
11772 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11773
11774 /* szName is empty */
11775 r = MsiSetPropertyA(hpkg, "", "Val");
11776 ok(r == ERROR_FUNCTION_FAILED,
11777 "Expected ERROR_FUNCTION_FAILED, got %d\n", r);
11778
11779 /* szName is empty and szValue is NULL */
11780 r = MsiSetPropertyA(hpkg, "", NULL);
11781 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11782
11783 /* set a property */
11784 r = MsiSetPropertyA(hpkg, "Prop", "Val");
11785 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11786
11787 /* get the property */
11788 size = MAX_PATH;
11789 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
11790 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11791 ok(!lstrcmpA(buf, "Val"), "Expected \"Val\", got \"%s\"\n", buf);
11792 ok(size == 3, "Expected 3, got %d\n", size);
11793
11794 /* update the property */
11795 r = MsiSetPropertyA(hpkg, "Prop", "Nuvo");
11796 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11797
11798 /* get the property */
11799 size = MAX_PATH;
11800 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
11801 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11802 ok(!lstrcmpA(buf, "Nuvo"), "Expected \"Nuvo\", got \"%s\"\n", buf);
11803 ok(size == 4, "Expected 4, got %d\n", size);
11804
11805 hdb = MsiGetActiveDatabase(hpkg);
11806 ok(hdb != 0, "Expected a valid database handle\n");
11807
11808 /* set prop is not in the _Property table */
11809 query = "SELECT * FROM `_Property` WHERE `Property` = 'Prop'";
11810 r = do_query(hdb, query, &hrec);
11811 ok(r == ERROR_BAD_QUERY_SYNTAX,
11812 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11813
11814 /* set prop is not in the Property table */
11815 query = "SELECT * FROM `Property` WHERE `Property` = 'Prop'";
11816 r = do_query(hdb, query, &hrec);
11817 ok(r == ERROR_BAD_QUERY_SYNTAX,
11818 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11819
11820 MsiCloseHandle(hdb);
11821
11822 /* szValue is an empty string */
11823 r = MsiSetPropertyA(hpkg, "Prop", "");
11824 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11825
11826 /* try to get the property */
11827 size = MAX_PATH;
11828 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
11829 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11830 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
11831 ok(size == 0, "Expected 0, got %d\n", size);
11832
11833 /* reset the property */
11834 r = MsiSetPropertyA(hpkg, "Prop", "BlueTap");
11835 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11836
11837 /* delete the property */
11838 r = MsiSetPropertyA(hpkg, "Prop", NULL);
11839 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11840
11841 /* try to get the property */
11842 size = MAX_PATH;
11843 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
11844 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11845 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
11846 ok(size == 0, "Expected 0, got %d\n", size);
11847
11848 MsiCloseHandle(hpkg);
11849 DeleteFileA(msifile);
11850 }
11851
11852 static void test_MsiApplyMultiplePatches(void)
11853 {
11854 UINT r, type = GetDriveType(NULL);
11855
11856 if (!pMsiApplyMultiplePatchesA) {
11857 win_skip("MsiApplyMultiplePatchesA not found\n");
11858 return;
11859 }
11860
11861 r = pMsiApplyMultiplePatchesA(NULL, NULL, NULL);
11862 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
11863
11864 r = pMsiApplyMultiplePatchesA("", NULL, NULL);
11865 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
11866
11867 r = pMsiApplyMultiplePatchesA(";", NULL, NULL);
11868 todo_wine
11869 {
11870 if (type == DRIVE_FIXED)
11871 ok(r == ERROR_PATH_NOT_FOUND,
11872 "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
11873 else
11874 ok(r == ERROR_INVALID_NAME,
11875 "Expected ERROR_INVALID_NAME, got %u\n", r);
11876 }
11877
11878 r = pMsiApplyMultiplePatchesA(" ;", NULL, NULL);
11879 todo_wine
11880 {
11881 if (type == DRIVE_FIXED)
11882 ok(r == ERROR_PATCH_PACKAGE_OPEN_FAILED,
11883 "Expected ERROR_PATCH_PACKAGE_OPEN_FAILED, got %u\n", r);
11884 else
11885 ok(r == ERROR_INVALID_NAME,
11886 "Expected ERROR_INVALID_NAME, got %u\n", r);
11887 }
11888
11889 r = pMsiApplyMultiplePatchesA(";;", NULL, NULL);
11890 todo_wine
11891 {
11892 if (type == DRIVE_FIXED)
11893 ok(r == ERROR_PATH_NOT_FOUND,
11894 "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
11895 else
11896 ok(r == ERROR_INVALID_NAME,
11897 "Expected ERROR_INVALID_NAME, got %u\n", r);
11898 }
11899
11900 r = pMsiApplyMultiplePatchesA("nosuchpatchpackage;", NULL, NULL);
11901 todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
11902
11903 r = pMsiApplyMultiplePatchesA(";nosuchpatchpackage", NULL, NULL);
11904 todo_wine
11905 {
11906 if (type == DRIVE_FIXED)
11907 ok(r == ERROR_PATH_NOT_FOUND,
11908 "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
11909 else
11910 ok(r == ERROR_INVALID_NAME,
11911 "Expected ERROR_INVALID_NAME, got %u\n", r);
11912 }
11913
11914 r = pMsiApplyMultiplePatchesA("nosuchpatchpackage;nosuchpatchpackage", NULL, NULL);
11915 todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
11916
11917 r = pMsiApplyMultiplePatchesA(" nosuchpatchpackage ; nosuchpatchpackage ", NULL, NULL);
11918 todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
11919 }
11920
11921 static void test_MsiApplyPatch(void)
11922 {
11923 UINT r;
11924
11925 r = MsiApplyPatch(NULL, NULL, INSTALLTYPE_DEFAULT, NULL);
11926 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
11927
11928 r = MsiApplyPatch("", NULL, INSTALLTYPE_DEFAULT, NULL);
11929 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
11930 }
11931
11932 START_TEST(package)
11933 {
11934 STATEMGRSTATUS status;
11935 BOOL ret = FALSE;
11936
11937 init_functionpointers();
11938
11939 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
11940
11941 /* Create a restore point ourselves so we circumvent the multitude of restore points
11942 * that would have been created by all the installation and removal tests.
11943 */
11944 if (pSRSetRestorePointA)
11945 {
11946 memset(&status, 0, sizeof(status));
11947 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
11948 }
11949
11950 test_createpackage();
11951 test_doaction();
11952 test_gettargetpath_bad();
11953 test_settargetpath();
11954 test_props();
11955 test_property_table();
11956 test_condition();
11957 test_msipackage();
11958 test_formatrecord2();
11959 test_states();
11960 test_getproperty();
11961 test_removefiles();
11962 test_appsearch();
11963 test_appsearch_complocator();
11964 test_appsearch_reglocator();
11965 test_appsearch_inilocator();
11966 test_appsearch_drlocator();
11967 test_featureparents();
11968 test_installprops();
11969 test_launchconditions();
11970 test_ccpsearch();
11971 test_complocator();
11972 test_MsiGetSourcePath();
11973 test_shortlongsource();
11974 test_sourcedir();
11975 test_access();
11976 test_emptypackage();
11977 test_MsiGetProductProperty();
11978 test_MsiSetProperty();
11979 test_MsiApplyMultiplePatches();
11980 test_MsiApplyPatch();
11981
11982 if (pSRSetRestorePointA && ret)
11983 {
11984 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
11985 if (ret)
11986 remove_restore_point(status.llSequenceNumber);
11987 }
11988 }