msi: Add more tests for the AppSearch action.
[wine/wine64.git] / dlls / msi / tests / package.c
blobfcb1969af4053124334f80de2edce889fe498565
1 /*
2 * tests for Microsoft Installer functionality
4 * Copyright 2005 Mike McCormack for CodeWeavers
5 * Copyright 2005 Aric Stewart for CodeWeavers
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.
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.
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
22 #define COBJMACROS
24 #include <stdio.h>
25 #include <windows.h>
26 #include <msidefs.h>
27 #include <msi.h>
28 #include <msiquery.h>
30 #include "wine/test.h"
32 static const char msifile[] = "winetest.msi";
33 char CURR_DIR[MAX_PATH];
35 static void get_user_sid(LPSTR *usersid)
37 HANDLE token;
38 BYTE buf[1024];
39 DWORD size;
40 PTOKEN_USER user;
41 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
42 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
44 *usersid = NULL;
45 pConvertSidToStringSidA = (void *)GetProcAddress(hadvapi32, "ConvertSidToStringSidA");
46 if (!pConvertSidToStringSidA)
47 return;
49 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
50 size = sizeof(buf);
51 GetTokenInformation(token, TokenUser, (void *)buf, size, &size);
52 user = (PTOKEN_USER)buf;
53 pConvertSidToStringSidA(user->User.Sid, usersid);
56 /* RegDeleteTreeW from dlls/advapi32/registry.c */
57 LSTATUS WINAPI package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
59 LONG ret;
60 DWORD dwMaxSubkeyLen, dwMaxValueLen;
61 DWORD dwMaxLen, dwSize;
62 WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
63 HKEY hSubKey = hKey;
65 if(lpszSubKey)
67 ret = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
68 if (ret) return ret;
71 ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
72 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
73 if (ret) goto cleanup;
75 dwMaxSubkeyLen++;
76 dwMaxValueLen++;
77 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
78 if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
80 /* Name too big: alloc a buffer for it */
81 if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
83 ret = ERROR_NOT_ENOUGH_MEMORY;
84 goto cleanup;
88 /* Recursively delete all the subkeys */
89 while (TRUE)
91 dwSize = dwMaxLen;
92 if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
93 NULL, NULL, NULL)) break;
95 ret = package_RegDeleteTreeW(hSubKey, lpszName);
96 if (ret) goto cleanup;
99 if (lpszSubKey)
100 ret = RegDeleteKeyW(hKey, lpszSubKey);
101 else
102 while (TRUE)
104 dwSize = dwMaxLen;
105 if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
106 NULL, NULL, NULL, NULL)) break;
108 ret = RegDeleteValueW(hKey, lpszName);
109 if (ret) goto cleanup;
112 cleanup:
113 if (lpszName != szNameBuf)
114 HeapFree(GetProcessHeap(), 0, lpszName);
115 if(lpszSubKey)
116 RegCloseKey(hSubKey);
117 return ret;
120 static BOOL squash_guid(LPCWSTR in, LPWSTR out)
122 DWORD i,n=1;
123 GUID guid;
125 if (FAILED(CLSIDFromString((LPOLESTR)in, &guid)))
126 return FALSE;
128 for(i=0; i<8; i++)
129 out[7-i] = in[n++];
130 n++;
131 for(i=0; i<4; i++)
132 out[11-i] = in[n++];
133 n++;
134 for(i=0; i<4; i++)
135 out[15-i] = in[n++];
136 n++;
137 for(i=0; i<2; i++)
139 out[17+i*2] = in[n++];
140 out[16+i*2] = in[n++];
142 n++;
143 for( ; i<8; i++)
145 out[17+i*2] = in[n++];
146 out[16+i*2] = in[n++];
148 out[32]=0;
149 return TRUE;
152 static void set_component_path(LPCSTR filename, MSIINSTALLCONTEXT context,
153 LPCSTR guid, LPSTR usersid, BOOL dir)
155 WCHAR guidW[MAX_PATH];
156 WCHAR squashedW[MAX_PATH];
157 CHAR squashed[MAX_PATH];
158 CHAR comppath[MAX_PATH];
159 CHAR prodpath[MAX_PATH];
160 CHAR path[MAX_PATH];
161 LPCSTR prod = NULL;
162 HKEY hkey;
164 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
165 squash_guid(guidW, squashedW);
166 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
168 if (context == MSIINSTALLCONTEXT_MACHINE)
170 prod = "3D0DAE300FACA1300AD792060BCDAA92";
171 sprintf(comppath,
172 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
173 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
174 lstrcpyA(prodpath,
175 "SOFTWARE\\Classes\\Installer\\"
176 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
178 else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
180 prod = "7D2F387510109040002000060BECB6AB";
181 sprintf(comppath,
182 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
183 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
184 sprintf(prodpath,
185 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
186 "Installer\\%s\\Installer\\Products\\"
187 "7D2F387510109040002000060BECB6AB", usersid);
189 else if (context == MSIINSTALLCONTEXT_USERMANAGED)
191 prod = "7D2F387510109040002000060BECB6AB";
192 sprintf(comppath,
193 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
194 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
195 sprintf(prodpath,
196 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
197 "Installer\\Managed\\%s\\Installer\\Products\\"
198 "7D2F387510109040002000060BECB6AB", usersid);
201 RegCreateKeyA(HKEY_LOCAL_MACHINE, comppath, &hkey);
203 lstrcpyA(path, CURR_DIR);
204 lstrcatA(path, "\\");
205 if (!dir) lstrcatA(path, filename);
207 RegSetValueExA(hkey, prod, 0, REG_SZ, (LPBYTE)path, lstrlenA(path));
208 RegCloseKey(hkey);
210 RegCreateKeyA(HKEY_LOCAL_MACHINE, prodpath, &hkey);
211 RegCloseKey(hkey);
214 static void delete_component_path(LPCSTR guid, MSIINSTALLCONTEXT context, LPSTR usersid)
216 WCHAR guidW[MAX_PATH];
217 WCHAR squashedW[MAX_PATH];
218 WCHAR substrW[MAX_PATH];
219 CHAR squashed[MAX_PATH];
220 CHAR comppath[MAX_PATH];
221 CHAR prodpath[MAX_PATH];
223 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
224 squash_guid(guidW, squashedW);
225 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
227 if (context == MSIINSTALLCONTEXT_MACHINE)
229 sprintf(comppath,
230 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
231 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
232 lstrcpyA(prodpath,
233 "SOFTWARE\\Classes\\Installer\\"
234 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
236 else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
238 sprintf(comppath,
239 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
240 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
241 sprintf(prodpath,
242 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
243 "Installer\\%s\\Installer\\Products\\"
244 "7D2F387510109040002000060BECB6AB", usersid);
246 else if (context == MSIINSTALLCONTEXT_USERMANAGED)
248 sprintf(comppath,
249 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
250 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
251 sprintf(prodpath,
252 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
253 "Installer\\Managed\\%s\\Installer\\Products\\"
254 "7D2F387510109040002000060BECB6AB", usersid);
257 MultiByteToWideChar(CP_ACP, 0, comppath, -1, substrW, MAX_PATH);
258 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW);
260 MultiByteToWideChar(CP_ACP, 0, prodpath, -1, substrW, MAX_PATH);
261 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW);
264 static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec)
266 MSIHANDLE hview = 0;
267 UINT r, ret;
269 /* open a select query */
270 r = MsiDatabaseOpenView(hdb, query, &hview);
271 if (r != ERROR_SUCCESS)
272 return r;
273 r = MsiViewExecute(hview, 0);
274 if (r != ERROR_SUCCESS)
275 return r;
276 ret = MsiViewFetch(hview, phrec);
277 r = MsiViewClose(hview);
278 if (r != ERROR_SUCCESS)
279 return r;
280 r = MsiCloseHandle(hview);
281 if (r != ERROR_SUCCESS)
282 return r;
283 return ret;
286 static UINT run_query( MSIHANDLE hdb, const char *query )
288 MSIHANDLE hview = 0;
289 UINT r;
291 r = MsiDatabaseOpenView(hdb, query, &hview);
292 if( r != ERROR_SUCCESS )
293 return r;
295 r = MsiViewExecute(hview, 0);
296 if( r == ERROR_SUCCESS )
297 r = MsiViewClose(hview);
298 MsiCloseHandle(hview);
299 return r;
302 static UINT create_component_table( MSIHANDLE hdb )
304 return run_query( hdb,
305 "CREATE TABLE `Component` ( "
306 "`Component` CHAR(72) NOT NULL, "
307 "`ComponentId` CHAR(38), "
308 "`Directory_` CHAR(72) NOT NULL, "
309 "`Attributes` SHORT NOT NULL, "
310 "`Condition` CHAR(255), "
311 "`KeyPath` CHAR(72) "
312 "PRIMARY KEY `Component`)" );
315 static UINT create_feature_table( MSIHANDLE hdb )
317 return run_query( hdb,
318 "CREATE TABLE `Feature` ( "
319 "`Feature` CHAR(38) NOT NULL, "
320 "`Feature_Parent` CHAR(38), "
321 "`Title` CHAR(64), "
322 "`Description` CHAR(255), "
323 "`Display` SHORT NOT NULL, "
324 "`Level` SHORT NOT NULL, "
325 "`Directory_` CHAR(72), "
326 "`Attributes` SHORT NOT NULL "
327 "PRIMARY KEY `Feature`)" );
330 static UINT create_feature_components_table( MSIHANDLE hdb )
332 return run_query( hdb,
333 "CREATE TABLE `FeatureComponents` ( "
334 "`Feature_` CHAR(38) NOT NULL, "
335 "`Component_` CHAR(72) NOT NULL "
336 "PRIMARY KEY `Feature_`, `Component_` )" );
339 static UINT create_file_table( MSIHANDLE hdb )
341 return run_query( hdb,
342 "CREATE TABLE `File` ("
343 "`File` CHAR(72) NOT NULL, "
344 "`Component_` CHAR(72) NOT NULL, "
345 "`FileName` CHAR(255) NOT NULL, "
346 "`FileSize` LONG NOT NULL, "
347 "`Version` CHAR(72), "
348 "`Language` CHAR(20), "
349 "`Attributes` SHORT, "
350 "`Sequence` SHORT NOT NULL "
351 "PRIMARY KEY `File`)" );
354 static UINT create_remove_file_table( MSIHANDLE hdb )
356 return run_query( hdb,
357 "CREATE TABLE `RemoveFile` ("
358 "`FileKey` CHAR(72) NOT NULL, "
359 "`Component_` CHAR(72) NOT NULL, "
360 "`FileName` CHAR(255) LOCALIZABLE, "
361 "`DirProperty` CHAR(72) NOT NULL, "
362 "`InstallMode` SHORT NOT NULL "
363 "PRIMARY KEY `FileKey`)" );
366 static UINT create_appsearch_table( MSIHANDLE hdb )
368 return run_query( hdb,
369 "CREATE TABLE `AppSearch` ("
370 "`Property` CHAR(72) NOT NULL, "
371 "`Signature_` CHAR(72) NOT NULL "
372 "PRIMARY KEY `Property`, `Signature_`)" );
375 static UINT create_reglocator_table( MSIHANDLE hdb )
377 return run_query( hdb,
378 "CREATE TABLE `RegLocator` ("
379 "`Signature_` CHAR(72) NOT NULL, "
380 "`Root` SHORT NOT NULL, "
381 "`Key` CHAR(255) NOT NULL, "
382 "`Name` CHAR(255), "
383 "`Type` SHORT "
384 "PRIMARY KEY `Signature_`)" );
387 static UINT create_signature_table( MSIHANDLE hdb )
389 return run_query( hdb,
390 "CREATE TABLE `Signature` ("
391 "`Signature` CHAR(72) NOT NULL, "
392 "`FileName` CHAR(255) NOT NULL, "
393 "`MinVersion` CHAR(20), "
394 "`MaxVersion` CHAR(20), "
395 "`MinSize` LONG, "
396 "`MaxSize` LONG, "
397 "`MinDate` LONG, "
398 "`MaxDate` LONG, "
399 "`Languages` CHAR(255) "
400 "PRIMARY KEY `Signature`)" );
403 static UINT create_launchcondition_table( MSIHANDLE hdb )
405 return run_query( hdb,
406 "CREATE TABLE `LaunchCondition` ("
407 "`Condition` CHAR(255) NOT NULL, "
408 "`Description` CHAR(255) NOT NULL "
409 "PRIMARY KEY `Condition`)" );
412 static UINT create_property_table( MSIHANDLE hdb )
414 return run_query( hdb,
415 "CREATE TABLE `Property` ("
416 "`Property` CHAR(72) NOT NULL, "
417 "`Value` CHAR(0) "
418 "PRIMARY KEY `Property`)" );
421 static UINT create_install_execute_sequence_table( MSIHANDLE hdb )
423 return run_query( hdb,
424 "CREATE TABLE `InstallExecuteSequence` ("
425 "`Action` CHAR(72) NOT NULL, "
426 "`Condition` CHAR(255), "
427 "`Sequence` SHORT "
428 "PRIMARY KEY `Action`)" );
431 static UINT create_media_table( MSIHANDLE hdb )
433 return run_query( hdb,
434 "CREATE TABLE `Media` ("
435 "`DiskId` SHORT NOT NULL, "
436 "`LastSequence` SHORT NOT NULL, "
437 "`DiskPrompt` CHAR(64), "
438 "`Cabinet` CHAR(255), "
439 "`VolumeLabel` CHAR(32), "
440 "`Source` CHAR(72) "
441 "PRIMARY KEY `DiskId`)" );
444 static UINT create_ccpsearch_table( MSIHANDLE hdb )
446 return run_query( hdb,
447 "CREATE TABLE `CCPSearch` ("
448 "`Signature_` CHAR(72) NOT NULL "
449 "PRIMARY KEY `Signature_`)" );
452 static UINT create_drlocator_table( MSIHANDLE hdb )
454 return run_query( hdb,
455 "CREATE TABLE `DrLocator` ("
456 "`Signature_` CHAR(72) NOT NULL, "
457 "`Parent` CHAR(72), "
458 "`Path` CHAR(255), "
459 "`Depth` SHORT "
460 "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
463 static UINT create_complocator_table( MSIHANDLE hdb )
465 return run_query( hdb,
466 "CREATE TABLE `CompLocator` ("
467 "`Signature_` CHAR(72) NOT NULL, "
468 "`ComponentId` CHAR(38) NOT NULL, "
469 "`Type` SHORT "
470 "PRIMARY KEY `Signature_`)" );
473 static UINT create_inilocator_table( MSIHANDLE hdb )
475 return run_query( hdb,
476 "CREATE TABLE `IniLocator` ("
477 "`Signature_` CHAR(72) NOT NULL, "
478 "`FileName` CHAR(255) NOT NULL, "
479 "`Section` CHAR(96)NOT NULL, "
480 "`Key` CHAR(128)NOT NULL, "
481 "`Field` SHORT, "
482 "`Type` SHORT "
483 "PRIMARY KEY `Signature_`)" );
486 static UINT add_component_entry( MSIHANDLE hdb, const char *values )
488 char insert[] = "INSERT INTO `Component` "
489 "(`Component`, `ComponentId`, `Directory_`, `Attributes`, `Condition`, `KeyPath`) "
490 "VALUES( %s )";
491 char *query;
492 UINT sz, r;
494 sz = strlen(values) + sizeof insert;
495 query = HeapAlloc(GetProcessHeap(),0,sz);
496 sprintf(query,insert,values);
497 r = run_query( hdb, query );
498 HeapFree(GetProcessHeap(), 0, query);
499 return r;
502 static UINT add_directory_entry( MSIHANDLE hdb, const char *values )
504 char insert[] = "INSERT INTO `Directory` (`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )";
505 char *query;
506 UINT sz, r;
508 sz = strlen(values) + sizeof insert;
509 query = HeapAlloc(GetProcessHeap(),0,sz);
510 sprintf(query,insert,values);
511 r = run_query( hdb, query );
512 HeapFree(GetProcessHeap(), 0, query);
513 return r;
516 static UINT add_feature_entry( MSIHANDLE hdb, const char *values )
518 char insert[] = "INSERT INTO `Feature` (`Feature`, `Feature_Parent`, "
519 "`Title`, `Description`, `Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )";
520 char *query;
521 UINT sz, r;
523 sz = strlen(values) + sizeof insert;
524 query = HeapAlloc(GetProcessHeap(),0,sz);
525 sprintf(query,insert,values);
526 r = run_query( hdb, query );
527 HeapFree(GetProcessHeap(), 0, query);
528 return r;
531 static UINT add_feature_components_entry( MSIHANDLE hdb, const char *values )
533 char insert[] = "INSERT INTO `FeatureComponents` "
534 "(`Feature_`, `Component_`) "
535 "VALUES( %s )";
536 char *query;
537 UINT sz, r;
539 sz = strlen(values) + sizeof insert;
540 query = HeapAlloc(GetProcessHeap(),0,sz);
541 sprintf(query,insert,values);
542 r = run_query( hdb, query );
543 HeapFree(GetProcessHeap(), 0, query);
544 return r;
547 static UINT add_file_entry( MSIHANDLE hdb, const char *values )
549 char insert[] = "INSERT INTO `File` "
550 "(`File`, `Component_`, `FileName`, `FileSize`, `Version`, `Language`, `Attributes`, `Sequence`) "
551 "VALUES( %s )";
552 char *query;
553 UINT sz, r;
555 sz = strlen(values) + sizeof insert;
556 query = HeapAlloc(GetProcessHeap(),0,sz);
557 sprintf(query,insert,values);
558 r = run_query( hdb, query );
559 HeapFree(GetProcessHeap(), 0, query);
560 return r;
563 static UINT add_appsearch_entry( MSIHANDLE hdb, const char *values )
565 char insert[] = "INSERT INTO `AppSearch` "
566 "(`Property`, `Signature_`) "
567 "VALUES( %s )";
568 char *query;
569 UINT sz, r;
571 sz = strlen(values) + sizeof insert;
572 query = HeapAlloc(GetProcessHeap(),0,sz);
573 sprintf(query,insert,values);
574 r = run_query( hdb, query );
575 HeapFree(GetProcessHeap(), 0, query);
576 return r;
579 static UINT add_reglocator_entry( MSIHANDLE hdb, const char *values )
581 char insert[] = "INSERT INTO `RegLocator` "
582 "(`Signature_`, `Root`, `Key`, `Name`, `Type`) "
583 "VALUES( %s )";
584 char *query;
585 UINT sz, r;
587 sz = strlen(values) + sizeof insert;
588 query = HeapAlloc(GetProcessHeap(),0,sz);
589 sprintf(query,insert,values);
590 r = run_query( hdb, query );
591 HeapFree(GetProcessHeap(), 0, query);
592 return r;
595 static UINT add_signature_entry( MSIHANDLE hdb, const char *values )
597 char insert[] = "INSERT INTO `Signature` "
598 "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
599 " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
600 "VALUES( %s )";
601 char *query;
602 UINT sz, r;
604 sz = strlen(values) + sizeof insert;
605 query = HeapAlloc(GetProcessHeap(),0,sz);
606 sprintf(query,insert,values);
607 r = run_query( hdb, query );
608 HeapFree(GetProcessHeap(), 0, query);
609 return r;
612 static UINT add_launchcondition_entry( MSIHANDLE hdb, const char *values )
614 char insert[] = "INSERT INTO `LaunchCondition` "
615 "(`Condition`, `Description`) "
616 "VALUES( %s )";
617 char *query;
618 UINT sz, r;
620 sz = strlen(values) + sizeof insert;
621 query = HeapAlloc(GetProcessHeap(),0,sz);
622 sprintf(query,insert,values);
623 r = run_query( hdb, query );
624 HeapFree(GetProcessHeap(), 0, query);
625 return r;
628 static UINT add_property_entry( MSIHANDLE hdb, const char *values )
630 char insert[] = "INSERT INTO `Property` "
631 "(`Property`, `Value`) "
632 "VALUES( %s )";
633 char *query;
634 UINT sz, r;
636 sz = strlen(values) + sizeof insert;
637 query = HeapAlloc(GetProcessHeap(),0,sz);
638 sprintf(query,insert,values);
639 r = run_query( hdb, query );
640 HeapFree(GetProcessHeap(), 0, query);
641 return r;
644 static UINT add_install_execute_sequence_entry( MSIHANDLE hdb, const char *values )
646 char insert[] = "INSERT INTO `InstallExecuteSequence` "
647 "(`Action`, `Condition`, `Sequence`) "
648 "VALUES( %s )";
649 char *query;
650 UINT sz, r;
652 sz = strlen(values) + sizeof insert;
653 query = HeapAlloc(GetProcessHeap(),0,sz);
654 sprintf(query,insert,values);
655 r = run_query( hdb, query );
656 HeapFree(GetProcessHeap(), 0, query);
657 return r;
660 static UINT add_media_entry( MSIHANDLE hdb, const char *values )
662 char insert[] = "INSERT INTO `Media` "
663 "(`DiskId`, `LastSequence`, `DiskPrompt`, `Cabinet`, `VolumeLabel`, `Source`) "
664 "VALUES( %s )";
665 char *query;
666 UINT sz, r;
668 sz = strlen(values) + sizeof insert;
669 query = HeapAlloc(GetProcessHeap(),0,sz);
670 sprintf(query,insert,values);
671 r = run_query( hdb, query );
672 HeapFree(GetProcessHeap(), 0, query);
673 return r;
676 static UINT add_ccpsearch_entry( MSIHANDLE hdb, const char *values )
678 char insert[] = "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )";
679 char *query;
680 UINT sz, r;
682 sz = strlen(values) + sizeof insert;
683 query = HeapAlloc(GetProcessHeap(),0,sz);
684 sprintf(query,insert,values);
685 r = run_query( hdb, query );
686 HeapFree(GetProcessHeap(), 0, query);
687 return r;
690 static UINT add_drlocator_entry( MSIHANDLE hdb, const char *values )
692 char insert[] = "INSERT INTO `DrLocator` "
693 "(`Signature_`, `Parent`, `Path`, `Depth`) "
694 "VALUES( %s )";
695 char *query;
696 UINT sz, r;
698 sz = strlen(values) + sizeof insert;
699 query = HeapAlloc(GetProcessHeap(),0,sz);
700 sprintf(query,insert,values);
701 r = run_query( hdb, query );
702 HeapFree(GetProcessHeap(), 0, query);
703 return r;
706 static UINT add_complocator_entry( MSIHANDLE hdb, const char *values )
708 char insert[] = "INSERT INTO `CompLocator` "
709 "(`Signature_`, `ComponentId`, `Type`) "
710 "VALUES( %s )";
711 char *query;
712 UINT sz, r;
714 sz = strlen(values) + sizeof insert;
715 query = HeapAlloc(GetProcessHeap(),0,sz);
716 sprintf(query,insert,values);
717 r = run_query( hdb, query );
718 HeapFree(GetProcessHeap(), 0, query);
719 return r;
722 static UINT add_inilocator_entry( MSIHANDLE hdb, const char *values )
724 char insert[] = "INSERT INTO `IniLocator` "
725 "(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) "
726 "VALUES( %s )";
727 char *query;
728 UINT sz, r;
730 sz = strlen(values) + sizeof insert;
731 query = HeapAlloc(GetProcessHeap(),0,sz);
732 sprintf(query,insert,values);
733 r = run_query( hdb, query );
734 HeapFree(GetProcessHeap(), 0, query);
735 return r;
738 static UINT set_summary_info(MSIHANDLE hdb)
740 UINT res;
741 MSIHANDLE suminfo;
743 /* build summary info */
744 res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
745 ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
747 res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
748 "Installation Database");
749 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
751 res = MsiSummaryInfoSetProperty(suminfo,3, VT_LPSTR, 0,NULL,
752 "Installation Database");
753 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
755 res = MsiSummaryInfoSetProperty(suminfo,4, VT_LPSTR, 0,NULL,
756 "Wine Hackers");
757 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
759 res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
760 ";1033");
761 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
763 res = MsiSummaryInfoSetProperty(suminfo,9, VT_LPSTR, 0,NULL,
764 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
765 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
767 res = MsiSummaryInfoSetProperty(suminfo, 14, VT_I4, 100, NULL, NULL);
768 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
770 res = MsiSummaryInfoSetProperty(suminfo, 15, VT_I4, 0, NULL, NULL);
771 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
773 res = MsiSummaryInfoPersist(suminfo);
774 ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
776 res = MsiCloseHandle( suminfo);
777 ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
779 return res;
783 static MSIHANDLE create_package_db(void)
785 MSIHANDLE hdb = 0;
786 UINT res;
788 DeleteFile(msifile);
790 /* create an empty database */
791 res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb );
792 ok( res == ERROR_SUCCESS , "Failed to create database\n" );
793 if( res != ERROR_SUCCESS )
794 return hdb;
796 res = MsiDatabaseCommit( hdb );
797 ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
799 res = set_summary_info(hdb);
801 res = run_query( hdb,
802 "CREATE TABLE `Directory` ( "
803 "`Directory` CHAR(255) NOT NULL, "
804 "`Directory_Parent` CHAR(255), "
805 "`DefaultDir` CHAR(255) NOT NULL "
806 "PRIMARY KEY `Directory`)" );
807 ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
809 return hdb;
812 static MSIHANDLE package_from_db(MSIHANDLE hdb)
814 UINT res;
815 CHAR szPackage[10];
816 MSIHANDLE hPackage;
818 sprintf(szPackage,"#%li",hdb);
819 res = MsiOpenPackage(szPackage,&hPackage);
820 if (res != ERROR_SUCCESS)
821 return 0;
823 res = MsiCloseHandle(hdb);
824 if (res != ERROR_SUCCESS)
825 return 0;
827 return hPackage;
830 static void create_test_file(const CHAR *name)
832 HANDLE file;
833 DWORD written;
835 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
836 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
837 WriteFile(file, name, strlen(name), &written, NULL);
838 WriteFile(file, "\n", strlen("\n"), &written, NULL);
839 CloseHandle(file);
842 typedef struct _tagVS_VERSIONINFO
844 WORD wLength;
845 WORD wValueLength;
846 WORD wType;
847 WCHAR szKey[1];
848 WORD wPadding1[1];
849 VS_FIXEDFILEINFO Value;
850 WORD wPadding2[1];
851 WORD wChildren[1];
852 } VS_VERSIONINFO;
854 #define roundoffs(a, b, r) (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))
855 #define roundpos(a, b, r) (((BYTE *)(a)) + roundoffs(a, b, r))
857 static void create_file_with_version(const CHAR *name, LONG ms, LONG ls)
859 VS_VERSIONINFO *pVerInfo;
860 VS_FIXEDFILEINFO *pFixedInfo;
861 LPBYTE buffer, ofs;
862 CHAR path[MAX_PATH];
863 DWORD handle, size;
864 HANDLE resource;
866 GetSystemDirectory(path, MAX_PATH);
867 lstrcatA(path, "\\kernel32.dll");
869 CopyFileA(path, name, FALSE);
871 size = GetFileVersionInfoSize(path, &handle);
872 buffer = HeapAlloc(GetProcessHeap(), 0, size);
874 GetFileVersionInfoA(path, 0, size, buffer);
876 pVerInfo = (VS_VERSIONINFO *)buffer;
877 ofs = (BYTE *)&pVerInfo->szKey[lstrlenW(pVerInfo->szKey) + 1];
878 pFixedInfo = (VS_FIXEDFILEINFO *)roundpos(pVerInfo, ofs, 4);
880 pFixedInfo->dwFileVersionMS = ms;
881 pFixedInfo->dwFileVersionLS = ls;
882 pFixedInfo->dwProductVersionMS = ms;
883 pFixedInfo->dwProductVersionLS = ls;
885 resource = BeginUpdateResource(name, FALSE);
886 if (!resource)
887 goto done;
889 UpdateResource(resource, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO),
890 MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), buffer, size);
891 EndUpdateResource(resource, FALSE);
893 done:
894 HeapFree(GetProcessHeap(), 0, buffer);
897 static void test_createpackage(void)
899 MSIHANDLE hPackage = 0;
900 UINT res;
902 hPackage = package_from_db(create_package_db());
903 ok( hPackage != 0, " Failed to create package\n");
905 res = MsiCloseHandle( hPackage);
906 ok( res == ERROR_SUCCESS , "Failed to close package\n" );
907 DeleteFile(msifile);
910 static void test_doaction( void )
912 MSIHANDLE hpkg;
913 UINT r;
915 r = MsiDoAction( -1, NULL );
916 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
918 hpkg = package_from_db(create_package_db());
919 ok( hpkg, "failed to create package\n");
921 r = MsiDoAction(hpkg, NULL);
922 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
924 r = MsiDoAction(0, "boo");
925 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
927 r = MsiDoAction(hpkg, "boo");
928 ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
930 MsiCloseHandle( hpkg );
931 DeleteFile(msifile);
934 static void test_gettargetpath_bad(void)
936 char buffer[0x80];
937 MSIHANDLE hpkg;
938 DWORD sz;
939 UINT r;
941 hpkg = package_from_db(create_package_db());
942 ok( hpkg, "failed to create package\n");
944 r = MsiGetTargetPath( 0, NULL, NULL, NULL );
945 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
947 r = MsiGetTargetPath( 0, NULL, NULL, &sz );
948 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
950 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
951 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
953 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
954 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
956 r = MsiGetTargetPath( hpkg, "boo", NULL, NULL );
957 ok( r == ERROR_DIRECTORY, "wrong return val\n");
959 r = MsiGetTargetPath( hpkg, "boo", buffer, NULL );
960 ok( r == ERROR_DIRECTORY, "wrong return val\n");
962 MsiCloseHandle( hpkg );
963 DeleteFile(msifile);
966 static void query_file_path(MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
968 UINT r;
969 DWORD size;
970 MSIHANDLE rec;
972 rec = MsiCreateRecord( 1 );
973 ok(rec, "MsiCreate record failed\n");
975 r = MsiRecordSetString( rec, 0, file );
976 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
978 size = MAX_PATH;
979 r = MsiFormatRecord( hpkg, rec, buff, &size );
980 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
982 MsiCloseHandle( rec );
985 static void test_settargetpath(void)
987 char tempdir[MAX_PATH+8], buffer[MAX_PATH], file[MAX_PATH];
988 DWORD sz;
989 MSIHANDLE hpkg;
990 UINT r;
991 MSIHANDLE hdb;
993 hdb = create_package_db();
994 ok ( hdb, "failed to create package database\n" );
996 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
997 ok( r == S_OK, "failed to add directory entry: %d\n" , r );
999 r = create_component_table( hdb );
1000 ok( r == S_OK, "cannot create Component table: %d\n", r );
1002 r = add_component_entry( hdb, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
1003 ok( r == S_OK, "cannot add dummy component: %d\n", r );
1005 r = add_component_entry( hdb, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
1006 ok( r == S_OK, "cannot add test component: %d\n", r );
1008 r = create_feature_table( hdb );
1009 ok( r == S_OK, "cannot create Feature table: %d\n", r );
1011 r = add_feature_entry( hdb, "'TestFeature', '', '', '', 0, 1, '', 0" );
1012 ok( r == ERROR_SUCCESS, "cannot add TestFeature to Feature table: %d\n", r );
1014 r = create_feature_components_table( hdb );
1015 ok( r == S_OK, "cannot create FeatureComponents table: %d\n", r );
1017 r = add_feature_components_entry( hdb, "'TestFeature', 'RootComp'" );
1018 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
1020 r = add_feature_components_entry( hdb, "'TestFeature', 'TestComp'" );
1021 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
1023 add_directory_entry( hdb, "'TestParent', 'TARGETDIR', 'TestParent'" );
1024 add_directory_entry( hdb, "'TestDir', 'TestParent', 'TestDir'" );
1026 r = create_file_table( hdb );
1027 ok( r == S_OK, "cannot create File table: %d\n", r );
1029 r = add_file_entry( hdb, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
1030 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
1032 r = add_file_entry( hdb, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
1033 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
1035 hpkg = package_from_db( hdb );
1036 ok( hpkg, "failed to create package\n");
1038 r = MsiDoAction( hpkg, "CostInitialize");
1039 ok( r == ERROR_SUCCESS, "cost init failed\n");
1041 r = MsiDoAction( hpkg, "FileCost");
1042 ok( r == ERROR_SUCCESS, "file cost failed\n");
1044 r = MsiDoAction( hpkg, "CostFinalize");
1045 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
1047 r = MsiSetTargetPath( 0, NULL, NULL );
1048 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1050 r = MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
1051 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1053 r = MsiSetTargetPath( hpkg, "boo", NULL );
1054 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1056 r = MsiSetTargetPath( hpkg, "boo", "c:\\bogusx" );
1057 ok( r == ERROR_DIRECTORY, "wrong return val\n");
1059 sz = sizeof tempdir - 1;
1060 r = MsiGetTargetPath( hpkg, "TARGETDIR", tempdir, &sz );
1061 sprintf( file, "%srootfile.txt", tempdir );
1062 query_file_path( hpkg, "[#RootFile]", buffer );
1063 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1064 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer );
1066 GetTempFileName( tempdir, "_wt", 0, buffer );
1067 sprintf( tempdir, "%s\\subdir", buffer );
1069 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1070 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1071 "MsiSetTargetPath on file returned %d\n", r );
1073 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1074 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1075 "MsiSetTargetPath on 'subdir' of file returned %d\n", r );
1077 DeleteFile( buffer );
1079 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1080 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1082 r = GetFileAttributes( buffer );
1083 ok ( r == INVALID_FILE_ATTRIBUTES, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r );
1085 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1086 ok( r == ERROR_SUCCESS, "MsiSetTargetPath on subsubdir returned %d\n", r );
1088 sz = sizeof buffer - 1;
1089 lstrcat( tempdir, "\\" );
1090 r = MsiGetTargetPath( hpkg, "TARGETDIR", buffer, &sz );
1091 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1092 ok( !lstrcmp(buffer, tempdir), "Expected %s, got %s\n", tempdir, buffer);
1094 sprintf( file, "%srootfile.txt", tempdir );
1095 query_file_path( hpkg, "[#RootFile]", buffer );
1096 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer);
1098 r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two" );
1099 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1101 query_file_path( hpkg, "[#TestFile]", buffer );
1102 ok( !lstrcmp(buffer, "C:\\one\\two\\TestDir\\testfile.txt"),
1103 "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer );
1105 sz = sizeof buffer - 1;
1106 r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
1107 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1108 ok( !lstrcmp(buffer, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer);
1110 MsiCloseHandle( hpkg );
1113 static void test_condition(void)
1115 MSICONDITION r;
1116 MSIHANDLE hpkg;
1118 hpkg = package_from_db(create_package_db());
1119 ok( hpkg, "failed to create package\n");
1121 r = MsiEvaluateCondition(0, NULL);
1122 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1124 r = MsiEvaluateCondition(hpkg, NULL);
1125 ok( r == MSICONDITION_NONE, "wrong return val\n");
1127 r = MsiEvaluateCondition(hpkg, "");
1128 ok( r == MSICONDITION_NONE, "wrong return val\n");
1130 r = MsiEvaluateCondition(hpkg, "1");
1131 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1133 r = MsiEvaluateCondition(hpkg, "0");
1134 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1136 r = MsiEvaluateCondition(hpkg, "-1");
1137 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1139 r = MsiEvaluateCondition(hpkg, "0 = 0");
1140 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1142 r = MsiEvaluateCondition(hpkg, "0 <> 0");
1143 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1145 r = MsiEvaluateCondition(hpkg, "0 = 1");
1146 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1148 r = MsiEvaluateCondition(hpkg, "0 > 1");
1149 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1151 r = MsiEvaluateCondition(hpkg, "0 ~> 1");
1152 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1154 r = MsiEvaluateCondition(hpkg, "1 > 1");
1155 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1157 r = MsiEvaluateCondition(hpkg, "1 ~> 1");
1158 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1160 r = MsiEvaluateCondition(hpkg, "0 >= 1");
1161 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1163 r = MsiEvaluateCondition(hpkg, "0 ~>= 1");
1164 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1166 r = MsiEvaluateCondition(hpkg, "1 >= 1");
1167 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1169 r = MsiEvaluateCondition(hpkg, "1 ~>= 1");
1170 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1172 r = MsiEvaluateCondition(hpkg, "0 < 1");
1173 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1175 r = MsiEvaluateCondition(hpkg, "0 ~< 1");
1176 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1178 r = MsiEvaluateCondition(hpkg, "1 < 1");
1179 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1181 r = MsiEvaluateCondition(hpkg, "1 ~< 1");
1182 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1184 r = MsiEvaluateCondition(hpkg, "0 <= 1");
1185 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1187 r = MsiEvaluateCondition(hpkg, "0 ~<= 1");
1188 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1190 r = MsiEvaluateCondition(hpkg, "1 <= 1");
1191 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1193 r = MsiEvaluateCondition(hpkg, "1 ~<= 1");
1194 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1196 r = MsiEvaluateCondition(hpkg, "0 >=");
1197 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1199 r = MsiEvaluateCondition(hpkg, " ");
1200 ok( r == MSICONDITION_NONE, "wrong return val\n");
1202 r = MsiEvaluateCondition(hpkg, "LicView <> \"1\"");
1203 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1205 r = MsiEvaluateCondition(hpkg, "LicView <> \"0\"");
1206 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1208 r = MsiEvaluateCondition(hpkg, "LicView <> LicView");
1209 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1211 r = MsiEvaluateCondition(hpkg, "not 0");
1212 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1214 r = MsiEvaluateCondition(hpkg, "not LicView");
1215 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1217 r = MsiEvaluateCondition(hpkg, "not \"A\"");
1218 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1220 r = MsiEvaluateCondition(hpkg, "~not \"A\"");
1221 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1223 r = MsiEvaluateCondition(hpkg, "\"0\"");
1224 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1226 r = MsiEvaluateCondition(hpkg, "1 and 2");
1227 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1229 r = MsiEvaluateCondition(hpkg, "not 0 and 3");
1230 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1232 r = MsiEvaluateCondition(hpkg, "not 0 and 0");
1233 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1235 r = MsiEvaluateCondition(hpkg, "not 0 or 1");
1236 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1238 r = MsiEvaluateCondition(hpkg, "(0)");
1239 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1241 r = MsiEvaluateCondition(hpkg, "(((((1))))))");
1242 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1244 r = MsiEvaluateCondition(hpkg, "(((((1)))))");
1245 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1247 r = MsiEvaluateCondition(hpkg, " \"A\" < \"B\" ");
1248 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1250 r = MsiEvaluateCondition(hpkg, " \"A\" > \"B\" ");
1251 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1253 r = MsiEvaluateCondition(hpkg, " \"1\" > \"12\" ");
1254 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1256 r = MsiEvaluateCondition(hpkg, " \"100\" < \"21\" ");
1257 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1259 r = MsiEvaluateCondition(hpkg, "0 < > 0");
1260 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1262 r = MsiEvaluateCondition(hpkg, "(1<<1) == 2");
1263 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1265 r = MsiEvaluateCondition(hpkg, " \"A\" = \"a\" ");
1266 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1268 r = MsiEvaluateCondition(hpkg, " \"A\" ~ = \"a\" ");
1269 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1271 r = MsiEvaluateCondition(hpkg, " \"A\" ~= \"a\" ");
1272 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1274 r = MsiEvaluateCondition(hpkg, " \"A\" ~= 1 ");
1275 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1277 r = MsiEvaluateCondition(hpkg, " \"A\" = 1 ");
1278 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1280 r = MsiEvaluateCondition(hpkg, " 1 ~= 1 ");
1281 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1283 r = MsiEvaluateCondition(hpkg, " 1 ~= \"1\" ");
1284 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1286 r = MsiEvaluateCondition(hpkg, " 1 = \"1\" ");
1287 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1289 r = MsiEvaluateCondition(hpkg, " 0 = \"1\" ");
1290 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1292 r = MsiEvaluateCondition(hpkg, " 0 < \"100\" ");
1293 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1295 r = MsiEvaluateCondition(hpkg, " 100 > \"0\" ");
1296 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1298 r = MsiEvaluateCondition(hpkg, "1 XOR 1");
1299 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1301 r = MsiEvaluateCondition(hpkg, "1 IMP 1");
1302 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1304 r = MsiEvaluateCondition(hpkg, "1 IMP 0");
1305 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1307 r = MsiEvaluateCondition(hpkg, "0 IMP 0");
1308 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1310 r = MsiEvaluateCondition(hpkg, "0 EQV 0");
1311 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1313 r = MsiEvaluateCondition(hpkg, "0 EQV 1");
1314 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1316 r = MsiEvaluateCondition(hpkg, "1 IMP 1 OR 0");
1317 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1319 r = MsiEvaluateCondition(hpkg, "1 IMPL 1");
1320 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1322 r = MsiEvaluateCondition(hpkg, "\"ASFD\" >< \"S\" ");
1323 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1325 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"s\" ");
1326 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1328 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"\" ");
1329 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1331 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"sss\" ");
1332 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1334 MsiSetProperty(hpkg, "mm", "5" );
1336 r = MsiEvaluateCondition(hpkg, "mm = 5");
1337 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1339 r = MsiEvaluateCondition(hpkg, "mm < 6");
1340 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1342 r = MsiEvaluateCondition(hpkg, "mm <= 5");
1343 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1345 r = MsiEvaluateCondition(hpkg, "mm > 4");
1346 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1348 r = MsiEvaluateCondition(hpkg, "mm < 12");
1349 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1351 r = MsiEvaluateCondition(hpkg, "mm = \"5\"");
1352 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1354 r = MsiEvaluateCondition(hpkg, "0 = \"\"");
1355 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1357 r = MsiEvaluateCondition(hpkg, "0 AND \"\"");
1358 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1360 r = MsiEvaluateCondition(hpkg, "1 AND \"\"");
1361 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1363 r = MsiEvaluateCondition(hpkg, "1 AND \"1\"");
1364 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1366 r = MsiEvaluateCondition(hpkg, "3 >< 1");
1367 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1369 r = MsiEvaluateCondition(hpkg, "3 >< 4");
1370 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1372 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 0");
1373 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1375 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1");
1376 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1378 r = MsiEvaluateCondition(hpkg, "NOT 1 OR 0");
1379 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1381 r = MsiEvaluateCondition(hpkg, "0 AND 1 OR 1");
1382 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1384 r = MsiEvaluateCondition(hpkg, "0 AND 0 OR 1");
1385 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1387 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1 OR 0");
1388 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1390 r = MsiEvaluateCondition(hpkg, "_1 = _1");
1391 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1393 r = MsiEvaluateCondition(hpkg, "( 1 AND 1 ) = 2");
1394 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1396 r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
1397 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1399 r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1400 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1402 r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
1403 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1405 r = MsiEvaluateCondition(hpkg, "NOT 1 AND 0");
1406 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1408 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1409 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1411 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1412 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1414 r = MsiEvaluateCondition(hpkg, "bandalmael<0");
1415 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1417 r = MsiEvaluateCondition(hpkg, "bandalmael>0");
1418 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1420 r = MsiEvaluateCondition(hpkg, "bandalmael>=0");
1421 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1423 r = MsiEvaluateCondition(hpkg, "bandalmael<=0");
1424 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1426 r = MsiEvaluateCondition(hpkg, "bandalmael~<>0");
1427 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1429 MsiSetProperty(hpkg, "bandalmael", "0" );
1430 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1431 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1433 MsiSetProperty(hpkg, "bandalmael", "" );
1434 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1435 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1437 MsiSetProperty(hpkg, "bandalmael", "asdf" );
1438 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1439 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1441 MsiSetProperty(hpkg, "bandalmael", "0asdf" );
1442 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1443 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1445 MsiSetProperty(hpkg, "bandalmael", "0 " );
1446 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1447 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1449 MsiSetProperty(hpkg, "bandalmael", "-0" );
1450 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1451 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1453 MsiSetProperty(hpkg, "bandalmael", "0000000000000" );
1454 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1455 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1457 MsiSetProperty(hpkg, "bandalmael", "--0" );
1458 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1459 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1461 MsiSetProperty(hpkg, "bandalmael", "0x00" );
1462 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1463 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1465 MsiSetProperty(hpkg, "bandalmael", "-" );
1466 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1467 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1469 MsiSetProperty(hpkg, "bandalmael", "+0" );
1470 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1471 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1473 MsiSetProperty(hpkg, "bandalmael", "0.0" );
1474 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1475 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1476 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1477 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1479 MsiSetProperty(hpkg, "one", "hi");
1480 MsiSetProperty(hpkg, "two", "hithere");
1481 r = MsiEvaluateCondition(hpkg, "one >< two");
1482 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1484 MsiSetProperty(hpkg, "one", "hithere");
1485 MsiSetProperty(hpkg, "two", "hi");
1486 r = MsiEvaluateCondition(hpkg, "one >< two");
1487 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1489 MsiSetProperty(hpkg, "one", "hello");
1490 MsiSetProperty(hpkg, "two", "hi");
1491 r = MsiEvaluateCondition(hpkg, "one >< two");
1492 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1494 MsiSetProperty(hpkg, "one", "hellohithere");
1495 MsiSetProperty(hpkg, "two", "hi");
1496 r = MsiEvaluateCondition(hpkg, "one >< two");
1497 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1499 MsiSetProperty(hpkg, "one", "");
1500 MsiSetProperty(hpkg, "two", "hi");
1501 r = MsiEvaluateCondition(hpkg, "one >< two");
1502 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1504 MsiSetProperty(hpkg, "one", "hi");
1505 MsiSetProperty(hpkg, "two", "");
1506 r = MsiEvaluateCondition(hpkg, "one >< two");
1507 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1509 MsiSetProperty(hpkg, "one", "");
1510 MsiSetProperty(hpkg, "two", "");
1511 r = MsiEvaluateCondition(hpkg, "one >< two");
1512 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1514 MsiSetProperty(hpkg, "one", "1234");
1515 MsiSetProperty(hpkg, "two", "1");
1516 r = MsiEvaluateCondition(hpkg, "one >< two");
1517 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1519 MsiSetProperty(hpkg, "one", "one 1234");
1520 MsiSetProperty(hpkg, "two", "1");
1521 r = MsiEvaluateCondition(hpkg, "one >< two");
1522 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1524 MsiSetProperty(hpkg, "one", "hithere");
1525 MsiSetProperty(hpkg, "two", "hi");
1526 r = MsiEvaluateCondition(hpkg, "one << two");
1527 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1529 MsiSetProperty(hpkg, "one", "hi");
1530 MsiSetProperty(hpkg, "two", "hithere");
1531 r = MsiEvaluateCondition(hpkg, "one << two");
1532 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1534 MsiSetProperty(hpkg, "one", "hi");
1535 MsiSetProperty(hpkg, "two", "hi");
1536 r = MsiEvaluateCondition(hpkg, "one << two");
1537 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1539 MsiSetProperty(hpkg, "one", "abcdhithere");
1540 MsiSetProperty(hpkg, "two", "hi");
1541 r = MsiEvaluateCondition(hpkg, "one << two");
1542 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1544 MsiSetProperty(hpkg, "one", "");
1545 MsiSetProperty(hpkg, "two", "hi");
1546 r = MsiEvaluateCondition(hpkg, "one << two");
1547 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1549 MsiSetProperty(hpkg, "one", "hithere");
1550 MsiSetProperty(hpkg, "two", "");
1551 r = MsiEvaluateCondition(hpkg, "one << two");
1552 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1554 MsiSetProperty(hpkg, "one", "");
1555 MsiSetProperty(hpkg, "two", "");
1556 r = MsiEvaluateCondition(hpkg, "one << two");
1557 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1559 MsiSetProperty(hpkg, "one", "1234");
1560 MsiSetProperty(hpkg, "two", "1");
1561 r = MsiEvaluateCondition(hpkg, "one << two");
1562 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1564 MsiSetProperty(hpkg, "one", "1234 one");
1565 MsiSetProperty(hpkg, "two", "1");
1566 r = MsiEvaluateCondition(hpkg, "one << two");
1567 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1569 MsiSetProperty(hpkg, "one", "hithere");
1570 MsiSetProperty(hpkg, "two", "there");
1571 r = MsiEvaluateCondition(hpkg, "one >> two");
1572 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1574 MsiSetProperty(hpkg, "one", "hithere");
1575 MsiSetProperty(hpkg, "two", "hi");
1576 r = MsiEvaluateCondition(hpkg, "one >> two");
1577 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1579 MsiSetProperty(hpkg, "one", "there");
1580 MsiSetProperty(hpkg, "two", "hithere");
1581 r = MsiEvaluateCondition(hpkg, "one >> two");
1582 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1584 MsiSetProperty(hpkg, "one", "there");
1585 MsiSetProperty(hpkg, "two", "there");
1586 r = MsiEvaluateCondition(hpkg, "one >> two");
1587 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1589 MsiSetProperty(hpkg, "one", "abcdhithere");
1590 MsiSetProperty(hpkg, "two", "hi");
1591 r = MsiEvaluateCondition(hpkg, "one >> two");
1592 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1594 MsiSetProperty(hpkg, "one", "");
1595 MsiSetProperty(hpkg, "two", "there");
1596 r = MsiEvaluateCondition(hpkg, "one >> two");
1597 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1599 MsiSetProperty(hpkg, "one", "there");
1600 MsiSetProperty(hpkg, "two", "");
1601 r = MsiEvaluateCondition(hpkg, "one >> two");
1602 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1604 MsiSetProperty(hpkg, "one", "");
1605 MsiSetProperty(hpkg, "two", "");
1606 r = MsiEvaluateCondition(hpkg, "one >> two");
1607 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1609 MsiSetProperty(hpkg, "one", "1234");
1610 MsiSetProperty(hpkg, "two", "4");
1611 r = MsiEvaluateCondition(hpkg, "one >> two");
1612 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1614 MsiSetProperty(hpkg, "one", "one 1234");
1615 MsiSetProperty(hpkg, "two", "4");
1616 r = MsiEvaluateCondition(hpkg, "one >> two");
1617 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1619 MsiSetProperty(hpkg, "MsiNetAssemblySupport", NULL); /* make sure it's empty */
1621 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1622 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1624 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport > \"1.1.4322\"");
1625 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1627 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport >= \"1.1.4322\"");
1628 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1630 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <= \"1.1.4322\"");
1631 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1633 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <> \"1.1.4322\"");
1634 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1636 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1637 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1639 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"abcd\"");
1640 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1642 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a1.1.4322\"");
1643 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1645 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322a\"");
1646 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1648 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1649 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1651 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1652 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1654 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1655 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1657 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1");
1658 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1660 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1\"");
1661 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1663 r = MsiEvaluateCondition(hpkg, "\"2\" < \"12.1\"");
1664 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1666 r = MsiEvaluateCondition(hpkg, "\"02.1\" < \"2.11\"");
1667 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1669 r = MsiEvaluateCondition(hpkg, "\"02.1.1\" < \"2.1\"");
1670 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1672 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1673 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1675 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1676 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1678 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0\"");
1679 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1681 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"-1\"");
1682 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1684 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a\"");
1685 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1687 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1688 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1690 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1691 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1693 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"/\"");
1694 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1696 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \" \"");
1697 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1699 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"azAZ_\"");
1700 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1702 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]\"");
1703 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1705 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]a\"");
1706 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1708 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]\"");
1709 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1711 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]a\"");
1712 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1714 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a}\"");
1715 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1717 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a\"");
1718 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1720 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a\"");
1721 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1723 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a{\"");
1724 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1726 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a]\"");
1727 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1729 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"A\"");
1730 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1732 MsiSetProperty(hpkg, "MsiNetAssemblySupport", "1.1.4322");
1733 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1734 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1736 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.14322\"");
1737 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1739 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.5\"");
1740 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1742 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1743 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1745 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1746 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1748 MsiSetProperty(hpkg, "one", "1");
1749 r = MsiEvaluateCondition(hpkg, "one < \"1\"");
1750 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1752 MsiSetProperty(hpkg, "X", "5.0");
1754 r = MsiEvaluateCondition(hpkg, "X != \"\"");
1755 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1757 r = MsiEvaluateCondition(hpkg, "X =\"5.0\"");
1758 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1760 r = MsiEvaluateCondition(hpkg, "X =\"5.1\"");
1761 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1763 r = MsiEvaluateCondition(hpkg, "X =\"6.0\"");
1764 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1766 r = MsiEvaluateCondition(hpkg, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1767 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1769 r = MsiEvaluateCondition(hpkg, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1770 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1772 r = MsiEvaluateCondition(hpkg, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1773 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1775 /* feature doesn't exist */
1776 r = MsiEvaluateCondition(hpkg, "&nofeature");
1777 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1779 MsiSetProperty(hpkg, "A", "2");
1780 MsiSetProperty(hpkg, "X", "50");
1782 r = MsiEvaluateCondition(hpkg, "2 <= X");
1783 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1785 r = MsiEvaluateCondition(hpkg, "A <= X");
1786 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1788 r = MsiEvaluateCondition(hpkg, "A <= 50");
1789 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1791 MsiSetProperty(hpkg, "X", "50val");
1793 r = MsiEvaluateCondition(hpkg, "2 <= X");
1794 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1796 r = MsiEvaluateCondition(hpkg, "A <= X");
1797 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1799 MsiSetProperty(hpkg, "A", "7");
1800 MsiSetProperty(hpkg, "X", "50");
1802 r = MsiEvaluateCondition(hpkg, "7 <= X");
1803 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1805 r = MsiEvaluateCondition(hpkg, "A <= X");
1806 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1808 r = MsiEvaluateCondition(hpkg, "A <= 50");
1809 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1811 MsiSetProperty(hpkg, "X", "50val");
1813 r = MsiEvaluateCondition(hpkg, "2 <= X");
1814 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1816 r = MsiEvaluateCondition(hpkg, "A <= X");
1817 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1819 MsiCloseHandle( hpkg );
1820 DeleteFile(msifile);
1823 static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop)
1825 UINT r;
1826 DWORD sz;
1827 char buffer[2];
1829 sz = sizeof buffer;
1830 strcpy(buffer,"x");
1831 r = MsiGetProperty( hpkg, prop, buffer, &sz );
1832 return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
1835 static void test_props(void)
1837 MSIHANDLE hpkg, hdb;
1838 UINT r;
1839 DWORD sz;
1840 char buffer[0x100];
1842 hdb = create_package_db();
1843 r = run_query( hdb,
1844 "CREATE TABLE `Property` ( "
1845 "`Property` CHAR(255) NOT NULL, "
1846 "`Value` CHAR(255) "
1847 "PRIMARY KEY `Property`)" );
1848 ok( r == ERROR_SUCCESS , "Failed\n" );
1850 r = run_query(hdb,
1851 "INSERT INTO `Property` "
1852 "(`Property`, `Value`) "
1853 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1854 ok( r == ERROR_SUCCESS , "Failed\n" );
1856 hpkg = package_from_db( hdb );
1857 ok( hpkg, "failed to create package\n");
1859 /* test invalid values */
1860 r = MsiGetProperty( 0, NULL, NULL, NULL );
1861 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1863 r = MsiGetProperty( hpkg, NULL, NULL, NULL );
1864 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1866 r = MsiGetProperty( hpkg, "boo", NULL, NULL );
1867 ok( r == ERROR_SUCCESS, "wrong return val\n");
1869 r = MsiGetProperty( hpkg, "boo", buffer, NULL );
1870 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1872 /* test retrieving an empty/nonexistent property */
1873 sz = sizeof buffer;
1874 r = MsiGetProperty( hpkg, "boo", NULL, &sz );
1875 ok( r == ERROR_SUCCESS, "wrong return val\n");
1876 ok( sz == 0, "wrong size returned\n");
1878 check_prop_empty( hpkg, "boo");
1879 sz = 0;
1880 strcpy(buffer,"x");
1881 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1882 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1883 ok( !strcmp(buffer,"x"), "buffer was changed\n");
1884 ok( sz == 0, "wrong size returned\n");
1886 sz = 1;
1887 strcpy(buffer,"x");
1888 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1889 ok( r == ERROR_SUCCESS, "wrong return val\n");
1890 ok( buffer[0] == 0, "buffer was not changed\n");
1891 ok( sz == 0, "wrong size returned\n");
1893 /* set the property to something */
1894 r = MsiSetProperty( 0, NULL, NULL );
1895 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1897 r = MsiSetProperty( hpkg, NULL, NULL );
1898 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1900 r = MsiSetProperty( hpkg, "", NULL );
1901 ok( r == ERROR_SUCCESS, "wrong return val\n");
1903 /* try set and get some illegal property identifiers */
1904 r = MsiSetProperty( hpkg, "", "asdf" );
1905 ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n");
1907 r = MsiSetProperty( hpkg, "=", "asdf" );
1908 ok( r == ERROR_SUCCESS, "wrong return val\n");
1910 r = MsiSetProperty( hpkg, " ", "asdf" );
1911 ok( r == ERROR_SUCCESS, "wrong return val\n");
1913 r = MsiSetProperty( hpkg, "'", "asdf" );
1914 ok( r == ERROR_SUCCESS, "wrong return val\n");
1916 sz = sizeof buffer;
1917 buffer[0]=0;
1918 r = MsiGetProperty( hpkg, "'", buffer, &sz );
1919 ok( r == ERROR_SUCCESS, "wrong return val\n");
1920 ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
1922 /* set empty values */
1923 r = MsiSetProperty( hpkg, "boo", NULL );
1924 ok( r == ERROR_SUCCESS, "wrong return val\n");
1925 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1927 r = MsiSetProperty( hpkg, "boo", "" );
1928 ok( r == ERROR_SUCCESS, "wrong return val\n");
1929 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1931 /* set a non-empty value */
1932 r = MsiSetProperty( hpkg, "boo", "xyz" );
1933 ok( r == ERROR_SUCCESS, "wrong return val\n");
1935 sz = 1;
1936 strcpy(buffer,"x");
1937 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1938 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1939 ok( buffer[0] == 0, "buffer was not changed\n");
1940 ok( sz == 3, "wrong size returned\n");
1942 sz = 4;
1943 strcpy(buffer,"x");
1944 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1945 ok( r == ERROR_SUCCESS, "wrong return val\n");
1946 ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
1947 ok( sz == 3, "wrong size returned\n");
1949 sz = 3;
1950 strcpy(buffer,"x");
1951 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1952 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1953 ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
1954 ok( sz == 3, "wrong size returned\n");
1956 r = MsiSetProperty(hpkg, "SourceDir", "foo");
1957 ok( r == ERROR_SUCCESS, "wrong return val\n");
1959 sz = 4;
1960 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
1961 ok( r == ERROR_SUCCESS, "wrong return val\n");
1962 ok( !strcmp(buffer,""), "buffer wrong\n");
1963 ok( sz == 0, "wrong size returned\n");
1965 sz = 4;
1966 r = MsiGetProperty(hpkg, "SOMERANDOMNAME", buffer, &sz);
1967 ok( r == ERROR_SUCCESS, "wrong return val\n");
1968 ok( !strcmp(buffer,""), "buffer wrong\n");
1969 ok( sz == 0, "wrong size returned\n");
1971 sz = 4;
1972 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
1973 ok( r == ERROR_SUCCESS, "wrong return val\n");
1974 ok( !strcmp(buffer,"foo"), "buffer wrong\n");
1975 ok( sz == 3, "wrong size returned\n");
1977 r = MsiSetProperty(hpkg, "MetadataCompName", "Photoshop.dll");
1978 ok( r == ERROR_SUCCESS, "wrong return val\n");
1980 sz = 0;
1981 r = MsiGetProperty(hpkg, "MetadataCompName", NULL, &sz );
1982 ok( r == ERROR_SUCCESS, "return wrong\n");
1983 ok( sz == 13, "size wrong (%d)\n", sz);
1985 sz = 13;
1986 r = MsiGetProperty(hpkg, "MetadataCompName", buffer, &sz );
1987 ok( r == ERROR_MORE_DATA, "return wrong\n");
1988 ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n");
1990 r = MsiSetProperty(hpkg, "property", "value");
1991 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1993 sz = 6;
1994 r = MsiGetProperty(hpkg, "property", buffer, &sz);
1995 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1996 ok( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer);
1998 r = MsiSetProperty(hpkg, "property", NULL);
1999 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2001 sz = 6;
2002 r = MsiGetProperty(hpkg, "property", buffer, &sz);
2003 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2004 ok( !strlen(buffer), "Expected empty string, got %s\n", buffer);
2006 MsiCloseHandle( hpkg );
2007 DeleteFile(msifile);
2010 static BOOL find_prop_in_property(MSIHANDLE hdb, LPCSTR prop, LPCSTR val)
2012 MSIHANDLE hview, hrec;
2013 BOOL found;
2014 CHAR buffer[MAX_PATH];
2015 DWORD sz;
2016 UINT r;
2018 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
2019 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2020 r = MsiViewExecute(hview, 0);
2021 ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
2023 found = FALSE;
2024 while (r == ERROR_SUCCESS && !found)
2026 r = MsiViewFetch(hview, &hrec);
2027 if (r != ERROR_SUCCESS) break;
2029 sz = MAX_PATH;
2030 r = MsiRecordGetString(hrec, 1, buffer, &sz);
2031 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
2033 sz = MAX_PATH;
2034 r = MsiRecordGetString(hrec, 2, buffer, &sz);
2035 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, val))
2036 found = TRUE;
2039 MsiCloseHandle(hrec);
2042 MsiViewClose(hview);
2043 MsiCloseHandle(hview);
2045 return found;
2048 static void test_property_table(void)
2050 const char *query;
2051 UINT r;
2052 MSIHANDLE hpkg, hdb, hrec;
2053 char buffer[MAX_PATH];
2054 DWORD sz;
2055 BOOL found;
2057 hdb = create_package_db();
2058 ok( hdb, "failed to create package\n");
2060 hpkg = package_from_db(hdb);
2061 ok( hpkg, "failed to create package\n");
2063 MsiCloseHandle(hdb);
2065 hdb = MsiGetActiveDatabase(hpkg);
2067 query = "CREATE TABLE `_Property` ( "
2068 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2069 r = run_query(hdb, query);
2070 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2072 MsiCloseHandle(hdb);
2073 MsiCloseHandle(hpkg);
2074 DeleteFile(msifile);
2076 hdb = create_package_db();
2077 ok( hdb, "failed to create package\n");
2079 query = "CREATE TABLE `_Property` ( "
2080 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2081 r = run_query(hdb, query);
2082 ok(r == ERROR_SUCCESS, "failed to create table\n");
2084 query = "ALTER `_Property` ADD `foo` INTEGER";
2085 r = run_query(hdb, query);
2086 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2088 query = "ALTER TABLE `_Property` ADD `foo` INTEGER";
2089 r = run_query(hdb, query);
2090 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2092 query = "ALTER TABLE `_Property` ADD `extra` INTEGER";
2093 r = run_query(hdb, query);
2094 ok(r == ERROR_SUCCESS, "failed to add column\n");
2096 hpkg = package_from_db(hdb);
2097 todo_wine
2099 ok(!hpkg, "package should not be created\n");
2102 MsiCloseHandle(hdb);
2103 MsiCloseHandle(hpkg);
2104 DeleteFile(msifile);
2106 hdb = create_package_db();
2107 ok (hdb, "failed to create package database\n");
2109 r = create_property_table(hdb);
2110 ok(r == ERROR_SUCCESS, "cannot create Property table: %d\n", r);
2112 r = add_property_entry(hdb, "'prop', 'val'");
2113 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2115 hpkg = package_from_db(hdb);
2116 ok(hpkg, "failed to create package\n");
2118 MsiCloseHandle(hdb);
2120 sz = MAX_PATH;
2121 r = MsiGetProperty(hpkg, "prop", buffer, &sz);
2122 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2123 ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
2125 hdb = MsiGetActiveDatabase(hpkg);
2127 found = find_prop_in_property(hdb, "prop", "val");
2128 ok(found, "prop should be in the _Property table\n");
2130 r = add_property_entry(hdb, "'dantes', 'mercedes'");
2131 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2133 query = "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
2134 r = do_query(hdb, query, &hrec);
2135 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2137 found = find_prop_in_property(hdb, "dantes", "mercedes");
2138 ok(found == FALSE, "dantes should not be in the _Property table\n");
2140 sz = MAX_PATH;
2141 lstrcpy(buffer, "aaa");
2142 r = MsiGetProperty(hpkg, "dantes", buffer, &sz);
2143 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2144 ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer);
2146 r = MsiSetProperty(hpkg, "dantes", "mercedes");
2147 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2149 found = find_prop_in_property(hdb, "dantes", "mercedes");
2150 ok(found == TRUE, "dantes should be in the _Property table\n");
2152 MsiCloseHandle(hdb);
2153 MsiCloseHandle(hpkg);
2154 DeleteFile(msifile);
2157 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
2159 MSIHANDLE htab = 0;
2160 UINT res;
2162 res = MsiDatabaseOpenView( hdb, szQuery, &htab );
2163 if( res == ERROR_SUCCESS )
2165 UINT r;
2167 r = MsiViewExecute( htab, hrec );
2168 if( r != ERROR_SUCCESS )
2170 res = r;
2171 fprintf(stderr,"MsiViewExecute failed %08x\n", res);
2174 r = MsiViewClose( htab );
2175 if( r != ERROR_SUCCESS )
2176 res = r;
2178 r = MsiCloseHandle( htab );
2179 if( r != ERROR_SUCCESS )
2180 res = r;
2182 return res;
2185 static UINT try_query( MSIHANDLE hdb, LPCSTR szQuery )
2187 return try_query_param( hdb, szQuery, 0 );
2190 static void set_summary_str(MSIHANDLE hdb, DWORD pid, LPCSTR value)
2192 MSIHANDLE summary;
2193 UINT r;
2195 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2196 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2198 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
2199 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2201 r = MsiSummaryInfoPersist(summary);
2202 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2204 MsiCloseHandle(summary);
2207 static void set_summary_dword(MSIHANDLE hdb, DWORD pid, DWORD value)
2209 MSIHANDLE summary;
2210 UINT r;
2212 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2213 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2215 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_I4, value, NULL, NULL);
2216 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2218 r = MsiSummaryInfoPersist(summary);
2219 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2221 MsiCloseHandle(summary);
2224 static void test_msipackage(void)
2226 MSIHANDLE hdb = 0, hpack = 100;
2227 UINT r;
2228 const char *query;
2229 char name[10];
2231 /* NULL szPackagePath */
2232 r = MsiOpenPackage(NULL, &hpack);
2233 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2235 /* empty szPackagePath */
2236 r = MsiOpenPackage("", &hpack);
2237 todo_wine
2239 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2242 if (r == ERROR_SUCCESS)
2243 MsiCloseHandle(hpack);
2245 /* nonexistent szPackagePath */
2246 r = MsiOpenPackage("nonexistent", &hpack);
2247 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2249 /* NULL hProduct */
2250 r = MsiOpenPackage(msifile, NULL);
2251 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2253 name[0]='#';
2254 name[1]=0;
2255 r = MsiOpenPackage(name, &hpack);
2256 ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r);
2258 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2259 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2261 /* database exists, but is emtpy */
2262 sprintf(name, "#%ld", hdb);
2263 r = MsiOpenPackage(name, &hpack);
2264 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2265 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2267 query = "CREATE TABLE `Property` ( "
2268 "`Property` CHAR(72), `Value` CHAR(0) "
2269 "PRIMARY KEY `Property`)";
2270 r = try_query(hdb, query);
2271 ok(r == ERROR_SUCCESS, "failed to create Properties table\n");
2273 query = "CREATE TABLE `InstallExecuteSequence` ("
2274 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2275 "PRIMARY KEY `Action`)";
2276 r = try_query(hdb, query);
2277 ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n");
2279 /* a few key tables exist */
2280 sprintf(name, "#%ld", hdb);
2281 r = MsiOpenPackage(name, &hpack);
2282 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2283 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2285 MsiCloseHandle(hdb);
2286 DeleteFile(msifile);
2288 /* start with a clean database to show what constitutes a valid package */
2289 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2290 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2292 sprintf(name, "#%ld", hdb);
2294 /* The following summary information props must exist:
2295 * - PID_REVNUMBER
2296 * - PID_PAGECOUNT
2299 set_summary_dword(hdb, PID_PAGECOUNT, 100);
2300 r = MsiOpenPackage(name, &hpack);
2301 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2302 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2304 set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2305 r = MsiOpenPackage(name, &hpack);
2306 ok(r == ERROR_SUCCESS,
2307 "Expected ERROR_SUCCESS, got %d\n", r);
2309 MsiCloseHandle(hpack);
2310 MsiCloseHandle(hdb);
2311 DeleteFile(msifile);
2314 static void test_formatrecord2(void)
2316 MSIHANDLE hpkg, hrec ;
2317 char buffer[0x100];
2318 DWORD sz;
2319 UINT r;
2321 hpkg = package_from_db(create_package_db());
2322 ok( hpkg, "failed to create package\n");
2324 r = MsiSetProperty(hpkg, "Manufacturer", " " );
2325 ok( r == ERROR_SUCCESS, "set property failed\n");
2327 hrec = MsiCreateRecord(2);
2328 ok(hrec, "create record failed\n");
2330 r = MsiRecordSetString( hrec, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2331 ok( r == ERROR_SUCCESS, "format record failed\n");
2333 buffer[0] = 0;
2334 sz = sizeof buffer;
2335 r = MsiFormatRecord( hpkg, hrec, buffer, &sz );
2337 r = MsiRecordSetString(hrec, 0, "[foo][1]");
2338 r = MsiRecordSetString(hrec, 1, "hoo");
2339 sz = sizeof buffer;
2340 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2341 ok( sz == 3, "size wrong\n");
2342 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2343 ok( r == ERROR_SUCCESS, "format failed\n");
2345 r = MsiRecordSetString(hrec, 0, "x[~]x");
2346 sz = sizeof buffer;
2347 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2348 ok( sz == 3, "size wrong\n");
2349 ok( 0 == strcmp(buffer,"x"), "wrong output %s\n",buffer);
2350 ok( r == ERROR_SUCCESS, "format failed\n");
2352 r = MsiRecordSetString(hrec, 0, "[foo.$%}][1]");
2353 r = MsiRecordSetString(hrec, 1, "hoo");
2354 sz = sizeof buffer;
2355 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2356 ok( sz == 3, "size wrong\n");
2357 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2358 ok( r == ERROR_SUCCESS, "format failed\n");
2360 r = MsiRecordSetString(hrec, 0, "[\\[]");
2361 sz = sizeof buffer;
2362 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2363 ok( sz == 1, "size wrong\n");
2364 ok( 0 == strcmp(buffer,"["), "wrong output %s\n",buffer);
2365 ok( r == ERROR_SUCCESS, "format failed\n");
2367 SetEnvironmentVariable("FOO", "BAR");
2368 r = MsiRecordSetString(hrec, 0, "[%FOO]");
2369 sz = sizeof buffer;
2370 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2371 ok( sz == 3, "size wrong\n");
2372 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2373 ok( r == ERROR_SUCCESS, "format failed\n");
2375 r = MsiRecordSetString(hrec, 0, "[[1]]");
2376 r = MsiRecordSetString(hrec, 1, "%FOO");
2377 sz = sizeof buffer;
2378 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2379 ok( sz == 3, "size wrong\n");
2380 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2381 ok( r == ERROR_SUCCESS, "format failed\n");
2383 MsiCloseHandle( hrec );
2384 MsiCloseHandle( hpkg );
2385 DeleteFile(msifile);
2388 static void test_states(void)
2390 MSIHANDLE hpkg;
2391 UINT r;
2392 MSIHANDLE hdb;
2393 INSTALLSTATE state, action;
2395 static const CHAR msifile2[] = "winetest2.msi";
2396 static const CHAR msifile3[] = "winetest3.msi";
2398 hdb = create_package_db();
2399 ok ( hdb, "failed to create package database\n" );
2401 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
2402 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
2404 r = create_property_table( hdb );
2405 ok( r == ERROR_SUCCESS, "cannot create Property table: %d\n", r );
2407 r = add_property_entry( hdb, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2408 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2410 r = add_property_entry( hdb, "'ProductLanguage', '1033'" );
2411 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2413 r = add_property_entry( hdb, "'ProductName', 'MSITEST'" );
2414 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2416 r = add_property_entry( hdb, "'ProductVersion', '1.1.1'" );
2417 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2419 r = create_install_execute_sequence_table( hdb );
2420 ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table: %d\n", r );
2422 r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
2423 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2425 r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
2426 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2428 r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
2429 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2431 r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" );
2432 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2434 r = add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" );
2435 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2437 r = add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" );
2438 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2440 r = add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" );
2441 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2443 r = add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" );
2444 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2446 r = add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" );
2447 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2449 r = add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" );
2450 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2452 r = add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" );
2453 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2455 r = create_media_table( hdb );
2456 ok( r == ERROR_SUCCESS, "cannot create media table: %d\n", r );
2458 r = add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''");
2459 ok( r == ERROR_SUCCESS, "cannot add media entry: %d\n", r );
2461 r = create_feature_table( hdb );
2462 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
2464 r = create_component_table( hdb );
2465 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
2467 /* msidbFeatureAttributesFavorLocal */
2468 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
2469 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2471 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2472 r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2473 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2475 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2476 r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2477 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2479 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2480 r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2481 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2483 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2484 r = add_component_entry( hdb, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2485 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2487 /* msidbFeatureAttributesFavorSource */
2488 r = add_feature_entry( hdb, "'two', '', '', '', 2, 1, '', 1" );
2489 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2491 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2492 r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2493 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2495 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2496 r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2497 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2499 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2500 r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2501 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2503 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2504 r = add_component_entry( hdb, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2505 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2507 /* msidbFeatureAttributesFavorSource */
2508 r = add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" );
2509 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2511 /* msidbFeatureAttributesFavorLocal */
2512 r = add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" );
2513 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2515 /* disabled */
2516 r = add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" );
2517 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2519 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2520 r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2521 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2523 /* no feature parent:msidbComponentAttributesLocalOnly */
2524 r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2525 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2527 /* msidbFeatureAttributesFavorLocal:removed */
2528 r = add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" );
2529 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2531 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2532 r = add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2533 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2535 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2536 r = add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2537 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2539 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2540 r = add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2541 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2543 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2544 r = add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2545 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2547 /* msidbFeatureAttributesFavorSource:removed */
2548 r = add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" );
2549 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2551 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2552 r = add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2553 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2555 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2556 r = add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2557 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2559 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2560 r = add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2561 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2563 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2564 r = add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2565 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2567 r = create_feature_components_table( hdb );
2568 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
2570 r = add_feature_components_entry( hdb, "'one', 'alpha'" );
2571 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2573 r = add_feature_components_entry( hdb, "'one', 'beta'" );
2574 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2576 r = add_feature_components_entry( hdb, "'one', 'gamma'" );
2577 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2579 r = add_feature_components_entry( hdb, "'one', 'theta'" );
2580 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2582 r = add_feature_components_entry( hdb, "'two', 'delta'" );
2583 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2585 r = add_feature_components_entry( hdb, "'two', 'epsilon'" );
2586 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2588 r = add_feature_components_entry( hdb, "'two', 'zeta'" );
2589 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2591 r = add_feature_components_entry( hdb, "'two', 'iota'" );
2592 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2594 r = add_feature_components_entry( hdb, "'three', 'eta'" );
2595 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2597 r = add_feature_components_entry( hdb, "'four', 'eta'" );
2598 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2600 r = add_feature_components_entry( hdb, "'five', 'eta'" );
2601 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2603 r = add_feature_components_entry( hdb, "'six', 'lambda'" );
2604 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2606 r = add_feature_components_entry( hdb, "'six', 'mu'" );
2607 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2609 r = add_feature_components_entry( hdb, "'six', 'nu'" );
2610 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2612 r = add_feature_components_entry( hdb, "'six', 'xi'" );
2613 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2615 r = add_feature_components_entry( hdb, "'seven', 'omicron'" );
2616 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2618 r = add_feature_components_entry( hdb, "'seven', 'pi'" );
2619 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2621 r = add_feature_components_entry( hdb, "'seven', 'rho'" );
2622 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2624 r = add_feature_components_entry( hdb, "'seven', 'sigma'" );
2625 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2627 r = create_file_table( hdb );
2628 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
2630 r = add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2631 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2633 r = add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2634 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2636 r = add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2637 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2639 r = add_file_entry( hdb, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2640 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2642 r = add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2643 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2645 r = add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2646 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2648 r = add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2649 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2651 r = add_file_entry( hdb, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2652 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2654 /* compressed file */
2655 r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2656 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2658 r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2659 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2661 r = add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2662 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2664 r = add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2665 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2667 r = add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2668 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2670 r = add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2671 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2673 r = add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2674 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2676 r = add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2677 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2679 r = add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2680 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2682 r = add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2683 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2685 MsiDatabaseCommit(hdb);
2687 /* these properties must not be in the saved msi file */
2688 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
2689 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2691 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
2692 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2694 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
2695 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2697 hpkg = package_from_db( hdb );
2698 ok( hpkg, "failed to create package\n");
2700 MsiCloseHandle(hdb);
2702 CopyFileA(msifile, msifile2, FALSE);
2703 CopyFileA(msifile, msifile3, FALSE);
2705 state = 0xdeadbee;
2706 action = 0xdeadbee;
2707 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2708 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2709 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2710 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2712 state = 0xdeadbee;
2713 action = 0xdeadbee;
2714 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2715 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2716 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2717 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2719 state = 0xdeadbee;
2720 action = 0xdeadbee;
2721 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2722 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2723 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2724 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2726 state = 0xdeadbee;
2727 action = 0xdeadbee;
2728 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2729 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2730 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2731 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2733 state = 0xdeadbee;
2734 action = 0xdeadbee;
2735 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2736 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2737 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2738 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2740 state = 0xdeadbee;
2741 action = 0xdeadbee;
2742 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2743 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2744 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2745 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2747 state = 0xdeadbee;
2748 action = 0xdeadbee;
2749 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2750 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2751 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2752 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2754 state = 0xdeadbee;
2755 action = 0xdeadbee;
2756 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2757 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2758 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2759 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2761 state = 0xdeadbee;
2762 action = 0xdeadbee;
2763 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2764 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2765 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2766 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2768 state = 0xdeadbee;
2769 action = 0xdeadbee;
2770 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2771 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2772 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2773 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2775 state = 0xdeadbee;
2776 action = 0xdeadbee;
2777 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2778 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2779 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2780 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2782 state = 0xdeadbee;
2783 action = 0xdeadbee;
2784 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2785 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2786 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2787 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2789 state = 0xdeadbee;
2790 action = 0xdeadbee;
2791 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2792 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2793 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2794 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2796 state = 0xdeadbee;
2797 action = 0xdeadbee;
2798 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2799 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2800 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2801 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2803 state = 0xdeadbee;
2804 action = 0xdeadbee;
2805 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2806 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2807 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2808 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2810 state = 0xdeadbee;
2811 action = 0xdeadbee;
2812 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2813 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2814 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2815 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2817 state = 0xdeadbee;
2818 action = 0xdeadbee;
2819 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2820 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2821 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2822 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2824 state = 0xdeadbee;
2825 action = 0xdeadbee;
2826 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2827 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2828 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2829 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2831 state = 0xdeadbee;
2832 action = 0xdeadbee;
2833 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2834 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2835 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2836 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2838 state = 0xdeadbee;
2839 action = 0xdeadbee;
2840 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2841 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2842 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2843 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2845 state = 0xdeadbee;
2846 action = 0xdeadbee;
2847 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2848 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2849 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2850 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2852 state = 0xdeadbee;
2853 action = 0xdeadbee;
2854 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
2855 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2856 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2857 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2859 state = 0xdeadbee;
2860 action = 0xdeadbee;
2861 r = MsiGetComponentState(hpkg, "pi", &state, &action);
2862 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2863 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2864 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2866 state = 0xdeadbee;
2867 action = 0xdeadbee;
2868 r = MsiGetComponentState(hpkg, "rho", &state, &action);
2869 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2870 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2871 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2873 state = 0xdeadbee;
2874 action = 0xdeadbee;
2875 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
2876 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2877 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2878 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2880 r = MsiDoAction( hpkg, "CostInitialize");
2881 ok( r == ERROR_SUCCESS, "cost init failed\n");
2883 state = 0xdeadbee;
2884 action = 0xdeadbee;
2885 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2886 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2887 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2888 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2890 state = 0xdeadbee;
2891 action = 0xdeadbee;
2892 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2893 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2894 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2895 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2897 state = 0xdeadbee;
2898 action = 0xdeadbee;
2899 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2900 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2901 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2902 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2904 state = 0xdeadbee;
2905 action = 0xdeadbee;
2906 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2907 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2908 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2909 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2911 state = 0xdeadbee;
2912 action = 0xdeadbee;
2913 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2914 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2915 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2916 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2918 state = 0xdeadbee;
2919 action = 0xdeadbee;
2920 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2921 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2922 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2923 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2925 state = 0xdeadbee;
2926 action = 0xdeadbee;
2927 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2928 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2929 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2930 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2932 state = 0xdeadbee;
2933 action = 0xdeadbee;
2934 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2935 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2936 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2937 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2939 state = 0xdeadbee;
2940 action = 0xdeadbee;
2941 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2942 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2943 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2944 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2946 state = 0xdeadbee;
2947 action = 0xdeadbee;
2948 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2949 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2950 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2951 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2953 state = 0xdeadbee;
2954 action = 0xdeadbee;
2955 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2956 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2957 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2958 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2960 state = 0xdeadbee;
2961 action = 0xdeadbee;
2962 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2963 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2964 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2965 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2967 state = 0xdeadbee;
2968 action = 0xdeadbee;
2969 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2970 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2971 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2972 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2974 state = 0xdeadbee;
2975 action = 0xdeadbee;
2976 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2977 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2978 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2979 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2981 state = 0xdeadbee;
2982 action = 0xdeadbee;
2983 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2984 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2985 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2986 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2988 state = 0xdeadbee;
2989 action = 0xdeadbee;
2990 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2991 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2992 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2993 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2995 state = 0xdeadbee;
2996 action = 0xdeadbee;
2997 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2998 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2999 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3000 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3002 state = 0xdeadbee;
3003 action = 0xdeadbee;
3004 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3005 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3006 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3007 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3009 state = 0xdeadbee;
3010 action = 0xdeadbee;
3011 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3012 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3013 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3014 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3016 state = 0xdeadbee;
3017 action = 0xdeadbee;
3018 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3019 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3020 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3021 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3023 state = 0xdeadbee;
3024 action = 0xdeadbee;
3025 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3026 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3027 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3028 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3030 state = 0xdeadbee;
3031 action = 0xdeadbee;
3032 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3033 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3034 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3035 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3037 state = 0xdeadbee;
3038 action = 0xdeadbee;
3039 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3040 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3041 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3042 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3044 state = 0xdeadbee;
3045 action = 0xdeadbee;
3046 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3047 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3048 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3049 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3051 state = 0xdeadbee;
3052 action = 0xdeadbee;
3053 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3054 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3055 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3056 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3058 r = MsiDoAction( hpkg, "FileCost");
3059 ok( r == ERROR_SUCCESS, "file cost failed\n");
3061 state = 0xdeadbee;
3062 action = 0xdeadbee;
3063 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3064 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3065 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3066 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3068 state = 0xdeadbee;
3069 action = 0xdeadbee;
3070 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3071 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3072 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3073 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3075 state = 0xdeadbee;
3076 action = 0xdeadbee;
3077 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3078 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3079 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3080 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3082 state = 0xdeadbee;
3083 action = 0xdeadbee;
3084 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3085 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3086 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3087 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3089 state = 0xdeadbee;
3090 action = 0xdeadbee;
3091 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3092 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3093 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3094 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3096 state = 0xdeadbee;
3097 action = 0xdeadbee;
3098 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3099 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3100 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3101 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3103 state = 0xdeadbee;
3104 action = 0xdeadbee;
3105 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3106 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3107 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3108 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3110 state = 0xdeadbee;
3111 action = 0xdeadbee;
3112 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3113 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3114 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3115 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3117 state = 0xdeadbee;
3118 action = 0xdeadbee;
3119 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3120 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3121 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3122 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3124 state = 0xdeadbee;
3125 action = 0xdeadbee;
3126 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3127 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3128 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3129 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3131 state = 0xdeadbee;
3132 action = 0xdeadbee;
3133 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3134 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3135 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3136 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3138 state = 0xdeadbee;
3139 action = 0xdeadbee;
3140 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3141 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3142 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3143 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3145 state = 0xdeadbee;
3146 action = 0xdeadbee;
3147 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3148 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3149 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3150 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3152 state = 0xdeadbee;
3153 action = 0xdeadbee;
3154 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3155 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3156 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3157 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3159 state = 0xdeadbee;
3160 action = 0xdeadbee;
3161 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3162 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3163 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3164 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3166 state = 0xdeadbee;
3167 action = 0xdeadbee;
3168 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3169 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3170 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3171 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3173 state = 0xdeadbee;
3174 action = 0xdeadbee;
3175 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3176 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3177 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3178 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3180 state = 0xdeadbee;
3181 action = 0xdeadbee;
3182 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3183 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3184 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3185 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3187 state = 0xdeadbee;
3188 action = 0xdeadbee;
3189 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3190 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3191 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3192 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3194 state = 0xdeadbee;
3195 action = 0xdeadbee;
3196 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3197 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3198 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3199 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3201 state = 0xdeadbee;
3202 action = 0xdeadbee;
3203 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3204 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3205 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3206 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3208 state = 0xdeadbee;
3209 action = 0xdeadbee;
3210 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3211 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3212 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3213 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3215 state = 0xdeadbee;
3216 action = 0xdeadbee;
3217 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3218 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3219 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3220 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3222 state = 0xdeadbee;
3223 action = 0xdeadbee;
3224 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3225 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3226 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3227 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3229 state = 0xdeadbee;
3230 action = 0xdeadbee;
3231 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3232 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3233 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3234 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3236 r = MsiDoAction( hpkg, "CostFinalize");
3237 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3239 state = 0xdeadbee;
3240 action = 0xdeadbee;
3241 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3242 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3243 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3244 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3246 state = 0xdeadbee;
3247 action = 0xdeadbee;
3248 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3249 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3250 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3251 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3253 state = 0xdeadbee;
3254 action = 0xdeadbee;
3255 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3256 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3257 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3258 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3260 state = 0xdeadbee;
3261 action = 0xdeadbee;
3262 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3263 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3264 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3265 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3267 state = 0xdeadbee;
3268 action = 0xdeadbee;
3269 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3270 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3271 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3272 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3274 state = 0xdeadbee;
3275 action = 0xdeadbee;
3276 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3277 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3278 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3279 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3281 state = 0xdeadbee;
3282 action = 0xdeadbee;
3283 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3284 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3285 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3286 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3288 state = 0xdeadbee;
3289 action = 0xdeadbee;
3290 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3291 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3292 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3293 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3295 state = 0xdeadbee;
3296 action = 0xdeadbee;
3297 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3298 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3299 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3300 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3302 state = 0xdeadbee;
3303 action = 0xdeadbee;
3304 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3305 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3306 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3307 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3309 state = 0xdeadbee;
3310 action = 0xdeadbee;
3311 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3312 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3313 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3314 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3316 state = 0xdeadbee;
3317 action = 0xdeadbee;
3318 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3319 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3320 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3321 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3323 state = 0xdeadbee;
3324 action = 0xdeadbee;
3325 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3326 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3327 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3328 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3330 state = 0xdeadbee;
3331 action = 0xdeadbee;
3332 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3333 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3334 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3335 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3337 state = 0xdeadbee;
3338 action = 0xdeadbee;
3339 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3340 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3341 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3342 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3344 state = 0xdeadbee;
3345 action = 0xdeadbee;
3346 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3347 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3348 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3349 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3351 state = 0xdeadbee;
3352 action = 0xdeadbee;
3353 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3354 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3355 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3356 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3358 state = 0xdeadbee;
3359 action = 0xdeadbee;
3360 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3361 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3362 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3363 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3365 state = 0xdeadbee;
3366 action = 0xdeadbee;
3367 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3368 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3369 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3370 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3372 state = 0xdeadbee;
3373 action = 0xdeadbee;
3374 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3375 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3376 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3377 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3379 state = 0xdeadbee;
3380 action = 0xdeadbee;
3381 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3382 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3383 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3384 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3386 state = 0xdeadbee;
3387 action = 0xdeadbee;
3388 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3389 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3390 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3391 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3393 state = 0xdeadbee;
3394 action = 0xdeadbee;
3395 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3396 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3397 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3398 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3400 state = 0xdeadbee;
3401 action = 0xdeadbee;
3402 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3403 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3404 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3405 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3407 state = 0xdeadbee;
3408 action = 0xdeadbee;
3409 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3410 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3411 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3412 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3414 MsiCloseHandle( hpkg );
3416 /* publish the features and components */
3417 r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven");
3418 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3420 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
3421 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
3423 /* these properties must not be in the saved msi file */
3424 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
3425 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3427 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
3428 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3430 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
3431 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3433 hpkg = package_from_db( hdb );
3434 ok( hpkg, "failed to create package\n");
3436 MsiCloseHandle(hdb);
3438 state = 0xdeadbee;
3439 action = 0xdeadbee;
3440 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3441 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3442 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3443 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3445 state = 0xdeadbee;
3446 action = 0xdeadbee;
3447 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3448 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3449 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3450 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3452 state = 0xdeadbee;
3453 action = 0xdeadbee;
3454 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3455 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3456 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3457 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3459 state = 0xdeadbee;
3460 action = 0xdeadbee;
3461 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3462 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3463 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3464 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3466 state = 0xdeadbee;
3467 action = 0xdeadbee;
3468 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3469 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3470 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3471 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3473 state = 0xdeadbee;
3474 action = 0xdeadbee;
3475 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3476 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3477 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3478 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3480 state = 0xdeadbee;
3481 action = 0xdeadbee;
3482 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3483 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3484 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3485 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3487 state = 0xdeadbee;
3488 action = 0xdeadbee;
3489 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3490 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3491 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3492 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3494 state = 0xdeadbee;
3495 action = 0xdeadbee;
3496 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3497 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3498 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3499 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3501 state = 0xdeadbee;
3502 action = 0xdeadbee;
3503 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3504 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3505 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3506 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3508 state = 0xdeadbee;
3509 action = 0xdeadbee;
3510 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3511 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3512 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3513 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3515 state = 0xdeadbee;
3516 action = 0xdeadbee;
3517 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3518 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3519 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3520 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3522 state = 0xdeadbee;
3523 action = 0xdeadbee;
3524 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3525 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3526 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3527 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3529 state = 0xdeadbee;
3530 action = 0xdeadbee;
3531 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3532 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3533 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3534 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3536 state = 0xdeadbee;
3537 action = 0xdeadbee;
3538 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3539 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3540 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3541 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3543 state = 0xdeadbee;
3544 action = 0xdeadbee;
3545 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3546 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3547 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3548 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3550 state = 0xdeadbee;
3551 action = 0xdeadbee;
3552 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3553 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3554 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3555 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3557 state = 0xdeadbee;
3558 action = 0xdeadbee;
3559 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3560 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3561 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3562 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3564 state = 0xdeadbee;
3565 action = 0xdeadbee;
3566 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3567 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3568 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3569 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3571 state = 0xdeadbee;
3572 action = 0xdeadbee;
3573 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3574 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3575 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3576 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3578 state = 0xdeadbee;
3579 action = 0xdeadbee;
3580 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3581 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3582 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3583 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3585 state = 0xdeadbee;
3586 action = 0xdeadbee;
3587 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3588 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3589 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3590 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3592 state = 0xdeadbee;
3593 action = 0xdeadbee;
3594 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3595 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3596 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3597 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3599 state = 0xdeadbee;
3600 action = 0xdeadbee;
3601 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3602 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3603 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3604 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3606 state = 0xdeadbee;
3607 action = 0xdeadbee;
3608 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3609 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3610 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3611 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3613 r = MsiDoAction( hpkg, "CostInitialize");
3614 ok( r == ERROR_SUCCESS, "cost init failed\n");
3616 state = 0xdeadbee;
3617 action = 0xdeadbee;
3618 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3619 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3620 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3621 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3623 state = 0xdeadbee;
3624 action = 0xdeadbee;
3625 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3626 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3627 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3628 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3630 state = 0xdeadbee;
3631 action = 0xdeadbee;
3632 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3633 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3634 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3635 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3637 state = 0xdeadbee;
3638 action = 0xdeadbee;
3639 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3640 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3641 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3642 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3644 state = 0xdeadbee;
3645 action = 0xdeadbee;
3646 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3647 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3648 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3649 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3651 state = 0xdeadbee;
3652 action = 0xdeadbee;
3653 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3654 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3655 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3656 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3658 state = 0xdeadbee;
3659 action = 0xdeadbee;
3660 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3661 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3662 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3663 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3665 state = 0xdeadbee;
3666 action = 0xdeadbee;
3667 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3668 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3669 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3670 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3672 state = 0xdeadbee;
3673 action = 0xdeadbee;
3674 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3675 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3676 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3677 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3679 state = 0xdeadbee;
3680 action = 0xdeadbee;
3681 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3682 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3683 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3684 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3686 state = 0xdeadbee;
3687 action = 0xdeadbee;
3688 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3689 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3690 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3691 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3693 state = 0xdeadbee;
3694 action = 0xdeadbee;
3695 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3696 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3697 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3698 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3700 state = 0xdeadbee;
3701 action = 0xdeadbee;
3702 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3703 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3704 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3705 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3707 state = 0xdeadbee;
3708 action = 0xdeadbee;
3709 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3710 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3711 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3712 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3714 state = 0xdeadbee;
3715 action = 0xdeadbee;
3716 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3717 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3718 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3719 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3721 state = 0xdeadbee;
3722 action = 0xdeadbee;
3723 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3724 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3725 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3726 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3728 state = 0xdeadbee;
3729 action = 0xdeadbee;
3730 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3731 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3732 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3733 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3735 state = 0xdeadbee;
3736 action = 0xdeadbee;
3737 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3738 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3739 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3740 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3742 state = 0xdeadbee;
3743 action = 0xdeadbee;
3744 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3745 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3746 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3747 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3749 state = 0xdeadbee;
3750 action = 0xdeadbee;
3751 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3752 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3753 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3754 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3756 state = 0xdeadbee;
3757 action = 0xdeadbee;
3758 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3759 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3760 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3761 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3763 state = 0xdeadbee;
3764 action = 0xdeadbee;
3765 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3766 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3767 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3768 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3770 state = 0xdeadbee;
3771 action = 0xdeadbee;
3772 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3773 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3774 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3775 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3777 state = 0xdeadbee;
3778 action = 0xdeadbee;
3779 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3780 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3781 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3782 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3784 state = 0xdeadbee;
3785 action = 0xdeadbee;
3786 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3787 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3788 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3789 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3791 r = MsiDoAction( hpkg, "FileCost");
3792 ok( r == ERROR_SUCCESS, "file cost failed\n");
3794 state = 0xdeadbee;
3795 action = 0xdeadbee;
3796 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3797 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3798 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3799 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3801 state = 0xdeadbee;
3802 action = 0xdeadbee;
3803 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3804 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3805 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3806 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3808 state = 0xdeadbee;
3809 action = 0xdeadbee;
3810 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3811 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3812 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3813 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3815 state = 0xdeadbee;
3816 action = 0xdeadbee;
3817 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3818 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3819 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3820 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3822 state = 0xdeadbee;
3823 action = 0xdeadbee;
3824 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3825 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3826 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3827 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3829 state = 0xdeadbee;
3830 action = 0xdeadbee;
3831 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3832 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3833 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3834 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3836 state = 0xdeadbee;
3837 action = 0xdeadbee;
3838 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3839 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3840 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3841 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3843 state = 0xdeadbee;
3844 action = 0xdeadbee;
3845 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3846 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3847 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3848 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3850 state = 0xdeadbee;
3851 action = 0xdeadbee;
3852 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3853 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3854 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3855 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3857 state = 0xdeadbee;
3858 action = 0xdeadbee;
3859 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3860 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3861 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3862 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3864 state = 0xdeadbee;
3865 action = 0xdeadbee;
3866 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3867 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3868 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3869 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3871 state = 0xdeadbee;
3872 action = 0xdeadbee;
3873 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3874 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3875 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3876 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3878 state = 0xdeadbee;
3879 action = 0xdeadbee;
3880 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3881 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3882 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3883 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3885 state = 0xdeadbee;
3886 action = 0xdeadbee;
3887 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3888 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3889 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3890 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3892 state = 0xdeadbee;
3893 action = 0xdeadbee;
3894 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3895 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3896 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3897 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3899 state = 0xdeadbee;
3900 action = 0xdeadbee;
3901 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3902 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3903 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3904 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3906 state = 0xdeadbee;
3907 action = 0xdeadbee;
3908 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3909 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3910 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3911 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3913 state = 0xdeadbee;
3914 action = 0xdeadbee;
3915 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3916 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3917 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3918 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3920 state = 0xdeadbee;
3921 action = 0xdeadbee;
3922 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3923 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3924 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3925 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3927 state = 0xdeadbee;
3928 action = 0xdeadbee;
3929 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3930 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3931 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3932 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3934 state = 0xdeadbee;
3935 action = 0xdeadbee;
3936 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3937 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3938 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3939 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3941 state = 0xdeadbee;
3942 action = 0xdeadbee;
3943 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3944 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3945 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3946 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3948 state = 0xdeadbee;
3949 action = 0xdeadbee;
3950 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3951 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3952 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3953 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3955 state = 0xdeadbee;
3956 action = 0xdeadbee;
3957 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3958 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3959 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3960 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3962 state = 0xdeadbee;
3963 action = 0xdeadbee;
3964 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3965 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3966 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3967 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3969 r = MsiDoAction( hpkg, "CostFinalize");
3970 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3972 state = 0xdeadbee;
3973 action = 0xdeadbee;
3974 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3975 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3976 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3977 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3979 state = 0xdeadbee;
3980 action = 0xdeadbee;
3981 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3982 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3983 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3984 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3986 state = 0xdeadbee;
3987 action = 0xdeadbee;
3988 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3989 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3990 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3991 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3993 state = 0xdeadbee;
3994 action = 0xdeadbee;
3995 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3996 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3997 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3998 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4000 state = 0xdeadbee;
4001 action = 0xdeadbee;
4002 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4003 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4004 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4005 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4007 state = 0xdeadbee;
4008 action = 0xdeadbee;
4009 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4010 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4011 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4012 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4014 state = 0xdeadbee;
4015 action = 0xdeadbee;
4016 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4017 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4018 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4019 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4021 state = 0xdeadbee;
4022 action = 0xdeadbee;
4023 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4024 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4025 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4026 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4028 state = 0xdeadbee;
4029 action = 0xdeadbee;
4030 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4031 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4032 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4033 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4035 state = 0xdeadbee;
4036 action = 0xdeadbee;
4037 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4038 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4039 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4040 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4042 state = 0xdeadbee;
4043 action = 0xdeadbee;
4044 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4045 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4046 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4047 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4049 state = 0xdeadbee;
4050 action = 0xdeadbee;
4051 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4052 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4053 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4054 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4056 state = 0xdeadbee;
4057 action = 0xdeadbee;
4058 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4059 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4060 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4061 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4063 state = 0xdeadbee;
4064 action = 0xdeadbee;
4065 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4066 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4067 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4068 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4070 state = 0xdeadbee;
4071 action = 0xdeadbee;
4072 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4073 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4074 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4075 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4077 state = 0xdeadbee;
4078 action = 0xdeadbee;
4079 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4080 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4081 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4082 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4084 state = 0xdeadbee;
4085 action = 0xdeadbee;
4086 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4087 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4088 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4089 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4091 state = 0xdeadbee;
4092 action = 0xdeadbee;
4093 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4094 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4095 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4096 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4098 state = 0xdeadbee;
4099 action = 0xdeadbee;
4100 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4101 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4102 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4103 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4105 state = 0xdeadbee;
4106 action = 0xdeadbee;
4107 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4108 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4109 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4110 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4112 state = 0xdeadbee;
4113 action = 0xdeadbee;
4114 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4115 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4116 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4117 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4119 state = 0xdeadbee;
4120 action = 0xdeadbee;
4121 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4122 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4123 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4124 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4126 state = 0xdeadbee;
4127 action = 0xdeadbee;
4128 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4129 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4130 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4131 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4133 state = 0xdeadbee;
4134 action = 0xdeadbee;
4135 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4136 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4137 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4138 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4140 state = 0xdeadbee;
4141 action = 0xdeadbee;
4142 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4143 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4144 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4145 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4147 MsiCloseHandle(hpkg);
4149 /* uninstall the product */
4150 r = MsiInstallProduct(msifile, "REMOVE=ALL");
4151 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4153 /* all features installed locally */
4154 r = MsiInstallProduct(msifile2, "ADDLOCAL=ALL");
4155 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4157 r = MsiOpenDatabase(msifile2, MSIDBOPEN_DIRECT, &hdb);
4158 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
4160 /* these properties must not be in the saved msi file */
4161 r = add_property_entry( hdb, "'ADDLOCAL', 'one,two,three,four,five,six,seven'");
4162 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
4164 hpkg = package_from_db( hdb );
4165 ok( hpkg, "failed to create package\n");
4167 state = 0xdeadbee;
4168 action = 0xdeadbee;
4169 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4170 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4171 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4172 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4174 state = 0xdeadbee;
4175 action = 0xdeadbee;
4176 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4177 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4178 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4179 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4181 state = 0xdeadbee;
4182 action = 0xdeadbee;
4183 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4184 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4185 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4186 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4188 state = 0xdeadbee;
4189 action = 0xdeadbee;
4190 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4191 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4192 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4193 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4195 state = 0xdeadbee;
4196 action = 0xdeadbee;
4197 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4198 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4199 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4200 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4202 state = 0xdeadbee;
4203 action = 0xdeadbee;
4204 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4205 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4206 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4207 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4209 state = 0xdeadbee;
4210 action = 0xdeadbee;
4211 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4212 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4213 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4214 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4216 state = 0xdeadbee;
4217 action = 0xdeadbee;
4218 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4219 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4220 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4221 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4223 state = 0xdeadbee;
4224 action = 0xdeadbee;
4225 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4226 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4227 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4228 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4230 state = 0xdeadbee;
4231 action = 0xdeadbee;
4232 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4233 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4234 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4235 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4237 state = 0xdeadbee;
4238 action = 0xdeadbee;
4239 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4240 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4241 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4242 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4244 state = 0xdeadbee;
4245 action = 0xdeadbee;
4246 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4247 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4248 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4249 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4251 state = 0xdeadbee;
4252 action = 0xdeadbee;
4253 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4254 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4255 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4256 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4258 state = 0xdeadbee;
4259 action = 0xdeadbee;
4260 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4261 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4262 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4263 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4265 state = 0xdeadbee;
4266 action = 0xdeadbee;
4267 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4268 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4269 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4270 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4272 state = 0xdeadbee;
4273 action = 0xdeadbee;
4274 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4275 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4276 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4277 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4279 state = 0xdeadbee;
4280 action = 0xdeadbee;
4281 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4282 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4283 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4284 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4286 state = 0xdeadbee;
4287 action = 0xdeadbee;
4288 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4289 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4290 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4291 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4293 state = 0xdeadbee;
4294 action = 0xdeadbee;
4295 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4296 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4297 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4298 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4300 state = 0xdeadbee;
4301 action = 0xdeadbee;
4302 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4303 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4304 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4305 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4307 state = 0xdeadbee;
4308 action = 0xdeadbee;
4309 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4310 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4311 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4312 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4314 state = 0xdeadbee;
4315 action = 0xdeadbee;
4316 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4317 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4318 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4319 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4321 state = 0xdeadbee;
4322 action = 0xdeadbee;
4323 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4324 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4325 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4326 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4328 state = 0xdeadbee;
4329 action = 0xdeadbee;
4330 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4331 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4332 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4333 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4335 state = 0xdeadbee;
4336 action = 0xdeadbee;
4337 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4338 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4339 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4340 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4342 r = MsiDoAction( hpkg, "CostInitialize");
4343 ok( r == ERROR_SUCCESS, "cost init failed\n");
4345 state = 0xdeadbee;
4346 action = 0xdeadbee;
4347 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4348 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4349 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4350 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4352 state = 0xdeadbee;
4353 action = 0xdeadbee;
4354 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4355 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4356 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4357 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4359 state = 0xdeadbee;
4360 action = 0xdeadbee;
4361 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4362 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4363 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4364 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4366 state = 0xdeadbee;
4367 action = 0xdeadbee;
4368 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4369 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4370 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4371 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4373 state = 0xdeadbee;
4374 action = 0xdeadbee;
4375 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4376 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4377 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4378 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4380 state = 0xdeadbee;
4381 action = 0xdeadbee;
4382 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4383 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4384 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4385 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4387 state = 0xdeadbee;
4388 action = 0xdeadbee;
4389 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4390 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4391 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4392 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4394 state = 0xdeadbee;
4395 action = 0xdeadbee;
4396 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4397 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4398 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4399 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4401 state = 0xdeadbee;
4402 action = 0xdeadbee;
4403 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4404 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4405 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4406 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4408 state = 0xdeadbee;
4409 action = 0xdeadbee;
4410 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4411 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4412 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4413 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4415 state = 0xdeadbee;
4416 action = 0xdeadbee;
4417 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4418 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4419 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4420 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4422 state = 0xdeadbee;
4423 action = 0xdeadbee;
4424 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4425 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4426 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4427 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4429 state = 0xdeadbee;
4430 action = 0xdeadbee;
4431 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4432 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4433 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4434 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4436 state = 0xdeadbee;
4437 action = 0xdeadbee;
4438 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4439 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4440 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4441 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4443 state = 0xdeadbee;
4444 action = 0xdeadbee;
4445 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4446 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4447 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4448 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4450 state = 0xdeadbee;
4451 action = 0xdeadbee;
4452 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4453 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4454 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4455 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4457 state = 0xdeadbee;
4458 action = 0xdeadbee;
4459 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4460 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4461 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4462 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4464 state = 0xdeadbee;
4465 action = 0xdeadbee;
4466 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4467 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4468 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4469 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4471 state = 0xdeadbee;
4472 action = 0xdeadbee;
4473 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4474 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4475 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4476 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4478 state = 0xdeadbee;
4479 action = 0xdeadbee;
4480 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4481 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4482 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4483 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4485 state = 0xdeadbee;
4486 action = 0xdeadbee;
4487 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4488 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4489 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4490 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4492 state = 0xdeadbee;
4493 action = 0xdeadbee;
4494 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4495 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4496 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4497 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4499 state = 0xdeadbee;
4500 action = 0xdeadbee;
4501 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4502 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4503 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4504 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4506 state = 0xdeadbee;
4507 action = 0xdeadbee;
4508 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4509 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4510 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4511 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4513 state = 0xdeadbee;
4514 action = 0xdeadbee;
4515 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4516 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4517 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4518 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4520 r = MsiDoAction( hpkg, "FileCost");
4521 ok( r == ERROR_SUCCESS, "file cost failed\n");
4523 state = 0xdeadbee;
4524 action = 0xdeadbee;
4525 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4526 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4527 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4528 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4530 state = 0xdeadbee;
4531 action = 0xdeadbee;
4532 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4533 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4534 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4535 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4537 state = 0xdeadbee;
4538 action = 0xdeadbee;
4539 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4540 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4541 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4542 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4544 state = 0xdeadbee;
4545 action = 0xdeadbee;
4546 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4547 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4548 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4549 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4551 state = 0xdeadbee;
4552 action = 0xdeadbee;
4553 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4554 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4555 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4556 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4558 state = 0xdeadbee;
4559 action = 0xdeadbee;
4560 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4561 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4562 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4563 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4565 state = 0xdeadbee;
4566 action = 0xdeadbee;
4567 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4568 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4569 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4570 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4572 state = 0xdeadbee;
4573 action = 0xdeadbee;
4574 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4575 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4576 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4577 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4579 state = 0xdeadbee;
4580 action = 0xdeadbee;
4581 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4582 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4583 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4584 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4586 state = 0xdeadbee;
4587 action = 0xdeadbee;
4588 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4589 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4590 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4591 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4593 state = 0xdeadbee;
4594 action = 0xdeadbee;
4595 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4596 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4597 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4598 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4600 state = 0xdeadbee;
4601 action = 0xdeadbee;
4602 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4603 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4604 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4605 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4607 state = 0xdeadbee;
4608 action = 0xdeadbee;
4609 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4610 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4611 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4612 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4614 state = 0xdeadbee;
4615 action = 0xdeadbee;
4616 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4617 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4618 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4619 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4621 state = 0xdeadbee;
4622 action = 0xdeadbee;
4623 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4624 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4625 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4626 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4628 state = 0xdeadbee;
4629 action = 0xdeadbee;
4630 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4631 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4632 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4633 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4635 state = 0xdeadbee;
4636 action = 0xdeadbee;
4637 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4638 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4639 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4640 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4642 state = 0xdeadbee;
4643 action = 0xdeadbee;
4644 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4645 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4646 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4647 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4649 state = 0xdeadbee;
4650 action = 0xdeadbee;
4651 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4652 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4653 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4654 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4656 state = 0xdeadbee;
4657 action = 0xdeadbee;
4658 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4659 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4660 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4661 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4663 state = 0xdeadbee;
4664 action = 0xdeadbee;
4665 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4666 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4667 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4668 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4670 state = 0xdeadbee;
4671 action = 0xdeadbee;
4672 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4673 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4674 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4675 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4677 state = 0xdeadbee;
4678 action = 0xdeadbee;
4679 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4680 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4681 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4682 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4684 state = 0xdeadbee;
4685 action = 0xdeadbee;
4686 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4687 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4688 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4689 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4691 state = 0xdeadbee;
4692 action = 0xdeadbee;
4693 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4694 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4695 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4696 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4698 r = MsiDoAction( hpkg, "CostFinalize");
4699 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
4701 state = 0xdeadbee;
4702 action = 0xdeadbee;
4703 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4704 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4705 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4706 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4708 state = 0xdeadbee;
4709 action = 0xdeadbee;
4710 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4711 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4712 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4713 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4715 state = 0xdeadbee;
4716 action = 0xdeadbee;
4717 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4718 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4719 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4720 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4722 state = 0xdeadbee;
4723 action = 0xdeadbee;
4724 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4725 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4726 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4727 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4729 state = 0xdeadbee;
4730 action = 0xdeadbee;
4731 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4732 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4733 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4734 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4736 state = 0xdeadbee;
4737 action = 0xdeadbee;
4738 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4739 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4740 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4741 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4743 state = 0xdeadbee;
4744 action = 0xdeadbee;
4745 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4746 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4747 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4748 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4750 state = 0xdeadbee;
4751 action = 0xdeadbee;
4752 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4753 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4754 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4755 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4757 state = 0xdeadbee;
4758 action = 0xdeadbee;
4759 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4760 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4761 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4762 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4764 state = 0xdeadbee;
4765 action = 0xdeadbee;
4766 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4767 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4768 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4769 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4771 state = 0xdeadbee;
4772 action = 0xdeadbee;
4773 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4774 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4775 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4776 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4778 state = 0xdeadbee;
4779 action = 0xdeadbee;
4780 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4781 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4782 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4783 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4785 state = 0xdeadbee;
4786 action = 0xdeadbee;
4787 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4788 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4789 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4790 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4792 state = 0xdeadbee;
4793 action = 0xdeadbee;
4794 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4795 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4796 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4797 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4799 state = 0xdeadbee;
4800 action = 0xdeadbee;
4801 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4802 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4803 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4804 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4806 state = 0xdeadbee;
4807 action = 0xdeadbee;
4808 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4809 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4810 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4811 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4813 state = 0xdeadbee;
4814 action = 0xdeadbee;
4815 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4816 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4817 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4818 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4820 state = 0xdeadbee;
4821 action = 0xdeadbee;
4822 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4823 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4824 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4825 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4827 state = 0xdeadbee;
4828 action = 0xdeadbee;
4829 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4830 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4831 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4832 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4834 state = 0xdeadbee;
4835 action = 0xdeadbee;
4836 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4837 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4838 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4839 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4841 state = 0xdeadbee;
4842 action = 0xdeadbee;
4843 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4844 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4845 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4846 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4848 state = 0xdeadbee;
4849 action = 0xdeadbee;
4850 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4851 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4852 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4853 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4855 state = 0xdeadbee;
4856 action = 0xdeadbee;
4857 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4858 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4859 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4860 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4862 state = 0xdeadbee;
4863 action = 0xdeadbee;
4864 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4865 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4866 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4867 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4869 state = 0xdeadbee;
4870 action = 0xdeadbee;
4871 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4872 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4873 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4874 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4876 MsiCloseHandle(hpkg);
4878 /* uninstall the product */
4879 r = MsiInstallProduct(msifile2, "REMOVE=ALL");
4880 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4882 /* all features installed from source */
4883 r = MsiInstallProduct(msifile3, "ADDSOURCE=ALL");
4884 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4886 r = MsiOpenDatabase(msifile3, MSIDBOPEN_DIRECT, &hdb);
4887 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
4889 /* this property must not be in the saved msi file */
4890 r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven'");
4891 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
4893 hpkg = package_from_db( hdb );
4894 ok( hpkg, "failed to create package\n");
4896 state = 0xdeadbee;
4897 action = 0xdeadbee;
4898 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4899 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4900 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4901 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4903 state = 0xdeadbee;
4904 action = 0xdeadbee;
4905 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4906 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4907 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4908 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4910 state = 0xdeadbee;
4911 action = 0xdeadbee;
4912 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4913 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4914 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4915 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4917 state = 0xdeadbee;
4918 action = 0xdeadbee;
4919 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4920 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4921 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4922 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4924 state = 0xdeadbee;
4925 action = 0xdeadbee;
4926 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4927 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4928 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4929 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4931 state = 0xdeadbee;
4932 action = 0xdeadbee;
4933 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4934 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4935 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4936 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4938 state = 0xdeadbee;
4939 action = 0xdeadbee;
4940 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4941 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4942 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4943 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4945 state = 0xdeadbee;
4946 action = 0xdeadbee;
4947 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4948 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4949 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4950 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4952 state = 0xdeadbee;
4953 action = 0xdeadbee;
4954 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4955 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4956 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4957 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4959 state = 0xdeadbee;
4960 action = 0xdeadbee;
4961 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4962 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4963 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4964 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4966 state = 0xdeadbee;
4967 action = 0xdeadbee;
4968 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4969 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4970 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4971 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4973 state = 0xdeadbee;
4974 action = 0xdeadbee;
4975 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4976 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4977 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4978 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4980 state = 0xdeadbee;
4981 action = 0xdeadbee;
4982 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4983 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4984 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4985 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4987 state = 0xdeadbee;
4988 action = 0xdeadbee;
4989 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4990 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4991 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4992 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4994 state = 0xdeadbee;
4995 action = 0xdeadbee;
4996 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4997 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4998 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4999 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5001 state = 0xdeadbee;
5002 action = 0xdeadbee;
5003 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5004 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5005 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5006 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5008 state = 0xdeadbee;
5009 action = 0xdeadbee;
5010 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5011 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5012 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5013 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5015 state = 0xdeadbee;
5016 action = 0xdeadbee;
5017 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5018 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5019 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5020 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5022 state = 0xdeadbee;
5023 action = 0xdeadbee;
5024 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5025 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5026 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5027 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5029 state = 0xdeadbee;
5030 action = 0xdeadbee;
5031 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5032 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5033 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5034 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5036 state = 0xdeadbee;
5037 action = 0xdeadbee;
5038 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5039 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5040 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5041 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5043 state = 0xdeadbee;
5044 action = 0xdeadbee;
5045 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5046 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5047 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5048 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5050 state = 0xdeadbee;
5051 action = 0xdeadbee;
5052 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5053 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5054 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5055 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5057 state = 0xdeadbee;
5058 action = 0xdeadbee;
5059 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5060 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5061 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5062 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5064 state = 0xdeadbee;
5065 action = 0xdeadbee;
5066 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5067 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5068 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5069 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5071 r = MsiDoAction( hpkg, "CostInitialize");
5072 ok( r == ERROR_SUCCESS, "cost init failed\n");
5074 state = 0xdeadbee;
5075 action = 0xdeadbee;
5076 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5077 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5078 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5079 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5081 state = 0xdeadbee;
5082 action = 0xdeadbee;
5083 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5084 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5085 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5086 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5088 state = 0xdeadbee;
5089 action = 0xdeadbee;
5090 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5091 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5092 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5093 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5095 state = 0xdeadbee;
5096 action = 0xdeadbee;
5097 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5098 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5099 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5100 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5102 state = 0xdeadbee;
5103 action = 0xdeadbee;
5104 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5105 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5106 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5107 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5109 state = 0xdeadbee;
5110 action = 0xdeadbee;
5111 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5112 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5113 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5114 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5116 state = 0xdeadbee;
5117 action = 0xdeadbee;
5118 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5119 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5120 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5121 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5123 state = 0xdeadbee;
5124 action = 0xdeadbee;
5125 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5126 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5127 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5128 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5130 state = 0xdeadbee;
5131 action = 0xdeadbee;
5132 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5133 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5134 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5135 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5137 state = 0xdeadbee;
5138 action = 0xdeadbee;
5139 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5140 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5141 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5142 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5144 state = 0xdeadbee;
5145 action = 0xdeadbee;
5146 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5147 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5148 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5149 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5151 state = 0xdeadbee;
5152 action = 0xdeadbee;
5153 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5154 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5155 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5156 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5158 state = 0xdeadbee;
5159 action = 0xdeadbee;
5160 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5161 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5162 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5163 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5165 state = 0xdeadbee;
5166 action = 0xdeadbee;
5167 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5168 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5169 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5170 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5172 state = 0xdeadbee;
5173 action = 0xdeadbee;
5174 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5175 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5176 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5177 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5179 state = 0xdeadbee;
5180 action = 0xdeadbee;
5181 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5182 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5183 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5184 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5186 state = 0xdeadbee;
5187 action = 0xdeadbee;
5188 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5189 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5190 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5191 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5193 state = 0xdeadbee;
5194 action = 0xdeadbee;
5195 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5196 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5197 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5198 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5200 state = 0xdeadbee;
5201 action = 0xdeadbee;
5202 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5203 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5204 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5205 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5207 state = 0xdeadbee;
5208 action = 0xdeadbee;
5209 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5210 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5211 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5212 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5214 state = 0xdeadbee;
5215 action = 0xdeadbee;
5216 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5217 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5218 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5219 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5221 state = 0xdeadbee;
5222 action = 0xdeadbee;
5223 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5224 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5225 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5226 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5228 state = 0xdeadbee;
5229 action = 0xdeadbee;
5230 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5231 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5232 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5233 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5235 state = 0xdeadbee;
5236 action = 0xdeadbee;
5237 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5238 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5239 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5240 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5242 state = 0xdeadbee;
5243 action = 0xdeadbee;
5244 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5245 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5246 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5247 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5249 r = MsiDoAction( hpkg, "FileCost");
5250 ok( r == ERROR_SUCCESS, "file cost failed\n");
5252 state = 0xdeadbee;
5253 action = 0xdeadbee;
5254 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5255 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5256 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5257 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5259 state = 0xdeadbee;
5260 action = 0xdeadbee;
5261 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5262 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5263 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5264 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5266 state = 0xdeadbee;
5267 action = 0xdeadbee;
5268 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5269 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5270 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5271 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5273 state = 0xdeadbee;
5274 action = 0xdeadbee;
5275 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5276 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5277 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5278 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5280 state = 0xdeadbee;
5281 action = 0xdeadbee;
5282 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5283 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5284 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5285 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5287 state = 0xdeadbee;
5288 action = 0xdeadbee;
5289 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5290 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5291 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5292 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5294 state = 0xdeadbee;
5295 action = 0xdeadbee;
5296 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5297 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5298 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5299 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5301 state = 0xdeadbee;
5302 action = 0xdeadbee;
5303 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5304 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5305 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5306 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5308 state = 0xdeadbee;
5309 action = 0xdeadbee;
5310 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5311 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5312 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5313 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5315 state = 0xdeadbee;
5316 action = 0xdeadbee;
5317 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5318 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5319 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5320 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5322 state = 0xdeadbee;
5323 action = 0xdeadbee;
5324 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5325 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5326 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5327 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5329 state = 0xdeadbee;
5330 action = 0xdeadbee;
5331 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5332 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5333 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5334 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5336 state = 0xdeadbee;
5337 action = 0xdeadbee;
5338 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5339 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5340 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5341 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5343 state = 0xdeadbee;
5344 action = 0xdeadbee;
5345 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5346 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5347 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5348 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5350 state = 0xdeadbee;
5351 action = 0xdeadbee;
5352 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5353 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5354 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5355 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5357 state = 0xdeadbee;
5358 action = 0xdeadbee;
5359 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5360 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5361 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5362 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5364 state = 0xdeadbee;
5365 action = 0xdeadbee;
5366 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5367 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5368 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5369 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5371 state = 0xdeadbee;
5372 action = 0xdeadbee;
5373 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5374 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5375 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5376 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5378 state = 0xdeadbee;
5379 action = 0xdeadbee;
5380 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5381 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5382 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5383 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5385 state = 0xdeadbee;
5386 action = 0xdeadbee;
5387 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5388 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5389 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5390 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5392 state = 0xdeadbee;
5393 action = 0xdeadbee;
5394 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5395 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5396 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5397 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5399 state = 0xdeadbee;
5400 action = 0xdeadbee;
5401 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5402 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5403 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5404 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5406 state = 0xdeadbee;
5407 action = 0xdeadbee;
5408 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5409 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5410 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5411 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5413 state = 0xdeadbee;
5414 action = 0xdeadbee;
5415 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5416 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5417 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5418 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5420 state = 0xdeadbee;
5421 action = 0xdeadbee;
5422 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5423 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5424 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5425 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5427 r = MsiDoAction( hpkg, "CostFinalize");
5428 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
5430 state = 0xdeadbee;
5431 action = 0xdeadbee;
5432 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5433 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5434 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5435 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5437 state = 0xdeadbee;
5438 action = 0xdeadbee;
5439 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5440 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5441 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5442 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5444 state = 0xdeadbee;
5445 action = 0xdeadbee;
5446 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5447 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5448 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5449 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5451 state = 0xdeadbee;
5452 action = 0xdeadbee;
5453 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5454 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5455 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5456 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5458 state = 0xdeadbee;
5459 action = 0xdeadbee;
5460 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5461 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5462 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5463 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5465 state = 0xdeadbee;
5466 action = 0xdeadbee;
5467 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5468 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5469 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5470 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5472 state = 0xdeadbee;
5473 action = 0xdeadbee;
5474 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5475 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5476 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5477 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5479 state = 0xdeadbee;
5480 action = 0xdeadbee;
5481 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5482 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5483 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5484 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5486 state = 0xdeadbee;
5487 action = 0xdeadbee;
5488 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5489 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5490 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5491 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5493 state = 0xdeadbee;
5494 action = 0xdeadbee;
5495 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5496 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5497 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5498 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5500 state = 0xdeadbee;
5501 action = 0xdeadbee;
5502 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5503 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5504 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5505 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5507 state = 0xdeadbee;
5508 action = 0xdeadbee;
5509 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5510 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5511 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5512 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5514 state = 0xdeadbee;
5515 action = 0xdeadbee;
5516 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5517 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5518 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5519 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5521 state = 0xdeadbee;
5522 action = 0xdeadbee;
5523 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5524 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5525 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5526 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5528 state = 0xdeadbee;
5529 action = 0xdeadbee;
5530 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5531 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5532 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5533 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5535 state = 0xdeadbee;
5536 action = 0xdeadbee;
5537 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5538 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5539 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5540 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5542 state = 0xdeadbee;
5543 action = 0xdeadbee;
5544 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5545 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5546 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5547 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5549 state = 0xdeadbee;
5550 action = 0xdeadbee;
5551 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5552 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5553 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5554 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5556 state = 0xdeadbee;
5557 action = 0xdeadbee;
5558 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5559 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5560 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5561 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5563 state = 0xdeadbee;
5564 action = 0xdeadbee;
5565 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5566 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5567 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5568 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5570 state = 0xdeadbee;
5571 action = 0xdeadbee;
5572 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5573 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5574 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5575 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5577 state = 0xdeadbee;
5578 action = 0xdeadbee;
5579 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5580 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5581 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5582 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5584 state = 0xdeadbee;
5585 action = 0xdeadbee;
5586 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5587 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5588 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5589 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5591 state = 0xdeadbee;
5592 action = 0xdeadbee;
5593 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5594 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5595 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5596 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5598 state = 0xdeadbee;
5599 action = 0xdeadbee;
5600 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5601 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5602 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5603 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5605 MsiCloseHandle(hpkg);
5607 /* uninstall the product */
5608 r = MsiInstallProduct(msifile3, "REMOVE=ALL");
5609 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5611 DeleteFileA(msifile);
5612 DeleteFileA(msifile2);
5613 DeleteFileA(msifile3);
5616 static void test_getproperty(void)
5618 MSIHANDLE hPackage = 0;
5619 char prop[100];
5620 static CHAR empty[] = "";
5621 DWORD size;
5622 UINT r;
5624 hPackage = package_from_db(create_package_db());
5625 ok( hPackage != 0, " Failed to create package\n");
5627 /* set the property */
5628 r = MsiSetProperty(hPackage, "Name", "Value");
5629 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5631 /* retrieve the size, NULL pointer */
5632 size = 0;
5633 r = MsiGetProperty(hPackage, "Name", NULL, &size);
5634 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5635 ok( size == 5, "Expected 5, got %d\n", size);
5637 /* retrieve the size, empty string */
5638 size = 0;
5639 r = MsiGetProperty(hPackage, "Name", empty, &size);
5640 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
5641 ok( size == 5, "Expected 5, got %d\n", size);
5643 /* don't change size */
5644 r = MsiGetProperty(hPackage, "Name", prop, &size);
5645 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
5646 ok( size == 5, "Expected 5, got %d\n", size);
5647 ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
5649 /* increase the size by 1 */
5650 size++;
5651 r = MsiGetProperty(hPackage, "Name", prop, &size);
5652 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5653 ok( size == 5, "Expected 5, got %d\n", size);
5654 ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
5656 r = MsiCloseHandle( hPackage);
5657 ok( r == ERROR_SUCCESS , "Failed to close package\n" );
5658 DeleteFile(msifile);
5661 static void test_removefiles(void)
5663 MSIHANDLE hpkg;
5664 UINT r;
5665 MSIHANDLE hdb;
5667 hdb = create_package_db();
5668 ok ( hdb, "failed to create package database\n" );
5670 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
5671 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
5673 r = create_feature_table( hdb );
5674 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
5676 r = create_component_table( hdb );
5677 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
5679 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
5680 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
5682 r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
5683 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
5685 r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
5686 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
5688 r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
5689 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
5691 r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
5692 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
5694 r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
5695 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
5697 r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
5698 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
5700 r = create_feature_components_table( hdb );
5701 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
5703 r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
5704 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
5706 r = add_feature_components_entry( hdb, "'one', 'helium'" );
5707 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
5709 r = add_feature_components_entry( hdb, "'one', 'lithium'" );
5710 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
5712 r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
5713 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
5715 r = add_feature_components_entry( hdb, "'one', 'boron'" );
5716 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
5718 r = add_feature_components_entry( hdb, "'one', 'carbon'" );
5719 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
5721 r = create_file_table( hdb );
5722 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
5724 r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
5725 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
5727 r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
5728 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
5730 r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
5731 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
5733 r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
5734 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
5736 r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
5737 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
5739 r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
5740 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
5742 r = create_remove_file_table( hdb );
5743 ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
5745 hpkg = package_from_db( hdb );
5746 ok( hpkg, "failed to create package\n");
5748 MsiCloseHandle( hdb );
5750 create_test_file( "hydrogen.txt" );
5751 create_test_file( "helium.txt" );
5752 create_test_file( "lithium.txt" );
5753 create_test_file( "beryllium.txt" );
5754 create_test_file( "boron.txt" );
5755 create_test_file( "carbon.txt" );
5757 r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
5758 ok( r == ERROR_SUCCESS, "set property failed\n");
5760 r = MsiDoAction( hpkg, "CostInitialize");
5761 ok( r == ERROR_SUCCESS, "cost init failed\n");
5763 r = MsiDoAction( hpkg, "FileCost");
5764 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
5766 r = MsiDoAction( hpkg, "CostFinalize");
5767 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
5769 r = MsiDoAction( hpkg, "InstallValidate");
5770 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
5772 r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
5773 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
5775 r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
5776 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
5778 r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
5779 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
5781 r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
5782 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
5784 r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
5785 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
5787 r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
5788 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
5790 r = MsiDoAction( hpkg, "RemoveFiles");
5791 ok( r == ERROR_SUCCESS, "remove files failed\n");
5793 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
5794 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
5795 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
5796 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
5797 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
5798 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
5800 MsiCloseHandle( hpkg );
5801 DeleteFileA(msifile);
5804 static void test_appsearch(void)
5806 MSIHANDLE hpkg;
5807 UINT r;
5808 MSIHANDLE hdb;
5809 CHAR prop[MAX_PATH];
5810 DWORD size = MAX_PATH;
5812 hdb = create_package_db();
5813 ok ( hdb, "failed to create package database\n" );
5815 r = create_appsearch_table( hdb );
5816 ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
5818 r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
5819 ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
5821 r = create_reglocator_table( hdb );
5822 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
5824 r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
5825 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
5827 r = create_signature_table( hdb );
5828 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
5830 r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
5831 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
5833 hpkg = package_from_db( hdb );
5834 ok( hpkg, "failed to create package\n");
5836 MsiCloseHandle( hdb );
5838 r = MsiDoAction( hpkg, "AppSearch" );
5839 ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
5841 r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
5842 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
5843 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
5845 MsiCloseHandle( hpkg );
5846 DeleteFileA(msifile);
5849 static void test_appsearch_complocator(void)
5851 MSIHANDLE hpkg, hdb;
5852 CHAR path[MAX_PATH];
5853 CHAR prop[MAX_PATH];
5854 LPSTR usersid;
5855 DWORD size;
5856 UINT r;
5858 get_user_sid(&usersid);
5859 if (!usersid)
5861 skip("ConvertSidToStringSidA is not available\n");
5862 return;
5865 create_test_file("FileName1");
5866 create_test_file("FileName4");
5867 set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE,
5868 "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
5870 create_test_file("FileName2");
5871 set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED,
5872 "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
5874 create_test_file("FileName3");
5875 set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED,
5876 "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
5878 create_test_file("FileName5");
5879 set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE,
5880 "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
5882 create_test_file("FileName6");
5883 set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE,
5884 "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
5886 create_test_file("FileName7");
5887 set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE,
5888 "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
5890 /* dir is FALSE, but we're pretending it's a directory */
5891 set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE,
5892 "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
5894 create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
5895 set_component_path("FileName8.dll", MSIINSTALLCONTEXT_MACHINE,
5896 "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
5898 create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
5899 set_component_path("FileName9.dll", MSIINSTALLCONTEXT_MACHINE,
5900 "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
5902 create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
5903 set_component_path("FileName10.dll", MSIINSTALLCONTEXT_MACHINE,
5904 "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
5906 hdb = create_package_db();
5907 ok(hdb, "Expected a valid database handle\n");
5909 r = create_appsearch_table(hdb);
5910 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5912 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
5913 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5915 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
5916 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5918 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
5919 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5921 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
5922 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5924 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
5925 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5927 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
5928 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5930 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
5931 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5933 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
5934 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5936 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
5937 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5939 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
5940 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5942 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
5943 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5945 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
5946 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5948 r = create_complocator_table(hdb);
5949 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5951 /* published component, machine, file, signature, misdbLocatorTypeFile */
5952 r = add_complocator_entry(hdb, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
5953 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5955 /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
5956 r = add_complocator_entry(hdb, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
5957 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5959 /* published component, user-managed, file, signature, misdbLocatorTypeFile */
5960 r = add_complocator_entry(hdb, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
5961 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5963 /* published component, machine, file, signature, misdbLocatorTypeDirectory */
5964 r = add_complocator_entry(hdb, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
5965 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5967 /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
5968 r = add_complocator_entry(hdb, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
5969 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5971 /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
5972 r = add_complocator_entry(hdb, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
5973 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5975 /* published component, machine, file, no signature, misdbLocatorTypeFile */
5976 r = add_complocator_entry(hdb, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
5977 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5979 /* unpublished component, no signature, misdbLocatorTypeDir */
5980 r = add_complocator_entry(hdb, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
5981 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5983 /* published component, no signature, dir does not exist misdbLocatorTypeDir */
5984 r = add_complocator_entry(hdb, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
5985 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5987 /* published component, signature w/ ver, misdbLocatorTypeFile */
5988 r = add_complocator_entry(hdb, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
5989 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5991 /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
5992 r = add_complocator_entry(hdb, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
5993 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5995 /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
5996 r = add_complocator_entry(hdb, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
5997 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5999 r = create_signature_table(hdb);
6000 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6002 r = add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
6003 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6005 r = add_signature_entry(hdb, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
6006 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6008 r = add_signature_entry(hdb, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
6009 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6011 r = add_signature_entry(hdb, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
6012 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6014 r = add_signature_entry(hdb, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
6015 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6017 r = add_signature_entry(hdb, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6018 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6020 r = add_signature_entry(hdb, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6021 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6023 r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6024 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6026 hpkg = package_from_db(hdb);
6027 ok(hpkg, "Expected a valid package handle\n");
6029 r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
6030 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6032 r = MsiDoAction(hpkg, "AppSearch");
6033 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6035 size = MAX_PATH;
6036 sprintf(path, "%s\\FileName1", CURR_DIR);
6037 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
6038 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6039 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6041 size = MAX_PATH;
6042 sprintf(path, "%s\\FileName2", CURR_DIR);
6043 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
6044 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6045 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6047 size = MAX_PATH;
6048 sprintf(path, "%s\\FileName3", CURR_DIR);
6049 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
6050 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6051 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6053 size = MAX_PATH;
6054 sprintf(path, "%s\\FileName4", CURR_DIR);
6055 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
6056 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6057 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6059 size = MAX_PATH;
6060 sprintf(path, "%s\\FileName5", CURR_DIR);
6061 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
6062 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6063 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6065 size = MAX_PATH;
6066 sprintf(path, "%s\\", CURR_DIR);
6067 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
6068 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6069 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6071 size = MAX_PATH;
6072 sprintf(path, "%s\\", CURR_DIR);
6073 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
6074 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6075 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6077 size = MAX_PATH;
6078 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
6079 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6080 ok(!lstrcmpA(prop, "october"), "Expected \"october\", got \"%s\"\n", prop);
6082 size = MAX_PATH;
6083 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
6084 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6085 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6087 size = MAX_PATH;
6088 sprintf(path, "%s\\FileName8.dll", CURR_DIR);
6089 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
6090 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6091 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6093 size = MAX_PATH;
6094 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
6095 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6096 todo_wine
6098 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6101 size = MAX_PATH;
6102 sprintf(path, "%s\\FileName10.dll", CURR_DIR);
6103 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
6104 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6105 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6107 delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
6108 MSIINSTALLCONTEXT_MACHINE, NULL);
6109 delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
6110 MSIINSTALLCONTEXT_USERUNMANAGED, usersid);
6111 delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
6112 MSIINSTALLCONTEXT_USERMANAGED, usersid);
6113 delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
6114 MSIINSTALLCONTEXT_MACHINE, NULL);
6115 delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
6116 MSIINSTALLCONTEXT_MACHINE, NULL);
6117 delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
6118 MSIINSTALLCONTEXT_MACHINE, NULL);
6119 delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
6120 MSIINSTALLCONTEXT_MACHINE, NULL);
6121 delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
6122 MSIINSTALLCONTEXT_MACHINE, NULL);
6123 delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
6124 MSIINSTALLCONTEXT_MACHINE, NULL);
6125 delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
6126 MSIINSTALLCONTEXT_MACHINE, NULL);
6128 DeleteFileA("FileName1");
6129 DeleteFileA("FileName2");
6130 DeleteFileA("FileName3");
6131 DeleteFileA("FileName4");
6132 DeleteFileA("FileName5");
6133 DeleteFileA("FileName6");
6134 DeleteFileA("FileName7");
6135 DeleteFileA("FileName8.dll");
6136 DeleteFileA("FileName9.dll");
6137 DeleteFileA("FileName10.dll");
6138 MsiCloseHandle(hpkg);
6139 DeleteFileA(msifile);
6142 static void test_appsearch_reglocator(void)
6144 MSIHANDLE hpkg, hdb;
6145 CHAR path[MAX_PATH];
6146 CHAR prop[MAX_PATH];
6147 DWORD binary[2];
6148 DWORD size, val;
6149 HKEY hklm, classes;
6150 HKEY hkcu, users;
6151 LPCSTR str;
6152 LONG res;
6153 UINT r;
6155 res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
6156 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6158 res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
6159 (const BYTE *)"regszdata", 10);
6160 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6162 res = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine", &hkcu);
6163 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6165 res = RegSetValueExA(hkcu, "Value1", 0, REG_SZ,
6166 (const BYTE *)"regszdata", 10);
6167 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6169 res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
6170 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6172 res = RegSetValueExA(users, "Value1", 0, REG_SZ,
6173 (const BYTE *)"regszdata", 10);
6174 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6176 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine", &hklm);
6177 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6179 res = RegSetValueA(hklm, NULL, REG_SZ, "defvalue", 8);
6180 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6182 res = RegSetValueExA(hklm, "Value1", 0, REG_SZ,
6183 (const BYTE *)"regszdata", 10);
6184 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6186 val = 42;
6187 res = RegSetValueExA(hklm, "Value2", 0, REG_DWORD,
6188 (const BYTE *)&val, sizeof(DWORD));
6189 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6191 val = -42;
6192 res = RegSetValueExA(hklm, "Value3", 0, REG_DWORD,
6193 (const BYTE *)&val, sizeof(DWORD));
6194 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6196 res = RegSetValueExA(hklm, "Value4", 0, REG_EXPAND_SZ,
6197 (const BYTE *)"%PATH%", 7);
6198 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6200 res = RegSetValueExA(hklm, "Value5", 0, REG_EXPAND_SZ,
6201 (const BYTE *)"my%NOVAR%", 10);
6202 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6204 res = RegSetValueExA(hklm, "Value6", 0, REG_MULTI_SZ,
6205 (const BYTE *)"one\0two\0", 9);
6206 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6208 binary[0] = 0x1234abcd;
6209 binary[1] = 0x567890ef;
6210 res = RegSetValueExA(hklm, "Value7", 0, REG_BINARY,
6211 (const BYTE *)binary, sizeof(binary));
6212 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6214 res = RegSetValueExA(hklm, "Value8", 0, REG_SZ,
6215 (const BYTE *)"#regszdata", 11);
6216 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6218 create_test_file("FileName1");
6219 sprintf(path, "%s\\FileName1", CURR_DIR);
6220 res = RegSetValueExA(hklm, "Value9", 0, REG_SZ,
6221 (const BYTE *)path, lstrlenA(path) + 1);
6222 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6224 sprintf(path, "%s\\FileName2", CURR_DIR);
6225 res = RegSetValueExA(hklm, "Value10", 0, REG_SZ,
6226 (const BYTE *)path, lstrlenA(path) + 1);
6227 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6229 lstrcpyA(path, CURR_DIR);
6230 res = RegSetValueExA(hklm, "Value11", 0, REG_SZ,
6231 (const BYTE *)path, lstrlenA(path) + 1);
6232 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6234 res = RegSetValueExA(hklm, "Value12", 0, REG_SZ,
6235 (const BYTE *)"", 1);
6236 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6238 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6239 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
6240 res = RegSetValueExA(hklm, "Value13", 0, REG_SZ,
6241 (const BYTE *)path, lstrlenA(path) + 1);
6242 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6244 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6245 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
6246 res = RegSetValueExA(hklm, "Value14", 0, REG_SZ,
6247 (const BYTE *)path, lstrlenA(path) + 1);
6248 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6250 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6251 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
6252 res = RegSetValueExA(hklm, "Value15", 0, REG_SZ,
6253 (const BYTE *)path, lstrlenA(path) + 1);
6254 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6256 hdb = create_package_db();
6257 ok(hdb, "Expected a valid database handle\n");
6259 r = create_appsearch_table(hdb);
6260 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6262 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
6263 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6265 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
6266 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6268 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
6269 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6271 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
6272 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6274 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
6275 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6277 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
6278 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6280 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
6281 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6283 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
6284 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6286 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
6287 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6289 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
6290 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6292 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
6293 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6295 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
6296 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6298 r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
6299 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6301 r = add_appsearch_entry(hdb, "'SIGPROP14', 'NewSignature14'");
6302 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6304 r = add_appsearch_entry(hdb, "'SIGPROP15', 'NewSignature15'");
6305 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6307 r = add_appsearch_entry(hdb, "'SIGPROP16', 'NewSignature16'");
6308 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6310 r = add_appsearch_entry(hdb, "'SIGPROP17', 'NewSignature17'");
6311 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6313 r = add_appsearch_entry(hdb, "'SIGPROP18', 'NewSignature18'");
6314 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6316 r = add_appsearch_entry(hdb, "'SIGPROP19', 'NewSignature19'");
6317 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6319 r = add_appsearch_entry(hdb, "'SIGPROP20', 'NewSignature20'");
6320 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6322 r = add_appsearch_entry(hdb, "'SIGPROP21', 'NewSignature21'");
6323 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6325 r = add_appsearch_entry(hdb, "'SIGPROP22', 'NewSignature22'");
6326 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6328 r = add_appsearch_entry(hdb, "'SIGPROP23', 'NewSignature23'");
6329 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6331 r = create_reglocator_table(hdb);
6332 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6334 /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
6335 str = "'NewSignature1', 2, 'Software\\Wine', 'Value1', 2";
6336 r = add_reglocator_entry(hdb, str);
6337 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6339 /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
6340 str = "'NewSignature2', 2, 'Software\\Wine', 'Value2', 2";
6341 r = add_reglocator_entry(hdb, str);
6342 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6344 /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
6345 str = "'NewSignature3', 2, 'Software\\Wine', 'Value3', 2";
6346 r = add_reglocator_entry(hdb, str);
6347 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6349 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
6350 str = "'NewSignature4', 2, 'Software\\Wine', 'Value4', 2";
6351 r = add_reglocator_entry(hdb, str);
6352 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6354 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
6355 str = "'NewSignature5', 2, 'Software\\Wine', 'Value5', 2";
6356 r = add_reglocator_entry(hdb, str);
6357 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6359 /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
6360 str = "'NewSignature6', 2, 'Software\\Wine', 'Value6', 2";
6361 r = add_reglocator_entry(hdb, str);
6362 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6364 /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
6365 str = "'NewSignature7', 2, 'Software\\Wine', 'Value7', 2";
6366 r = add_reglocator_entry(hdb, str);
6367 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6369 /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
6370 str = "'NewSignature8', 2, 'Software\\Wine', 'Value8', 2";
6371 r = add_reglocator_entry(hdb, str);
6372 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6374 /* HKLM, msidbLocatorTypeFileName, file exists */
6375 str = "'NewSignature9', 2, 'Software\\Wine', 'Value9', 1";
6376 r = add_reglocator_entry(hdb, str);
6377 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6379 /* HKLM, msidbLocatorTypeFileName, file does not exist */
6380 str = "'NewSignature10', 2, 'Software\\Wine', 'Value10', 1";
6381 r = add_reglocator_entry(hdb, str);
6382 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6384 /* HKLM, msidbLocatorTypeFileName, no signature */
6385 str = "'NewSignature11', 2, 'Software\\Wine', 'Value9', 1";
6386 r = add_reglocator_entry(hdb, str);
6387 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6389 /* HKLM, msidbLocatorTypeDirectory, file exists */
6390 str = "'NewSignature12', 2, 'Software\\Wine', 'Value9', 0";
6391 r = add_reglocator_entry(hdb, str);
6392 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6394 /* HKLM, msidbLocatorTypeDirectory, directory */
6395 str = "'NewSignature13', 2, 'Software\\Wine', 'Value11', 0";
6396 r = add_reglocator_entry(hdb, str);
6397 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6399 /* HKLM, msidbLocatorTypeDirectory, file exists, with signature */
6400 str = "'NewSignature14', 2, 'Software\\Wine', 'Value9', 0";
6401 r = add_reglocator_entry(hdb, str);
6402 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6404 /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
6405 str = "'NewSignature15', 0, 'Software\\Wine', 'Value1', 2";
6406 r = add_reglocator_entry(hdb, str);
6407 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6409 /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
6410 str = "'NewSignature16', 1, 'Software\\Wine', 'Value1', 2";
6411 r = add_reglocator_entry(hdb, str);
6412 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6414 /* HKU, msidbLocatorTypeRawValue, REG_SZ */
6415 str = "'NewSignature17', 3, 'S-1-5-18\\Software\\Wine', 'Value1', 2";
6416 r = add_reglocator_entry(hdb, str);
6417 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6419 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
6420 str = "'NewSignature18', 2, 'Software\\Wine', '', 2";
6421 r = add_reglocator_entry(hdb, str);
6422 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6424 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
6425 str = "'NewSignature19', 2, 'Software\\IDontExist', '', 2";
6426 r = add_reglocator_entry(hdb, str);
6427 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6429 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
6430 str = "'NewSignature20', 2, 'Software\\Wine', 'Value12', 2";
6431 r = add_reglocator_entry(hdb, str);
6432 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6434 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, signature */
6435 str = "'NewSignature21', 2, 'Software\\Wine', 'Value13', 1";
6436 r = add_reglocator_entry(hdb, str);
6437 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6439 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
6440 str = "'NewSignature22', 2, 'Software\\Wine', 'Value14', 1";
6441 r = add_reglocator_entry(hdb, str);
6442 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6444 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
6445 str = "'NewSignature23', 2, 'Software\\Wine', 'Value15', 1";
6446 r = add_reglocator_entry(hdb, str);
6447 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6449 r = create_signature_table(hdb);
6450 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6452 str = "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
6453 r = add_signature_entry(hdb, str);
6454 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6456 str = "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
6457 r = add_signature_entry(hdb, str);
6458 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6460 str = "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
6461 r = add_signature_entry(hdb, str);
6462 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6464 str = "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6465 r = add_signature_entry(hdb, str);
6466 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6468 str = "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6469 r = add_signature_entry(hdb, str);
6470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6472 str = "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6473 r = add_signature_entry(hdb, str);
6474 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6476 hpkg = package_from_db(hdb);
6477 ok(hpkg, "Expected a valid package handle\n");
6479 r = MsiDoAction(hpkg, "AppSearch");
6480 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6482 size = MAX_PATH;
6483 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
6484 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6485 ok(!lstrcmpA(prop, "regszdata"),
6486 "Expected \"regszdata\", got \"%s\"\n", prop);
6488 size = MAX_PATH;
6489 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
6490 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6491 ok(!lstrcmpA(prop, "#42"), "Expected \"#42\", got \"%s\"\n", prop);
6493 size = MAX_PATH;
6494 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
6495 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6496 ok(!lstrcmpA(prop, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop);
6498 ExpandEnvironmentStringsA("%PATH%", path, MAX_PATH);
6500 size = MAX_PATH;
6501 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
6502 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6503 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6505 size = MAX_PATH;
6506 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
6507 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6508 ok(!lstrcmpA(prop,
6509 "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop);
6511 size = MAX_PATH;
6512 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
6513 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6514 todo_wine
6516 ok(!memcmp(prop, "\0one\0two\0\0", 10),
6517 "Expected \"\\0one\\0two\\0\\0\"\n");
6520 size = MAX_PATH;
6521 lstrcpyA(path, "#xCDAB3412EF907856");
6522 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
6523 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6524 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6526 size = MAX_PATH;
6527 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
6528 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6529 ok(!lstrcmpA(prop, "##regszdata"),
6530 "Expected \"##regszdata\", got \"%s\"\n", prop);
6532 size = MAX_PATH;
6533 sprintf(path, "%s\\FileName1", CURR_DIR);
6534 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
6535 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6536 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6538 size = MAX_PATH;
6539 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
6540 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6541 todo_wine
6543 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6546 size = MAX_PATH;
6547 sprintf(path, "%s\\", CURR_DIR);
6548 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
6549 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6550 todo_wine
6552 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6555 size = MAX_PATH;
6556 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
6557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6558 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6560 size = MAX_PATH;
6561 sprintf(path, "%s\\", CURR_DIR);
6562 r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
6563 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6564 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6566 size = MAX_PATH;
6567 r = MsiGetPropertyA(hpkg, "SIGPROP14", prop, &size);
6568 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6569 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6571 size = MAX_PATH;
6572 r = MsiGetPropertyA(hpkg, "SIGPROP15", prop, &size);
6573 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6574 ok(!lstrcmpA(prop, "regszdata"),
6575 "Expected \"regszdata\", got \"%s\"\n", prop);
6577 size = MAX_PATH;
6578 r = MsiGetPropertyA(hpkg, "SIGPROP16", prop, &size);
6579 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6580 ok(!lstrcmpA(prop, "regszdata"),
6581 "Expected \"regszdata\", got \"%s\"\n", prop);
6583 size = MAX_PATH;
6584 r = MsiGetPropertyA(hpkg, "SIGPROP17", prop, &size);
6585 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6586 ok(!lstrcmpA(prop, "regszdata"),
6587 "Expected \"regszdata\", got \"%s\"\n", prop);
6589 size = MAX_PATH;
6590 r = MsiGetPropertyA(hpkg, "SIGPROP18", prop, &size);
6591 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6592 ok(!lstrcmpA(prop, "defvalue"),
6593 "Expected \"defvalue\", got \"%s\"\n", prop);
6595 size = MAX_PATH;
6596 r = MsiGetPropertyA(hpkg, "SIGPROP19", prop, &size);
6597 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6598 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6600 size = MAX_PATH;
6601 r = MsiGetPropertyA(hpkg, "SIGPROP20", prop, &size);
6602 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6603 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6605 size = MAX_PATH;
6606 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
6607 r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size);
6608 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6609 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6611 size = MAX_PATH;
6612 r = MsiGetPropertyA(hpkg, "SIGPROP22", prop, &size);
6613 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6614 todo_wine
6616 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6619 size = MAX_PATH;
6620 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
6621 r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size);
6622 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6623 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6625 RegSetValueA(hklm, NULL, REG_SZ, "", 0);
6626 RegDeleteValueA(hklm, "Value1");
6627 RegDeleteValueA(hklm, "Value2");
6628 RegDeleteValueA(hklm, "Value3");
6629 RegDeleteValueA(hklm, "Value4");
6630 RegDeleteValueA(hklm, "Value5");
6631 RegDeleteValueA(hklm, "Value6");
6632 RegDeleteValueA(hklm, "Value7");
6633 RegDeleteValueA(hklm, "Value8");
6634 RegDeleteValueA(hklm, "Value9");
6635 RegDeleteValueA(hklm, "Value10");
6636 RegDeleteValueA(hklm, "Value11");
6637 RegDeleteValueA(hklm, "Value12");
6638 RegDeleteValueA(hklm, "Value13");
6639 RegDeleteValueA(hklm, "Value14");
6640 RegDeleteValueA(hklm, "Value15");
6641 RegDeleteKeyA(hklm, "");
6642 RegCloseKey(hklm);
6644 RegDeleteValueA(classes, "Value1");
6645 RegDeleteKeyA(classes, "");
6646 RegCloseKey(classes);
6648 RegDeleteValueA(hkcu, "Value1");
6649 RegDeleteKeyA(hkcu, "");
6650 RegCloseKey(hkcu);
6652 RegDeleteValueA(users, "Value1");
6653 RegDeleteKeyA(users, "");
6654 RegCloseKey(users);
6656 DeleteFileA("FileName1");
6657 DeleteFileA("FileName3.dll");
6658 DeleteFileA("FileName4.dll");
6659 DeleteFileA("FileName5.dll");
6660 MsiCloseHandle(hpkg);
6661 DeleteFileA(msifile);
6664 static void delete_win_ini(LPCSTR file)
6666 CHAR path[MAX_PATH];
6668 GetWindowsDirectoryA(path, MAX_PATH);
6669 lstrcatA(path, "\\");
6670 lstrcatA(path, file);
6672 DeleteFileA(path);
6675 static void test_appsearch_inilocator(void)
6677 MSIHANDLE hpkg, hdb;
6678 CHAR path[MAX_PATH];
6679 CHAR prop[MAX_PATH];
6680 LPCSTR str;
6681 LPSTR ptr;
6682 DWORD size;
6683 UINT r;
6685 WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
6687 create_test_file("FileName1");
6688 sprintf(path, "%s\\FileName1", CURR_DIR);
6689 WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
6691 WritePrivateProfileStringA("Section", "Key3", CURR_DIR, "IniFile.ini");
6693 sprintf(path, "%s\\IDontExist", CURR_DIR);
6694 WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
6696 create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6697 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
6698 WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
6700 create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6701 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
6702 WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
6704 create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6705 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
6706 WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
6708 hdb = create_package_db();
6709 ok(hdb, "Expected a valid database handle\n");
6711 r = create_appsearch_table(hdb);
6712 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6714 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
6715 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6717 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
6718 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6720 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
6721 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6723 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
6724 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6726 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
6727 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6729 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
6730 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6732 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
6733 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6735 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
6736 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6738 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
6739 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6741 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
6742 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6744 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
6745 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6747 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
6748 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6750 r = create_inilocator_table(hdb);
6751 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6753 /* msidbLocatorTypeRawValue, field 1 */
6754 str = "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
6755 r = add_inilocator_entry(hdb, str);
6756 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6758 /* msidbLocatorTypeRawValue, field 2 */
6759 str = "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
6760 r = add_inilocator_entry(hdb, str);
6761 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6763 /* msidbLocatorTypeRawValue, entire field */
6764 str = "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
6765 r = add_inilocator_entry(hdb, str);
6766 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6768 /* msidbLocatorTypeFile */
6769 str = "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
6770 r = add_inilocator_entry(hdb, str);
6771 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6773 /* msidbLocatorTypeDirectory, file */
6774 str = "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
6775 r = add_inilocator_entry(hdb, str);
6776 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6778 /* msidbLocatorTypeDirectory, directory */
6779 str = "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
6780 r = add_inilocator_entry(hdb, str);
6781 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6783 /* msidbLocatorTypeFile, file, no signature */
6784 str = "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
6785 r = add_inilocator_entry(hdb, str);
6786 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6788 /* msidbLocatorTypeFile, dir, no signature */
6789 str = "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
6790 r = add_inilocator_entry(hdb, str);
6791 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6793 /* msidbLocatorTypeFile, file does not exist */
6794 str = "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
6795 r = add_inilocator_entry(hdb, str);
6796 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6798 /* msidbLocatorTypeFile, signature with version */
6799 str = "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1";
6800 r = add_inilocator_entry(hdb, str);
6801 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6803 /* msidbLocatorTypeFile, signature with version, ver > max */
6804 str = "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1";
6805 r = add_inilocator_entry(hdb, str);
6806 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6808 /* msidbLocatorTypeFile, signature with version, sig->name ignored */
6809 str = "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1";
6810 r = add_inilocator_entry(hdb, str);
6811 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6813 r = create_signature_table(hdb);
6814 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6816 r = add_signature_entry(hdb, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
6817 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6819 r = add_signature_entry(hdb, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
6820 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6822 r = add_signature_entry(hdb, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6823 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6825 r = add_signature_entry(hdb, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6826 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6828 r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6829 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6831 hpkg = package_from_db(hdb);
6832 ok(hpkg, "Expected a valid package handle\n");
6834 r = MsiDoAction(hpkg, "AppSearch");
6835 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6837 size = MAX_PATH;
6838 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
6839 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6840 ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop);
6842 size = MAX_PATH;
6843 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
6844 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6845 ok(!lstrcmpA(prop, "field2"), "Expected \"field2\", got \"%s\"\n", prop);
6847 size = MAX_PATH;
6848 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
6849 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6850 ok(!lstrcmpA(prop, "keydata,field2"),
6851 "Expected \"keydata,field2\", got \"%s\"\n", prop);
6853 size = MAX_PATH;
6854 sprintf(path, "%s\\FileName1", CURR_DIR);
6855 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
6856 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6857 todo_wine
6859 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6862 size = MAX_PATH;
6863 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
6864 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6865 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6867 size = MAX_PATH;
6868 sprintf(path, "%s\\", CURR_DIR);
6869 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
6870 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6871 todo_wine
6873 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6876 size = MAX_PATH;
6877 sprintf(path, "%s\\", CURR_DIR);
6878 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
6879 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6880 todo_wine
6882 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6885 size = MAX_PATH;
6886 lstrcpyA(path, CURR_DIR);
6887 ptr = strrchr(path, '\\');
6888 *(ptr + 1) = '\0';
6889 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
6890 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6891 todo_wine
6893 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6896 size = MAX_PATH;
6897 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
6898 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6899 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6901 size = MAX_PATH;
6902 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
6903 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
6904 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6905 todo_wine
6907 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6910 size = MAX_PATH;
6911 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
6912 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6913 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6915 size = MAX_PATH;
6916 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
6917 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
6918 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6919 todo_wine
6921 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6924 delete_win_ini("IniFile.ini");
6925 DeleteFileA("FileName1");
6926 DeleteFileA("FileName2.dll");
6927 DeleteFileA("FileName3.dll");
6928 DeleteFileA("FileName4.dll");
6929 MsiCloseHandle(hpkg);
6930 DeleteFileA(msifile);
6933 static void test_appsearch_drlocator(void)
6935 MSIHANDLE hpkg, hdb;
6936 CHAR path[MAX_PATH];
6937 CHAR prop[MAX_PATH];
6938 LPCSTR str;
6939 DWORD size;
6940 UINT r;
6942 create_test_file("FileName1");
6943 CreateDirectoryA("one", NULL);
6944 CreateDirectoryA("one\\two", NULL);
6945 CreateDirectoryA("one\\two\\three", NULL);
6946 create_test_file("one\\two\\three\\FileName2");
6947 CreateDirectoryA("another", NULL);
6948 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6949 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6950 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6952 hdb = create_package_db();
6953 ok(hdb, "Expected a valid database handle\n");
6955 r = create_appsearch_table(hdb);
6956 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6958 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
6959 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6961 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
6962 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6964 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
6965 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6967 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
6968 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6970 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
6971 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6973 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
6974 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6976 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
6977 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6979 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
6980 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6982 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
6983 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6985 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
6986 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6988 r = create_drlocator_table(hdb);
6989 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6991 /* no parent, full path, depth 0, signature */
6992 sprintf(path, "'NewSignature1', '', '%s', 0", CURR_DIR);
6993 r = add_drlocator_entry(hdb, path);
6994 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6996 /* no parent, full path, depth 0, no signature */
6997 sprintf(path, "'NewSignature2', '', '%s', 0", CURR_DIR);
6998 r = add_drlocator_entry(hdb, path);
6999 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7001 /* no parent, relative path, depth 0, no signature */
7002 sprintf(path, "'NewSignature3', '', '%s', 0", CURR_DIR + 3);
7003 r = add_drlocator_entry(hdb, path);
7004 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7006 /* no parent, full path, depth 2, signature */
7007 sprintf(path, "'NewSignature4', '', '%s', 2", CURR_DIR);
7008 r = add_drlocator_entry(hdb, path);
7009 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7011 /* no parent, full path, depth 3, signature */
7012 sprintf(path, "'NewSignature5', '', '%s', 3", CURR_DIR);
7013 r = add_drlocator_entry(hdb, path);
7014 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7016 /* no parent, full path, depth 1, signature is dir */
7017 sprintf(path, "'NewSignature6', '', '%s', 1", CURR_DIR);
7018 r = add_drlocator_entry(hdb, path);
7019 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7021 /* parent is in DrLocator, relative path, depth 0, signature */
7022 sprintf(path, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
7023 r = add_drlocator_entry(hdb, path);
7024 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7026 /* no parent, full path, depth 0, signature w/ version */
7027 sprintf(path, "'NewSignature8', '', '%s', 0", CURR_DIR);
7028 r = add_drlocator_entry(hdb, path);
7029 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7031 /* no parent, full path, depth 0, signature w/ version, ver > max */
7032 sprintf(path, "'NewSignature9', '', '%s', 0", CURR_DIR);
7033 r = add_drlocator_entry(hdb, path);
7034 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7036 /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
7037 sprintf(path, "'NewSignature10', '', '%s', 0", CURR_DIR);
7038 r = add_drlocator_entry(hdb, path);
7039 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7041 r = create_signature_table(hdb);
7042 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7044 str = "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
7045 r = add_signature_entry(hdb, str);
7046 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7048 str = "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
7049 r = add_signature_entry(hdb, str);
7050 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7052 str = "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
7053 r = add_signature_entry(hdb, str);
7054 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7056 str = "'NewSignature6', 'another', '', '', '', '', '', '', ''";
7057 r = add_signature_entry(hdb, str);
7058 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7060 str = "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
7061 r = add_signature_entry(hdb, str);
7062 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7064 str = "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7065 r = add_signature_entry(hdb, str);
7066 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7068 str = "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7069 r = add_signature_entry(hdb, str);
7070 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7072 str = "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7073 r = add_signature_entry(hdb, str);
7074 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7076 hpkg = package_from_db(hdb);
7077 ok(hpkg, "Expected a valid package handle\n");
7079 r = MsiDoAction(hpkg, "AppSearch");
7080 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7082 size = MAX_PATH;
7083 sprintf(path, "%s\\FileName1", CURR_DIR);
7084 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
7085 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7086 todo_wine
7088 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7091 size = MAX_PATH;
7092 sprintf(path, "%s\\", CURR_DIR);
7093 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
7094 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7095 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7097 size = MAX_PATH;
7098 sprintf(path, "%s\\", CURR_DIR);
7099 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
7100 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7101 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7103 size = MAX_PATH;
7104 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
7105 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7106 todo_wine
7108 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7111 size = MAX_PATH;
7112 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
7113 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
7114 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7115 todo_wine
7117 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7120 size = MAX_PATH;
7121 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
7122 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7123 todo_wine
7125 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7128 size = MAX_PATH;
7129 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
7130 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
7131 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7132 todo_wine
7134 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7137 size = MAX_PATH;
7138 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
7139 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
7140 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7141 todo_wine
7143 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7146 size = MAX_PATH;
7147 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
7148 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7149 todo_wine
7151 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7154 size = MAX_PATH;
7155 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
7156 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7157 todo_wine
7159 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7162 DeleteFileA("FileName1");
7163 DeleteFileA("FileName3.dll");
7164 DeleteFileA("FileName4.dll");
7165 DeleteFileA("FileName5.dll");
7166 DeleteFileA("one\\two\\three\\FileName2");
7167 RemoveDirectoryA("one\\two\\three");
7168 RemoveDirectoryA("one\\two");
7169 RemoveDirectoryA("one");
7170 RemoveDirectoryA("another");
7171 MsiCloseHandle(hpkg);
7172 DeleteFileA(msifile);
7175 static void test_featureparents(void)
7177 MSIHANDLE hpkg;
7178 UINT r;
7179 MSIHANDLE hdb;
7180 INSTALLSTATE state, action;
7182 hdb = create_package_db();
7183 ok ( hdb, "failed to create package database\n" );
7185 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
7186 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
7188 r = create_feature_table( hdb );
7189 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
7191 r = create_component_table( hdb );
7192 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
7194 r = create_feature_components_table( hdb );
7195 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
7197 r = create_file_table( hdb );
7198 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
7200 /* msidbFeatureAttributesFavorLocal */
7201 r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
7202 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7204 /* msidbFeatureAttributesFavorSource */
7205 r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
7206 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7208 /* msidbFeatureAttributesFavorLocal */
7209 r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
7210 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7212 /* disabled because of install level */
7213 r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
7214 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7216 /* child feature of disabled feature */
7217 r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
7218 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7220 /* component of disabled feature (install level) */
7221 r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
7222 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7224 /* component of disabled child feature (install level) */
7225 r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
7226 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7228 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
7229 r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
7230 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7232 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
7233 r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
7234 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7236 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
7237 r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
7238 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7240 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
7241 r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
7242 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7244 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
7245 r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
7246 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7248 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
7249 r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
7250 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7252 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
7253 r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
7254 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7256 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
7257 r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
7258 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7260 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
7261 r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
7263 r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
7264 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7266 r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
7267 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7269 r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
7270 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7272 r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
7273 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7275 r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
7276 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7278 r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
7279 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7281 r = add_feature_components_entry( hdb, "'orion', 'leo'" );
7282 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7284 r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
7285 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7287 r = add_feature_components_entry( hdb, "'orion', 'libra'" );
7288 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7290 r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
7291 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7293 r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
7294 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7296 r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
7297 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7299 r = add_feature_components_entry( hdb, "'orion', 'canis'" );
7300 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7302 r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
7303 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7305 r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
7306 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7308 r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
7309 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7311 r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
7312 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7314 r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
7315 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7317 r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
7318 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7320 r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
7321 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7323 r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
7324 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7326 r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
7327 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7329 r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
7330 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7332 r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
7333 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7335 r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
7336 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7338 r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
7339 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7341 r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
7342 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7344 r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
7345 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7347 hpkg = package_from_db( hdb );
7348 ok( hpkg, "failed to create package\n");
7350 MsiCloseHandle( hdb );
7352 r = MsiDoAction( hpkg, "CostInitialize");
7353 ok( r == ERROR_SUCCESS, "cost init failed\n");
7355 r = MsiDoAction( hpkg, "FileCost");
7356 ok( r == ERROR_SUCCESS, "file cost failed\n");
7358 r = MsiDoAction( hpkg, "CostFinalize");
7359 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7361 state = 0xdeadbee;
7362 action = 0xdeadbee;
7363 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
7364 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7365 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7366 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7368 state = 0xdeadbee;
7369 action = 0xdeadbee;
7370 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
7371 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7372 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7373 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7375 state = 0xdeadbee;
7376 action = 0xdeadbee;
7377 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
7378 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7379 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7380 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7382 state = 0xdeadbee;
7383 action = 0xdeadbee;
7384 r = MsiGetFeatureState(hpkg, "waters", &state, &action);
7385 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7386 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7387 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7389 state = 0xdeadbee;
7390 action = 0xdeadbee;
7391 r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
7392 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7393 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7394 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7396 state = 0xdeadbee;
7397 action = 0xdeadbee;
7398 r = MsiGetComponentState(hpkg, "leo", &state, &action);
7399 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7400 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7401 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7403 state = 0xdeadbee;
7404 action = 0xdeadbee;
7405 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
7406 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7407 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
7408 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
7410 state = 0xdeadbee;
7411 action = 0xdeadbee;
7412 r = MsiGetComponentState(hpkg, "libra", &state, &action);
7413 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7414 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
7415 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
7417 state = 0xdeadbee;
7418 action = 0xdeadbee;
7419 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
7420 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7421 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
7422 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
7424 state = 0xdeadbee;
7425 action = 0xdeadbee;
7426 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
7427 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7428 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
7429 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
7431 state = 0xdeadbee;
7432 action = 0xdeadbee;
7433 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
7434 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7435 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
7436 ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
7438 state = 0xdeadbee;
7439 action = 0xdeadbee;
7440 r = MsiGetComponentState(hpkg, "canis", &state, &action);
7441 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7442 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
7443 ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
7445 state = 0xdeadbee;
7446 action = 0xdeadbee;
7447 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
7448 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7449 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
7450 ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
7452 state = 0xdeadbee;
7453 action = 0xdeadbee;
7454 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
7455 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7456 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
7457 ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
7459 state = 0xdeadbee;
7460 action = 0xdeadbee;
7461 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
7462 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7463 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
7464 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
7466 state = 0xdeadbee;
7467 action = 0xdeadbee;
7468 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
7469 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7470 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
7471 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
7473 r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
7474 ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
7476 state = 0xdeadbee;
7477 action = 0xdeadbee;
7478 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
7479 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7480 ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
7481 ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
7483 state = 0xdeadbee;
7484 action = 0xdeadbee;
7485 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
7486 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7487 ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
7488 ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
7490 state = 0xdeadbee;
7491 action = 0xdeadbee;
7492 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
7493 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7494 ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
7495 ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
7497 state = 0xdeadbee;
7498 action = 0xdeadbee;
7499 r = MsiGetComponentState(hpkg, "leo", &state, &action);
7500 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7501 ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
7502 ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
7504 state = 0xdeadbee;
7505 action = 0xdeadbee;
7506 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
7507 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7508 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
7509 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
7511 state = 0xdeadbee;
7512 action = 0xdeadbee;
7513 r = MsiGetComponentState(hpkg, "libra", &state, &action);
7514 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7515 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
7516 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
7518 state = 0xdeadbee;
7519 action = 0xdeadbee;
7520 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
7521 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7522 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
7523 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
7525 state = 0xdeadbee;
7526 action = 0xdeadbee;
7527 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
7528 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7529 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
7530 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
7532 state = 0xdeadbee;
7533 action = 0xdeadbee;
7534 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
7535 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7536 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
7537 ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
7539 state = 0xdeadbee;
7540 action = 0xdeadbee;
7541 r = MsiGetComponentState(hpkg, "canis", &state, &action);
7542 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7543 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
7544 ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
7546 state = 0xdeadbee;
7547 action = 0xdeadbee;
7548 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
7549 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7550 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
7551 ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
7553 state = 0xdeadbee;
7554 action = 0xdeadbee;
7555 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
7556 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7557 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
7558 ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
7560 state = 0xdeadbee;
7561 action = 0xdeadbee;
7562 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
7563 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7564 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
7565 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
7567 state = 0xdeadbee;
7568 action = 0xdeadbee;
7569 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
7570 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7571 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
7572 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
7574 MsiCloseHandle(hpkg);
7575 DeleteFileA(msifile);
7578 static void test_installprops(void)
7580 MSIHANDLE hpkg, hdb;
7581 CHAR path[MAX_PATH];
7582 CHAR buf[MAX_PATH];
7583 DWORD size, type;
7584 LANGID langid;
7585 HKEY hkey1, hkey2;
7586 int res;
7587 UINT r;
7589 GetCurrentDirectory(MAX_PATH, path);
7590 lstrcat(path, "\\");
7591 lstrcat(path, msifile);
7593 hdb = create_package_db();
7594 ok( hdb, "failed to create database\n");
7596 hpkg = package_from_db(hdb);
7597 ok( hpkg, "failed to create package\n");
7599 MsiCloseHandle(hdb);
7601 size = MAX_PATH;
7602 r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
7603 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7604 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
7606 RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
7608 RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2);
7610 size = MAX_PATH;
7611 type = REG_SZ;
7612 *path = '\0';
7613 if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
7615 size = MAX_PATH;
7616 type = REG_SZ;
7617 RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
7620 /* win9x doesn't set this */
7621 if (*path)
7623 size = MAX_PATH;
7624 r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
7625 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7626 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
7629 size = MAX_PATH;
7630 type = REG_SZ;
7631 *path = '\0';
7632 if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
7634 size = MAX_PATH;
7635 type = REG_SZ;
7636 RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
7639 if (*path)
7641 size = MAX_PATH;
7642 r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
7643 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7644 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
7647 size = MAX_PATH;
7648 r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
7649 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7650 trace("VersionDatabase = %s\n", buf);
7652 size = MAX_PATH;
7653 r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
7654 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7655 trace("VersionMsi = %s\n", buf);
7657 size = MAX_PATH;
7658 r = MsiGetProperty(hpkg, "Date", buf, &size);
7659 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7660 trace("Date = %s\n", buf);
7662 size = MAX_PATH;
7663 r = MsiGetProperty(hpkg, "Time", buf, &size);
7664 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7665 trace("Time = %s\n", buf);
7667 size = MAX_PATH;
7668 r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
7669 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7670 trace("PackageCode = %s\n", buf);
7672 langid = GetUserDefaultLangID();
7673 sprintf(path, "%d", langid);
7675 size = MAX_PATH;
7676 r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
7677 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
7678 ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
7680 res = GetSystemMetrics(SM_CXSCREEN);
7681 size = MAX_PATH;
7682 r = MsiGetProperty(hpkg, "ScreenX", buf, &size);
7683 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
7685 res = GetSystemMetrics(SM_CYSCREEN);
7686 size = MAX_PATH;
7687 r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
7688 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
7690 CloseHandle(hkey1);
7691 CloseHandle(hkey2);
7692 MsiCloseHandle(hpkg);
7693 DeleteFile(msifile);
7696 static void test_launchconditions(void)
7698 MSIHANDLE hpkg;
7699 MSIHANDLE hdb;
7700 UINT r;
7702 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7704 hdb = create_package_db();
7705 ok( hdb, "failed to create package database\n" );
7707 r = create_launchcondition_table( hdb );
7708 ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
7710 r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
7711 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
7713 /* invalid condition */
7714 r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
7715 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
7717 hpkg = package_from_db( hdb );
7718 ok( hpkg, "failed to create package\n");
7720 MsiCloseHandle( hdb );
7722 r = MsiSetProperty( hpkg, "X", "1" );
7723 ok( r == ERROR_SUCCESS, "failed to set property\n" );
7725 /* invalid conditions are ignored */
7726 r = MsiDoAction( hpkg, "LaunchConditions" );
7727 ok( r == ERROR_SUCCESS, "cost init failed\n" );
7729 /* verify LaunchConditions still does some verification */
7730 r = MsiSetProperty( hpkg, "X", "2" );
7731 ok( r == ERROR_SUCCESS, "failed to set property\n" );
7733 r = MsiDoAction( hpkg, "LaunchConditions" );
7734 ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
7736 MsiCloseHandle( hpkg );
7737 DeleteFile( msifile );
7740 static void test_ccpsearch(void)
7742 MSIHANDLE hdb, hpkg;
7743 CHAR prop[MAX_PATH];
7744 DWORD size = MAX_PATH;
7745 UINT r;
7747 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7749 hdb = create_package_db();
7750 ok(hdb, "failed to create package database\n");
7752 r = create_ccpsearch_table(hdb);
7753 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7755 r = add_ccpsearch_entry(hdb, "'CCP_random'");
7756 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7758 r = add_ccpsearch_entry(hdb, "'RMCCP_random'");
7759 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7761 r = create_reglocator_table(hdb);
7762 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7764 r = add_reglocator_entry(hdb, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
7765 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7767 r = create_drlocator_table(hdb);
7768 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7770 r = add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
7771 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7773 r = create_signature_table(hdb);
7774 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7776 hpkg = package_from_db(hdb);
7777 ok(hpkg, "failed to create package\n");
7779 MsiCloseHandle(hdb);
7781 r = MsiDoAction(hpkg, "CCPSearch");
7782 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7784 r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
7785 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7786 ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
7788 MsiCloseHandle(hpkg);
7789 DeleteFileA(msifile);
7792 static void test_complocator(void)
7794 MSIHANDLE hdb, hpkg;
7795 UINT r;
7796 CHAR prop[MAX_PATH];
7797 CHAR expected[MAX_PATH];
7798 DWORD size = MAX_PATH;
7800 hdb = create_package_db();
7801 ok(hdb, "failed to create package database\n");
7803 r = create_appsearch_table(hdb);
7804 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7806 r = add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
7807 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7809 r = add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
7810 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7812 r = add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
7813 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7815 r = add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
7816 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7818 r = add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
7819 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7821 r = add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
7822 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7824 r = add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
7825 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7827 r = add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
7828 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7830 r = add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
7831 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7833 r = add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
7834 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7836 r = add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
7837 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7839 r = add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
7840 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7842 r = add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
7843 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7845 r = add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
7846 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7848 r = add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
7849 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7851 r = add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
7852 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7854 r = create_complocator_table(hdb);
7855 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7857 r = add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
7858 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7860 r = add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
7861 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7863 r = add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
7864 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7866 r = add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
7867 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7869 r = add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
7870 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7872 r = add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
7873 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7875 r = add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
7876 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7878 r = add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
7879 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7881 r = add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
7882 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7884 r = add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
7885 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7887 r = add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
7888 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7890 r = add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
7891 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7893 r = add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
7894 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7896 r = add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
7897 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7899 r = add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
7900 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7902 r = add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
7903 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7905 r = create_signature_table(hdb);
7906 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7908 r = add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
7909 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7911 r = add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
7912 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7914 r = add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
7915 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7917 r = add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
7918 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7920 r = add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
7921 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7923 r = add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
7924 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7926 r = add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
7927 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7929 r = add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
7930 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7932 hpkg = package_from_db(hdb);
7933 ok(hpkg, "failed to create package\n");
7935 MsiCloseHandle(hdb);
7937 create_test_file("abelisaurus");
7938 create_test_file("bactrosaurus");
7939 create_test_file("camelotia");
7940 create_test_file("diclonius");
7941 create_test_file("echinodon");
7942 create_test_file("falcarius");
7943 create_test_file("gallimimus");
7944 create_test_file("hagryphus");
7945 CreateDirectoryA("iguanodon", NULL);
7946 CreateDirectoryA("jobaria", NULL);
7947 CreateDirectoryA("kakuru", NULL);
7948 CreateDirectoryA("labocania", NULL);
7949 CreateDirectoryA("megaraptor", NULL);
7950 CreateDirectoryA("neosodon", NULL);
7951 CreateDirectoryA("olorotitan", NULL);
7952 CreateDirectoryA("pantydraco", NULL);
7954 set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE,
7955 "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL, FALSE);
7956 set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE,
7957 "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL, FALSE);
7958 set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE,
7959 "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL, FALSE);
7960 set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE,
7961 "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL, FALSE);
7962 set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE,
7963 "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL, FALSE);
7964 set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE,
7965 "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL, FALSE);
7966 set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE,
7967 "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL, FALSE);
7968 set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE,
7969 "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL, FALSE);
7971 r = MsiDoAction(hpkg, "AppSearch");
7972 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7974 size = MAX_PATH;
7975 r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
7976 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7978 lstrcpyA(expected, CURR_DIR);
7979 lstrcatA(expected, "\\abelisaurus");
7980 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
7981 "Expected %s or empty string, got %s\n", expected, prop);
7983 size = MAX_PATH;
7984 r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
7985 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7986 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
7988 size = MAX_PATH;
7989 r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
7990 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7991 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
7993 size = MAX_PATH;
7994 r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
7995 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7996 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
7998 size = MAX_PATH;
7999 r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
8000 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8002 lstrcpyA(expected, CURR_DIR);
8003 lstrcatA(expected, "\\");
8004 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
8005 "Expected %s or empty string, got %s\n", expected, prop);
8007 size = MAX_PATH;
8008 r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
8009 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8010 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8012 size = MAX_PATH;
8013 r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
8014 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8015 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8017 size = MAX_PATH;
8018 r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
8019 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8020 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8022 size = MAX_PATH;
8023 r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
8024 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8025 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8027 size = MAX_PATH;
8028 r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
8029 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8030 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8032 size = MAX_PATH;
8033 r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
8034 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8035 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8037 size = MAX_PATH;
8038 r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
8039 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8040 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8042 size = MAX_PATH;
8043 r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
8044 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8046 lstrcpyA(expected, CURR_DIR);
8047 lstrcatA(expected, "\\");
8048 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
8049 "Expected %s or empty string, got %s\n", expected, prop);
8051 size = MAX_PATH;
8052 r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
8053 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8055 lstrcpyA(expected, CURR_DIR);
8056 lstrcatA(expected, "\\neosodon\\");
8057 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
8058 "Expected %s or empty string, got %s\n", expected, prop);
8060 size = MAX_PATH;
8061 r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
8062 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8063 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8065 size = MAX_PATH;
8066 r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
8067 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8068 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8070 MsiCloseHandle(hpkg);
8071 DeleteFileA("abelisaurus");
8072 DeleteFileA("bactrosaurus");
8073 DeleteFileA("camelotia");
8074 DeleteFileA("diclonius");
8075 DeleteFileA("echinodon");
8076 DeleteFileA("falcarius");
8077 DeleteFileA("gallimimus");
8078 DeleteFileA("hagryphus");
8079 RemoveDirectoryA("iguanodon");
8080 RemoveDirectoryA("jobaria");
8081 RemoveDirectoryA("kakuru");
8082 RemoveDirectoryA("labocania");
8083 RemoveDirectoryA("megaraptor");
8084 RemoveDirectoryA("neosodon");
8085 RemoveDirectoryA("olorotitan");
8086 RemoveDirectoryA("pantydraco");
8087 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
8088 MSIINSTALLCONTEXT_MACHINE, NULL);
8089 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
8090 MSIINSTALLCONTEXT_MACHINE, NULL);
8091 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
8092 MSIINSTALLCONTEXT_MACHINE, NULL);
8093 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
8094 MSIINSTALLCONTEXT_MACHINE, NULL);
8095 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
8096 MSIINSTALLCONTEXT_MACHINE, NULL);
8097 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
8098 MSIINSTALLCONTEXT_MACHINE, NULL);
8099 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
8100 MSIINSTALLCONTEXT_MACHINE, NULL);
8101 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
8102 MSIINSTALLCONTEXT_MACHINE, NULL);
8103 DeleteFileA(msifile);
8106 static void set_suminfo_prop(MSIHANDLE db, DWORD prop, DWORD val)
8108 MSIHANDLE summary;
8109 UINT r;
8111 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
8112 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8114 r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
8115 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8117 r = MsiSummaryInfoPersist(summary);
8118 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
8120 MsiCloseHandle(summary);
8123 static void test_MsiGetSourcePath(void)
8125 MSIHANDLE hdb, hpkg;
8126 CHAR path[MAX_PATH];
8127 CHAR cwd[MAX_PATH];
8128 CHAR subsrc[MAX_PATH];
8129 CHAR sub2[MAX_PATH];
8130 DWORD size;
8131 UINT r;
8133 lstrcpyA(cwd, CURR_DIR);
8134 lstrcatA(cwd, "\\");
8136 lstrcpyA(subsrc, cwd);
8137 lstrcatA(subsrc, "subsource");
8138 lstrcatA(subsrc, "\\");
8140 lstrcpyA(sub2, subsrc);
8141 lstrcatA(sub2, "sub2");
8142 lstrcatA(sub2, "\\");
8144 /* uncompressed source */
8146 hdb = create_package_db();
8147 ok( hdb, "failed to create database\n");
8149 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
8151 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
8152 ok(r == S_OK, "failed\n");
8154 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
8155 ok(r == S_OK, "failed\n");
8157 r = add_directory_entry(hdb, "'SubDir2', 'SubDir', 'sub2'");
8158 ok(r == S_OK, "failed\n");
8160 r = MsiDatabaseCommit(hdb);
8161 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
8163 hpkg = package_from_db(hdb);
8164 ok(hpkg, "failed to create package\n");
8166 MsiCloseHandle(hdb);
8168 /* invalid database handle */
8169 size = MAX_PATH;
8170 lstrcpyA(path, "kiwi");
8171 r = MsiGetSourcePath(-1, "TARGETDIR", path, &size);
8172 ok(r == ERROR_INVALID_HANDLE,
8173 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
8174 ok(!lstrcmpA(path, "kiwi"),
8175 "Expected path to be unchanged, got \"%s\"\n", path);
8176 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8178 /* NULL szFolder */
8179 size = MAX_PATH;
8180 lstrcpyA(path, "kiwi");
8181 r = MsiGetSourcePath(hpkg, NULL, path, &size);
8182 ok(r == ERROR_INVALID_PARAMETER,
8183 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
8184 ok(!lstrcmpA(path, "kiwi"),
8185 "Expected path to be unchanged, got \"%s\"\n", path);
8186 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8188 /* empty szFolder */
8189 size = MAX_PATH;
8190 lstrcpyA(path, "kiwi");
8191 r = MsiGetSourcePath(hpkg, "", path, &size);
8192 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8193 ok(!lstrcmpA(path, "kiwi"),
8194 "Expected path to be unchanged, got \"%s\"\n", path);
8195 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8197 /* try TARGETDIR */
8198 size = MAX_PATH;
8199 lstrcpyA(path, "kiwi");
8200 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8201 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8202 ok(!lstrcmpA(path, "kiwi"),
8203 "Expected path to be unchanged, got \"%s\"\n", path);
8204 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8206 /* try SourceDir */
8207 size = MAX_PATH;
8208 lstrcpyA(path, "kiwi");
8209 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8210 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8211 ok(!lstrcmpA(path, "kiwi"),
8212 "Expected path to be unchanged, got \"%s\"\n", path);
8213 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8215 /* try SOURCEDIR */
8216 size = MAX_PATH;
8217 lstrcpyA(path, "kiwi");
8218 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8219 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8220 ok(!lstrcmpA(path, "kiwi"),
8221 "Expected path to be unchanged, got \"%s\"\n", path);
8222 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8224 /* source path does not exist, but the property exists */
8225 size = MAX_PATH;
8226 lstrcpyA(path, "kiwi");
8227 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8228 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8229 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8230 ok(size == 0, "Expected 0, got %d\n", size);
8232 /* try SubDir */
8233 size = MAX_PATH;
8234 lstrcpyA(path, "kiwi");
8235 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8236 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8237 ok(!lstrcmpA(path, "kiwi"),
8238 "Expected path to be unchanged, got \"%s\"\n", path);
8239 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8241 /* try SubDir2 */
8242 size = MAX_PATH;
8243 lstrcpyA(path, "kiwi");
8244 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8245 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8246 ok(!lstrcmpA(path, "kiwi"),
8247 "Expected path to be unchanged, got \"%s\"\n", path);
8248 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8250 r = MsiDoAction(hpkg, "CostInitialize");
8251 ok(r == ERROR_SUCCESS, "cost init failed\n");
8253 /* try TARGETDIR after CostInitialize */
8254 size = MAX_PATH;
8255 lstrcpyA(path, "kiwi");
8256 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8257 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8258 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8259 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8261 /* try SourceDir after CostInitialize */
8262 size = MAX_PATH;
8263 lstrcpyA(path, "kiwi");
8264 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8265 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8266 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8267 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8269 /* try SOURCEDIR after CostInitialize */
8270 size = MAX_PATH;
8271 lstrcpyA(path, "kiwi");
8272 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8273 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8274 ok(!lstrcmpA(path, "kiwi"),
8275 "Expected path to be unchanged, got \"%s\"\n", path);
8276 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8278 /* source path does not exist, but the property exists */
8279 size = MAX_PATH;
8280 lstrcpyA(path, "kiwi");
8281 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8282 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8283 todo_wine
8285 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8286 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8289 /* try SubDir after CostInitialize */
8290 size = MAX_PATH;
8291 lstrcpyA(path, "kiwi");
8292 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8293 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8294 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8295 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8297 /* try SubDir2 after CostInitialize */
8298 size = MAX_PATH;
8299 lstrcpyA(path, "kiwi");
8300 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8301 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8302 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
8303 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
8305 r = MsiDoAction(hpkg, "ResolveSource");
8306 ok(r == ERROR_SUCCESS, "file cost failed\n");
8308 /* try TARGETDIR after ResolveSource */
8309 size = MAX_PATH;
8310 lstrcpyA(path, "kiwi");
8311 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8312 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8313 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8314 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8316 /* try SourceDir after ResolveSource */
8317 size = MAX_PATH;
8318 lstrcpyA(path, "kiwi");
8319 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8320 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8321 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8322 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8324 /* try SOURCEDIR after ResolveSource */
8325 size = MAX_PATH;
8326 lstrcpyA(path, "kiwi");
8327 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8328 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8329 ok(!lstrcmpA(path, "kiwi"),
8330 "Expected path to be unchanged, got \"%s\"\n", path);
8331 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8333 /* source path does not exist, but the property exists */
8334 size = MAX_PATH;
8335 lstrcpyA(path, "kiwi");
8336 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8337 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8338 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8339 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8341 /* try SubDir after ResolveSource */
8342 size = MAX_PATH;
8343 lstrcpyA(path, "kiwi");
8344 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8345 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8346 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8347 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8349 /* try SubDir2 after ResolveSource */
8350 size = MAX_PATH;
8351 lstrcpyA(path, "kiwi");
8352 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8353 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8354 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
8355 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
8357 r = MsiDoAction(hpkg, "FileCost");
8358 ok(r == ERROR_SUCCESS, "file cost failed\n");
8360 /* try TARGETDIR after FileCost */
8361 size = MAX_PATH;
8362 lstrcpyA(path, "kiwi");
8363 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8364 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8365 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8366 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8368 /* try SourceDir after FileCost */
8369 size = MAX_PATH;
8370 lstrcpyA(path, "kiwi");
8371 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8372 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8373 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8374 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8376 /* try SOURCEDIR after FileCost */
8377 size = MAX_PATH;
8378 lstrcpyA(path, "kiwi");
8379 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8380 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8381 ok(!lstrcmpA(path, "kiwi"),
8382 "Expected path to be unchanged, got \"%s\"\n", path);
8383 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8385 /* try SubDir after FileCost */
8386 size = MAX_PATH;
8387 lstrcpyA(path, "kiwi");
8388 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8389 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8390 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8391 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8393 /* try SubDir2 after FileCost */
8394 size = MAX_PATH;
8395 lstrcpyA(path, "kiwi");
8396 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8397 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8398 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
8399 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
8401 r = MsiDoAction(hpkg, "CostFinalize");
8402 ok(r == ERROR_SUCCESS, "file cost failed\n");
8404 /* try TARGETDIR after CostFinalize */
8405 size = MAX_PATH;
8406 lstrcpyA(path, "kiwi");
8407 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8408 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8409 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8410 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8412 /* try SourceDir after CostFinalize */
8413 size = MAX_PATH;
8414 lstrcpyA(path, "kiwi");
8415 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8416 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8417 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8418 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8420 /* try SOURCEDIR after CostFinalize */
8421 size = MAX_PATH;
8422 lstrcpyA(path, "kiwi");
8423 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8424 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8425 ok(!lstrcmpA(path, "kiwi"),
8426 "Expected path to be unchanged, got \"%s\"\n", path);
8427 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8429 /* try SubDir after CostFinalize */
8430 size = MAX_PATH;
8431 lstrcpyA(path, "kiwi");
8432 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8433 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8434 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8435 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8437 /* try SubDir2 after CostFinalize */
8438 size = MAX_PATH;
8439 lstrcpyA(path, "kiwi");
8440 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8441 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8442 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
8443 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
8445 /* nonexistent directory */
8446 size = MAX_PATH;
8447 lstrcpyA(path, "kiwi");
8448 r = MsiGetSourcePath(hpkg, "IDontExist", path, &size);
8449 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8450 ok(!lstrcmpA(path, "kiwi"),
8451 "Expected path to be unchanged, got \"%s\"\n", path);
8452 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8454 /* NULL szPathBuf */
8455 size = MAX_PATH;
8456 r = MsiGetSourcePath(hpkg, "SourceDir", NULL, &size);
8457 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8458 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8460 /* NULL pcchPathBuf */
8461 lstrcpyA(path, "kiwi");
8462 r = MsiGetSourcePath(hpkg, "SourceDir", path, NULL);
8463 ok(r == ERROR_INVALID_PARAMETER,
8464 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
8465 ok(!lstrcmpA(path, "kiwi"),
8466 "Expected path to be unchanged, got \"%s\"\n", path);
8468 /* pcchPathBuf is 0 */
8469 size = 0;
8470 lstrcpyA(path, "kiwi");
8471 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8472 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
8473 ok(!lstrcmpA(path, "kiwi"),
8474 "Expected path to be unchanged, got \"%s\"\n", path);
8475 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8477 /* pcchPathBuf does not have room for NULL terminator */
8478 size = lstrlenA(cwd);
8479 lstrcpyA(path, "kiwi");
8480 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8481 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
8482 ok(!strncmp(path, cwd, lstrlenA(cwd) - 1),
8483 "Expected path with no backslash, got \"%s\"\n", path);
8484 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8486 /* pcchPathBuf has room for NULL terminator */
8487 size = lstrlenA(cwd) + 1;
8488 lstrcpyA(path, "kiwi");
8489 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8490 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8491 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8492 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8494 MsiCloseHandle(hpkg);
8496 /* compressed source */
8498 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
8499 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8501 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed);
8503 hpkg = package_from_db(hdb);
8504 ok(hpkg, "failed to create package\n");
8506 r = MsiDoAction(hpkg, "CostInitialize");
8507 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8508 r = MsiDoAction(hpkg, "FileCost");
8509 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8510 r = MsiDoAction(hpkg, "CostFinalize");
8511 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8513 /* try TARGETDIR after CostFinalize */
8514 size = MAX_PATH;
8515 lstrcpyA(path, "kiwi");
8516 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8517 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8518 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8519 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8521 /* try SourceDir after CostFinalize */
8522 size = MAX_PATH;
8523 lstrcpyA(path, "kiwi");
8524 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8525 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8526 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8527 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8529 /* try SOURCEDIR after CostFinalize */
8530 size = MAX_PATH;
8531 lstrcpyA(path, "kiwi");
8532 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8533 todo_wine
8535 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8536 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8537 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8540 /* try SubDir after CostFinalize */
8541 size = MAX_PATH;
8542 lstrcpyA(path, "kiwi");
8543 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8544 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8545 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8546 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8548 /* try SubDir2 after CostFinalize */
8549 size = MAX_PATH;
8550 lstrcpyA(path, "kiwi");
8551 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8552 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8553 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8554 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8556 MsiCloseHandle(hpkg);
8557 DeleteFile(msifile);
8560 static void test_shortlongsource(void)
8562 MSIHANDLE hdb, hpkg;
8563 CHAR path[MAX_PATH];
8564 CHAR cwd[MAX_PATH];
8565 CHAR subsrc[MAX_PATH];
8566 DWORD size;
8567 UINT r;
8569 lstrcpyA(cwd, CURR_DIR);
8570 lstrcatA(cwd, "\\");
8572 lstrcpyA(subsrc, cwd);
8573 lstrcatA(subsrc, "long");
8574 lstrcatA(subsrc, "\\");
8576 /* long file names */
8578 hdb = create_package_db();
8579 ok( hdb, "failed to create database\n");
8581 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
8583 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
8584 ok(r == S_OK, "failed\n");
8586 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'short|long'");
8587 ok(r == S_OK, "failed\n");
8589 /* CostInitialize:short */
8590 r = add_directory_entry(hdb, "'SubDir2', 'TARGETDIR', 'one|two'");
8591 ok(r == S_OK, "failed\n");
8593 /* CostInitialize:long */
8594 r = add_directory_entry(hdb, "'SubDir3', 'TARGETDIR', 'three|four'");
8595 ok(r == S_OK, "failed\n");
8597 /* FileCost:short */
8598 r = add_directory_entry(hdb, "'SubDir4', 'TARGETDIR', 'five|six'");
8599 ok(r == S_OK, "failed\n");
8601 /* FileCost:long */
8602 r = add_directory_entry(hdb, "'SubDir5', 'TARGETDIR', 'seven|eight'");
8603 ok(r == S_OK, "failed\n");
8605 /* CostFinalize:short */
8606 r = add_directory_entry(hdb, "'SubDir6', 'TARGETDIR', 'nine|ten'");
8607 ok(r == S_OK, "failed\n");
8609 /* CostFinalize:long */
8610 r = add_directory_entry(hdb, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
8611 ok(r == S_OK, "failed\n");
8613 MsiDatabaseCommit(hdb);
8615 hpkg = package_from_db(hdb);
8616 ok(hpkg, "failed to create package\n");
8618 MsiCloseHandle(hdb);
8620 CreateDirectoryA("one", NULL);
8621 CreateDirectoryA("four", NULL);
8623 r = MsiDoAction(hpkg, "CostInitialize");
8624 ok(r == ERROR_SUCCESS, "file cost failed\n");
8626 CreateDirectory("five", NULL);
8627 CreateDirectory("eight", NULL);
8629 r = MsiDoAction(hpkg, "FileCost");
8630 ok(r == ERROR_SUCCESS, "file cost failed\n");
8632 CreateDirectory("nine", NULL);
8633 CreateDirectory("twelve", NULL);
8635 r = MsiDoAction(hpkg, "CostFinalize");
8636 ok(r == ERROR_SUCCESS, "file cost failed\n");
8638 /* neither short nor long source directories exist */
8639 size = MAX_PATH;
8640 lstrcpyA(path, "kiwi");
8641 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8642 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8643 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8644 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8646 CreateDirectoryA("short", NULL);
8648 /* short source directory exists */
8649 size = MAX_PATH;
8650 lstrcpyA(path, "kiwi");
8651 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8652 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8653 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8654 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8656 CreateDirectoryA("long", NULL);
8658 /* both short and long source directories exist */
8659 size = MAX_PATH;
8660 lstrcpyA(path, "kiwi");
8661 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8662 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8663 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8664 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8666 lstrcpyA(subsrc, cwd);
8667 lstrcatA(subsrc, "two");
8668 lstrcatA(subsrc, "\\");
8670 /* short dir exists before CostInitialize */
8671 size = MAX_PATH;
8672 lstrcpyA(path, "kiwi");
8673 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8674 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8675 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8676 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8678 lstrcpyA(subsrc, cwd);
8679 lstrcatA(subsrc, "four");
8680 lstrcatA(subsrc, "\\");
8682 /* long dir exists before CostInitialize */
8683 size = MAX_PATH;
8684 lstrcpyA(path, "kiwi");
8685 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
8686 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8687 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8688 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8690 lstrcpyA(subsrc, cwd);
8691 lstrcatA(subsrc, "six");
8692 lstrcatA(subsrc, "\\");
8694 /* short dir exists before FileCost */
8695 size = MAX_PATH;
8696 lstrcpyA(path, "kiwi");
8697 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
8698 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8699 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8700 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8702 lstrcpyA(subsrc, cwd);
8703 lstrcatA(subsrc, "eight");
8704 lstrcatA(subsrc, "\\");
8706 /* long dir exists before FileCost */
8707 size = MAX_PATH;
8708 lstrcpyA(path, "kiwi");
8709 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
8710 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8711 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8712 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8714 lstrcpyA(subsrc, cwd);
8715 lstrcatA(subsrc, "ten");
8716 lstrcatA(subsrc, "\\");
8718 /* short dir exists before CostFinalize */
8719 size = MAX_PATH;
8720 lstrcpyA(path, "kiwi");
8721 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
8722 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8723 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8724 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8726 lstrcpyA(subsrc, cwd);
8727 lstrcatA(subsrc, "twelve");
8728 lstrcatA(subsrc, "\\");
8730 /* long dir exists before CostFinalize */
8731 size = MAX_PATH;
8732 lstrcpyA(path, "kiwi");
8733 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
8734 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8735 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8736 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8738 MsiCloseHandle(hpkg);
8739 RemoveDirectoryA("short");
8740 RemoveDirectoryA("long");
8741 RemoveDirectoryA("one");
8742 RemoveDirectoryA("four");
8743 RemoveDirectoryA("five");
8744 RemoveDirectoryA("eight");
8745 RemoveDirectoryA("nine");
8746 RemoveDirectoryA("twelve");
8748 /* short file names */
8750 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
8751 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8753 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
8755 hpkg = package_from_db(hdb);
8756 ok(hpkg, "failed to create package\n");
8758 MsiCloseHandle(hdb);
8760 CreateDirectoryA("one", NULL);
8761 CreateDirectoryA("four", NULL);
8763 r = MsiDoAction(hpkg, "CostInitialize");
8764 ok(r == ERROR_SUCCESS, "file cost failed\n");
8766 CreateDirectory("five", NULL);
8767 CreateDirectory("eight", NULL);
8769 r = MsiDoAction(hpkg, "FileCost");
8770 ok(r == ERROR_SUCCESS, "file cost failed\n");
8772 CreateDirectory("nine", NULL);
8773 CreateDirectory("twelve", NULL);
8775 r = MsiDoAction(hpkg, "CostFinalize");
8776 ok(r == ERROR_SUCCESS, "file cost failed\n");
8778 lstrcpyA(subsrc, cwd);
8779 lstrcatA(subsrc, "short");
8780 lstrcatA(subsrc, "\\");
8782 /* neither short nor long source directories exist */
8783 size = MAX_PATH;
8784 lstrcpyA(path, "kiwi");
8785 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8786 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8787 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8788 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8790 CreateDirectoryA("short", NULL);
8792 /* short source directory exists */
8793 size = MAX_PATH;
8794 lstrcpyA(path, "kiwi");
8795 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8796 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8797 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8798 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8800 CreateDirectoryA("long", NULL);
8802 /* both short and long source directories exist */
8803 size = MAX_PATH;
8804 lstrcpyA(path, "kiwi");
8805 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8806 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8807 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8808 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8810 lstrcpyA(subsrc, cwd);
8811 lstrcatA(subsrc, "one");
8812 lstrcatA(subsrc, "\\");
8814 /* short dir exists before CostInitialize */
8815 size = MAX_PATH;
8816 lstrcpyA(path, "kiwi");
8817 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8818 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8819 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8820 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8822 lstrcpyA(subsrc, cwd);
8823 lstrcatA(subsrc, "three");
8824 lstrcatA(subsrc, "\\");
8826 /* long dir exists before CostInitialize */
8827 size = MAX_PATH;
8828 lstrcpyA(path, "kiwi");
8829 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
8830 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8831 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8832 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8834 lstrcpyA(subsrc, cwd);
8835 lstrcatA(subsrc, "five");
8836 lstrcatA(subsrc, "\\");
8838 /* short dir exists before FileCost */
8839 size = MAX_PATH;
8840 lstrcpyA(path, "kiwi");
8841 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
8842 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8843 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8844 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8846 lstrcpyA(subsrc, cwd);
8847 lstrcatA(subsrc, "seven");
8848 lstrcatA(subsrc, "\\");
8850 /* long dir exists before FileCost */
8851 size = MAX_PATH;
8852 lstrcpyA(path, "kiwi");
8853 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
8854 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8855 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8856 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8858 lstrcpyA(subsrc, cwd);
8859 lstrcatA(subsrc, "nine");
8860 lstrcatA(subsrc, "\\");
8862 /* short dir exists before CostFinalize */
8863 size = MAX_PATH;
8864 lstrcpyA(path, "kiwi");
8865 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
8866 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8867 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8868 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8870 lstrcpyA(subsrc, cwd);
8871 lstrcatA(subsrc, "eleven");
8872 lstrcatA(subsrc, "\\");
8874 /* long dir exists before CostFinalize */
8875 size = MAX_PATH;
8876 lstrcpyA(path, "kiwi");
8877 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
8878 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8879 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8880 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8882 MsiCloseHandle(hpkg);
8883 RemoveDirectoryA("short");
8884 RemoveDirectoryA("long");
8885 RemoveDirectoryA("one");
8886 RemoveDirectoryA("four");
8887 RemoveDirectoryA("five");
8888 RemoveDirectoryA("eight");
8889 RemoveDirectoryA("nine");
8890 RemoveDirectoryA("twelve");
8891 DeleteFileA(msifile);
8894 static void test_sourcedir(void)
8896 MSIHANDLE hdb, hpkg;
8897 CHAR package[10];
8898 CHAR path[MAX_PATH];
8899 CHAR cwd[MAX_PATH];
8900 CHAR subsrc[MAX_PATH];
8901 DWORD size;
8902 UINT r;
8904 lstrcpyA(cwd, CURR_DIR);
8905 lstrcatA(cwd, "\\");
8907 lstrcpyA(subsrc, cwd);
8908 lstrcatA(subsrc, "long");
8909 lstrcatA(subsrc, "\\");
8911 hdb = create_package_db();
8912 ok( hdb, "failed to create database\n");
8914 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
8915 ok(r == S_OK, "failed\n");
8917 sprintf(package, "#%li", hdb);
8918 r = MsiOpenPackage(package, &hpkg);
8919 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8921 /* properties only */
8923 /* SourceDir prop */
8924 size = MAX_PATH;
8925 lstrcpyA(path, "kiwi");
8926 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
8927 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8928 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8929 ok(size == 0, "Expected 0, got %d\n", size);
8931 /* SOURCEDIR prop */
8932 size = MAX_PATH;
8933 lstrcpyA(path, "kiwi");
8934 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8935 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8936 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8937 ok(size == 0, "Expected 0, got %d\n", size);
8939 r = MsiDoAction(hpkg, "CostInitialize");
8940 ok(r == ERROR_SUCCESS, "file cost failed\n");
8942 /* SourceDir after CostInitialize */
8943 size = MAX_PATH;
8944 lstrcpyA(path, "kiwi");
8945 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
8946 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8947 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8948 ok(size == 0, "Expected 0, got %d\n", size);
8950 /* SOURCEDIR after CostInitialize */
8951 size = MAX_PATH;
8952 lstrcpyA(path, "kiwi");
8953 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8954 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8955 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8956 ok(size == 0, "Expected 0, got %d\n", size);
8958 r = MsiDoAction(hpkg, "FileCost");
8959 ok(r == ERROR_SUCCESS, "file cost failed\n");
8961 /* SourceDir after FileCost */
8962 size = MAX_PATH;
8963 lstrcpyA(path, "kiwi");
8964 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
8965 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8966 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8967 ok(size == 0, "Expected 0, got %d\n", size);
8969 /* SOURCEDIR after FileCost */
8970 size = MAX_PATH;
8971 lstrcpyA(path, "kiwi");
8972 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8973 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8974 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8975 ok(size == 0, "Expected 0, got %d\n", size);
8977 r = MsiDoAction(hpkg, "CostFinalize");
8978 ok(r == ERROR_SUCCESS, "file cost failed\n");
8980 /* SourceDir after CostFinalize */
8981 size = MAX_PATH;
8982 lstrcpyA(path, "kiwi");
8983 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
8984 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8985 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8986 ok(size == 0, "Expected 0, got %d\n", size);
8988 /* SOURCEDIR after CostFinalize */
8989 size = MAX_PATH;
8990 lstrcpyA(path, "kiwi");
8991 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8992 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8993 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8994 ok(size == 0, "Expected 0, got %d\n", size);
8996 r = MsiDoAction(hpkg, "ResolveSource");
8997 ok(r == ERROR_SUCCESS, "file cost failed\n");
8999 /* SourceDir after ResolveSource */
9000 size = MAX_PATH;
9001 lstrcpyA(path, "kiwi");
9002 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9003 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9004 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9005 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9007 /* SOURCEDIR after ResolveSource */
9008 size = MAX_PATH;
9009 lstrcpyA(path, "kiwi");
9010 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9011 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9012 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9013 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9015 /* random casing */
9016 size = MAX_PATH;
9017 lstrcpyA(path, "kiwi");
9018 r = MsiGetProperty(hpkg, "SoUrCeDiR", path, &size);
9019 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9020 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9021 ok(size == 0, "Expected 0, got %d\n", size);
9023 MsiCloseHandle(hpkg);
9025 /* reset the package state */
9026 sprintf(package, "#%li", hdb);
9027 r = MsiOpenPackage(package, &hpkg);
9028 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9030 /* test how MsiGetSourcePath affects the properties */
9032 /* SourceDir prop */
9033 size = MAX_PATH;
9034 lstrcpyA(path, "kiwi");
9035 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9036 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9037 todo_wine
9039 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9040 ok(size == 0, "Expected 0, got %d\n", size);
9043 size = MAX_PATH;
9044 lstrcpyA(path, "kiwi");
9045 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
9046 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9047 ok(!lstrcmpA(path, "kiwi"),
9048 "Expected path to be unchanged, got \"%s\"\n", path);
9049 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9051 /* SourceDir after MsiGetSourcePath */
9052 size = MAX_PATH;
9053 lstrcpyA(path, "kiwi");
9054 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9055 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9056 todo_wine
9058 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9059 ok(size == 0, "Expected 0, got %d\n", size);
9062 /* SOURCEDIR prop */
9063 size = MAX_PATH;
9064 lstrcpyA(path, "kiwi");
9065 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9066 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9067 todo_wine
9069 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9070 ok(size == 0, "Expected 0, got %d\n", size);
9073 size = MAX_PATH;
9074 lstrcpyA(path, "kiwi");
9075 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9076 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9077 ok(!lstrcmpA(path, "kiwi"),
9078 "Expected path to be unchanged, got \"%s\"\n", path);
9079 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9081 /* SOURCEDIR prop after MsiGetSourcePath */
9082 size = MAX_PATH;
9083 lstrcpyA(path, "kiwi");
9084 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9085 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9086 todo_wine
9088 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9089 ok(size == 0, "Expected 0, got %d\n", size);
9092 r = MsiDoAction(hpkg, "CostInitialize");
9093 ok(r == ERROR_SUCCESS, "file cost failed\n");
9095 /* SourceDir after CostInitialize */
9096 size = MAX_PATH;
9097 lstrcpyA(path, "kiwi");
9098 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9099 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9100 todo_wine
9102 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9103 ok(size == 0, "Expected 0, got %d\n", size);
9106 size = MAX_PATH;
9107 lstrcpyA(path, "kiwi");
9108 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
9109 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9110 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9111 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9113 /* SourceDir after MsiGetSourcePath */
9114 size = MAX_PATH;
9115 lstrcpyA(path, "kiwi");
9116 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9117 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9118 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9119 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9121 /* SOURCEDIR after CostInitialize */
9122 size = MAX_PATH;
9123 lstrcpyA(path, "kiwi");
9124 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9125 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9126 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9127 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9129 /* SOURCEDIR source path still does not exist */
9130 size = MAX_PATH;
9131 lstrcpyA(path, "kiwi");
9132 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9133 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9134 ok(!lstrcmpA(path, "kiwi"),
9135 "Expected path to be unchanged, got \"%s\"\n", path);
9136 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9138 r = MsiDoAction(hpkg, "FileCost");
9139 ok(r == ERROR_SUCCESS, "file cost failed\n");
9141 /* SourceDir after FileCost */
9142 size = MAX_PATH;
9143 lstrcpyA(path, "kiwi");
9144 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9145 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9146 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9147 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9149 /* SOURCEDIR after FileCost */
9150 size = MAX_PATH;
9151 lstrcpyA(path, "kiwi");
9152 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9153 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9154 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9155 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9157 /* SOURCEDIR source path still does not exist */
9158 size = MAX_PATH;
9159 lstrcpyA(path, "kiwi");
9160 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9161 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9162 ok(!lstrcmpA(path, "kiwi"),
9163 "Expected path to be unchanged, got \"%s\"\n", path);
9164 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9166 r = MsiDoAction(hpkg, "CostFinalize");
9167 ok(r == ERROR_SUCCESS, "file cost failed\n");
9169 /* SourceDir after CostFinalize */
9170 size = MAX_PATH;
9171 lstrcpyA(path, "kiwi");
9172 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9173 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9174 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9175 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9177 /* SOURCEDIR after CostFinalize */
9178 size = MAX_PATH;
9179 lstrcpyA(path, "kiwi");
9180 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9181 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9182 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9183 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9185 /* SOURCEDIR source path still does not exist */
9186 size = MAX_PATH;
9187 lstrcpyA(path, "kiwi");
9188 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9189 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9190 ok(!lstrcmpA(path, "kiwi"),
9191 "Expected path to be unchanged, got \"%s\"\n", path);
9192 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9194 r = MsiDoAction(hpkg, "ResolveSource");
9195 ok(r == ERROR_SUCCESS, "file cost failed\n");
9197 /* SourceDir after ResolveSource */
9198 size = MAX_PATH;
9199 lstrcpyA(path, "kiwi");
9200 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9201 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9202 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9203 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9205 /* SOURCEDIR after ResolveSource */
9206 size = MAX_PATH;
9207 lstrcpyA(path, "kiwi");
9208 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9209 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9210 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9211 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9213 /* SOURCEDIR source path still does not exist */
9214 size = MAX_PATH;
9215 lstrcpyA(path, "kiwi");
9216 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9217 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9218 ok(!lstrcmpA(path, "kiwi"),
9219 "Expected path to be unchanged, got \"%s\"\n", path);
9220 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9222 MsiCloseHandle(hdb);
9223 MsiCloseHandle(hpkg);
9224 DeleteFileA(msifile);
9227 struct access_res
9229 BOOL gothandle;
9230 DWORD lasterr;
9231 BOOL ignore;
9234 static const struct access_res create[16] =
9236 { TRUE, ERROR_SUCCESS, TRUE },
9237 { TRUE, ERROR_SUCCESS, TRUE },
9238 { TRUE, ERROR_SUCCESS, FALSE },
9239 { TRUE, ERROR_SUCCESS, FALSE },
9240 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9241 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9242 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9243 { TRUE, ERROR_SUCCESS, FALSE },
9244 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9245 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9246 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9247 { TRUE, ERROR_SUCCESS, TRUE },
9248 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9249 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9250 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9251 { TRUE, ERROR_SUCCESS, TRUE }
9254 static const struct access_res create_commit[16] =
9256 { TRUE, ERROR_SUCCESS, TRUE },
9257 { TRUE, ERROR_SUCCESS, TRUE },
9258 { TRUE, ERROR_SUCCESS, FALSE },
9259 { TRUE, ERROR_SUCCESS, FALSE },
9260 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9261 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9262 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9263 { TRUE, ERROR_SUCCESS, FALSE },
9264 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9265 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9266 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9267 { TRUE, ERROR_SUCCESS, TRUE },
9268 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9269 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9270 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9271 { TRUE, ERROR_SUCCESS, TRUE }
9274 static const struct access_res create_close[16] =
9276 { TRUE, ERROR_SUCCESS, FALSE },
9277 { TRUE, ERROR_SUCCESS, FALSE },
9278 { TRUE, ERROR_SUCCESS, FALSE },
9279 { TRUE, ERROR_SUCCESS, FALSE },
9280 { TRUE, ERROR_SUCCESS, FALSE },
9281 { TRUE, ERROR_SUCCESS, FALSE },
9282 { TRUE, ERROR_SUCCESS, FALSE },
9283 { TRUE, ERROR_SUCCESS, FALSE },
9284 { TRUE, ERROR_SUCCESS, FALSE },
9285 { TRUE, ERROR_SUCCESS, FALSE },
9286 { TRUE, ERROR_SUCCESS, FALSE },
9287 { TRUE, ERROR_SUCCESS, FALSE },
9288 { TRUE, ERROR_SUCCESS, FALSE },
9289 { TRUE, ERROR_SUCCESS, FALSE },
9290 { TRUE, ERROR_SUCCESS, FALSE },
9291 { TRUE, ERROR_SUCCESS }
9294 static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line)
9296 DWORD access = 0, share = 0;
9297 DWORD lasterr;
9298 HANDLE hfile;
9299 int i, j, idx = 0;
9301 for (i = 0; i < 4; i++)
9303 if (i == 0) access = 0;
9304 if (i == 1) access = GENERIC_READ;
9305 if (i == 2) access = GENERIC_WRITE;
9306 if (i == 3) access = GENERIC_READ | GENERIC_WRITE;
9308 for (j = 0; j < 4; j++)
9310 if (ares[idx].ignore)
9311 continue;
9313 if (j == 0) share = 0;
9314 if (j == 1) share = FILE_SHARE_READ;
9315 if (j == 2) share = FILE_SHARE_WRITE;
9316 if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE;
9318 SetLastError(0xdeadbeef);
9319 hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
9320 FILE_ATTRIBUTE_NORMAL, 0);
9321 lasterr = GetLastError();
9323 ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
9324 "(%d, handle, %d): Expected %d, got %d\n",
9325 line, idx, ares[idx].gothandle,
9326 (hfile != INVALID_HANDLE_VALUE));
9328 ok(lasterr == ares[idx].lasterr ||
9329 lasterr == 0xdeadbeef, /* win9x */
9330 "(%d, lasterr, %d): Expected %d, got %d\n",
9331 line, idx, ares[idx].lasterr, lasterr);
9333 CloseHandle(hfile);
9334 idx++;
9339 #define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
9341 static void test_access(void)
9343 MSIHANDLE hdb;
9344 UINT r;
9346 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
9347 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9349 test_file_access(msifile, create);
9351 r = MsiDatabaseCommit(hdb);
9352 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9354 test_file_access(msifile, create_commit);
9356 MsiCloseHandle(hdb);
9358 test_file_access(msifile, create_close);
9360 DeleteFileA(msifile);
9362 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATEDIRECT, &hdb);
9363 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9365 test_file_access(msifile, create);
9367 r = MsiDatabaseCommit(hdb);
9368 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9370 test_file_access(msifile, create_commit);
9372 MsiCloseHandle(hdb);
9374 test_file_access(msifile, create_close);
9376 DeleteFileA(msifile);
9379 static void test_emptypackage(void)
9381 MSIHANDLE hpkg, hdb, hsuminfo;
9382 MSIHANDLE hview, hrec;
9383 MSICONDITION condition;
9384 CHAR buffer[MAX_PATH];
9385 DWORD size;
9386 UINT r;
9388 r = MsiOpenPackageA("", &hpkg);
9389 todo_wine
9391 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9394 hdb = MsiGetActiveDatabase(hpkg);
9395 todo_wine
9397 ok(hdb != 0, "Expected a valid database handle\n");
9400 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Tables`", &hview);
9401 todo_wine
9403 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9405 r = MsiViewExecute(hview, 0);
9406 todo_wine
9408 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9411 r = MsiViewFetch(hview, &hrec);
9412 todo_wine
9414 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9417 size = MAX_PATH;
9418 r = MsiRecordGetString(hrec, 1, buffer, &size);
9419 todo_wine
9421 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9422 ok(!lstrcmpA(buffer, "_Property"),
9423 "Expected \"_Property\", got \"%s\"\n", buffer);
9426 MsiCloseHandle(hrec);
9428 r = MsiViewFetch(hview, &hrec);
9429 todo_wine
9431 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9434 size = MAX_PATH;
9435 r = MsiRecordGetString(hrec, 1, buffer, &size);
9436 todo_wine
9438 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9439 ok(!lstrcmpA(buffer, "#_FolderCache"),
9440 "Expected \"_Property\", got \"%s\"\n", buffer);
9443 MsiCloseHandle(hrec);
9444 MsiViewClose(hview);
9445 MsiCloseHandle(hview);
9447 condition = MsiDatabaseIsTablePersistentA(hdb, "_Property");
9448 todo_wine
9450 ok(condition == MSICONDITION_FALSE,
9451 "Expected MSICONDITION_FALSE, got %d\n", condition);
9454 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
9455 todo_wine
9457 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9459 r = MsiViewExecute(hview, 0);
9460 todo_wine
9462 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9465 /* _Property table is not empty */
9466 r = MsiViewFetch(hview, &hrec);
9467 todo_wine
9469 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9472 MsiCloseHandle(hrec);
9473 MsiViewClose(hview);
9474 MsiCloseHandle(hview);
9476 condition = MsiDatabaseIsTablePersistentA(hdb, "#_FolderCache");
9477 todo_wine
9479 ok(condition == MSICONDITION_FALSE,
9480 "Expected MSICONDITION_FALSE, got %d\n", condition);
9483 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `#_FolderCache`", &hview);
9484 todo_wine
9486 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9488 r = MsiViewExecute(hview, 0);
9489 todo_wine
9491 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9494 /* #_FolderCache is not empty */
9495 r = MsiViewFetch(hview, &hrec);
9496 todo_wine
9498 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9501 MsiCloseHandle(hrec);
9502 MsiViewClose(hview);
9503 MsiCloseHandle(hview);
9505 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Streams`", &hview);
9506 todo_wine
9508 ok(r == ERROR_BAD_QUERY_SYNTAX,
9509 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
9512 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Storages`", &hview);
9513 todo_wine
9515 ok(r == ERROR_BAD_QUERY_SYNTAX,
9516 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
9519 r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsuminfo);
9520 todo_wine
9522 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
9523 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
9526 MsiCloseHandle(hsuminfo);
9528 r = MsiDatabaseCommit(hdb);
9529 todo_wine
9531 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9534 MsiCloseHandle(hdb);
9535 MsiCloseHandle(hpkg);
9538 START_TEST(package)
9540 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
9542 test_createpackage();
9543 test_doaction();
9544 test_gettargetpath_bad();
9545 test_settargetpath();
9546 test_props();
9547 test_property_table();
9548 test_condition();
9549 test_msipackage();
9550 test_formatrecord2();
9551 test_states();
9552 test_getproperty();
9553 test_removefiles();
9554 test_appsearch();
9555 test_appsearch_complocator();
9556 test_appsearch_reglocator();
9557 test_appsearch_inilocator();
9558 test_appsearch_drlocator();
9559 test_featureparents();
9560 test_installprops();
9561 test_launchconditions();
9562 test_ccpsearch();
9563 test_complocator();
9564 test_MsiGetSourcePath();
9565 test_shortlongsource();
9566 test_sourcedir();
9567 test_access();
9568 test_emptypackage();