[MSI_WINETEST]
[reactos.git] / rostests / winetests / msi / package.c
1 /*
2 * tests for Microsoft Installer functionality
3 *
4 * Copyright 2005 Mike McCormack for CodeWeavers
5 * Copyright 2005 Aric Stewart for CodeWeavers
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22 #define COBJMACROS
23
24 #include <stdio.h>
25 #include <windows.h>
26 #include <msidefs.h>
27 #include <msi.h>
28 #include <msiquery.h>
29 #include <srrestoreptapi.h>
30
31 #include "wine/test.h"
32
33 static const char msifile[] = "winetest-package.msi";
34 char CURR_DIR[MAX_PATH];
35
36 static UINT (WINAPI *pMsiApplyMultiplePatchesA)(LPCSTR, LPCSTR, LPCSTR);
37
38 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
39
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 r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two\\three" );
1051 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1052
1053 sz = sizeof buffer - 1;
1054 r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
1055 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1056 ok( !lstrcmpi(buffer, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", buffer);
1057
1058 MsiCloseHandle( hpkg );
1059 }
1060
1061 static void test_condition(void)
1062 {
1063 MSICONDITION r;
1064 MSIHANDLE hpkg;
1065
1066 hpkg = package_from_db(create_package_db());
1067 ok( hpkg, "failed to create package\n");
1068
1069 r = MsiEvaluateCondition(0, NULL);
1070 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1071
1072 r = MsiEvaluateCondition(hpkg, NULL);
1073 ok( r == MSICONDITION_NONE, "wrong return val\n");
1074
1075 r = MsiEvaluateCondition(hpkg, "");
1076 ok( r == MSICONDITION_NONE, "wrong return val\n");
1077
1078 r = MsiEvaluateCondition(hpkg, "1");
1079 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1080
1081 r = MsiEvaluateCondition(hpkg, "0");
1082 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1083
1084 r = MsiEvaluateCondition(hpkg, "-1");
1085 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1086
1087 r = MsiEvaluateCondition(hpkg, "0 = 0");
1088 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1089
1090 r = MsiEvaluateCondition(hpkg, "0 <> 0");
1091 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1092
1093 r = MsiEvaluateCondition(hpkg, "0 = 1");
1094 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1095
1096 r = MsiEvaluateCondition(hpkg, "0 > 1");
1097 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1098
1099 r = MsiEvaluateCondition(hpkg, "0 ~> 1");
1100 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1101
1102 r = MsiEvaluateCondition(hpkg, "1 > 1");
1103 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1104
1105 r = MsiEvaluateCondition(hpkg, "1 ~> 1");
1106 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1107
1108 r = MsiEvaluateCondition(hpkg, "0 >= 1");
1109 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1110
1111 r = MsiEvaluateCondition(hpkg, "0 ~>= 1");
1112 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1113
1114 r = MsiEvaluateCondition(hpkg, "1 >= 1");
1115 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1116
1117 r = MsiEvaluateCondition(hpkg, "1 ~>= 1");
1118 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1119
1120 r = MsiEvaluateCondition(hpkg, "0 < 1");
1121 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1122
1123 r = MsiEvaluateCondition(hpkg, "0 ~< 1");
1124 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1125
1126 r = MsiEvaluateCondition(hpkg, "1 < 1");
1127 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1128
1129 r = MsiEvaluateCondition(hpkg, "1 ~< 1");
1130 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1131
1132 r = MsiEvaluateCondition(hpkg, "0 <= 1");
1133 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1134
1135 r = MsiEvaluateCondition(hpkg, "0 ~<= 1");
1136 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1137
1138 r = MsiEvaluateCondition(hpkg, "1 <= 1");
1139 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1140
1141 r = MsiEvaluateCondition(hpkg, "1 ~<= 1");
1142 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1143
1144 r = MsiEvaluateCondition(hpkg, "0 >=");
1145 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1146
1147 r = MsiEvaluateCondition(hpkg, " ");
1148 ok( r == MSICONDITION_NONE, "wrong return val\n");
1149
1150 r = MsiEvaluateCondition(hpkg, "LicView <> \"1\"");
1151 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1152
1153 r = MsiEvaluateCondition(hpkg, "LicView <> \"0\"");
1154 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1155
1156 r = MsiEvaluateCondition(hpkg, "LicView <> LicView");
1157 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1158
1159 r = MsiEvaluateCondition(hpkg, "not 0");
1160 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1161
1162 r = MsiEvaluateCondition(hpkg, "not LicView");
1163 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1164
1165 r = MsiEvaluateCondition(hpkg, "\"Testing\" ~<< \"Testing\"");
1166 ok (r == MSICONDITION_TRUE, "wrong return val\n");
1167
1168 r = MsiEvaluateCondition(hpkg, "LicView ~<< \"Testing\"");
1169 ok (r == MSICONDITION_FALSE, "wrong return val\n");
1170
1171 r = MsiEvaluateCondition(hpkg, "Not LicView ~<< \"Testing\"");
1172 ok (r == MSICONDITION_TRUE, "wrong return val\n");
1173
1174 r = MsiEvaluateCondition(hpkg, "not \"A\"");
1175 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1176
1177 r = MsiEvaluateCondition(hpkg, "~not \"A\"");
1178 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1179
1180 r = MsiEvaluateCondition(hpkg, "\"0\"");
1181 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1182
1183 r = MsiEvaluateCondition(hpkg, "1 and 2");
1184 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1185
1186 r = MsiEvaluateCondition(hpkg, "not 0 and 3");
1187 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1188
1189 r = MsiEvaluateCondition(hpkg, "not 0 and 0");
1190 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1191
1192 r = MsiEvaluateCondition(hpkg, "not 0 or 1");
1193 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1194
1195 r = MsiEvaluateCondition(hpkg, "(0)");
1196 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1197
1198 r = MsiEvaluateCondition(hpkg, "(((((1))))))");
1199 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1200
1201 r = MsiEvaluateCondition(hpkg, "(((((1)))))");
1202 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1203
1204 r = MsiEvaluateCondition(hpkg, " \"A\" < \"B\" ");
1205 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1206
1207 r = MsiEvaluateCondition(hpkg, " \"A\" > \"B\" ");
1208 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1209
1210 r = MsiEvaluateCondition(hpkg, " \"1\" > \"12\" ");
1211 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1212
1213 r = MsiEvaluateCondition(hpkg, " \"100\" < \"21\" ");
1214 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1215
1216 r = MsiEvaluateCondition(hpkg, "0 < > 0");
1217 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1218
1219 r = MsiEvaluateCondition(hpkg, "(1<<1) == 2");
1220 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1221
1222 r = MsiEvaluateCondition(hpkg, " \"A\" = \"a\" ");
1223 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1224
1225 r = MsiEvaluateCondition(hpkg, " \"A\" ~ = \"a\" ");
1226 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1227
1228 r = MsiEvaluateCondition(hpkg, " \"A\" ~= \"a\" ");
1229 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1230
1231 r = MsiEvaluateCondition(hpkg, " \"A\" ~= 1 ");
1232 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1233
1234 r = MsiEvaluateCondition(hpkg, " \"A\" = 1 ");
1235 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1236
1237 r = MsiEvaluateCondition(hpkg, " 1 ~= 1 ");
1238 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1239
1240 r = MsiEvaluateCondition(hpkg, " 1 ~= \"1\" ");
1241 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1242
1243 r = MsiEvaluateCondition(hpkg, " 1 = \"1\" ");
1244 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1245
1246 r = MsiEvaluateCondition(hpkg, " 0 = \"1\" ");
1247 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1248
1249 r = MsiEvaluateCondition(hpkg, " 0 < \"100\" ");
1250 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1251
1252 r = MsiEvaluateCondition(hpkg, " 100 > \"0\" ");
1253 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1254
1255 r = MsiEvaluateCondition(hpkg, "1 XOR 1");
1256 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1257
1258 r = MsiEvaluateCondition(hpkg, "1 IMP 1");
1259 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1260
1261 r = MsiEvaluateCondition(hpkg, "1 IMP 0");
1262 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1263
1264 r = MsiEvaluateCondition(hpkg, "0 IMP 0");
1265 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1266
1267 r = MsiEvaluateCondition(hpkg, "0 EQV 0");
1268 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1269
1270 r = MsiEvaluateCondition(hpkg, "0 EQV 1");
1271 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1272
1273 r = MsiEvaluateCondition(hpkg, "1 IMP 1 OR 0");
1274 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1275
1276 r = MsiEvaluateCondition(hpkg, "1 IMPL 1");
1277 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1278
1279 r = MsiEvaluateCondition(hpkg, "\"ASFD\" >< \"S\" ");
1280 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1281
1282 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"s\" ");
1283 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1284
1285 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"\" ");
1286 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1287
1288 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"sss\" ");
1289 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1290
1291 MsiSetProperty(hpkg, "mm", "5" );
1292
1293 r = MsiEvaluateCondition(hpkg, "mm = 5");
1294 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1295
1296 r = MsiEvaluateCondition(hpkg, "mm < 6");
1297 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1298
1299 r = MsiEvaluateCondition(hpkg, "mm <= 5");
1300 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1301
1302 r = MsiEvaluateCondition(hpkg, "mm > 4");
1303 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1304
1305 r = MsiEvaluateCondition(hpkg, "mm < 12");
1306 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1307
1308 r = MsiEvaluateCondition(hpkg, "mm = \"5\"");
1309 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1310
1311 r = MsiEvaluateCondition(hpkg, "0 = \"\"");
1312 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1313
1314 r = MsiEvaluateCondition(hpkg, "0 AND \"\"");
1315 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1316
1317 r = MsiEvaluateCondition(hpkg, "1 AND \"\"");
1318 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1319
1320 r = MsiEvaluateCondition(hpkg, "1 AND \"1\"");
1321 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1322
1323 r = MsiEvaluateCondition(hpkg, "3 >< 1");
1324 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1325
1326 r = MsiEvaluateCondition(hpkg, "3 >< 4");
1327 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1328
1329 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 0");
1330 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1331
1332 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1");
1333 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1334
1335 r = MsiEvaluateCondition(hpkg, "NOT 1 OR 0");
1336 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1337
1338 r = MsiEvaluateCondition(hpkg, "0 AND 1 OR 1");
1339 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1340
1341 r = MsiEvaluateCondition(hpkg, "0 AND 0 OR 1");
1342 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1343
1344 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1 OR 0");
1345 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1346
1347 r = MsiEvaluateCondition(hpkg, "_1 = _1");
1348 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1349
1350 r = MsiEvaluateCondition(hpkg, "( 1 AND 1 ) = 2");
1351 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1352
1353 r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
1354 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1355
1356 r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1357 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1358
1359 r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
1360 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1361
1362 r = MsiEvaluateCondition(hpkg, "NOT 1 AND 0");
1363 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1364
1365 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1366 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1367
1368 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1369 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1370
1371 r = MsiEvaluateCondition(hpkg, "bandalmael<0");
1372 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1373
1374 r = MsiEvaluateCondition(hpkg, "bandalmael>0");
1375 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1376
1377 r = MsiEvaluateCondition(hpkg, "bandalmael>=0");
1378 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1379
1380 r = MsiEvaluateCondition(hpkg, "bandalmael<=0");
1381 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1382
1383 r = MsiEvaluateCondition(hpkg, "bandalmael~<>0");
1384 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1385
1386 MsiSetProperty(hpkg, "bandalmael", "0" );
1387 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1388 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1389
1390 MsiSetProperty(hpkg, "bandalmael", "" );
1391 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1392 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1393
1394 MsiSetProperty(hpkg, "bandalmael", "asdf" );
1395 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1396 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1397
1398 MsiSetProperty(hpkg, "bandalmael", "0asdf" );
1399 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1400 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1401
1402 MsiSetProperty(hpkg, "bandalmael", "0 " );
1403 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1404 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1405
1406 MsiSetProperty(hpkg, "bandalmael", "-0" );
1407 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1408 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1409
1410 MsiSetProperty(hpkg, "bandalmael", "0000000000000" );
1411 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1412 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1413
1414 MsiSetProperty(hpkg, "bandalmael", "--0" );
1415 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1416 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1417
1418 MsiSetProperty(hpkg, "bandalmael", "0x00" );
1419 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1420 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1421
1422 MsiSetProperty(hpkg, "bandalmael", "-" );
1423 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1424 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1425
1426 MsiSetProperty(hpkg, "bandalmael", "+0" );
1427 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1428 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1429
1430 MsiSetProperty(hpkg, "bandalmael", "0.0" );
1431 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1432 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1433 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1434 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1435
1436 MsiSetProperty(hpkg, "one", "hi");
1437 MsiSetProperty(hpkg, "two", "hithere");
1438 r = MsiEvaluateCondition(hpkg, "one >< two");
1439 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1440
1441 MsiSetProperty(hpkg, "one", "hithere");
1442 MsiSetProperty(hpkg, "two", "hi");
1443 r = MsiEvaluateCondition(hpkg, "one >< two");
1444 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1445
1446 MsiSetProperty(hpkg, "one", "hello");
1447 MsiSetProperty(hpkg, "two", "hi");
1448 r = MsiEvaluateCondition(hpkg, "one >< two");
1449 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1450
1451 MsiSetProperty(hpkg, "one", "hellohithere");
1452 MsiSetProperty(hpkg, "two", "hi");
1453 r = MsiEvaluateCondition(hpkg, "one >< two");
1454 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1455
1456 MsiSetProperty(hpkg, "one", "");
1457 MsiSetProperty(hpkg, "two", "hi");
1458 r = MsiEvaluateCondition(hpkg, "one >< two");
1459 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1460
1461 MsiSetProperty(hpkg, "one", "hi");
1462 MsiSetProperty(hpkg, "two", "");
1463 r = MsiEvaluateCondition(hpkg, "one >< two");
1464 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1465
1466 MsiSetProperty(hpkg, "one", "");
1467 MsiSetProperty(hpkg, "two", "");
1468 r = MsiEvaluateCondition(hpkg, "one >< two");
1469 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1470
1471 MsiSetProperty(hpkg, "one", "1234");
1472 MsiSetProperty(hpkg, "two", "1");
1473 r = MsiEvaluateCondition(hpkg, "one >< two");
1474 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1475
1476 MsiSetProperty(hpkg, "one", "one 1234");
1477 MsiSetProperty(hpkg, "two", "1");
1478 r = MsiEvaluateCondition(hpkg, "one >< two");
1479 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1480
1481 MsiSetProperty(hpkg, "one", "hithere");
1482 MsiSetProperty(hpkg, "two", "hi");
1483 r = MsiEvaluateCondition(hpkg, "one << two");
1484 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1485
1486 MsiSetProperty(hpkg, "one", "hi");
1487 MsiSetProperty(hpkg, "two", "hithere");
1488 r = MsiEvaluateCondition(hpkg, "one << two");
1489 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1490
1491 MsiSetProperty(hpkg, "one", "hi");
1492 MsiSetProperty(hpkg, "two", "hi");
1493 r = MsiEvaluateCondition(hpkg, "one << two");
1494 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1495
1496 MsiSetProperty(hpkg, "one", "abcdhithere");
1497 MsiSetProperty(hpkg, "two", "hi");
1498 r = MsiEvaluateCondition(hpkg, "one << two");
1499 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1500
1501 MsiSetProperty(hpkg, "one", "");
1502 MsiSetProperty(hpkg, "two", "hi");
1503 r = MsiEvaluateCondition(hpkg, "one << two");
1504 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1505
1506 MsiSetProperty(hpkg, "one", "hithere");
1507 MsiSetProperty(hpkg, "two", "");
1508 r = MsiEvaluateCondition(hpkg, "one << two");
1509 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1510
1511 MsiSetProperty(hpkg, "one", "");
1512 MsiSetProperty(hpkg, "two", "");
1513 r = MsiEvaluateCondition(hpkg, "one << two");
1514 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1515
1516 MsiSetProperty(hpkg, "one", "1234");
1517 MsiSetProperty(hpkg, "two", "1");
1518 r = MsiEvaluateCondition(hpkg, "one << two");
1519 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1520
1521 MsiSetProperty(hpkg, "one", "1234 one");
1522 MsiSetProperty(hpkg, "two", "1");
1523 r = MsiEvaluateCondition(hpkg, "one << two");
1524 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1525
1526 MsiSetProperty(hpkg, "one", "hithere");
1527 MsiSetProperty(hpkg, "two", "there");
1528 r = MsiEvaluateCondition(hpkg, "one >> two");
1529 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1530
1531 MsiSetProperty(hpkg, "one", "hithere");
1532 MsiSetProperty(hpkg, "two", "hi");
1533 r = MsiEvaluateCondition(hpkg, "one >> two");
1534 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1535
1536 MsiSetProperty(hpkg, "one", "there");
1537 MsiSetProperty(hpkg, "two", "hithere");
1538 r = MsiEvaluateCondition(hpkg, "one >> two");
1539 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1540
1541 MsiSetProperty(hpkg, "one", "there");
1542 MsiSetProperty(hpkg, "two", "there");
1543 r = MsiEvaluateCondition(hpkg, "one >> two");
1544 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1545
1546 MsiSetProperty(hpkg, "one", "abcdhithere");
1547 MsiSetProperty(hpkg, "two", "hi");
1548 r = MsiEvaluateCondition(hpkg, "one >> two");
1549 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1550
1551 MsiSetProperty(hpkg, "one", "");
1552 MsiSetProperty(hpkg, "two", "there");
1553 r = MsiEvaluateCondition(hpkg, "one >> two");
1554 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1555
1556 MsiSetProperty(hpkg, "one", "there");
1557 MsiSetProperty(hpkg, "two", "");
1558 r = MsiEvaluateCondition(hpkg, "one >> two");
1559 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1560
1561 MsiSetProperty(hpkg, "one", "");
1562 MsiSetProperty(hpkg, "two", "");
1563 r = MsiEvaluateCondition(hpkg, "one >> two");
1564 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1565
1566 MsiSetProperty(hpkg, "one", "1234");
1567 MsiSetProperty(hpkg, "two", "4");
1568 r = MsiEvaluateCondition(hpkg, "one >> two");
1569 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1570
1571 MsiSetProperty(hpkg, "one", "one 1234");
1572 MsiSetProperty(hpkg, "two", "4");
1573 r = MsiEvaluateCondition(hpkg, "one >> two");
1574 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1575
1576 MsiSetProperty(hpkg, "MsiNetAssemblySupport", NULL); /* make sure it's empty */
1577
1578 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1579 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1580
1581 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport > \"1.1.4322\"");
1582 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1583
1584 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport >= \"1.1.4322\"");
1585 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1586
1587 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <= \"1.1.4322\"");
1588 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1589
1590 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <> \"1.1.4322\"");
1591 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1592
1593 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1594 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1595
1596 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"abcd\"");
1597 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1598
1599 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a1.1.4322\"");
1600 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1601
1602 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322a\"");
1603 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1604
1605 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1606 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1607
1608 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1609 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1610
1611 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1612 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1613
1614 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1");
1615 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1616
1617 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1\"");
1618 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1619
1620 r = MsiEvaluateCondition(hpkg, "\"2\" < \"12.1\"");
1621 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1622
1623 r = MsiEvaluateCondition(hpkg, "\"02.1\" < \"2.11\"");
1624 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1625
1626 r = MsiEvaluateCondition(hpkg, "\"02.1.1\" < \"2.1\"");
1627 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1628
1629 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1630 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1631
1632 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1633 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1634
1635 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0\"");
1636 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1637
1638 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"-1\"");
1639 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1640
1641 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a\"");
1642 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1643
1644 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1645 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1646
1647 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1648 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1649
1650 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"/\"");
1651 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1652
1653 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \" \"");
1654 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1655
1656 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"azAZ_\"");
1657 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1658
1659 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]\"");
1660 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1661
1662 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]a\"");
1663 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1664
1665 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]\"");
1666 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1667
1668 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]a\"");
1669 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1670
1671 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a}\"");
1672 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1673
1674 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a\"");
1675 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1676
1677 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a\"");
1678 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1679
1680 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a{\"");
1681 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1682
1683 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a]\"");
1684 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1685
1686 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"A\"");
1687 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1688
1689 MsiSetProperty(hpkg, "MsiNetAssemblySupport", "1.1.4322");
1690 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1691 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1692
1693 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.14322\"");
1694 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1695
1696 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.5\"");
1697 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1698
1699 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1700 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1701
1702 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1703 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1704
1705 MsiSetProperty(hpkg, "one", "1");
1706 r = MsiEvaluateCondition(hpkg, "one < \"1\"");
1707 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1708
1709 MsiSetProperty(hpkg, "X", "5.0");
1710
1711 r = MsiEvaluateCondition(hpkg, "X != \"\"");
1712 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1713
1714 r = MsiEvaluateCondition(hpkg, "X =\"5.0\"");
1715 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1716
1717 r = MsiEvaluateCondition(hpkg, "X =\"5.1\"");
1718 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1719
1720 r = MsiEvaluateCondition(hpkg, "X =\"6.0\"");
1721 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1722
1723 r = MsiEvaluateCondition(hpkg, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1724 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1725
1726 r = MsiEvaluateCondition(hpkg, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1727 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1728
1729 r = MsiEvaluateCondition(hpkg, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1730 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1731
1732 /* feature doesn't exist */
1733 r = MsiEvaluateCondition(hpkg, "&nofeature");
1734 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1735
1736 MsiSetProperty(hpkg, "A", "2");
1737 MsiSetProperty(hpkg, "X", "50");
1738
1739 r = MsiEvaluateCondition(hpkg, "2 <= X");
1740 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1741
1742 r = MsiEvaluateCondition(hpkg, "A <= X");
1743 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1744
1745 r = MsiEvaluateCondition(hpkg, "A <= 50");
1746 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1747
1748 MsiSetProperty(hpkg, "X", "50val");
1749
1750 r = MsiEvaluateCondition(hpkg, "2 <= X");
1751 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1752
1753 r = MsiEvaluateCondition(hpkg, "A <= X");
1754 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1755
1756 MsiSetProperty(hpkg, "A", "7");
1757 MsiSetProperty(hpkg, "X", "50");
1758
1759 r = MsiEvaluateCondition(hpkg, "7 <= X");
1760 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1761
1762 r = MsiEvaluateCondition(hpkg, "A <= X");
1763 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1764
1765 r = MsiEvaluateCondition(hpkg, "A <= 50");
1766 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1767
1768 MsiSetProperty(hpkg, "X", "50val");
1769
1770 r = MsiEvaluateCondition(hpkg, "2 <= X");
1771 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1772
1773 r = MsiEvaluateCondition(hpkg, "A <= X");
1774 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1775
1776 MsiCloseHandle( hpkg );
1777 DeleteFile(msifile);
1778 }
1779
1780 static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop)
1781 {
1782 UINT r;
1783 DWORD sz;
1784 char buffer[2];
1785
1786 sz = sizeof buffer;
1787 strcpy(buffer,"x");
1788 r = MsiGetProperty( hpkg, prop, buffer, &sz );
1789 return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
1790 }
1791
1792 static void test_props(void)
1793 {
1794 MSIHANDLE hpkg, hdb;
1795 UINT r;
1796 DWORD sz;
1797 char buffer[0x100];
1798
1799 hdb = create_package_db();
1800 r = run_query( hdb,
1801 "CREATE TABLE `Property` ( "
1802 "`Property` CHAR(255) NOT NULL, "
1803 "`Value` CHAR(255) "
1804 "PRIMARY KEY `Property`)" );
1805 ok( r == ERROR_SUCCESS , "Failed\n" );
1806
1807 r = run_query(hdb,
1808 "INSERT INTO `Property` "
1809 "(`Property`, `Value`) "
1810 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1811 ok( r == ERROR_SUCCESS , "Failed\n" );
1812
1813 hpkg = package_from_db( hdb );
1814 ok( hpkg, "failed to create package\n");
1815
1816 /* test invalid values */
1817 r = MsiGetProperty( 0, NULL, NULL, NULL );
1818 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1819
1820 r = MsiGetProperty( hpkg, NULL, NULL, NULL );
1821 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1822
1823 r = MsiGetProperty( hpkg, "boo", NULL, NULL );
1824 ok( r == ERROR_SUCCESS, "wrong return val\n");
1825
1826 r = MsiGetProperty( hpkg, "boo", buffer, NULL );
1827 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1828
1829 /* test retrieving an empty/nonexistent property */
1830 sz = sizeof buffer;
1831 r = MsiGetProperty( hpkg, "boo", NULL, &sz );
1832 ok( r == ERROR_SUCCESS, "wrong return val\n");
1833 ok( sz == 0, "wrong size returned\n");
1834
1835 check_prop_empty( hpkg, "boo");
1836 sz = 0;
1837 strcpy(buffer,"x");
1838 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1839 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1840 ok( !strcmp(buffer,"x"), "buffer was changed\n");
1841 ok( sz == 0, "wrong size returned\n");
1842
1843 sz = 1;
1844 strcpy(buffer,"x");
1845 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1846 ok( r == ERROR_SUCCESS, "wrong return val\n");
1847 ok( buffer[0] == 0, "buffer was not changed\n");
1848 ok( sz == 0, "wrong size returned\n");
1849
1850 /* set the property to something */
1851 r = MsiSetProperty( 0, NULL, NULL );
1852 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1853
1854 r = MsiSetProperty( hpkg, NULL, NULL );
1855 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1856
1857 r = MsiSetProperty( hpkg, "", NULL );
1858 ok( r == ERROR_SUCCESS, "wrong return val\n");
1859
1860 /* try set and get some illegal property identifiers */
1861 r = MsiSetProperty( hpkg, "", "asdf" );
1862 ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n");
1863
1864 r = MsiSetProperty( hpkg, "=", "asdf" );
1865 ok( r == ERROR_SUCCESS, "wrong return val\n");
1866
1867 r = MsiSetProperty( hpkg, " ", "asdf" );
1868 ok( r == ERROR_SUCCESS, "wrong return val\n");
1869
1870 r = MsiSetProperty( hpkg, "'", "asdf" );
1871 ok( r == ERROR_SUCCESS, "wrong return val\n");
1872
1873 sz = sizeof buffer;
1874 buffer[0]=0;
1875 r = MsiGetProperty( hpkg, "'", buffer, &sz );
1876 ok( r == ERROR_SUCCESS, "wrong return val\n");
1877 ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
1878
1879 /* set empty values */
1880 r = MsiSetProperty( hpkg, "boo", NULL );
1881 ok( r == ERROR_SUCCESS, "wrong return val\n");
1882 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1883
1884 r = MsiSetProperty( hpkg, "boo", "" );
1885 ok( r == ERROR_SUCCESS, "wrong return val\n");
1886 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1887
1888 /* set a non-empty value */
1889 r = MsiSetProperty( hpkg, "boo", "xyz" );
1890 ok( r == ERROR_SUCCESS, "wrong return val\n");
1891
1892 sz = 1;
1893 strcpy(buffer,"x");
1894 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1895 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1896 ok( buffer[0] == 0, "buffer was not changed\n");
1897 ok( sz == 3, "wrong size returned\n");
1898
1899 sz = 4;
1900 strcpy(buffer,"x");
1901 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1902 ok( r == ERROR_SUCCESS, "wrong return val\n");
1903 ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
1904 ok( sz == 3, "wrong size returned\n");
1905
1906 sz = 3;
1907 strcpy(buffer,"x");
1908 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1909 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1910 ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
1911 ok( sz == 3, "wrong size returned\n");
1912
1913 r = MsiSetProperty(hpkg, "SourceDir", "foo");
1914 ok( r == ERROR_SUCCESS, "wrong return val\n");
1915
1916 sz = 4;
1917 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
1918 ok( r == ERROR_SUCCESS, "wrong return val\n");
1919 ok( !strcmp(buffer,""), "buffer wrong\n");
1920 ok( sz == 0, "wrong size returned\n");
1921
1922 sz = 4;
1923 r = MsiGetProperty(hpkg, "SOMERANDOMNAME", buffer, &sz);
1924 ok( r == ERROR_SUCCESS, "wrong return val\n");
1925 ok( !strcmp(buffer,""), "buffer wrong\n");
1926 ok( sz == 0, "wrong size returned\n");
1927
1928 sz = 4;
1929 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
1930 ok( r == ERROR_SUCCESS, "wrong return val\n");
1931 ok( !strcmp(buffer,"foo"), "buffer wrong\n");
1932 ok( sz == 3, "wrong size returned\n");
1933
1934 r = MsiSetProperty(hpkg, "MetadataCompName", "Photoshop.dll");
1935 ok( r == ERROR_SUCCESS, "wrong return val\n");
1936
1937 sz = 0;
1938 r = MsiGetProperty(hpkg, "MetadataCompName", NULL, &sz );
1939 ok( r == ERROR_SUCCESS, "return wrong\n");
1940 ok( sz == 13, "size wrong (%d)\n", sz);
1941
1942 sz = 13;
1943 r = MsiGetProperty(hpkg, "MetadataCompName", buffer, &sz );
1944 ok( r == ERROR_MORE_DATA, "return wrong\n");
1945 ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n");
1946
1947 r = MsiSetProperty(hpkg, "property", "value");
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( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer);
1954
1955 r = MsiSetProperty(hpkg, "property", NULL);
1956 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1957
1958 sz = 6;
1959 r = MsiGetProperty(hpkg, "property", buffer, &sz);
1960 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1961 ok( !strlen(buffer), "Expected empty string, got %s\n", buffer);
1962
1963 MsiCloseHandle( hpkg );
1964 DeleteFile(msifile);
1965 }
1966
1967 static BOOL find_prop_in_property(MSIHANDLE hdb, LPCSTR prop, LPCSTR val)
1968 {
1969 MSIHANDLE hview, hrec;
1970 BOOL found;
1971 CHAR buffer[MAX_PATH];
1972 DWORD sz;
1973 UINT r;
1974
1975 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
1976 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
1977 r = MsiViewExecute(hview, 0);
1978 ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
1979
1980 found = FALSE;
1981 while (r == ERROR_SUCCESS && !found)
1982 {
1983 r = MsiViewFetch(hview, &hrec);
1984 if (r != ERROR_SUCCESS) break;
1985
1986 sz = MAX_PATH;
1987 r = MsiRecordGetString(hrec, 1, buffer, &sz);
1988 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
1989 {
1990 sz = MAX_PATH;
1991 r = MsiRecordGetString(hrec, 2, buffer, &sz);
1992 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, val))
1993 found = TRUE;
1994 }
1995
1996 MsiCloseHandle(hrec);
1997 }
1998
1999 MsiViewClose(hview);
2000 MsiCloseHandle(hview);
2001
2002 return found;
2003 }
2004
2005 static void test_property_table(void)
2006 {
2007 const char *query;
2008 UINT r;
2009 MSIHANDLE hpkg, hdb, hrec;
2010 char buffer[MAX_PATH];
2011 DWORD sz;
2012 BOOL found;
2013
2014 hdb = create_package_db();
2015 ok( hdb, "failed to create package\n");
2016
2017 hpkg = package_from_db(hdb);
2018 ok( hpkg, "failed to create package\n");
2019
2020 MsiCloseHandle(hdb);
2021
2022 hdb = MsiGetActiveDatabase(hpkg);
2023
2024 query = "CREATE TABLE `_Property` ( "
2025 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2026 r = run_query(hdb, query);
2027 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2028
2029 MsiCloseHandle(hdb);
2030 MsiCloseHandle(hpkg);
2031 DeleteFile(msifile);
2032
2033 hdb = create_package_db();
2034 ok( hdb, "failed to create package\n");
2035
2036 query = "CREATE TABLE `_Property` ( "
2037 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2038 r = run_query(hdb, query);
2039 ok(r == ERROR_SUCCESS, "failed to create table\n");
2040
2041 query = "ALTER `_Property` ADD `foo` INTEGER";
2042 r = run_query(hdb, query);
2043 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2044
2045 query = "ALTER TABLE `_Property` ADD `foo` INTEGER";
2046 r = run_query(hdb, query);
2047 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2048
2049 query = "ALTER TABLE `_Property` ADD `extra` INTEGER";
2050 r = run_query(hdb, query);
2051 ok(r == ERROR_SUCCESS, "failed to add column\n");
2052
2053 hpkg = package_from_db(hdb);
2054 todo_wine
2055 {
2056 ok(!hpkg, "package should not be created\n");
2057 }
2058
2059 MsiCloseHandle(hdb);
2060 MsiCloseHandle(hpkg);
2061 DeleteFile(msifile);
2062
2063 hdb = create_package_db();
2064 ok (hdb, "failed to create package database\n");
2065
2066 r = create_property_table(hdb);
2067 ok(r == ERROR_SUCCESS, "cannot create Property table: %d\n", r);
2068
2069 r = add_property_entry(hdb, "'prop', 'val'");
2070 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2071
2072 hpkg = package_from_db(hdb);
2073 ok(hpkg, "failed to create package\n");
2074
2075 MsiCloseHandle(hdb);
2076
2077 sz = MAX_PATH;
2078 r = MsiGetProperty(hpkg, "prop", buffer, &sz);
2079 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2080 ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
2081
2082 hdb = MsiGetActiveDatabase(hpkg);
2083
2084 found = find_prop_in_property(hdb, "prop", "val");
2085 ok(found, "prop should be in the _Property table\n");
2086
2087 r = add_property_entry(hdb, "'dantes', 'mercedes'");
2088 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2089
2090 query = "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
2091 r = do_query(hdb, query, &hrec);
2092 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2093
2094 found = find_prop_in_property(hdb, "dantes", "mercedes");
2095 ok(found == FALSE, "dantes should not be in the _Property table\n");
2096
2097 sz = MAX_PATH;
2098 lstrcpy(buffer, "aaa");
2099 r = MsiGetProperty(hpkg, "dantes", buffer, &sz);
2100 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2101 ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer);
2102
2103 r = MsiSetProperty(hpkg, "dantes", "mercedes");
2104 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2105
2106 found = find_prop_in_property(hdb, "dantes", "mercedes");
2107 ok(found == TRUE, "dantes should be in the _Property table\n");
2108
2109 MsiCloseHandle(hdb);
2110 MsiCloseHandle(hpkg);
2111 DeleteFile(msifile);
2112 }
2113
2114 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
2115 {
2116 MSIHANDLE htab = 0;
2117 UINT res;
2118
2119 res = MsiDatabaseOpenView( hdb, szQuery, &htab );
2120 if( res == ERROR_SUCCESS )
2121 {
2122 UINT r;
2123
2124 r = MsiViewExecute( htab, hrec );
2125 if( r != ERROR_SUCCESS )
2126 {
2127 res = r;
2128 fprintf(stderr,"MsiViewExecute failed %08x\n", res);
2129 }
2130
2131 r = MsiViewClose( htab );
2132 if( r != ERROR_SUCCESS )
2133 res = r;
2134
2135 r = MsiCloseHandle( htab );
2136 if( r != ERROR_SUCCESS )
2137 res = r;
2138 }
2139 return res;
2140 }
2141
2142 static UINT try_query( MSIHANDLE hdb, LPCSTR szQuery )
2143 {
2144 return try_query_param( hdb, szQuery, 0 );
2145 }
2146
2147 static void set_summary_str(MSIHANDLE hdb, DWORD pid, LPCSTR value)
2148 {
2149 MSIHANDLE summary;
2150 UINT r;
2151
2152 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2153 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2154
2155 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
2156 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2157
2158 r = MsiSummaryInfoPersist(summary);
2159 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2160
2161 MsiCloseHandle(summary);
2162 }
2163
2164 static void set_summary_dword(MSIHANDLE hdb, DWORD pid, DWORD value)
2165 {
2166 MSIHANDLE summary;
2167 UINT r;
2168
2169 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2170 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2171
2172 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_I4, value, NULL, NULL);
2173 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2174
2175 r = MsiSummaryInfoPersist(summary);
2176 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2177
2178 MsiCloseHandle(summary);
2179 }
2180
2181 static void test_msipackage(void)
2182 {
2183 MSIHANDLE hdb = 0, hpack = 100;
2184 UINT r;
2185 const char *query;
2186 char name[10];
2187
2188 /* NULL szPackagePath */
2189 r = MsiOpenPackage(NULL, &hpack);
2190 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2191
2192 /* empty szPackagePath */
2193 r = MsiOpenPackage("", &hpack);
2194 todo_wine
2195 {
2196 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2197 }
2198
2199 if (r == ERROR_SUCCESS)
2200 MsiCloseHandle(hpack);
2201
2202 /* nonexistent szPackagePath */
2203 r = MsiOpenPackage("nonexistent", &hpack);
2204 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2205
2206 /* NULL hProduct */
2207 r = MsiOpenPackage(msifile, NULL);
2208 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2209
2210 name[0]='#';
2211 name[1]=0;
2212 r = MsiOpenPackage(name, &hpack);
2213 ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r);
2214
2215 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2216 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2217
2218 /* database exists, but is emtpy */
2219 sprintf(name, "#%d", hdb);
2220 r = MsiOpenPackage(name, &hpack);
2221 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2222 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2223
2224 query = "CREATE TABLE `Property` ( "
2225 "`Property` CHAR(72), `Value` CHAR(0) "
2226 "PRIMARY KEY `Property`)";
2227 r = try_query(hdb, query);
2228 ok(r == ERROR_SUCCESS, "failed to create Properties table\n");
2229
2230 query = "CREATE TABLE `InstallExecuteSequence` ("
2231 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2232 "PRIMARY KEY `Action`)";
2233 r = try_query(hdb, query);
2234 ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n");
2235
2236 /* a few key tables exist */
2237 sprintf(name, "#%d", hdb);
2238 r = MsiOpenPackage(name, &hpack);
2239 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2240 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2241
2242 MsiCloseHandle(hdb);
2243 DeleteFile(msifile);
2244
2245 /* start with a clean database to show what constitutes a valid package */
2246 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2247 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2248
2249 sprintf(name, "#%d", hdb);
2250
2251 /* The following summary information props must exist:
2252 * - PID_REVNUMBER
2253 * - PID_PAGECOUNT
2254 */
2255
2256 set_summary_dword(hdb, PID_PAGECOUNT, 100);
2257 r = MsiOpenPackage(name, &hpack);
2258 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2259 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2260
2261 set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2262 r = MsiOpenPackage(name, &hpack);
2263 ok(r == ERROR_SUCCESS,
2264 "Expected ERROR_SUCCESS, got %d\n", r);
2265
2266 MsiCloseHandle(hpack);
2267 MsiCloseHandle(hdb);
2268 DeleteFile(msifile);
2269 }
2270
2271 static void test_formatrecord2(void)
2272 {
2273 MSIHANDLE hpkg, hrec ;
2274 char buffer[0x100];
2275 DWORD sz;
2276 UINT r;
2277
2278 hpkg = package_from_db(create_package_db());
2279 ok( hpkg, "failed to create package\n");
2280
2281 r = MsiSetProperty(hpkg, "Manufacturer", " " );
2282 ok( r == ERROR_SUCCESS, "set property failed\n");
2283
2284 hrec = MsiCreateRecord(2);
2285 ok(hrec, "create record failed\n");
2286
2287 r = MsiRecordSetString( hrec, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2288 ok( r == ERROR_SUCCESS, "format record failed\n");
2289
2290 buffer[0] = 0;
2291 sz = sizeof buffer;
2292 r = MsiFormatRecord( hpkg, hrec, buffer, &sz );
2293
2294 r = MsiRecordSetString(hrec, 0, "[foo][1]");
2295 r = MsiRecordSetString(hrec, 1, "hoo");
2296 sz = sizeof buffer;
2297 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2298 ok( sz == 3, "size wrong\n");
2299 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2300 ok( r == ERROR_SUCCESS, "format failed\n");
2301
2302 r = MsiRecordSetString(hrec, 0, "x[~]x");
2303 sz = sizeof buffer;
2304 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2305 ok( sz == 3, "size wrong\n");
2306 ok( 0 == strcmp(buffer,"x"), "wrong output %s\n",buffer);
2307 ok( r == ERROR_SUCCESS, "format failed\n");
2308
2309 r = MsiRecordSetString(hrec, 0, "[foo.$%}][1]");
2310 r = MsiRecordSetString(hrec, 1, "hoo");
2311 sz = sizeof buffer;
2312 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2313 ok( sz == 3, "size wrong\n");
2314 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2315 ok( r == ERROR_SUCCESS, "format failed\n");
2316
2317 r = MsiRecordSetString(hrec, 0, "[\\[]");
2318 sz = sizeof buffer;
2319 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2320 ok( sz == 1, "size wrong\n");
2321 ok( 0 == strcmp(buffer,"["), "wrong output %s\n",buffer);
2322 ok( r == ERROR_SUCCESS, "format failed\n");
2323
2324 SetEnvironmentVariable("FOO", "BAR");
2325 r = MsiRecordSetString(hrec, 0, "[%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 r = MsiRecordSetString(hrec, 0, "[[1]]");
2333 r = MsiRecordSetString(hrec, 1, "%FOO");
2334 sz = sizeof buffer;
2335 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2336 ok( sz == 3, "size wrong\n");
2337 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2338 ok( r == ERROR_SUCCESS, "format failed\n");
2339
2340 MsiCloseHandle( hrec );
2341 MsiCloseHandle( hpkg );
2342 DeleteFile(msifile);
2343 }
2344
2345 static void test_states(void)
2346 {
2347 MSIHANDLE hpkg;
2348 UINT r;
2349 MSIHANDLE hdb;
2350 INSTALLSTATE state, action;
2351
2352 static const CHAR msifile2[] = "winetest2-package.msi";
2353 static const CHAR msifile3[] = "winetest3-package.msi";
2354 static const CHAR msifile4[] = "winetest4-package.msi";
2355
2356 hdb = create_package_db();
2357 ok ( hdb, "failed to create package database\n" );
2358
2359 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
2360 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
2361
2362 r = create_property_table( hdb );
2363 ok( r == ERROR_SUCCESS, "cannot create Property table: %d\n", r );
2364
2365 r = add_property_entry( hdb, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2366 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2367
2368 r = add_property_entry( hdb, "'ProductLanguage', '1033'" );
2369 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2370
2371 r = add_property_entry( hdb, "'ProductName', 'MSITEST'" );
2372 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2373
2374 r = add_property_entry( hdb, "'ProductVersion', '1.1.1'" );
2375 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2376
2377 r = create_install_execute_sequence_table( hdb );
2378 ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table: %d\n", r );
2379
2380 r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
2381 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2382
2383 r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
2384 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2385
2386 r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
2387 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2388
2389 r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" );
2390 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2391
2392 r = add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" );
2393 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2394
2395 r = add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" );
2396 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2397
2398 r = add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" );
2399 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2400
2401 r = add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" );
2402 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2403
2404 r = add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" );
2405 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2406
2407 r = add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" );
2408 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2409
2410 r = add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" );
2411 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2412
2413 r = create_media_table( hdb );
2414 ok( r == ERROR_SUCCESS, "cannot create media table: %d\n", r );
2415
2416 r = add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''");
2417 ok( r == ERROR_SUCCESS, "cannot add media entry: %d\n", r );
2418
2419 r = create_feature_table( hdb );
2420 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
2421
2422 r = create_component_table( hdb );
2423 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
2424
2425 /* msidbFeatureAttributesFavorLocal */
2426 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
2427 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2428
2429 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2430 r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2431 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2432
2433 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2434 r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2435 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2436
2437 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2438 r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2439 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2440
2441 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2442 r = add_component_entry( hdb, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2443 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2444
2445 /* msidbFeatureAttributesFavorSource */
2446 r = add_feature_entry( hdb, "'two', '', '', '', 2, 1, '', 1" );
2447 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2448
2449 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2450 r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2451 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2452
2453 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2454 r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2455 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2456
2457 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2458 r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2459 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2460
2461 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2462 r = add_component_entry( hdb, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2463 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2464
2465 /* msidbFeatureAttributesFavorSource */
2466 r = add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" );
2467 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2468
2469 /* msidbFeatureAttributesFavorLocal */
2470 r = add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" );
2471 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2472
2473 /* disabled */
2474 r = add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" );
2475 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2476
2477 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2478 r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2479 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2480
2481 /* no feature parent:msidbComponentAttributesLocalOnly */
2482 r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2483 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2484
2485 /* msidbFeatureAttributesFavorLocal:removed */
2486 r = add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" );
2487 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2488
2489 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2490 r = add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2491 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2492
2493 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2494 r = add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2495 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2496
2497 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2498 r = add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2499 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2500
2501 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2502 r = add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2503 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2504
2505 /* msidbFeatureAttributesFavorSource:removed */
2506 r = add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" );
2507 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2508
2509 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2510 r = add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2511 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2512
2513 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2514 r = add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2515 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2516
2517 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2518 r = add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2519 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2520
2521 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2522 r = add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2523 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2524
2525 /* msidbFeatureAttributesFavorLocal */
2526 r = add_feature_entry( hdb, "'eight', '', '', '', 2, 1, '', 0" );
2527 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2528
2529 r = add_component_entry( hdb, "'tau', '{07DEB510-677C-4A6F-A0A6-7CD8EFEA77ED}', 'TARGETDIR', 1, '', 'tau_file'" );
2530 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2531
2532 /* msidbFeatureAttributesFavorSource */
2533 r = add_feature_entry( hdb, "'nine', '', '', '', 2, 1, '', 1" );
2534 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2535
2536 r = add_component_entry( hdb, "'phi', '{9F0594C5-35AD-43EA-94DD-8DF73FAA664D}', 'TARGETDIR', 1, '', 'phi_file'" );
2537 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2538
2539 /* msidbFeatureAttributesFavorAdvertise */
2540 r = add_feature_entry( hdb, "'ten', '', '', '', 2, 1, '', 4" );
2541 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2542
2543 r = add_component_entry( hdb, "'chi', '{E6B539AB-5DA9-4236-A2D2-E341A50B4C38}', 'TARGETDIR', 1, '', 'chi_file'" );
2544 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2545
2546 r = create_feature_components_table( hdb );
2547 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
2548
2549 r = add_feature_components_entry( hdb, "'one', 'alpha'" );
2550 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2551
2552 r = add_feature_components_entry( hdb, "'one', 'beta'" );
2553 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2554
2555 r = add_feature_components_entry( hdb, "'one', 'gamma'" );
2556 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2557
2558 r = add_feature_components_entry( hdb, "'one', 'theta'" );
2559 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2560
2561 r = add_feature_components_entry( hdb, "'two', 'delta'" );
2562 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2563
2564 r = add_feature_components_entry( hdb, "'two', 'epsilon'" );
2565 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2566
2567 r = add_feature_components_entry( hdb, "'two', 'zeta'" );
2568 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2569
2570 r = add_feature_components_entry( hdb, "'two', 'iota'" );
2571 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2572
2573 r = add_feature_components_entry( hdb, "'three', 'eta'" );
2574 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2575
2576 r = add_feature_components_entry( hdb, "'four', 'eta'" );
2577 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2578
2579 r = add_feature_components_entry( hdb, "'five', 'eta'" );
2580 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2581
2582 r = add_feature_components_entry( hdb, "'six', 'lambda'" );
2583 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2584
2585 r = add_feature_components_entry( hdb, "'six', 'mu'" );
2586 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2587
2588 r = add_feature_components_entry( hdb, "'six', 'nu'" );
2589 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2590
2591 r = add_feature_components_entry( hdb, "'six', 'xi'" );
2592 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2593
2594 r = add_feature_components_entry( hdb, "'seven', 'omicron'" );
2595 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2596
2597 r = add_feature_components_entry( hdb, "'seven', 'pi'" );
2598 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2599
2600 r = add_feature_components_entry( hdb, "'seven', 'rho'" );
2601 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2602
2603 r = add_feature_components_entry( hdb, "'seven', 'sigma'" );
2604 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2605
2606 r = add_feature_components_entry( hdb, "'eight', 'tau'" );
2607 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2608
2609 r = add_feature_components_entry( hdb, "'nine', 'phi'" );
2610 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2611
2612 r = add_feature_components_entry( hdb, "'ten', 'chi'" );
2613 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2614
2615 r = create_file_table( hdb );
2616 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
2617
2618 r = add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2619 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2620
2621 r = add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2622 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2623
2624 r = add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2625 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2626
2627 r = add_file_entry( hdb, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2628 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2629
2630 r = add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2631 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2632
2633 r = add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2634 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2635
2636 r = add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2637 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2638
2639 r = add_file_entry( hdb, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2640 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2641
2642 /* compressed file */
2643 r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2644 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2645
2646 r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2647 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2648
2649 r = add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2650 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2651
2652 r = add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2653 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2654
2655 r = add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2656 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2657
2658 r = add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2659 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2660
2661 r = add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2662 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2663
2664 r = add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2665 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2666
2667 r = add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2668 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2669
2670 r = add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2671 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2672
2673 r = add_file_entry( hdb, "'tau_file', 'tau', 'tau.txt', 100, '', '1033', 8192, 1" );
2674 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2675
2676 r = add_file_entry( hdb, "'phi_file', 'phi', 'phi.txt', 100, '', '1033', 8192, 1" );
2677 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2678
2679 r = add_file_entry( hdb, "'chi_file', 'chi', 'chi.txt', 100, '', '1033', 8192, 1" );
2680 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2681
2682 MsiDatabaseCommit(hdb);
2683
2684 /* these properties must not be in the saved msi file */
2685 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
2686 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2687
2688 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
2689 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2690
2691 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
2692 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2693
2694 r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
2695 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2696
2697 r = add_property_entry( hdb, "'REINSTALLMODE', 'omus'");
2698 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2699
2700 hpkg = package_from_db( hdb );
2701 ok( hpkg, "failed to create package\n");
2702
2703 MsiCloseHandle(hdb);
2704
2705 CopyFileA(msifile, msifile2, FALSE);
2706 CopyFileA(msifile, msifile3, FALSE);
2707 CopyFileA(msifile, msifile4, FALSE);
2708
2709 state = 0xdeadbee;
2710 action = 0xdeadbee;
2711 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2712 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2713 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2714 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2715
2716 state = 0xdeadbee;
2717 action = 0xdeadbee;
2718 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2719 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2720 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2721 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2722
2723 state = 0xdeadbee;
2724 action = 0xdeadbee;
2725 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2726 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2727 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2728 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2729
2730 state = 0xdeadbee;
2731 action = 0xdeadbee;
2732 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2733 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2734 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2735 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2736
2737 state = 0xdeadbee;
2738 action = 0xdeadbee;
2739 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2740 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2741 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2742 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2743
2744 state = 0xdeadbee;
2745 action = 0xdeadbee;
2746 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2747 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2748 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2749 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2750
2751 state = 0xdeadbee;
2752 action = 0xdeadbee;
2753 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2754 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2755 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2756 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2757
2758 state = 0xdeadbee;
2759 action = 0xdeadbee;
2760 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
2761 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2762 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2763 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2764
2765 state = 0xdeadbee;
2766 action = 0xdeadbee;
2767 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
2768 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2769 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2770 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2771
2772 state = 0xdeadbee;
2773 action = 0xdeadbee;
2774 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
2775 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2776 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2777 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2778
2779 state = 0xdeadbee;
2780 action = 0xdeadbee;
2781 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2782 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2783 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2784 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2785
2786 state = 0xdeadbee;
2787 action = 0xdeadbee;
2788 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2789 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2790 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2791 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2792
2793 state = 0xdeadbee;
2794 action = 0xdeadbee;
2795 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2796 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2797 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2798 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2799
2800 state = 0xdeadbee;
2801 action = 0xdeadbee;
2802 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2803 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2804 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2805 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2806
2807 state = 0xdeadbee;
2808 action = 0xdeadbee;
2809 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2810 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2811 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2812 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2813
2814 state = 0xdeadbee;
2815 action = 0xdeadbee;
2816 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2817 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2818 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2819 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2820
2821 state = 0xdeadbee;
2822 action = 0xdeadbee;
2823 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2824 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2825 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2826 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2827
2828 state = 0xdeadbee;
2829 action = 0xdeadbee;
2830 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2831 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2832 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2833 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2834
2835 state = 0xdeadbee;
2836 action = 0xdeadbee;
2837 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2838 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2839 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2840 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2841
2842 state = 0xdeadbee;
2843 action = 0xdeadbee;
2844 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2845 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2846 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2847 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2848
2849 state = 0xdeadbee;
2850 action = 0xdeadbee;
2851 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2852 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2853 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2854 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2855
2856 state = 0xdeadbee;
2857 action = 0xdeadbee;
2858 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2859 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2860 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2861 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2862
2863 state = 0xdeadbee;
2864 action = 0xdeadbee;
2865 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2866 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2867 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2868 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2869
2870 state = 0xdeadbee;
2871 action = 0xdeadbee;
2872 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2873 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2874 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2875 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2876
2877 state = 0xdeadbee;
2878 action = 0xdeadbee;
2879 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
2880 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2881 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2882 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2883
2884 state = 0xdeadbee;
2885 action = 0xdeadbee;
2886 r = MsiGetComponentState(hpkg, "pi", &state, &action);
2887 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2888 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2889 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2890
2891 state = 0xdeadbee;
2892 action = 0xdeadbee;
2893 r = MsiGetComponentState(hpkg, "rho", &state, &action);
2894 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2895 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2896 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2897
2898 state = 0xdeadbee;
2899 action = 0xdeadbee;
2900 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
2901 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2902 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2903 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2904
2905 state = 0xdeadbee;
2906 action = 0xdeadbee;
2907 r = MsiGetComponentState(hpkg, "tau", &state, &action);
2908 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2909 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2910 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2911
2912 state = 0xdeadbee;
2913 action = 0xdeadbee;
2914 r = MsiGetComponentState(hpkg, "phi", &state, &action);
2915 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2916 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2917 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2918
2919 state = 0xdeadbee;
2920 action = 0xdeadbee;
2921 r = MsiGetComponentState(hpkg, "chi", &state, &action);
2922 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2923 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2924 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2925
2926 r = MsiDoAction( hpkg, "CostInitialize");
2927 ok( r == ERROR_SUCCESS, "cost init failed\n");
2928
2929 state = 0xdeadbee;
2930 action = 0xdeadbee;
2931 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2932 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2933 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2934 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2935
2936 state = 0xdeadbee;
2937 action = 0xdeadbee;
2938 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2939 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2940 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2941 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2942
2943 state = 0xdeadbee;
2944 action = 0xdeadbee;
2945 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2946 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2947 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2948 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2949
2950 state = 0xdeadbee;
2951 action = 0xdeadbee;
2952 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2953 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2954 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2955 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2956
2957 state = 0xdeadbee;
2958 action = 0xdeadbee;
2959 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2960 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2961 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2962 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2963
2964 state = 0xdeadbee;
2965 action = 0xdeadbee;
2966 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2967 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2968 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2969 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2970
2971 state = 0xdeadbee;
2972 action = 0xdeadbee;
2973 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2974 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2975 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2976 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2977
2978 state = 0xdeadbee;
2979 action = 0xdeadbee;
2980 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
2981 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2982 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2983 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2984
2985 state = 0xdeadbee;
2986 action = 0xdeadbee;
2987 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
2988 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2989 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2990 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2991
2992 state = 0xdeadbee;
2993 action = 0xdeadbee;
2994 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
2995 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2996 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2997 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2998
2999 state = 0xdeadbee;
3000 action = 0xdeadbee;
3001 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3002 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3003 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3004 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3005
3006 state = 0xdeadbee;
3007 action = 0xdeadbee;
3008 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3009 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3010 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3011 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3012
3013 state = 0xdeadbee;
3014 action = 0xdeadbee;
3015 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3016 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3017 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3018 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3019
3020 state = 0xdeadbee;
3021 action = 0xdeadbee;
3022 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3023 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3024 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3025 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3026
3027 state = 0xdeadbee;
3028 action = 0xdeadbee;
3029 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3030 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3031 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3032 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3033
3034 state = 0xdeadbee;
3035 action = 0xdeadbee;
3036 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3037 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3038 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3039 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3040
3041 state = 0xdeadbee;
3042 action = 0xdeadbee;
3043 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3044 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3045 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3046 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3047
3048 state = 0xdeadbee;
3049 action = 0xdeadbee;
3050 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3051 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3052 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3053 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3054
3055 state = 0xdeadbee;
3056 action = 0xdeadbee;
3057 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3058 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3059 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3060 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3061
3062 state = 0xdeadbee;
3063 action = 0xdeadbee;
3064 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3065 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3066 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3067 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3068
3069 state = 0xdeadbee;
3070 action = 0xdeadbee;
3071 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3072 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3073 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3074 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3075
3076 state = 0xdeadbee;
3077 action = 0xdeadbee;
3078 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3079 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3080 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3081 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3082
3083 state = 0xdeadbee;
3084 action = 0xdeadbee;
3085 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3086 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3087 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3088 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3089
3090 state = 0xdeadbee;
3091 action = 0xdeadbee;
3092 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3093 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3094 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3095 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3096
3097 state = 0xdeadbee;
3098 action = 0xdeadbee;
3099 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3100 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3101 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3102 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3103
3104 state = 0xdeadbee;
3105 action = 0xdeadbee;
3106 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3107 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3108 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3109 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3110
3111 state = 0xdeadbee;
3112 action = 0xdeadbee;
3113 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3114 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3115 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3116 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3117
3118 state = 0xdeadbee;
3119 action = 0xdeadbee;
3120 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3121 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3122 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3123 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3124
3125 state = 0xdeadbee;
3126 action = 0xdeadbee;
3127 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3128 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3129 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3130 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3131
3132 state = 0xdeadbee;
3133 action = 0xdeadbee;
3134 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3135 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3136 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3137 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3138
3139 state = 0xdeadbee;
3140 action = 0xdeadbee;
3141 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3142 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3143 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3144 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3145
3146 r = MsiDoAction( hpkg, "FileCost");
3147 ok( r == ERROR_SUCCESS, "file cost failed\n");
3148
3149 state = 0xdeadbee;
3150 action = 0xdeadbee;
3151 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3152 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3153 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3154 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3155
3156 state = 0xdeadbee;
3157 action = 0xdeadbee;
3158 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3159 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3160 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3161 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3162
3163 state = 0xdeadbee;
3164 action = 0xdeadbee;
3165 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3166 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3167 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3168 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3169
3170 state = 0xdeadbee;
3171 action = 0xdeadbee;
3172 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3173 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3174 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3175 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3176
3177 state = 0xdeadbee;
3178 action = 0xdeadbee;
3179 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3180 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3181 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3182 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3183
3184 state = 0xdeadbee;
3185 action = 0xdeadbee;
3186 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3187 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3188 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3189 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3190
3191 state = 0xdeadbee;
3192 action = 0xdeadbee;
3193 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3194 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3195 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3196 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3197
3198 state = 0xdeadbee;
3199 action = 0xdeadbee;
3200 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3201 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3202 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3203 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3204
3205 state = 0xdeadbee;
3206 action = 0xdeadbee;
3207 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3208 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3209 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3210 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3211
3212 state = 0xdeadbee;
3213 action = 0xdeadbee;
3214 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3215 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3216 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3217 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3218
3219 state = 0xdeadbee;
3220 action = 0xdeadbee;
3221 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3222 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3223 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3224 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3225
3226 state = 0xdeadbee;
3227 action = 0xdeadbee;
3228 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3229 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3230 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3231 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3232
3233 state = 0xdeadbee;
3234 action = 0xdeadbee;
3235 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3236 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3237 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3238 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3239
3240 state = 0xdeadbee;
3241 action = 0xdeadbee;
3242 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3243 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3244 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3245 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3246
3247 state = 0xdeadbee;
3248 action = 0xdeadbee;
3249 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3250 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3251 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3252 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3253
3254 state = 0xdeadbee;
3255 action = 0xdeadbee;
3256 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3257 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3258 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3259 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3260
3261 state = 0xdeadbee;
3262 action = 0xdeadbee;
3263 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3264 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3265 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3266 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3267
3268 state = 0xdeadbee;
3269 action = 0xdeadbee;
3270 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3271 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3272 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3273 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3274
3275 state = 0xdeadbee;
3276 action = 0xdeadbee;
3277 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3278 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3279 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3280 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3281
3282 state = 0xdeadbee;
3283 action = 0xdeadbee;
3284 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3285 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3286 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3287 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3288
3289 state = 0xdeadbee;
3290 action = 0xdeadbee;
3291 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3292 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3293 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3294 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3295
3296 state = 0xdeadbee;
3297 action = 0xdeadbee;
3298 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3299 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3300 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3301 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3302
3303 state = 0xdeadbee;
3304 action = 0xdeadbee;
3305 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3306 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3307 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3308 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3309
3310 state = 0xdeadbee;
3311 action = 0xdeadbee;
3312 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3313 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3314 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3315 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3316
3317 state = 0xdeadbee;
3318 action = 0xdeadbee;
3319 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3320 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3321 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3322 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3323
3324 state = 0xdeadbee;
3325 action = 0xdeadbee;
3326 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3327 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3328 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3329 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3330
3331 state = 0xdeadbee;
3332 action = 0xdeadbee;
3333 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3334 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3335 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3336 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3337
3338 state = 0xdeadbee;
3339 action = 0xdeadbee;
3340 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3341 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3342 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3343 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3344
3345 state = 0xdeadbee;
3346 action = 0xdeadbee;
3347 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3348 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3349 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3350 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3351
3352 state = 0xdeadbee;
3353 action = 0xdeadbee;
3354 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3355 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3356 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3357 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3358
3359 state = 0xdeadbee;
3360 action = 0xdeadbee;
3361 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3362 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3363 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3364 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3365
3366 r = MsiDoAction( hpkg, "CostFinalize");
3367 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3368
3369 state = 0xdeadbee;
3370 action = 0xdeadbee;
3371 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3372 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3373 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3374 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3375
3376 state = 0xdeadbee;
3377 action = 0xdeadbee;
3378 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3379 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3380 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3381 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3382
3383 state = 0xdeadbee;
3384 action = 0xdeadbee;
3385 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3386 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3387 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3388 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3389
3390 state = 0xdeadbee;
3391 action = 0xdeadbee;
3392 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3393 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3394 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3395 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3396
3397 state = 0xdeadbee;
3398 action = 0xdeadbee;
3399 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3400 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3401 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3402 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3403
3404 state = 0xdeadbee;
3405 action = 0xdeadbee;
3406 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3407 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3408 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3409 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3410
3411 state = 0xdeadbee;
3412 action = 0xdeadbee;
3413 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3414 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3415 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3416 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3417
3418 state = 0xdeadbee;
3419 action = 0xdeadbee;
3420 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3421 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3422 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3423 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3424
3425 state = 0xdeadbee;
3426 action = 0xdeadbee;
3427 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3428 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3429 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3430 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3431
3432 state = 0xdeadbee;
3433 action = 0xdeadbee;
3434 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3435 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3436 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3437 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3438
3439 state = 0xdeadbee;
3440 action = 0xdeadbee;
3441 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3442 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3443 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3444 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3445
3446 state = 0xdeadbee;
3447 action = 0xdeadbee;
3448 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3449 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3450 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3451 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3452
3453 state = 0xdeadbee;
3454 action = 0xdeadbee;
3455 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3456 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3457 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3458 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3459
3460 state = 0xdeadbee;
3461 action = 0xdeadbee;
3462 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3463 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3464 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3465 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3466
3467 state = 0xdeadbee;
3468 action = 0xdeadbee;
3469 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3470 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3471 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3472 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3473
3474 state = 0xdeadbee;
3475 action = 0xdeadbee;
3476 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3477 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3478 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3479 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3480
3481 state = 0xdeadbee;
3482 action = 0xdeadbee;
3483 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3484 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3485 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3486 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3487
3488 state = 0xdeadbee;
3489 action = 0xdeadbee;
3490 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3491 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3492 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3493 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3494
3495 state = 0xdeadbee;
3496 action = 0xdeadbee;
3497 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3498 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3499 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3500 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3501
3502 state = 0xdeadbee;
3503 action = 0xdeadbee;
3504 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3505 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3506 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3507 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3508
3509 state = 0xdeadbee;
3510 action = 0xdeadbee;
3511 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3512 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3513 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3514 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3515
3516 state = 0xdeadbee;
3517 action = 0xdeadbee;
3518 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3519 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3520 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3521 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3522
3523 state = 0xdeadbee;
3524 action = 0xdeadbee;
3525 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3526 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3527 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3528 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3529
3530 state = 0xdeadbee;
3531 action = 0xdeadbee;
3532 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3533 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3534 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3535 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3536
3537 state = 0xdeadbee;
3538 action = 0xdeadbee;
3539 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3540 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3541 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3542 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3543
3544 state = 0xdeadbee;
3545 action = 0xdeadbee;
3546 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3547 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3548 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3549 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3550
3551 state = 0xdeadbee;
3552 action = 0xdeadbee;
3553 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3554 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3555 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3556 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3557
3558 state = 0xdeadbee;
3559 action = 0xdeadbee;
3560 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3561 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3562 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3563 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3564
3565 state = 0xdeadbee;
3566 action = 0xdeadbee;
3567 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3568 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3569 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3570 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3571
3572 state = 0xdeadbee;
3573 action = 0xdeadbee;
3574 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3575 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3576 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3577 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3578
3579 state = 0xdeadbee;
3580 action = 0xdeadbee;
3581 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3582 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3583 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3584 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3585
3586 MsiCloseHandle( hpkg );
3587
3588 /* publish the features and components */
3589 r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven REINSTALL=eight,nine,ten");
3590 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3591
3592 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
3593 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
3594
3595 /* these properties must not be in the saved msi file */
3596 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
3597 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3598
3599 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
3600 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3601
3602 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
3603 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3604
3605 r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
3606 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3607
3608 hpkg = package_from_db( hdb );
3609 ok( hpkg, "failed to create package\n");
3610
3611 MsiCloseHandle(hdb);
3612
3613 state = 0xdeadbee;
3614 action = 0xdeadbee;
3615 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3616 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3617 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3618 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3619
3620 state = 0xdeadbee;
3621 action = 0xdeadbee;
3622 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3623 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3624 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3625 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3626
3627 state = 0xdeadbee;
3628 action = 0xdeadbee;
3629 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3630 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3631 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3632 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3633
3634 state = 0xdeadbee;
3635 action = 0xdeadbee;
3636 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3637 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3638 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3639 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3640
3641 state = 0xdeadbee;
3642 action = 0xdeadbee;
3643 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3644 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3645 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3646 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3647
3648 state = 0xdeadbee;
3649 action = 0xdeadbee;
3650 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3651 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3652 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3653 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3654
3655 state = 0xdeadbee;
3656 action = 0xdeadbee;
3657 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3658 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3659 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3660 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3661
3662 state = 0xdeadbee;
3663 action = 0xdeadbee;
3664 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3665 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3666 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3667 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3668
3669 state = 0xdeadbee;
3670 action = 0xdeadbee;
3671 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3672 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3673 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3674 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3675
3676 state = 0xdeadbee;
3677 action = 0xdeadbee;
3678 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3679 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3680 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3681 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3682
3683 state = 0xdeadbee;
3684 action = 0xdeadbee;
3685 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3686 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3687 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3688 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3689
3690 state = 0xdeadbee;
3691 action = 0xdeadbee;
3692 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3693 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3694 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3695 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3696
3697 state = 0xdeadbee;
3698 action = 0xdeadbee;
3699 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3700 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3701 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3702 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3703
3704 state = 0xdeadbee;
3705 action = 0xdeadbee;
3706 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3707 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3708 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3709 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3710
3711 state = 0xdeadbee;
3712 action = 0xdeadbee;
3713 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3714 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3715 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3716 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3717
3718 state = 0xdeadbee;
3719 action = 0xdeadbee;
3720 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3721 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3722 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3723 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3724
3725 state = 0xdeadbee;
3726 action = 0xdeadbee;
3727 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3728 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3729 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3730 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3731
3732 state = 0xdeadbee;
3733 action = 0xdeadbee;
3734 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3735 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3736 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3737 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3738
3739 state = 0xdeadbee;
3740 action = 0xdeadbee;
3741 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3742 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3743 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3744 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3745
3746 state = 0xdeadbee;
3747 action = 0xdeadbee;
3748 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3749 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3750 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3751 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3752
3753 state = 0xdeadbee;
3754 action = 0xdeadbee;
3755 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3756 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3757 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3758 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3759
3760 state = 0xdeadbee;
3761 action = 0xdeadbee;
3762 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3763 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3764 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3765 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3766
3767 state = 0xdeadbee;
3768 action = 0xdeadbee;
3769 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3770 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3771 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3772 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3773
3774 state = 0xdeadbee;
3775 action = 0xdeadbee;
3776 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3777 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3778 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3779 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3780
3781 state = 0xdeadbee;
3782 action = 0xdeadbee;
3783 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3784 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3785 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3786 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3787
3788 state = 0xdeadbee;
3789 action = 0xdeadbee;
3790 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3791 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3792 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3793 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3794
3795 state = 0xdeadbee;
3796 action = 0xdeadbee;
3797 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3798 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3799 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3800 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3801
3802 state = 0xdeadbee;
3803 action = 0xdeadbee;
3804 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3805 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3806 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3807 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3808
3809 state = 0xdeadbee;
3810 action = 0xdeadbee;
3811 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3812 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3813 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3814 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3815
3816 state = 0xdeadbee;
3817 action = 0xdeadbee;
3818 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3819 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3820 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3821 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3822
3823 state = 0xdeadbee;
3824 action = 0xdeadbee;
3825 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3826 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3827 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3828 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3829
3830 r = MsiDoAction( hpkg, "CostInitialize");
3831 ok( r == ERROR_SUCCESS, "cost init failed\n");
3832
3833 state = 0xdeadbee;
3834 action = 0xdeadbee;
3835 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3836 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3837 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3838 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3839
3840 state = 0xdeadbee;
3841 action = 0xdeadbee;
3842 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3843 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3844 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3845 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3846
3847 state = 0xdeadbee;
3848 action = 0xdeadbee;
3849 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3850 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3851 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3852 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3853
3854 state = 0xdeadbee;
3855 action = 0xdeadbee;
3856 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3857 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3858 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3859 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3860
3861 state = 0xdeadbee;
3862 action = 0xdeadbee;
3863 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3864 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3865 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3866 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3867
3868 state = 0xdeadbee;
3869 action = 0xdeadbee;
3870 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3871 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3872 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3873 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3874
3875 state = 0xdeadbee;
3876 action = 0xdeadbee;
3877 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3878 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3879 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3880 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3881
3882 state = 0xdeadbee;
3883 action = 0xdeadbee;
3884 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3885 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3886 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3887 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3888
3889 state = 0xdeadbee;
3890 action = 0xdeadbee;
3891 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3892 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3893 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3894 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3895
3896 state = 0xdeadbee;
3897 action = 0xdeadbee;
3898 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3899 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3900 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3901 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3902
3903 state = 0xdeadbee;
3904 action = 0xdeadbee;
3905 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3906 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3907 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3908 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3909
3910 state = 0xdeadbee;
3911 action = 0xdeadbee;
3912 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3913 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3914 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3915 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3916
3917 state = 0xdeadbee;
3918 action = 0xdeadbee;
3919 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3920 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3921 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3922 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3923
3924 state = 0xdeadbee;
3925 action = 0xdeadbee;
3926 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3927 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3928 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3929 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3930
3931 state = 0xdeadbee;
3932 action = 0xdeadbee;
3933 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3934 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3935 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3936 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3937
3938 state = 0xdeadbee;
3939 action = 0xdeadbee;
3940 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3941 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3942 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3943 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3944
3945 state = 0xdeadbee;
3946 action = 0xdeadbee;
3947 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3948 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3949 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3950 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3951
3952 state = 0xdeadbee;
3953 action = 0xdeadbee;
3954 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3955 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3956 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3957 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3958
3959 state = 0xdeadbee;
3960 action = 0xdeadbee;
3961 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3962 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3963 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3964 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3965
3966 state = 0xdeadbee;
3967 action = 0xdeadbee;
3968 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3969 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3970 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3971 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3972
3973 state = 0xdeadbee;
3974 action = 0xdeadbee;
3975 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3976 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3977 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3978 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3979
3980 state = 0xdeadbee;
3981 action = 0xdeadbee;
3982 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3983 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3984 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3985 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3986
3987 state = 0xdeadbee;
3988 action = 0xdeadbee;
3989 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3990 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3991 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3992 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3993
3994 state = 0xdeadbee;
3995 action = 0xdeadbee;
3996 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3997 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3998 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3999 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4000
4001 state = 0xdeadbee;
4002 action = 0xdeadbee;
4003 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4004 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4005 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4006 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4007
4008 state = 0xdeadbee;
4009 action = 0xdeadbee;
4010 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4011 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4012 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4013 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4014
4015 state = 0xdeadbee;
4016 action = 0xdeadbee;
4017 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4018 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4019 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4020 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4021
4022 state = 0xdeadbee;
4023 action = 0xdeadbee;
4024 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4025 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4026 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4027 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4028
4029 state = 0xdeadbee;
4030 action = 0xdeadbee;
4031 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4032 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4033 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4034 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4035
4036 state = 0xdeadbee;
4037 action = 0xdeadbee;
4038 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4039 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4040 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4041 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4042
4043 state = 0xdeadbee;
4044 action = 0xdeadbee;
4045 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4046 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4047 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4048 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4049
4050 r = MsiDoAction( hpkg, "FileCost");
4051 ok( r == ERROR_SUCCESS, "file cost failed\n");
4052
4053 state = 0xdeadbee;
4054 action = 0xdeadbee;
4055 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4056 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4057 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4058 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4059
4060 state = 0xdeadbee;
4061 action = 0xdeadbee;
4062 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4063 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4064 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4065 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4066
4067 state = 0xdeadbee;
4068 action = 0xdeadbee;
4069 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4070 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4071 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4072 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4073
4074 state = 0xdeadbee;
4075 action = 0xdeadbee;
4076 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4077 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4078 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4079 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4080
4081 state = 0xdeadbee;
4082 action = 0xdeadbee;
4083 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4084 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4085 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4086 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4087
4088 state = 0xdeadbee;
4089 action = 0xdeadbee;
4090 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4091 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4092 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4093 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4094
4095 state = 0xdeadbee;
4096 action = 0xdeadbee;
4097 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4098 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4099 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4100 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4101
4102 state = 0xdeadbee;
4103 action = 0xdeadbee;
4104 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4105 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4106 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4107 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4108
4109 state = 0xdeadbee;
4110 action = 0xdeadbee;
4111 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4112 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4113 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4114 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4115
4116 state = 0xdeadbee;
4117 action = 0xdeadbee;
4118 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4119 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4120 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4121 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4122
4123 state = 0xdeadbee;
4124 action = 0xdeadbee;
4125 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4126 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4127 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4128 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4129
4130 state = 0xdeadbee;
4131 action = 0xdeadbee;
4132 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4133 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4134 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4135 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4136
4137 state = 0xdeadbee;
4138 action = 0xdeadbee;
4139 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4140 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4141 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4142 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4143
4144 state = 0xdeadbee;
4145 action = 0xdeadbee;
4146 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4147 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4148 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4149 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4150
4151 state = 0xdeadbee;
4152 action = 0xdeadbee;
4153 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4154 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4155 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4156 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4157
4158 state = 0xdeadbee;
4159 action = 0xdeadbee;
4160 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4161 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4162 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4163 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4164
4165 state = 0xdeadbee;
4166 action = 0xdeadbee;
4167 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4168 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4169 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4170 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4171
4172 state = 0xdeadbee;
4173 action = 0xdeadbee;
4174 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4175 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4176 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4177 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4178
4179 state = 0xdeadbee;
4180 action = 0xdeadbee;
4181 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4182 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4183 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4184 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4185
4186 state = 0xdeadbee;
4187 action = 0xdeadbee;
4188 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4189 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4190 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4191 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4192
4193 state = 0xdeadbee;
4194 action = 0xdeadbee;
4195 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4196 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4197 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4198 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4199
4200 state = 0xdeadbee;
4201 action = 0xdeadbee;
4202 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4203 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4204 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4205 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4206
4207 state = 0xdeadbee;
4208 action = 0xdeadbee;
4209 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4210 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4211 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4212 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4213
4214 state = 0xdeadbee;
4215 action = 0xdeadbee;
4216 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4217 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4218 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4219 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4220
4221 state = 0xdeadbee;
4222 action = 0xdeadbee;
4223 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4224 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4225 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4226 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4227
4228 state = 0xdeadbee;
4229 action = 0xdeadbee;
4230 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4231 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4232 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4233 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4234
4235 state = 0xdeadbee;
4236 action = 0xdeadbee;
4237 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4238 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4239 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4240 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4241
4242 state = 0xdeadbee;
4243 action = 0xdeadbee;
4244 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4245 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4246 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4247 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4248
4249 state = 0xdeadbee;
4250 action = 0xdeadbee;
4251 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4252 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4253 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4254 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4255
4256 state = 0xdeadbee;
4257 action = 0xdeadbee;
4258 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4259 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4260 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4261 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4262
4263 r = MsiDoAction( hpkg, "CostFinalize");
4264 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
4265
4266 state = 0xdeadbee;
4267 action = 0xdeadbee;
4268 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4269 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4270 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4271 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4272
4273 state = 0xdeadbee;
4274 action = 0xdeadbee;
4275 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4276 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4277 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4278 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4279
4280 state = 0xdeadbee;
4281 action = 0xdeadbee;
4282 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4283 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4284 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4285 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4286
4287 state = 0xdeadbee;
4288 action = 0xdeadbee;
4289 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4290 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4291 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4292 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4293
4294 state = 0xdeadbee;
4295 action = 0xdeadbee;
4296 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4297 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4298 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4299 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4300
4301 state = 0xdeadbee;
4302 action = 0xdeadbee;
4303 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4304 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4305 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4306 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4307
4308 state = 0xdeadbee;
4309 action = 0xdeadbee;
4310 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4311 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4312 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4313 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4314
4315 state = 0xdeadbee;
4316 action = 0xdeadbee;
4317 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4318 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4319 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4320 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4321
4322 state = 0xdeadbee;
4323 action = 0xdeadbee;
4324 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4325 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4326 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4327 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4328
4329 state = 0xdeadbee;
4330 action = 0xdeadbee;
4331 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4332 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4333 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4334 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4335
4336 state = 0xdeadbee;
4337 action = 0xdeadbee;
4338 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4339 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4340 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4341 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4342
4343 state = 0xdeadbee;
4344 action = 0xdeadbee;
4345 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4346 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4347 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4348 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4349
4350 state = 0xdeadbee;
4351 action = 0xdeadbee;
4352 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4353 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4354 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4355 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4356
4357 state = 0xdeadbee;
4358 action = 0xdeadbee;
4359 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4360 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4361 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4362 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4363
4364 state = 0xdeadbee;
4365 action = 0xdeadbee;
4366 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4367 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4368 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4369 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4370
4371 state = 0xdeadbee;
4372 action = 0xdeadbee;
4373 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4374 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4375 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4376 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4377
4378 state = 0xdeadbee;
4379 action = 0xdeadbee;
4380 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4381 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4382 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4383 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4384
4385 state = 0xdeadbee;
4386 action = 0xdeadbee;
4387 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4388 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4389 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4390 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4391
4392 state = 0xdeadbee;
4393 action = 0xdeadbee;
4394 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4395 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4396 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4397 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4398
4399 state = 0xdeadbee;
4400 action = 0xdeadbee;
4401 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4402 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4403 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4404 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4405
4406 state = 0xdeadbee;
4407 action = 0xdeadbee;
4408 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4409 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4410 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4411 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4412
4413 state = 0xdeadbee;
4414 action = 0xdeadbee;
4415 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4416 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4417 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4418 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4419
4420 state = 0xdeadbee;
4421 action = 0xdeadbee;
4422 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4423 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4424 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4425 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4426
4427 state = 0xdeadbee;
4428 action = 0xdeadbee;
4429 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4430 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4431 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4432 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4433
4434 state = 0xdeadbee;
4435 action = 0xdeadbee;
4436 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4437 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4438 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4439 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4440
4441 state = 0xdeadbee;
4442 action = 0xdeadbee;
4443 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4444 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4445 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4446 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4447
4448 state = 0xdeadbee;
4449 action = 0xdeadbee;
4450 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4451 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4452 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4453 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4454
4455 state = 0xdeadbee;
4456 action = 0xdeadbee;
4457 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4458 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4459 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4460 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4461
4462 state = 0xdeadbee;
4463 action = 0xdeadbee;
4464 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4465 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4466 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4467 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4468
4469 state = 0xdeadbee;
4470 action = 0xdeadbee;
4471 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4472 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4473 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4474 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4475
4476 state = 0xdeadbee;
4477 action = 0xdeadbee;
4478 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4479 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4480 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4481 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4482
4483 MsiCloseHandle(hpkg);
4484
4485 /* uninstall the product */
4486 r = MsiInstallProduct(msifile, "REMOVE=ALL");
4487 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4488
4489 /* all features installed locally */
4490 r = MsiInstallProduct(msifile2, "ADDLOCAL=ALL");
4491 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4492
4493 r = MsiOpenDatabase(msifile2, MSIDBOPEN_DIRECT, &hdb);
4494 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
4495
4496 /* these properties must not be in the saved msi file */
4497 r = add_property_entry( hdb, "'ADDLOCAL', 'one,two,three,four,five,six,seven,eight,nine,ten'");
4498 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
4499
4500 hpkg = package_from_db( hdb );
4501 ok( hpkg, "failed to create package\n");
4502
4503 state = 0xdeadbee;
4504 action = 0xdeadbee;
4505 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4506 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4507 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4508 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4509
4510 state = 0xdeadbee;
4511 action = 0xdeadbee;
4512 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4513 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4514 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4515 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4516
4517 state = 0xdeadbee;
4518 action = 0xdeadbee;
4519 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4520 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4521 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4522 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4523
4524 state = 0xdeadbee;
4525 action = 0xdeadbee;
4526 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4527 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4528 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4529 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4530
4531 state = 0xdeadbee;
4532 action = 0xdeadbee;
4533 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4534 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4535 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4536 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4537
4538 state = 0xdeadbee;
4539 action = 0xdeadbee;
4540 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4541 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4542 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4543 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4544
4545 state = 0xdeadbee;
4546 action = 0xdeadbee;
4547 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4548 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4549 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4550 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4551
4552 state = 0xdeadbee;
4553 action = 0xdeadbee;
4554 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4555 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4556 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4557 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4558
4559 state = 0xdeadbee;
4560 action = 0xdeadbee;
4561 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4562 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4563 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4564 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4565
4566 state = 0xdeadbee;
4567 action = 0xdeadbee;
4568 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4569 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4570 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4571 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4572
4573 state = 0xdeadbee;
4574 action = 0xdeadbee;
4575 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4576 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4577 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4578 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4579
4580 state = 0xdeadbee;
4581 action = 0xdeadbee;
4582 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4583 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4584 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4585 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4586
4587 state = 0xdeadbee;
4588 action = 0xdeadbee;
4589 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4590 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4591 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4592 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4593
4594 state = 0xdeadbee;
4595 action = 0xdeadbee;
4596 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4597 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4598 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4599 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4600
4601 state = 0xdeadbee;
4602 action = 0xdeadbee;
4603 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4604 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4605 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4606 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4607
4608 state = 0xdeadbee;
4609 action = 0xdeadbee;
4610 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4611 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4612 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4613 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4614
4615 state = 0xdeadbee;
4616 action = 0xdeadbee;
4617 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4618 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4619 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4620 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4621
4622 state = 0xdeadbee;
4623 action = 0xdeadbee;
4624 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4625 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4626 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4627 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4628
4629 state = 0xdeadbee;
4630 action = 0xdeadbee;
4631 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4632 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4633 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4634 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4635
4636 state = 0xdeadbee;
4637 action = 0xdeadbee;
4638 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4639 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4640 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4641 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4642
4643 state = 0xdeadbee;
4644 action = 0xdeadbee;
4645 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4646 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4647 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4648 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4649
4650 state = 0xdeadbee;
4651 action = 0xdeadbee;
4652 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4653 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4654 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4655 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4656
4657 state = 0xdeadbee;
4658 action = 0xdeadbee;
4659 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4660 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4661 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4662 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4663
4664 state = 0xdeadbee;
4665 action = 0xdeadbee;
4666 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4667 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4668 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4669 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4670
4671 state = 0xdeadbee;
4672 action = 0xdeadbee;
4673 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4674 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4675 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4676 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4677
4678 state = 0xdeadbee;
4679 action = 0xdeadbee;
4680 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4681 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4682 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4683 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4684
4685 state = 0xdeadbee;
4686 action = 0xdeadbee;
4687 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4688 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4689 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4690 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4691
4692 state = 0xdeadbee;
4693 action = 0xdeadbee;
4694 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4695 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4696 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4697 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4698
4699 state = 0xdeadbee;
4700 action = 0xdeadbee;
4701 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4702 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4703 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4704 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4705
4706 state = 0xdeadbee;
4707 action = 0xdeadbee;
4708 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4709 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4710 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4711 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4712
4713 state = 0xdeadbee;
4714 action = 0xdeadbee;
4715 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4716 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4717 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4718 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4719
4720 r = MsiDoAction( hpkg, "CostInitialize");
4721 ok( r == ERROR_SUCCESS, "cost init failed\n");
4722
4723 state = 0xdeadbee;
4724 action = 0xdeadbee;
4725 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4726 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4727 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4728 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4729
4730 state = 0xdeadbee;
4731 action = 0xdeadbee;
4732 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4733 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4734 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4735 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4736
4737 state = 0xdeadbee;
4738 action = 0xdeadbee;
4739 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4740 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4741 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4742 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4743
4744 state = 0xdeadbee;
4745 action = 0xdeadbee;
4746 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4747 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4748 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4749 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4750
4751 state = 0xdeadbee;
4752 action = 0xdeadbee;
4753 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4754 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4755 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4756 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4757
4758 state = 0xdeadbee;
4759 action = 0xdeadbee;
4760 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4761 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4762 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4763 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4764
4765 state = 0xdeadbee;
4766 action = 0xdeadbee;
4767 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4768 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4769 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4770 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4771
4772 state = 0xdeadbee;
4773 action = 0xdeadbee;
4774 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4775 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4776 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4777 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4778
4779 state = 0xdeadbee;
4780 action = 0xdeadbee;
4781 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4782 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4783 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4784 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4785
4786 state = 0xdeadbee;
4787 action = 0xdeadbee;
4788 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4789 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4790 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4791 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4792
4793 state = 0xdeadbee;
4794 action = 0xdeadbee;
4795 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4796 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4797 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4798 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4799
4800 state = 0xdeadbee;
4801 action = 0xdeadbee;
4802 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4803 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4804 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4805 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4806
4807 state = 0xdeadbee;
4808 action = 0xdeadbee;
4809 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4810 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4811 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4812 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4813
4814 state = 0xdeadbee;
4815 action = 0xdeadbee;
4816 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4817 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4818 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4819 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4820
4821 state = 0xdeadbee;
4822 action = 0xdeadbee;
4823 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4824 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4825 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4826 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4827
4828 state = 0xdeadbee;
4829 action = 0xdeadbee;
4830 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4831 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4832 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4833 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4834
4835 state = 0xdeadbee;
4836 action = 0xdeadbee;
4837 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4838 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4839 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4840 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4841
4842 state = 0xdeadbee;
4843 action = 0xdeadbee;
4844 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4845 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4846 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4847 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4848
4849 state = 0xdeadbee;
4850 action = 0xdeadbee;
4851 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4852 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4853 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4854 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4855
4856 state = 0xdeadbee;
4857 action = 0xdeadbee;
4858 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4859 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4860 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4861 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4862
4863 state = 0xdeadbee;
4864 action = 0xdeadbee;
4865 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4866 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4867 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4868 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4869
4870 state = 0xdeadbee;
4871 action = 0xdeadbee;
4872 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4873 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4874 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4875 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4876
4877 state = 0xdeadbee;
4878 action = 0xdeadbee;
4879 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4880 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4881 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4882 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4883
4884 state = 0xdeadbee;
4885 action = 0xdeadbee;
4886 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4887 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4888 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4889 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4890
4891 state = 0xdeadbee;
4892 action = 0xdeadbee;
4893 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4894 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4895 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4896 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4897
4898 state = 0xdeadbee;
4899 action = 0xdeadbee;
4900 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4901 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4902 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4903 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4904
4905 state = 0xdeadbee;
4906 action = 0xdeadbee;
4907 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4908 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4909 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4910 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4911
4912 state = 0xdeadbee;
4913 action = 0xdeadbee;
4914 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4915 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4916 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4917 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4918
4919 state = 0xdeadbee;
4920 action = 0xdeadbee;
4921 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4922 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4923 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4924 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4925
4926 state = 0xdeadbee;
4927 action = 0xdeadbee;
4928 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4929 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4930 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4931 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4932
4933 state = 0xdeadbee;
4934 action = 0xdeadbee;
4935 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4936 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4937 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4938 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4939
4940 r = MsiDoAction( hpkg, "FileCost");
4941 ok( r == ERROR_SUCCESS, "file cost failed\n");
4942
4943 state = 0xdeadbee;
4944 action = 0xdeadbee;
4945 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4946 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4947 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4948 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4949
4950 state = 0xdeadbee;
4951 action = 0xdeadbee;
4952 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4953 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4954 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4955 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4956
4957 state = 0xdeadbee;
4958 action = 0xdeadbee;
4959 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4960 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4961 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4962 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4963
4964 state = 0xdeadbee;
4965 action = 0xdeadbee;
4966 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4967 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4968 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4969 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4970
4971 state = 0xdeadbee;
4972 action = 0xdeadbee;
4973 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4974 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4975 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4976 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4977
4978 state = 0xdeadbee;
4979 action = 0xdeadbee;
4980 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4981 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4982 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4983 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4984
4985 state = 0xdeadbee;
4986 action = 0xdeadbee;
4987 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4988 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4989 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4990 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4991
4992 state = 0xdeadbee;
4993 action = 0xdeadbee;
4994 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4995 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4996 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4997 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4998
4999 state = 0xdeadbee;
5000 action = 0xdeadbee;
5001 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5002 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5003 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5004 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5005
5006 state = 0xdeadbee;
5007 action = 0xdeadbee;
5008 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5009 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5010 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5011 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5012
5013 state = 0xdeadbee;
5014 action = 0xdeadbee;
5015 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5016 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5017 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5018 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5019
5020 state = 0xdeadbee;
5021 action = 0xdeadbee;
5022 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5023 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5024 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5025 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5026
5027 state = 0xdeadbee;
5028 action = 0xdeadbee;
5029 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5030 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5031 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5032 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5033
5034 state = 0xdeadbee;
5035 action = 0xdeadbee;
5036 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5037 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5038 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5039 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5040
5041 state = 0xdeadbee;
5042 action = 0xdeadbee;
5043 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5044 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5045 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5046 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5047
5048 state = 0xdeadbee;
5049 action = 0xdeadbee;
5050 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5051 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5052 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5053 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5054
5055 state = 0xdeadbee;
5056 action = 0xdeadbee;
5057 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5058 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5059 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5060 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5061
5062 state = 0xdeadbee;
5063 action = 0xdeadbee;
5064 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5065 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5066 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5067 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5068
5069 state = 0xdeadbee;
5070 action = 0xdeadbee;
5071 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5072 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5073 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5074 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5075
5076 state = 0xdeadbee;
5077 action = 0xdeadbee;
5078 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5079 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5080 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5081 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5082
5083 state = 0xdeadbee;
5084 action = 0xdeadbee;
5085 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5086 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5087 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5088 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5089
5090 state = 0xdeadbee;
5091 action = 0xdeadbee;
5092 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5093 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5094 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5095 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5096
5097 state = 0xdeadbee;
5098 action = 0xdeadbee;
5099 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5100 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5101 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5102 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5103
5104 state = 0xdeadbee;
5105 action = 0xdeadbee;
5106 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5107 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5108 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5109 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5110
5111 state = 0xdeadbee;
5112 action = 0xdeadbee;
5113 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5114 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5115 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5116 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5117
5118 state = 0xdeadbee;
5119 action = 0xdeadbee;
5120 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5121 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5122 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5123 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5124
5125 state = 0xdeadbee;
5126 action = 0xdeadbee;
5127 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5128 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5129 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5130 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5131
5132 state = 0xdeadbee;
5133 action = 0xdeadbee;
5134 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5135 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5136 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5137 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5138
5139 state = 0xdeadbee;
5140 action = 0xdeadbee;
5141 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5142 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5143 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5144 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5145
5146 state = 0xdeadbee;
5147 action = 0xdeadbee;
5148 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5149 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5150 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5151 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5152
5153 state = 0xdeadbee;
5154 action = 0xdeadbee;
5155 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5156 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5157 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5158 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5159
5160 r = MsiDoAction( hpkg, "CostFinalize");
5161 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
5162
5163 state = 0xdeadbee;
5164 action = 0xdeadbee;
5165 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5166 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5167 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5168 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5169
5170 state = 0xdeadbee;
5171 action = 0xdeadbee;
5172 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5173 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5174 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5175 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5176
5177 state = 0xdeadbee;
5178 action = 0xdeadbee;
5179 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5180 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5181 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5182 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5183
5184 state = 0xdeadbee;
5185 action = 0xdeadbee;
5186 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5187 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5188 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5189 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5190
5191 state = 0xdeadbee;
5192 action = 0xdeadbee;
5193 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5194 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5195 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5196 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5197
5198 state = 0xdeadbee;
5199 action = 0xdeadbee;
5200 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5201 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5202 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5203 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5204
5205 state = 0xdeadbee;
5206 action = 0xdeadbee;
5207 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5208 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5209 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5210 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5211
5212 state = 0xdeadbee;
5213 action = 0xdeadbee;
5214 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5215 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5216 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5217 todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5218
5219 state = 0xdeadbee;
5220 action = 0xdeadbee;
5221 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5222 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5223 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5224 todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5225
5226 state = 0xdeadbee;
5227 action = 0xdeadbee;
5228 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5229 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5230 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5231 todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5232
5233 state = 0xdeadbee;
5234 action = 0xdeadbee;
5235 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5236 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5237 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5238 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5239
5240 state = 0xdeadbee;
5241 action = 0xdeadbee;
5242 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5243 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5244 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5245 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5246
5247 state = 0xdeadbee;
5248 action = 0xdeadbee;
5249 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5250 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5251 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5252 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5253
5254 state = 0xdeadbee;
5255 action = 0xdeadbee;
5256 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5257 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5258 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5259 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5260
5261 state = 0xdeadbee;
5262 action = 0xdeadbee;
5263 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5264 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5265 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5266 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5267
5268 state = 0xdeadbee;
5269 action = 0xdeadbee;
5270 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5271 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5272 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5273 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5274
5275 state = 0xdeadbee;
5276 action = 0xdeadbee;
5277 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5278 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5279 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5280 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5281
5282 state = 0xdeadbee;
5283 action = 0xdeadbee;
5284 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5285 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5286 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5287 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5288
5289 state = 0xdeadbee;
5290 action = 0xdeadbee;
5291 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5292 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5293 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5294 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5295
5296 state = 0xdeadbee;
5297 action = 0xdeadbee;
5298 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5299 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5300 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5301 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5302
5303 state = 0xdeadbee;
5304 action = 0xdeadbee;
5305 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5306 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5307 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5308 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5309
5310 state = 0xdeadbee;
5311 action = 0xdeadbee;
5312 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5313 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5314 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5315 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5316
5317 state = 0xdeadbee;
5318 action = 0xdeadbee;
5319 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5320 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5321 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5322 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5323
5324 state = 0xdeadbee;
5325 action = 0xdeadbee;
5326 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5327 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5328 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5329 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5330
5331 state = 0xdeadbee;
5332 action = 0xdeadbee;
5333 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5334 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5335 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5336 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5337
5338 state = 0xdeadbee;
5339 action = 0xdeadbee;
5340 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5341 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5342 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5343 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5344
5345 state = 0xdeadbee;
5346 action = 0xdeadbee;
5347 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5348 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5349 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5350 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5351
5352 state = 0xdeadbee;
5353 action = 0xdeadbee;
5354 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5355 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5356 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5357 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5358
5359 state = 0xdeadbee;
5360 action = 0xdeadbee;
5361 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5362 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5363 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5364 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5365
5366 state = 0xdeadbee;
5367 action = 0xdeadbee;
5368 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5369 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5370 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5371 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5372
5373 state = 0xdeadbee;
5374 action = 0xdeadbee;
5375 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5376 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5377 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5378 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5379
5380 MsiCloseHandle(hpkg);
5381
5382 /* uninstall the product */
5383 r = MsiInstallProduct(msifile2, "REMOVE=ALL");
5384 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5385
5386 /* all features installed from source */
5387 r = MsiInstallProduct(msifile3, "ADDSOURCE=ALL");
5388 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5389
5390 r = MsiOpenDatabase(msifile3, MSIDBOPEN_DIRECT, &hdb);
5391 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
5392
5393 /* this property must not be in the saved msi file */
5394 r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
5395 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
5396
5397 hpkg = package_from_db( hdb );
5398 ok( hpkg, "failed to create package\n");
5399
5400 state = 0xdeadbee;
5401 action = 0xdeadbee;
5402 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5403 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5404 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5405 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5406
5407 state = 0xdeadbee;
5408 action = 0xdeadbee;
5409 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5410 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5411 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5412 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5413
5414 state = 0xdeadbee;
5415 action = 0xdeadbee;
5416 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5417 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5418 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5419 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5420
5421 state = 0xdeadbee;
5422 action = 0xdeadbee;
5423 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5424 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5425 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5426 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5427
5428 state = 0xdeadbee;
5429 action = 0xdeadbee;
5430 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5431 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5432 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5433 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5434
5435 state = 0xdeadbee;
5436 action = 0xdeadbee;
5437 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5438 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5439 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5440 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5441
5442 state = 0xdeadbee;
5443 action = 0xdeadbee;
5444 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5445 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5446 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5447 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5448
5449 state = 0xdeadbee;
5450 action = 0xdeadbee;
5451 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5452 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5453 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5454 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5455
5456 state = 0xdeadbee;
5457 action = 0xdeadbee;
5458 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5459 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5460 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5461 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5462
5463 state = 0xdeadbee;
5464 action = 0xdeadbee;
5465 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5466 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5467 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5468 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5469
5470 state = 0xdeadbee;
5471 action = 0xdeadbee;
5472 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5473 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5474 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5475 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5476
5477 state = 0xdeadbee;
5478 action = 0xdeadbee;
5479 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5480 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5481 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5482 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5483
5484 state = 0xdeadbee;
5485 action = 0xdeadbee;
5486 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5487 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5488 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5489 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5490
5491 state = 0xdeadbee;
5492 action = 0xdeadbee;
5493 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5494 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5495 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5496 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5497
5498 state = 0xdeadbee;
5499 action = 0xdeadbee;
5500 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5501 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5502 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5503 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5504
5505 state = 0xdeadbee;
5506 action = 0xdeadbee;
5507 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5508 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5509 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5510 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5511
5512 state = 0xdeadbee;
5513 action = 0xdeadbee;
5514 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5515 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5516 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5517 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5518
5519 state = 0xdeadbee;
5520 action = 0xdeadbee;
5521 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5522 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5523 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5524 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5525
5526 state = 0xdeadbee;
5527 action = 0xdeadbee;
5528 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5529 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5530 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5531 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5532
5533 state = 0xdeadbee;
5534 action = 0xdeadbee;
5535 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5536 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5537 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5538 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5539
5540 state = 0xdeadbee;
5541 action = 0xdeadbee;
5542 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5543 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5544 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5545 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5546
5547 state = 0xdeadbee;
5548 action = 0xdeadbee;
5549 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5550 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5551 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5552 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5553
5554 state = 0xdeadbee;
5555 action = 0xdeadbee;
5556 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5557 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5558 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5559 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5560
5561 state = 0xdeadbee;
5562 action = 0xdeadbee;
5563 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5564 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5565 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5566 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5567
5568 state = 0xdeadbee;
5569 action = 0xdeadbee;
5570 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5571 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5572 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5573 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5574
5575 state = 0xdeadbee;
5576 action = 0xdeadbee;
5577 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5578 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5579 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5580 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5581
5582 state = 0xdeadbee;
5583 action = 0xdeadbee;
5584 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5585 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5586 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5587 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5588
5589 state = 0xdeadbee;
5590 action = 0xdeadbee;
5591 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5592 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5593 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5594 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5595
5596 state = 0xdeadbee;
5597 action = 0xdeadbee;
5598 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5599 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5600 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5601 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5602
5603 state = 0xdeadbee;
5604 action = 0xdeadbee;
5605 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5606 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5607 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5608 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5609
5610 state = 0xdeadbee;
5611 action = 0xdeadbee;
5612 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5613 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5614 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5615 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5616
5617 r = MsiDoAction( hpkg, "CostInitialize");
5618 ok( r == ERROR_SUCCESS, "cost init failed\n");
5619
5620 state = 0xdeadbee;
5621 action = 0xdeadbee;
5622 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5623 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5624 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5625 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5626
5627 state = 0xdeadbee;
5628 action = 0xdeadbee;
5629 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5630 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5631 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5632 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5633
5634 state = 0xdeadbee;
5635 action = 0xdeadbee;
5636 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5637 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5638 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5639 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5640
5641 state = 0xdeadbee;
5642 action = 0xdeadbee;
5643 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5644 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5645 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5646 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5647
5648 state = 0xdeadbee;
5649 action = 0xdeadbee;
5650 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5651 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5652 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5653 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5654
5655 state = 0xdeadbee;
5656 action = 0xdeadbee;
5657 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5658 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5659 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5660 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5661
5662 state = 0xdeadbee;
5663 action = 0xdeadbee;
5664 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5665 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5666 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5667 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5668
5669 state = 0xdeadbee;
5670 action = 0xdeadbee;
5671 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5672 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5673 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5674 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5675
5676 state = 0xdeadbee;
5677 action = 0xdeadbee;
5678 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5679 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5680 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5681 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5682
5683 state = 0xdeadbee;
5684 action = 0xdeadbee;
5685 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5686 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5687 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5688 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5689
5690 state = 0xdeadbee;
5691 action = 0xdeadbee;
5692 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5693 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5694 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5695 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5696
5697 state = 0xdeadbee;
5698 action = 0xdeadbee;
5699 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5700 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5701 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5702 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5703
5704 state = 0xdeadbee;
5705 action = 0xdeadbee;
5706 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5707 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5708 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5709 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5710
5711 state = 0xdeadbee;
5712 action = 0xdeadbee;
5713 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5714 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5715 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5716 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5717
5718 state = 0xdeadbee;
5719 action = 0xdeadbee;
5720 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5721 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5722 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5723 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5724
5725 state = 0xdeadbee;
5726 action = 0xdeadbee;
5727 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5728 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5729 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5730 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5731
5732 state = 0xdeadbee;
5733 action = 0xdeadbee;
5734 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5735 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5736 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5737 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5738
5739 state = 0xdeadbee;
5740 action = 0xdeadbee;
5741 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5742 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5743 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5744 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5745
5746 state = 0xdeadbee;
5747 action = 0xdeadbee;
5748 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5749 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5750 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5751 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5752
5753 state = 0xdeadbee;
5754 action = 0xdeadbee;
5755 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5756 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5757 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5758 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5759
5760 state = 0xdeadbee;
5761 action = 0xdeadbee;
5762 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5763 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5764 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5765 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5766
5767 state = 0xdeadbee;
5768 action = 0xdeadbee;
5769 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5770 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5771 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5772 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5773
5774 state = 0xdeadbee;
5775 action = 0xdeadbee;
5776 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5777 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5778 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5779 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5780
5781 state = 0xdeadbee;
5782 action = 0xdeadbee;
5783 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5784 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5785 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5786 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5787
5788 state = 0xdeadbee;
5789 action = 0xdeadbee;
5790 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5791 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5792 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5793 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5794
5795 state = 0xdeadbee;
5796 action = 0xdeadbee;
5797 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5798 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5799 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5800 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5801
5802 state = 0xdeadbee;
5803 action = 0xdeadbee;
5804 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5805 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5806 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5807 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5808
5809 state = 0xdeadbee;
5810 action = 0xdeadbee;
5811 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5812 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5813 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5814 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5815
5816 state = 0xdeadbee;
5817 action = 0xdeadbee;
5818 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5819 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5820 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5821 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5822
5823 state = 0xdeadbee;
5824 action = 0xdeadbee;
5825 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5826 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5827 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5828 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5829
5830 state = 0xdeadbee;
5831 action = 0xdeadbee;
5832 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5833 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5834 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5835 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5836
5837 r = MsiDoAction( hpkg, "FileCost");
5838 ok( r == ERROR_SUCCESS, "file cost failed\n");
5839
5840 state = 0xdeadbee;
5841 action = 0xdeadbee;
5842 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5843 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5844 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5845 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5846
5847 state = 0xdeadbee;
5848 action = 0xdeadbee;
5849 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5850 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5851 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5852 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5853
5854 state = 0xdeadbee;
5855 action = 0xdeadbee;
5856 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5857 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5858 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5859 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5860
5861 state = 0xdeadbee;
5862 action = 0xdeadbee;
5863 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5864 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5865 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5866 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5867
5868 state = 0xdeadbee;
5869 action = 0xdeadbee;
5870 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5871 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5872 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5873 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5874
5875 state = 0xdeadbee;
5876 action = 0xdeadbee;
5877 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5878 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5879 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5880 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5881
5882 state = 0xdeadbee;
5883 action = 0xdeadbee;
5884 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5885 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5886 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5887 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5888
5889 state = 0xdeadbee;
5890 action = 0xdeadbee;
5891 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5892 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5893 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5894 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5895
5896 state = 0xdeadbee;
5897 action = 0xdeadbee;
5898 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5899 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5900 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5901 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5902
5903 state = 0xdeadbee;
5904 action = 0xdeadbee;
5905 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5906 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5907 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5908 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5909
5910 state = 0xdeadbee;
5911 action = 0xdeadbee;
5912 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5913 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5914 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5915 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5916
5917 state = 0xdeadbee;
5918 action = 0xdeadbee;
5919 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5920 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5921 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5922 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5923
5924 state = 0xdeadbee;
5925 action = 0xdeadbee;
5926 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5927 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5928 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5929 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5930
5931 state = 0xdeadbee;
5932 action = 0xdeadbee;
5933 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5934 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5935 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5936 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5937
5938 state = 0xdeadbee;
5939 action = 0xdeadbee;
5940 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5941 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5942 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5943 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5944
5945 state = 0xdeadbee;
5946 action = 0xdeadbee;
5947 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5948 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5949 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5950 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5951
5952 state = 0xdeadbee;
5953 action = 0xdeadbee;
5954 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5955 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5956 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5957 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5958
5959 state = 0xdeadbee;
5960 action = 0xdeadbee;
5961 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5962 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5963 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5964 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5965
5966 state = 0xdeadbee;
5967 action = 0xdeadbee;
5968 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5969 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5970 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5971 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5972
5973 state = 0xdeadbee;
5974 action = 0xdeadbee;
5975 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5976 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5977 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5978 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5979
5980 state = 0xdeadbee;
5981 action = 0xdeadbee;
5982 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5983 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5984 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5985 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5986
5987 state = 0xdeadbee;
5988 action = 0xdeadbee;
5989 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5990 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5991 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5992 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5993
5994 state = 0xdeadbee;
5995 action = 0xdeadbee;
5996 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5997 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5998 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5999 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6000
6001 state = 0xdeadbee;
6002 action = 0xdeadbee;
6003 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6004 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6005 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6006 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6007
6008 state = 0xdeadbee;
6009 action = 0xdeadbee;
6010 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6011 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6012 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6013 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6014
6015 state = 0xdeadbee;
6016 action = 0xdeadbee;
6017 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6018 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6019 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6020 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6021
6022 state = 0xdeadbee;
6023 action = 0xdeadbee;
6024 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6025 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6026 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6027 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6028
6029 state = 0xdeadbee;
6030 action = 0xdeadbee;
6031 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6032 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6033 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6034 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6035
6036 state = 0xdeadbee;
6037 action = 0xdeadbee;
6038 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6039 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6040 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6041 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6042
6043 state = 0xdeadbee;
6044 action = 0xdeadbee;
6045 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6046 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6047 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6048 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6049
6050 state = 0xdeadbee;
6051 action = 0xdeadbee;
6052 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6053 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6054 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6055 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6056
6057 r = MsiDoAction( hpkg, "CostFinalize");
6058 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
6059
6060 state = 0xdeadbee;
6061 action = 0xdeadbee;
6062 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6063 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6064 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6065 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6066
6067 state = 0xdeadbee;
6068 action = 0xdeadbee;
6069 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6070 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6071 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6072 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6073
6074 state = 0xdeadbee;
6075 action = 0xdeadbee;
6076 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6077 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6078 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6079 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6080
6081 state = 0xdeadbee;
6082 action = 0xdeadbee;
6083 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6084 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6085 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6086 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6087
6088 state = 0xdeadbee;
6089 action = 0xdeadbee;
6090 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6091 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6092 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6093 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6094
6095 state = 0xdeadbee;
6096 action = 0xdeadbee;
6097 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6098 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6099 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6100 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6101
6102 state = 0xdeadbee;
6103 action = 0xdeadbee;
6104 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6105 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6106 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6107 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6108
6109 state = 0xdeadbee;
6110 action = 0xdeadbee;
6111 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6112 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6113 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6114 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6115
6116 state = 0xdeadbee;
6117 action = 0xdeadbee;
6118 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6119 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6120 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6121 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6122
6123 state = 0xdeadbee;
6124 action = 0xdeadbee;
6125 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6126 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6127 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6128 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6129
6130 state = 0xdeadbee;
6131 action = 0xdeadbee;
6132 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6133 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6134 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6135 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6136
6137 state = 0xdeadbee;
6138 action = 0xdeadbee;
6139 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6140 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6141 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6142 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6143
6144 state = 0xdeadbee;
6145 action = 0xdeadbee;
6146 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6147 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6148 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6149 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6150
6151 state = 0xdeadbee;
6152 action = 0xdeadbee;
6153 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6154 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6155 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6156 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6157
6158 state = 0xdeadbee;
6159 action = 0xdeadbee;
6160 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6161 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6162 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6163 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6164
6165 state = 0xdeadbee;
6166 action = 0xdeadbee;
6167 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6168 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6169 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6170 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6171
6172 state = 0xdeadbee;
6173 action = 0xdeadbee;
6174 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6175 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6176 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6177 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6178
6179 state = 0xdeadbee;
6180 action = 0xdeadbee;
6181 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6182 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6183 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6184 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6185
6186 state = 0xdeadbee;
6187 action = 0xdeadbee;
6188 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6189 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6190 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6191 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6192
6193 state = 0xdeadbee;
6194 action = 0xdeadbee;
6195 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6196 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6197 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6198 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6199
6200 state = 0xdeadbee;
6201 action = 0xdeadbee;
6202 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6203 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6204 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6205 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6206
6207 state = 0xdeadbee;
6208 action = 0xdeadbee;
6209 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6210 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6211 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6212 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6213
6214 state = 0xdeadbee;
6215 action = 0xdeadbee;
6216 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6217 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6218 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6219 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6220
6221 state = 0xdeadbee;
6222 action = 0xdeadbee;
6223 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6224 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6225 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6226 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6227
6228 state = 0xdeadbee;
6229 action = 0xdeadbee;
6230 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6231 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6232 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6233 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6234
6235 state = 0xdeadbee;
6236 action = 0xdeadbee;
6237 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6238 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6239 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6240 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6241
6242 state = 0xdeadbee;
6243 action = 0xdeadbee;
6244 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6245 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6246 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6247 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6248
6249 state = 0xdeadbee;
6250 action = 0xdeadbee;
6251 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6252 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6253 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6254 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6255
6256 state = 0xdeadbee;
6257 action = 0xdeadbee;
6258 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6259 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6260 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6261 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6262
6263 state = 0xdeadbee;
6264 action = 0xdeadbee;
6265 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6266 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6267 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6268 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6269
6270 state = 0xdeadbee;
6271 action = 0xdeadbee;
6272 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6273 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6274 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6275 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6276
6277 MsiCloseHandle(hpkg);
6278
6279 /* reinstall the product */
6280 r = MsiInstallProduct(msifile3, "REINSTALL=ALL");
6281 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6282
6283 r = MsiOpenDatabase(msifile4, MSIDBOPEN_DIRECT, &hdb);
6284 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
6285
6286 /* this property must not be in the saved msi file */
6287 r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
6288 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
6289
6290 hpkg = package_from_db( hdb );
6291 ok( hpkg, "failed to create package\n");
6292
6293 state = 0xdeadbee;
6294 action = 0xdeadbee;
6295 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6296 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6297 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6298 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6299
6300 state = 0xdeadbee;
6301 action = 0xdeadbee;
6302 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6303 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6304 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6305 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6306
6307 state = 0xdeadbee;
6308 action = 0xdeadbee;
6309 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6310 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6311 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6312 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6313
6314 state = 0xdeadbee;
6315 action = 0xdeadbee;
6316 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6317 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6318 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6319 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6320
6321 state = 0xdeadbee;
6322 action = 0xdeadbee;
6323 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6324 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6325 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6326 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6327
6328 state = 0xdeadbee;
6329 action = 0xdeadbee;
6330 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6331 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6332 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6333 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6334
6335 state = 0xdeadbee;
6336 action = 0xdeadbee;
6337 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6338 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6339 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6340 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6341
6342 state = 0xdeadbee;
6343 action = 0xdeadbee;
6344 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6345 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6346 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6347 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6348
6349 state = 0xdeadbee;
6350 action = 0xdeadbee;
6351 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6352 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6353 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6354 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6355
6356 state = 0xdeadbee;
6357 action = 0xdeadbee;
6358 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6359 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6360 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6361 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6362
6363 state = 0xdeadbee;
6364 action = 0xdeadbee;
6365 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6366 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6367 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6368 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6369
6370 state = 0xdeadbee;
6371 action = 0xdeadbee;
6372 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6373 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6374 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6375 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6376
6377 state = 0xdeadbee;
6378 action = 0xdeadbee;
6379 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6380 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6381 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6382 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6383
6384 state = 0xdeadbee;
6385 action = 0xdeadbee;
6386 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6387 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6388 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6389 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6390
6391 state = 0xdeadbee;
6392 action = 0xdeadbee;
6393 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6394 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6395 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6396 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6397
6398 state = 0xdeadbee;
6399 action = 0xdeadbee;
6400 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6401 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6402 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6403 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6404
6405 state = 0xdeadbee;
6406 action = 0xdeadbee;
6407 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6408 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6409 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6410 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6411
6412 state = 0xdeadbee;
6413 action = 0xdeadbee;
6414 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6415 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6416 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6417 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6418
6419 state = 0xdeadbee;
6420 action = 0xdeadbee;
6421 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6422 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6423 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6424 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6425
6426 state = 0xdeadbee;
6427 action = 0xdeadbee;
6428 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6429 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6430 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6431 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6432
6433 state = 0xdeadbee;
6434 action = 0xdeadbee;
6435 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6436 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6437 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6438 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6439
6440 state = 0xdeadbee;
6441 action = 0xdeadbee;
6442 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6443 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6444 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6445 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6446
6447 state = 0xdeadbee;
6448 action = 0xdeadbee;
6449 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6450 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6451 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6452 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6453
6454 state = 0xdeadbee;
6455 action = 0xdeadbee;
6456 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6457 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6458 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6459 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6460
6461 state = 0xdeadbee;
6462 action = 0xdeadbee;
6463 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6464 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6465 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6466 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6467
6468 state = 0xdeadbee;
6469 action = 0xdeadbee;
6470 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6471 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6472 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6473 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6474
6475 state = 0xdeadbee;
6476 action = 0xdeadbee;
6477 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6478 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6479 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6480 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6481
6482 state = 0xdeadbee;
6483 action = 0xdeadbee;
6484 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6485 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6486 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6487 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6488
6489 state = 0xdeadbee;
6490 action = 0xdeadbee;
6491 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6492 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6493 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6494 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6495
6496 state = 0xdeadbee;
6497 action = 0xdeadbee;
6498 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6499 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6500 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6501 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6502
6503 state = 0xdeadbee;
6504 action = 0xdeadbee;
6505 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6506 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6507 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6508 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6509
6510 r = MsiDoAction( hpkg, "CostInitialize");
6511 ok( r == ERROR_SUCCESS, "cost init failed\n");
6512
6513 state = 0xdeadbee;
6514 action = 0xdeadbee;
6515 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6516 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6517 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6518 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6519
6520 state = 0xdeadbee;
6521 action = 0xdeadbee;
6522 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6523 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6524 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6525 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6526
6527 state = 0xdeadbee;
6528 action = 0xdeadbee;
6529 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6530 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6531 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6532 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6533
6534 state = 0xdeadbee;
6535 action = 0xdeadbee;
6536 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6537 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6538 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6539 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6540
6541 state = 0xdeadbee;
6542 action = 0xdeadbee;
6543 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6544 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6545 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6546 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6547
6548 state = 0xdeadbee;
6549 action = 0xdeadbee;
6550 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6551 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6552 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6553 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6554
6555 state = 0xdeadbee;
6556 action = 0xdeadbee;
6557 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6558 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6559 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6560 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6561
6562 state = 0xdeadbee;
6563 action = 0xdeadbee;
6564 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6565 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6566 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6567 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6568
6569 state = 0xdeadbee;
6570 action = 0xdeadbee;
6571 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6572 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6573 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6574 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6575
6576 state = 0xdeadbee;
6577 action = 0xdeadbee;
6578 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6579 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6580 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6581 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6582
6583 state = 0xdeadbee;
6584 action = 0xdeadbee;
6585 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6586 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6587 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6588 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6589
6590 state = 0xdeadbee;
6591 action = 0xdeadbee;
6592 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6593 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6594 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6595 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6596
6597 state = 0xdeadbee;
6598 action = 0xdeadbee;
6599 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6600 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6601 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6602 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6603
6604 state = 0xdeadbee;
6605 action = 0xdeadbee;
6606 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6607 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6608 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6609 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6610
6611 state = 0xdeadbee;
6612 action = 0xdeadbee;
6613 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6614 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6615 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6616 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6617
6618 state = 0xdeadbee;
6619 action = 0xdeadbee;
6620 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6621 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6622 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6623 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6624
6625 state = 0xdeadbee;
6626 action = 0xdeadbee;
6627 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6628 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6629 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6630 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6631
6632 state = 0xdeadbee;
6633 action = 0xdeadbee;
6634 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6635 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6636 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6637 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6638
6639 state = 0xdeadbee;
6640 action = 0xdeadbee;
6641 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6642 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6643 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6644 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6645
6646 state = 0xdeadbee;
6647 action = 0xdeadbee;
6648 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6649 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6650 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6651 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6652
6653 state = 0xdeadbee;
6654 action = 0xdeadbee;
6655 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6656 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6657 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6658 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6659
6660 state = 0xdeadbee;
6661 action = 0xdeadbee;
6662 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6663 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6664 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6665 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6666
6667 state = 0xdeadbee;
6668 action = 0xdeadbee;
6669 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6670 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6671 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6672 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6673
6674 state = 0xdeadbee;
6675 action = 0xdeadbee;
6676 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6677 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6678 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6679 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6680
6681 state = 0xdeadbee;
6682 action = 0xdeadbee;
6683 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6684 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6685 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6686 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6687
6688 state = 0xdeadbee;
6689 action = 0xdeadbee;
6690 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6691 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6692 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6693 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6694
6695 state = 0xdeadbee;
6696 action = 0xdeadbee;
6697 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6698 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6699 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6700 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6701
6702 state = 0xdeadbee;
6703 action = 0xdeadbee;
6704 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6705 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6706 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6707 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6708
6709 state = 0xdeadbee;
6710 action = 0xdeadbee;
6711 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6712 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6713 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6714 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6715
6716 state = 0xdeadbee;
6717 action = 0xdeadbee;
6718 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6719 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6720 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6721 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6722
6723 state = 0xdeadbee;
6724 action = 0xdeadbee;
6725 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6726 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6727 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6728 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6729
6730 r = MsiDoAction( hpkg, "FileCost");
6731 ok( r == ERROR_SUCCESS, "file cost failed\n");
6732
6733 state = 0xdeadbee;
6734 action = 0xdeadbee;
6735 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6736 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6737 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6738 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6739
6740 state = 0xdeadbee;
6741 action = 0xdeadbee;
6742 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6743 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6744 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6745 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6746
6747 state = 0xdeadbee;
6748 action = 0xdeadbee;
6749 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6750 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6751 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6752 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6753
6754 state = 0xdeadbee;
6755 action = 0xdeadbee;
6756 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6757 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6758 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6759 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6760
6761 state = 0xdeadbee;
6762 action = 0xdeadbee;
6763 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6764 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6765 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6766 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6767
6768 state = 0xdeadbee;
6769 action = 0xdeadbee;
6770 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6771 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6772 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6773 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6774
6775 state = 0xdeadbee;
6776 action = 0xdeadbee;
6777 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6778 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6779 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6780 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6781
6782 state = 0xdeadbee;
6783 action = 0xdeadbee;
6784 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6785 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6786 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6787 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6788
6789 state = 0xdeadbee;
6790 action = 0xdeadbee;
6791 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6792 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6793 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6794 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6795
6796 state = 0xdeadbee;
6797 action = 0xdeadbee;
6798 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6799 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6800 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6801 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6802
6803 state = 0xdeadbee;
6804 action = 0xdeadbee;
6805 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6806 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6807 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6808 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6809
6810 state = 0xdeadbee;
6811 action = 0xdeadbee;
6812 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6813 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6814 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6815 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6816
6817 state = 0xdeadbee;
6818 action = 0xdeadbee;
6819 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6820 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6821 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6822 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6823
6824 state = 0xdeadbee;
6825 action = 0xdeadbee;
6826 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6827 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6828 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6829 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6830
6831 state = 0xdeadbee;
6832 action = 0xdeadbee;
6833 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6834 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6835 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6836 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6837
6838 state = 0xdeadbee;
6839 action = 0xdeadbee;
6840 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6841 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6842 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6843 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6844
6845 state = 0xdeadbee;
6846 action = 0xdeadbee;
6847 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6848 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6849 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6850 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6851
6852 state = 0xdeadbee;
6853 action = 0xdeadbee;
6854 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6855 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6856 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6857 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6858
6859 state = 0xdeadbee;
6860 action = 0xdeadbee;
6861 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6862 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6863 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6864 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6865
6866 state = 0xdeadbee;
6867 action = 0xdeadbee;
6868 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6869 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6870 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6871 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6872
6873 state = 0xdeadbee;
6874 action = 0xdeadbee;
6875 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6876 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6877 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6878 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6879
6880 state = 0xdeadbee;
6881 action = 0xdeadbee;
6882 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6883 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6884 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6885 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6886
6887 state = 0xdeadbee;
6888 action = 0xdeadbee;
6889 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6890 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6891 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6892 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6893
6894 state = 0xdeadbee;
6895 action = 0xdeadbee;
6896 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6897 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6898 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6899 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6900
6901 state = 0xdeadbee;
6902 action = 0xdeadbee;
6903 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6904 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6905 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6906 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6907
6908 state = 0xdeadbee;
6909 action = 0xdeadbee;
6910 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6911 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6912 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6913 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6914
6915 state = 0xdeadbee;
6916 action = 0xdeadbee;
6917 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6918 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6919 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6920 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6921
6922 state = 0xdeadbee;
6923 action = 0xdeadbee;
6924 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6925 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6926 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6927 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6928
6929 state = 0xdeadbee;
6930 action = 0xdeadbee;
6931 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6932 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6933 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6934 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6935
6936 state = 0xdeadbee;
6937 action = 0xdeadbee;
6938 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6939 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6940 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6941 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6942
6943 state = 0xdeadbee;
6944 action = 0xdeadbee;
6945 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6946 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6947 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6948 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6949
6950 r = MsiDoAction( hpkg, "CostFinalize");
6951 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
6952
6953 state = 0xdeadbee;
6954 action = 0xdeadbee;
6955 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6956 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6957 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6958 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6959
6960 state = 0xdeadbee;
6961 action = 0xdeadbee;
6962 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6963 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6964 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6965 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6966
6967 state = 0xdeadbee;
6968 action = 0xdeadbee;
6969 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6970 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6971 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6972 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6973
6974 state = 0xdeadbee;
6975 action = 0xdeadbee;
6976 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6977 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6978 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6979 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6980
6981 state = 0xdeadbee;
6982 action = 0xdeadbee;
6983 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6984 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6985 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6986 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6987
6988 state = 0xdeadbee;
6989 action = 0xdeadbee;
6990 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6991 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6992 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6993 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
6994
6995 state = 0xdeadbee;
6996 action = 0xdeadbee;
6997 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6998 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6999 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7000 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7001
7002 state = 0xdeadbee;
7003 action = 0xdeadbee;
7004 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
7005 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7006 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7007 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7008
7009 state = 0xdeadbee;
7010 action = 0xdeadbee;
7011 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
7012 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7013 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7014 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7015
7016 state = 0xdeadbee;
7017 action = 0xdeadbee;
7018 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
7019 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7020 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7021 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7022
7023 state = 0xdeadbee;
7024 action = 0xdeadbee;
7025 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
7026 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7027 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7028 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7029
7030 state = 0xdeadbee;
7031 action = 0xdeadbee;
7032 r = MsiGetComponentState(hpkg, "beta", &state, &action);
7033 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7034 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7035 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7036
7037 state = 0xdeadbee;
7038 action = 0xdeadbee;
7039 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
7040 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7041 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7042 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7043
7044 state = 0xdeadbee;
7045 action = 0xdeadbee;
7046 r = MsiGetComponentState(hpkg, "theta", &state, &action);
7047 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7048 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7049 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7050
7051 state = 0xdeadbee;
7052 action = 0xdeadbee;
7053 r = MsiGetComponentState(hpkg, "delta", &state, &action);
7054 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7055 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7056 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7057
7058 state = 0xdeadbee;
7059 action = 0xdeadbee;
7060 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
7061 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7062 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7063 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7064
7065 state = 0xdeadbee;
7066 action = 0xdeadbee;
7067 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
7068 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7069 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7070 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7071
7072 state = 0xdeadbee;
7073 action = 0xdeadbee;
7074 r = MsiGetComponentState(hpkg, "iota", &state, &action);
7075 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7076 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7077 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7078
7079 state = 0xdeadbee;
7080 action = 0xdeadbee;
7081 r = MsiGetComponentState(hpkg, "eta", &state, &action);
7082 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7083 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7084 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7085
7086 state = 0xdeadbee;
7087 action = 0xdeadbee;
7088 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
7089 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7090 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7091 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7092
7093 state = 0xdeadbee;
7094 action = 0xdeadbee;
7095 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
7096 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7097 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7098 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7099
7100 state = 0xdeadbee;
7101 action = 0xdeadbee;
7102 r = MsiGetComponentState(hpkg, "mu", &state, &action);
7103 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7104 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7105 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7106
7107 state = 0xdeadbee;
7108 action = 0xdeadbee;
7109 r = MsiGetComponentState(hpkg, "nu", &state, &action);
7110 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7111 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7112 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7113
7114 state = 0xdeadbee;
7115 action = 0xdeadbee;
7116 r = MsiGetComponentState(hpkg, "xi", &state, &action);
7117 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7118 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7119 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7120
7121 state = 0xdeadbee;
7122 action = 0xdeadbee;
7123 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
7124 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7125 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7126 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7127
7128 state = 0xdeadbee;
7129 action = 0xdeadbee;
7130 r = MsiGetComponentState(hpkg, "pi", &state, &action);
7131 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7132 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7133 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7134
7135 state = 0xdeadbee;
7136 action = 0xdeadbee;
7137 r = MsiGetComponentState(hpkg, "rho", &state, &action);
7138 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7139 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7140 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7141
7142 state = 0xdeadbee;
7143 action = 0xdeadbee;
7144 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
7145 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7146 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7147 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7148
7149 state = 0xdeadbee;
7150 action = 0xdeadbee;
7151 r = MsiGetComponentState(hpkg, "tau", &state, &action);
7152 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7153 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7154 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7155
7156 state = 0xdeadbee;
7157 action = 0xdeadbee;
7158 r = MsiGetComponentState(hpkg, "phi", &state, &action);
7159 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7160 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7161 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7162
7163 state = 0xdeadbee;
7164 action = 0xdeadbee;
7165 r = MsiGetComponentState(hpkg, "chi", &state, &action);
7166 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7167 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7168 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7169
7170 MsiCloseHandle(hpkg);
7171
7172 /* uninstall the product */
7173 r = MsiInstallProduct(msifile4, "REMOVE=ALL");
7174 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7175
7176 DeleteFileA(msifile);
7177 DeleteFileA(msifile2);
7178 DeleteFileA(msifile3);
7179 DeleteFileA(msifile4);
7180 }
7181
7182 static void test_getproperty(void)
7183 {
7184 MSIHANDLE hPackage = 0;
7185 char prop[100];
7186 static CHAR empty[] = "";
7187 DWORD size;
7188 UINT r;
7189
7190 hPackage = package_from_db(create_package_db());
7191 ok( hPackage != 0, " Failed to create package\n");
7192
7193 /* set the property */
7194 r = MsiSetProperty(hPackage, "Name", "Value");
7195 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7196
7197 /* retrieve the size, NULL pointer */
7198 size = 0;
7199 r = MsiGetProperty(hPackage, "Name", NULL, &size);
7200 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7201 ok( size == 5, "Expected 5, got %d\n", size);
7202
7203 /* retrieve the size, empty string */
7204 size = 0;
7205 r = MsiGetProperty(hPackage, "Name", empty, &size);
7206 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7207 ok( size == 5, "Expected 5, got %d\n", size);
7208
7209 /* don't change size */
7210 r = MsiGetProperty(hPackage, "Name", prop, &size);
7211 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7212 ok( size == 5, "Expected 5, got %d\n", size);
7213 ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
7214
7215 /* increase the size by 1 */
7216 size++;
7217 r = MsiGetProperty(hPackage, "Name", prop, &size);
7218 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7219 ok( size == 5, "Expected 5, got %d\n", size);
7220 ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
7221
7222 r = MsiCloseHandle( hPackage);
7223 ok( r == ERROR_SUCCESS , "Failed to close package\n" );
7224 DeleteFile(msifile);
7225 }
7226
7227 static void test_removefiles(void)
7228 {
7229 MSIHANDLE hpkg;
7230 UINT r;
7231 MSIHANDLE hdb;
7232
7233 hdb = create_package_db();
7234 ok ( hdb, "failed to create package database\n" );
7235
7236 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
7237 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
7238
7239 r = create_feature_table( hdb );
7240 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
7241
7242 r = create_component_table( hdb );
7243 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
7244
7245 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
7246 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7247
7248 r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
7249 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7250
7251 r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
7252 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7253
7254 r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
7255 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7256
7257 r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
7258 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7259
7260 r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
7261 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7262
7263 r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
7264 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7265
7266 r = create_feature_components_table( hdb );
7267 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
7268
7269 r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
7270 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7271
7272 r = add_feature_components_entry( hdb, "'one', 'helium'" );
7273 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7274
7275 r = add_feature_components_entry( hdb, "'one', 'lithium'" );
7276 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7277
7278 r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
7279 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7280
7281 r = add_feature_components_entry( hdb, "'one', 'boron'" );
7282 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7283
7284 r = add_feature_components_entry( hdb, "'one', 'carbon'" );
7285 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7286
7287 r = create_file_table( hdb );
7288 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
7289
7290 r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
7291 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7292
7293 r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
7294 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7295
7296 r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
7297 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7298
7299 r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
7300 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7301
7302 r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
7303 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7304
7305 r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
7306 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7307
7308 r = create_remove_file_table( hdb );
7309 ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
7310
7311 hpkg = package_from_db( hdb );
7312 ok( hpkg, "failed to create package\n");
7313
7314 MsiCloseHandle( hdb );
7315
7316 create_test_file( "hydrogen.txt" );
7317 create_test_file( "helium.txt" );
7318 create_test_file( "lithium.txt" );
7319 create_test_file( "beryllium.txt" );
7320 create_test_file( "boron.txt" );
7321 create_test_file( "carbon.txt" );
7322
7323 r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
7324 ok( r == ERROR_SUCCESS, "set property failed\n");
7325
7326 r = MsiDoAction( hpkg, "CostInitialize");
7327 ok( r == ERROR_SUCCESS, "cost init failed\n");
7328
7329 r = MsiDoAction( hpkg, "FileCost");
7330 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7331
7332 r = MsiDoAction( hpkg, "CostFinalize");
7333 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7334
7335 r = MsiDoAction( hpkg, "InstallValidate");
7336 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7337
7338 r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
7339 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7340
7341 r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
7342 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7343
7344 r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
7345 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7346
7347 r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
7348 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7349
7350 r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
7351 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7352
7353 r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
7354 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7355
7356 r = MsiDoAction( hpkg, "RemoveFiles");
7357 ok( r == ERROR_SUCCESS, "remove files failed\n");
7358
7359 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
7360 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
7361 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
7362 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
7363 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
7364 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
7365
7366 MsiCloseHandle( hpkg );
7367 DeleteFileA(msifile);
7368 }
7369
7370 static void test_appsearch(void)
7371 {
7372 MSIHANDLE hpkg;
7373 UINT r;
7374 MSIHANDLE hdb;
7375 CHAR prop[MAX_PATH];
7376 DWORD size = MAX_PATH;
7377
7378 hdb = create_package_db();
7379 ok ( hdb, "failed to create package database\n" );
7380
7381 r = create_appsearch_table( hdb );
7382 ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
7383
7384 r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
7385 ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
7386
7387 r = create_reglocator_table( hdb );
7388 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7389
7390 r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
7391 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7392
7393 r = create_signature_table( hdb );
7394 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
7395
7396 r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
7397 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
7398
7399 hpkg = package_from_db( hdb );
7400 ok( hpkg, "failed to create package\n");
7401
7402 MsiCloseHandle( hdb );
7403
7404 r = MsiDoAction( hpkg, "AppSearch" );
7405 ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
7406
7407 r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
7408 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
7409 todo_wine
7410 {
7411 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
7412 }
7413
7414 MsiCloseHandle( hpkg );
7415 DeleteFileA(msifile);
7416 }
7417
7418 static void test_appsearch_complocator(void)
7419 {
7420 MSIHANDLE hpkg, hdb;
7421 CHAR path[MAX_PATH];
7422 CHAR prop[MAX_PATH];
7423 LPSTR usersid;
7424 DWORD size;
7425 UINT r;
7426
7427 if (!get_user_sid(&usersid))
7428 return;
7429
7430 create_test_file("FileName1");
7431 create_test_file("FileName4");
7432 set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE,
7433 "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
7434
7435 create_test_file("FileName2");
7436 set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED,
7437 "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
7438
7439 create_test_file("FileName3");
7440 set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED,
7441 "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
7442
7443 create_test_file("FileName5");
7444 set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE,
7445 "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
7446
7447 create_test_file("FileName6");
7448 set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE,
7449 "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
7450
7451 create_test_file("FileName7");
7452 set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE,
7453 "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
7454
7455 /* dir is FALSE, but we're pretending it's a directory */
7456 set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE,
7457 "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
7458
7459 create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7460 set_component_path("FileName8.dll", MSIINSTALLCONTEXT_MACHINE,
7461 "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
7462
7463 create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
7464 set_component_path("FileName9.dll", MSIINSTALLCONTEXT_MACHINE,
7465 "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
7466
7467 create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7468 set_component_path("FileName10.dll", MSIINSTALLCONTEXT_MACHINE,
7469 "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
7470
7471 hdb = create_package_db();
7472 ok(hdb, "Expected a valid database handle\n");
7473
7474 r = create_appsearch_table(hdb);
7475 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7476
7477 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
7478 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7479
7480 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
7481 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7482
7483 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
7484 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7485
7486 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
7487 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7488
7489 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
7490 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7491
7492 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
7493 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7494
7495 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
7496 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7497
7498 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
7499 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7500
7501 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
7502 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7503
7504 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
7505 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7506
7507 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
7508 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7509
7510 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
7511 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7512
7513 r = create_complocator_table(hdb);
7514 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7515
7516 /* published component, machine, file, signature, misdbLocatorTypeFile */
7517 r = add_complocator_entry(hdb, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
7518 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7519
7520 /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
7521 r = add_complocator_entry(hdb, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
7522 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7523
7524 /* published component, user-managed, file, signature, misdbLocatorTypeFile */
7525 r = add_complocator_entry(hdb, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
7526 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7527
7528 /* published component, machine, file, signature, misdbLocatorTypeDirectory */
7529 r = add_complocator_entry(hdb, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
7530 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7531
7532 /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
7533 r = add_complocator_entry(hdb, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
7534 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7535
7536 /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
7537 r = add_complocator_entry(hdb, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
7538 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7539
7540 /* published component, machine, file, no signature, misdbLocatorTypeFile */
7541 r = add_complocator_entry(hdb, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
7542 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7543
7544 /* unpublished component, no signature, misdbLocatorTypeDir */
7545 r = add_complocator_entry(hdb, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
7546 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7547
7548 /* published component, no signature, dir does not exist misdbLocatorTypeDir */
7549 r = add_complocator_entry(hdb, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
7550 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7551
7552 /* published component, signature w/ ver, misdbLocatorTypeFile */
7553 r = add_complocator_entry(hdb, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
7554 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7555
7556 /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
7557 r = add_complocator_entry(hdb, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
7558 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7559
7560 /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
7561 r = add_complocator_entry(hdb, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
7562 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7563
7564 r = create_signature_table(hdb);
7565 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7566
7567 r = add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
7568 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7569
7570 r = add_signature_entry(hdb, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
7571 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7572
7573 r = add_signature_entry(hdb, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
7574 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7575
7576 r = add_signature_entry(hdb, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
7577 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7578
7579 r = add_signature_entry(hdb, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
7580 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7581
7582 r = add_signature_entry(hdb, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7583 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7584
7585 r = add_signature_entry(hdb, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7586 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7587
7588 r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7589 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7590
7591 hpkg = package_from_db(hdb);
7592 ok(hpkg, "Expected a valid package handle\n");
7593
7594 r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
7595 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7596
7597 r = MsiDoAction(hpkg, "AppSearch");
7598 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7599
7600 size = MAX_PATH;
7601 sprintf(path, "%s\\FileName1", CURR_DIR);
7602 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
7603 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7604 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7605
7606 size = MAX_PATH;
7607 sprintf(path, "%s\\FileName2", CURR_DIR);
7608 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
7609 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7610 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7611
7612 size = MAX_PATH;
7613 sprintf(path, "%s\\FileName3", CURR_DIR);
7614 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
7615 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7616 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7617
7618 size = MAX_PATH;
7619 sprintf(path, "%s\\FileName4", CURR_DIR);
7620 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
7621 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7622 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7623
7624 size = MAX_PATH;
7625 sprintf(path, "%s\\FileName5", CURR_DIR);
7626 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
7627 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7628 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7629
7630 size = MAX_PATH;
7631 sprintf(path, "%s\\", CURR_DIR);
7632 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
7633 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7634 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7635
7636 size = MAX_PATH;
7637 sprintf(path, "%s\\", CURR_DIR);
7638 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
7639 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7640 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7641
7642 size = MAX_PATH;
7643 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
7644 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7645 ok(!lstrcmpA(prop, "october"), "Expected \"october\", got \"%s\"\n", prop);
7646
7647 size = MAX_PATH;
7648 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
7649 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7650 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7651
7652 size = MAX_PATH;
7653 sprintf(path, "%s\\FileName8.dll", CURR_DIR);
7654 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
7655 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7656 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7657
7658 size = MAX_PATH;
7659 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
7660 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7661 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7662
7663 size = MAX_PATH;
7664 sprintf(path, "%s\\FileName10.dll", CURR_DIR);
7665 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
7666 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7667 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7668
7669 delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
7670 MSIINSTALLCONTEXT_MACHINE, NULL);
7671 delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
7672 MSIINSTALLCONTEXT_USERUNMANAGED, usersid);
7673 delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
7674 MSIINSTALLCONTEXT_USERMANAGED, usersid);
7675 delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
7676 MSIINSTALLCONTEXT_MACHINE, NULL);
7677 delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
7678 MSIINSTALLCONTEXT_MACHINE, NULL);
7679 delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
7680 MSIINSTALLCONTEXT_MACHINE, NULL);
7681 delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
7682 MSIINSTALLCONTEXT_MACHINE, NULL);
7683 delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
7684 MSIINSTALLCONTEXT_MACHINE, NULL);
7685 delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
7686 MSIINSTALLCONTEXT_MACHINE, NULL);
7687 delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
7688 MSIINSTALLCONTEXT_MACHINE, NULL);
7689
7690 DeleteFileA("FileName1");
7691 DeleteFileA("FileName2");
7692 DeleteFileA("FileName3");
7693 DeleteFileA("FileName4");
7694 DeleteFileA("FileName5");
7695 DeleteFileA("FileName6");
7696 DeleteFileA("FileName7");
7697 DeleteFileA("FileName8.dll");
7698 DeleteFileA("FileName9.dll");
7699 DeleteFileA("FileName10.dll");
7700 MsiCloseHandle(hpkg);
7701 DeleteFileA(msifile);
7702 LocalFree(usersid);
7703 }
7704
7705 static void test_appsearch_reglocator(void)
7706 {
7707 MSIHANDLE hpkg, hdb;
7708 CHAR path[MAX_PATH];
7709 CHAR prop[MAX_PATH];
7710 DWORD binary[2];
7711 DWORD size, val;
7712 BOOL space, version;
7713 HKEY hklm, classes;
7714 HKEY hkcu, users;
7715 LPSTR pathdata;
7716 LPSTR pathvar;
7717 LPCSTR str;
7718 LPSTR ptr;
7719 LONG res;
7720 UINT r;
7721
7722 version = TRUE;
7723 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
7724 version = FALSE;
7725
7726 DeleteFileA("test.dll");
7727
7728 res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
7729 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7730
7731 res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
7732 (const BYTE *)"regszdata", 10);
7733 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7734
7735 res = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine", &hkcu);
7736 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7737
7738 res = RegSetValueExA(hkcu, "Value1", 0, REG_SZ,
7739 (const BYTE *)"regszdata", 10);
7740 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7741
7742 users = 0;
7743 res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
7744 ok(res == ERROR_SUCCESS ||
7745 broken(res == ERROR_INVALID_PARAMETER),
7746 "Expected ERROR_SUCCESS, got %d\n", res);
7747
7748 if (res == ERROR_SUCCESS)
7749 {
7750 res = RegSetValueExA(users, "Value1", 0, REG_SZ,
7751 (const BYTE *)"regszdata", 10);
7752 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7753 }
7754
7755 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine", &hklm);
7756 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7757
7758 res = RegSetValueA(hklm, NULL, REG_SZ, "defvalue", 8);
7759 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7760
7761 res = RegSetValueExA(hklm, "Value1", 0, REG_SZ,
7762 (const BYTE *)"regszdata", 10);
7763 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7764
7765 val = 42;
7766 res = RegSetValueExA(hklm, "Value2", 0, REG_DWORD,
7767 (const BYTE *)&val, sizeof(DWORD));
7768 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7769
7770 val = -42;
7771 res = RegSetValueExA(hklm, "Value3", 0, REG_DWORD,
7772 (const BYTE *)&val, sizeof(DWORD));
7773 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7774
7775 res = RegSetValueExA(hklm, "Value4", 0, REG_EXPAND_SZ,
7776 (const BYTE *)"%PATH%", 7);
7777 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7778
7779 res = RegSetValueExA(hklm, "Value5", 0, REG_EXPAND_SZ,
7780 (const BYTE *)"my%NOVAR%", 10);
7781 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7782
7783 res = RegSetValueExA(hklm, "Value6", 0, REG_MULTI_SZ,
7784 (const BYTE *)"one\0two\0", 9);
7785 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7786
7787 binary[0] = 0x1234abcd;
7788 binary[1] = 0x567890ef;
7789 res = RegSetValueExA(hklm, "Value7", 0, REG_BINARY,
7790 (const BYTE *)binary, sizeof(binary));
7791 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7792
7793 res = RegSetValueExA(hklm, "Value8", 0, REG_SZ,
7794 (const BYTE *)"#regszdata", 11);
7795 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7796
7797 create_test_file("FileName1");
7798 sprintf(path, "%s\\FileName1", CURR_DIR);
7799 res = RegSetValueExA(hklm, "Value9", 0, REG_SZ,
7800 (const BYTE *)path, lstrlenA(path) + 1);
7801 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7802
7803 sprintf(path, "%s\\FileName2", CURR_DIR);
7804 res = RegSetValueExA(hklm, "Value10", 0, REG_SZ,
7805 (const BYTE *)path, lstrlenA(path) + 1);
7806 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7807
7808 lstrcpyA(path, CURR_DIR);
7809 res = RegSetValueExA(hklm, "Value11", 0, REG_SZ,
7810 (const BYTE *)path, lstrlenA(path) + 1);
7811 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7812
7813 res = RegSetValueExA(hklm, "Value12", 0, REG_SZ,
7814 (const BYTE *)"", 1);
7815 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7816
7817 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7818 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
7819 res = RegSetValueExA(hklm, "Value13", 0, REG_SZ,
7820 (const BYTE *)path, lstrlenA(path) + 1);
7821 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7822
7823 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
7824 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
7825 res = RegSetValueExA(hklm, "Value14", 0, REG_SZ,
7826 (const BYTE *)path, lstrlenA(path) + 1);
7827 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7828
7829 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7830 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
7831 res = RegSetValueExA(hklm, "Value15", 0, REG_SZ,
7832 (const BYTE *)path, lstrlenA(path) + 1);
7833 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7834
7835 sprintf(path, "\"%s\\FileName1\" -option", CURR_DIR);
7836 res = RegSetValueExA(hklm, "value16", 0, REG_SZ,
7837 (const BYTE *)path, lstrlenA(path) + 1);
7838
7839 space = (strchr(CURR_DIR, ' ')) ? TRUE : FALSE;
7840 sprintf(path, "%s\\FileName1 -option", CURR_DIR);
7841 res = RegSetValueExA(hklm, "value17", 0, REG_SZ,
7842 (const BYTE *)path, lstrlenA(path) + 1);
7843
7844 hdb = create_package_db();
7845 ok(hdb, "Expected a valid database handle\n");
7846
7847 r = create_appsearch_table(hdb);
7848 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7849
7850 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
7851 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7852
7853 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
7854 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7855
7856 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
7857 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7858
7859 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
7860 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7861
7862 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
7863 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7864
7865 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
7866 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7867
7868 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
7869 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7870
7871 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
7872 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7873
7874 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
7875 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7876
7877 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
7878 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7879
7880 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
7881 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7882
7883 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
7884 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7885
7886 r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
7887 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7888
7889 r = add_appsearch_entry(hdb, "'SIGPROP14', 'NewSignature14'");
7890 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7891
7892 r = add_appsearch_entry(hdb, "'SIGPROP15', 'NewSignature15'");
7893 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7894
7895 r = add_appsearch_entry(hdb, "'SIGPROP16', 'NewSignature16'");
7896 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7897
7898 r = add_appsearch_entry(hdb, "'SIGPROP17', 'NewSignature17'");
7899 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7900
7901 r = add_appsearch_entry(hdb, "'SIGPROP18', 'NewSignature18'");
7902 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7903
7904 r = add_appsearch_entry(hdb, "'SIGPROP19', 'NewSignature19'");
7905 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7906
7907 r = add_appsearch_entry(hdb, "'SIGPROP20', 'NewSignature20'");
7908 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7909
7910 r = add_appsearch_entry(hdb, "'SIGPROP21', 'NewSignature21'");
7911 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7912
7913 r = add_appsearch_entry(hdb, "'SIGPROP22', 'NewSignature22'");
7914 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7915
7916 r = add_appsearch_entry(hdb, "'SIGPROP23', 'NewSignature23'");
7917 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7918
7919 r = add_appsearch_entry(hdb, "'SIGPROP24', 'NewSignature24'");
7920 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7921
7922 r = add_appsearch_entry(hdb, "'SIGPROP25', 'NewSignature25'");
7923 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7924
7925 r = add_appsearch_entry(hdb, "'SIGPROP26', 'NewSignature26'");
7926 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7927
7928 r = add_appsearch_entry(hdb, "'SIGPROP27', 'NewSignature27'");
7929 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7930
7931 r = add_appsearch_entry(hdb, "'SIGPROP28', 'NewSignature28'");
7932 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7933
7934 r = add_appsearch_entry(hdb, "'SIGPROP29', 'NewSignature29'");
7935 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7936
7937 r = add_appsearch_entry(hdb, "'SIGPROP30', 'NewSignature30'");
7938 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7939
7940 r = create_reglocator_table(hdb);
7941 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7942
7943 /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
7944 str = "'NewSignature1', 2, 'Software\\Wine', 'Value1', 2";
7945 r = add_reglocator_entry(hdb, str);
7946 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7947
7948 /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
7949 str = "'NewSignature2', 2, 'Software\\Wine', 'Value2', 2";
7950 r = add_reglocator_entry(hdb, str);
7951 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7952
7953 /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
7954 str = "'NewSignature3', 2, 'Software\\Wine', 'Value3', 2";
7955 r = add_reglocator_entry(hdb, str);
7956 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7957
7958 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
7959 str = "'NewSignature4', 2, 'Software\\Wine', 'Value4', 2";
7960 r = add_reglocator_entry(hdb, str);
7961 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7962
7963 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
7964 str = "'NewSignature5', 2, 'Software\\Wine', 'Value5', 2";
7965 r = add_reglocator_entry(hdb, str);
7966 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7967
7968 /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
7969 str = "'NewSignature6', 2, 'Software\\Wine', 'Value6', 2";
7970 r = add_reglocator_entry(hdb, str);
7971 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7972
7973 /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
7974 str = "'NewSignature7', 2, 'Software\\Wine', 'Value7', 2";
7975 r = add_reglocator_entry(hdb, str);
7976 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7977
7978 /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
7979 str = "'NewSignature8', 2, 'Software\\Wine', 'Value8', 2";
7980 r = add_reglocator_entry(hdb, str);
7981 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7982
7983 /* HKLM, msidbLocatorTypeFileName, signature, file exists */
7984 str = "'NewSignature9', 2, 'Software\\Wine', 'Value9', 1";
7985 r = add_reglocator_entry(hdb, str);
7986 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7987
7988 /* HKLM, msidbLocatorTypeFileName, signature, file does not exist */
7989 str = "'NewSignature10', 2, 'Software\\Wine', 'Value10', 1";
7990 r = add_reglocator_entry(hdb, str);
7991 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7992
7993 /* HKLM, msidbLocatorTypeFileName, no signature */
7994 str = "'NewSignature11', 2, 'Software\\Wine', 'Value9', 1";
7995 r = add_reglocator_entry(hdb, str);
7996 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7997
7998 /* HKLM, msidbLocatorTypeDirectory, no signature, file exists */
7999 str = "'NewSignature12', 2, 'Software\\Wine', 'Value9', 0";
8000 r = add_reglocator_entry(hdb, str);
8001 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8002
8003 /* HKLM, msidbLocatorTypeDirectory, no signature, directory exists */
8004 str = "'NewSignature13', 2, 'Software\\Wine', 'Value11', 0";
8005 r = add_reglocator_entry(hdb, str);
8006 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8007
8008 /* HKLM, msidbLocatorTypeDirectory, signature, file exists */
8009 str = "'NewSignature14', 2, 'Software\\Wine', 'Value9', 0";
8010 r = add_reglocator_entry(hdb, str);
8011 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8012
8013 /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
8014 str = "'NewSignature15', 0, 'Software\\Wine', 'Value1', 2";
8015 r = add_reglocator_entry(hdb, str);
8016 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8017
8018 /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
8019 str = "'NewSignature16', 1, 'Software\\Wine', 'Value1', 2";
8020 r = add_reglocator_entry(hdb, str);
8021 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8022
8023 /* HKU, msidbLocatorTypeRawValue, REG_SZ */
8024 str = "'NewSignature17', 3, 'S-1-5-18\\Software\\Wine', 'Value1', 2";
8025 r = add_reglocator_entry(hdb, str);
8026 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8027
8028 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
8029 str = "'NewSignature18', 2, 'Software\\Wine', '', 2";
8030 r = add_reglocator_entry(hdb, str);
8031 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8032
8033 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
8034 str = "'NewSignature19', 2, 'Software\\IDontExist', '', 2";
8035 r = add_reglocator_entry(hdb, str);
8036 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8037
8038 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
8039 str = "'NewSignature20', 2, 'Software\\Wine', 'Value12', 2";
8040 r = add_reglocator_entry(hdb, str);
8041 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8042
8043 /* HKLM, msidbLocatorTypeFileName, signature, file exists w/ version */
8044 str = "'NewSignature21', 2, 'Software\\Wine', 'Value13', 1";
8045 r = add_reglocator_entry(hdb, str);
8046 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8047
8048 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
8049 str = "'NewSignature22', 2, 'Software\\Wine', 'Value14', 1";
8050 r = add_reglocator_entry(hdb, str);
8051 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8052
8053 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
8054 str = "'NewSignature23', 2, 'Software\\Wine', 'Value15', 1";
8055 r = add_reglocator_entry(hdb, str);
8056 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8057
8058 /* HKLM, msidbLocatorTypeFileName, no signature, directory exists */
8059 str = "'NewSignature24', 2, 'Software\\Wine', 'Value11', 1";
8060 r = add_reglocator_entry(hdb, str);
8061 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8062
8063 /* HKLM, msidbLocatorTypeFileName, no signature, file does not exist */
8064 str = "'NewSignature25', 2, 'Software\\Wine', 'Value10', 1";
8065 r = add_reglocator_entry(hdb, str);
8066 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8067
8068 /* HKLM, msidbLocatorTypeDirectory, signature, directory exists */
8069 str = "'NewSignature26', 2, 'Software\\Wine', 'Value11', 0";
8070 r = add_reglocator_entry(hdb, str);
8071 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8072
8073 /* HKLM, msidbLocatorTypeDirectory, signature, file does not exist */
8074 str = "'NewSignature27', 2, 'Software\\Wine', 'Value10', 0";
8075 r = add_reglocator_entry(hdb, str);
8076 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8077
8078 /* HKLM, msidbLocatorTypeDirectory, no signature, file does not exist */
8079 str = "'NewSignature28', 2, 'Software\\Wine', 'Value10', 0";
8080 r = add_reglocator_entry(hdb, str);
8081 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8082
8083 /* HKLM, msidbLocatorTypeFile, file exists, in quotes */
8084 str = "'NewSignature29', 2, 'Software\\Wine', 'Value16', 1";
8085 r = add_reglocator_entry(hdb, str);
8086 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8087
8088 /* HKLM, msidbLocatorTypeFile, file exists, no quotes */
8089 str = "'NewSignature30', 2, 'Software\\Wine', 'Value17', 1";
8090 r = add_reglocator_entry(hdb, str);
8091 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8092
8093 r = create_signature_table(hdb);
8094 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8095
8096 str = "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
8097 r = add_signature_entry(hdb, str);
8098 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8099
8100 str = "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
8101 r = add_signature_entry(hdb, str);
8102 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8103
8104 str = "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
8105 r = add_signature_entry(hdb, str);
8106 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8107
8108 str = "'NewSignature21', 'FileName3.dll', '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 str = "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8113 r = add_signature_entry(hdb, str);
8114 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8115
8116 str = "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8117 r = add_signature_entry(hdb, str);
8118 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8119
8120 ptr = strrchr(CURR_DIR, '\\') + 1;
8121 sprintf(path, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr);
8122 r = add_signature_entry(hdb, path);
8123 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8124
8125 str = "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''";
8126 r = add_signature_entry(hdb, str);
8127 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8128
8129 str = "'NewSignature29', 'FileName1', '', '', '', '', '', '', ''";
8130 r = add_signature_entry(hdb, str);
8131 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8132
8133 str = "'NewSignature30', 'FileName1', '', '', '', '', '', '', ''";
8134 r = add_signature_entry(hdb, str);
8135 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8136
8137 hpkg = package_from_db(hdb);
8138 ok(hpkg, "Expected a valid package handle\n");
8139
8140 r = MsiDoAction(hpkg, "AppSearch");
8141 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8142
8143 size = MAX_PATH;
8144 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8145 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8146 ok(!lstrcmpA(prop, "regszdata"),
8147 "Expected \"regszdata\", got \"%s\"\n", prop);
8148
8149 size = MAX_PATH;
8150 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8151 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8152 ok(!lstrcmpA(prop, "#42"), "Expected \"#42\", got \"%s\"\n", prop);
8153
8154 size = MAX_PATH;
8155 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8156 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8157 ok(!lstrcmpA(prop, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop);
8158
8159 size = ExpandEnvironmentStringsA("%PATH%", NULL, 0);
8160 if (size == 0 && GetLastError() == ERROR_INVALID_PARAMETER)
8161 {
8162 /* Workaround for Win95 */
8163 CHAR tempbuf[1];
8164 size = ExpandEnvironmentStringsA("%PATH%", tempbuf, 0);
8165 }
8166 pathvar = HeapAlloc(GetProcessHeap(), 0, size);
8167 ExpandEnvironmentStringsA("%PATH%", pathvar, size);
8168
8169 size = 0;
8170 r = MsiGetPropertyA(hpkg, "SIGPROP4", NULL, &size);
8171 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8172
8173 pathdata = HeapAlloc(GetProcessHeap(), 0, ++size);
8174 r = MsiGetPropertyA(hpkg, "SIGPROP4", pathdata, &size);
8175 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8176 ok(!lstrcmpA(pathdata, pathvar),
8177 "Expected \"%s\", got \"%s\"\n", pathvar, pathdata);
8178
8179 HeapFree(GetProcessHeap(), 0, pathvar);
8180 HeapFree(GetProcessHeap(), 0, pathdata);
8181
8182 size = MAX_PATH;
8183 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8184 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8185 ok(!lstrcmpA(prop,
8186 "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop);
8187
8188 size = MAX_PATH;
8189 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8190 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8191 todo_wine
8192 {
8193 ok(!memcmp(prop, "\0one\0two\0\0", 10),
8194 "Expected \"\\0one\\0two\\0\\0\"\n");
8195 }
8196
8197 size = MAX_PATH;
8198 lstrcpyA(path, "#xCDAB3412EF907856");
8199 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8200 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8201 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8202
8203 size = MAX_PATH;
8204 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8205 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8206 ok(!lstrcmpA(prop, "##regszdata"),
8207 "Expected \"##regszdata\", got \"%s\"\n", prop);
8208
8209 size = MAX_PATH;
8210 sprintf(path, "%s\\FileName1", CURR_DIR);
8211 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8212 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8213 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8214
8215 size = MAX_PATH;
8216 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8217 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8218 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8219
8220 size = MAX_PATH;
8221 sprintf(path, "%s\\", CURR_DIR);
8222 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8223 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8224 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8225
8226 size = MAX_PATH;
8227 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8228 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8229 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8230
8231 size = MAX_PATH;
8232 sprintf(path, "%s\\", CURR_DIR);
8233 r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
8234 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8235 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8236
8237 size = MAX_PATH;
8238 r = MsiGetPropertyA(hpkg, "SIGPROP14", prop, &size);
8239 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8240 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8241
8242 size = MAX_PATH;
8243 r = MsiGetPropertyA(hpkg, "SIGPROP15", prop, &size);
8244 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8245 ok(!lstrcmpA(prop, "regszdata"),
8246 "Expected \"regszdata\", got \"%s\"\n", prop);
8247
8248 size = MAX_PATH;
8249 r = MsiGetPropertyA(hpkg, "SIGPROP16", 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 if (users)
8255 {
8256 size = MAX_PATH;
8257 r = MsiGetPropertyA(hpkg, "SIGPROP17", prop, &size);
8258 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8259 ok(!lstrcmpA(prop, "regszdata"),
8260 "Expected \"regszdata\", got \"%s\"\n", prop);
8261 }
8262
8263 size = MAX_PATH;
8264 r = MsiGetPropertyA(hpkg, "SIGPROP18", prop, &size);
8265 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8266 ok(!lstrcmpA(prop, "defvalue"),
8267 "Expected \"defvalue\", got \"%s\"\n", prop);
8268
8269 size = MAX_PATH;
8270 r = MsiGetPropertyA(hpkg, "SIGPROP19", prop, &size);
8271 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8272 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8273
8274 size = MAX_PATH;
8275 r = MsiGetPropertyA(hpkg, "SIGPROP20", prop, &size);
8276 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8277 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8278
8279 if (version)
8280 {
8281 size = MAX_PATH;
8282 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8283 r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size);
8284 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8285 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8286
8287 size = MAX_PATH;
8288 r = MsiGetPropertyA(hpkg, "SIGPROP22", prop, &size);
8289 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8290 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8291
8292 size = MAX_PATH;
8293 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
8294 r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size);
8295 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8296 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8297 }
8298
8299 size = MAX_PATH;
8300 lstrcpyA(path, CURR_DIR);
8301 ptr = strrchr(path, '\\') + 1;
8302 *ptr = '\0';
8303 r = MsiGetPropertyA(hpkg, "SIGPROP24", prop, &size);
8304 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8305 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8306
8307 size = MAX_PATH;
8308 sprintf(path, "%s\\", CURR_DIR);
8309 r = MsiGetPropertyA(hpkg, "SIGPROP25", prop, &size);
8310 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8311 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8312
8313 size = MAX_PATH;
8314 r = MsiGetPropertyA(hpkg, "SIGPROP26", prop, &size);
8315 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8316 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8317
8318 size = MAX_PATH;
8319 r = MsiGetPropertyA(hpkg, "SIGPROP27", prop, &size);
8320 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8321 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8322
8323 size = MAX_PATH;
8324 r = MsiGetPropertyA(hpkg, "SIGPROP28", prop, &size);
8325 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8326 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8327
8328 size = MAX_PATH;
8329 sprintf(path, "%s\\FileName1", CURR_DIR);
8330 r = MsiGetPropertyA(hpkg, "SIGPROP29", prop, &size);
8331 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8332 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8333
8334 size = MAX_PATH;
8335 sprintf(path, "%s\\FileName1", CURR_DIR);
8336 r = MsiGetPropertyA(hpkg, "SIGPROP30", prop, &size);
8337 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8338 if (space)
8339 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8340 else
8341 todo_wine ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8342
8343 RegSetValueA(hklm, NULL, REG_SZ, "", 0);
8344 RegDeleteValueA(hklm, "Value1");
8345 RegDeleteValueA(hklm, "Value2");
8346 RegDeleteValueA(hklm, "Value3");
8347 RegDeleteValueA(hklm, "Value4");
8348 RegDeleteValueA(hklm, "Value5");
8349 RegDeleteValueA(hklm, "Value6");
8350 RegDeleteValueA(hklm, "Value7");
8351 RegDeleteValueA(hklm, "Value8");
8352 RegDeleteValueA(hklm, "Value9");
8353 RegDeleteValueA(hklm, "Value10");
8354 RegDeleteValueA(hklm, "Value11");
8355 RegDeleteValueA(hklm, "Value12");
8356 RegDeleteValueA(hklm, "Value13");
8357 RegDeleteValueA(hklm, "Value14");
8358 RegDeleteValueA(hklm, "Value15");
8359 RegDeleteValueA(hklm, "Value16");
8360 RegDeleteValueA(hklm, "Value17");
8361 RegDeleteKeyA(hklm, "");
8362 RegCloseKey(hklm);
8363
8364 RegDeleteValueA(classes, "Value1");
8365 RegDeleteKeyA(classes, "");
8366 RegCloseKey(classes);
8367
8368 RegDeleteValueA(hkcu, "Value1");
8369 RegDeleteKeyA(hkcu, "");
8370 RegCloseKey(hkcu);
8371
8372 RegDeleteValueA(users, "Value1");
8373 RegDeleteKeyA(users, "");
8374 RegCloseKey(users);
8375
8376 DeleteFileA("FileName1");
8377 DeleteFileA("FileName3.dll");
8378 DeleteFileA("FileName4.dll");
8379 DeleteFileA("FileName5.dll");
8380 MsiCloseHandle(hpkg);
8381 DeleteFileA(msifile);
8382 }
8383
8384 static void delete_win_ini(LPCSTR file)
8385 {
8386 CHAR path[MAX_PATH];
8387
8388 GetWindowsDirectoryA(path, MAX_PATH);
8389 lstrcatA(path, "\\");
8390 lstrcatA(path, file);
8391
8392 DeleteFileA(path);
8393 }
8394
8395 static void test_appsearch_inilocator(void)
8396 {
8397 MSIHANDLE hpkg, hdb;
8398 CHAR path[MAX_PATH];
8399 CHAR prop[MAX_PATH];
8400 BOOL version;
8401 LPCSTR str;
8402 LPSTR ptr;
8403 DWORD size;
8404 UINT r;
8405
8406 version = TRUE;
8407 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
8408 version = FALSE;
8409
8410 DeleteFileA("test.dll");
8411
8412 WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
8413
8414 create_test_file("FileName1");
8415 sprintf(path, "%s\\FileName1", CURR_DIR);
8416 WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
8417
8418 WritePrivateProfileStringA("Section", "Key3", CURR_DIR, "IniFile.ini");
8419
8420 sprintf(path, "%s\\IDontExist", CURR_DIR);
8421 WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
8422
8423 create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8424 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
8425 WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
8426
8427 create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8428 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8429 WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
8430
8431 create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8432 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
8433 WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
8434
8435 hdb = create_package_db();
8436 ok(hdb, "Expected a valid database handle\n");
8437
8438 r = create_appsearch_table(hdb);
8439 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8440
8441 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8442 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8443
8444 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8445 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8446
8447 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8448 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8449
8450 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8451 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8452
8453 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8454 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8455
8456 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8457 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8458
8459 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8460 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8461
8462 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8463 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8464
8465 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8466 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8467
8468 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8469 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8470
8471 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8472 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8473
8474 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
8475 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8476
8477 r = create_inilocator_table(hdb);
8478 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8479
8480 /* msidbLocatorTypeRawValue, field 1 */
8481 str = "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
8482 r = add_inilocator_entry(hdb, str);
8483 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8484
8485 /* msidbLocatorTypeRawValue, field 2 */
8486 str = "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
8487 r = add_inilocator_entry(hdb, str);
8488 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8489
8490 /* msidbLocatorTypeRawValue, entire field */
8491 str = "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
8492 r = add_inilocator_entry(hdb, str);
8493 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8494
8495 /* msidbLocatorTypeFile */
8496 str = "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
8497 r = add_inilocator_entry(hdb, str);
8498 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8499
8500 /* msidbLocatorTypeDirectory, file */
8501 str = "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
8502 r = add_inilocator_entry(hdb, str);
8503 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8504
8505 /* msidbLocatorTypeDirectory, directory */
8506 str = "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
8507 r = add_inilocator_entry(hdb, str);
8508 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8509
8510 /* msidbLocatorTypeFile, file, no signature */
8511 str = "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
8512 r = add_inilocator_entry(hdb, str);
8513 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8514
8515 /* msidbLocatorTypeFile, dir, no signature */
8516 str = "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
8517 r = add_inilocator_entry(hdb, str);
8518 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8519
8520 /* msidbLocatorTypeFile, file does not exist */
8521 str = "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
8522 r = add_inilocator_entry(hdb, str);
8523 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8524
8525 /* msidbLocatorTypeFile, signature with version */
8526 str = "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1";
8527 r = add_inilocator_entry(hdb, str);
8528 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8529
8530 /* msidbLocatorTypeFile, signature with version, ver > max */
8531 str = "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1";
8532 r = add_inilocator_entry(hdb, str);
8533 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8534
8535 /* msidbLocatorTypeFile, signature with version, sig->name ignored */
8536 str = "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1";
8537 r = add_inilocator_entry(hdb, str);
8538 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8539
8540 r = create_signature_table(hdb);
8541 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8542
8543 r = add_signature_entry(hdb, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
8544 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8545
8546 r = add_signature_entry(hdb, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
8547 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8548
8549 r = add_signature_entry(hdb, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8550 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8551
8552 r = add_signature_entry(hdb, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8553 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8554
8555 r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8556 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8557
8558 hpkg = package_from_db(hdb);
8559 ok(hpkg, "Expected a valid package handle\n");
8560
8561 r = MsiDoAction(hpkg, "AppSearch");
8562 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8563
8564 size = MAX_PATH;
8565 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8566 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8567 ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop);
8568
8569 size = MAX_PATH;
8570 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8571 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8572 ok(!lstrcmpA(prop, "field2"), "Expected \"field2\", got \"%s\"\n", prop);
8573
8574 size = MAX_PATH;
8575 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8576 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8577 ok(!lstrcmpA(prop, "keydata,field2"),
8578 "Expected \"keydata,field2\", got \"%s\"\n", prop);
8579
8580 size = MAX_PATH;
8581 sprintf(path, "%s\\FileName1", CURR_DIR);
8582 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
8583 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8584 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8585
8586 size = MAX_PATH;
8587 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8588 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8589 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8590
8591 size = MAX_PATH;
8592 sprintf(path, "%s\\", CURR_DIR);
8593 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8594 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8595 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8596
8597 size = MAX_PATH;
8598 sprintf(path, "%s\\", CURR_DIR);
8599 r = MsiGetPropertyA(hpkg, "SIGPROP7", 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 lstrcpyA(path, CURR_DIR);
8605 ptr = strrchr(path, '\\');
8606 *(ptr + 1) = '\0';
8607 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8608 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8609 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8610
8611 size = MAX_PATH;
8612 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8613 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8614 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8615
8616 if (version)
8617 {
8618 size = MAX_PATH;
8619 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
8620 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8621 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8622 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8623
8624 size = MAX_PATH;
8625 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8626 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8627 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8628
8629 size = MAX_PATH;
8630 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
8631 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8632 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8633 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8634 }
8635
8636 delete_win_ini("IniFile.ini");
8637 DeleteFileA("FileName1");
8638 DeleteFileA("FileName2.dll");
8639 DeleteFileA("FileName3.dll");
8640 DeleteFileA("FileName4.dll");
8641 MsiCloseHandle(hpkg);
8642 DeleteFileA(msifile);
8643 }
8644
8645 /*
8646 * MSI AppSearch action on DrLocator table always returns absolute paths.
8647 * If a relative path was set, it returns the first absolute path that
8648 * matches or an empty string if it didn't find anything.
8649 * This helper function replicates this behaviour.
8650 */
8651 static void search_absolute_directory(LPSTR absolute, LPCSTR relative)
8652 {
8653 int i, size;
8654 DWORD attr, drives;
8655
8656 size = lstrlenA(relative);
8657 drives = GetLogicalDrives();
8658 lstrcpyA(absolute, "A:\\");
8659 for (i = 0; i < 26; absolute[0] = '\0', i++)
8660 {
8661 if (!(drives & (1 << i)))
8662 continue;
8663
8664 absolute[0] = 'A' + i;
8665 if (GetDriveType(absolute) != DRIVE_FIXED)
8666 continue;
8667
8668 lstrcpynA(absolute + 3, relative, size + 1);
8669 attr = GetFileAttributesA(absolute);
8670 if (attr != INVALID_FILE_ATTRIBUTES &&
8671 (attr & FILE_ATTRIBUTE_DIRECTORY))
8672 {
8673 if (absolute[3 + size - 1] != '\\')
8674 lstrcatA(absolute, "\\");
8675 break;
8676 }
8677 absolute[3] = '\0';
8678 }
8679 }
8680
8681 static void test_appsearch_drlocator(void)
8682 {
8683 MSIHANDLE hpkg, hdb;
8684 CHAR path[MAX_PATH];
8685 CHAR prop[MAX_PATH];
8686 BOOL version;
8687 LPCSTR str;
8688 DWORD size;
8689 UINT r;
8690
8691 version = TRUE;
8692 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
8693 version = FALSE;
8694
8695 DeleteFileA("test.dll");
8696
8697 create_test_file("FileName1");
8698 CreateDirectoryA("one", NULL);
8699 CreateDirectoryA("one\\two", NULL);
8700 CreateDirectoryA("one\\two\\three", NULL);
8701 create_test_file("one\\two\\three\\FileName2");
8702 CreateDirectoryA("another", NULL);
8703 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8704 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8705 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8706
8707 hdb = create_package_db();
8708 ok(hdb, "Expected a valid database handle\n");
8709
8710 r = create_appsearch_table(hdb);
8711 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8712
8713 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8714 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8715
8716 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8717 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8718
8719 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8720 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8721
8722 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8723 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8724
8725 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8726 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8727
8728 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8729 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8730
8731 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8732 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8733
8734 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8735 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8736
8737 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8738 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8739
8740 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8741 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8742
8743 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8744 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8745
8746 r = create_drlocator_table(hdb);
8747 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8748
8749 /* no parent, full path, depth 0, signature */
8750 sprintf(path, "'NewSignature1', '', '%s', 0", CURR_DIR);
8751 r = add_drlocator_entry(hdb, path);
8752 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8753
8754 /* no parent, full path, depth 0, no signature */
8755 sprintf(path, "'NewSignature2', '', '%s', 0", CURR_DIR);
8756 r = add_drlocator_entry(hdb, path);
8757 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8758
8759 /* no parent, relative path, depth 0, no signature */
8760 sprintf(path, "'NewSignature3', '', '%s', 0", CURR_DIR + 3);
8761 r = add_drlocator_entry(hdb, path);
8762 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8763
8764 /* no parent, full path, depth 2, signature */
8765 sprintf(path, "'NewSignature4', '', '%s', 2", CURR_DIR);
8766 r = add_drlocator_entry(hdb, path);
8767 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8768
8769 /* no parent, full path, depth 3, signature */
8770 sprintf(path, "'NewSignature5', '', '%s', 3", CURR_DIR);
8771 r = add_drlocator_entry(hdb, path);
8772 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8773
8774 /* no parent, full path, depth 1, signature is dir */
8775 sprintf(path, "'NewSignature6', '', '%s', 1", CURR_DIR);
8776 r = add_drlocator_entry(hdb, path);
8777 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8778
8779 /* parent is in DrLocator, relative path, depth 0, signature */
8780 sprintf(path, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
8781 r = add_drlocator_entry(hdb, path);
8782 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8783
8784 /* no parent, full path, depth 0, signature w/ version */
8785 sprintf(path, "'NewSignature8', '', '%s', 0", CURR_DIR);
8786 r = add_drlocator_entry(hdb, path);
8787 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8788
8789 /* no parent, full path, depth 0, signature w/ version, ver > max */
8790 sprintf(path, "'NewSignature9', '', '%s', 0", CURR_DIR);
8791 r = add_drlocator_entry(hdb, path);
8792 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8793
8794 /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
8795 sprintf(path, "'NewSignature10', '', '%s', 0", CURR_DIR);
8796 r = add_drlocator_entry(hdb, path);
8797 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8798
8799 /* no parent, relative empty path, depth 0, no signature */
8800 sprintf(path, "'NewSignature11', '', '', 0");
8801 r = add_drlocator_entry(hdb, path);
8802 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8803
8804 r = create_signature_table(hdb);
8805 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8806
8807 str = "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
8808 r = add_signature_entry(hdb, str);
8809 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8810
8811 str = "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
8812 r = add_signature_entry(hdb, str);
8813 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8814
8815 str = "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
8816 r = add_signature_entry(hdb, str);
8817 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8818
8819 str = "'NewSignature6', 'another', '', '', '', '', '', '', ''";
8820 r = add_signature_entry(hdb, str);
8821 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8822
8823 str = "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
8824 r = add_signature_entry(hdb, str);
8825 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8826
8827 str = "'NewSignature8', 'FileName3.dll', '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 str = "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8832 r = add_signature_entry(hdb, str);
8833 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8834
8835 str = "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8836 r = add_signature_entry(hdb, str);
8837 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8838
8839 hpkg = package_from_db(hdb);
8840 ok(hpkg, "Expected a valid package handle\n");
8841
8842 r = MsiDoAction(hpkg, "AppSearch");
8843 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8844
8845 size = MAX_PATH;
8846 sprintf(path, "%s\\FileName1", CURR_DIR);
8847 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8848 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8849 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8850
8851 size = MAX_PATH;
8852 sprintf(path, "%s\\", CURR_DIR);
8853 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8854 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8855 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8856
8857 size = MAX_PATH;
8858 search_absolute_directory(path, CURR_DIR + 3);
8859 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8860 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8861 ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8862
8863 size = MAX_PATH;
8864 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
8865 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8866 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8867
8868 size = MAX_PATH;
8869 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
8870 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8871 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8872 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8873
8874 size = MAX_PATH;
8875 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8876 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8877 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8878
8879 size = MAX_PATH;
8880 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
8881 r = MsiGetPropertyA(hpkg, "SIGPROP7", 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 if (version)
8886 {
8887 size = MAX_PATH;
8888 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8889 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8890 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8891 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8892
8893 size = MAX_PATH;
8894 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8895 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8896 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8897
8898 size = MAX_PATH;
8899 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8900 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8901 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8902 }
8903
8904 size = MAX_PATH;
8905 search_absolute_directory(path, "");
8906 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8907 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8908 ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8909
8910 DeleteFileA("FileName1");
8911 DeleteFileA("FileName3.dll");
8912 DeleteFileA("FileName4.dll");
8913 DeleteFileA("FileName5.dll");
8914 DeleteFileA("one\\two\\three\\FileName2");
8915 RemoveDirectoryA("one\\two\\three");
8916 RemoveDirectoryA("one\\two");
8917 RemoveDirectoryA("one");
8918 RemoveDirectoryA("another");
8919 MsiCloseHandle(hpkg);
8920 DeleteFileA(msifile);
8921 }
8922
8923 static void test_featureparents(void)
8924 {
8925 MSIHANDLE hpkg;
8926 UINT r;
8927 MSIHANDLE hdb;
8928 INSTALLSTATE state, action;
8929
8930 hdb = create_package_db();
8931 ok ( hdb, "failed to create package database\n" );
8932
8933 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
8934 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
8935
8936 r = create_feature_table( hdb );
8937 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
8938
8939 r = create_component_table( hdb );
8940 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
8941
8942 r = create_feature_components_table( hdb );
8943 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
8944
8945 r = create_file_table( hdb );
8946 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
8947
8948 /* msidbFeatureAttributesFavorLocal */
8949 r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
8950 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
8951
8952 /* msidbFeatureAttributesFavorSource */
8953 r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
8954 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
8955
8956 /* msidbFeatureAttributesFavorLocal */
8957 r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
8958 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
8959
8960 /* disabled because of install level */
8961 r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
8962 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
8963
8964 /* child feature of disabled feature */
8965 r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
8966 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
8967
8968 /* component of disabled feature (install level) */
8969 r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
8970 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8971
8972 /* component of disabled child feature (install level) */
8973 r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
8974 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8975
8976 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
8977 r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
8978 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8979
8980 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
8981 r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
8982 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8983
8984 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
8985 r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
8986 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8987
8988 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
8989 r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
8990 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8991
8992 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
8993 r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
8994 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8995
8996 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
8997 r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
8998 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
8999
9000 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
9001 r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
9002 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9003
9004 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
9005 r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
9006 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9007
9008 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
9009 r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
9010
9011 r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
9012 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9013
9014 r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
9015 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9016
9017 r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
9018 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9019
9020 r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
9021 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9022
9023 r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
9024 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9025
9026 r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
9027 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9028
9029 r = add_feature_components_entry( hdb, "'orion', 'leo'" );
9030 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9031
9032 r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
9033 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9034
9035 r = add_feature_components_entry( hdb, "'orion', 'libra'" );
9036 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9037
9038 r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
9039 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9040
9041 r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
9042 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9043
9044 r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
9045 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9046
9047 r = add_feature_components_entry( hdb, "'orion', 'canis'" );
9048 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9049
9050 r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
9051 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9052
9053 r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
9054 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9055
9056 r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
9057 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9058
9059 r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
9060 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9061
9062 r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
9063 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9064
9065 r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
9066 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9067
9068 r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
9069 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9070
9071 r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
9072 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9073
9074 r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
9075 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9076
9077 r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
9078 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9079
9080 r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
9081 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9082
9083 r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
9084 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9085
9086 r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
9087 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9088
9089 r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
9090 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9091
9092 r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
9093 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9094
9095 hpkg = package_from_db( hdb );
9096 ok( hpkg, "failed to create package\n");
9097
9098 MsiCloseHandle( hdb );
9099
9100 r = MsiDoAction( hpkg, "CostInitialize");
9101 ok( r == ERROR_SUCCESS, "cost init failed\n");
9102
9103 r = MsiDoAction( hpkg, "FileCost");
9104 ok( r == ERROR_SUCCESS, "file cost failed\n");
9105
9106 r = MsiDoAction( hpkg, "CostFinalize");
9107 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
9108
9109 state = 0xdeadbee;
9110 action = 0xdeadbee;
9111 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
9112 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9113 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9114 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9115
9116 state = 0xdeadbee;
9117 action = 0xdeadbee;
9118 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
9119 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9120 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9121 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
9122
9123 state = 0xdeadbee;
9124 action = 0xdeadbee;
9125 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
9126 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9127 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9128 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9129
9130 state = 0xdeadbee;
9131 action = 0xdeadbee;
9132 r = MsiGetFeatureState(hpkg, "waters", &state, &action);
9133 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9134 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9135 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
9136
9137 state = 0xdeadbee;
9138 action = 0xdeadbee;
9139 r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
9140 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9141 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9142 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
9143
9144 state = 0xdeadbee;
9145 action = 0xdeadbee;
9146 r = MsiGetComponentState(hpkg, "leo", &state, &action);
9147 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9148 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
9149 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9150
9151 state = 0xdeadbee;
9152 action = 0xdeadbee;
9153 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9154 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9155 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9156 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9157
9158 state = 0xdeadbee;
9159 action = 0xdeadbee;
9160 r = MsiGetComponentState(hpkg, "libra", &state, &action);
9161 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9162 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9163 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9164
9165 state = 0xdeadbee;
9166 action = 0xdeadbee;
9167 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9168 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9169 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9170 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9171
9172 state = 0xdeadbee;
9173 action = 0xdeadbee;
9174 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9175 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9176 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9177 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9178
9179 state = 0xdeadbee;
9180 action = 0xdeadbee;
9181 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9182 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9183 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9184 ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
9185
9186 state = 0xdeadbee;
9187 action = 0xdeadbee;
9188 r = MsiGetComponentState(hpkg, "canis", &state, &action);
9189 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9190 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9191 ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
9192
9193 state = 0xdeadbee;
9194 action = 0xdeadbee;
9195 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9196 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9197 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9198 ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
9199
9200 state = 0xdeadbee;
9201 action = 0xdeadbee;
9202 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9203 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9204 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9205 ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
9206
9207 state = 0xdeadbee;
9208 action = 0xdeadbee;
9209 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9210 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9211 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9212 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9213
9214 state = 0xdeadbee;
9215 action = 0xdeadbee;
9216 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9217 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9218 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
9219 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
9220
9221 r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
9222 ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
9223
9224 state = 0xdeadbee;
9225 action = 0xdeadbee;
9226 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
9227 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9228 ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
9229 ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
9230
9231 state = 0xdeadbee;
9232 action = 0xdeadbee;
9233 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
9234 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9235 ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
9236 ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
9237
9238 state = 0xdeadbee;
9239 action = 0xdeadbee;
9240 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
9241 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9242 ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
9243 ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
9244
9245 state = 0xdeadbee;
9246 action = 0xdeadbee;
9247 r = MsiGetComponentState(hpkg, "leo", &state, &action);
9248 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9249 ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
9250 ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
9251
9252 state = 0xdeadbee;
9253 action = 0xdeadbee;
9254 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9255 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9256 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9257 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9258
9259 state = 0xdeadbee;
9260 action = 0xdeadbee;
9261 r = MsiGetComponentState(hpkg, "libra", &state, &action);
9262 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9263 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9264 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9265
9266 state = 0xdeadbee;
9267 action = 0xdeadbee;
9268 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9269 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9270 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9271 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9272
9273 state = 0xdeadbee;
9274 action = 0xdeadbee;
9275 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9276 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9277 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9278 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9279
9280 state = 0xdeadbee;
9281 action = 0xdeadbee;
9282 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9283 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9284 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9285 ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
9286
9287 state = 0xdeadbee;
9288 action = 0xdeadbee;
9289 r = MsiGetComponentState(hpkg, "canis", &state, &action);
9290 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9291 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9292 ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
9293
9294 state = 0xdeadbee;
9295 action = 0xdeadbee;
9296 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9297 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9298 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9299 ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
9300
9301 state = 0xdeadbee;
9302 action = 0xdeadbee;
9303 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9304 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9305 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9306 ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
9307
9308 state = 0xdeadbee;
9309 action = 0xdeadbee;
9310 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9311 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9312 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9313 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9314
9315 state = 0xdeadbee;
9316 action = 0xdeadbee;
9317 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9318 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9319 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
9320 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
9321
9322 MsiCloseHandle(hpkg);
9323 DeleteFileA(msifile);
9324 }
9325
9326 static void test_installprops(void)
9327 {
9328 MSIHANDLE hpkg, hdb;
9329 CHAR path[MAX_PATH];
9330 CHAR buf[MAX_PATH];
9331 DWORD size, type;
9332 LANGID langid;
9333 HKEY hkey1, hkey2;
9334 int res;
9335 UINT r;
9336
9337 GetCurrentDirectory(MAX_PATH, path);
9338 lstrcat(path, "\\");
9339 lstrcat(path, msifile);
9340
9341 hdb = create_package_db();
9342 ok( hdb, "failed to create database\n");
9343
9344 hpkg = package_from_db(hdb);
9345 ok( hpkg, "failed to create package\n");
9346
9347 MsiCloseHandle(hdb);
9348
9349 size = MAX_PATH;
9350 r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
9351 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9352 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9353
9354 RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
9355
9356 RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2);
9357
9358 size = MAX_PATH;
9359 type = REG_SZ;
9360 *path = '\0';
9361 if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
9362 {
9363 size = MAX_PATH;
9364 type = REG_SZ;
9365 RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
9366 }
9367
9368 /* win9x doesn't set this */
9369 if (*path)
9370 {
9371 size = MAX_PATH;
9372 r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
9373 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9374 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9375 }
9376
9377 size = MAX_PATH;
9378 type = REG_SZ;
9379 *path = '\0';
9380 if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
9381 {
9382 size = MAX_PATH;
9383 type = REG_SZ;
9384 RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
9385 }
9386
9387 if (*path)
9388 {
9389 size = MAX_PATH;
9390 r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
9391 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9392 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9393 }
9394
9395 size = MAX_PATH;
9396 r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
9397 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9398 trace("VersionDatabase = %s\n", buf);
9399
9400 size = MAX_PATH;
9401 r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
9402 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9403 trace("VersionMsi = %s\n", buf);
9404
9405 size = MAX_PATH;
9406 r = MsiGetProperty(hpkg, "Date", buf, &size);
9407 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9408 trace("Date = %s\n", buf);
9409
9410 size = MAX_PATH;
9411 r = MsiGetProperty(hpkg, "Time", buf, &size);
9412 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9413 trace("Time = %s\n", buf);
9414
9415 size = MAX_PATH;
9416 r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
9417 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9418 trace("PackageCode = %s\n", buf);
9419
9420 langid = GetUserDefaultLangID();
9421 sprintf(path, "%d", langid);
9422
9423 size = MAX_PATH;
9424 r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
9425 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
9426 ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
9427
9428 res = GetSystemMetrics(SM_CXSCREEN);
9429 size = MAX_PATH;
9430 r = MsiGetProperty(hpkg, "ScreenX", buf, &size);
9431 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
9432
9433 res = GetSystemMetrics(SM_CYSCREEN);
9434 size = MAX_PATH;
9435 r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
9436 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
9437
9438 CloseHandle(hkey1);
9439 CloseHandle(hkey2);
9440 MsiCloseHandle(hpkg);
9441 DeleteFile(msifile);
9442 }
9443
9444 static void test_launchconditions(void)
9445 {
9446 MSIHANDLE hpkg;
9447 MSIHANDLE hdb;
9448 UINT r;
9449
9450 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9451
9452 hdb = create_package_db();
9453 ok( hdb, "failed to create package database\n" );
9454
9455 r = create_launchcondition_table( hdb );
9456 ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
9457
9458 r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
9459 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
9460
9461 /* invalid condition */
9462 r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
9463 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
9464
9465 hpkg = package_from_db( hdb );
9466 ok( hpkg, "failed to create package\n");
9467
9468 MsiCloseHandle( hdb );
9469
9470 r = MsiSetProperty( hpkg, "X", "1" );
9471 ok( r == ERROR_SUCCESS, "failed to set property\n" );
9472
9473 /* invalid conditions are ignored */
9474 r = MsiDoAction( hpkg, "LaunchConditions" );
9475 ok( r == ERROR_SUCCESS, "cost init failed\n" );
9476
9477 /* verify LaunchConditions still does some verification */
9478 r = MsiSetProperty( hpkg, "X", "2" );
9479 ok( r == ERROR_SUCCESS, "failed to set property\n" );
9480
9481 r = MsiDoAction( hpkg, "LaunchConditions" );
9482 ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
9483
9484 MsiCloseHandle( hpkg );
9485 DeleteFile( msifile );
9486 }
9487
9488 static void test_ccpsearch(void)
9489 {
9490 MSIHANDLE hdb, hpkg;
9491 CHAR prop[MAX_PATH];
9492 DWORD size = MAX_PATH;
9493 UINT r;
9494
9495 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9496
9497 hdb = create_package_db();
9498 ok(hdb, "failed to create package database\n");
9499
9500 r = create_ccpsearch_table(hdb);
9501 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9502
9503 r = add_ccpsearch_entry(hdb, "'CCP_random'");
9504 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9505
9506 r = add_ccpsearch_entry(hdb, "'RMCCP_random'");
9507 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9508
9509 r = create_reglocator_table(hdb);
9510 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9511
9512 r = add_reglocator_entry(hdb, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
9513 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9514
9515 r = create_drlocator_table(hdb);
9516 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9517
9518 r = add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
9519 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9520
9521 r = create_signature_table(hdb);
9522 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9523
9524 hpkg = package_from_db(hdb);
9525 ok(hpkg, "failed to create package\n");
9526
9527 MsiCloseHandle(hdb);
9528
9529 r = MsiDoAction(hpkg, "CCPSearch");
9530 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9531
9532 r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
9533 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9534 ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
9535
9536 MsiCloseHandle(hpkg);
9537 DeleteFileA(msifile);
9538 }
9539
9540 static void test_complocator(void)
9541 {
9542 MSIHANDLE hdb, hpkg;
9543 UINT r;
9544 CHAR prop[MAX_PATH];
9545 CHAR expected[MAX_PATH];
9546 DWORD size = MAX_PATH;
9547
9548 hdb = create_package_db();
9549 ok(hdb, "failed to create package database\n");
9550
9551 r = create_appsearch_table(hdb);
9552 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9553
9554 r = add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
9555 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9556
9557 r = add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
9558 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9559
9560 r = add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
9561 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9562
9563 r = add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
9564 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9565
9566 r = add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
9567 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9568
9569 r = add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
9570 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9571
9572 r = add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
9573 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9574
9575 r = add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
9576 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9577
9578 r = add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
9579 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9580
9581 r = add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
9582 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9583
9584 r = add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
9585 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9586
9587 r = add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
9588 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9589
9590 r = add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
9591 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9592
9593 r = add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
9594 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9595
9596 r = add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
9597 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9598
9599 r = add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
9600 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9601
9602 r = create_complocator_table(hdb);
9603 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9604
9605 r = add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
9606 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9607
9608 r = add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
9609 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9610
9611 r = add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
9612 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9613
9614 r = add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
9615 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9616
9617 r = add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
9618 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9619
9620 r = add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
9621 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9622
9623 r = add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
9624 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9625
9626 r = add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
9627 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9628
9629 r = add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
9630 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9631
9632 r = add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
9633 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9634
9635 r = add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
9636 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9637
9638 r = add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
9639 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9640
9641 r = add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
9642 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9643
9644 r = add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
9645 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9646
9647 r = add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
9648 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9649
9650 r = add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
9651 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9652
9653 r = create_signature_table(hdb);
9654 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9655
9656 r = add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
9657 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9658
9659 r = add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
9660 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9661
9662 r = add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
9663 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9664
9665 r = add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
9666 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9667
9668 r = add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
9669 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9670
9671 r = add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
9672 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9673
9674 r = add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
9675 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9676
9677 r = add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
9678 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9679
9680 hpkg = package_from_db(hdb);
9681 ok(hpkg, "failed to create package\n");
9682
9683 MsiCloseHandle(hdb);
9684
9685 create_test_file("abelisaurus");
9686 create_test_file("bactrosaurus");
9687 create_test_file("camelotia");
9688 create_test_file("diclonius");
9689 create_test_file("echinodon");
9690 create_test_file("falcarius");
9691 create_test_file("gallimimus");
9692 create_test_file("hagryphus");
9693 CreateDirectoryA("iguanodon", NULL);
9694 CreateDirectoryA("jobaria", NULL);
9695 CreateDirectoryA("kakuru", NULL);
9696 CreateDirectoryA("labocania", NULL);
9697 CreateDirectoryA("megaraptor", NULL);
9698 CreateDirectoryA("neosodon", NULL);
9699 CreateDirectoryA("olorotitan", NULL);
9700 CreateDirectoryA("pantydraco", NULL);
9701
9702 set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE,
9703 "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL, FALSE);
9704 set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE,
9705 "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL, FALSE);
9706 set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE,
9707 "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL, FALSE);
9708 set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE,
9709 "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL, FALSE);
9710 set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE,
9711 "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL, FALSE);
9712 set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE,
9713 "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL, FALSE);
9714 set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE,
9715 "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL, FALSE);
9716 set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE,
9717 "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL, FALSE);
9718
9719 r = MsiDoAction(hpkg, "AppSearch");
9720 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9721
9722 size = MAX_PATH;
9723 r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
9724 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9725
9726 lstrcpyA(expected, CURR_DIR);
9727 lstrcatA(expected, "\\abelisaurus");
9728 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9729 "Expected %s or empty string, got %s\n", expected, prop);
9730
9731 size = MAX_PATH;
9732 r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
9733 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9734 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9735
9736 size = MAX_PATH;
9737 r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
9738 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9739 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9740
9741 size = MAX_PATH;
9742 r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
9743 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9744 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9745
9746 size = MAX_PATH;
9747 r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
9748 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9749
9750 lstrcpyA(expected, CURR_DIR);
9751 lstrcatA(expected, "\\");
9752 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9753 "Expected %s or empty string, got %s\n", expected, prop);
9754
9755 size = MAX_PATH;
9756 r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
9757 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9758 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9759
9760 size = MAX_PATH;
9761 r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
9762 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9763 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9764
9765 size = MAX_PATH;
9766 r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
9767 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9768 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9769
9770 size = MAX_PATH;
9771 r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
9772 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9773 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9774
9775 size = MAX_PATH;
9776 r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
9777 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9778 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9779
9780 size = MAX_PATH;
9781 r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
9782 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9783 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9784
9785 size = MAX_PATH;
9786 r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
9787 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9788 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9789
9790 size = MAX_PATH;
9791 r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
9792 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9793
9794 lstrcpyA(expected, CURR_DIR);
9795 lstrcatA(expected, "\\");
9796 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9797 "Expected %s or empty string, got %s\n", expected, prop);
9798
9799 size = MAX_PATH;
9800 r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
9801 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9802
9803 lstrcpyA(expected, CURR_DIR);
9804 lstrcatA(expected, "\\neosodon\\");
9805 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9806 "Expected %s or empty string, got %s\n", expected, prop);
9807
9808 size = MAX_PATH;
9809 r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
9810 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9811 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9812
9813 size = MAX_PATH;
9814 r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
9815 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9816 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9817
9818 MsiCloseHandle(hpkg);
9819 DeleteFileA("abelisaurus");
9820 DeleteFileA("bactrosaurus");
9821 DeleteFileA("camelotia");
9822 DeleteFileA("diclonius");
9823 DeleteFileA("echinodon");
9824 DeleteFileA("falcarius");
9825 DeleteFileA("gallimimus");
9826 DeleteFileA("hagryphus");
9827 RemoveDirectoryA("iguanodon");
9828 RemoveDirectoryA("jobaria");
9829 RemoveDirectoryA("kakuru");
9830 RemoveDirectoryA("labocania");
9831 RemoveDirectoryA("megaraptor");
9832 RemoveDirectoryA("neosodon");
9833 RemoveDirectoryA("olorotitan");
9834 RemoveDirectoryA("pantydraco");
9835 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
9836 MSIINSTALLCONTEXT_MACHINE, NULL);
9837 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
9838 MSIINSTALLCONTEXT_MACHINE, NULL);
9839 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
9840 MSIINSTALLCONTEXT_MACHINE, NULL);
9841 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
9842 MSIINSTALLCONTEXT_MACHINE, NULL);
9843 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
9844 MSIINSTALLCONTEXT_MACHINE, NULL);
9845 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
9846 MSIINSTALLCONTEXT_MACHINE, NULL);
9847 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
9848 MSIINSTALLCONTEXT_MACHINE, NULL);
9849 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
9850 MSIINSTALLCONTEXT_MACHINE, NULL);
9851 DeleteFileA(msifile);
9852 }
9853
9854 static void set_suminfo_prop(MSIHANDLE db, DWORD prop, DWORD val)
9855 {
9856 MSIHANDLE summary;
9857 UINT r;
9858
9859 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
9860 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9861
9862 r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
9863 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9864
9865 r = MsiSummaryInfoPersist(summary);
9866 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
9867
9868 MsiCloseHandle(summary);
9869 }
9870
9871 static void test_MsiGetSourcePath(void)
9872 {
9873 MSIHANDLE hdb, hpkg;
9874 CHAR path[MAX_PATH];
9875 CHAR cwd[MAX_PATH];
9876 CHAR subsrc[MAX_PATH];
9877 CHAR sub2[MAX_PATH];
9878 DWORD size;
9879 UINT r;
9880
9881 lstrcpyA(cwd, CURR_DIR);
9882 lstrcatA(cwd, "\\");
9883
9884 lstrcpyA(subsrc, cwd);
9885 lstrcatA(subsrc, "subsource");
9886 lstrcatA(subsrc, "\\");
9887
9888 lstrcpyA(sub2, subsrc);
9889 lstrcatA(sub2, "sub2");
9890 lstrcatA(sub2, "\\");
9891
9892 /* uncompressed source */
9893
9894 hdb = create_package_db();
9895 ok( hdb, "failed to create database\n");
9896
9897 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
9898
9899 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
9900 ok(r == S_OK, "failed\n");
9901
9902 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
9903 ok(r == S_OK, "failed\n");
9904
9905 r = add_directory_entry(hdb, "'SubDir2', 'SubDir', 'sub2'");
9906 ok(r == S_OK, "failed\n");
9907
9908 r = MsiDatabaseCommit(hdb);
9909 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
9910
9911 hpkg = package_from_db(hdb);
9912 ok(hpkg, "failed to create package\n");
9913
9914 MsiCloseHandle(hdb);
9915
9916 /* invalid database handle */
9917 size = MAX_PATH;
9918 lstrcpyA(path, "kiwi");
9919 r = MsiGetSourcePath(-1, "TARGETDIR", path, &size);
9920 ok(r == ERROR_INVALID_HANDLE,
9921 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
9922 ok(!lstrcmpA(path, "kiwi"),
9923 "Expected path to be unchanged, got \"%s\"\n", path);
9924 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9925
9926 /* NULL szFolder */
9927 size = MAX_PATH;
9928 lstrcpyA(path, "kiwi");
9929 r = MsiGetSourcePath(hpkg, NULL, path, &size);
9930 ok(r == ERROR_INVALID_PARAMETER,
9931 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
9932 ok(!lstrcmpA(path, "kiwi"),
9933 "Expected path to be unchanged, got \"%s\"\n", path);
9934 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9935
9936 /* empty szFolder */
9937 size = MAX_PATH;
9938 lstrcpyA(path, "kiwi");
9939 r = MsiGetSourcePath(hpkg, "", path, &size);
9940 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9941 ok(!lstrcmpA(path, "kiwi"),
9942 "Expected path to be unchanged, got \"%s\"\n", path);
9943 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9944
9945 /* try TARGETDIR */
9946 size = MAX_PATH;
9947 lstrcpyA(path, "kiwi");
9948 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
9949 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9950 ok(!lstrcmpA(path, "kiwi"),
9951 "Expected path to be unchanged, got \"%s\"\n", path);
9952 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9953
9954 /* try SourceDir */
9955 size = MAX_PATH;
9956 lstrcpyA(path, "kiwi");
9957 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
9958 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9959 ok(!lstrcmpA(path, "kiwi"),
9960 "Expected path to be unchanged, got \"%s\"\n", path);
9961 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9962
9963 /* try SOURCEDIR */
9964 size = MAX_PATH;
9965 lstrcpyA(path, "kiwi");
9966 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9967 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9968 ok(!lstrcmpA(path, "kiwi"),
9969 "Expected path to be unchanged, got \"%s\"\n", path);
9970 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9971
9972 /* source path does not exist, but the property exists */
9973 size = MAX_PATH;
9974 lstrcpyA(path, "kiwi");
9975 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9976 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9977 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9978 ok(size == 0, "Expected 0, got %d\n", size);
9979
9980 /* try SubDir */
9981 size = MAX_PATH;
9982 lstrcpyA(path, "kiwi");
9983 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
9984 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9985 ok(!lstrcmpA(path, "kiwi"),
9986 "Expected path to be unchanged, got \"%s\"\n", path);
9987 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9988
9989 /* try SubDir2 */
9990 size = MAX_PATH;
9991 lstrcpyA(path, "kiwi");
9992 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
9993 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9994 ok(!lstrcmpA(path, "kiwi"),
9995 "Expected path to be unchanged, got \"%s\"\n", path);
9996 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9997
9998 r = MsiDoAction(hpkg, "CostInitialize");
9999 ok(r == ERROR_SUCCESS, "cost init failed\n");
10000
10001 /* try TARGETDIR after CostInitialize */
10002 size = MAX_PATH;
10003 lstrcpyA(path, "kiwi");
10004 r = MsiGetSourcePath(hpkg, "TARGETDIR", 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_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10014 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10015 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10016
10017 /* try SOURCEDIR after CostInitialize */
10018 size = MAX_PATH;
10019 lstrcpyA(path, "kiwi");
10020 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10021 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10022 ok(!lstrcmpA(path, "kiwi"),
10023 "Expected path to be unchanged, got \"%s\"\n", path);
10024 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10025
10026 /* source path does not exist, but the property exists */
10027 size = MAX_PATH;
10028 lstrcpyA(path, "kiwi");
10029 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10030 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10031 todo_wine
10032 {
10033 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10034 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10035 }
10036
10037 /* try SubDir after CostInitialize */
10038 size = MAX_PATH;
10039 lstrcpyA(path, "kiwi");
10040 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10041 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10042 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10043 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10044
10045 /* try SubDir2 after CostInitialize */
10046 size = MAX_PATH;
10047 lstrcpyA(path, "kiwi");
10048 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10049 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10050 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10051 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10052
10053 r = MsiDoAction(hpkg, "ResolveSource");
10054 ok(r == ERROR_SUCCESS, "file cost failed\n");
10055
10056 /* try TARGETDIR after ResolveSource */
10057 size = MAX_PATH;
10058 lstrcpyA(path, "kiwi");
10059 r = MsiGetSourcePath(hpkg, "TARGETDIR", 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_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10069 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10070 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10071
10072 /* try SOURCEDIR after ResolveSource */
10073 size = MAX_PATH;
10074 lstrcpyA(path, "kiwi");
10075 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10076 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10077 ok(!lstrcmpA(path, "kiwi"),
10078 "Expected path to be unchanged, got \"%s\"\n", path);
10079 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10080
10081 /* source path does not exist, but the property exists */
10082 size = MAX_PATH;
10083 lstrcpyA(path, "kiwi");
10084 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10085 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10086 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10087 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10088
10089 /* try SubDir after ResolveSource */
10090 size = MAX_PATH;
10091 lstrcpyA(path, "kiwi");
10092 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10093 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10094 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10095 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10096
10097 /* try SubDir2 after ResolveSource */
10098 size = MAX_PATH;
10099 lstrcpyA(path, "kiwi");
10100 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10101 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10102 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10103 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10104
10105 r = MsiDoAction(hpkg, "FileCost");
10106 ok(r == ERROR_SUCCESS, "file cost failed\n");
10107
10108 /* try TARGETDIR after FileCost */
10109 size = MAX_PATH;
10110 lstrcpyA(path, "kiwi");
10111 r = MsiGetSourcePath(hpkg, "TARGETDIR", 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_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10121 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10122 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10123
10124 /* try SOURCEDIR after FileCost */
10125 size = MAX_PATH;
10126 lstrcpyA(path, "kiwi");
10127 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10128 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10129 ok(!lstrcmpA(path, "kiwi"),
10130 "Expected path to be unchanged, got \"%s\"\n", path);
10131 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10132
10133 /* source path does not exist, but the property exists */
10134 size = MAX_PATH;
10135 lstrcpyA(path, "kiwi");
10136 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10137 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10138 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10139 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10140
10141 /* try SubDir after FileCost */
10142 size = MAX_PATH;
10143 lstrcpyA(path, "kiwi");
10144 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10145 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10146 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10147 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10148
10149 /* try SubDir2 after FileCost */
10150 size = MAX_PATH;
10151 lstrcpyA(path, "kiwi");
10152 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10153 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10154 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10155 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10156
10157 r = MsiDoAction(hpkg, "CostFinalize");
10158 ok(r == ERROR_SUCCESS, "file cost failed\n");
10159
10160 /* try TARGETDIR after CostFinalize */
10161 size = MAX_PATH;
10162 lstrcpyA(path, "kiwi");
10163 r = MsiGetSourcePath(hpkg, "TARGETDIR", 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_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10173 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10174 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10175
10176 /* try SOURCEDIR after CostFinalize */
10177 size = MAX_PATH;
10178 lstrcpyA(path, "kiwi");
10179 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10180 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10181 ok(!lstrcmpA(path, "kiwi"),
10182 "Expected path to be unchanged, got \"%s\"\n", path);
10183 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10184
10185 /* source path does not exist, but the property exists */
10186 size = MAX_PATH;
10187 lstrcpyA(path, "kiwi");
10188 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10189 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10190 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10191 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10192
10193 /* try SubDir after CostFinalize */
10194 size = MAX_PATH;
10195 lstrcpyA(path, "kiwi");
10196 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10197 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10198 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10199 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10200
10201 /* try SubDir2 after CostFinalize */
10202 size = MAX_PATH;
10203 lstrcpyA(path, "kiwi");
10204 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10205 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10206 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10207 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10208
10209 /* nonexistent directory */
10210 size = MAX_PATH;
10211 lstrcpyA(path, "kiwi");
10212 r = MsiGetSourcePath(hpkg, "IDontExist", path, &size);
10213 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10214 ok(!lstrcmpA(path, "kiwi"),
10215 "Expected path to be unchanged, got \"%s\"\n", path);
10216 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10217
10218 /* NULL szPathBuf */
10219 size = MAX_PATH;
10220 r = MsiGetSourcePath(hpkg, "SourceDir", NULL, &size);
10221 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10222 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10223
10224 /* NULL pcchPathBuf */
10225 lstrcpyA(path, "kiwi");
10226 r = MsiGetSourcePath(hpkg, "SourceDir", path, NULL);
10227 ok(r == ERROR_INVALID_PARAMETER,
10228 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
10229 ok(!lstrcmpA(path, "kiwi"),
10230 "Expected path to be unchanged, got \"%s\"\n", path);
10231
10232 /* pcchPathBuf is 0 */
10233 size = 0;
10234 lstrcpyA(path, "kiwi");
10235 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10236 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
10237 ok(!lstrcmpA(path, "kiwi"),
10238 "Expected path to be unchanged, got \"%s\"\n", path);
10239 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10240
10241 /* pcchPathBuf does not have room for NULL terminator */
10242 size = lstrlenA(cwd);
10243 lstrcpyA(path, "kiwi");
10244 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10245 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
10246 ok(!strncmp(path, cwd, lstrlenA(cwd) - 1),
10247 "Expected path with no backslash, got \"%s\"\n", path);
10248 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10249
10250 /* pcchPathBuf has room for NULL terminator */
10251 size = lstrlenA(cwd) + 1;
10252 lstrcpyA(path, "kiwi");
10253 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10254 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10255 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10256 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10257
10258 MsiCloseHandle(hpkg);
10259
10260 /* compressed source */
10261
10262 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
10263 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10264
10265 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed);
10266
10267 hpkg = package_from_db(hdb);
10268 ok(hpkg, "failed to create package\n");
10269
10270 /* try TARGETDIR */
10271 size = MAX_PATH;
10272 lstrcpyA(path, "kiwi");
10273 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10274 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10275 ok(!lstrcmpA(path, "kiwi"),
10276 "Expected path to be unchanged, got \"%s\"\n", path);
10277 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10278
10279 /* try SourceDir */
10280 size = MAX_PATH;
10281 lstrcpyA(path, "kiwi");
10282 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10283 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10284 ok(!lstrcmpA(path, "kiwi"),
10285 "Expected path to be unchanged, got \"%s\"\n", path);
10286 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10287
10288 /* try SOURCEDIR */
10289 size = MAX_PATH;
10290 lstrcpyA(path, "kiwi");
10291 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10292 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10293 ok(!lstrcmpA(path, "kiwi"),
10294 "Expected path to be unchanged, got \"%s\"\n", path);
10295 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10296
10297 /* source path nor the property exist */
10298 size = MAX_PATH;
10299 lstrcpyA(path, "kiwi");
10300 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10301 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10302 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10303 ok(size == 0, "Expected 0, got %d\n", size);
10304
10305 /* try SubDir */
10306 size = MAX_PATH;
10307 lstrcpyA(path, "kiwi");
10308 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10309 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10310 ok(!lstrcmpA(path, "kiwi"),
10311 "Expected path to be unchanged, got \"%s\"\n", path);
10312 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10313
10314 /* try SubDir2 */
10315 size = MAX_PATH;
10316 lstrcpyA(path, "kiwi");
10317 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10318 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10319 ok(!lstrcmpA(path, "kiwi"),
10320 "Expected path to be unchanged, got \"%s\"\n", path);
10321 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10322
10323 r = MsiDoAction(hpkg, "CostInitialize");
10324 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10325
10326 /* try TARGETDIR after CostInitialize */
10327 size = MAX_PATH;
10328 lstrcpyA(path, "kiwi");
10329 r = MsiGetSourcePath(hpkg, "TARGETDIR", 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 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10339 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10340 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10341
10342 /* try SOURCEDIR after CostInitialize */
10343 size = MAX_PATH;
10344 lstrcpyA(path, "kiwi");
10345 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10346 todo_wine
10347 {
10348 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10349 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10350 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10351 }
10352
10353 /* source path does not exist, but the property exists */
10354 size = MAX_PATH;
10355 lstrcpyA(path, "kiwi");
10356 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10357 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10358 todo_wine
10359 {
10360 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10361 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10362 }
10363
10364 /* try SubDir after CostInitialize */
10365 size = MAX_PATH;
10366 lstrcpyA(path, "kiwi");
10367 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10368 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10369 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10370 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10371
10372 /* try SubDir2 after CostInitialize */
10373 size = MAX_PATH;
10374 lstrcpyA(path, "kiwi");
10375 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10376 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10377 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10378 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10379
10380 r = MsiDoAction(hpkg, "ResolveSource");
10381 ok(r == ERROR_SUCCESS, "file cost failed\n");
10382
10383 /* try TARGETDIR after ResolveSource */
10384 size = MAX_PATH;
10385 lstrcpyA(path, "kiwi");
10386 r = MsiGetSourcePath(hpkg, "TARGETDIR", 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 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10396 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10397 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10398
10399 /* try SOURCEDIR after ResolveSource */
10400 size = MAX_PATH;
10401 lstrcpyA(path, "kiwi");
10402 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10403 todo_wine
10404 {
10405 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10406 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10407 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10408 }
10409
10410 /* source path and the property exist */
10411 size = MAX_PATH;
10412 lstrcpyA(path, "kiwi");
10413 r = MsiGetProperty(hpkg, "SOURCEDIR", 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 SubDir after ResolveSource */
10419 size = MAX_PATH;
10420 lstrcpyA(path, "kiwi");
10421 r = MsiGetSourcePath(hpkg, "SubDir", 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 /* try SubDir2 after ResolveSource */
10427 size = MAX_PATH;
10428 lstrcpyA(path, "kiwi");
10429 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10430 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10431 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10432 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10433
10434 r = MsiDoAction(hpkg, "FileCost");
10435 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10436
10437 /* try TARGETDIR after CostFinalize */
10438 size = MAX_PATH;
10439 lstrcpyA(path, "kiwi");
10440 r = MsiGetSourcePath(hpkg, "TARGETDIR", 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 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10450 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10451 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10452
10453 /* try SOURCEDIR after CostFinalize */
10454 size = MAX_PATH;
10455 lstrcpyA(path, "kiwi");
10456 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10457 todo_wine
10458 {
10459 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10460 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10461 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10462 }
10463
10464 /* source path and the property exist */
10465 size = MAX_PATH;
10466 lstrcpyA(path, "kiwi");
10467 r = MsiGetProperty(hpkg, "SOURCEDIR", 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 SubDir after CostFinalize */
10473 size = MAX_PATH;
10474 lstrcpyA(path, "kiwi");
10475 r = MsiGetSourcePath(hpkg, "SubDir", 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 /* try SubDir2 after CostFinalize */
10481 size = MAX_PATH;
10482 lstrcpyA(path, "kiwi");
10483 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10484 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10485 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10486 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10487
10488 r = MsiDoAction(hpkg, "CostFinalize");
10489 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10490
10491 /* try TARGETDIR after CostFinalize */
10492 size = MAX_PATH;
10493 lstrcpyA(path, "kiwi");
10494 r = MsiGetSourcePath(hpkg, "TARGETDIR", 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 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10504 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10505 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10506
10507 /* try SOURCEDIR after CostFinalize */
10508 size = MAX_PATH;
10509 lstrcpyA(path, "kiwi");
10510 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10511 todo_wine
10512 {
10513 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10514 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10515 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10516 }
10517
10518 /* source path and the property exist */
10519 size = MAX_PATH;
10520 lstrcpyA(path, "kiwi");
10521 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10522 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10523 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10524 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10525
10526 /* try SubDir after CostFinalize */
10527 size = MAX_PATH;
10528 lstrcpyA(path, "kiwi");
10529 r = MsiGetSourcePath(hpkg, "SubDir", 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 /* try SubDir2 after CostFinalize */
10535 size = MAX_PATH;
10536 lstrcpyA(path, "kiwi");
10537 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10538 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10539 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10540 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10541
10542 MsiCloseHandle(hpkg);
10543 DeleteFile(msifile);
10544 }
10545
10546 static void test_shortlongsource(void)
10547 {
10548 MSIHANDLE hdb, hpkg;
10549 CHAR path[MAX_PATH];
10550 CHAR cwd[MAX_PATH];
10551 CHAR subsrc[MAX_PATH];
10552 DWORD size;
10553 UINT r;
10554
10555 lstrcpyA(cwd, CURR_DIR);
10556 lstrcatA(cwd, "\\");
10557
10558 lstrcpyA(subsrc, cwd);
10559 lstrcatA(subsrc, "long");
10560 lstrcatA(subsrc, "\\");
10561
10562 /* long file names */
10563
10564 hdb = create_package_db();
10565 ok( hdb, "failed to create database\n");
10566
10567 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
10568
10569 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
10570 ok(r == S_OK, "failed\n");
10571
10572 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'short|long'");
10573 ok(r == S_OK, "failed\n");
10574
10575 /* CostInitialize:short */
10576 r = add_directory_entry(hdb, "'SubDir2', 'TARGETDIR', 'one|two'");
10577 ok(r == S_OK, "failed\n");
10578
10579 /* CostInitialize:long */
10580 r = add_directory_entry(hdb, "'SubDir3', 'TARGETDIR', 'three|four'");
10581 ok(r == S_OK, "failed\n");
10582
10583 /* FileCost:short */
10584 r = add_directory_entry(hdb, "'SubDir4', 'TARGETDIR', 'five|six'");
10585 ok(r == S_OK, "failed\n");
10586
10587 /* FileCost:long */
10588 r = add_directory_entry(hdb, "'SubDir5', 'TARGETDIR', 'seven|eight'");
10589 ok(r == S_OK, "failed\n");
10590
10591 /* CostFinalize:short */
10592 r = add_directory_entry(hdb, "'SubDir6', 'TARGETDIR', 'nine|ten'");
10593 ok(r == S_OK, "failed\n");
10594
10595 /* CostFinalize:long */
10596 r = add_directory_entry(hdb, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
10597 ok(r == S_OK, "failed\n");
10598
10599 MsiDatabaseCommit(hdb);
10600
10601 hpkg = package_from_db(hdb);
10602 ok(hpkg, "failed to create package\n");
10603
10604 MsiCloseHandle(hdb);
10605
10606 CreateDirectoryA("one", NULL);
10607 CreateDirectoryA("four", NULL);
10608
10609 r = MsiDoAction(hpkg, "CostInitialize");
10610 ok(r == ERROR_SUCCESS, "file cost failed\n");
10611
10612 CreateDirectory("five", NULL);
10613 CreateDirectory("eight", NULL);
10614
10615 r = MsiDoAction(hpkg, "FileCost");
10616 ok(r == ERROR_SUCCESS, "file cost failed\n");
10617
10618 CreateDirectory("nine", NULL);
10619 CreateDirectory("twelve", NULL);
10620
10621 r = MsiDoAction(hpkg, "CostFinalize");
10622 ok(r == ERROR_SUCCESS, "file cost failed\n");
10623
10624 /* neither short nor long source directories exist */
10625 size = MAX_PATH;
10626 lstrcpyA(path, "kiwi");
10627 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10628 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10629 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10630 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10631
10632 CreateDirectoryA("short", NULL);
10633
10634 /* short source directory exists */
10635 size = MAX_PATH;
10636 lstrcpyA(path, "kiwi");
10637 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10638 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10639 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10640 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10641
10642 CreateDirectoryA("long", NULL);
10643
10644 /* both short and long source directories exist */
10645 size = MAX_PATH;
10646 lstrcpyA(path, "kiwi");
10647 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10648 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10649 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10650 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10651
10652 lstrcpyA(subsrc, cwd);
10653 lstrcatA(subsrc, "two");
10654 lstrcatA(subsrc, "\\");
10655
10656 /* short dir exists before CostInitialize */
10657 size = MAX_PATH;
10658 lstrcpyA(path, "kiwi");
10659 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10660 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10661 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10662 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10663
10664 lstrcpyA(subsrc, cwd);
10665 lstrcatA(subsrc, "four");
10666 lstrcatA(subsrc, "\\");
10667
10668 /* long dir exists before CostInitialize */
10669 size = MAX_PATH;
10670 lstrcpyA(path, "kiwi");
10671 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
10672 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10673 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10674 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10675
10676 lstrcpyA(subsrc, cwd);
10677 lstrcatA(subsrc, "six");
10678 lstrcatA(subsrc, "\\");
10679
10680 /* short dir exists before FileCost */
10681 size = MAX_PATH;
10682 lstrcpyA(path, "kiwi");
10683 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
10684 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10685 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10686 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10687
10688 lstrcpyA(subsrc, cwd);
10689 lstrcatA(subsrc, "eight");
10690 lstrcatA(subsrc, "\\");
10691
10692 /* long dir exists before FileCost */
10693 size = MAX_PATH;
10694 lstrcpyA(path, "kiwi");
10695 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
10696 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10697 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10698 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10699
10700 lstrcpyA(subsrc, cwd);
10701 lstrcatA(subsrc, "ten");
10702 lstrcatA(subsrc, "\\");
10703
10704 /* short dir exists before CostFinalize */
10705 size = MAX_PATH;
10706 lstrcpyA(path, "kiwi");
10707 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
10708 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10709 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10710 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10711
10712 lstrcpyA(subsrc, cwd);
10713 lstrcatA(subsrc, "twelve");
10714 lstrcatA(subsrc, "\\");
10715
10716 /* long dir exists before CostFinalize */
10717 size = MAX_PATH;
10718 lstrcpyA(path, "kiwi");
10719 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
10720 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10721 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10722 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10723
10724 MsiCloseHandle(hpkg);
10725 RemoveDirectoryA("short");
10726 RemoveDirectoryA("long");
10727 RemoveDirectoryA("one");
10728 RemoveDirectoryA("four");
10729 RemoveDirectoryA("five");
10730 RemoveDirectoryA("eight");
10731 RemoveDirectoryA("nine");
10732 RemoveDirectoryA("twelve");
10733
10734 /* short file names */
10735
10736 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
10737 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10738
10739 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
10740
10741 hpkg = package_from_db(hdb);
10742 ok(hpkg, "failed to create package\n");
10743
10744 MsiCloseHandle(hdb);
10745
10746 CreateDirectoryA("one", NULL);
10747 CreateDirectoryA("four", NULL);
10748
10749 r = MsiDoAction(hpkg, "CostInitialize");
10750 ok(r == ERROR_SUCCESS, "file cost failed\n");
10751
10752 CreateDirectory("five", NULL);
10753 CreateDirectory("eight", NULL);
10754
10755 r = MsiDoAction(hpkg, "FileCost");
10756 ok(r == ERROR_SUCCESS, "file cost failed\n");
10757
10758 CreateDirectory("nine", NULL);
10759 CreateDirectory("twelve", NULL);
10760
10761 r = MsiDoAction(hpkg, "CostFinalize");
10762 ok(r == ERROR_SUCCESS, "file cost failed\n");
10763
10764 lstrcpyA(subsrc, cwd);
10765 lstrcatA(subsrc, "short");
10766 lstrcatA(subsrc, "\\");
10767
10768 /* neither short nor long source directories exist */
10769 size = MAX_PATH;
10770 lstrcpyA(path, "kiwi");
10771 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10772 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10773 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10774 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10775
10776 CreateDirectoryA("short", NULL);
10777
10778 /* short source directory exists */
10779 size = MAX_PATH;
10780 lstrcpyA(path, "kiwi");
10781 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10782 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10783 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10784 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10785
10786 CreateDirectoryA("long", NULL);
10787
10788 /* both short and long source directories exist */
10789 size = MAX_PATH;
10790 lstrcpyA(path, "kiwi");
10791 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10792 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10793 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10794 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10795
10796 lstrcpyA(subsrc, cwd);
10797 lstrcatA(subsrc, "one");
10798 lstrcatA(subsrc, "\\");
10799
10800 /* short dir exists before CostInitialize */
10801 size = MAX_PATH;
10802 lstrcpyA(path, "kiwi");
10803 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10804 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10805 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10806 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10807
10808 lstrcpyA(subsrc, cwd);
10809 lstrcatA(subsrc, "three");
10810 lstrcatA(subsrc, "\\");
10811
10812 /* long dir exists before CostInitialize */
10813 size = MAX_PATH;
10814 lstrcpyA(path, "kiwi");
10815 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
10816 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10817 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10818 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10819
10820 lstrcpyA(subsrc, cwd);
10821 lstrcatA(subsrc, "five");
10822 lstrcatA(subsrc, "\\");
10823
10824 /* short dir exists before FileCost */
10825 size = MAX_PATH;
10826 lstrcpyA(path, "kiwi");
10827 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
10828 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10829 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10830 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10831
10832 lstrcpyA(subsrc, cwd);
10833 lstrcatA(subsrc, "seven");
10834 lstrcatA(subsrc, "\\");
10835
10836 /* long dir exists before FileCost */
10837 size = MAX_PATH;
10838 lstrcpyA(path, "kiwi");
10839 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
10840 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10841 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10842 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10843
10844 lstrcpyA(subsrc, cwd);
10845 lstrcatA(subsrc, "nine");
10846 lstrcatA(subsrc, "\\");
10847
10848 /* short dir exists before CostFinalize */
10849 size = MAX_PATH;
10850 lstrcpyA(path, "kiwi");
10851 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
10852 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10853 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10854 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10855
10856 lstrcpyA(subsrc, cwd);
10857 lstrcatA(subsrc, "eleven");
10858 lstrcatA(subsrc, "\\");
10859
10860 /* long dir exists before CostFinalize */
10861 size = MAX_PATH;
10862 lstrcpyA(path, "kiwi");
10863 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
10864 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10865 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10866 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10867
10868 MsiCloseHandle(hpkg);
10869 RemoveDirectoryA("short");
10870 RemoveDirectoryA("long");
10871 RemoveDirectoryA("one");
10872 RemoveDirectoryA("four");
10873 RemoveDirectoryA("five");
10874 RemoveDirectoryA("eight");
10875 RemoveDirectoryA("nine");
10876 RemoveDirectoryA("twelve");
10877 DeleteFileA(msifile);
10878 }
10879
10880 static void test_sourcedir(void)
10881 {
10882 MSIHANDLE hdb, hpkg;
10883 CHAR package[10];
10884 CHAR path[MAX_PATH];
10885 CHAR cwd[MAX_PATH];
10886 CHAR subsrc[MAX_PATH];
10887 DWORD size;
10888 UINT r;
10889
10890 lstrcpyA(cwd, CURR_DIR);
10891 lstrcatA(cwd, "\\");
10892
10893 lstrcpyA(subsrc, cwd);
10894 lstrcatA(subsrc, "long");
10895 lstrcatA(subsrc, "\\");
10896
10897 hdb = create_package_db();
10898 ok( hdb, "failed to create database\n");
10899
10900 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
10901 ok(r == S_OK, "failed\n");
10902
10903 sprintf(package, "#%i", hdb);
10904 r = MsiOpenPackage(package, &hpkg);
10905 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10906
10907 /* properties only */
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 /* SOURCEDIR prop */
10918 size = MAX_PATH;
10919 lstrcpyA(path, "kiwi");
10920 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10921 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10922 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10923 ok(size == 0, "Expected 0, got %d\n", size);
10924
10925 r = MsiDoAction(hpkg, "CostInitialize");
10926 ok(r == ERROR_SUCCESS, "file cost failed\n");
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 /* SOURCEDIR after CostInitialize */
10937 size = MAX_PATH;
10938 lstrcpyA(path, "kiwi");
10939 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10940 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10941 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10942 ok(size == 0, "Expected 0, got %d\n", size);
10943
10944 r = MsiDoAction(hpkg, "FileCost");
10945 ok(r == ERROR_SUCCESS, "file cost failed\n");
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 /* SOURCEDIR after FileCost */
10956 size = MAX_PATH;
10957 lstrcpyA(path, "kiwi");
10958 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10959 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10960 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10961 ok(size == 0, "Expected 0, got %d\n", size);
10962
10963 r = MsiDoAction(hpkg, "CostFinalize");
10964 ok(r == ERROR_SUCCESS, "file cost failed\n");
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 /* SOURCEDIR after CostFinalize */
10975 size = MAX_PATH;
10976 lstrcpyA(path, "kiwi");
10977 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10978 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10979 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10980 ok(size == 0, "Expected 0, got %d\n", size);
10981
10982 r = MsiDoAction(hpkg, "ResolveSource");
10983 ok(r == ERROR_SUCCESS, "file cost failed\n");
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 /* SOURCEDIR after ResolveSource */
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, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10999 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11000
11001 /* random casing */
11002 size = MAX_PATH;
11003 lstrcpyA(path, "kiwi");
11004 r = MsiGetProperty(hpkg, "SoUrCeDiR", path, &size);
11005 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11006 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11007 ok(size == 0, "Expected 0, got %d\n", size);
11008
11009 MsiCloseHandle(hpkg);
11010
11011 /* reset the package state */
11012 sprintf(package, "#%i", hdb);
11013 r = MsiOpenPackage(package, &hpkg);
11014 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11015
11016 /* test how MsiGetSourcePath affects the properties */
11017
11018 /* SourceDir prop */
11019 size = MAX_PATH;
11020 lstrcpyA(path, "kiwi");
11021 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11022 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11023 todo_wine
11024 {
11025 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11026 ok(size == 0, "Expected 0, got %d\n", size);
11027 }
11028
11029 size = MAX_PATH;
11030 lstrcpyA(path, "kiwi");
11031 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11032 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11033 ok(!lstrcmpA(path, "kiwi"),
11034 "Expected path to be unchanged, got \"%s\"\n", path);
11035 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11036
11037 /* SourceDir after MsiGetSourcePath */
11038 size = MAX_PATH;
11039 lstrcpyA(path, "kiwi");
11040 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11041 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11042 todo_wine
11043 {
11044 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11045 ok(size == 0, "Expected 0, got %d\n", size);
11046 }
11047
11048 /* SOURCEDIR prop */
11049 size = MAX_PATH;
11050 lstrcpyA(path, "kiwi");
11051 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11052 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11053 todo_wine
11054 {
11055 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11056 ok(size == 0, "Expected 0, got %d\n", size);
11057 }
11058
11059 size = MAX_PATH;
11060 lstrcpyA(path, "kiwi");
11061 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11062 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11063 ok(!lstrcmpA(path, "kiwi"),
11064 "Expected path to be unchanged, got \"%s\"\n", path);
11065 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11066
11067 /* SOURCEDIR prop after MsiGetSourcePath */
11068 size = MAX_PATH;
11069 lstrcpyA(path, "kiwi");
11070 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11071 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11072 todo_wine
11073 {
11074 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11075 ok(size == 0, "Expected 0, got %d\n", size);
11076 }
11077
11078 r = MsiDoAction(hpkg, "CostInitialize");
11079 ok(r == ERROR_SUCCESS, "file cost failed\n");
11080
11081 /* SourceDir after CostInitialize */
11082 size = MAX_PATH;
11083 lstrcpyA(path, "kiwi");
11084 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11085 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11086 todo_wine
11087 {
11088 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11089 ok(size == 0, "Expected 0, got %d\n", size);
11090 }
11091
11092 size = MAX_PATH;
11093 lstrcpyA(path, "kiwi");
11094 r = MsiGetSourcePath(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 MsiGetSourcePath */
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 after CostInitialize */
11108 size = MAX_PATH;
11109 lstrcpyA(path, "kiwi");
11110 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11111 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11112 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11113 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11114
11115 /* SOURCEDIR source path still does not exist */
11116 size = MAX_PATH;
11117 lstrcpyA(path, "kiwi");
11118 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11119 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11120 ok(!lstrcmpA(path, "kiwi"),
11121 "Expected path to be unchanged, got \"%s\"\n", path);
11122 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11123
11124 r = MsiDoAction(hpkg, "FileCost");
11125 ok(r == ERROR_SUCCESS, "file cost failed\n");
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 after FileCost */
11136 size = MAX_PATH;
11137 lstrcpyA(path, "kiwi");
11138 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11139 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11140 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11141 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11142
11143 /* SOURCEDIR source path still does not exist */
11144 size = MAX_PATH;
11145 lstrcpyA(path, "kiwi");
11146 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11147 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11148 ok(!lstrcmpA(path, "kiwi"),
11149 "Expected path to be unchanged, got \"%s\"\n", path);
11150 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11151
11152 r = MsiDoAction(hpkg, "CostFinalize");
11153 ok(r == ERROR_SUCCESS, "file cost failed\n");
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 after CostFinalize */
11164 size = MAX_PATH;
11165 lstrcpyA(path, "kiwi");
11166 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11167 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11168 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11169 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11170
11171 /* SOURCEDIR source path still does not exist */
11172 size = MAX_PATH;
11173 lstrcpyA(path, "kiwi");
11174 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11175 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11176 ok(!lstrcmpA(path, "kiwi"),
11177 "Expected path to be unchanged, got \"%s\"\n", path);
11178 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11179
11180 r = MsiDoAction(hpkg, "ResolveSource");
11181 ok(r == ERROR_SUCCESS, "file cost failed\n");
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 after ResolveSource */
11192 size = MAX_PATH;
11193 lstrcpyA(path, "kiwi");
11194 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11195 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11196 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11197 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11198
11199 /* SOURCEDIR source path still does not exist */
11200 size = MAX_PATH;
11201 lstrcpyA(path, "kiwi");
11202 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11203 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11204 ok(!lstrcmpA(path, "kiwi"),
11205 "Expected path to be unchanged, got \"%s\"\n", path);
11206 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11207
11208 MsiCloseHandle(hdb);
11209 MsiCloseHandle(hpkg);
11210 DeleteFileA(msifile);
11211 }
11212
11213 struct access_res
11214 {
11215 BOOL gothandle;
11216 DWORD lasterr;
11217 BOOL ignore;
11218 };
11219
11220 static const struct access_res create[16] =
11221 {
11222 { TRUE, ERROR_SUCCESS, TRUE },
11223 { TRUE, ERROR_SUCCESS, TRUE },
11224 { TRUE, ERROR_SUCCESS, FALSE },
11225 { TRUE, ERROR_SUCCESS, FALSE },
11226 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11227 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11228 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11229 { TRUE, ERROR_SUCCESS, FALSE },
11230 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11231 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11232 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11233 { TRUE, ERROR_SUCCESS, TRUE },
11234 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11235 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11236 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11237 { TRUE, ERROR_SUCCESS, TRUE }
11238 };
11239
11240 static const struct access_res create_commit[16] =
11241 {
11242 { TRUE, ERROR_SUCCESS, TRUE },
11243 { TRUE, ERROR_SUCCESS, TRUE },
11244 { TRUE, ERROR_SUCCESS, FALSE },
11245 { TRUE, ERROR_SUCCESS, FALSE },
11246 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11247 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11248 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11249 { TRUE, ERROR_SUCCESS, FALSE },
11250 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11251 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11252 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11253 { TRUE, ERROR_SUCCESS, TRUE },
11254 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11255 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11256 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11257 { TRUE, ERROR_SUCCESS, TRUE }
11258 };
11259
11260 static const struct access_res create_close[16] =
11261 {
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, FALSE },
11270 { TRUE, ERROR_SUCCESS, FALSE },
11271 { TRUE, ERROR_SUCCESS, FALSE },
11272 { TRUE, ERROR_SUCCESS, FALSE },
11273 { TRUE, ERROR_SUCCESS, FALSE },
11274 { TRUE, ERROR_SUCCESS, FALSE },
11275 { TRUE, ERROR_SUCCESS, FALSE },
11276 { TRUE, ERROR_SUCCESS, FALSE },
11277 { TRUE, ERROR_SUCCESS }
11278 };
11279
11280 static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line)
11281 {
11282 DWORD access = 0, share = 0;
11283 DWORD lasterr;
11284 HANDLE hfile;
11285 int i, j, idx = 0;
11286
11287 for (i = 0; i < 4; i++)
11288 {
11289 if (i == 0) access = 0;
11290 if (i == 1) access = GENERIC_READ;
11291 if (i == 2) access = GENERIC_WRITE;
11292 if (i == 3) access = GENERIC_READ | GENERIC_WRITE;
11293
11294 for (j = 0; j < 4; j++)
11295 {
11296 if (ares[idx].ignore)
11297 continue;
11298
11299 if (j == 0) share = 0;
11300 if (j == 1) share = FILE_SHARE_READ;
11301 if (j == 2) share = FILE_SHARE_WRITE;
11302 if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE;
11303
11304 SetLastError(0xdeadbeef);
11305 hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
11306 FILE_ATTRIBUTE_NORMAL, 0);
11307 lasterr = GetLastError();
11308
11309 ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
11310 "(%d, handle, %d): Expected %d, got %d\n",
11311 line, idx, ares[idx].gothandle,
11312 (hfile != INVALID_HANDLE_VALUE));
11313
11314 ok(lasterr == ares[idx].lasterr ||
11315 lasterr == 0xdeadbeef, /* win9x */
11316 "(%d, lasterr, %d): Expected %d, got %d\n",
11317 line, idx, ares[idx].lasterr, lasterr);
11318
11319 CloseHandle(hfile);
11320 idx++;
11321 }
11322 }
11323 }
11324
11325 #define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
11326
11327 static void test_access(void)
11328 {
11329 MSIHANDLE hdb;
11330 UINT r;
11331
11332 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
11333 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11334
11335 test_file_access(msifile, create);
11336
11337 r = MsiDatabaseCommit(hdb);
11338 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11339
11340 test_file_access(msifile, create_commit);
11341
11342 MsiCloseHandle(hdb);
11343
11344 test_file_access(msifile, create_close);
11345
11346 DeleteFileA(msifile);
11347
11348 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATEDIRECT, &hdb);
11349 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11350
11351 test_file_access(msifile, create);
11352
11353 r = MsiDatabaseCommit(hdb);
11354 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11355
11356 test_file_access(msifile, create_commit);
11357
11358 MsiCloseHandle(hdb);
11359
11360 test_file_access(msifile, create_close);
11361
11362 DeleteFileA(msifile);
11363 }
11364
11365 static void test_emptypackage(void)
11366 {
11367 MSIHANDLE hpkg = 0, hdb = 0, hsuminfo = 0;
11368 MSIHANDLE hview = 0, hrec = 0;
11369 MSICONDITION condition;
11370 CHAR buffer[MAX_PATH];
11371 DWORD size;
11372 UINT r;
11373
11374 r = MsiOpenPackageA("", &hpkg);
11375 todo_wine
11376 {
11377 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11378 }
11379
11380 hdb = MsiGetActiveDatabase(hpkg);
11381 todo_wine
11382 {
11383 ok(hdb != 0, "Expected a valid database handle\n");
11384 }
11385
11386 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Tables`", &hview);
11387 todo_wine
11388 {
11389 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11390 }
11391 r = MsiViewExecute(hview, 0);
11392 todo_wine
11393 {
11394 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11395 }
11396
11397 r = MsiViewFetch(hview, &hrec);
11398 todo_wine
11399 {
11400 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11401 }
11402
11403 buffer[0] = 0;
11404 size = MAX_PATH;
11405 r = MsiRecordGetString(hrec, 1, buffer, &size);
11406 todo_wine
11407 {
11408 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11409 ok(!lstrcmpA(buffer, "_Property"),
11410 "Expected \"_Property\", got \"%s\"\n", buffer);
11411 }
11412
11413 MsiCloseHandle(hrec);
11414
11415 r = MsiViewFetch(hview, &hrec);
11416 todo_wine
11417 {
11418 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11419 }
11420
11421 size = MAX_PATH;
11422 r = MsiRecordGetString(hrec, 1, buffer, &size);
11423 todo_wine
11424 {
11425 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11426 ok(!lstrcmpA(buffer, "#_FolderCache"),
11427 "Expected \"_Property\", got \"%s\"\n", buffer);
11428 }
11429
11430 MsiCloseHandle(hrec);
11431 MsiViewClose(hview);
11432 MsiCloseHandle(hview);
11433
11434 condition = MsiDatabaseIsTablePersistentA(hdb, "_Property");
11435 todo_wine
11436 {
11437 ok(condition == MSICONDITION_FALSE,
11438 "Expected MSICONDITION_FALSE, got %d\n", condition);
11439 }
11440
11441 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
11442 todo_wine
11443 {
11444 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11445 }
11446 r = MsiViewExecute(hview, 0);
11447 todo_wine
11448 {
11449 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11450 }
11451
11452 /* _Property table is not empty */
11453 r = MsiViewFetch(hview, &hrec);
11454 todo_wine
11455 {
11456 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11457 }
11458
11459 MsiCloseHandle(hrec);
11460 MsiViewClose(hview);
11461 MsiCloseHandle(hview);
11462
11463 condition = MsiDatabaseIsTablePersistentA(hdb, "#_FolderCache");
11464 todo_wine
11465 {
11466 ok(condition == MSICONDITION_FALSE,
11467 "Expected MSICONDITION_FALSE, got %d\n", condition);
11468 }
11469
11470 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `#_FolderCache`", &hview);
11471 todo_wine
11472 {
11473 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11474 }
11475 r = MsiViewExecute(hview, 0);
11476 todo_wine
11477 {
11478 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11479 }
11480
11481 /* #_FolderCache is not empty */
11482 r = MsiViewFetch(hview, &hrec);
11483 todo_wine
11484 {
11485 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11486 }
11487
11488 MsiCloseHandle(hrec);
11489 MsiViewClose(hview);
11490 MsiCloseHandle(hview);
11491
11492 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Streams`", &hview);
11493 todo_wine
11494 {
11495 ok(r == ERROR_BAD_QUERY_SYNTAX,
11496 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11497 }
11498
11499 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Storages`", &hview);
11500 todo_wine
11501 {
11502 ok(r == ERROR_BAD_QUERY_SYNTAX,
11503 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11504 }
11505
11506 r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsuminfo);
11507 todo_wine
11508 {
11509 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
11510 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
11511 }
11512
11513 MsiCloseHandle(hsuminfo);
11514
11515 r = MsiDatabaseCommit(hdb);
11516 todo_wine
11517 {
11518 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11519 }
11520
11521 MsiCloseHandle(hdb);
11522 MsiCloseHandle(hpkg);
11523 }
11524
11525 static void test_MsiGetProductProperty(void)
11526 {
11527 MSIHANDLE hprod, hdb;
11528 CHAR val[MAX_PATH];
11529 CHAR path[MAX_PATH];
11530 CHAR query[MAX_PATH];
11531 CHAR keypath[MAX_PATH*2];
11532 CHAR prodcode[MAX_PATH];
11533 CHAR prod_squashed[MAX_PATH];
11534 HKEY prodkey, userkey, props;
11535 DWORD size;
11536 LONG res;
11537 UINT r;
11538 SC_HANDLE scm;
11539
11540 scm = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
11541 if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
11542 {
11543 win_skip("Different registry keys on Win9x and WinMe\n");
11544 return;
11545 }
11546 CloseServiceHandle(scm);
11547
11548 GetCurrentDirectoryA(MAX_PATH, path);
11549 lstrcatA(path, "\\");
11550
11551 create_test_guid(prodcode, prod_squashed);
11552
11553 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
11554 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11555
11556 r = MsiDatabaseCommit(hdb);
11557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11558
11559 r = set_summary_info(hdb);
11560 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11561
11562 r = run_query(hdb,
11563 "CREATE TABLE `Directory` ( "
11564 "`Directory` CHAR(255) NOT NULL, "
11565 "`Directory_Parent` CHAR(255), "
11566 "`DefaultDir` CHAR(255) NOT NULL "
11567 "PRIMARY KEY `Directory`)");
11568 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11569
11570 r = run_query(hdb,
11571 "CREATE TABLE `Property` ( "
11572 "`Property` CHAR(72) NOT NULL, "
11573 "`Value` CHAR(255) "
11574 "PRIMARY KEY `Property`)");
11575 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11576
11577 sprintf(query, "INSERT INTO `Property` "
11578 "(`Property`, `Value`) "
11579 "VALUES( 'ProductCode', '%s' )", prodcode);
11580 r = run_query(hdb, query);
11581 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11582
11583 r = MsiDatabaseCommit(hdb);
11584 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11585
11586 MsiCloseHandle(hdb);
11587
11588 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
11589 lstrcatA(keypath, prod_squashed);
11590
11591 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
11592 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11593
11594 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
11595 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
11596 lstrcatA(keypath, prod_squashed);
11597
11598 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
11599 if (res == ERROR_ACCESS_DENIED)
11600 {
11601 skip("Not enough rights to perform tests\n");
11602 RegDeleteKeyA(prodkey, "");
11603 RegCloseKey(prodkey);
11604 return;
11605 }
11606 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11607
11608 res = RegCreateKeyA(userkey, "InstallProperties", &props);
11609 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11610
11611 lstrcpyA(val, path);
11612 lstrcatA(val, "\\");
11613 lstrcatA(val, msifile);
11614 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
11615 (const BYTE *)val, lstrlenA(val) + 1);
11616 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11617
11618 hprod = 0xdeadbeef;
11619 r = MsiOpenProductA(prodcode, &hprod);
11620 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11621 ok(hprod != 0 && hprod != 0xdeadbeef, "Expected a valid product handle\n");
11622
11623 /* hProduct is invalid */
11624 size = MAX_PATH;
11625 lstrcpyA(val, "apple");
11626 r = MsiGetProductPropertyA(0xdeadbeef, "ProductCode", val, &size);
11627 ok(r == ERROR_INVALID_HANDLE,
11628 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
11629 ok(!lstrcmpA(val, "apple"),
11630 "Expected val to be unchanged, got \"%s\"\n", val);
11631 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11632
11633 /* szProperty is NULL */
11634 size = MAX_PATH;
11635 lstrcpyA(val, "apple");
11636 r = MsiGetProductPropertyA(hprod, NULL, val, &size);
11637 ok(r == ERROR_INVALID_PARAMETER,
11638 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11639 ok(!lstrcmpA(val, "apple"),
11640 "Expected val to be unchanged, got \"%s\"\n", val);
11641 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11642
11643 /* szProperty is empty */
11644 size = MAX_PATH;
11645 lstrcpyA(val, "apple");
11646 r = MsiGetProductPropertyA(hprod, "", val, &size);
11647 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11648 ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
11649 ok(size == 0, "Expected 0, got %d\n", size);
11650
11651 /* get the property */
11652 size = MAX_PATH;
11653 lstrcpyA(val, "apple");
11654 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11655 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11656 ok(!lstrcmpA(val, prodcode),
11657 "Expected \"%s\", got \"%s\"\n", prodcode, val);
11658 ok(size == lstrlenA(prodcode),
11659 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11660
11661 /* lpValueBuf is NULL */
11662 size = MAX_PATH;
11663 r = MsiGetProductPropertyA(hprod, "ProductCode", NULL, &size);
11664 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11665 ok(size == lstrlenA(prodcode),
11666 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11667
11668 /* pcchValueBuf is NULL */
11669 lstrcpyA(val, "apple");
11670 r = MsiGetProductPropertyA(hprod, "ProductCode", val, NULL);
11671 ok(r == ERROR_INVALID_PARAMETER,
11672 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11673 ok(!lstrcmpA(val, "apple"),
11674 "Expected val to be unchanged, got \"%s\"\n", val);
11675 ok(size == lstrlenA(prodcode),
11676 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11677
11678 /* pcchValueBuf is too small */
11679 size = 4;
11680 lstrcpyA(val, "apple");
11681 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11682 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
11683 ok(!strncmp(val, prodcode, 3),
11684 "Expected first 3 chars of \"%s\", got \"%s\"\n", prodcode, val);
11685 ok(size == lstrlenA(prodcode),
11686 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11687
11688 /* pcchValueBuf does not leave room for NULL terminator */
11689 size = lstrlenA(prodcode);
11690 lstrcpyA(val, "apple");
11691 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11692 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
11693 ok(!strncmp(val, prodcode, lstrlenA(prodcode) - 1),
11694 "Expected first 37 chars of \"%s\", got \"%s\"\n", prodcode, val);
11695 ok(size == lstrlenA(prodcode),
11696 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11697
11698 /* pcchValueBuf has enough room for NULL terminator */
11699 size = lstrlenA(prodcode) + 1;
11700 lstrcpyA(val, "apple");
11701 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11702 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11703 ok(!lstrcmpA(val, prodcode),
11704 "Expected \"%s\", got \"%s\"\n", prodcode, val);
11705 ok(size == lstrlenA(prodcode),
11706 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11707
11708 /* nonexistent property */
11709 size = MAX_PATH;
11710 lstrcpyA(val, "apple");
11711 r = MsiGetProductPropertyA(hprod, "IDontExist", val, &size);
11712 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11713 ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
11714 ok(size == 0, "Expected 0, got %d\n", size);
11715
11716 r = MsiSetPropertyA(hprod, "NewProperty", "value");
11717 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11718
11719 /* non-product property set */
11720 size = MAX_PATH;
11721 lstrcpyA(val, "apple");
11722 r = MsiGetProductPropertyA(hprod, "NewProperty", val, &size);
11723 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11724 ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
11725 ok(size == 0, "Expected 0, got %d\n", size);
11726
11727 r = MsiSetPropertyA(hprod, "ProductCode", "value");
11728 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11729
11730 /* non-product property that is also a product property set */
11731 size = MAX_PATH;
11732 lstrcpyA(val, "apple");
11733 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11734 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11735 ok(!lstrcmpA(val, prodcode),
11736 "Expected \"%s\", got \"%s\"\n", prodcode, val);
11737 ok(size == lstrlenA(prodcode),
11738 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11739
11740 MsiCloseHandle(hprod);
11741
11742 RegDeleteValueA(props, "LocalPackage");
11743 RegDeleteKeyA(props, "");
11744 RegCloseKey(props);
11745 RegDeleteKeyA(userkey, "");
11746 RegCloseKey(userkey);
11747 RegDeleteKeyA(prodkey, "");
11748 RegCloseKey(prodkey);
11749 DeleteFileA(msifile);
11750 }
11751
11752 static void test_MsiSetProperty(void)
11753 {
11754 MSIHANDLE hpkg, hdb, hrec;
11755 CHAR buf[MAX_PATH];
11756 LPCSTR query;
11757 DWORD size;
11758 UINT r;
11759
11760 hpkg = package_from_db(create_package_db());
11761 ok(hpkg != 0, "Expected a valid package\n");
11762
11763 /* invalid hInstall */
11764 r = MsiSetPropertyA(0, "Prop", "Val");
11765 ok(r == ERROR_INVALID_HANDLE,
11766 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
11767
11768 /* invalid hInstall */
11769 r = MsiSetPropertyA(0xdeadbeef, "Prop", "Val");
11770 ok(r == ERROR_INVALID_HANDLE,
11771 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
11772
11773 /* szName is NULL */
11774 r = MsiSetPropertyA(hpkg, NULL, "Val");
11775 ok(r == ERROR_INVALID_PARAMETER,
11776 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11777
11778 /* both szName and szValue are NULL */
11779 r = MsiSetPropertyA(hpkg, NULL, NULL);
11780 ok(r == ERROR_INVALID_PARAMETER,
11781 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11782
11783 /* szName is empty */
11784 r = MsiSetPropertyA(hpkg, "", "Val");
11785 ok(r == ERROR_FUNCTION_FAILED,
11786 "Expected ERROR_FUNCTION_FAILED, got %d\n", r);
11787
11788 /* szName is empty and szValue is NULL */
11789 r = MsiSetPropertyA(hpkg, "", NULL);
11790 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11791
11792 /* set a property */
11793 r = MsiSetPropertyA(hpkg, "Prop", "Val");
11794 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11795
11796 /* get the property */
11797 size = MAX_PATH;
11798 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
11799 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11800 ok(!lstrcmpA(buf, "Val"), "Expected \"Val\", got \"%s\"\n", buf);
11801 ok(size == 3, "Expected 3, got %d\n", size);
11802
11803 /* update the property */
11804 r = MsiSetPropertyA(hpkg, "Prop", "Nuvo");
11805 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11806
11807 /* get the property */
11808 size = MAX_PATH;
11809 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
11810 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11811 ok(!lstrcmpA(buf, "Nuvo"), "Expected \"Nuvo\", got \"%s\"\n", buf);
11812 ok(size == 4, "Expected 4, got %d\n", size);
11813
11814 hdb = MsiGetActiveDatabase(hpkg);
11815 ok(hdb != 0, "Expected a valid database handle\n");
11816
11817 /* set prop is not in the _Property table */
11818 query = "SELECT * FROM `_Property` WHERE `Property` = 'Prop'";
11819 r = do_query(hdb, query, &hrec);
11820 ok(r == ERROR_BAD_QUERY_SYNTAX,
11821 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11822
11823 /* set prop is not in the Property table */
11824 query = "SELECT * FROM `Property` WHERE `Property` = 'Prop'";
11825 r = do_query(hdb, query, &hrec);
11826 ok(r == ERROR_BAD_QUERY_SYNTAX,
11827 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11828
11829 MsiCloseHandle(hdb);
11830
11831 /* szValue is an empty string */
11832 r = MsiSetPropertyA(hpkg, "Prop", "");
11833 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11834
11835 /* try to get the property */
11836 size = MAX_PATH;
11837 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
11838 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11839 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
11840 ok(size == 0, "Expected 0, got %d\n", size);
11841
11842 /* reset the property */
11843 r = MsiSetPropertyA(hpkg, "Prop", "BlueTap");
11844 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11845
11846 /* delete the property */
11847 r = MsiSetPropertyA(hpkg, "Prop", NULL);
11848 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11849
11850 /* try to get the property */
11851 size = MAX_PATH;
11852 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
11853 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11854 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
11855 ok(size == 0, "Expected 0, got %d\n", size);
11856
11857 MsiCloseHandle(hpkg);
11858 DeleteFileA(msifile);
11859 }
11860
11861 static void test_MsiApplyMultiplePatches(void)
11862 {
11863 UINT r, type = GetDriveType(NULL);
11864
11865 if (!pMsiApplyMultiplePatchesA) {
11866 win_skip("MsiApplyMultiplePatchesA not found\n");
11867 return;
11868 }
11869
11870 r = pMsiApplyMultiplePatchesA(NULL, NULL, NULL);
11871 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
11872
11873 r = pMsiApplyMultiplePatchesA("", NULL, NULL);
11874 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
11875
11876 r = pMsiApplyMultiplePatchesA(";", NULL, NULL);
11877 todo_wine
11878 {
11879 if (type == DRIVE_FIXED)
11880 ok(r == ERROR_PATH_NOT_FOUND,
11881 "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
11882 else
11883 ok(r == ERROR_INVALID_NAME,
11884 "Expected ERROR_INVALID_NAME, got %u\n", r);
11885 }
11886
11887 r = pMsiApplyMultiplePatchesA(" ;", NULL, NULL);
11888 todo_wine
11889 {
11890 if (type == DRIVE_FIXED)
11891 ok(r == ERROR_PATCH_PACKAGE_OPEN_FAILED,
11892 "Expected ERROR_PATCH_PACKAGE_OPEN_FAILED, got %u\n", r);
11893 else
11894 ok(r == ERROR_INVALID_NAME,
11895 "Expected ERROR_INVALID_NAME, got %u\n", r);
11896 }
11897
11898 r = pMsiApplyMultiplePatchesA(";;", NULL, NULL);
11899 todo_wine
11900 {
11901 if (type == DRIVE_FIXED)
11902 ok(r == ERROR_PATH_NOT_FOUND,
11903 "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
11904 else
11905 ok(r == ERROR_INVALID_NAME,
11906 "Expected ERROR_INVALID_NAME, got %u\n", r);
11907 }
11908
11909 r = pMsiApplyMultiplePatchesA("nosuchpatchpackage;", NULL, NULL);
11910 todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
11911
11912 r = pMsiApplyMultiplePatchesA(";nosuchpatchpackage", NULL, NULL);
11913 todo_wine
11914 {
11915 if (type == DRIVE_FIXED)
11916 ok(r == ERROR_PATH_NOT_FOUND,
11917 "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
11918 else
11919 ok(r == ERROR_INVALID_NAME,
11920 "Expected ERROR_INVALID_NAME, got %u\n", r);
11921 }
11922
11923 r = pMsiApplyMultiplePatchesA("nosuchpatchpackage;nosuchpatchpackage", NULL, NULL);
11924 todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
11925
11926 r = pMsiApplyMultiplePatchesA(" nosuchpatchpackage ; nosuchpatchpackage ", NULL, NULL);
11927 todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
11928 }
11929
11930 static void test_MsiApplyPatch(void)
11931 {
11932 UINT r;
11933
11934 r = MsiApplyPatch(NULL, NULL, INSTALLTYPE_DEFAULT, NULL);
11935 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
11936
11937 r = MsiApplyPatch("", NULL, INSTALLTYPE_DEFAULT, NULL);
11938 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
11939 }
11940
11941 START_TEST(package)
11942 {
11943 STATEMGRSTATUS status;
11944 BOOL ret = FALSE;
11945
11946 init_functionpointers();
11947
11948 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
11949
11950 /* Create a restore point ourselves so we circumvent the multitude of restore points
11951 * that would have been created by all the installation and removal tests.
11952 */
11953 if (pSRSetRestorePointA)
11954 {
11955 memset(&status, 0, sizeof(status));
11956 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
11957 }
11958
11959 test_createpackage();
11960 test_doaction();
11961 test_gettargetpath_bad();
11962 test_settargetpath();
11963 test_props();
11964 test_property_table();
11965 test_condition();
11966 test_msipackage();
11967 test_formatrecord2();
11968 test_states();
11969 test_getproperty();
11970 test_removefiles();
11971 test_appsearch();
11972 test_appsearch_complocator();
11973 test_appsearch_reglocator();
11974 test_appsearch_inilocator();
11975 test_appsearch_drlocator();
11976 test_featureparents();
11977 test_installprops();
11978 test_launchconditions();
11979 test_ccpsearch();
11980 test_complocator();
11981 test_MsiGetSourcePath();
11982 test_shortlongsource();
11983 test_sourcedir();
11984 test_access();
11985 test_emptypackage();
11986 test_MsiGetProductProperty();
11987 test_MsiSetProperty();
11988 test_MsiApplyMultiplePatches();
11989 test_MsiApplyPatch();
11990
11991 if (pSRSetRestorePointA && ret)
11992 {
11993 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
11994 if (ret)
11995 remove_restore_point(status.llSequenceNumber);
11996 }
11997 }